responsive

This commit is contained in:
Roland Gruber 2019-09-26 18:05:06 +02:00
parent 7add41b48e
commit a9c0833250
4 changed files with 136 additions and 206 deletions

View File

@ -195,7 +195,7 @@ 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(); $return = new htmlResponsiveRow();
$modules = $this->getAccountContainer()->get_type()->getModules(); $modules = $this->getAccountContainer()->get_type()->getModules();
$typeId = $this->getAccountContainer()->get_type()->getId(); $typeId = $this->getAccountContainer()->get_type()->getId();
if ($this->autoAddObjectClasses || (isset($this->attributes['objectClass']) && in_array('posixGroup', $this->attributes['objectClass']))) { 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 // group name
if ($this->manageCnAndDescription($modules)) { if ($this->manageCnAndDescription($modules)) {
$cn = ''; $this->addSimpleInputTextField($return, 'cn', _("Group name"), true);
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);
} }
// GID number // GID number
$gidNumber = ''; $gidNumberInput = $this->addSimpleInputTextField($return, 'gidNumber', _('GID number'));
if (isset($this->attributes['gidNumber'][0])) {
$gidNumber = $this->attributes['gidNumber'][0];
}
$gidNumberInput = new htmlTableExtendedInputField(_('GID number'), 'gidNumber', $gidNumber, 'gidNumber');
$gidNumberInput->setFieldMaxLength(20);
$gidNumberInput->setValidationRule(htmlElement::VALIDATE_NUMERIC); $gidNumberInput->setValidationRule(htmlElement::VALIDATE_NUMERIC);
$return->addElement($gidNumberInput, true);
// description // description
$description = '';
if (isset($this->attributes['description'][0])) {
$description = $this->attributes['description'][0];
}
if ($this->manageCnAndDescription($modules)) { if ($this->manageCnAndDescription($modules)) {
$return->addElement(new htmlTableExtendedInputField(_('Description'), 'description', $description, 'description'), true); $this->addSimpleInputTextField($return, 'description', _('Description'));
} }
// password buttons // password buttons
if (checkIfWriteAccessIsAllowed($this->get_scope()) && isset($this->attributes[$this->passwordAttrName][0])) { if (checkIfWriteAccessIsAllowed($this->get_scope()) && isset($this->attributes[$this->passwordAttrName][0])) {
$return->addElement(new htmlOutputText(_('Password'))); $return->addLabel(new htmlOutputText(_('Password')));
$pwdContainer = new htmlTable(); $pwdContainer = new htmlGroup();
if (pwd_is_enabled($this->attributes[$this->passwordAttrName][0])) { if (pwd_is_enabled($this->attributes[$this->passwordAttrName][0])) {
$pwdContainer->addElement(new htmlButton('lockPassword', _('Lock password'))); $pwdContainer->addElement(new htmlButton('lockPassword', _('Lock password')));
} }
else { else {
$pwdContainer->addElement(new htmlButton('unlockPassword', _('Unlock password'))); $pwdContainer->addElement(new htmlButton('unlockPassword', _('Unlock password')));
} }
$pwdContainer->addElement(new htmlSpacer('0.5rem', null));
$pwdContainer->addElement(new htmlButton('removePassword', _('Remove password'))); $pwdContainer->addElement(new htmlButton('removePassword', _('Remove password')));
$pwdContainer->colspan = 2; $return->addField($pwdContainer);
$return->addElement($pwdContainer, true);
} }
if (isset($this->orig['gidNumber'][0]) && $this->attributes['gidNumber'][0]!=$this->orig['gidNumber'][0]) { 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 // group members
if (!$this->isBooleanConfigOptionSet('posixGroup_' . $typeId . '_hidememberUid')) { 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')) { 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 { $membersGroup->addElement(new htmlHelpLink('members'));
$return->addElement(new htmlOutputText('')); $return->addField($membersGroup);
} $return->addLabel(new htmlOutputText(' ', false));
$return->addElement(new htmlHelpLink('members'), true);
$return->addElement(new htmlOutputText(''));
$users = $this->getUsers(); $users = $this->getUsers();
$members = array(); $members = array();
if (isset($this->attributes['memberUid'][0])) { if (isset($this->attributes['memberUid'][0])) {
@ -274,19 +257,18 @@ class posixGroup extends baseModule implements passwordService {
$members = array_unique($members); $members = array_unique($members);
natcasesort($members); natcasesort($members);
$members = array_map('htmlspecialchars', $members); $members = array_map('htmlspecialchars', $members);
$return->addElement(new htmlOutputText(implode('<br>', $members), false), true); $return->addField(new htmlOutputText(implode('<br>', $members), false));
} }
// remove button // remove button
if (!$this->autoAddObjectClasses) { if (!$this->autoAddObjectClasses) {
$return->addElement(new htmlSpacer(null, '20px'), true); $return->addVerticalSpacer('2rem');
$remButton = new htmlButton('remObjectClass', _('Remove Unix extension')); $remButton = new htmlButton('remObjectClass', _('Remove Unix extension'));
$remButton->colspan = 5; $return->add($remButton, 12, 12, 12, 'text-center');
$return->addElement($remButton);
} }
} }
else { else {
// add button // add button
$return->addElement(new htmlButton('addObjectClass', _('Add Unix extension'))); $return->add(new htmlButton('addObjectClass', _('Add Unix extension')), 12);
} }
return $return; return $return;
} }
@ -298,7 +280,7 @@ class posixGroup extends baseModule implements passwordService {
* @return array meta HTML output * @return array meta HTML output
*/ */
function display_html_user() { function display_html_user() {
$return = new htmlTable(); $return = new htmlResponsiveRow();
if (!isset($this->attributes['memberUid'])) { if (!isset($this->attributes['memberUid'])) {
$this->attributes['memberUid'] = array(); $this->attributes['memberUid'] = array();
} }
@ -319,12 +301,7 @@ class posixGroup extends baseModule implements passwordService {
} }
} }
} }
$return->addElement(new htmlSubTitle(_("Group members")), true); $return->add(new htmlSubTitle(_("Group members")), 12);
$return->addElement(new htmlOutputText(_("Selected users")));
$return->addElement(new htmlOutputText(''));
$return->addElement(new htmlOutputText(_("Available users")));
$return->addNewLine();
$remUsers = array(); $remUsers = array();
if (isset($this->attributes['memberUid'])) { if (isset($this->attributes['memberUid'])) {
@ -339,32 +316,9 @@ class posixGroup extends baseModule implements passwordService {
$remUsersDescriptive[$user] = $user; $remUsersDescriptive[$user] = $user;
} }
} }
$remSelect = new htmlSelect('removeusers', $remUsersDescriptive, null, 15);
$remSelect->setMultiSelect(true); $this->addDoubleSelectionArea($return, _("Selected users"), _("Available users"), $remUsersDescriptive, null,
$remSelect->setTransformSingleSelect(false); $users, null, 'members');
$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);
// sync from group of names // sync from group of names
$gon = $this->getAccountContainer()->getAccountModule('groupOfNames'); $gon = $this->getAccountContainer()->getAccountModule('groupOfNames');
@ -372,32 +326,26 @@ class posixGroup extends baseModule implements passwordService {
$gon = $this->getAccountContainer()->getAccountModule('groupOfUniqueNames'); $gon = $this->getAccountContainer()->getAccountModule('groupOfUniqueNames');
} }
if ($gon != null) { if ($gon != null) {
$return->addElement(new htmlSpacer(null, '20px'), true); $return->addVerticalSpacer('2rem');
$syncGroup = new htmlTable();
$syncGroup->colspan = 5;
$syncButton = new htmlButton('syncGON', sprintf(_('Sync from %s'), $gon->get_alias())); $syncButton = new htmlButton('syncGON', sprintf(_('Sync from %s'), $gon->get_alias()));
$syncButton->setIconClass('refreshButton'); $syncButton->setIconClass('refreshButton');
$syncGroup->addElement($syncButton); $return->add($syncButton, 12, 12, 12, 'text-center');
$syncGroup->addSpace('2rem'); $return->addVerticalSpacer('1rem');
$syncGroup->addElement(new htmlTableExtendedInputCheckbox('syncGON_delete', true, _('Delete non-matching entries'), null, false)); $return->add(new htmlResponsiveInputCheckbox('syncGON_delete', true, _('Delete non-matching entries'), null, false), 12);
$return->addElement($syncGroup, true);
} }
$windows = $this->getAccountContainer()->getAccountModule('windowsGroup'); $windows = $this->getAccountContainer()->getAccountModule('windowsGroup');
if ($windows != null) { if ($windows != null) {
$return->addElement(new htmlSpacer(null, '20px'), true); $return->addVerticalSpacer('2rem');
$syncGroup = new htmlTable();
$syncGroup->colspan = 5;
$syncButton = new htmlButton('syncWindows', sprintf(_('Sync from %s'), $windows->get_alias())); $syncButton = new htmlButton('syncWindows', sprintf(_('Sync from %s'), $windows->get_alias()));
$syncButton->setIconClass('refreshButton'); $syncButton->setIconClass('refreshButton');
$syncGroup->addElement($syncButton); $return->add($syncButton, 12, 12, 12, 'text-center');
$syncGroup->addSpace('2rem'); $return->addVerticalSpacer('1rem');
$syncGroup->addElement(new htmlTableExtendedInputCheckbox('syncWindows_delete', true, _('Delete non-matching entries'), null, false)); $return->add(new htmlResponsiveInputCheckbox('syncWindows_delete', true, _('Delete non-matching entries'), null, false), 12);
$return->addElement($syncGroup, true);
} }
// back button // back button
$return->addElement(new htmlSpacer(null, '20px'), true); $return->addVerticalSpacer('2rem');
$return->addElement(new htmlAccountPageButton(get_class($this), 'attributes', 'back', _('Back')), true); $return->add(new htmlAccountPageButton(get_class($this), 'attributes', 'back', _('Back')), 12);
return $return; return $return;
} }
@ -998,13 +946,12 @@ class posixGroup extends baseModule implements passwordService {
if (!isset($this->attributes['memberUid'])) { if (!isset($this->attributes['memberUid'])) {
$this->attributes['memberUid'] = array(); $this->attributes['memberUid'] = array();
} }
// add users if (isset($_POST['members_2']) && isset($_POST['members_left'])) { // Add groups to list
if (isset($_POST['addusers']) && isset($_POST['addusers_button'])) { // Add users to list // add new group
$this->attributes['memberUid'] = @array_merge($this->attributes['memberUid'], $_POST['addusers']); $this->attributes['memberUid'] = @array_merge($this->attributes['memberUid'], $_POST['members_2']);
} }
// remove users elseif (isset($_POST['members_1']) && isset($_POST['members_right'])) { // remove groups from list
elseif (isset($_POST['removeusers']) && isset($_POST['removeusers_button'])) { // remove users from list $this->attributes['memberUid'] = array_delete($_POST['members_1'], $this->attributes['memberUid']);
$this->attributes['memberUid'] = array_delete($_POST['removeusers'], $this->attributes['memberUid']);
} }
// sync users // sync users
elseif (isset($_POST['syncGON'])) { elseif (isset($_POST['syncGON'])) {

View File

@ -292,7 +292,7 @@ class windowsGroup extends baseModule {
* @return htmlElement HTML meta data * @return htmlElement HTML meta data
*/ */
public function display_html_attributes() { public function display_html_attributes() {
$container = new htmlTable(); $container = new htmlResponsiveRow();
$this->addSimpleInputTextField($container, 'cn', _('Group name'), true); $this->addSimpleInputTextField($container, 'cn', _('Group name'), true);
$this->addSimpleInputTextField($container, 'description', _('Description'), false); $this->addSimpleInputTextField($container, 'description', _('Description'), false);
if (!$this->isBooleanConfigOptionSet('windowsGroup_hidemail')) { if (!$this->isBooleanConfigOptionSet('windowsGroup_hidemail')) {
@ -331,58 +331,58 @@ class windowsGroup extends baseModule {
unset($scopeList[$flippedScopes[windowsGroup::SCOPE_GLOBAL]]); 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); $groupScopeSelect->setHasDescriptiveElements(true);
$container->addElement($groupScopeSelect, true); $container->add($groupScopeSelect, 12);
$groupTypeSelect = new htmlTableExtendedSelect('groupType', $this->groupTypes, array($groupType), _('Group type'), 'groupType'); $groupTypeSelect = new htmlResponsiveSelect('groupType', $this->groupTypes, array($groupType), _('Group type'), 'groupType');
$groupTypeSelect->setHasDescriptiveElements(true); $groupTypeSelect->setHasDescriptiveElements(true);
$container->addElement($groupTypeSelect, true); $container->add($groupTypeSelect, 12);
// notes // notes
$info = ''; $this->addSimpleInputTextField($container, 'info', _('Notes'), false, null, true);
if (isset($this->attributes['info'][0])) {
$info = $this->attributes['info'][0];
}
$container->addElement(new htmlTableExtendedInputTextarea('info', $info, 30, 5, _('Notes'), 'info'), true);
// managed by // managed by
if (!$this->isBooleanConfigOptionSet('windowsGroup_hidemanagedBy')) { if (!$this->isBooleanConfigOptionSet('windowsGroup_hidemanagedBy')) {
$container->addElement(new htmlOutputText(_('Managed by'))); $container->addLabel(new htmlOutputText(_('Managed by')));
$managedBy = '-'; $managedBy = '-';
if (isset($this->attributes['managedBy'][0])) { if (isset($this->attributes['managedBy'][0])) {
$managedBy = $this->attributes['managedBy'][0]; $managedBy = $this->attributes['managedBy'][0];
} }
$container->addElement(new htmlOutputText(getAbstractDN($managedBy))); $managedByGroup = new htmlGroup();
$container->addElement(new htmlHelpLink('managedBy'), true); $managedByGroup->addElement(new htmlOutputText(getAbstractDN($managedBy)));
$container->addElement(new htmlOutputText('')); $managedByGroup->addElement(new htmlSpacer('0.5rem', null));
$managedByGroup->addElement(new htmlHelpLink('managedBy'), true);
$container->addField($managedByGroup);
$managedByButtons = new htmlGroup(); $managedByButtons = new htmlGroup();
$managedByButtons->addElement(new htmlAccountPageButton(get_class($this), 'managedBy', 'edit', _('Change'))); $managedByButtons->addElement(new htmlAccountPageButton(get_class($this), 'managedBy', 'edit', _('Change')));
if (isset($this->attributes['managedBy'][0])) { if (isset($this->attributes['managedBy'][0])) {
$managedByButtons->addElement(new htmlSpacer('5px', null)); $managedByButtons->addElement(new htmlSpacer('5px', null));
$managedByButtons->addElement(new htmlAccountPageButton(get_class($this), 'attributes', 'removeManagedBy', _('Remove'))); $managedByButtons->addElement(new htmlAccountPageButton(get_class($this), 'attributes', 'removeManagedBy', _('Remove')));
} }
$container->addElement($managedByButtons, true); $container->addLabel(new htmlOutputText('&nbsp;', false));
$container->addField($managedByButtons);
} }
// NIS // NIS
if (!$this->isBooleanConfigOptionSet('windowsGroup_hidemsSFU30Name', true) || !$this->isBooleanConfigOptionSet('windowsGroup_hidemsSFU30NisDomain', true)) { 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)) { if (!$this->isBooleanConfigOptionSet('windowsGroup_hidemsSFU30Name', true)) {
$this->addSimpleInputTextField($container, 'msSFU30Name', _('NIS name')); $this->addSimpleInputTextField($container, 'msSFU30Name', _('NIS name'));
} }
if (!$this->isBooleanConfigOptionSet('windowsGroup_hidemsSFU30NisDomain', true)) { if (!$this->isBooleanConfigOptionSet('windowsGroup_hidemsSFU30NisDomain', true)) {
$this->addSimpleInputTextField($container, 'msSFU30NisDomain', _('NIS domain')); $this->addSimpleInputTextField($container, 'msSFU30NisDomain', _('NIS domain'));
} }
$container->addVerticalSpace('20px'); $container->addVerticalSpacer('2rem');
} }
// group members // group members
$container->addElement(new htmlSpacer(null, '10px'), true); $container->addVerticalSpacer('1rem');
$container->addElement(new htmlOutputText(_("Group members"))); $container->addLabel(new htmlOutputText(_("Group members")));
$memberButtons = new htmlGroup(); $memberButtons = new htmlGroup();
$memberButtons->addElement(new htmlAccountPageButton(get_class($this), 'user', 'open', _('Edit'))); $memberButtons->addElement(new htmlAccountPageButton(get_class($this), 'user', 'open', _('Edit')));
if (!empty($this->attributes['member'])) { 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'))); $memberButtons->addElement(new htmlAccountPageButton(get_class($this), 'effectiveMembers', 'open', _('Show effective members')));
} }
$container->addElement($memberButtons); $memberButtons->addElement(new htmlSpacer('0.5rem', null));
$container->addElement(new htmlHelpLink('member'), true); $memberButtons->addElement(new htmlHelpLink('member'));
$container->addField($memberButtons);
$memberList = array(); $memberList = array();
if (isset($this->attributes['member'])) { if (isset($this->attributes['member'])) {
for ($i = 0; $i < sizeof($this->attributes['member']); $i++) { for ($i = 0; $i < sizeof($this->attributes['member']); $i++) {
@ -392,19 +392,22 @@ class windowsGroup extends baseModule {
} }
$members = new htmlTable(); $members = new htmlTable();
$members->alignment = htmlElement::ALIGN_RIGHT; $members->alignment = htmlElement::ALIGN_RIGHT;
$members->colspan = 3; $members->setCSSClasses(array('fullwidth'));
for ($i = 0; $i < sizeof($memberList); $i++) { for ($i = 0; $i < sizeof($memberList); $i++) {
$member = new htmlOutputText(getAbstractDN($memberList[$i])); $member = new htmlOutputText(getAbstractDN($memberList[$i]));
$member->alignment = htmlElement::ALIGN_RIGHT; $member->alignment = htmlElement::ALIGN_RIGHT;
$members->addElement($member, true); $members->addElement($member, true);
} }
$container->addElement(new htmlOutputText('')); $container->addLabel(new htmlOutputText('&nbsp;', false));
$container->addElement($members, true); $container->addField($members);
// member of // member of
$container->addVerticalSpace('10px'); $container->addVerticalSpacer('2rem');
$container->addElement(new htmlOutputText(_("Member of"))); $container->addLabel(new htmlOutputText(_("Member of")));
$container->addElement(new htmlAccountPageButton(get_class($this), 'memberof', 'open', _('Edit'))); $memberOfGroup = new htmlGroup();
$container->addElement(new htmlHelpLink('memberOf'), true); $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(); $memberList = array();
if (isset($this->attributes['memberOf'])) { if (isset($this->attributes['memberOf'])) {
for ($i = 0; $i < sizeof($this->attributes['memberOf']); $i++) { for ($i = 0; $i < sizeof($this->attributes['memberOf']); $i++) {
@ -413,17 +416,16 @@ class windowsGroup extends baseModule {
usort($memberList, 'compareDN'); usort($memberList, 'compareDN');
} }
$memberOf = new htmlTable(); $memberOf = new htmlTable();
$memberOf->setCSSClasses(array('fullwidth'));
$memberOf->alignment = htmlElement::ALIGN_RIGHT; $memberOf->alignment = htmlElement::ALIGN_RIGHT;
$memberOf->colspan = 3;
for ($i = 0; $i < sizeof($memberList); $i++) { for ($i = 0; $i < sizeof($memberList); $i++) {
$member = new htmlOutputText(getAbstractDN($memberList[$i])); $member = new htmlOutputText(getAbstractDN($memberList[$i]));
$member->alignment = htmlElement::ALIGN_RIGHT; $member->alignment = htmlElement::ALIGN_RIGHT;
$memberOf->addElement($member, true); $memberOf->addElement($member, true);
} }
$container->addElement(new htmlOutputText('')); $container->addLabel(new htmlOutputText('&nbsp;', false));
$container->addElement($memberOf, true); $container->addField($memberOf);
$container->addElement(new htmlEqualWidth(array('groupType', 'groupScope')));
return $container; return $container;
} }
@ -499,19 +501,12 @@ class windowsGroup extends baseModule {
* @return htmlElement meta HTML code * @return htmlElement meta HTML code
*/ */
function display_html_memberof() { function display_html_memberof() {
$return = new htmlTable(); $return = new htmlResponsiveRow();
$return->add(new htmlSubTitle(_("Groups")), 12);
$groups = $this->findGroups(); $groups = $this->findGroups();
// sort by DN // sort by DN
usort($groups, 'compareDN'); 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(); $selectedGroups = array();
if (empty($this->attributes['memberOf'])) { if (empty($this->attributes['memberOf'])) {
$this->attributes['memberOf'] = array(); $this->attributes['memberOf'] = array();
@ -530,34 +525,13 @@ class windowsGroup extends baseModule {
} }
} }
$remGroupSelect = new htmlSelect('removegroups', $selectedGroups, null, 15); $this->addDoubleSelectionArea($return, _("Selected groups"), _("Available groups"), $selectedGroups,
$remGroupSelect->setMultiSelect(true); null, $availableGroups, null, 'memberof', false, 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();
$backGroup = new htmlGroup(); $return->addVerticalSpacer('2rem');
$backGroup->colspan = 10;
$backGroup->addElement(new htmlSpacer(null, '10px'), true);
$backButton = new htmlAccountPageButton(get_class($this), 'attributes', 'back', _('Back')); $backButton = new htmlAccountPageButton(get_class($this), 'attributes', 'back', _('Back'));
$backGroup->addElement($backButton); $return->add($backButton, 12);
$return->addElement($backGroup);
return $return; return $return;
} }
@ -568,12 +542,12 @@ class windowsGroup extends baseModule {
* @return array list of info/error messages * @return array list of info/error messages
*/ */
function process_memberof() { 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 // 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 elseif (isset($_POST['memberof_1']) && isset($_POST['memberof_right'])) { // remove groups from list
$this->attributes['memberOf'] = array_delete($_POST['removegroups'], $this->attributes['memberOf']); $this->attributes['memberOf'] = array_delete($_POST['memberof_1'], $this->attributes['memberOf']);
} }
return array(); return array();
} }
@ -584,7 +558,7 @@ class windowsGroup extends baseModule {
* @return htmlElement HTML meta data * @return htmlElement HTML meta data
*/ */
function display_html_managedBy() { function display_html_managedBy() {
$return = new htmlTable(); $return = new htmlResponsiveRow();
// show possible managers // show possible managers
$options = array(); $options = array();
$filter = get_ldap_filter('user'); $filter = get_ldap_filter('user');
@ -609,11 +583,13 @@ class windowsGroup extends baseModule {
$membersSelect->setRightToLeftTextDirection(true); $membersSelect->setRightToLeftTextDirection(true);
$membersSelect->setSortElements(false); $membersSelect->setSortElements(false);
$membersSelect->setTransformSingleSelect(false); $membersSelect->setTransformSingleSelect(false);
$return->addElement($membersSelect, true); $return->add($membersSelect, 12);
$buttonTable = new htmlTable(); $return->addVerticalSpacer('2rem');
$buttonTable = new htmlGroup();
$buttonTable->addElement(new htmlAccountPageButton(get_class($this), 'attributes', 'set', _('Change'))); $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'))); $buttonTable->addElement(new htmlAccountPageButton(get_class($this), 'attributes', 'cancel', _('Cancel')));
$return->addElement($buttonTable); $return->add($buttonTable, 12);
return $return; return $return;
} }
@ -637,7 +613,7 @@ class windowsGroup extends baseModule {
* @return htmlElement HTML meta data * @return htmlElement HTML meta data
*/ */
function display_html_user() { function display_html_user() {
$return = new htmlTable(); $return = new htmlResponsiveRow();
$typeManager = new TypeManager(); $typeManager = new TypeManager();
// show list of possible new members // show list of possible new members
if (isset($_POST['form_subpage_' . get_class($this) . '_user_select']) && isset($_POST['type'])) { 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->setFieldSize('5em');
$filter->filterSelectBox('members'); $filter->filterSelectBox('members');
$filterGroup->addElement($filter); $filterGroup->addElement($filter);
$return->addElement($filterGroup, true); $return->add($filterGroup, 12);
$return->addVerticalSpacer('1rem');
$options = array(); $options = array();
$filter = get_ldap_filter($type->getId()); $filter = get_ldap_filter($type->getId());
@ -664,19 +641,21 @@ class windowsGroup extends baseModule {
} }
} }
$size = 20; $size = 20;
if (sizeof($options) < 20) $size = sizeof($options); if (sizeof($options) < 20) {
$size = sizeof($options);
}
$membersSelect = new htmlSelect('members', $options, array(), $size); $membersSelect = new htmlSelect('members', $options, array(), $size);
$membersSelect->setHasDescriptiveElements(true); $membersSelect->setHasDescriptiveElements(true);
$membersSelect->setMultiSelect(true); $membersSelect->setMultiSelect(true);
$membersSelect->setRightToLeftTextDirection(true); $membersSelect->setRightToLeftTextDirection(true);
$membersSelect->setSortElements(false); $membersSelect->setSortElements(false);
$membersSelect->setTransformSingleSelect(false); $membersSelect->setTransformSingleSelect(false);
$return->addElement($membersSelect, true); $return->add($membersSelect, 12);
$return->addVerticalSpace('10px'); $return->addVerticalSpacer('2rem');
$buttonTable = new htmlTable(); $buttonTable = new htmlGroup();
$buttonTable->addElement(new htmlAccountPageButton(get_class($this), 'user', 'addMembers', _('Add'))); $buttonTable->addElement(new htmlAccountPageButton(get_class($this), 'user', 'addMembers', _('Add')));
$buttonTable->addElement(new htmlAccountPageButton(get_class($this), 'user', 'cancel', _('Cancel'))); $buttonTable->addElement(new htmlAccountPageButton(get_class($this), 'user', 'cancel', _('Cancel')));
$return->addElement($buttonTable); $return->add($buttonTable, 12);
return $return; return $return;
} }
// show existing members // show existing members
@ -701,11 +680,13 @@ class windowsGroup extends baseModule {
$membersSelect->setRightToLeftTextDirection(true); $membersSelect->setRightToLeftTextDirection(true);
$membersSelect->setSortElements(false); $membersSelect->setSortElements(false);
$membersSelect->setTransformSingleSelect(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 = new htmlAccountPageButton(get_class($this), 'user', 'remove', _('Remove selected entries'));
$removeButton->colspan = 3; $return->add($removeButton, 12);
$return->addElement($removeButton, true); $return->addVerticalSpacer('2rem');
$return->addElement(new htmlOutputText('&nbsp;', false), true); $return->add(new htmlHorizontalLine(), 12);
$return->addVerticalSpacer('2rem');
} }
$types = $typeManager->getConfiguredTypes(); $types = $typeManager->getConfiguredTypes();
$options = array(); $options = array();
@ -716,15 +697,14 @@ class windowsGroup extends baseModule {
$optionsSelected[] = $type->getId(); $optionsSelected[] = $type->getId();
} }
} }
$typeTable = new htmlTable(); $return->addLabel(new htmlOutputText(_('Add entries of this type:')));
$typeTable->addElement(new htmlOutputText(_('Add entries of this type:') . ' '));
$typeSelect = new htmlSelect('type', $options, $optionsSelected); $typeSelect = new htmlSelect('type', $options, $optionsSelected);
$typeSelect->setHasDescriptiveElements(true); $typeSelect->setHasDescriptiveElements(true);
$typeTable->addElement($typeSelect); $return->addField($typeSelect);
$typeTable->addElement(new htmlAccountPageButton(get_class($this), 'user', 'select', _('Ok'))); $return->addLabel(new htmlOutputText('&nbsp;', false));
$return->addElement($typeTable, true); $return->addField(new htmlAccountPageButton(get_class($this), 'user', 'select', _('Ok')));
$return->addElement(new htmlOutputText('&nbsp;', false), true); $return->addVerticalSpacer('2rem');
$return->addElement(new htmlAccountPageButton(get_class($this), 'attributes', 'membersBack', _('Back'))); $return->add(new htmlAccountPageButton(get_class($this), 'attributes', 'membersBack', _('Back')), 12);
return $return; return $return;
} }
@ -768,7 +748,7 @@ class windowsGroup extends baseModule {
* @return htmlElement HTML meta data * @return htmlElement HTML meta data
*/ */
function display_html_effectiveMembers() { function display_html_effectiveMembers() {
$return = new htmlTable(); $return = new htmlResponsiveRow();
$effectiveMembers = $this->getEffectiveMembers(); $effectiveMembers = $this->getEffectiveMembers();
$entryTable = new htmlTable(); $entryTable = new htmlTable();
// sort by DN, align right // sort by DN, align right
@ -779,9 +759,9 @@ class windowsGroup extends baseModule {
$entry->alignment = htmlElement::ALIGN_RIGHT; $entry->alignment = htmlElement::ALIGN_RIGHT;
$entryTable->addElement($entry, true); $entryTable->addElement($entry, true);
} }
$return->addElement($entryTable, true); $return->add($entryTable, 12);
$return->addVerticalSpace('10px'); $return->addVerticalSpacer('2rem');
$return->addElement(new htmlAccountPageButton(get_class($this), 'attributes', 'membersEffectiveBack', _('Back'))); $return->add(new htmlAccountPageButton(get_class($this), 'attributes', 'membersEffectiveBack', _('Back')), 12);
return $return; return $return;
} }
@ -803,7 +783,9 @@ class windowsGroup extends baseModule {
$errors = array(); $errors = array();
for ($i = 0; $i < sizeof($rawAccounts); $i++) { for ($i = 0; $i < sizeof($rawAccounts); $i++) {
// add object class // 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 // cn + sAMAccountName
if ($rawAccounts[$i][$ids['windowsGroup_name']] != "") { if ($rawAccounts[$i][$ids['windowsGroup_name']] != "") {
if (get_preg($rawAccounts[$i][$ids['windowsGroup_name']], 'groupname')) { 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'])); $toAdd = array_values(array_diff($this->attributes['memberOf'], $this->orig['memberOf']));
$toRem = array_values(array_diff($this->orig['memberOf'], $this->attributes['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 // add groups
for ($i = 0; $i < sizeof($toAdd); $i++) { for ($i = 0; $i < sizeof($toAdd); $i++) {
if (in_array($toAdd[$i], $groups)) { if (in_array($toAdd[$i], $groups)) {

View File

@ -1,9 +1,8 @@
<?php <?php
/* /*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2013 - 2015 Roland Gruber Copyright (C) 2013 - 2019 Roland Gruber
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
@ -138,26 +137,29 @@ class windowsHost extends baseModule {
* @return htmlElement HTML meta data * @return htmlElement HTML meta data
*/ */
public function display_html_attributes() { public function display_html_attributes() {
$container = new htmlTable(); $container = new htmlResponsiveRow();
$this->addSimpleInputTextField($container, 'cn', _('Host name'), true); $this->addSimpleInputTextField($container, 'cn', _('Host name'), true);
$this->addSimpleInputTextField($container, 'description', _('Description'), false); $this->addSimpleInputTextField($container, 'description', _('Description'), false);
$this->addSimpleInputTextField($container, 'location', _('Location'), false); $this->addSimpleInputTextField($container, 'location', _('Location'), false);
// managed by // managed by
$container->addElement(new htmlOutputText(_('Managed by'))); $container->addLabel(new htmlOutputText(_('Managed by')));
$managedBy = '-'; $managedBy = '-';
if (isset($this->attributes['managedBy'][0])) { if (isset($this->attributes['managedBy'][0])) {
$managedBy = $this->attributes['managedBy'][0]; $managedBy = $this->attributes['managedBy'][0];
} }
$container->addElement(new htmlOutputText(getAbstractDN($managedBy))); $managedByGroup = new htmlGroup();
$container->addElement(new htmlHelpLink('managedBy'), true); $managedByGroup->addElement(new htmlOutputText(getAbstractDN($managedBy)));
$container->addElement(new htmlOutputText('')); $managedByGroup->addElement(new htmlSpacer('0.5rem', null));
$managedByGroup->addElement(new htmlHelpLink('managedBy'), true);
$container->addField($managedByGroup);
$container->addLabel(new htmlOutputText('&nbsp;', false));
$managedByButtons = new htmlGroup(); $managedByButtons = new htmlGroup();
$managedByButtons->addElement(new htmlAccountPageButton(get_class($this), 'managedBy', 'edit', _('Change'))); $managedByButtons->addElement(new htmlAccountPageButton(get_class($this), 'managedBy', 'edit', _('Change')));
if (isset($this->attributes['managedBy'][0])) { if (isset($this->attributes['managedBy'][0])) {
$managedByButtons->addElement(new htmlSpacer('5px', null)); $managedByButtons->addElement(new htmlSpacer('5px', null));
$managedByButtons->addElement(new htmlAccountPageButton(get_class($this), 'attributes', 'removeManagedBy', _('Remove'))); $managedByButtons->addElement(new htmlAccountPageButton(get_class($this), 'attributes', 'removeManagedBy', _('Remove')));
} }
$container->addElement($managedByButtons, true); $container->addField($managedByButtons);
return $container; return $container;
} }
@ -195,7 +197,7 @@ class windowsHost extends baseModule {
* @return htmlElement HTML meta data * @return htmlElement HTML meta data
*/ */
function display_html_managedBy() { function display_html_managedBy() {
$return = new htmlTable(); $return = new htmlResponsiveRow();
// show possible managers // show possible managers
$options = array(); $options = array();
$filter = get_ldap_filter('user'); $filter = get_ldap_filter('user');
@ -220,11 +222,12 @@ class windowsHost extends baseModule {
$membersSelect->setRightToLeftTextDirection(true); $membersSelect->setRightToLeftTextDirection(true);
$membersSelect->setSortElements(false); $membersSelect->setSortElements(false);
$membersSelect->setTransformSingleSelect(false); $membersSelect->setTransformSingleSelect(false);
$return->addElement($membersSelect, true); $return->add($membersSelect, 12);
$return->addVerticalSpacer('2rem');
$buttonTable = new htmlTable(); $buttonTable = new htmlTable();
$buttonTable->addElement(new htmlAccountPageButton(get_class($this), 'attributes', 'set', _('Change'))); $buttonTable->addElement(new htmlAccountPageButton(get_class($this), 'attributes', 'set', _('Change')));
$buttonTable->addElement(new htmlAccountPageButton(get_class($this), 'attributes', 'cancel', _('Cancel'))); $buttonTable->addElement(new htmlAccountPageButton(get_class($this), 'attributes', 'cancel', _('Cancel')));
$return->addElement($buttonTable); $return->add($buttonTable, 12);
return $return; return $return;
} }

View File

@ -1,9 +1,8 @@
<?php <?php
/* /*
$Id$
This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/) This code is part of LDAP Account Manager (http://www.ldap-account-manager.org/)
Copyright (C) 2013 - 2017 Roland Gruber Copyright (C) 2013 - 2019 Roland Gruber
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by