From fb6af7bafa7e5da3baaa9dcd5b69754ece3b6bd7 Mon Sep 17 00:00:00 2001 From: Rouslan Placella Date: Mon, 21 Jan 2013 00:25:11 +0000 Subject: [PATCH 1/3] There are no dialogs for changing/adding columns of a table --- js/functions.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/js/functions.js b/js/functions.js index 7ef3a081af..d76bf26e60 100644 --- a/js/functions.js +++ b/js/functions.js @@ -3864,11 +3864,6 @@ $(function () { $("#sqlqueryresults").html(data.sql_query); $("#result_query .notice").remove(); $("#result_query").prepend(data.message); - if ($("#change_column_dialog").length > 0) { - $("#change_column_dialog").dialog("close").remove(); - } else if ($("#add_columns").length > 0) { - $("#add_columns").dialog("close").remove(); - } /* Reload the field form */ if ($("#fieldsForm").length) { reloadFieldForm(data.message); From b11c4016d976adcaf4b9ff916ae8d6294f166990 Mon Sep 17 00:00:00 2001 From: Rouslan Placella Date: Mon, 21 Jan 2013 00:26:40 +0000 Subject: [PATCH 2/3] Table structure functionality belongs in tbl_structure.js file --- js/functions.js | 55 +-------------------------------------------- js/tbl_structure.js | 53 +++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+), 54 deletions(-) diff --git a/js/functions.js b/js/functions.js index d76bf26e60..a834ed59df 100644 --- a/js/functions.js +++ b/js/functions.js @@ -3824,57 +3824,4 @@ AJAX.registerOnload('functions.js', function () { $('a.login-link').live('click', function(e) { e.preventDefault(); window.location.reload(true); -}); - -/** - * jQuery coding for 'Change Table' and 'Add Column'. Used on tbl_structure.php * - * Attach Ajax Event handlers for Change Table - */ -$(function () { - /** - *Ajax action for submitting the "Column Change" and "Add Column" form - **/ - $(".append_fields_form.ajax").live('submit', function(event) { - event.preventDefault(); - /** - * @var the_form object referring to the export form - */ - var $form = $(this); - - /* - * First validate the form; if there is a problem, avoid submitting it - * - * checkTableEditForm() needs a pure element and not a jQuery object, - * this is why we pass $form[0] as a parameter (the jQuery object - * is actually an array of DOM elements) - */ - if (checkTableEditForm($form[0], $form.find('input[name=orig_num_fields]').val())) { - // OK, form passed validation step - PMA_prepareForAjaxRequest($form); - //User wants to submit the form - PMA_ajaxShowMessage(); - $.post($form.attr('action'), $form.serialize() + '&do_save_data=1', function(data) { - if ($("#sqlqueryresults").length != 0) { - $("#sqlqueryresults").remove(); - } else if ($(".error").length != 0) { - $(".error").remove(); - } - if (data.success == true) { - $("
").prependTo("#page_content"); - $("#sqlqueryresults").html(data.sql_query); - $("#result_query .notice").remove(); - $("#result_query").prepend(data.message); - /* Reload the field form */ - if ($("#fieldsForm").length) { - reloadFieldForm(data.message); - } else { - PMA_ajaxShowMessage(data.message); - } - PMA_reloadNavigation(); - } else { - PMA_ajaxShowMessage(data.error, false); - } - }); // end $.post() - } - }); // end change table button "do_save_data" -}); +}); \ No newline at end of file diff --git a/js/tbl_structure.js b/js/tbl_structure.js index 3c61b10a0c..3a84915b26 100644 --- a/js/tbl_structure.js +++ b/js/tbl_structure.js @@ -374,6 +374,59 @@ AJAX.registerOnload('tbl_structure.js', function() { }); }); +/** + * jQuery coding for 'Change Table' and 'Add Column'. Used on tbl_structure.php * + * Attach Ajax Event handlers for Change Table + */ +$(function () { + /** + *Ajax action for submitting the "Column Change" and "Add Column" form + **/ + $(".append_fields_form.ajax").live('submit', function(event) { + event.preventDefault(); + /** + * @var the_form object referring to the export form + */ + var $form = $(this); + + /* + * First validate the form; if there is a problem, avoid submitting it + * + * checkTableEditForm() needs a pure element and not a jQuery object, + * this is why we pass $form[0] as a parameter (the jQuery object + * is actually an array of DOM elements) + */ + if (checkTableEditForm($form[0], $form.find('input[name=orig_num_fields]').val())) { + // OK, form passed validation step + PMA_prepareForAjaxRequest($form); + //User wants to submit the form + PMA_ajaxShowMessage(); + $.post($form.attr('action'), $form.serialize() + '&do_save_data=1', function(data) { + if ($("#sqlqueryresults").length != 0) { + $("#sqlqueryresults").remove(); + } else if ($(".error").length != 0) { + $(".error").remove(); + } + if (data.success == true) { + $("
").prependTo("#page_content"); + $("#sqlqueryresults").html(data.sql_query); + $("#result_query .notice").remove(); + $("#result_query").prepend(data.message); + /* Reload the field form */ + if ($("#fieldsForm").length) { + reloadFieldForm(data.message); + } else { + PMA_ajaxShowMessage(data.message); + } + PMA_reloadNavigation(); + } else { + PMA_ajaxShowMessage(data.error, false); + } + }); // end $.post() + } + }); // end change table button "do_save_data" +}); + /** * Reload fields table */ From 26dc7d31410d94a19b0d44c77ea4d537d16ec877 Mon Sep 17 00:00:00 2001 From: Rouslan Placella Date: Mon, 21 Jan 2013 00:29:27 +0000 Subject: [PATCH 3/3] Bind events according to the new AJAX spec: http://wiki.phpmyadmin.net/pma/Page_loader#The_onload_event --- js/tbl_structure.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/js/tbl_structure.js b/js/tbl_structure.js index 3a84915b26..91e7a16ee3 100644 --- a/js/tbl_structure.js +++ b/js/tbl_structure.js @@ -375,14 +375,17 @@ AJAX.registerOnload('tbl_structure.js', function() { }); /** - * jQuery coding for 'Change Table' and 'Add Column'. Used on tbl_structure.php * + * jQuery coding for 'Change Table' and 'Add Column'. * Attach Ajax Event handlers for Change Table */ -$(function () { +AJAX.registerTeardown('tbl_structure.js', function() { + $(".append_fields_form.ajax").unbind('submit'); +}); +AJAX.registerOnload('tbl_structure.js', function() { /** *Ajax action for submitting the "Column Change" and "Add Column" form - **/ - $(".append_fields_form.ajax").live('submit', function(event) { + */ + $(".append_fields_form.ajax").bind('submit', function(event) { event.preventDefault(); /** * @var the_form object referring to the export form