The branch, master has been updated via f328f6d4a933cb4b0d0328687c214f809a919749 (commit) from d17b0e157d09c67524114f72ab7c1ff824c336f4 (commit)
- Log ----------------------------------------------------------------- commit f328f6d4a933cb4b0d0328687c214f809a919749 Author: Marc Delisle marc@infomarc.info Date: Sat Feb 5 07:18:42 2011 -0500
Conditional Ajax in Privileges
-----------------------------------------------------------------------
Summary of changes: js/server_privileges.js | 27 ++++++++++++++++++--------- server_privileges.php | 18 ++++++++++++------ 2 files changed, 30 insertions(+), 15 deletions(-)
diff --git a/js/server_privileges.js b/js/server_privileges.js index 01ffac4..a18ec9f 100644 --- a/js/server_privileges.js +++ b/js/server_privileges.js @@ -148,11 +148,12 @@ $(document).ready(function() { * * @see PMA_ajaxShowMessage() * @see appendNewUser() + * @see $cfg['AjaxEnable'] * @memberOf jQuery * @name add_user_click * */ - $("#fieldset_add_user a").live("click", function(event) { + $("#fieldset_add_user a.ajax").live("click", function(event) { /** @lends jQuery */ event.preventDefault();
@@ -225,10 +226,11 @@ $(document).ready(function() { * Ajax event handler for 'Reload Privileges' anchor * * @see PMA_ajaxShowMessage() + * @see $cfg['AjaxEnable'] * @memberOf jQuery * @name reload_privileges_click */ - $("#reload_privileges_anchor").live("click", function(event) { + $("#reload_privileges_anchor.ajax").live("click", function(event) { event.preventDefault();
PMA_ajaxShowMessage(PMA_messages['strReloadingPrivileges']); @@ -248,20 +250,23 @@ $(document).ready(function() { * AJAX handler for 'Revoke User' * * @see PMA_ajaxShowMessage() + * @see $cfg['AjaxEnable'] * @memberOf jQuery * @name revoke_user_click */ - $("#fieldset_delete_user_footer #buttonGo").live('click', function(event) { + $("#fieldset_delete_user_footer #buttonGo.ajax").live('click', function(event) { event.preventDefault();
PMA_ajaxShowMessage(PMA_messages['strRemovingSelectedUsers']); + + $form = $("#usersForm");
- $.post($("#usersForm").attr('action'), $("#usersForm").serialize() + "&delete=" + $(this).attr('value') + "&ajax_request=true", function(data) { + $.post($form.attr('action'), $form.serialize() + "&delete=" + $(this).attr('value') + "&ajax_request=true", function(data) { if(data.success == true) { PMA_ajaxShowMessage(data.message);
//Remove the revoked user from the users list - $("#usersForm").find("input:checkbox:checked").parents("tr").slideUp("medium", function() { + $form.find("input:checkbox:checked").parents("tr").slideUp("medium", function() { var this_user_initial = $(this).find('input:checkbox').val().charAt(0).toUpperCase(); $(this).remove();
@@ -271,7 +276,7 @@ $(document).ready(function() { }
//Re-check the classes of each row - $("#usersForm") + $form .find('tbody').find('tr:odd') .removeClass('even').addClass('odd') .end() @@ -296,8 +301,9 @@ $(document).ready(function() { * Step 1: Load Edit User Dialog * @memberOf jQuery * @name edit_user_click + * @see $cfg['AjaxEnable'] */ - $(".edit_user_anchor").live('click', function(event) { + $(".edit_user_anchor.ajax").live('click', function(event) { /** @lends jQuery */ event.preventDefault();
@@ -326,6 +332,7 @@ $(document).ready(function() { * Step 2: Submit the Edit User Dialog * * @see PMA_ajaxShowMessage() + * @see $cfg['AjaxEnable'] * @memberOf jQuery * @name edit_user_submit */ @@ -395,10 +402,11 @@ $(document).ready(function() { * AJAX handler for 'Export Privileges' * * @see PMA_ajaxShowMessage() + * @see $cfg['AjaxEnable'] * @memberOf jQuery * @name export_user_click */ - $(".export_user_anchor").live('click', function(event) { + $(".export_user_anchor.ajax").live('click', function(event) { /** @lends jQuery */ event.preventDefault();
@@ -424,10 +432,11 @@ $(document).ready(function() { * AJAX handler to Paginate the Users Table * * @see PMA_ajaxShowMessage() + * @see $cfg['AjaxEnable'] * @name paginate_users_table_click * @memberOf jQuery */ - $("#initials_table").find("a").live('click', function(event) { + $("#initials_table.ajax").find("a").live('click', function(event) { event.preventDefault();
PMA_ajaxShowMessage(); diff --git a/server_privileges.php b/server_privileges.php index c650300..499fea6 100644 --- a/server_privileges.php +++ b/server_privileges.php @@ -19,6 +19,12 @@ $GLOBALS['js_include'][] = 'jquery/jquery-ui-1.8.custom.js';
require './libraries/server_common.inc.php';
+if ($GLOBALS['cfg']['AjaxEnable']) { + $conditional_class = 'ajax'; +} else { + $conditional_class = ''; +} + /** * Messages are built using the message name */ @@ -1346,7 +1352,7 @@ if (isset($_REQUEST['flush_privileges'])) { /** * defines some standard links */ -$link_edit = '<a class="edit_user_anchor" href="server_privileges.php?' . $GLOBALS['url_query'] +$link_edit = '<a class="edit_user_anchor ' . $conditional_class . '" href="server_privileges.php?' . $GLOBALS['url_query'] . '&username=%s' . '&hostname=%s' . '&dbname=%s' @@ -1363,7 +1369,7 @@ $link_revoke = '<a href="server_privileges.php?' . $GLOBALS['url_query'] . PMA_getIcon('b_usrdrop.png', __('Revoke')) . '</a>';
-$link_export = '<a class="export_user_anchor" href="server_privileges.php?' . $GLOBALS['url_query'] +$link_export = '<a class="export_user_anchor ' . $conditional_class . '" href="server_privileges.php?' . $GLOBALS['url_query'] . '&username=%s' . '&hostname=%s' . '&initial=%s' @@ -1583,7 +1589,7 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs
uksort($array_initials, "strnatcasecmp");
- echo '<table id="initials_table" cellspacing="5"><tr>'; + echo '<table id="initials_table" class="' . $conditional_class . '" <cellspacing="5"><tr>'; foreach ($array_initials as $tmp_initial => $initial_was_found) { if ($initial_was_found) { echo '<td><a href="server_privileges.php?' . $GLOBALS['url_query'] . '&initial=' . urlencode($tmp_initial) . '">' . $tmp_initial . '</a></td>' . "\n"; @@ -1685,7 +1691,7 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs
// add/delete user fieldset echo ' <fieldset id="fieldset_add_user">' . "\n" - . ' <a href="server_privileges.php?' . $GLOBALS['url_query'] . '&adduser=1">' . "\n" + . ' <a href="server_privileges.php?' . $GLOBALS['url_query'] . '&adduser=1" class="' . $conditional_class . '">' . "\n" . PMA_getIcon('b_usradd.png') . ' ' . __('Add a new User') . '</a>' . "\n" . ' </fieldset>' . "\n" @@ -1702,7 +1708,7 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs . ' </label>' . "\n" . ' </fieldset>' . "\n" . ' <fieldset id="fieldset_delete_user_footer" class="tblFooters">' . "\n" - . ' <input type="submit" name="delete" value="' . __('Go') . '" id="buttonGo" />' . "\n" + . ' <input type="submit" name="delete" value="' . __('Go') . '" id="buttonGo" class="' . $conditional_class . '"/>' . "\n" . ' </fieldset>' . "\n" . '</form>' . "\n"; } else { @@ -1720,7 +1726,7 @@ if (empty($_REQUEST['adduser']) && (! isset($checkprivs) || ! strlen($checkprivs }
$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" id="reload_privileges_anchor">', false); + $flushnote->addParam('<a href="server_privileges.php?' . $GLOBALS['url_query'] . '&flush_privileges=1" id="reload_privileges_anchor" class="' . $conditional_class . '">', false); $flushnote->addParam('</a>', false); $flushnote->display(); }
hooks/post-receive