The branch, master has been updated via e252eeb1fcf1da035d7944ad19c7ac2527287484 (commit) via 3cb56a2b9e44b76a06fa7a7278acb428f1cb2b0f (commit) via c450d876a6ed77cf52709db1a4b29ed8b1a97a29 (commit) via bdea8c332b36c063631aa4ececfd3419fe1150d4 (commit) via 59dfaee0d73ca68b580e5f462d016426b5b6e216 (commit) via 0f1a038b2d79b32f723f246d05300754d22f846e (commit) via 8604ba0303f46fe9717147e8454dfb4231fbafa4 (commit) via a8f258cb8d5755cfa539636f815a564fd27f9980 (commit) from aa83986a29c065e92dd8943a9e87f886faa17dbb (commit)
- Log ----------------------------------------------------------------- commit e252eeb1fcf1da035d7944ad19c7ac2527287484 Author: Marc Delisle marc@infomarc.info Date: Mon Jun 20 08:07:34 2011 -0400
ChangeLog Entry for AJAX feature
commit 3cb56a2b9e44b76a06fa7a7278acb428f1cb2b0f Merge: aa83986a29c065e92dd8943a9e87f886faa17dbb c450d876a6ed77cf52709db1a4b29ed8b1a97a29 Author: Marc Delisle marc@infomarc.info Date: Mon Jun 20 08:04:45 2011 -0400
Merge commit 'c450d876a6ed77cf52709db1a4b29ed8b1a97a29'
commit c450d876a6ed77cf52709db1a4b29ed8b1a97a29 Merge: bdea8c332b36c063631aa4ececfd3419fe1150d4 1be932c707eaac963afb1f6ea4db77a527b20926 Author: Thilanka Kaushalya lgtkaushalya@gmail.com Date: Sun Jun 19 23:23:29 2011 +0530
Merge branch 'master' of git://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin/phpmyadmin
commit bdea8c332b36c063631aa4ececfd3419fe1150d4 Author: Thilanka Kaushalya lgtkaushalya@gmail.com Date: Sun Jun 19 23:23:10 2011 +0530
Added ajax dialog for change in vertical rows
commit 59dfaee0d73ca68b580e5f462d016426b5b6e216 Author: Thilanka Kaushalya lgtkaushalya@gmail.com Date: Sun Jun 19 11:30:43 2011 +0530
Added the update resultsForm when there in single pageination
commit 0f1a038b2d79b32f723f246d05300754d22f846e Author: Thilanka Kaushalya lgtkaushalya@gmail.com Date: Sun Jun 19 10:42:43 2011 +0530
Fixed the bugs at table multi row change option
commit 8604ba0303f46fe9717147e8454dfb4231fbafa4 Merge: a8f258cb8d5755cfa539636f815a564fd27f9980 1f10c9b961f1ea62ae5903a321d2c9bca022e8ea Author: Thilanka Kaushalya lgtkaushalya@gmail.com Date: Sat Jun 18 22:38:44 2011 +0530
Merge branch 'master' of git://phpmyadmin.git.sourceforge.net/gitroot/phpmyadmin/phpmyadmin
commit a8f258cb8d5755cfa539636f815a564fd27f9980 Author: Thilanka Kaushalya lgtkaushalya@gmail.com Date: Sat Jun 18 22:36:54 2011 +0530
Added ajax dialog for table row change
-----------------------------------------------------------------------
Summary of changes: ChangeLog | 1 + js/messages.php | 2 + js/sql.js | 155 ++++++++++++++++++++++++++++++++++++++++- libraries/display_tbl.lib.php | 6 ++- sql.php | 1 + 5 files changed, 163 insertions(+), 2 deletions(-)
diff --git a/ChangeLog b/ChangeLog index 09b7813..bed0b3c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -20,6 +20,7 @@ phpMyAdmin - ChangeLog + [interface] Mouse-based column reordering in query results + AJAX for Insert to a table from database Structure page - Patch #3316969 PMA_ajaxShowMessage() does not respect timeout ++ AJAX for Change on multiple rows in table Browse
3.4.3.0 (not yet released) - bug #3311170 [sync] Missing helper icons in Synchronize diff --git a/js/messages.php b/js/messages.php index 222ad84..6863532 100644 --- a/js/messages.php +++ b/js/messages.php @@ -130,6 +130,8 @@ $js_messages['strInlineEdit'] = __('Inline Edit'); $js_messages['strEdit'] = __('Edit'); $js_messages['strSave'] = __('Save'); $js_messages['strHide'] = __('Hide'); +$js_messages['strNoRowSelected'] = __('No rows selected'); +$js_messages['strChangeTbl'] = __('Change');
/* For tbl_select.js */ $js_messages['strHideSearchCriteria'] = __('Hide search criteria'); diff --git a/js/sql.js b/js/sql.js index bc252a5..080a2e4 100644 --- a/js/sql.js +++ b/js/sql.js @@ -981,7 +981,7 @@ $(document).ready(function() { } } }) - +rowsDeleteForm /* * update the where_clause, remove the last appended ' AND ' * */ @@ -1057,6 +1057,159 @@ $(document).ready(function() { PMA_unInlineEditRow($del_hide, $chg_submit, $this_td, $input_siblings, '', disp_mode); } }) // End After editing, clicking again should post data + +/** + * Ajax Event for table row change + * */ + $("#resultsForm.ajax .mult_submit[value=edit]").live('click', function(event){ + event.preventDefault(); + + /*Check whether atleast one row is selected for change*/ + if ($("#table_results tbody tr, #table_results tbody tr td").hasClass("marked")) { + var div = $('<div id="change_row_dialog"></div>'); + + /** + * @var button_options Object that stores the options passed to jQueryUI + * dialog + */ + var button_options = {}; + // in the following function we need to use $(this) + button_options[PMA_messages['strCancel']] = function() {$(this).parent().dialog('close').remove();} + + var button_options_error = {}; + button_options_error[PMA_messages['strOK']] = function() {$(this).parent().dialog('close').remove();} + var $form = $("#resultsForm"); + var $msgbox = PMA_ajaxShowMessage(); + + $.get( $form.attr('action'), $form.serialize()+"&ajax_request=true&submit_mult=row_edit", function(data) { + //in the case of an error, show the error message returned. + if (data.success != undefined && data.success == false) { + div + .append(data.error) + .dialog({ + title: PMA_messages['strChangeTbl'], + height: 230, + width: 900, + open: PMA_verifyTypeOfAllColumns, + buttons : button_options_error + })// end dialog options + } else { + div + .append(data) + .dialog({ + title: PMA_messages['strChangeTbl'], + height: 600, + width: 900, + open: PMA_verifyTypeOfAllColumns, + buttons : button_options + }) + //Remove the top menu container from the dialog + .find("#topmenucontainer").hide() + ; // end dialog options + $(".insertRowTable").addClass("ajax"); + $("#buttonYes").addClass("ajax"); + } + PMA_ajaxRemoveMessage($msgbox); + }) // end $.get() + } else { + PMA_ajaxShowMessage(PMA_messages['strNoRowSelected']); + } + }); + +/** + * Click action for "Go" button in ajax dialog insertForm -> insertRowTable + */ + $("#insertForm .insertRowTable.ajax input[value=Go]").live('click', function(event) { + event.preventDefault(); + /** + * @var the_form object referring to the insert form + */ + var $form = $("#insertForm"); + PMA_prepareForAjaxRequest($form); + //User wants to submit the form + $.post($form.attr('action'), $form.serialize(), function(data) { + if (data.success == true) { + PMA_ajaxShowMessage(data.message); + if ($("#pageselector").length != 0) { + $("#pageselector").trigger('change'); + } else { + $("input[name=navig].ajax").trigger('click'); + } + + } else { + PMA_ajaxShowMessage(data.error); + $("#table_results tbody tr.marked .multi_checkbox " + + ", #table_results tbody tr td.marked .multi_checkbox").prop("checked", false); + $("#table_results tbody tr.marked .multi_checkbox " + + ", #table_results tbody tr td.marked .multi_checkbox").removeClass("last_clicked"); + $("#table_results tbody tr" + + ", #table_results tbody tr td").removeClass("marked"); + } + if ($("#change_row_dialog").length > 0) { + $("#change_row_dialog").dialog("close").remove(); + } + /**Update the row count at the tableForm*/ + $("#result_query").remove(); + $("#sqlqueryresults").prepend(data.sql_query); + $("#result_query .notice").remove(); + $("#result_query").prepend((data.message)); + }) // end $.post() + }) // end insert table button "Go" + +/** + * Click action for #buttonYes button in ajax dialog insertForm + */ + $("#buttonYes.ajax").live('click', function(event){ + event.preventDefault(); + /** + * @var the_form object referring to the insert form + */ + var $form = $("#insertForm"); + /**Get the submit type and the after insert type in the form*/ + var selected_submit_type = $("#insertForm").find("#actions_panel .control_at_footer option:selected").attr('value'); + var selected_after_insert = $("#insertForm").find("#actions_panel select[name=after_insert] option:selected").attr('value'); + $("#result_query").remove(); + PMA_prepareForAjaxRequest($form); + //User wants to submit the form + $.post($form.attr('action'), $form.serialize() , function(data) { + if (data.success == true) { + PMA_ajaxShowMessage(data.message); + if (selected_submit_type == "showinsert") { + $("#sqlqueryresults").prepend(data.sql_query); + $("#result_query .notice").remove(); + $("#result_query").prepend(data.message); + $("#table_results tbody tr.marked .multi_checkbox " + + ", #table_results tbody tr td.marked .multi_checkbox").prop("checked", false); + $("#table_results tbody tr.marked .multi_checkbox " + + ", #table_results tbody tr td.marked .multi_checkbox").removeClass("last_clicked"); + $("#table_results tbody tr" + + ", #table_results tbody tr td").removeClass("marked"); + } else { + if ($("#pageselector").length != 0) { + $("#pageselector").trigger('change'); + } else { + $("input[name=navig].ajax").trigger('click'); + } + $("#result_query").remove(); + $("#sqlqueryresults").prepend(data.sql_query); + $("#result_query .notice").remove(); + $("#result_query").prepend((data.message)); + } + } else { + PMA_ajaxShowMessage(data.error); + $("#table_results tbody tr.marked .multi_checkbox " + + ", #table_results tbody tr td.marked .multi_checkbox").prop("checked", false); + $("#table_results tbody tr.marked .multi_checkbox " + + ", #table_results tbody tr td.marked .multi_checkbox").removeClass("last_clicked"); + $("#table_results tbody tr" + + ", #table_results tbody tr td").removeClass("marked"); + } + if ($("#change_row_dialog").length > 0) { + $("#change_row_dialog").dialog("close").remove(); + } + }) // end $.post() + }); + }, 'top.frame_content') // end $(document).ready()
diff --git a/libraries/display_tbl.lib.php b/libraries/display_tbl.lib.php index 84e6f7b..16d3a9f 100644 --- a/libraries/display_tbl.lib.php +++ b/libraries/display_tbl.lib.php @@ -650,7 +650,11 @@ function PMA_displayTableHeaders(&$is_display, &$fields_meta, $fields_cnt = 0, $ // Start of form for multi-rows edit/delete/export
if ($is_display['del_lnk'] == 'dr' || $is_display['del_lnk'] == 'kp') { - echo '<form method="post" action="tbl_row_action.php" name="rowsDeleteForm" id="rowsDeleteForm">' . "\n"; + echo '<form method="post" action="tbl_row_action.php" name="resultsForm" id="resultsForm"'; + if ($GLOBALS['cfg']['AjaxEnable']) { + echo ' class="ajax" '; + } + echo '>' . "\n"; echo PMA_generate_common_hidden_inputs($db, $table, 1); echo '<input type="hidden" name="goto" value="sql.php" />' . "\n"; } diff --git a/sql.php b/sql.php index bd3ff46..f4ea949 100644 --- a/sql.php +++ b/sql.php @@ -15,6 +15,7 @@ require_once './libraries/check_user_privileges.lib.php'; require_once './libraries/bookmark.lib.php';
$GLOBALS['js_include'][] = 'jquery/jquery-ui-1.8.custom.js'; +$GLOBALS['js_include'][] = 'tbl_change.js';
if(isset($_SESSION['profiling'])) { $GLOBALS['js_include'][] = 'highcharts/highcharts.js';
hooks/post-receive