From f80b603a5499ce2d2ba219525cccce17cfdcdf8c Mon Sep 17 00:00:00 2001 From: Marc Delisle Date: Wed, 2 Feb 2011 12:53:20 -0500 Subject: [PATCH] Conditional Ajax for password change --- js/functions.js | 3 ++- main.php | 14 ++++++++++++-- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/js/functions.js b/js/functions.js index 731d7d81d..12831a132 100644 --- a/js/functions.js +++ b/js/functions.js @@ -1979,8 +1979,9 @@ $(document).ready(function() { /** * Attach Ajax event handler on the change password anchor + * @see $cfg['AjaxEnable'] */ - $('#change_password_anchor').live('click', function(event) { + $('#change_password_anchor.ajax').live('click', function(event) { event.preventDefault(); /** diff --git a/main.php b/main.php index 62fbc04da..881803395 100644 --- a/main.php +++ b/main.php @@ -88,8 +88,13 @@ if ($server > 0 // Logout for advanced authentication if ($cfg['Server']['auth_type'] != 'config') { if ($cfg['ShowChgPassword']) { + if ($GLOBALS['cfg']['AjaxEnable']) { + $conditional_class = 'ajax'; + } else { + $conditional_class = null; + } PMA_printListItem(__('Change password'), 'li_change_password', - './user_password.php?' . $common_url_query, null, null, 'change_password_anchor'); + './user_password.php?' . $common_url_query, null, null, 'change_password_anchor', null, $conditional_class); } } // end if if (PMA_MYSQL_MAJOR_VERSION < 2009) { @@ -360,8 +365,10 @@ if ($cfg['SuhosinDisableWarning'] == false && @ini_get('suhosin.request.max_valu * @param string $mysql_help_page display a link to MySQL's manual * @param string $target special target for $url * @param string $a_id id for the anchor, used for jQuery to hook in functions + * @param string $class class for the li element + * @param string $a_class class for the anchor element */ -function PMA_printListItem($name, $id = null, $url = null, $mysql_help_page = null, $target = null, $a_id = null, $class = null) +function PMA_printListItem($name, $id = null, $url = null, $mysql_help_page = null, $target = null, $a_id = null, $class = null, $a_class = null) { echo '
  • '; }