diff --git a/js/server_privileges.js b/js/server_privileges.js index b4c8b532b..0d4a6fe54 100755 --- a/js/server_privileges.js +++ b/js/server_privileges.js @@ -105,6 +105,7 @@ function suggestPassword(passwd_form) { * Paginate table of users * Flush privileges */ + $(document).ready(function() { /** @@ -118,10 +119,9 @@ $(document).ready(function() { PMA_ajaxShowMessage(); $(this).append('
'); - var add_user_url = $(this).attr("href"); - //add_user_url += "&ajax_request=true"; - $.get(add_user_url, {'ajax_request':true}, function(data) { - $("#add_user_dialog").prepend(data).dialog({ + $.get($(this).attr("href"), {'ajax_request':true}, function(data) { + $("#add_user_dialog") + .prepend(data).dialog({ title: 'Add a New User', width: 800, modal: true, @@ -135,4 +135,21 @@ $(document).ready(function() { });//end of Add New User AJAX event handler + /** + * Attach Ajax event handler to 'Reload Privileges' anchor + */ + $("#reload_privileges_anchor").click(function(event) { + event.preventDefault(); + + PMA_ajaxShowMessage("Reloading Privileges"); + $.get($(this).attr("href"), {'ajax_request': true}, function(data) { + $('
') + .prepend(data) + .dialog({ + title: 'Reload Privileges', + buttons: { "Close": function() {$(this).dialog("close")} } + }); //dialog options end + }); + }); //end of Reload Privileges Ajax event handler + }); //end $(document).ready() \ No newline at end of file diff --git a/server_privileges.php b/server_privileges.php index b7436ed40..5a682f561 100755 --- a/server_privileges.php +++ b/server_privileges.php @@ -1295,6 +1295,15 @@ if (isset($_REQUEST['flush_privileges'])) { $sql_query = 'FLUSH PRIVILEGES;'; PMA_DBI_query($sql_query); $message = PMA_Message::success(__('The privileges were reloaded successfully.')); + + /** + * If we are in an Ajax request, just display the message and exit. + * jQuery will take care of displaying the data with a dialog + */ + if( $GLOBALS['is_ajax_request'] ) { + $message->display(); + exit; + } } @@ -1596,7 +1605,7 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs . ' ' . "\n"; } // end if (display overview) $flushnote = new PMA_Message(__('Note: phpMyAdmin gets the users\' privileges directly from MySQL\'s privilege tables. The content of these tables may differ from the privileges the server uses, if they have been changed manually. In this case, you should %sreload the privileges%s before you continue.'), PMA_Message::NOTICE); - $flushnote->addParam('', false); + $flushnote->addParam('', false); $flushnote->addParam('', false); $flushnote->display(); }