The branch, master has been updated
via ff56cbf5d901a34bc3884254f5f56ce2d2ee0ab2 (commit)
from f44ba87d59c814659fce2e13b602c5fa4cf2f1fe (commit)
- Log -----------------------------------------------------------------
commit ff56cbf5d901a34bc3884254f5f56ce2d2ee0ab2
Author: Marc Delisle <marc(a)infomarc.info>
Date: Thu Sep 22 10:48:29 2011 -0400
Fix bug 3411523 (SQL query tab broken) which was introduced when
applying the fix for bug #3383572 (Cannot execute saved query), which
works for the 3.4 branch.
-----------------------------------------------------------------------
Summary of changes:
js/sql.js | 122 ++++++++++++++++++++++++-------------------------------------
1 files changed, 48 insertions(+), 74 deletions(-)
diff --git a/js/sql.js b/js/sql.js
index 599865e..813bf68 100644
--- a/js/sql.js
+++ b/js/sql.js
@@ -138,16 +138,10 @@ $(document).ready(function() {
* @memberOf jQuery
* @name sqlqueryform_submit
*/
- $("#sqlqueryform.ajax input:submit").live('click', function(event)
{
+ $("#sqlqueryform.ajax").live('submit', function(event) {
event.preventDefault();
- var $form = $(this).closest("form");
- var clicked_button = $(this).attr('id');
-
- if ('button_submit_query' == clicked_button) {
-
$form.find("select[name=id_bookmark]").attr("value","");
- }
-
+ var $form = $(this);
if (! checkSqlQuery($form[0])) {
return false;
}
@@ -161,78 +155,58 @@ $(document).ready(function() {
PMA_prepareForAjaxRequest($form);
$.post($form.attr('action'), $form.serialize() , function(data) {
- if ('button_submit_query' == clicked_button) {
- if (data.success == true) {
- // fade out previous messages, if any
- $('.success').fadeOut();
- $('.sqlquery_message').fadeOut();
- // show a message that stays on screen
- if (typeof data.sql_query != 'undefined') {
- $('<div
class="sqlquery_message"></div>')
- .html(data.sql_query)
- .insertBefore('#sqlqueryform');
- // unnecessary div that came from data.sql_query
- $('.notice').remove();
- } else {
- $('#sqlqueryform').before(data.message);
- }
- $sqlqueryresults.show();
- // this happens if a USE command was typed
- if (typeof data.reload != 'undefined') {
- // Unbind the submit event before reloading. See bug #3295529
- $("#sqlqueryform.ajax").die('submit');
- $form.find('input[name=db]').val(data.db);
- // need to regenerate the whole upper part
- $form.find('input[name=ajax_request]').remove();
- $form.append('<input type="hidden"
name="reload" value="true" />');
- $.post('db_sql.php', $form.serialize(), function(data) {
- $('body').html(data);
- }); // end inner post
- }
- } else if (data.success == false ) {
- // show an error message that stays on screen
- $('#sqlqueryform').before(data.error);
- $sqlqueryresults.hide();
+ if (data.success == true) {
+ // fade out previous messages, if any
+ $('.success').fadeOut();
+ $('.sqlquery_message').fadeOut();
+ // show a message that stays on screen
+ if (typeof data.sql_query != 'undefined') {
+ $('<div
class="sqlquery_message"></div>')
+ .html(data.sql_query)
+ .insertBefore('#sqlqueryform');
+ // unnecessary div that came from data.sql_query
+ $('.notice').remove();
} else {
- // real results are returned
- // fade out previous messages, if any
- $('.success').fadeOut();
- $('.sqlquery_message').fadeOut();
- var $received_data = $(data);
- var $zero_row_results =
$received_data.find('textarea[name="sql_query"]');
- // if zero rows are returned from the query execution
- if ($zero_row_results.length > 0) {
- $('#sqlquery').val($zero_row_results.val());
- } else {
- $sqlqueryresults
- .show()
- .html(data)
- .trigger('makegrid');
- $('#togglequerybox').show();
- if
($("#togglequerybox").siblings(":visible").length > 0) {
- $("#togglequerybox").trigger('click');
- }
- PMA_init_slider();
- }
- }
- } else {
- // button_submit_bookmark
- //
- // view only
- if ('1' == data.action_bookmark) {
- $('#sqlquery').text(data.sql_query);
- // send to codemirror if possible
- setQuery(data.sql_query);
+ $('#sqlqueryform').before(data.message);
}
- // delete
- if ('2' == data.action_bookmark) {
- $("#id_bookmark option[value='" + data.id_bookmark +
"']").remove();
+ $sqlqueryresults.show();
+ // this happens if a USE command was typed
+ if (typeof data.reload != 'undefined') {
+ // Unbind the submit event before reloading. See bug #3295529
+ $("#sqlqueryform.ajax").die('submit');
+ $form.find('input[name=db]').val(data.db);
+ // need to regenerate the whole upper part
+ $form.find('input[name=ajax_request]').remove();
+ $form.append('<input type="hidden"
name="reload" value="true" />');
+ $.post('db_sql.php', $form.serialize(), function(data) {
+ $('body').html(data);
+ }); // end inner post
}
+ } else if (data.success == false ) {
+ // show an error message that stays on screen
+ $('#sqlqueryform').before(data.error);
+ $sqlqueryresults.hide();
+ } else {
+ // real results are returned
// fade out previous messages, if any
$('.success').fadeOut();
$('.sqlquery_message').fadeOut();
- // show a message that stays on screen
- $('#sqlqueryform').before(data.message);
+ var $received_data = $(data);
+ var $zero_row_results =
$received_data.find('textarea[name="sql_query"]');
+ // if zero rows are returned from the query execution
+ if ($zero_row_results.length > 0) {
+ $('#sqlquery').val($zero_row_results.val());
+ } else {
+ $sqlqueryresults
+ .show()
+ .html(data)
+ .trigger('makegrid');
+ $('#togglequerybox').show();
+ if
($("#togglequerybox").siblings(":visible").length > 0) {
+ $("#togglequerybox").trigger('click');
+ }
+ PMA_init_slider();
+ }
}
PMA_ajaxRemoveMessage($msgbox);
}); // end $.post()
hooks/post-receive
--
phpMyAdmin
Show replies by date