Attached Ajax event handler to Reload Privileges
This commit is contained in:
@@ -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('<div id="add_user_dialog"></div>');
|
||||
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) {
|
||||
$('<div id="reload_privileges_dialog"></div>')
|
||||
.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()
|
@@ -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
|
||||
. ' </fieldset>' . "\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('<a href="server_privileges.php?' . $GLOBALS['url_query'] . '&flush_privileges=1">', false);
|
||||
$flushnote->addParam('<a href="server_privileges.php?' . $GLOBALS['url_query'] . '&flush_privileges=1" id="reload_privileges_anchor">', false);
|
||||
$flushnote->addParam('</a>', false);
|
||||
$flushnote->display();
|
||||
}
|
||||
|
Reference in New Issue
Block a user