From 68a4c2b24034e32f2822308ce26ad825e826438d Mon Sep 17 00:00:00 2001 From: Madhura Jayaratne Date: Sun, 29 Apr 2012 22:28:34 +0530 Subject: [PATCH] remove() the dialog properly. Now closing the dialog with the X have the same effect as closing it with buttons. --- js/db_structure.js | 14 ++++++++++++-- js/functions.js | 10 +++++++--- js/sql.js | 12 ++++++++---- js/tbl_structure.js | 20 ++++++++++++++++---- 4 files changed, 43 insertions(+), 13 deletions(-) diff --git a/js/db_structure.js b/js/db_structure.js index 5adff6ef27..e0b786495c 100644 --- a/js/db_structure.js +++ b/js/db_structure.js @@ -144,10 +144,14 @@ $(function() { */ var button_options = {}; // in the following function we need to use $(this) - button_options[PMA_messages['strCancel']] = function() {$(this).dialog('close').remove();} + button_options[PMA_messages['strCancel']] = function() { + $(this).dialog('close'); + }; var button_options_error = {}; - button_options_error[PMA_messages['strOK']] = function() {$(this).dialog('close').remove();} + button_options_error[PMA_messages['strOK']] = function() { + $(this).dialog('close'); + }; var $msgbox = PMA_ajaxShowMessage(); @@ -162,6 +166,9 @@ $(function() { width: 900, modal: true, open: PMA_verifyColumnsProperties, + close: function() { + $(this).remove(); + }, buttons : button_options_error })// end dialog options } else { @@ -173,6 +180,9 @@ $(function() { width: 900, modal: true, open: PMA_verifyColumnsProperties, + close: function() { + $(this).remove(); + }, buttons : button_options });// end dialog options //Remove the top menu container from the dialog diff --git a/js/functions.js b/js/functions.js index c7d2414e09..1c892e1dd6 100644 --- a/js/functions.js +++ b/js/functions.js @@ -1575,12 +1575,12 @@ function PMA_createTableDialog( $div, url , target) var button_options = {}; // in the following function we need to use $(this) button_options[PMA_messages['strCancel']] = function() { - $(this).closest('.ui-dialog-content').dialog('close').remove(); + $(this).closest('.ui-dialog-content').dialog('close'); }; var button_options_error = {}; button_options_error[PMA_messages['strOK']] = function() { - $(this).closest('.ui-dialog-content').dialog('close').remove(); + $(this).closest('.ui-dialog-content').dialog('close'); }; // allow create-table form only once @@ -1600,6 +1600,9 @@ function PMA_createTableDialog( $div, url , target) height: 230, width: 900, open: PMA_verifyColumnsProperties, + close: function() { + $(this).remove(); + }, buttons : button_options_error })// end dialog options //remove the redundant [Back] link in the error message. @@ -1660,6 +1663,7 @@ function PMA_createTableDialog( $div, url , target) // resize topmenu menuResize(); menuResize(); // somehow need to call it twice to work + $(this).remove(); }, buttons: button_options }); // end dialog options @@ -2549,7 +2553,7 @@ $(function() { }; button_options[PMA_messages['strCancel']] = function() { - $(this).dialog('close').remove(); + $(this).dialog('close'); }; $.get($(this).attr('href'), {'ajax_request': true}, function(data) { $('
') diff --git a/js/sql.js b/js/sql.js index bfacc0e877..58663dd592 100644 --- a/js/sql.js +++ b/js/sql.js @@ -381,10 +381,14 @@ $(function() { */ var button_options = {}; // in the following function we need to use $(this) - button_options[PMA_messages['strCancel']] = function() {$(this).dialog('close').remove();}; + button_options[PMA_messages['strCancel']] = function() { + $(this).dialog('close'); + }; var button_options_error = {}; - button_options_error[PMA_messages['strOK']] = function() {$(this).dialog('close').remove();}; + button_options_error[PMA_messages['strOK']] = function() { + $(this).dialog('close'); + }; var $form = $("#resultsForm"); var $msgbox = PMA_ajaxShowMessage(); @@ -399,7 +403,7 @@ $(function() { width: 900, open: PMA_verifyColumnsProperties, close: function(event, ui) { - $('#change_row_dialog').remove(); + $(this).remove(); }, buttons : button_options_error }); // end dialog options @@ -412,7 +416,7 @@ $(function() { width: 900, open: PMA_verifyColumnsProperties, close: function(event, ui) { - $('#change_row_dialog').remove(); + $(this).remove(); }, buttons : button_options }) diff --git a/js/tbl_structure.js b/js/tbl_structure.js index 44c0d28883..7ea41fc408 100644 --- a/js/tbl_structure.js +++ b/js/tbl_structure.js @@ -477,12 +477,12 @@ $(function() { var button_options = {}; // in the following function we need to use $(this) button_options[PMA_messages['strCancel']] = function() { - $(this).dialog('close').remove(); + $(this).dialog('close'); }; var button_options_error = {}; button_options_error[PMA_messages['strOK']] = function() { - $(this).dialog('close').remove(); + $(this).dialog('close'); }; var $msgbox = PMA_ajaxShowMessage(); @@ -496,6 +496,9 @@ $(function() { height: 230, width: 900, open: PMA_verifyColumnsProperties, + close: function() { + $(this).remove(); + }, modal: true, buttons : button_options_error }); // end dialog options @@ -507,6 +510,9 @@ $(function() { height: 600, width: 900, open: PMA_verifyColumnsProperties, + close: function() { + $(this).remove(); + }, modal: true, buttons : button_options }); // end dialog options @@ -549,12 +555,12 @@ function changeColumns(action,url) var button_options = {}; // in the following function we need to use $(this) button_options[PMA_messages['strCancel']] = function() { - $(this).dialog('close').remove(); + $(this).dialog('close'); }; var button_options_error = {}; button_options_error[PMA_messages['strOK']] = function() { - $(this).dialog('close').remove(); + $(this).dialog('close'); }; var $msgbox = PMA_ajaxShowMessage(); @@ -569,6 +575,9 @@ function changeColumns(action,url) width: 900, modal: true, open: PMA_verifyColumnsProperties, + close: function() { + $(this).remove(); + }, buttons : button_options_error }); // end dialog options } else { @@ -580,6 +589,9 @@ function changeColumns(action,url) width: 900, modal: true, open: PMA_verifyColumnsProperties, + close: function() { + $(this).remove(); + }, buttons : button_options }); // end dialog options $("#append_fields_form input[name=do_save_data]").addClass("ajax");