use new meta HTML

This commit is contained in:
Roland Gruber 2010-08-02 19:24:58 +00:00
parent 343883209f
commit 68fbc6660e
1 changed files with 75 additions and 90 deletions

View File

@ -94,43 +94,38 @@ class shadowAccount extends baseModule implements passwordService {
for ( $i=1; $i<=31; $i++ ) $day[] = $i; for ( $i=1; $i<=31; $i++ ) $day[] = $i;
for ( $i=1; $i<=12; $i++ ) $mon[] = $i; for ( $i=1; $i<=12; $i++ ) $mon[] = $i;
for ( $i=2003; $i<=2030; $i++ ) $year[] = $i; for ( $i=2003; $i<=2030; $i++ ) $year[] = $i;
$return['profile_options'] = array( $profileOptionsTable = new htmlTable();
array( // auto add extension
array('kind' => 'text', 'text' => _('Automatically add this extension') . ":"), $profileOptionsTable->addElement(new htmlTableExtendedInputCheckbox('shadowAccount_addExt', false, _('Automatically add this extension'), 'autoAdd'), true);
array('kind' => 'input', 'name' => 'shadowAccount_addExt', 'type' => 'checkbox'), // password warning
array('kind' => 'help', 'value' => 'autoAdd')), $profilePwdWarning = new htmlTableExtendedInputField(_('Password warning'), 'shadowAccount_shadowWarning', null, 'shadowWarning');
// password warning $profilePwdWarning->setFieldSize(5);
array( $profilePwdWarning->setFieldMaxLength(4);
array('kind' => 'text', 'text' => _('Password warning')), $profileOptionsTable->addElement($profilePwdWarning, true);
array('kind' => 'input', 'name' => 'shadowAccount_shadowWarning', 'type' => 'text', 'size' => '5', 'maxlength' => '4', 'value' => ""), // password expiration
array('kind' => 'help', 'value' => 'shadowWarning')), $profilePwdExpiration = new htmlTableExtendedInputField(_('Password expiration'), 'shadowAccount_shadowInactive', null, 'shadowInactive');
// password expiration $profilePwdExpiration->setFieldSize(5);
array( $profilePwdExpiration->setFieldMaxLength(4);
array('kind' => 'text', 'text' => _('Password expiration')), $profileOptionsTable->addElement($profilePwdExpiration, true);
array('kind' => 'input', 'name' => 'shadowAccount_shadowInactive', 'type' => 'text', 'size' => '5', 'maxlength' => '4', 'value' => ""), // minimum password age
array('kind' => 'help', 'value' => 'shadowInactive')), $profilePwdMinAge = new htmlTableExtendedInputField(_('Minimum password age'), 'shadowAccount_shadowMin', null, 'shadowMin');
// minimum password age $profilePwdMinAge->setFieldSize(5);
array( $profilePwdMinAge->setFieldMaxLength(5);
array('kind' => 'text', 'text' => _('Minimum password age')), $profileOptionsTable->addElement($profilePwdMinAge, true);
array('kind' => 'input', 'name' => 'shadowAccount_shadowMin', 'type' => 'text', 'size' => '5', 'maxlength' => '5', 'value' => ""), // maximum password age
array('kind' => 'help', 'value' => 'shadowMin')), $profilePwdMinAge = new htmlTableExtendedInputField(_('Maximum password age'), 'shadowAccount_shadowMax', null, 'shadowMax');
// maximum password age $profilePwdMinAge->setFieldSize(5);
array( $profilePwdMinAge->setFieldMaxLength(5);
array('kind' => 'text', 'text' => _('Maximum password age')), $profileOptionsTable->addElement($profilePwdMinAge, true);
array('kind' => 'input', 'name' => 'shadowAccount_shadowMax', 'type' => 'text', 'size' => '5', 'maxlength' => '5', 'value' => ""), // expiration date
array('kind' => 'help', 'value' => 'shadowMax')), $profileOptionsTable->addElement(new htmlOutputText(_('Account expiration date')));
// expiration date $profileOptionsExpire = new htmlTable();
array( $profileOptionsExpire->addElement(new htmlSelect('shadowAccount_shadowExpire_day', $day, array('1')));
array('kind' => 'text', 'text' => _('Account expiration date')), $profileOptionsExpire->addElement(new htmlSelect('shadowAccount_shadowExpire_mon', $mon, array('1')));
array('kind' => 'table', 'value' => array( $profileOptionsExpire->addElement(new htmlSelect('shadowAccount_shadowExpire_yea', $year, array('2030')));
array ( $profileOptionsTable->addElement($profileOptionsExpire);
array('kind' => 'select', 'name' => 'shadowAccount_shadowExpire_day', 'options' => $day, 'options_selected' => array('1')), $profileOptionsTable->addElement(new htmlHelpLink('shadowExpire'));
array('kind' => 'select', 'name' => 'shadowAccount_shadowExpire_mon', 'options' => $mon, 'options_selected' => array('1')), $return['profile_options'] = $profileOptionsTable;
array('kind' => 'select', 'name' => 'shadowAccount_shadowExpire_yea', 'options' => $year, 'options_selected' => array('2030'))
)
)),
array('kind' => 'help', 'value' => 'shadowExpire')),
);
// profile checks // profile checks
$return['profile_checks']['shadowAccount_shadowMin'] = array( $return['profile_checks']['shadowAccount_shadowMin'] = array(
'type' => 'ext_preg', 'type' => 'ext_preg',
@ -293,61 +288,53 @@ class shadowAccount extends baseModule implements passwordService {
if (isset($_POST['form_subpage_shadowAccount_attributes_addObjectClass'])) { if (isset($_POST['form_subpage_shadowAccount_attributes_addObjectClass'])) {
$this->attributes['objectClass'][] = 'shadowAccount'; $this->attributes['objectClass'][] = 'shadowAccount';
} }
$return = array(); $return = new htmlTable();
if (in_array('shadowAccount', $this->attributes['objectClass'])) { if (in_array('shadowAccount', $this->attributes['objectClass'])) {
$shWarning = ''; $shWarning = '';
if (isset($this->attributes['shadowWarning'][0])) { if (isset($this->attributes['shadowWarning'][0])) {
$shWarning = $this->attributes['shadowWarning'][0]; $shWarning = $this->attributes['shadowWarning'][0];
} }
$return[] = array( $pwdWarnInput = new htmlTableExtendedInputField(_('Password warning'), 'shadowWarning', $shWarning, 'shadowWarning');
array('kind' => 'text', 'text' => _('Password warning')), $pwdWarnInput->setFieldMaxLength(4);
array('kind' => 'input', 'name' => 'shadowWarning', 'type' => 'text', 'size' => '5', 'maxlength' => '4', 'value' => $shWarning), $pwdWarnInput->setFieldSize(5);
array('kind' => 'help', 'value' => 'shadowWarning')); $return->addElement($pwdWarnInput, true);
$shPwdExpiration = ''; $shPwdExpiration = '';
if (isset($this->attributes['shadowInactive'][0])) $shPwdExpiration = $this->attributes['shadowInactive'][0]; if (isset($this->attributes['shadowInactive'][0])) $shPwdExpiration = $this->attributes['shadowInactive'][0];
$return[] = array( $pwdExpInput = new htmlTableExtendedInputField(_('Password expiration'), 'shadowInactive', $shPwdExpiration, 'shadowInactive');
array('kind' => 'text', 'text' => _('Password expiration')), $pwdExpInput->setFieldMaxLength(4);
array('kind' => 'input', 'name' => 'shadowInactive', 'type' => 'text', 'size' => '5', 'maxlength' => '4', 'value' => $shPwdExpiration), $pwdExpInput->setFieldSize(5);
array('kind' => 'help', 'value' => 'shadowInactive')); $return->addElement($pwdExpInput, true);
$shMinAge = ''; $shMinAge = '';
if (isset($this->attributes['shadowMin'][0])) $shMinAge = $this->attributes['shadowMin'][0]; if (isset($this->attributes['shadowMin'][0])) $shMinAge = $this->attributes['shadowMin'][0];
$return[] = array( $minAgeInput = new htmlTableExtendedInputField(_('Minimum password age'), 'shadowMin', $shMinAge, 'shadowMin');
array('kind' => 'text', 'text' => _('Minimum password age')), $minAgeInput->setFieldMaxLength(5);
array('kind' => 'input', 'name' => 'shadowMin', 'type' => 'text', 'size' => '5', 'maxlength' => '5', 'value' => $shMinAge), $minAgeInput->setFieldSize(5);
array('kind' => 'help', 'value' => 'shadowMin')); $return->addElement($minAgeInput, true);
$shMaxAge = ''; $shMaxAge = '';
if (isset($this->attributes['shadowMax'][0])) $shMaxAge = $this->attributes['shadowMax'][0]; if (isset($this->attributes['shadowMax'][0])) $shMaxAge = $this->attributes['shadowMax'][0];
$return[] = array( $maxAgeInput = new htmlTableExtendedInputField(_('Maximum password age'), 'shadowMax', $shMaxAge, 'shadowMax');
array('kind' => 'text', 'text' => _('Maximum password age')), $maxAgeInput->setFieldMaxLength(5);
array('kind' => 'input', 'name' => 'shadowMax', 'type' => 'text', 'size' => '5', 'maxlength' => '5', 'value' => $shMaxAge), $maxAgeInput->setFieldSize(5);
array('kind' => 'help', 'value' => 'shadowMax')); $return->addElement($maxAgeInput, true);
$expirationDate = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"; $expirationDate = "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;-&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
if (isset($this->attributes['shadowExpire'][0])) { if (isset($this->attributes['shadowExpire'][0])) {
$shAccExpirationDate = $this->attributes['shadowExpire'][0]; $shAccExpirationDate = $this->attributes['shadowExpire'][0];
$date = getdate($shAccExpirationDate*3600*24); $date = getdate($shAccExpirationDate*3600*24);
$expirationDate = $date['mday'] . "." . $date['mon'] . "." . $date['year']; $expirationDate = $date['mday'] . "." . $date['mon'] . "." . $date['year'];
} }
$return[] = array( $return->addElement(new htmlOutputText(_('Account expiration date')));
array('kind' => 'text', 'text' => _('Account expiration date')), $expireTable = new htmlTable();
array('kind' => 'table', 'value' => array(array( $expireTable->addElement(new htmlOutputText($expirationDate, false));
array('kind' => 'text', 'text' => $expirationDate), $expireTable->addElement(new htmlAccountPageButton('shadowAccount', 'expire', 'open', _('Change')));
array('kind' => 'input', 'name' => 'form_subpage_shadowAccount_expire_open', 'type' => 'submit', 'value' => _('Change')) $return->addElement($expireTable);
))), $return->addElement(new htmlHelpLink('shadowExpire'), true);
array('kind' => 'help', 'value' => 'shadowExpire' )); $return->addElement(new htmlOutputText(''), true);
$return[] = array( $remButton = new htmlAccountPageButton('shadowAccount', 'attributes', 'remObjectClass', _('Remove Shadow account extension'));
array('kind' => 'text', 'text' => '&nbsp;') $remButton->colspan = 4;
); $return->addElement($remButton);
$return[] = array(
array('kind' => 'input', 'type' => 'submit', 'name' => 'form_subpage_shadowAccount_attributes_remObjectClass',
'value' => _('Remove Shadow account extension'), 'td' => array('colspan' => '4'))
);
} }
else { else {
$return[] = array( $return->addElement(new htmlAccountPageButton('shadowAccount', 'attributes', 'addObjectClass', _('Add Shadow account extension')));
array('kind' => 'text', 'text' => '&nbsp;'),
array('kind' => 'input', 'type' => 'submit', 'name' => 'form_subpage_shadowAccount_attributes_addObjectClass', 'value' => _('Add Shadow account extension'))
);
} }
return $return; return $return;
} }
@ -378,7 +365,7 @@ class shadowAccount extends baseModule implements passwordService {
* @return array meta HTML code * @return array meta HTML code
*/ */
function display_html_expire() { function display_html_expire() {
$return = array(); $return = new htmlTable();
$shAccExpirationDate = 0; $shAccExpirationDate = 0;
if (isset($this->attributes['shadowExpire'][0])) { if (isset($this->attributes['shadowExpire'][0])) {
$shAccExpirationDate = $this->attributes['shadowExpire'][0]; $shAccExpirationDate = $this->attributes['shadowExpire'][0];
@ -387,23 +374,21 @@ class shadowAccount extends baseModule implements passwordService {
for ( $i=1; $i<=31; $i++ ) $mday[] = $i; for ( $i=1; $i<=31; $i++ ) $mday[] = $i;
for ( $i=1; $i<=12; $i++ ) $mon[] = $i; for ( $i=1; $i<=12; $i++ ) $mon[] = $i;
for ( $i=2003; $i<=2030; $i++ ) $year[] = $i; for ( $i=2003; $i<=2030; $i++ ) $year[] = $i;
$return[] = array( $return->addElement(new htmlOutputText(_('Account expiration date')));
array('kind' => 'text', 'text' => _('Account expiration date')), $expTable = new htmlTable();
array('kind' => 'table', 'value' => array( $expTable->addElement(new htmlSelect('shadowExpire_day', $mday, array($date['mday'])));
array( $expTable->addElement(new htmlSelect('shadowExpire_mon', $mon, array($date['mon'])));
array('kind' => 'select', 'name' => 'shadowExpire_day', 'options' => $mday, 'options_selected' => $date['mday']), $expTable->addElement(new htmlSelect('shadowExpire_yea', $year, array($date['year'])));
array('kind' => 'select', 'name' => 'shadowExpire_mon', 'options' => $mon, 'options_selected' => $date['mon']), $return->addElement($expTable);
array('kind' => 'select', 'name' => 'shadowExpire_yea', 'options' => $year, 'options_selected' => $date['year'])))), $return->addElement(new htmlHelpLink('shadowExpire'), true);
array('kind' => 'help', 'value' => 'shadowExpire')); $buttonTable = new htmlTable();
$buttons = array(); $buttonTable->addElement(new htmlAccountPageButton('shadowAccount', 'attributes', 'change', _('Change')));
$buttons[] = array('kind' => 'input', 'name' => 'form_subpage_shadowAccount_attributes_change', 'type' => 'submit', 'value' => _('Change'));
if (isset($this->attributes['shadowExpire'][0])) { if (isset($this->attributes['shadowExpire'][0])) {
$buttons[] = array('kind' => 'input', 'name' => 'form_subpage_shadowAccount_attributes_del', 'type' => 'submit', 'value' => _('Remove')); $buttonTable->addElement(new htmlAccountPageButton('shadowAccount', 'attributes', 'del', _('Remove')));
} }
$buttons[] = array('kind' => 'input', 'name' => 'form_subpage_shadowAccount_attributes_back', 'type' => 'submit', 'value' => _('Cancel')); $buttonTable->addElement(new htmlAccountPageButton('shadowAccount', 'attributes', 'back', _('Cancel')));
$return[] = array( $buttonTable->colspan=3;
array('kind' => 'table', 'td' => array('colspan' => 3), 'value' => array($buttons)) $return->addElement($buttonTable);
);
return $return; return $return;
} }