Conditional Ajax for password change

This commit is contained in:
Marc Delisle
2011-02-02 12:53:20 -05:00
parent a3e0bc0223
commit f80b603a54
2 changed files with 14 additions and 3 deletions

View File

@@ -1979,8 +1979,9 @@ $(document).ready(function() {
/** /**
* Attach Ajax event handler on the change password anchor * 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(); event.preventDefault();
/** /**

View File

@@ -88,8 +88,13 @@ if ($server > 0
// Logout for advanced authentication // Logout for advanced authentication
if ($cfg['Server']['auth_type'] != 'config') { if ($cfg['Server']['auth_type'] != 'config') {
if ($cfg['ShowChgPassword']) { if ($cfg['ShowChgPassword']) {
if ($GLOBALS['cfg']['AjaxEnable']) {
$conditional_class = 'ajax';
} else {
$conditional_class = null;
}
PMA_printListItem(__('Change password'), 'li_change_password', 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 } // end if
if (PMA_MYSQL_MAJOR_VERSION < 2009) { 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 $mysql_help_page display a link to MySQL's manual
* @param string $target special target for $url * @param string $target special target for $url
* @param string $a_id id for the anchor, used for jQuery to hook in functions * @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 '<li id="' . $id . '"'; echo '<li id="' . $id . '"';
if (null !== $class) { if (null !== $class) {
@@ -376,6 +383,9 @@ function PMA_printListItem($name, $id = null, $url = null, $mysql_help_page = nu
if (null != $a_id) { if (null != $a_id) {
echo ' id="' . $a_id .'"'; echo ' id="' . $a_id .'"';
} }
if (null != $a_class) {
echo ' class="' . $a_class .'"';
}
echo '>'; echo '>';
} }