use new meta HTML classes

This commit is contained in:
Roland Gruber 2010-09-21 17:57:04 +00:00
parent 9fe0345867
commit 0306d3d929
1 changed files with 113 additions and 105 deletions

View File

@ -167,48 +167,46 @@ class nisnetgroup 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();
// user name // user name
$groupName = ''; $groupName = '';
if (isset($this->attributes['cn'][0])) $groupName = $this->attributes['cn'][0]; if (isset($this->attributes['cn'][0])) $groupName = $this->attributes['cn'][0];
$return[] = array ( $nameInput = new htmlTableExtendedInputField(_("Group name"), 'cn', $groupName, 'cn');
array('kind' => 'text', 'text' => _("Group name").'*'), $nameInput->setRequired(true);
array('kind' => 'input', 'name' => 'cn', 'type' => 'text', 'size' => '30', 'maxlength' => '20', 'value' => $groupName), $nameInput->setFieldMaxLength(20);
array('kind' => 'help', 'value' => 'cn')); $return->addElement($nameInput, true);
$description = ''; $description = '';
if (isset($this->attributes['description'][0])) $description = $this->attributes['description'][0]; if (isset($this->attributes['description'][0])) $description = $this->attributes['description'][0];
$return[] = array( $return->addElement(new htmlTableExtendedInputField(_('Description'), 'description', $description, 'description'), true);
array('kind' => 'text', 'text' => _('Description')), $subgroupsContainer = new htmlTable();
array('kind' => 'input', 'name' => 'description', 'type' => 'text', 'size' => '30', 'maxlength' => '255', 'value' => $description),
array ('kind' => 'help', 'value' => 'description'));
$subgroups = array();
if (isset($this->attributes['memberNisNetgroup']) && is_array($this->attributes['memberNisNetgroup'])) { if (isset($this->attributes['memberNisNetgroup']) && is_array($this->attributes['memberNisNetgroup'])) {
$membergroups = $this->attributes['memberNisNetgroup']; $membergroups = $this->attributes['memberNisNetgroup'];
while (sizeof($membergroups) > 0) { while (sizeof($membergroups) > 0) {
$parts = array_splice($membergroups, 0, 8); $parts = array_splice($membergroups, 0, 8);
$subgroups[] = array(array('kind' => 'text', 'text' => implode(', ', $parts))); $subgroupsContainer->addElement(new htmlOutputText(implode(', ', $parts)), true);
} }
} }
$subgroups[] = array(array('kind' => 'input', 'name' => 'form_subpage_nisnetgroup_group_open', 'type' => 'submit', 'value' => _('Edit subgroups'))); $subgroupsContainer->addElement(new htmlAccountPageButton(get_class($this), 'group', 'open', _('Edit subgroups')));
$return[] = array( $subgroupsLabel = new htmlOutputText(_('Subgroups'));
array('kind' => 'text', 'text' => _('Subgroups'), 'td' => array('valign' => 'top')), $subgroupsLabel->alignment = htmlElement::ALIGN_TOP;
array('kind' => 'table', 'value' => $subgroups), $return->addElement($subgroupsLabel);
array('kind' => 'help', 'value' => 'memberNisNetgroup')); $return->addElement($subgroupsContainer);
$return[] = array( $return->addElement(new htmlHelpLink('memberNisNetgroup'), true);
array('kind' => 'text', 'text' => ' '), $return->addElement(new htmlSpacer(null, '10px'), true);
array('kind' => 'text', 'text' => ' '),
array('kind' => 'text', 'text' => ' '),
);
// members // members
$memberTable = array(array( $memberTable = new htmlTable();
array('kind' => 'text', 'text' => _('Host'), 'td' => array('colspan' => 2)), $hostLabel = new htmlOutputText(_('Host'));
array('kind' => 'text', 'text' => _('User'), 'td' => array('colspan' => 2)), $hostLabel->colspan = 2;
array('kind' => 'text', 'text' => _('Domain'), $memberTable->addElement($hostLabel);
), $userLabel = new htmlOutputText(_('User'));
)); $userLabel->colspan = 2;
$memberTable->addElement($userLabel);
$memberTable->addElement(new htmlOutputText(_('Domain')));
$memberTable->addElement(new htmlSpacer('5px', null));
$memberTable->addElement(new htmlHelpLink('members'), true);
if (isset($this->attributes['nisNetgroupTriple']) && (sizeof($this->attributes['nisNetgroupTriple']) > 0)) { if (isset($this->attributes['nisNetgroupTriple']) && (sizeof($this->attributes['nisNetgroupTriple']) > 0)) {
for ($i = 0; $i < sizeof($this->attributes['nisNetgroupTriple']); $i++) { for ($i = 0; $i < sizeof($this->attributes['nisNetgroupTriple']); $i++) {
$triple = substr($this->attributes['nisNetgroupTriple'][$i], 1, strlen($this->attributes['nisNetgroupTriple'][$i]) - 2); $triple = substr($this->attributes['nisNetgroupTriple'][$i], 1, strlen($this->attributes['nisNetgroupTriple'][$i]) - 2);
@ -219,41 +217,60 @@ class nisnetgroup extends baseModule {
if (isset($_POST['form_subpage_nisnetgroup_attributes_select']) && ($_POST['type'] == 'user') && ($_POST['position'] == $i)) { if (isset($_POST['form_subpage_nisnetgroup_attributes_select']) && ($_POST['type'] == 'user') && ($_POST['position'] == $i)) {
$triple[1] = $_POST['selectBox']; $triple[1] = $_POST['selectBox'];
} }
$memberTable[] = array( $hostField = new htmlInputField('host_' . $i, $triple[0]);
array('kind' => 'input', 'type' => 'text', 'name' => 'host_' . $i, 'value' => $triple[0]), $hostField->setFieldSize(20);
array('kind' => 'input', 'type' => 'submit', 'name' => 'form_subpage_nisnetgroup_select_host' . $i, 'image' => 'host.png', 'value' => ' ', 'title' => _('Select host')), $memberTable->addElement($hostField);
array('kind' => 'input', 'type' => 'text', 'name' => 'user_' . $i, 'value' => $triple[1]), $hostButton = new htmlAccountPageButton(get_class($this), 'select', 'host' . $i, 'host.png', true);
array('kind' => 'input', 'type' => 'submit', 'name' => 'form_subpage_nisnetgroup_select_user' . $i, 'image' => 'user.png', 'value' => ' ', 'title' => _('Select user')), $hostButton->setTitle(_('Select host'));
array('kind' => 'input', 'type' => 'text', 'name' => 'domain_' . $i, 'value' => $triple[2]), $memberTable->addElement($hostButton);
array('kind' => 'text', 'text' => '&nbsp;'), $userField = new htmlInputField('user_' . $i, $triple[1]);
array('kind' => 'input', 'type' => 'submit', 'name' => 'del_' . $i, 'image' => 'del.png', 'value' => ' ', 'title' => _('Delete')) $userField->setFieldSize(20);
); $memberTable->addElement($userField);
$userButton = new htmlAccountPageButton(get_class($this), 'select', 'user' . $i, 'user.png', true);
$userButton->setTitle(_('Select user'));
$memberTable->addElement($userButton);
$domainField = new htmlInputField('domain_' . $i, $triple[2]);
$domainField->setFieldSize(20);
$memberTable->addElement($domainField);
$memberTable->addElement(new htmlSpacer('5px', null));
$delButton = new htmlButton('del_' . $i, 'del.png', true);
$delButton->setTitle(_('Delete'));
$memberTable->addElement($delButton);
$memberTable->addNewLine();
} }
} }
$memberTable[] = array( $memberTable->addElement(new htmlSpacer(null, '10px'), true);
array('kind' => 'text', 'text' => '&nbsp;'),
array('kind' => 'text', 'text' => '&nbsp;'),
array('kind' => 'text', 'text' => '&nbsp;'),
);
$hostNew = ''; $hostNew = '';
$userNew = ''; $userNew = '';
$domainNew = ''; $domainNew = '';
if (isset($_POST['host_new'])) $hostNew = $_POST['host_new']; if (isset($_POST['host_new'])) $hostNew = $_POST['host_new'];
if (isset($_POST['user_new'])) $userNew = $_POST['user_new']; if (isset($_POST['user_new'])) $userNew = $_POST['user_new'];
if (isset($_POST['domain_new'])) $domainNew = $_POST['domain_new']; if (isset($_POST['domain_new'])) $domainNew = $_POST['domain_new'];
$memberTable[] = array( $hostField = new htmlInputField('host_new', $hostNew);
array('kind' => 'input', 'type' => 'text', 'name' => 'host_new', 'value' => $hostNew), $hostField->setFieldSize(20);
array('kind' => 'input', 'type' => 'submit', 'name' => 'form_subpage_nisnetgroup_select_hostNew', 'image' => 'host.png', 'value' => ' ', 'title' => _('Select host')), $memberTable->addElement($hostField);
array('kind' => 'input', 'type' => 'text', 'name' => 'user_new', 'value' => $userNew), $hostButton = new htmlAccountPageButton(get_class($this), 'select', 'hostNew', 'host.png', true);
array('kind' => 'input', 'type' => 'submit', 'name' => 'form_subpage_nisnetgroup_select_userNew', 'image' => 'user.png', 'value' => ' ', 'title' => _('Select user')), $hostButton->setTitle(_('Select host'));
array('kind' => 'input', 'type' => 'text', 'name' => 'domain_new', 'value' => $domainNew), $memberTable->addElement($hostButton);
array('kind' => 'text', 'text' => '&nbsp;'), $userField = new htmlInputField('user_new', $userNew);
array('kind' => 'input', 'type' => 'submit', 'name' => 'add_new', 'image' => 'add.png', 'value' => ' ', 'title' => _('Add')) $userField->setFieldSize(20);
); $memberTable->addElement($userField);
$return[] = array( $userButton = new htmlAccountPageButton(get_class($this), 'select', 'userNew', 'user.png', true);
array('kind' => 'text', 'text' => _('Members'), 'td' => array('valign' => 'top')), $userButton->setTitle(_('Select user'));
array('kind' => 'table', 'value' => $memberTable), $memberTable->addElement($userButton);
array('kind' => 'help', 'value' => 'members', 'td' => array('valign' => 'top'))); $domainField = new htmlInputField('domain_new', $domainNew);
$domainField->setFieldSize(20);
$memberTable->addElement($domainField);
$memberTable->addElement(new htmlSpacer('5px', null));
$addButton = new htmlButton('add_new', 'add.png', true);
$addButton->setTitle(_('Add'));
$memberTable->addElement($addButton);
$memberTable->colspan = 2;
$membersLabel = new htmlOutputText(_('Members'));
$membersLabel->alignment = htmlElement::ALIGN_TOP;
$return->addElement($membersLabel);
$return->addElement($memberTable);
return $return; return $return;
} }
@ -332,7 +349,7 @@ class nisnetgroup extends baseModule {
/** /**
* 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() {
// load list with all groups // load list with all groups
@ -351,29 +368,27 @@ class nisnetgroup extends baseModule {
$subgroups = $this->attributes['memberNisNetgroup']; $subgroups = $this->attributes['memberNisNetgroup'];
$allGroups = array_delete($subgroups, $allGroups); $allGroups = array_delete($subgroups, $allGroups);
} }
$return = new htmlTable();
$return[] = array( $return->addElement(new htmlSubTitle(_("Subgroups")), true);
array('kind' => 'fieldset', 'legend' => _("Subgroups"), 'value' => array( $return->addElement(new htmlOutputText(_("Selected groups")));
array( $return->addElement(new htmlOutputText(''));
array('kind' => 'fieldset', 'td' => array('valign' => 'top'), 'legend' => _("Selected groups"), 'value' => array( $return->addElement(new htmlOutputText(_("Available groups")));
array ( $return->addNewLine();
array('kind' => 'select', 'name' => 'removegroups', 'size' => '15', 'multiple' => true, 'options' => $subgroups)))), $selGroupSelect = new htmlSelect('removegroups', $subgroups, array(), 15);
array('kind' => 'table', 'value' => array( $selGroupSelect->setMultiSelect(true);
array( $return->addElement($selGroupSelect);
array('kind' => 'input', 'type' => 'submit', 'name' => 'addgroups_button', 'value' => '<=', 'td' => array('align' => 'center'))), $buttonContainer = new htmlTable();
array( $buttonContainer->addElement(new htmlButton('addgroups_button', 'back.gif', true), true);
array('kind' => 'input', 'type' => 'submit', 'name' => 'removegroups_button', 'value' => '=>', 'td' => array('align' => 'center'))), $buttonContainer->addElement(new htmlButton('removegroups_button', 'forward.gif', true), true);
array( $buttonContainer->addElement(new htmlHelpLink('memberNisNetgroup'));
array('kind' => 'help', 'value' => 'memberNisNetgroup', 'td' => array('align' => 'center'))))), $return->addElement($buttonContainer);
array('kind' => 'fieldset', 'td' => array('valign' => 'top'), 'legend' => _("Available groups"), 'value' => array( $availGroupSelect = new htmlSelect('addgroups', $allGroups, array(), 15);
array( $availGroupSelect->setMultiSelect(true);
array('kind' => 'select', 'name' => 'addgroups', 'size' => '15', 'multiple' => true, 'options' => $allGroups)))) $return->addElement($availGroupSelect);
)))); $return->addNewLine();
$backButton = new htmlAccountPageButton(get_class($this), 'attributes', 'back', _('Back'));
$return[] = array( $backButton->colspan = 3;
array('kind' => 'input', 'type' => 'submit', 'value' => _('Back'), 'name' => 'form_subpage_nisnetgroup_attributes_back'), $return->addElement($backButton);
array('kind' => 'text'),
array('kind' => 'text'));
return $return; return $return;
} }
@ -400,10 +415,10 @@ class nisnetgroup extends baseModule {
/** /**
* Displays the host/user selection. * Displays the host/user selection.
* *
* @return array meta HTML code * @return htmlElement meta HTML code
*/ */
function display_html_select() { function display_html_select() {
$return = array(); $return = new htmlTable();
$selectHost = true; $selectHost = true;
$postKeys = array_keys($_POST); $postKeys = array_keys($_POST);
$position = 'New'; $position = 'New';
@ -448,34 +463,27 @@ class nisnetgroup extends baseModule {
} }
} }
} }
$return[] = array( $return->addElement(new htmlOutputText(_('Filter')));
array('kind' => 'text', 'text' => _('Filter')), $return->addElement(new htmlInputField('filter', $filter));
array('kind' => 'input', 'type' => 'text', 'name' => 'filter', 'value' => $filter), $return->addElement(new htmlButton($filterButtonName, _('Ok')));
array('kind' => 'input', 'type' => 'submit', 'name' => $filterButtonName, 'value' => _('Ok')), $return->addElement(new htmlHelpLink('filter'), true);
array('kind' => 'help', 'value' => 'filter')
);
$title = _('Host name'); $title = _('Host name');
if (!$selectHost) $title = _('User name'); if (!$selectHost) $title = _('User name');
$return[] = array( $return->addElement(new htmlOutputText($title));
array('kind' => 'text', 'text' => $title), $return->addElement(new htmlSelect('selectBox', $options), true);
array('kind' => 'select', 'name' => 'selectBox', 'options' => $options) $return->addElement(new htmlSpacer(null, '10px'), true);
);
$return[] = array(
array('kind' => 'text', 'text' => '&nbsp;')
);
$type = 'host'; $type = 'host';
if (!$selectHost) $type = 'user'; if (!$selectHost) $type = 'user';
$return[] = array( $buttonContainer = new htmlTable();
array('kind' => 'table', 'td' => array('colspan' => 2), 'value' => array(array( $buttonContainer->addElement(new htmlAccountPageButton(get_class($this), 'attributes', 'select', _('Ok')));
array('kind' => 'input', 'type' => 'submit', 'value' => _('Ok'), 'name' => 'form_subpage_nisnetgroup_attributes_select'), $buttonContainer->addElement(new htmlAccountPageButton(get_class($this), 'attributes', 'back', _('Cancel')));
array('kind' => 'input', 'type' => 'submit', 'value' => _('Cancel'), 'name' => 'form_subpage_nisnetgroup_attributes_back'), $buttonContainer->colspan = 4;
))), $return->addElement($buttonContainer, true);
array('kind' => 'input', 'type' => 'hidden', 'name' => 'host_new', 'value' => $_POST['host_new']), $return->addElement(new htmlHiddenInput('host_new', $_POST['host_new']));
array('kind' => 'input', 'type' => 'hidden', 'name' => 'user_new', 'value' => $_POST['user_new']), $return->addElement(new htmlHiddenInput('user_new', $_POST['user_new']));
array('kind' => 'input', 'type' => 'hidden', 'name' => 'domain_new', 'value' => $_POST['domain_new']), $return->addElement(new htmlHiddenInput('domain_new', $_POST['domain_new']));
array('kind' => 'input', 'type' => 'hidden', 'name' => 'type', 'value' => $type), $return->addElement(new htmlHiddenInput('type', $type));
array('kind' => 'input', 'type' => 'hidden', 'name' => 'position', 'value' => $position), $return->addElement(new htmlHiddenInput('position', $position));
);
return $return; return $return;
} }