From 818965f8830ee877a4bbfe5f4255dd2db0b8ae10 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Thu, 30 Dec 2010 06:50:23 -0500 Subject: [PATCH 1/5] Inline edit links were not displayed in search results --- js/sql.js | 10 +++++----- js/tbl_select.js | 20 ++++++++++++++++++++ tbl_select.php | 1 + 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/js/sql.js b/js/sql.js index d9ecdea05..8e7bab276 100644 --- a/js/sql.js +++ b/js/sql.js @@ -54,10 +54,11 @@ function getFieldName($this_field, disp_mode) { * The function that iterates over each row in the table_results and appends a * new inline edit anchor to each table row. * - * @param disp_mode string */ -function appendInlineAnchor(disp_mode) { - if(disp_mode == 'vertical') { +function appendInlineAnchor() { + var disp_mode = $("#top_direction_dropdown").val(); + + if (disp_mode == 'vertical') { // there can be one or two tr containing this class, depending // on the ModifyDeleteAtLeft and ModifyDeleteAtRight cfg parameters $('#table_results tr') @@ -163,10 +164,9 @@ $(document).ready(function() { * Attach the {@link appendInlineAnchor} function to a custom event, which * will be triggered manually everytime the table of results is reloaded * @memberOf jQuery - * @name sqlqueryresults_live */ $("#sqlqueryresults").live('appendAnchor',function() { - appendInlineAnchor(disp_mode); + appendInlineAnchor(); }) /** diff --git a/js/tbl_select.js b/js/tbl_select.js index 6b03cced5..208daac73 100644 --- a/js/tbl_select.js +++ b/js/tbl_select.js @@ -22,6 +22,25 @@ $(document).ready(function() { cache: 'false' }); + /** + * Attach the {@link appendInlineAnchor} function to a custom event, which + * will be triggered manually everytime the table of results is reloaded; + * + * Needs appendInlineAnchor() which is defined in sql.js + * @memberOf jQuery + */ + $("#searchresults").live('appendAnchor',function() { + appendInlineAnchor(); + }) + + /** + * Trigger the appendAnchor event to prepare the first table for inline edit + * + * @memberOf jQuery + */ + $("#searchresults").trigger('appendAnchor'); + + $('') .html(PMA_messages['strShowSearchCriteria']) .insertAfter('#tbl_search_form') @@ -63,6 +82,7 @@ $(document).ready(function() { if (typeof response == 'string') { // found results $("#searchresults").html(response); + $("#searchresults").trigger('appendAnchor'); $('#tbl_search_form').hide(); $('#togglesearchform') // always start with the Show message diff --git a/tbl_select.php b/tbl_select.php index a680c86b8..6913a9aa0 100644 --- a/tbl_select.php +++ b/tbl_select.php @@ -16,6 +16,7 @@ require_once './libraries/common.inc.php'; require_once './libraries/mysql_charsets.lib.php'; +$GLOBALS['js_include'][] = 'sql.js'; $GLOBALS['js_include'][] = 'tbl_select.js'; $GLOBALS['js_include'][] = 'jquery/jquery-ui-1.8.custom.js'; $GLOBALS['js_include'][] = 'jquery/timepicker.js'; From 6f5e0c9407c9857cde3e7cf578711007983a74c6 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Thu, 30 Dec 2010 07:08:40 -0500 Subject: [PATCH 2/5] Unneeded wrapping of a jQuery object --- js/sql.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/js/sql.js b/js/sql.js index 8e7bab276..875b5017c 100644 --- a/js/sql.js +++ b/js/sql.js @@ -270,13 +270,13 @@ $(document).ready(function() { PMA_ajaxShowMessage(); /** - * @var the_form Object referring to the form element that paginates the results table + * @var $the_form Object referring to the form element that paginates the results table */ - var the_form = $(this).parent("form"); + var $the_form = $(this).parent("form"); - $(the_form).append(''); + $the_form.append(''); - $.post($(the_form).attr('action'), $(the_form).serialize(), function(data) { + $.post($the_form.attr('action'), $the_form.serialize(), function(data) { $("#sqlqueryresults").html(data); $("#sqlqueryresults").trigger('appendAnchor'); }) // end $.post() From 45ba32fa18caa705275fc03900a45f22c635daa8 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Thu, 30 Dec 2010 07:27:19 -0500 Subject: [PATCH 3/5] AJAX navi buttons do not work in search results, so use the same div as in normal browse results --- js/tbl_select.js | 27 ++++----------------------- tbl_select.php | 2 +- 2 files changed, 5 insertions(+), 24 deletions(-) diff --git a/js/tbl_select.js b/js/tbl_select.js index 208daac73..3c6cae338 100644 --- a/js/tbl_select.js +++ b/js/tbl_select.js @@ -22,25 +22,6 @@ $(document).ready(function() { cache: 'false' }); - /** - * Attach the {@link appendInlineAnchor} function to a custom event, which - * will be triggered manually everytime the table of results is reloaded; - * - * Needs appendInlineAnchor() which is defined in sql.js - * @memberOf jQuery - */ - $("#searchresults").live('appendAnchor',function() { - appendInlineAnchor(); - }) - - /** - * Trigger the appendAnchor event to prepare the first table for inline edit - * - * @memberOf jQuery - */ - $("#searchresults").trigger('appendAnchor'); - - $('') .html(PMA_messages['strShowSearchCriteria']) .insertAfter('#tbl_search_form') @@ -70,7 +51,7 @@ $(document).ready(function() { event.preventDefault(); // empty previous search results while we are waiting for new results - $("#searchresults").empty(); + $("#sqlqueryresults").empty(); PMA_ajaxShowMessage(PMA_messages['strSearching']); // add this hidden field just once @@ -81,8 +62,8 @@ $(document).ready(function() { $.post($search_form.attr('action'), $search_form.serialize(), function(response) { if (typeof response == 'string') { // found results - $("#searchresults").html(response); - $("#searchresults").trigger('appendAnchor'); + $("#sqlqueryresults").html(response); + $("#sqlqueryresults").trigger('appendAnchor'); $('#tbl_search_form').hide(); $('#togglesearchform') // always start with the Show message @@ -91,7 +72,7 @@ $(document).ready(function() { .show(); } else { // error message (zero rows) - $("#searchresults").html(response['message']); + $("#sqlqueryresults").html(response['message']); } }) }) diff --git a/tbl_select.php b/tbl_select.php index 6913a9aa0..67bf5d24b 100644 --- a/tbl_select.php +++ b/tbl_select.php @@ -303,7 +303,7 @@ $(function() { -
+
Date: Thu, 30 Dec 2010 07:45:15 -0500 Subject: [PATCH 4/5] Unneeded wrapping of a jQuery object --- js/db_operations.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/js/db_operations.js b/js/db_operations.js index 4e3dedf4f..502ca0d00 100644 --- a/js/db_operations.js +++ b/js/db_operations.js @@ -60,9 +60,9 @@ $(document).ready(function() { .after(data.sql_query); //Remove the empty notice div generated due to a NULL query passed to PMA_showMessage() - var notice_class = $("#topmenucontainer").next("div").find('.notice'); - if($(notice_class).text() == '') { - $(notice_class).remove(); + var $notice_class = $("#topmenucontainer").next("div").find('.notice'); + if ($notice_class.text() == '') { + $notice_class.remove(); } $("" + PMA_messages['strReloadDatabase'] + "?").dialog({ From ecdbb6dcc73aa97fc4df90d92e0ff4b4530f69e9 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Thu, 30 Dec 2010 08:14:46 -0500 Subject: [PATCH 5/5] Bug #3141319 Query execution time changes and disappears when no rows are returned --- js/sql.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/js/sql.js b/js/sql.js index 875b5017c..96483e0e7 100644 --- a/js/sql.js +++ b/js/sql.js @@ -224,7 +224,10 @@ $(document).ready(function() { $.post($(this).attr('action'), $(this).serialize() , function(data) { if(data.success == true) { - PMA_ajaxShowMessage(data.message); + // fade out previous success message, if any + $('.success').fadeOut(); + // show a message that stays on screen + $('#sqlqueryform').before(data.message); $('#sqlqueryresults').show(); // this happens if a USE command was typed if (typeof data.reload != 'undefined') { @@ -243,6 +246,7 @@ $(document).ready(function() { $('#sqlqueryresults').hide(); } else { + // real results are returned $('#sqlqueryresults').show(); $("#sqlqueryresults").html(data); $("#sqlqueryresults").trigger('appendAnchor');