better disable radio buttons

This commit is contained in:
Roland Gruber 2012-07-22 17:45:58 +00:00
parent e0259fc24d
commit 7cc3a97be9
1 changed files with 15 additions and 4 deletions

View File

@ -293,12 +293,12 @@ class user extends baseType {
&& (!$ppolicyAvailable || $ppolicyLocked); && (!$ppolicyAvailable || $ppolicyLocked);
$dialog = '<div id="lam_accountStatusDialog" class="hidden">'; $dialog = '<div id="lam_accountStatusDialog" class="hidden">';
// show radio buttons for lock/unlock // show radio buttons for lock/unlock
$radioDisabled = ' readonly="readonly"'; $radioDisabled = true;
$lockChecked = ' checked="checked"'; $lockChecked = ' checked="checked"';
$unlockChecked = ''; $unlockChecked = '';
$onchange = ''; $onchange = '';
if ($partiallyLocked && !$fullyLocked) { if ($partiallyLocked && !$fullyLocked) {
$radioDisabled = ''; $radioDisabled = false;
$onchange = ' onchange="if (jQuery(\'#lam_accountStatusActionRadioLock:checked\').val()) {' . $onchange = ' onchange="if (jQuery(\'#lam_accountStatusActionRadioLock:checked\').val()) {' .
'jQuery(\'#lam_accountStatusDialogLockDiv\').removeClass(\'hidden\');' . 'jQuery(\'#lam_accountStatusDialogLockDiv\').removeClass(\'hidden\');' .
'jQuery(\'#lam_accountStatusDialogUnlockDiv\').addClass(\'hidden\');' . 'jQuery(\'#lam_accountStatusDialogUnlockDiv\').addClass(\'hidden\');' .
@ -312,8 +312,19 @@ class user extends baseType {
$lockChecked = ''; $lockChecked = '';
$unlockChecked = ' checked="checked"'; $unlockChecked = ' checked="checked"';
} }
$dialog .= '<input id="lam_accountStatusActionRadioLock" type="radio" name="lam_accountStatusAction" value="lock"' . $onchange . $lockChecked . $radioDisabled . '> ' . _('Lock') . '<br>'; if (!$radioDisabled) {
$dialog .= '<input id="lam_accountStatusActionRadioUnlock" type="radio" name="lam_accountStatusAction" value="unlock"' . $onchange . $unlockChecked . $radioDisabled . '> ' . _('Unlock') . '<br><br>'; $dialog .= '<input id="lam_accountStatusActionRadioLock" type="radio" name="lam_accountStatusAction" value="lock"' . $onchange . $lockChecked . '> ' . _('Lock') . '<br>';
$dialog .= '<input id="lam_accountStatusActionRadioUnlock" type="radio" name="lam_accountStatusAction" value="unlock"' . $onchange . $unlockChecked . '> ' . _('Unlock') . '<br><br>';
}
else {
$radioValue = 'lock';
if ($lockChecked == '') {
$radioValue = 'unlock';
}
$dialog .= '<input id="lam_accountStatusActionRadioLockDisabled" type="radio" name="lam_accountStatusActionDisabled" disabled value="lock"' . $onchange . $lockChecked . '> ' . _('Lock') . '<br>';
$dialog .= '<input id="lam_accountStatusActionRadioUnlockDisabled" type="radio" name="lam_accountStatusActionDisabled" disabled value="unlock"' . $onchange . $unlockChecked . '> ' . _('Unlock') . '<br><br>';
$dialog .= '<input type="hidden" name="lam_accountStatusAction" value="' . $radioValue . '">';
}
$dialog .= '<input type="hidden" name="lam_accountStatusResult" id="lam_accountStatusResult" value="cancel">'; $dialog .= '<input type="hidden" name="lam_accountStatusResult" id="lam_accountStatusResult" value="cancel">';
// locking part // locking part
if (!$fullyLocked) { if (!$fullyLocked) {