use new meta HTML classes

This commit is contained in:
Roland Gruber 2010-09-27 16:47:27 +00:00
parent db63e9a6b2
commit 16f7110b8a
1 changed files with 77 additions and 155 deletions

View File

@ -138,12 +138,9 @@ class sambaSamAccount extends baseModule implements passwordService {
// PHP extensions // PHP extensions
$return['extensions'] = array('hash', 'iconv'); $return['extensions'] = array('hash', 'iconv');
// profile options // profile options
$return['profile_options'] = array( $profileContainer = new htmlTable();
array( $profileContainer->addElement(new htmlTableExtendedInputCheckbox('sambaSamAccount_addExt', false, _('Automatically add this extension'), 'autoAdd'), true);
array('kind' => 'text', 'text' => _('Automatically add this extension') . ":"), $return['profile_options'] = $profileContainer;
array('kind' => 'input', 'name' => 'sambaSamAccount_addExt', 'type' => 'checkbox'),
array('kind' => 'help', 'value' => 'autoAdd')),
);
// profile checks // profile checks
$return['profile_checks']['sambaSamAccount_smbhome'] = array( $return['profile_checks']['sambaSamAccount_smbhome'] = array(
'type' => 'ext_preg', 'type' => 'ext_preg',
@ -521,83 +518,57 @@ class sambaSamAccount extends baseModule implements passwordService {
); );
} }
// configuration options // configuration options
$return['config_options']['user'] = array( $timezones = array(
array( "GMT-12: " . _("Eniwetok, Kwajalein") => '-12',
array('kind' => 'text', 'text' => _("Time zone") . '  '), "GMT-11: " . _("Midway Island, Samoa") => '-11',
array('kind' => 'select', 'name' => 'sambaSamAccount_timeZone', 'size' => '1', "GMT-10: " . _("Hawaii") => '-10',
'options' => array( "GMT-09: " . _("Alaska") => '-9',
array('-12', "GMT-12: " . _("Eniwetok, Kwajalein")), "GMT-08: " . _("Pacific Time (US & Canada)") => '-8',
array('-11', "GMT-11: " . _("Midway Island, Samoa")), "GMT-07: " . _("Mountain Time (US & Canada)") => '-7',
array('-10', "GMT-10: " . _("Hawaii")), "GMT-06: " . _("Central Time (US & Canada), Mexico City") => '-6',
array('-9', "GMT-09: " . _("Alaska")), "GMT-05: " . _("Eastern Time (US & Canada), Bogota") => '-5',
array('-8', "GMT-08: " . _("Pacific Time (US & Canada)")), "GMT-04: " . _("Atlantic time (Canada), Caracas") => '-4',
array('-7', "GMT-07: " . _("Mountain Time (US & Canada)")), "GMT-03: " . _("Brazil, Buenos Aires") => '-3',
array('-6', "GMT-06: " . _("Central Time (US & Canada), Mexico City")), "GMT-02: " . _("Mid-Atlantic") => '-2',
array('-5', "GMT-05: " . _("Eastern Time (US & Canada), Bogota")), "GMT-01: " . _("Azores, Cape Verde Islands") => '-1',
array('-4', "GMT-04: " . _("Atlantic time (Canada), Caracas")), 'GMT: ' . _("Western Europe Time, London, Lisbon") => '0',
array('-3', "GMT-03: " . _("Brazil, Buenos Aires")), "GMT+01: " . _("Central Europe Time, Paris, Berlin") => '1',
array('-2', "GMT-02: " . _("Mid-Atlantic")), "GMT+02: " . _("Eastern Europe Time, South Africa") => '2',
array('-1', "GMT-01: " . _("Azores, Cape Verde Islands")), "GMT+03: " . _("Baghdad, Riyadh, Moscow") => '3',
array('0', 'GMT: ' . _("Western Europe Time, London, Lisbon")), "GMT+04: " . _("Abu Dhabi, Muscat, Baku") => '4',
array('1', "GMT+01: " . _("Central Europe Time, Paris, Berlin")), "GMT+05: " . _("Islamabad, Karachi") => '5',
array('2', "GMT+02: " . _("Eastern Europe Time, South Africa")), "GMT+06: " . _("Almaty, Dhaka, Colombo") => '6',
array('3', "GMT+03: " . _("Baghdad, Riyadh, Moscow")), "GMT+07: " . _("Bangkok, Hanoi, Jakarta") => '7',
array('4', "GMT+04: " . _("Abu Dhabi, Muscat, Baku")), "GMT+08: " . _("Beijing, Perth, Singapore") => '8',
array('5', "GMT+05: " . _("Islamabad, Karachi")), "GMT+09: " . _("Tokyo, Seoul, Osaka, Yakutsk") => '9',
array('6', "GMT+06: " . _("Almaty, Dhaka, Colombo")), "GMT+10: " . _("East Australian Standard, Guam") => '10',
array('7', "GMT+07: " . _("Bangkok, Hanoi, Jakarta")), "GMT+11: " . _("Magadan, Solomon Islands") => '11',
array('8', "GMT+08: " . _("Beijing, Perth, Singapore")), "GMT+12: " . _("Auckland, Fiji, Kamchatka") => '12',
array('9', "GMT+09: " . _("Tokyo, Seoul, Osaka, Yakutsk")),
array('10', "GMT+10: " . _("East Australian Standard, Guam")),
array('11', "GMT+11: " . _("Magadan, Solomon Islands")),
array('12', "GMT+12: " . _("Auckland, Fiji, Kamchatka")),
),
'options_selected' => array('0'),
'descriptiveOptions' => true),
array('kind' => 'help', 'value' => 'timeZone')),
array(
array('kind' => 'text', 'text' => _("Disable LM hashes") . '  '),
array('kind' => 'select', 'name' => 'sambaSamAccount_lmHash', 'size' => '1',
'options' => array(
array('yes', _('yes')),
array('no', _('no'))
),
'options_selected' => array('yes'),
'descriptiveOptions' => true),
array('kind' => 'help', 'value' => 'lmHash')
),
array(
array('kind' => 'text', 'text' => _('Hidden options'), 'td' => array('valign' => 'top')),
array('kind' => 'table', 'value' => array(
array(
array('kind' => 'input', 'name' => 'sambaSamAccount_hideHomeDrive', 'type' => 'checkbox'),
array('kind' => 'text', 'text' => _('Home drive')),
array('kind' => 'text', 'text' => ' '),
array('kind' => 'input', 'name' => 'sambaSamAccount_hideHomePath', 'type' => 'checkbox'),
array('kind' => 'text', 'text' => _('Home path')),
array('kind' => 'text', 'text' => ' '),
array('kind' => 'input', 'name' => 'sambaSamAccount_hideProfilePath', 'type' => 'checkbox'),
array('kind' => 'text', 'text' => _('Profile path')),
),
array(
array('kind' => 'input', 'name' => 'sambaSamAccount_hideLogonScript', 'type' => 'checkbox'),
array('kind' => 'text', 'text' => _('Logon script')),
array('kind' => 'text', 'text' => ' '),
array('kind' => 'input', 'name' => 'sambaSamAccount_hideWorkstations', 'type' => 'checkbox'),
array('kind' => 'text', 'text' => _('Samba workstations')),
array('kind' => 'text', 'text' => ' '),
array('kind' => 'input', 'name' => 'sambaSamAccount_hideLogonHours', 'type' => 'checkbox'),
array('kind' => 'text', 'text' => _('Logon hours')),
),
array(
array('kind' => 'input', 'name' => 'sambaSamAccount_hideTerminalServer', 'type' => 'checkbox'),
array('kind' => 'text', 'text' => _('Terminal server options')),
),
)),
array('kind' => 'text', 'text' => ' '),
array('kind' => 'help', 'value' => 'hiddenOptions'),
)
); );
$configContainer = new htmlTable();
$timezoneSelect = new htmlTableExtendedSelect('sambaSamAccount_timeZone', $timezones, array('0'), _("Time zone"), 'timeZone');
$timezoneSelect->setHasDescriptiveElements(true);
$configContainer->addElement($timezoneSelect, true);
$yesNo = array(_('yes') => 'yes', _('no') => 'no');
$yesNoSelect = new htmlTableExtendedSelect('sambaSamAccount_lmHash', $yesNo, array('yes'), _("Disable LM hashes"), 'lmHash');
$yesNoSelect->setHasDescriptiveElements(true);
$configContainer->addElement($yesNoSelect, true);
$hiddenLabel = new htmlOutputText(_('Hidden options'));
$hiddenLabel->alignment = htmlElement::ALIGN_TOP;
$configContainer->addElement($hiddenLabel);
$hiddenContainer = new htmlTable();
$hiddenContainer->addElement(new htmlTableExtendedInputCheckbox('sambaSamAccount_hideHomeDrive', false, _('Home drive'), null, false));
$hiddenContainer->addElement(new htmlTableExtendedInputCheckbox('sambaSamAccount_hideHomePath', false, _('Home path'), null, false));
$hiddenContainer->addElement(new htmlTableExtendedInputCheckbox('sambaSamAccount_hideProfilePath', false, _('Profile path'), null, false));
$hiddenContainer->addNewLine();
$hiddenContainer->addElement(new htmlTableExtendedInputCheckbox('sambaSamAccount_hideLogonScript', false, _('Logon script'), null, false));
$hiddenContainer->addElement(new htmlTableExtendedInputCheckbox('sambaSamAccount_hideWorkstations', false, _('Samba workstations'), null, false));
$hiddenContainer->addElement(new htmlTableExtendedInputCheckbox('sambaSamAccount_hideLogonHours', false, _('Logon hours'), null, false));
$hiddenContainer->addNewLine();
$hiddenContainer->addElement(new htmlTableExtendedInputCheckbox('sambaSamAccount_hideTerminalServer', false, _('Terminal server options'), null, false));
$configContainer->addElement($hiddenContainer);
$configContainer->addElement(new htmlHelpLink('hiddenOptions'), true);
$return['config_options']['user'] = $configContainer;
return $return; return $return;
} }
@ -1536,7 +1507,7 @@ class sambaSamAccount extends baseModule implements passwordService {
/** /**
* Returns a list of elements for the account profiles. * Returns a list of elements for the account profiles.
* *
* @return profile elements * @return htmlElement profile elements
*/ */
function get_profileOptions() { function get_profileOptions() {
$return = parent::get_profileOptions(); $return = parent::get_profileOptions();
@ -1547,75 +1518,40 @@ class sambaSamAccount extends baseModule implements passwordService {
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;
// use no password at all // use no password at all
$return[] = array( $return->addElement(new htmlTableExtendedInputCheckbox('sambaSamAccount_sambaAcctFlagsN', false, _('Use no password'), 'noPassword'), true);
array('kind' => 'text', 'text' => _('Use no password') . ': '),
array('kind' => 'input', 'name' => 'sambaSamAccount_sambaAcctFlagsN', 'type' => 'checkbox', 'checked' => false),
array('kind' => 'help', 'value' => 'noPassword')
);
// account deactivation // account deactivation
$return[] = array( $return->addElement(new htmlTableExtendedInputCheckbox('sambaSamAccount_sambaAcctFlagsD', false, _('Account is deactivated'), 'deactivated'), true);
array('kind' => 'text', 'text' => _('Account is deactivated') . ': '),
array('kind' => 'input', 'name' => 'sambaSamAccount_sambaAcctFlagsD', 'type' => 'checkbox', 'checked' => false),
array('kind' => 'help', 'value' => 'deactivated')
);
// password never expires // password never expires
$return[] = array( $return->addElement(new htmlTableExtendedInputCheckbox('sambaSamAccount_sambaAcctFlagsX', false, _('Password does not expire'), 'noExpire'), true);
array('kind' => 'text', 'text' => _('Password does not expire') . ': '),
array('kind' => 'input', 'name' => 'sambaSamAccount_sambaAcctFlagsX', 'type' => 'checkbox', 'checked' => true),
array('kind' => 'help', 'value' => 'noExpire')
);
// expiration date // expiration date
$return[] = array( $return->addElement(new htmlOutputText(_('Account expiration date')));
array('kind' => 'text', 'text' => _('Account expiration date')), $expireContainer = new htmlTable();
array('kind' => 'table', 'value' => array( $expireContainer->addElement(new htmlSelect('sambaSamAccount_expire_day', $day, array('1')));
array ( $expireContainer->addElement(new htmlSelect('sambaSamAccount_expire_mon', $mon, array('1')));
array('kind' => 'select', 'name' => 'sambaSamAccount_expire_day', 'options' => $day, 'options_selected' => array('1')), $expireContainer->addElement(new htmlSelect('sambaSamAccount_expire_yea', $year, array('2030')));
array('kind' => 'select', 'name' => 'sambaSamAccount_expire_mon', 'options' => $mon, 'options_selected' => array('1')), $return->addElement($expireContainer);
array('kind' => 'select', 'name' => 'sambaSamAccount_expire_yea', 'options' => $year, 'options_selected' => array('2030')) $return->addElement(new htmlHelpLink('expireDate'), true);
)
)),
array('kind' => 'help', 'value' => 'expireDate'));
if (!$this->isBooleanConfigOptionSet('sambaSamAccount_hideHomeDrive')) { if (!$this->isBooleanConfigOptionSet('sambaSamAccount_hideHomeDrive')) {
// letter of home drive // letter of home drive
$drives = array('-'); $drives = array('-');
for ($i = 90; $i > 67; $i--) $drives[] = chr($i) . ':'; for ($i = 90; $i > 67; $i--) $drives[] = chr($i) . ':';
$return[] = array( $return->addElement(new htmlTableExtendedSelect('sambaSamAccount_sambaHomeDrive', $drives, array('-'), _('Home drive'), 'homeDrive'), true);
array('kind' => 'text', 'text' => _('Home drive') . ': '),
array('kind' => 'select', 'name' => 'sambaSamAccount_sambaHomeDrive', 'options' => $drives, 'options_selected' => array('-')),
array('kind' => 'help', 'value' => 'homeDrive')
);
} }
if (!$this->isBooleanConfigOptionSet('sambaSamAccount_hideHomePath')) { if (!$this->isBooleanConfigOptionSet('sambaSamAccount_hideHomePath')) {
// path to home directory // path to home directory
$return[] = array( $return->addElement(new htmlTableExtendedInputField(_('Home path'), 'sambaSamAccount_smbhome', '', 'homePath'), true);
array('kind' => 'text', 'text' => _('Home path') . ': '),
array('kind' => 'input', 'type' => 'text', 'name' => 'sambaSamAccount_smbhome', 'size' => '20', 'maxlength' => '255', 'value' => ''),
array('kind' => 'help', 'value' => 'homePath')
);
} }
if (!$this->isBooleanConfigOptionSet('sambaSamAccount_hideProfilePath')) { if (!$this->isBooleanConfigOptionSet('sambaSamAccount_hideProfilePath')) {
// profile path // profile path
$return[] = array( $return->addElement(new htmlTableExtendedInputField(_('Profile path'), 'sambaSamAccount_profilePath', '', 'profilePath'), true);
array('kind' => 'text', 'text' => _('Profile path') . ': '),
array('kind' => 'input', 'type' => 'text', 'name' => 'sambaSamAccount_profilePath', 'size' => '20', 'maxlength' => '255', 'value' => ''),
array('kind' => 'help', 'value' => 'profilePath')
);
} }
if (!$this->isBooleanConfigOptionSet('sambaSamAccount_hideLogonScript')) { if (!$this->isBooleanConfigOptionSet('sambaSamAccount_hideLogonScript')) {
// logon script // logon script
$return[] = array( $return->addElement(new htmlTableExtendedInputField(_('Logon script'), 'sambaSamAccount_logonScript', '', 'scriptPath'), true);
array('kind' => 'text', 'text' => _('Logon script') . ': '),
array('kind' => 'input', 'type' => 'text', 'name' => 'sambaSamAccount_logonScript', 'size' => '20', 'maxlength' => '255', 'value' => ''),
array('kind' => 'help', 'value' => 'scriptPath')
);
} }
if (!$this->isBooleanConfigOptionSet('sambaSamAccount_hideWorkstations')) { if (!$this->isBooleanConfigOptionSet('sambaSamAccount_hideWorkstations')) {
// allowed workstations // allowed workstations
$return[] = array( $return->addElement(new htmlTableExtendedInputField(_('Samba workstations'), 'sambaSamAccount_userWorkstations', '', 'workstations'), true);
array('kind' => 'text', 'text' => _('Samba workstations') . ': '),
array('kind' => 'input', 'type' => 'text', 'name' => 'sambaSamAccount_userWorkstations', 'value' => ''),
array('kind' => 'help', 'value' => 'workstations')
);
} }
// domains // domains
$sambaDomains = search_domains(); $sambaDomains = search_domains();
@ -1623,29 +1559,19 @@ class sambaSamAccount extends baseModule implements passwordService {
for ($i = 0; $i < count($sambaDomains); $i++) { for ($i = 0; $i < count($sambaDomains); $i++) {
$sambaDomainNames[] = $sambaDomains[$i]->name; $sambaDomainNames[] = $sambaDomains[$i]->name;
} }
$return[] = array( $return->addElement(new htmlTableExtendedSelect('sambaSamAccount_sambaDomainName', $sambaDomainNames, null, _('Domain'), 'domain'), true);
array('kind' => 'text', 'text' => _('Domain') . ': '),
array('kind' => 'select', 'name' => 'sambaSamAccount_sambaDomainName', 'options' => $sambaDomainNames, 'options_selected' => array()),
array('kind' => 'help', 'value' => 'domain')
);
// Windows group // Windows group
$groups = array(); $groups = array();
foreach ($this->rids as $key => $value) { foreach ($this->rids as $key => $value) {
$groups[] = array($value, $key); $groups[$key] = $value;
} }
$groups[] = array("-", "-"); $groups["-"] = "-";
$return[] = array( $groupSelect = new htmlTableExtendedSelect('sambaSamAccount_group', $groups, array('513'), _('Windows group'), 'group');
array('kind' => 'text', 'text' => _('Windows group') . ': '), $groupSelect->setHasDescriptiveElements(true);
array('kind' => 'select', 'name' => 'sambaSamAccount_group', 'options' => $groups, 'options_selected' => array('513'), 'descriptiveOptions' => true), $return->addElement($groupSelect, true);
array('kind' => 'help', 'value' => 'group')
);
if (!$this->isBooleanConfigOptionSet('sambaSamAccount_hideLogonHours')) { if (!$this->isBooleanConfigOptionSet('sambaSamAccount_hideLogonHours')) {
// logon hours // logon hours
$return[] = array( $return->addElement(new htmlTableExtendedInputField(_('Logon hours'), 'sambaSamAccount_logonHours', '', 'logonHoursUpload'), true);
array('kind' => 'text', 'text' => _('Logon hours') . ': '),
array('kind' => 'input', 'type' => 'text', 'name' => 'sambaSamAccount_logonHours', 'value' => ''),
array('kind' => 'help', 'value' => 'logonHoursUpload')
);
} }
} }
elseif ($this->get_scope() == 'host') { elseif ($this->get_scope() == 'host') {
@ -1655,11 +1581,7 @@ class sambaSamAccount extends baseModule implements passwordService {
for ($i = 0; $i < count($sambaDomains); $i++) { for ($i = 0; $i < count($sambaDomains); $i++) {
$sambaDomainNames[] = $sambaDomains[$i]->name; $sambaDomainNames[] = $sambaDomains[$i]->name;
} }
$return[] = array( $return->addElement(new htmlTableExtendedSelect('sambaSamAccount_sambaDomainName', $sambaDomainNames, null, _('Domain'), 'domain'), true);
array('kind' => 'text', 'text' => _('Domain') . ': '),
array('kind' => 'select', 'name' => 'sambaSamAccount_sambaDomainName', 'options' => $sambaDomainNames, 'options_selected' => array()),
array('kind' => 'help', 'value' => 'domain')
);
} }
return $return; return $return;
} }