use new meta HTML classes

This commit is contained in:
Roland Gruber 2010-09-26 14:39:50 +00:00
parent b435abacdd
commit 6141669652
1 changed files with 67 additions and 97 deletions

View File

@ -221,41 +221,42 @@ class sambaDomain extends baseModule {
/** /**
* Returns the HTML meta data for the main account page. * Returns the HTML meta data for the main account page.
* *
* @return array HTML meta data * @return htmlElement HTML meta data
*/ */
function display_html_attributes() { function display_html_attributes() {
$return = array(); $return = new htmlTable();
// domain name // domain name
$domainName = '';
if (isset($this->attributes['sambaDomainName'][0])) {
$domainName = $this->attributes['sambaDomainName'][0];
}
if ($this->getAccountContainer()->isNewAccount) { if ($this->getAccountContainer()->isNewAccount) {
$return[] = array( $domainNameInput = new htmlTableExtendedInputField(_('Domain name'), 'domainName', $domainName, 'domainName');
array('kind' => 'text', 'text' => _('Domain name').'*'), $domainNameInput->setRequired(true);
array('kind' => 'input', 'name' => 'domainName', 'type' => 'text', 'value' => $this->attributes['sambaDomainName'][0]), $return->addElement($domainNameInput, true);
array('kind' => 'help', 'value' => 'domainName'));
} }
else { else {
$return[] = array( $return->addElement(new htmlOutputText(_('Domain name')));
array('kind' => 'text', 'text' => _('Domain name')), $return->addElement(new htmlOutputText($domainName));
array('kind' => 'text', 'text' => $this->attributes['sambaDomainName'][0]), $return->addElement(new htmlHelpLink('domainName'), true);
array('kind' => 'help', 'value' => 'domainName'));
} }
// domain SID // domain SID
$domainSID = '';
if (isset($this->attributes['sambaSID'][0])) {
$domainSID = $this->attributes['sambaSID'][0];
}
if ($this->getAccountContainer()->isNewAccount) { if ($this->getAccountContainer()->isNewAccount) {
$return[] = array( $domainSIDInput = new htmlTableExtendedInputField(_('Domain SID'), 'domainSID', $domainSID, 'domainSID');
array('kind' => 'text', 'text' => _('Domain SID').'*'), $domainSIDInput->setRequired(true);
array('kind' => 'input', 'name' => 'domainSID', 'type' => 'text', 'value' => $this->attributes['sambaSID'][0]), $return->addElement($domainSIDInput, true);
array('kind' => 'help', 'value' => 'domainSID'));
} }
else { else {
$return[] = array( $return->addElement(new htmlOutputText(_('Domain SID')));
array('kind' => 'text', 'text' => _('Domain SID')), $return->addElement(new htmlOutputText($domainSID));
array('kind' => 'text', 'text' => $this->attributes['sambaSID'][0]), $return->addElement(new htmlHelpLink('domainSID'), true);
array('kind' => 'help', 'value' => 'domainSID'));
} }
$return[] = array( $return->addElement(new htmlSubTitle(_("Password policy")), true);
array('kind' => 'text', 'text' => ""),
array('kind' => 'text', 'text' => " "),
array('kind' => 'text', 'text' => ""));
/* group policies */ /* group policies */
@ -264,137 +265,106 @@ class sambaDomain extends baseModule {
if (isset($this->attributes['sambaMinPwdLength'][0])) { if (isset($this->attributes['sambaMinPwdLength'][0])) {
$sambaMinPwdLength = $this->attributes['sambaMinPwdLength'][0]; $sambaMinPwdLength = $this->attributes['sambaMinPwdLength'][0];
} }
$return[] = array( $return->addElement(new htmlTableExtendedSelect('minPwdLength', array('-', 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15),
array('kind' => 'text', 'text' => _('Minimal password length')), array($sambaMinPwdLength), _('Minimal password length'), 'minPwdLength'), true);
array('kind' => 'select', 'name' => 'minPwdLength',
'options' => array('-', 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15),
'options_selected' => $sambaMinPwdLength),
array('kind' => 'help', 'value' => 'minPwdLength'));
// password history length // password history length
$sambaPwdHistoryLength = '-'; $sambaPwdHistoryLength = '-';
if (isset($this->attributes['sambaPwdHistoryLength'][0])) { if (isset($this->attributes['sambaPwdHistoryLength'][0])) {
$sambaPwdHistoryLength = $this->attributes['sambaPwdHistoryLength'][0]; $sambaPwdHistoryLength = $this->attributes['sambaPwdHistoryLength'][0];
} }
$return[] = array( $return->addElement(new htmlTableExtendedSelect('pwdHistLength', array('-', 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15),
array('kind' => 'text', 'text' => _('Password history length')), array($sambaPwdHistoryLength), _('Password history length'), 'pwdHistLength'), true);
array('kind' => 'select', 'name' => 'pwdHistLength',
'options' => array('-', 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15),
'options_selected' => $sambaPwdHistoryLength),
array('kind' => 'help', 'value' => 'pwdHistLength'));
// logon to change password // logon to change password
$sambaLogonToChgPwd = '-'; $sambaLogonToChgPwd = '-';
if (isset($this->attributes['sambaLogonToChgPwd'][0])) { if (isset($this->attributes['sambaLogonToChgPwd'][0])) {
$sambaLogonToChgPwd = $this->attributes['sambaLogonToChgPwd'][0]; $sambaLogonToChgPwd = $this->attributes['sambaLogonToChgPwd'][0];
} }
$return[] = array( $logonPwdChangeSelect = new htmlTableExtendedSelect('logonToChgPwd', array('-' => '-', _('Off') => '0', _('On') => '2'),
array('kind' => 'text', 'text' => _('Logon for password change')), array($sambaLogonToChgPwd), _('Logon for password change'), 'logonToChgPwd');
array('kind' => 'select', 'name' => 'logonToChgPwd', $logonPwdChangeSelect->setHasDescriptiveElements(true);
'options' => array(array('-', '-'), array(0, _('Off')), array(2, _('On'))), 'descriptiveOptions' => true, $return->addElement($logonPwdChangeSelect, true);
'options_selected' => $sambaLogonToChgPwd),
array('kind' => 'help', 'value' => 'logonToChgPwd'));
// force logoff // force logoff
$sambaForceLogoff = '-'; $sambaForceLogoff = '-';
if (isset($this->attributes['sambaForceLogoff'][0])) { if (isset($this->attributes['sambaForceLogoff'][0])) {
$sambaForceLogoff = $this->attributes['sambaForceLogoff'][0]; $sambaForceLogoff = $this->attributes['sambaForceLogoff'][0];
} }
$return[] = array( $forceLogoffSelect = new htmlTableExtendedSelect('forceLogoff', array('-' => '-', _('Off') => '-1', _('On') => '0'),
array('kind' => 'text', 'text' => _('Disconnect users outside logon hours')), array($sambaForceLogoff), _('Disconnect users outside logon hours'), 'forceLogoff');
array('kind' => 'select', 'name' => 'forceLogoff', $forceLogoffSelect->setHasDescriptiveElements(true);
'options' => array(array('-', '-'), array('-1', _('Off')), array(0, _('On'))), 'descriptiveOptions' => true, $return->addElement($forceLogoffSelect, true);
'options_selected' => $sambaForceLogoff),
array('kind' => 'help', 'value' => 'forceLogoff'));
// do not allow machine password change // do not allow machine password change
$sambaRefuseMachinePwdChange = '-'; $sambaRefuseMachinePwdChange = '-';
if (isset($this->attributes['sambaRefuseMachinePwdChange'][0])) { if (isset($this->attributes['sambaRefuseMachinePwdChange'][0])) {
$sambaRefuseMachinePwdChange = $this->attributes['sambaRefuseMachinePwdChange'][0]; $sambaRefuseMachinePwdChange = $this->attributes['sambaRefuseMachinePwdChange'][0];
} }
$return[] = array( $refuseMachPwdChange = new htmlTableExtendedSelect('refuseMachinePwdChange', array('-' => '-', _('Off') => '0', _('On') => '1'),
array('kind' => 'text', 'text' => _('Allow machine password changes')), array($sambaRefuseMachinePwdChange), _('Allow machine password changes'), 'refuseMachinePwdChange');
array('kind' => 'select', 'name' => 'refuseMachinePwdChange', $refuseMachPwdChange->setHasDescriptiveElements(true);
'options' => array(array('-', '-'), array('0', _('Off')), array(1, _('On'))), 'descriptiveOptions' => true, $return->addElement($refuseMachPwdChange, true);
'options_selected' => $sambaRefuseMachinePwdChange),
array('kind' => 'help', 'value' => 'refuseMachinePwdChange'));
// Lockout users after bad logon attempts // Lockout users after bad logon attempts
$sambaLockoutThreshold = ''; $sambaLockoutThreshold = '';
if (isset($this->attributes['sambaLockoutThreshold'][0])) { if (isset($this->attributes['sambaLockoutThreshold'][0])) {
$sambaLockoutThreshold = $this->attributes['sambaLockoutThreshold'][0]; $sambaLockoutThreshold = $this->attributes['sambaLockoutThreshold'][0];
} }
$return[] = array( $return->addElement(new htmlTableExtendedInputField(_('Lockout users after bad logon attempts'), 'lockoutThreshold', $sambaLockoutThreshold, 'lockoutThreshold'), true);
array('kind' => 'text', 'text' => _('Lockout users after bad logon attempts')),
array('kind' => 'input', 'name' => 'lockoutThreshold', 'type' => 'text', 'value' => $sambaLockoutThreshold),
array('kind' => 'help', 'value' => 'lockoutThreshold'));
// Minimum password age // Minimum password age
$sambaMinPwdAge = ''; $sambaMinPwdAge = '';
if (isset($this->attributes['sambaMinPwdAge'][0])) { if (isset($this->attributes['sambaMinPwdAge'][0])) {
$sambaMinPwdAge = $this->attributes['sambaMinPwdAge'][0]; $sambaMinPwdAge = $this->attributes['sambaMinPwdAge'][0];
} }
$return[] = array( $return->addElement(new htmlTableExtendedInputField(_('Minimum password age'), 'minPwdAge', $sambaMinPwdAge, 'minPwdAge'), true);
array('kind' => 'text', 'text' => _('Minimum password age')),
array('kind' => 'input', 'name' => 'minPwdAge', 'type' => 'text', 'value' => $sambaMinPwdAge),
array('kind' => 'help', 'value' => 'minPwdAge'));
// Maximum password age // Maximum password age
$sambaMaxPwdAge = ''; $sambaMaxPwdAge = '';
if (isset($this->attributes['sambaMaxPwdAge'][0])) { if (isset($this->attributes['sambaMaxPwdAge'][0])) {
$sambaMaxPwdAge = $this->attributes['sambaMaxPwdAge'][0]; $sambaMaxPwdAge = $this->attributes['sambaMaxPwdAge'][0];
} }
$return[] = array( $return->addElement(new htmlTableExtendedInputField(_('Maximum password age'), 'maxPwdAge', $sambaMaxPwdAge, 'maxPwdAge'), true);
array('kind' => 'text', 'text' => _('Maximum password age')),
array('kind' => 'input', 'name' => 'maxPwdAge', 'type' => 'text', 'value' => $sambaMaxPwdAge),
array('kind' => 'help', 'value' => 'maxPwdAge'));
// Lockout duration // Lockout duration
$sambaLockoutDuration = ''; $sambaLockoutDuration = '';
if (isset($this->attributes['sambaLockoutDuration'][0])) { if (isset($this->attributes['sambaLockoutDuration'][0])) {
$sambaLockoutDuration = $this->attributes['sambaLockoutDuration'][0]; $sambaLockoutDuration = $this->attributes['sambaLockoutDuration'][0];
} }
$return[] = array( $return->addElement(new htmlTableExtendedInputField(_('Lockout duration'), 'lockoutDuration', $sambaLockoutDuration, 'lockoutDuration'), true);
array('kind' => 'text', 'text' => _('Lockout duration')),
array('kind' => 'input', 'name' => 'lockoutDuration', 'type' => 'text', 'value' => $sambaLockoutDuration),
array('kind' => 'help', 'value' => 'lockoutDuration'));
// Reset time after lockout // Reset time after lockout
$sambaLockoutObservationWindow = ''; $sambaLockoutObservationWindow = '';
if (isset($this->attributes['sambaLockoutObservationWindow'][0])) { if (isset($this->attributes['sambaLockoutObservationWindow'][0])) {
$sambaLockoutObservationWindow = $this->attributes['sambaLockoutObservationWindow'][0]; $sambaLockoutObservationWindow = $this->attributes['sambaLockoutObservationWindow'][0];
} }
$return[] = array( $return->addElement(new htmlTableExtendedInputField(_('Reset time after lockout'), 'lockoutObservationWindow', $sambaLockoutObservationWindow, 'lockoutObservationWindow'), true);
array('kind' => 'text', 'text' => _('Reset time after lockout')),
array('kind' => 'input', 'name' => 'lockoutObservationWindow', 'type' => 'text', 'value' => $sambaLockoutObservationWindow),
array('kind' => 'help', 'value' => 'lockoutObservationWindow'));
$return[] = array( $return->addElement(new htmlSubTitle(_('RID settings')), true);
array('kind' => 'text', 'text' => ""),
array('kind' => 'text', 'text' => " "),
array('kind' => 'text', 'text' => ""));
/* RID settings */ /* RID settings */
// next RID // next RID
$return[] = array( $nextRID = '';
array('kind' => 'text', 'text' => _('Next RID')), if (isset($this->attributes['sambaNextRid'][0])) {
array('kind' => 'input', 'name' => 'nextRID', 'type' => 'text', 'value' => $this->attributes['sambaNextRid'][0]), $nextRID = $this->attributes['sambaNextRid'][0];
array('kind' => 'help', 'value' => 'nextRID')); }
$return->addElement(new htmlTableExtendedInputField(_('Next RID'), 'nextRID', $nextRID, 'nextRID'), true);
// next user RID // next user RID
$return[] = array( $nextUserRID = '';
array('kind' => 'text', 'text' => _('Next user RID')), if (isset($this->attributes['sambaNextUserRid'][0])) {
array('kind' => 'input', 'name' => 'nextUserRID', 'type' => 'text', 'value' => $this->attributes['sambaNextUserRid'][0]), $nextUserRID = $this->attributes['sambaNextUserRid'][0];
array('kind' => 'help', 'value' => 'nextUserRID')); }
$return->addElement(new htmlTableExtendedInputField(_('Next user RID'), 'nextUserRID', $nextUserRID, 'nextUserRID'), true);
// next group RID // next group RID
$return[] = array( $nextGroupRID = '';
array('kind' => 'text', 'text' => _('Next group RID')), if (isset($this->attributes['sambaNextGroupRid'][0])) {
array('kind' => 'input', 'name' => 'nextGroupRID', 'type' => 'text', 'value' => $this->attributes['sambaNextGroupRid'][0]), $nextGroupRID = $this->attributes['sambaNextGroupRid'][0];
array('kind' => 'help', 'value' => 'nextGroupRID')); }
$return->addElement(new htmlTableExtendedInputField(_('Next group RID'), 'nextGroupRID', $nextGroupRID, 'nextGroupRID'), true);
// RID base // RID base
if (!isset($this->attributes['sambaAlgorithmicRidBase'][0])) $this->attributes['sambaAlgorithmicRidBase'][0] = 1000; if (!isset($this->attributes['sambaAlgorithmicRidBase'][0])) $this->attributes['sambaAlgorithmicRidBase'][0] = 1000;
if ($this->getAccountContainer()->isNewAccount) { if ($this->getAccountContainer()->isNewAccount) {
$return[] = array( $ridBaseInput = new htmlTableExtendedInputField(_('RID base'), 'RIDbase', $this->attributes['sambaAlgorithmicRidBase'][0], 'RIDbase');
array('kind' => 'text', 'text' => _('RID base').'*'), $ridBaseInput->setRequired(true);
array('kind' => 'input', 'name' => 'RIDbase', 'type' => 'text', 'value' => $this->attributes['sambaAlgorithmicRidBase'][0]), $return->addElement($ridBaseInput, true);
array('kind' => 'help', 'value' => 'RIDbase'));
} }
else { else {
$return[] = array( $return->addElement(new htmlOutputText(_('RID base')));
array('kind' => 'text', 'text' => _('RID base')), $return->addElement(new htmlOutputText($this->attributes['sambaAlgorithmicRidBase'][0]));
array('kind' => 'text', 'text' => $this->attributes['sambaAlgorithmicRidBase'][0]), $return->addElement(new htmlHelpLink('RIDbase'), true);
array('kind' => 'help', 'value' => 'RIDbase'));
} }
return $return; return $return;
} }