refactoring

This commit is contained in:
Roland Gruber 2016-01-20 20:48:30 +00:00
parent 3715bb4377
commit f8e7adf82d
2 changed files with 7 additions and 5 deletions

View File

@ -156,7 +156,7 @@ echo $_SESSION['header'];
$group = new htmlTable(); $group = new htmlTable();
$profiles = array(); $profiles = array();
$selectedProfile = array(); $selectedProfile = array();
$fieldsEnabled = false; $profilesExisting = false;
if (sizeof($files) > 0) { if (sizeof($files) > 0) {
$profiles = $files; $profiles = $files;
if (!empty($_COOKIE["lam_default_profile"]) && in_array($_COOKIE["lam_default_profile"], $files)) { if (!empty($_COOKIE["lam_default_profile"]) && in_array($_COOKIE["lam_default_profile"], $files)) {
@ -165,18 +165,18 @@ echo $_SESSION['header'];
else { else {
$selectedProfile[] = $conf->default; $selectedProfile[] = $conf->default;
} }
$fieldsEnabled = true; $profilesExisting = true;
} }
$select = new htmlSelect('filename', $profiles, $selectedProfile); $select = new htmlSelect('filename', $profiles, $selectedProfile);
$select->setIsEnabled($fieldsEnabled); $select->setIsEnabled($profilesExisting);
$group->addElement($select); $group->addElement($select);
$passwordField = new htmlInputField('passwd'); $passwordField = new htmlInputField('passwd');
$passwordField->setIsPassword(true); $passwordField->setIsPassword(true);
$passwordField->setIsEnabled($fieldsEnabled); $passwordField->setIsEnabled($profilesExisting);
$passwordField->setFieldSize(20); $passwordField->setFieldSize(20);
$group->addElement($passwordField); $group->addElement($passwordField);
$button = new htmlButton('submit', _("Ok")); $button = new htmlButton('submit', _("Ok"));
$button->setIsEnabled($fieldsEnabled); $button->setIsEnabled($profilesExisting);
$group->addElement($button); $group->addElement($button);
$group->addElement(new htmlHelpLink('200')); $group->addElement(new htmlHelpLink('200'));
$tabindex = 1; $tabindex = 1;

View File

@ -25,6 +25,8 @@ include_once (dirname ( __FILE__ ) . '/../utils/configuration.inc');
/** /**
* LAMConfig test case. * LAMConfig test case.
*
* @author Roland Gruber
*/ */
class LAMConfigTest extends PHPUnit_Framework_TestCase { class LAMConfigTest extends PHPUnit_Framework_TestCase {