From 67339bab2aa1cc20b0ba0d55d7d6b5feb538607d Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Sat, 19 Feb 2011 07:49:49 -0500 Subject: [PATCH 1/3] Current code has problems with Ajax, for example when creating a user. There are missing headers and this commit is an attempt to fix this situation. --- libraries/common.lib.php | 14 +++++++++----- libraries/header.inc.php | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/libraries/common.lib.php b/libraries/common.lib.php index 95aaae6c95..a4c6a71bb3 100644 --- a/libraries/common.lib.php +++ b/libraries/common.lib.php @@ -2935,11 +2935,15 @@ function PMA_ajaxResponse($message, $success = true, $extra_data = array()) $response = array_merge($response, $extra_data); } - // Set the Content-Type header to JSON so that jQuery parses the response correctly - if(!isset($GLOBALS['is_header_sent'])) { - header('Cache-Control: no-cache'); - header("Content-Type: application/json"); - } + // Set the Content-Type header to JSON so that jQuery parses the + // response correctly. + // + // At this point, other headers might have been sent; + // even if $GLOBALS['is_header_sent'] is true, + // we have to send these additional headers. + header('Cache-Control: no-cache'); + header("Content-Type: application/json"); + echo json_encode($response); exit; } diff --git a/libraries/header.inc.php b/libraries/header.inc.php index 1720e80f62..807ec0af20 100644 --- a/libraries/header.inc.php +++ b/libraries/header.inc.php @@ -15,7 +15,7 @@ require_once './libraries/common.inc.php'; /** - * If this is an Ajax request, we do not need to generate all this output. + * This is not an Ajax request so we need to generate all this output. */ if (isset($GLOBALS['is_ajax_request']) && !$GLOBALS['is_ajax_request']) { From 624ec9c5f9ddeb2394b206ba38f500a7d5181f0a Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Sat, 19 Feb 2011 10:38:58 -0500 Subject: [PATCH 2/3] Make edit privileges panel more manageable --- js/server_privileges.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/js/server_privileges.js b/js/server_privileges.js index a18ec9f4ac..5fe839804d 100644 --- a/js/server_privileges.js +++ b/js/server_privileges.js @@ -212,6 +212,7 @@ $(document).ready(function() { width: 800, // height is a workaround for this Chrome problem: // http://bugs.jqueryui.com/ticket/4671 + // also it's interesting to be able to scroll this window height: 600, modal: true, buttons: button_options @@ -322,6 +323,7 @@ $(document).ready(function() { .append(data) .dialog({ width: 900, + height: 600, buttons: button_options }); //dialog options end displayPasswordGenerateButton(); From 4c7aa9cfee0f6135501242fb5708cfed40cc6be0 Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Sat, 19 Feb 2011 11:20:11 -0500 Subject: [PATCH 3/3] No need to show the "Hide query box" initially --- js/sql.js | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/js/sql.js b/js/sql.js index be6a7ab605..219b28c405 100644 --- a/js/sql.js +++ b/js/sql.js @@ -192,12 +192,15 @@ $(document).ready(function() { if (! $('#sqlqueryform').find('a').is('#togglequerybox')) { $('') .html(PMA_messages['strHideQueryBox']) - .appendTo("#sqlqueryform"); + .appendTo("#sqlqueryform") + // initially hidden because at this point, nothing else + // appears under the link + .hide(); // Attach the toggling of the query box visibility to a click $("#togglequerybox").bind('click', function() { var $link = $(this) - $link.siblings().slideToggle("medium"); + $link.siblings().slideToggle("fast"); if ($link.text() == PMA_messages['strHideQueryBox']) { $link.text(PMA_messages['strShowQueryBox']); } else { @@ -263,6 +266,7 @@ $(document).ready(function() { $('#sqlqueryresults').show(); $("#sqlqueryresults").html(data); $("#sqlqueryresults").trigger('appendAnchor'); + $('#togglequerybox').show(); if($("#togglequerybox").siblings(":visible").length > 0) { $("#togglequerybox").trigger('click'); }