From a9c08332506a7ba6810732aeb1cb2d43f34c6725 Mon Sep 17 00:00:00 2001 From: Roland Gruber Date: Thu, 26 Sep 2019 18:05:06 +0200 Subject: [PATCH] responsive --- lam/lib/modules/posixGroup.inc | 133 ++++++------------- lam/lib/modules/windowsGroup.inc | 181 ++++++++++++-------------- lam/lib/modules/windowsHost.inc | 25 ++-- lam/lib/modules/windowsPosixGroup.inc | 3 +- 4 files changed, 136 insertions(+), 206 deletions(-) diff --git a/lam/lib/modules/posixGroup.inc b/lam/lib/modules/posixGroup.inc index 35a5d92f..d096a868 100644 --- a/lam/lib/modules/posixGroup.inc +++ b/lam/lib/modules/posixGroup.inc @@ -195,7 +195,7 @@ class posixGroup extends baseModule implements passwordService { * @see baseModule::get_metaData() */ function display_html_attributes() { - $return = new htmlTable(); + $return = new htmlResponsiveRow(); $modules = $this->getAccountContainer()->get_type()->getModules(); $typeId = $this->getAccountContainer()->get_type()->getId(); if ($this->autoAddObjectClasses || (isset($this->attributes['objectClass']) && in_array('posixGroup', $this->attributes['objectClass']))) { @@ -205,60 +205,43 @@ class posixGroup extends baseModule implements passwordService { } // group name if ($this->manageCnAndDescription($modules)) { - $cn = ''; - if (isset($this->attributes['cn'][0])) { - $cn = $this->attributes['cn'][0]; - } - $cnInput = new htmlTableExtendedInputField(_("Group name"), 'cn', $cn, 'cn'); - $cnInput->setRequired(true); - $cnInput->setFieldMaxLength(100); - $return->addElement($cnInput, true); + $this->addSimpleInputTextField($return, 'cn', _("Group name"), 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); + $gidNumberInput = $this->addSimpleInputTextField($return, 'gidNumber', _('GID number')); $gidNumberInput->setValidationRule(htmlElement::VALIDATE_NUMERIC); - $return->addElement($gidNumberInput, true); // description - $description = ''; - if (isset($this->attributes['description'][0])) { - $description = $this->attributes['description'][0]; - } if ($this->manageCnAndDescription($modules)) { - $return->addElement(new htmlTableExtendedInputField(_('Description'), 'description', $description, 'description'), true); + $this->addSimpleInputTextField($return, 'description', _('Description')); } // password buttons if (checkIfWriteAccessIsAllowed($this->get_scope()) && isset($this->attributes[$this->passwordAttrName][0])) { - $return->addElement(new htmlOutputText(_('Password'))); - $pwdContainer = new htmlTable(); + $return->addLabel(new htmlOutputText(_('Password'))); + $pwdContainer = new htmlGroup(); if (pwd_is_enabled($this->attributes[$this->passwordAttrName][0])) { $pwdContainer->addElement(new htmlButton('lockPassword', _('Lock password'))); } else { $pwdContainer->addElement(new htmlButton('unlockPassword', _('Unlock password'))); } + $pwdContainer->addElement(new htmlSpacer('0.5rem', null)); $pwdContainer->addElement(new htmlButton('removePassword', _('Remove password'))); - $pwdContainer->colspan = 2; - $return->addElement($pwdContainer, true); + $return->addField($pwdContainer); } if (isset($this->orig['gidNumber'][0]) && $this->attributes['gidNumber'][0]!=$this->orig['gidNumber'][0]) { - $return->addElement(new htmlTableExtendedInputCheckbox('changegids', $this->changegids, _('Change GID number of users and hosts'), 'changegids'), true); + $return->add(new htmlResponsiveInputCheckbox('changegids', $this->changegids, _('Change GID number of users and hosts'), 'changegids'), 12); } // group members if (!$this->isBooleanConfigOptionSet('posixGroup_' . $typeId . '_hidememberUid')) { - $return->addElement(new htmlOutputText(_("Group members"))); + $return->addVerticalSpacer('0.5rem'); + $return->addLabel(new htmlOutputText(_("Group members"))); + $membersGroup = new htmlGroup(); if (!$this->isBooleanConfigOptionSet('posixGroup_autoSyncGon')) { - $return->addElement(new htmlAccountPageButton(get_class($this), 'user', 'open', _('Edit members'))); + $membersGroup->addElement(new htmlAccountPageButton(get_class($this), 'user', 'open', _('Edit members'))); } - else { - $return->addElement(new htmlOutputText('')); - } - $return->addElement(new htmlHelpLink('members'), true); - $return->addElement(new htmlOutputText('')); + $membersGroup->addElement(new htmlHelpLink('members')); + $return->addField($membersGroup); + $return->addLabel(new htmlOutputText(' ', false)); $users = $this->getUsers(); $members = array(); if (isset($this->attributes['memberUid'][0])) { @@ -274,19 +257,18 @@ class posixGroup extends baseModule implements passwordService { $members = array_unique($members); natcasesort($members); $members = array_map('htmlspecialchars', $members); - $return->addElement(new htmlOutputText(implode('
', $members), false), true); + $return->addField(new htmlOutputText(implode('
', $members), false)); } // remove button if (!$this->autoAddObjectClasses) { - $return->addElement(new htmlSpacer(null, '20px'), true); + $return->addVerticalSpacer('2rem'); $remButton = new htmlButton('remObjectClass', _('Remove Unix extension')); - $remButton->colspan = 5; - $return->addElement($remButton); + $return->add($remButton, 12, 12, 12, 'text-center'); } } else { // add button - $return->addElement(new htmlButton('addObjectClass', _('Add Unix extension'))); + $return->add(new htmlButton('addObjectClass', _('Add Unix extension')), 12); } return $return; } @@ -298,7 +280,7 @@ class posixGroup extends baseModule implements passwordService { * @return array meta HTML output */ function display_html_user() { - $return = new htmlTable(); + $return = new htmlResponsiveRow(); if (!isset($this->attributes['memberUid'])) { $this->attributes['memberUid'] = array(); } @@ -319,12 +301,7 @@ class posixGroup extends baseModule implements passwordService { } } } - $return->addElement(new htmlSubTitle(_("Group members")), true); - - $return->addElement(new htmlOutputText(_("Selected users"))); - $return->addElement(new htmlOutputText('')); - $return->addElement(new htmlOutputText(_("Available users"))); - $return->addNewLine(); + $return->add(new htmlSubTitle(_("Group members")), 12); $remUsers = array(); if (isset($this->attributes['memberUid'])) { @@ -339,32 +316,9 @@ class posixGroup extends baseModule implements passwordService { $remUsersDescriptive[$user] = $user; } } - $remSelect = new htmlSelect('removeusers', $remUsersDescriptive, null, 15); - $remSelect->setMultiSelect(true); - $remSelect->setTransformSingleSelect(false); - $remSelect->setHasDescriptiveElements(true); - $return->addElement($remSelect); - $buttonContainer = new htmlTable(); - $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); - $addSelect->setTransformSingleSelect(false); - $addSelect->setHasDescriptiveElements(true); - $addSelect->enableDynamicScrolling(); - $return->addElement($addSelect); - $return->addNewLine(); - $return->addElement(new htmlOutputText('')); - $return->addElement(new htmlOutputText('')); - $filterContainer = new htmlGroup(); - $filterInput = new htmlInputField('newFilter', null, 10); - $filterInput->filterSelectBox('addusers'); - $filterContainer->addElement(new htmlOutputText(_('Filter'))); - $filterContainer->addElement($filterInput); - $filterContainer->addElement(new htmlHelpLink('filter')); - $return->addElement($filterContainer, true); + + $this->addDoubleSelectionArea($return, _("Selected users"), _("Available users"), $remUsersDescriptive, null, + $users, null, 'members'); // sync from group of names $gon = $this->getAccountContainer()->getAccountModule('groupOfNames'); @@ -372,32 +326,26 @@ class posixGroup extends baseModule implements passwordService { $gon = $this->getAccountContainer()->getAccountModule('groupOfUniqueNames'); } if ($gon != null) { - $return->addElement(new htmlSpacer(null, '20px'), true); - $syncGroup = new htmlTable(); - $syncGroup->colspan = 5; + $return->addVerticalSpacer('2rem'); $syncButton = new htmlButton('syncGON', sprintf(_('Sync from %s'), $gon->get_alias())); $syncButton->setIconClass('refreshButton'); - $syncGroup->addElement($syncButton); - $syncGroup->addSpace('2rem'); - $syncGroup->addElement(new htmlTableExtendedInputCheckbox('syncGON_delete', true, _('Delete non-matching entries'), null, false)); - $return->addElement($syncGroup, true); + $return->add($syncButton, 12, 12, 12, 'text-center'); + $return->addVerticalSpacer('1rem'); + $return->add(new htmlResponsiveInputCheckbox('syncGON_delete', true, _('Delete non-matching entries'), null, false), 12); } $windows = $this->getAccountContainer()->getAccountModule('windowsGroup'); if ($windows != null) { - $return->addElement(new htmlSpacer(null, '20px'), true); - $syncGroup = new htmlTable(); - $syncGroup->colspan = 5; + $return->addVerticalSpacer('2rem'); $syncButton = new htmlButton('syncWindows', sprintf(_('Sync from %s'), $windows->get_alias())); $syncButton->setIconClass('refreshButton'); - $syncGroup->addElement($syncButton); - $syncGroup->addSpace('2rem'); - $syncGroup->addElement(new htmlTableExtendedInputCheckbox('syncWindows_delete', true, _('Delete non-matching entries'), null, false)); - $return->addElement($syncGroup, true); + $return->add($syncButton, 12, 12, 12, 'text-center'); + $return->addVerticalSpacer('1rem'); + $return->add(new htmlResponsiveInputCheckbox('syncWindows_delete', true, _('Delete non-matching entries'), null, false), 12); } // back button - $return->addElement(new htmlSpacer(null, '20px'), true); - $return->addElement(new htmlAccountPageButton(get_class($this), 'attributes', 'back', _('Back')), true); + $return->addVerticalSpacer('2rem'); + $return->add(new htmlAccountPageButton(get_class($this), 'attributes', 'back', _('Back')), 12); return $return; } @@ -998,13 +946,12 @@ class posixGroup extends baseModule implements passwordService { if (!isset($this->attributes['memberUid'])) { $this->attributes['memberUid'] = array(); } - // add users - if (isset($_POST['addusers']) && isset($_POST['addusers_button'])) { // Add users to list - $this->attributes['memberUid'] = @array_merge($this->attributes['memberUid'], $_POST['addusers']); + if (isset($_POST['members_2']) && isset($_POST['members_left'])) { // Add groups to list + // add new group + $this->attributes['memberUid'] = @array_merge($this->attributes['memberUid'], $_POST['members_2']); } - // remove users - elseif (isset($_POST['removeusers']) && isset($_POST['removeusers_button'])) { // remove users from list - $this->attributes['memberUid'] = array_delete($_POST['removeusers'], $this->attributes['memberUid']); + elseif (isset($_POST['members_1']) && isset($_POST['members_right'])) { // remove groups from list + $this->attributes['memberUid'] = array_delete($_POST['members_1'], $this->attributes['memberUid']); } // sync users elseif (isset($_POST['syncGON'])) { diff --git a/lam/lib/modules/windowsGroup.inc b/lam/lib/modules/windowsGroup.inc index 6eee3750..31ffd03e 100644 --- a/lam/lib/modules/windowsGroup.inc +++ b/lam/lib/modules/windowsGroup.inc @@ -292,7 +292,7 @@ class windowsGroup extends baseModule { * @return htmlElement HTML meta data */ public function display_html_attributes() { - $container = new htmlTable(); + $container = new htmlResponsiveRow(); $this->addSimpleInputTextField($container, 'cn', _('Group name'), true); $this->addSimpleInputTextField($container, 'description', _('Description'), false); if (!$this->isBooleanConfigOptionSet('windowsGroup_hidemail')) { @@ -331,58 +331,58 @@ class windowsGroup extends baseModule { unset($scopeList[$flippedScopes[windowsGroup::SCOPE_GLOBAL]]); } } - $groupScopeSelect = new htmlTableExtendedSelect('groupScope', $scopeList, array($groupScope), _('Group scope'), 'groupScope'); + $groupScopeSelect = new htmlResponsiveSelect('groupScope', $scopeList, array($groupScope), _('Group scope'), 'groupScope'); $groupScopeSelect->setHasDescriptiveElements(true); - $container->addElement($groupScopeSelect, true); - $groupTypeSelect = new htmlTableExtendedSelect('groupType', $this->groupTypes, array($groupType), _('Group type'), 'groupType'); + $container->add($groupScopeSelect, 12); + $groupTypeSelect = new htmlResponsiveSelect('groupType', $this->groupTypes, array($groupType), _('Group type'), 'groupType'); $groupTypeSelect->setHasDescriptiveElements(true); - $container->addElement($groupTypeSelect, true); + $container->add($groupTypeSelect, 12); // notes - $info = ''; - if (isset($this->attributes['info'][0])) { - $info = $this->attributes['info'][0]; - } - $container->addElement(new htmlTableExtendedInputTextarea('info', $info, 30, 5, _('Notes'), 'info'), true); + $this->addSimpleInputTextField($container, 'info', _('Notes'), false, null, true); // managed by if (!$this->isBooleanConfigOptionSet('windowsGroup_hidemanagedBy')) { - $container->addElement(new htmlOutputText(_('Managed by'))); + $container->addLabel(new htmlOutputText(_('Managed by'))); $managedBy = '-'; if (isset($this->attributes['managedBy'][0])) { $managedBy = $this->attributes['managedBy'][0]; } - $container->addElement(new htmlOutputText(getAbstractDN($managedBy))); - $container->addElement(new htmlHelpLink('managedBy'), true); - $container->addElement(new htmlOutputText('')); + $managedByGroup = new htmlGroup(); + $managedByGroup->addElement(new htmlOutputText(getAbstractDN($managedBy))); + $managedByGroup->addElement(new htmlSpacer('0.5rem', null)); + $managedByGroup->addElement(new htmlHelpLink('managedBy'), true); + $container->addField($managedByGroup); $managedByButtons = new htmlGroup(); $managedByButtons->addElement(new htmlAccountPageButton(get_class($this), 'managedBy', 'edit', _('Change'))); if (isset($this->attributes['managedBy'][0])) { $managedByButtons->addElement(new htmlSpacer('5px', null)); $managedByButtons->addElement(new htmlAccountPageButton(get_class($this), 'attributes', 'removeManagedBy', _('Remove'))); } - $container->addElement($managedByButtons, true); + $container->addLabel(new htmlOutputText(' ', false)); + $container->addField($managedByButtons); } // NIS if (!$this->isBooleanConfigOptionSet('windowsGroup_hidemsSFU30Name', true) || !$this->isBooleanConfigOptionSet('windowsGroup_hidemsSFU30NisDomain', true)) { - $container->addElement(new htmlSubTitle(_('NIS')), true); + $container->add(new htmlSubTitle(_('NIS')), 12); if (!$this->isBooleanConfigOptionSet('windowsGroup_hidemsSFU30Name', true)) { $this->addSimpleInputTextField($container, 'msSFU30Name', _('NIS name')); } if (!$this->isBooleanConfigOptionSet('windowsGroup_hidemsSFU30NisDomain', true)) { $this->addSimpleInputTextField($container, 'msSFU30NisDomain', _('NIS domain')); } - $container->addVerticalSpace('20px'); + $container->addVerticalSpacer('2rem'); } // group members - $container->addElement(new htmlSpacer(null, '10px'), true); - $container->addElement(new htmlOutputText(_("Group members"))); + $container->addVerticalSpacer('1rem'); + $container->addLabel(new htmlOutputText(_("Group members"))); $memberButtons = new htmlGroup(); $memberButtons->addElement(new htmlAccountPageButton(get_class($this), 'user', 'open', _('Edit'))); if (!empty($this->attributes['member'])) { - $memberButtons->addElement(new htmlSpacer('10px', null)); + $memberButtons->addElement(new htmlSpacer('0.5rem', null)); $memberButtons->addElement(new htmlAccountPageButton(get_class($this), 'effectiveMembers', 'open', _('Show effective members'))); } - $container->addElement($memberButtons); - $container->addElement(new htmlHelpLink('member'), true); + $memberButtons->addElement(new htmlSpacer('0.5rem', null)); + $memberButtons->addElement(new htmlHelpLink('member')); + $container->addField($memberButtons); $memberList = array(); if (isset($this->attributes['member'])) { for ($i = 0; $i < sizeof($this->attributes['member']); $i++) { @@ -392,19 +392,22 @@ class windowsGroup extends baseModule { } $members = new htmlTable(); $members->alignment = htmlElement::ALIGN_RIGHT; - $members->colspan = 3; + $members->setCSSClasses(array('fullwidth')); for ($i = 0; $i < sizeof($memberList); $i++) { $member = new htmlOutputText(getAbstractDN($memberList[$i])); $member->alignment = htmlElement::ALIGN_RIGHT; $members->addElement($member, true); } - $container->addElement(new htmlOutputText('')); - $container->addElement($members, true); + $container->addLabel(new htmlOutputText(' ', false)); + $container->addField($members); // member of - $container->addVerticalSpace('10px'); - $container->addElement(new htmlOutputText(_("Member of"))); - $container->addElement(new htmlAccountPageButton(get_class($this), 'memberof', 'open', _('Edit'))); - $container->addElement(new htmlHelpLink('memberOf'), true); + $container->addVerticalSpacer('2rem'); + $container->addLabel(new htmlOutputText(_("Member of"))); + $memberOfGroup = new htmlGroup(); + $memberOfGroup->addElement(new htmlAccountPageButton(get_class($this), 'memberof', 'open', _('Edit'))); + $memberOfGroup->addElement(new htmlSpacer('0.5rem', null)); + $memberOfGroup->addElement(new htmlHelpLink('memberOf'), true); + $container->addField($memberOfGroup); $memberList = array(); if (isset($this->attributes['memberOf'])) { for ($i = 0; $i < sizeof($this->attributes['memberOf']); $i++) { @@ -413,17 +416,16 @@ class windowsGroup extends baseModule { usort($memberList, 'compareDN'); } $memberOf = new htmlTable(); + $memberOf->setCSSClasses(array('fullwidth')); $memberOf->alignment = htmlElement::ALIGN_RIGHT; - $memberOf->colspan = 3; for ($i = 0; $i < sizeof($memberList); $i++) { $member = new htmlOutputText(getAbstractDN($memberList[$i])); $member->alignment = htmlElement::ALIGN_RIGHT; $memberOf->addElement($member, true); } - $container->addElement(new htmlOutputText('')); - $container->addElement($memberOf, true); + $container->addLabel(new htmlOutputText(' ', false)); + $container->addField($memberOf); - $container->addElement(new htmlEqualWidth(array('groupType', 'groupScope'))); return $container; } @@ -499,19 +501,12 @@ class windowsGroup extends baseModule { * @return htmlElement meta HTML code */ function display_html_memberof() { - $return = new htmlTable(); + $return = new htmlResponsiveRow(); + $return->add(new htmlSubTitle(_("Groups")), 12); $groups = $this->findGroups(); // sort by DN usort($groups, 'compareDN'); - $groupContainer = new htmlTable(); - $groupContainer->alignment = htmlElement::ALIGN_TOP; - $groupContainer->addElement(new htmlSubTitle(_("Groups")), true); - $groupContainer->addElement(new htmlOutputText(_("Selected groups"))); - $groupContainer->addElement(new htmlOutputText('')); - $groupContainer->addElement(new htmlOutputText(_("Available groups"))); - $groupContainer->addNewLine(); - $selectedGroups = array(); if (empty($this->attributes['memberOf'])) { $this->attributes['memberOf'] = array(); @@ -530,34 +525,13 @@ class windowsGroup extends baseModule { } } - $remGroupSelect = new htmlSelect('removegroups', $selectedGroups, null, 15); - $remGroupSelect->setMultiSelect(true); - $remGroupSelect->setTransformSingleSelect(false); - $remGroupSelect->setHasDescriptiveElements(true); - $remGroupSelect->setRightToLeftTextDirection(true); - $remGroupSelect->setSortElements(false); - $groupContainer->addElement($remGroupSelect); - $buttonGroupContainer = new htmlTable(); - $buttonGroupContainer->addElement(new htmlButton('addgroups_button', 'back.gif', true), true); - $buttonGroupContainer->addElement(new htmlButton('removegroups_button', 'forward.gif', true), true); - $groupContainer->addElement($buttonGroupContainer); - $addGroupSelect = new htmlSelect('addgroups', $availableGroups, null, 15); - $addGroupSelect->setMultiSelect(true); - $addGroupSelect->setHasDescriptiveElements(true); - $addGroupSelect->setTransformSingleSelect(false); - $addGroupSelect->setRightToLeftTextDirection(true); - $addGroupSelect->setSortElements(false); - $groupContainer->addElement($addGroupSelect); - $groupContainer->addNewLine(); - $return->addElement($groupContainer); - $return->addNewLine(); + $this->addDoubleSelectionArea($return, _("Selected groups"), _("Available groups"), $selectedGroups, + null, $availableGroups, null, 'memberof', false, true); - $backGroup = new htmlGroup(); - $backGroup->colspan = 10; - $backGroup->addElement(new htmlSpacer(null, '10px'), true); + $return->addVerticalSpacer('2rem'); $backButton = new htmlAccountPageButton(get_class($this), 'attributes', 'back', _('Back')); - $backGroup->addElement($backButton); - $return->addElement($backGroup); + $return->add($backButton, 12); + return $return; } @@ -568,12 +542,12 @@ class windowsGroup extends baseModule { * @return array list of info/error messages */ function process_memberof() { - if (isset($_POST['addgroups']) && isset($_POST['addgroups_button'])) { // Add groups to list + if (isset($_POST['memberof_2']) && isset($_POST['memberof_left'])) { // Add groups to list // add new group - $this->attributes['memberOf'] = @array_merge($this->attributes['memberOf'], $_POST['addgroups']); + $this->attributes['memberOf'] = @array_merge($this->attributes['memberOf'], $_POST['memberof_2']); } - elseif (isset($_POST['removegroups']) && isset($_POST['removegroups_button'])) { // remove groups from list - $this->attributes['memberOf'] = array_delete($_POST['removegroups'], $this->attributes['memberOf']); + elseif (isset($_POST['memberof_1']) && isset($_POST['memberof_right'])) { // remove groups from list + $this->attributes['memberOf'] = array_delete($_POST['memberof_1'], $this->attributes['memberOf']); } return array(); } @@ -584,7 +558,7 @@ class windowsGroup extends baseModule { * @return htmlElement HTML meta data */ function display_html_managedBy() { - $return = new htmlTable(); + $return = new htmlResponsiveRow(); // show possible managers $options = array(); $filter = get_ldap_filter('user'); @@ -609,11 +583,13 @@ class windowsGroup extends baseModule { $membersSelect->setRightToLeftTextDirection(true); $membersSelect->setSortElements(false); $membersSelect->setTransformSingleSelect(false); - $return->addElement($membersSelect, true); - $buttonTable = new htmlTable(); + $return->add($membersSelect, 12); + $return->addVerticalSpacer('2rem'); + $buttonTable = new htmlGroup(); $buttonTable->addElement(new htmlAccountPageButton(get_class($this), 'attributes', 'set', _('Change'))); + $buttonTable->addElement(new htmlSpacer('0.5rem', null)); $buttonTable->addElement(new htmlAccountPageButton(get_class($this), 'attributes', 'cancel', _('Cancel'))); - $return->addElement($buttonTable); + $return->add($buttonTable, 12); return $return; } @@ -637,7 +613,7 @@ class windowsGroup extends baseModule { * @return htmlElement HTML meta data */ function display_html_user() { - $return = new htmlTable(); + $return = new htmlResponsiveRow(); $typeManager = new TypeManager(); // show list of possible new members if (isset($_POST['form_subpage_' . get_class($this) . '_user_select']) && isset($_POST['type'])) { @@ -648,7 +624,8 @@ class windowsGroup extends baseModule { $filter->setFieldSize('5em'); $filter->filterSelectBox('members'); $filterGroup->addElement($filter); - $return->addElement($filterGroup, true); + $return->add($filterGroup, 12); + $return->addVerticalSpacer('1rem'); $options = array(); $filter = get_ldap_filter($type->getId()); @@ -664,19 +641,21 @@ class windowsGroup extends baseModule { } } $size = 20; - if (sizeof($options) < 20) $size = sizeof($options); + if (sizeof($options) < 20) { + $size = sizeof($options); + } $membersSelect = new htmlSelect('members', $options, array(), $size); $membersSelect->setHasDescriptiveElements(true); $membersSelect->setMultiSelect(true); $membersSelect->setRightToLeftTextDirection(true); $membersSelect->setSortElements(false); $membersSelect->setTransformSingleSelect(false); - $return->addElement($membersSelect, true); - $return->addVerticalSpace('10px'); - $buttonTable = new htmlTable(); + $return->add($membersSelect, 12); + $return->addVerticalSpacer('2rem'); + $buttonTable = new htmlGroup(); $buttonTable->addElement(new htmlAccountPageButton(get_class($this), 'user', 'addMembers', _('Add'))); $buttonTable->addElement(new htmlAccountPageButton(get_class($this), 'user', 'cancel', _('Cancel'))); - $return->addElement($buttonTable); + $return->add($buttonTable, 12); return $return; } // show existing members @@ -701,11 +680,13 @@ class windowsGroup extends baseModule { $membersSelect->setRightToLeftTextDirection(true); $membersSelect->setSortElements(false); $membersSelect->setTransformSingleSelect(false); - $return->addElement($membersSelect, true); + $return->add($membersSelect, 12); + $return->addVerticalSpacer('0.5rem'); $removeButton = new htmlAccountPageButton(get_class($this), 'user', 'remove', _('Remove selected entries')); - $removeButton->colspan = 3; - $return->addElement($removeButton, true); - $return->addElement(new htmlOutputText(' ', false), true); + $return->add($removeButton, 12); + $return->addVerticalSpacer('2rem'); + $return->add(new htmlHorizontalLine(), 12); + $return->addVerticalSpacer('2rem'); } $types = $typeManager->getConfiguredTypes(); $options = array(); @@ -716,15 +697,14 @@ class windowsGroup extends baseModule { $optionsSelected[] = $type->getId(); } } - $typeTable = new htmlTable(); - $typeTable->addElement(new htmlOutputText(_('Add entries of this type:') . ' ')); + $return->addLabel(new htmlOutputText(_('Add entries of this type:'))); $typeSelect = new htmlSelect('type', $options, $optionsSelected); $typeSelect->setHasDescriptiveElements(true); - $typeTable->addElement($typeSelect); - $typeTable->addElement(new htmlAccountPageButton(get_class($this), 'user', 'select', _('Ok'))); - $return->addElement($typeTable, true); - $return->addElement(new htmlOutputText(' ', false), true); - $return->addElement(new htmlAccountPageButton(get_class($this), 'attributes', 'membersBack', _('Back'))); + $return->addField($typeSelect); + $return->addLabel(new htmlOutputText(' ', false)); + $return->addField(new htmlAccountPageButton(get_class($this), 'user', 'select', _('Ok'))); + $return->addVerticalSpacer('2rem'); + $return->add(new htmlAccountPageButton(get_class($this), 'attributes', 'membersBack', _('Back')), 12); return $return; } @@ -768,7 +748,7 @@ class windowsGroup extends baseModule { * @return htmlElement HTML meta data */ function display_html_effectiveMembers() { - $return = new htmlTable(); + $return = new htmlResponsiveRow(); $effectiveMembers = $this->getEffectiveMembers(); $entryTable = new htmlTable(); // sort by DN, align right @@ -779,9 +759,9 @@ class windowsGroup extends baseModule { $entry->alignment = htmlElement::ALIGN_RIGHT; $entryTable->addElement($entry, true); } - $return->addElement($entryTable, true); - $return->addVerticalSpace('10px'); - $return->addElement(new htmlAccountPageButton(get_class($this), 'attributes', 'membersEffectiveBack', _('Back'))); + $return->add($entryTable, 12); + $return->addVerticalSpacer('2rem'); + $return->add(new htmlAccountPageButton(get_class($this), 'attributes', 'membersEffectiveBack', _('Back')), 12); return $return; } @@ -803,7 +783,9 @@ class windowsGroup extends baseModule { $errors = array(); for ($i = 0; $i < sizeof($rawAccounts); $i++) { // add object class - if (!in_array('group', $partialAccounts[$i]['objectClass'])) $partialAccounts[$i]['objectClass'][] = 'group'; + if (!in_array('group', $partialAccounts[$i]['objectClass'])) { + $partialAccounts[$i]['objectClass'][] = 'group'; + } // cn + sAMAccountName if ($rawAccounts[$i][$ids['windowsGroup_name']] != "") { if (get_preg($rawAccounts[$i][$ids['windowsGroup_name']], 'groupname')) { @@ -1034,7 +1016,6 @@ class windowsGroup extends baseModule { } $toAdd = array_values(array_diff($this->attributes['memberOf'], $this->orig['memberOf'])); $toRem = array_values(array_diff($this->orig['memberOf'], $this->attributes['memberOf'])); - $toUpdate = array_values(array_intersect($this->attributes['memberOf'], $this->orig['memberOf'])); // add groups for ($i = 0; $i < sizeof($toAdd); $i++) { if (in_array($toAdd[$i], $groups)) { diff --git a/lam/lib/modules/windowsHost.inc b/lam/lib/modules/windowsHost.inc index 596addff..0c3586a2 100644 --- a/lam/lib/modules/windowsHost.inc +++ b/lam/lib/modules/windowsHost.inc @@ -1,9 +1,8 @@ addSimpleInputTextField($container, 'cn', _('Host name'), true); $this->addSimpleInputTextField($container, 'description', _('Description'), false); $this->addSimpleInputTextField($container, 'location', _('Location'), false); // managed by - $container->addElement(new htmlOutputText(_('Managed by'))); + $container->addLabel(new htmlOutputText(_('Managed by'))); $managedBy = '-'; if (isset($this->attributes['managedBy'][0])) { $managedBy = $this->attributes['managedBy'][0]; } - $container->addElement(new htmlOutputText(getAbstractDN($managedBy))); - $container->addElement(new htmlHelpLink('managedBy'), true); - $container->addElement(new htmlOutputText('')); + $managedByGroup = new htmlGroup(); + $managedByGroup->addElement(new htmlOutputText(getAbstractDN($managedBy))); + $managedByGroup->addElement(new htmlSpacer('0.5rem', null)); + $managedByGroup->addElement(new htmlHelpLink('managedBy'), true); + $container->addField($managedByGroup); + $container->addLabel(new htmlOutputText(' ', false)); $managedByButtons = new htmlGroup(); $managedByButtons->addElement(new htmlAccountPageButton(get_class($this), 'managedBy', 'edit', _('Change'))); if (isset($this->attributes['managedBy'][0])) { $managedByButtons->addElement(new htmlSpacer('5px', null)); $managedByButtons->addElement(new htmlAccountPageButton(get_class($this), 'attributes', 'removeManagedBy', _('Remove'))); } - $container->addElement($managedByButtons, true); + $container->addField($managedByButtons); return $container; } @@ -195,7 +197,7 @@ class windowsHost extends baseModule { * @return htmlElement HTML meta data */ function display_html_managedBy() { - $return = new htmlTable(); + $return = new htmlResponsiveRow(); // show possible managers $options = array(); $filter = get_ldap_filter('user'); @@ -220,11 +222,12 @@ class windowsHost extends baseModule { $membersSelect->setRightToLeftTextDirection(true); $membersSelect->setSortElements(false); $membersSelect->setTransformSingleSelect(false); - $return->addElement($membersSelect, true); + $return->add($membersSelect, 12); + $return->addVerticalSpacer('2rem'); $buttonTable = new htmlTable(); $buttonTable->addElement(new htmlAccountPageButton(get_class($this), 'attributes', 'set', _('Change'))); $buttonTable->addElement(new htmlAccountPageButton(get_class($this), 'attributes', 'cancel', _('Cancel'))); - $return->addElement($buttonTable); + $return->add($buttonTable, 12); return $return; } diff --git a/lam/lib/modules/windowsPosixGroup.inc b/lam/lib/modules/windowsPosixGroup.inc index 1e99b334..c1cfd080 100644 --- a/lam/lib/modules/windowsPosixGroup.inc +++ b/lam/lib/modules/windowsPosixGroup.inc @@ -1,9 +1,8 @@