select fields can now show/hide table rows

This commit is contained in:
Roland Gruber 2013-02-17 15:04:15 +00:00
parent a7a0e18960
commit 96f5a2ceeb
2 changed files with 9 additions and 25 deletions

View File

@ -144,7 +144,7 @@ foreach ($cssFiles as $cssEntry) {
echo "<link rel=\"shortcut icon\" type=\"image/x-icon\" href=\"../../graphics/favicon.ico\">\n";
echo ("</head>\n");
echo ("<body onload=\"configLoginMethodChanged()\">\n");
echo ("<body>\n");
// include all JavaScript files
$jsDirName = dirname(__FILE__) . '/../lib';
$jsDir = dir($jsDirName);
@ -398,7 +398,14 @@ $loginOptions = array(
);
$loginSelect = new htmlTableExtendedSelect('loginMethod', $loginOptions, array($conf->getLoginMethod()), _("Login method"), '220');
$loginSelect->setHasDescriptiveElements(true);
$loginSelect->setOnchangeEvent('configLoginMethodChanged()');
$loginSelect->setTableRowsToHide(array(
LAMConfig::LOGIN_LIST => array('loginSearchSuffix', 'loginSearchFilter', 'loginSearchDN', 'loginSearchPassword', 'httpAuthentication'),
LAMConfig::LOGIN_SEARCH => array('admins')
));
$loginSelect->setTableRowsToShow(array(
LAMConfig::LOGIN_LIST => array('admins'),
LAMConfig::LOGIN_SEARCH => array('loginSearchSuffix', 'loginSearchFilter', 'loginSearchDN', 'loginSearchPassword', 'httpAuthentication')
));
$securitySettingsContent->addElement($loginSelect, true);
// admin list
$adminText = implode("\n", explode(";", $conf->get_Adminstring()));

View File

@ -153,29 +153,6 @@ function loginProfileChanged(element) {
location.href='login.php?useProfile=' + element.options[element.selectedIndex].value;
}
/**
* Hides/unhides input fields for the login method.
*/
function configLoginMethodChanged() {
selectLoginMethod = document.getElementsByName('loginMethod')[0];
if ( selectLoginMethod.options[selectLoginMethod.selectedIndex].value == 'list' ) {
jQuery('textarea[name=admins]').parent().parent().show();
jQuery('input[name=loginSearchSuffix]').parent().parent().hide();
jQuery('input[name=loginSearchFilter]').parent().parent().hide();
jQuery('input[name=loginSearchDN]').parent().parent().hide();
jQuery('input[name=loginSearchPassword]').parent().parent().hide();
jQuery('input[name=httpAuthentication]').parent().parent().hide();
}
else {
jQuery('textarea[name=admins]').parent().parent().hide();
jQuery('input[name=loginSearchSuffix]').parent().parent().show();
jQuery('input[name=loginSearchFilter]').parent().parent().show();
jQuery('input[name=loginSearchDN]').parent().parent().show();
jQuery('input[name=loginSearchPassword]').parent().parent().show();
jQuery('input[name=httpAuthentication]').parent().parent().show();
}
}
/**
* Shows the dialog to delete a profile.
*