use new meta HTML classes

This commit is contained in:
Roland Gruber 2010-09-26 11:12:59 +00:00
parent b34ecb28d4
commit daad8f506e
2 changed files with 88 additions and 80 deletions

View File

@ -896,7 +896,7 @@ class posixAccount extends baseModule implements passwordService {
/** /**
* 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 = new htmlTable(); $return = new htmlTable();
@ -1012,6 +1012,7 @@ class posixAccount extends baseModule implements passwordService {
$pwdContainer->addElement(new htmlButton('unlockPassword', _('Unlock password'))); $pwdContainer->addElement(new htmlButton('unlockPassword', _('Unlock password')));
} }
$pwdContainer->addElement(new htmlButton('removePassword', _('Remove password'))); $pwdContainer->addElement(new htmlButton('removePassword', _('Remove password')));
$pwdContainer->colspan = 2;
$return->addElement($pwdContainer); $return->addElement($pwdContainer);
} }
return $return; return $return;
@ -1020,7 +1021,7 @@ class posixAccount extends baseModule implements passwordService {
/** /**
* Displays the delete homedir option for the delete page. * Displays the delete homedir option for the delete page.
* *
* @return meta HTML code * @return htmlElement meta HTML code
*/ */
function display_html_delete() { function display_html_delete() {
$return = null; $return = null;
@ -1034,7 +1035,7 @@ class posixAccount extends baseModule implements passwordService {
/** /**
* Displays the group selection. * Displays the group selection.
* *
* @return array meta HTML code * @return htmlElement meta HTML code
*/ */
function display_html_group() { function display_html_group() {
$return = new htmlTable(); $return = new htmlTable();

View File

@ -163,48 +163,55 @@ class posixGroup extends baseModule implements passwordService {
* @see baseModule::get_metaData() * @see baseModule::get_metaData()
*/ */
function display_html_attributes() { function display_html_attributes() {
$return = new htmlTable();
// group name
if ($this->manageCnAttribute) { if ($this->manageCnAttribute) {
$return[] = array( $cn = '';
array('kind' => 'text', 'text' => _("Group name").'*'), if (isset($this->attributes['cn'][0])) {
array('kind' => 'input', 'name' => 'cn', 'type' => 'text', 'size' => '30', 'maxlength' => '30', 'value' => $this->attributes['cn'][0]), $cn = $this->attributes['cn'][0];
array('kind' => 'help', 'value' => 'cn')); }
$cnInput = new htmlTableExtendedInputField(_("Group name"), 'cn', $cn, 'cn');
$cnInput->setRequired(true);
$cnInput->setFieldMaxLength(30);
$return->addElement($cnInput, true);
}
// GID number
$gidNumber = '';
if (isset($this->attributes['gidNumber'][0])) {
$gidNumber = $this->attributes['gidNumber'][0];
}
$gidNumberInput = new htmlTableExtendedInputField(_('GID number'), 'gidNumber', $gidNumber, 'gidNumber');
$gidNumberInput->setFieldMaxLength(20);
$return->addElement($gidNumberInput, true);
// description
$description = '';
if (isset($this->attributes['description'][0])) {
$description = $this->attributes['description'][0];
} }
$return[] = array(
array('kind' => 'text', 'text' => _('GID number').'*'),
array('kind' => 'input', 'name' => 'gidNumber', 'type' => 'text', 'size' => '30', 'maxlength' => '20', 'value' => $this->attributes['gidNumber'][0]),
array('kind' => 'help', 'value' => 'gidNumber'));
if ($this->manageDescriptionAttribute) { if ($this->manageDescriptionAttribute) {
$return[] = array( $return->addElement(new htmlTableExtendedInputField(_('Description'), 'description', $description, 'description'), true);
array('kind' => 'text', 'text' => _('Description')),
array('kind' => 'input', 'name' => 'description', 'type' => 'text', 'size' => '30', 'maxlength' => '255', 'value' => $this->attributes['description'][0]),
array ('kind' => 'help', 'value' => 'description'));
} }
$return[] = array( // group members
array('kind' => 'text', 'text' => _("Group members")), $return->addElement(new htmlOutputText(_("Group members")));
array('kind' => 'input', 'name' => 'form_subpage_' . get_class($this) . '_user_open', 'type' => 'submit', 'value' => _('Edit members')), $return->addElement(new htmlAccountPageButton(get_class($this), 'user', 'open', _('Edit members')));
array ('kind' => 'help', 'value' => 'members')); $return->addElement(new htmlHelpLink('members'), true);
// password buttons
if (isset($this->attributes['userPassword'][0])) { if (isset($this->attributes['userPassword'][0])) {
$return->addElement(new htmlOutputText(_('Password')));
$pwdContainer = new htmlTable();
if (pwd_is_enabled($this->attributes['userPassword'][0])) { if (pwd_is_enabled($this->attributes['userPassword'][0])) {
$lockOption = array('kind' => 'input', 'name' => 'form_subpage_' . get_class($this) . '_attributes_lockPassword', 'type' => 'submit', 'value' => _('Lock password')); $pwdContainer->addElement(new htmlButton('lockPassword', _('Lock password')));
} }
else { else {
$lockOption = array('kind' => 'input', 'name' => 'form_subpage_' . get_class($this) . '_attributes_unlockPassword', 'type' => 'submit', 'value' => _('Unlock password')); $pwdContainer->addElement(new htmlButton('unlockPassword', _('Unlock password')));
} }
$return[] = array(array('kind' => 'text', 'text' => "")); $pwdContainer->addElement(new htmlButton('removePassword', _('Remove password')));
$return[] = array( $pwdContainer->colspan = 2;
array('kind' => 'text', 'text' => _('Password') ), $return->addElement($pwdContainer, true);
array('kind' => 'table', 'value' => array( }
array($lockOption), if (isset($this->orig['gidNumber'][0]) && $this->attributes['gidNumber'][0]!=$this->orig['gidNumber'][0]) {
array( $return->addElement(new htmlTableExtendedInputCheckbox('changegids', $this->changegids, _('Change GID number of users and hosts'), 'changegids'));
array('kind' => 'input', 'name' => 'form_subpage_' . get_class($this) . '_attributes_removePassword', 'type' => 'submit', 'value' => _('Remove password'))
)
)));
} }
if ($this->attributes['gidNumber'][0]!=$this->orig['gidNumber'][0] && $this->orig['gidNumber'][0]!='')
$return[] = array(
array('kind' => 'text', 'text' => _('Change GID number of users and hosts')),
array('kind' => 'input', 'name' => 'changegids', 'type' => 'checkbox', 'checked' => $this->changegids, 'value' => true),
array('kind' => 'help', 'value' => 'changegids'));
return $return; return $return;
} }
@ -215,7 +222,8 @@ class posixGroup extends baseModule implements passwordService {
* @return array meta HTML output * @return array meta HTML output
*/ */
function display_html_user() { function display_html_user() {
// load list with all users $return = new htmlTable();
// load list with all users
$dn_users = $_SESSION['cache']->get_cache(array('uid', 'gidNumber'), 'posixAccount', 'user'); $dn_users = $_SESSION['cache']->get_cache(array('uid', 'gidNumber'), 'posixAccount', 'user');
$users = array(); $users = array();
if (is_array($dn_users)) { if (is_array($dn_users)) {
@ -237,29 +245,35 @@ class posixGroup extends baseModule implements passwordService {
} }
} }
} }
$return[] = array( $return->addElement(new htmlSubTitle(_("Group members")), true);
array('kind' => 'fieldset', 'legend' => _("Group members"), 'value' => array (
array( $return->addElement(new htmlOutputText(_("Selected users")));
array('kind' => 'fieldset', 'td' => array ('valign' => 'top'), 'legend' => _("Selected users"), 'value' => array ( $return->addElement(new htmlOutputText(''));
array( $return->addElement(new htmlOutputText(_("Available users")));
array ( 'kind' => 'select', 'name' => 'removeusers', 'size' => '15', 'multiple' => true, 'options' => $this->attributes['memberUid'])))), $return->addNewLine();
array('kind' => 'table', 'value' => array(
array( $remGroups = array();
array('kind' => 'input', 'type' => 'submit', 'name' => 'addusers_button', 'value' => '<=', 'td' => array('align' => 'center'))), if (isset($this->attributes['memberUid'])) {
array( $remGroups = $this->attributes['memberUid'];
array('kind' => 'input', 'type' => 'submit', 'name' => 'removeusers_button', 'value' => '=>', 'td' => array('align' => 'center'))), }
array( $remSelect = new htmlSelect('removeusers', $remGroups, null, 15);
array('kind' => 'help', 'value' => 'members', 'td' => array('align' => 'center'))))), $remSelect->setMultiSelect(true);
array('kind' => 'fieldset', 'td' => array('valign' => 'top'), 'legend' => _("Available users"), 'value' => array( $return->addElement($remSelect);
array( $buttonContainer = new htmlTable();
array('kind' => 'select', 'name' => 'addusers', 'size' => '15', 'multiple' => true, 'options' => $users)))) $buttonContainer->addElement(new htmlButton('addusers_button', 'back.gif', true), true);
)))); $buttonContainer->addElement(new htmlButton('removeusers_button', 'forward.gif', true), true);
$buttonContainer->addElement(new htmlHelpLink('members'));
$return->addElement($buttonContainer);
$addSelect = new htmlSelect('addusers', $users, null, 15);
$addSelect->setMultiSelect(true);
$return->addElement($addSelect);
$return->addNewLine();
$return[] = array( // back button
array('kind' => 'input', 'name' => 'form_subpage_' . get_class($this) . '_attributes_back' ,'type' => 'submit', 'value' => _('Back') ), $return->addElement(new htmlSpacer(null, '10px'), true);
array('kind' => 'text'), $return->addElement(new htmlAccountPageButton(get_class($this), 'attributes', 'back', _('Back')));
array('kind' => 'text'));
return $return; return $return;
} }
/** /**
@ -292,15 +306,15 @@ class posixGroup extends baseModule implements passwordService {
// managed attributes // managed attributes
$return['attributes'] = array('cn', 'gidNumber', 'userPassword', 'memberUid', 'description'); $return['attributes'] = array('cn', 'gidNumber', 'userPassword', 'memberUid', 'description');
// configuration options // configuration options
$return['config_options']['group'] = array( $configContainer = new htmlTable();
array( $configContainer->addElement(new htmlSubTitle(_("Groups")), true);
array('kind' => 'text', 'text' => '<b>' . _("Groups") . ': &nbsp;</b>' . _('Minimum GID number') . "* "), $minGidInput = new htmlTableExtendedInputField(_('Minimum GID number'), 'posixGroup_minGID', null, 'minMaxGID');
array('kind' => 'input', 'name' => 'posixGroup_minGID', 'type' => 'text', 'size' => '10', 'maxlength' => '255'), $minGidInput->setRequired(true);
array('kind' => 'text', 'value' => '&nbsp;'), $configContainer->addElement($minGidInput, true);
array('kind' => 'text', 'text' => _('Maximum GID number') . "* "), $maxGidInput = new htmlTableExtendedInputField(_('Maximum GID number'), 'posixGroup_maxGID', null, 'minMaxGID');
array('kind' => 'input', 'name' => 'posixGroup_maxGID', 'type' => 'text', 'size' => '10', 'maxlength' => '255'), $maxGidInput->setRequired(true);
array('kind' => 'help', 'value' => 'minMaxGID')) $configContainer->addElement($maxGidInput, true);
); $return['config_options']['group'] = $configContainer;
// configuration checks // configuration checks
$return['config_checks']['group']['posixGroup_minGID'] = array ( $return['config_checks']['group']['posixGroup_minGID'] = array (
'type' => 'ext_preg', 'type' => 'ext_preg',
@ -422,17 +436,10 @@ class posixGroup extends baseModule implements passwordService {
*/ */
function get_configOptions($scopes, $allScopes) { function get_configOptions($scopes, $allScopes) {
$return = parent::get_configOptions($scopes, $allScopes); $return = parent::get_configOptions($scopes, $allScopes);
$pwdHash = array(
array('kind' => 'text', 'text' => '<b>' . _("Password hash type") . ': &nbsp;</b>'),
array('kind' => 'select', 'name' => 'posixAccount_pwdHash', 'size' => '1',
'options' => array("CRYPT", "SHA", "SSHA", "MD5", "SMD5", "PLAIN"), 'options_selected' => array('SSHA')),
array('kind' => 'text', 'value' => '&nbsp;'),
array('kind' => 'text', 'value' => '&nbsp;'),
array('kind' => 'text', 'value' => '&nbsp;'),
array('kind' => 'help', 'value' => 'pwdHash')
);
// display password hash option only if posixAccount module is not used // display password hash option only if posixAccount module is not used
if (!isset($allScopes['posixAccount'])) $return[] = $pwdHash; if (!isset($allScopes['posixAccount'])) {
$return[0]->addElement(new htmlTableExtendedSelect('posixAccount_pwdHash', array("CRYPT", "SHA", "SSHA", "MD5", "SMD5", "PLAIN"), array('SSHA'), _("Password hash type"), 'pwdHash'));
}
return $return; return $return;
} }
@ -532,13 +539,13 @@ class posixGroup extends baseModule implements passwordService {
if ($this->manageDescriptionAttribute) { if ($this->manageDescriptionAttribute) {
$this->attributes['description'][0] = $_POST['description']; $this->attributes['description'][0] = $_POST['description'];
} }
if (isset($_POST['form_subpage_' . get_class($this) . '_attributes_lockPassword'])) { if (isset($_POST['lockPassword'])) {
$this->attributes['userPassword'][0] = pwd_disable($this->attributes['userPassword'][0]); $this->attributes['userPassword'][0] = pwd_disable($this->attributes['userPassword'][0]);
} }
if (isset($_POST['form_subpage_' . get_class($this) . '_attributes_unlockPassword'])) { if (isset($_POST['unlockPassword'])) {
$this->attributes['userPassword'][0] = pwd_enable($this->attributes['userPassword'][0]); $this->attributes['userPassword'][0] = pwd_enable($this->attributes['userPassword'][0]);
} }
if (isset($_POST['form_subpage_' . get_class($this) . '_attributes_removePassword'])) { if (isset($_POST['removePassword'])) {
unset($this->attributes['userPassword']); unset($this->attributes['userPassword']);
} }
if (isset($_POST['changegids'])) $this->changegids=true; if (isset($_POST['changegids'])) $this->changegids=true;