responsive

This commit is contained in:
Roland Gruber 2019-11-02 12:01:16 +01:00
parent 75ce322789
commit 3169c85802
1 changed files with 34 additions and 41 deletions

View File

@ -126,9 +126,9 @@ class nisMailAliasUser extends baseModule {
* @return htmlElement HTML meta data * @return htmlElement HTML meta data
*/ */
function display_html_attributes() { function display_html_attributes() {
$return = new htmlTable(); $return = new htmlResponsiveRow();
if (!$this->isMailAliasTypeActive()) { if (!$this->isMailAliasTypeActive()) {
$return->addElement(new htmlStatusMessage('ERROR', _('Please activate the mail aliases type for this server profile.'))); $return->add(new htmlStatusMessage('ERROR', _('Please activate the mail aliases type for this server profile.')), 12);
return $return; return $return;
} }
$aliases = $this->getMailAliasList(); $aliases = $this->getMailAliasList();
@ -136,8 +136,7 @@ class nisMailAliasUser extends baseModule {
$userName = $this->getUserName(); $userName = $this->getUserName();
$mails = $this->getMailAddresses(); $mails = $this->getMailAddresses();
if (!$this->isBooleanConfigOptionSet('nisMailAliasUser_hideUserAliases') && ($userName != null)) { if (!$this->isBooleanConfigOptionSet('nisMailAliasUser_hideUserAliases') && ($userName != null)) {
$return->addElement(new htmlSubTitle(_('Aliases for user name')), true); $return->add(new htmlSubTitle(_('Aliases for user name')), 12);
$userTable = new htmlTable();
for ($i = 0; $i < $count; $i++) { for ($i = 0; $i < $count; $i++) {
if (empty($aliases[$i]['rfc822mailmember'])) { if (empty($aliases[$i]['rfc822mailmember'])) {
continue; continue;
@ -147,7 +146,7 @@ class nisMailAliasUser extends baseModule {
if (in_array($userName, $members) if (in_array($userName, $members)
&& (!isset($this->recipientsToDelete[$dn]) || !in_array($userName, $this->recipientsToDelete[$dn])) && (!isset($this->recipientsToDelete[$dn]) || !in_array($userName, $this->recipientsToDelete[$dn]))
&& !in_array($dn, $this->aliasesToDelete)) { && !in_array($dn, $this->aliasesToDelete)) {
$userTable->addElement(new htmlOutputText($aliases[$i]['cn'][0])); $return->addLabel(new htmlOutputText($aliases[$i]['cn'][0]));
$buttonGroup = new htmlGroup(); $buttonGroup = new htmlGroup();
$remButton = new htmlButton('rem_' . $i, 'del.png', true); $remButton = new htmlButton('rem_' . $i, 'del.png', true);
$remButton->setTitle(_('Remove user from alias entry.')); $remButton->setTitle(_('Remove user from alias entry.'));
@ -155,24 +154,20 @@ class nisMailAliasUser extends baseModule {
$delButton = new htmlButton('del_' . $i, 'trash.png', true); $delButton = new htmlButton('del_' . $i, 'trash.png', true);
$delButton->setTitle(sprintf(_('Delete whole alias entry which includes %s recipients.'), sizeof($members))); $delButton->setTitle(sprintf(_('Delete whole alias entry which includes %s recipients.'), sizeof($members)));
$buttonGroup->addElement($delButton); $buttonGroup->addElement($delButton);
$userTable->addElement($buttonGroup, true); $return->addField($buttonGroup);
} }
} }
$userTable->addVerticalSpace('5px'); $return->addVerticalSpacer('1rem');
$addButton = new htmlAccountPageButton(get_class($this), 'add', 'user', _('Add')); $addButton = new htmlAccountPageButton(get_class($this), 'add', 'user', _('Add'));
$addButton->setIconClass('createButton'); $addButton->setIconClass('createButton');
$addButton->colspan = 5; $return->add($addButton, 12, 12, 12, 'text-center');
$userTable->addElement($addButton, true);
$return->addElement($userTable, true);
} }
if (!$this->isBooleanConfigOptionSet('nisMailAliasUser_hideUserAliases') && !empty($mails)) { if (!$this->isBooleanConfigOptionSet('nisMailAliasUser_hideUserAliases') && !empty($mails)) {
$return->addElement(new htmlSubTitle(_('Aliases for email')), true); $return->add(new htmlSubTitle(_('Aliases for email')), 12);
$mailTable = new htmlTable();
for ($m = 0; $m < sizeof($mails); $m++) { for ($m = 0; $m < sizeof($mails); $m++) {
if (sizeof($mails) > 1) { if (sizeof($mails) > 1) {
$label = new htmlOutputText($mails[$m]); $label = new htmlOutputText($mails[$m]);
$label->colspan = 5; $return->add($label, 12);
$mailTable->addElement($label, true);
} }
for ($i = 0; $i < $count; $i++) { for ($i = 0; $i < $count; $i++) {
if (empty($aliases[$i]['rfc822mailmember'])) { if (empty($aliases[$i]['rfc822mailmember'])) {
@ -183,8 +178,7 @@ class nisMailAliasUser extends baseModule {
if (in_array($mails[$m], $members) if (in_array($mails[$m], $members)
&& (!isset($this->recipientsToDelete[$dn]) || !in_array($mails[$m], $this->recipientsToDelete[$dn])) && (!isset($this->recipientsToDelete[$dn]) || !in_array($mails[$m], $this->recipientsToDelete[$dn]))
&& !in_array($dn, $this->aliasesToDelete)) { && !in_array($dn, $this->aliasesToDelete)) {
$mailTable->addSpace('5px'); $return->addLabel(new htmlOutputText($aliases[$i]['cn'][0]));
$mailTable->addElement(new htmlOutputText($aliases[$i]['cn'][0]));
$buttonGroup = new htmlGroup(); $buttonGroup = new htmlGroup();
$remButton = new htmlButton('remMail_' . $i . '_' . $m, 'del.png', true); $remButton = new htmlButton('remMail_' . $i . '_' . $m, 'del.png', true);
$remButton->setTitle(_('Remove user from alias entry.')); $remButton->setTitle(_('Remove user from alias entry.'));
@ -192,19 +186,17 @@ class nisMailAliasUser extends baseModule {
$delButton = new htmlButton('delMail_' . $i . '_' . $m, 'trash.png', true); $delButton = new htmlButton('delMail_' . $i . '_' . $m, 'trash.png', true);
$delButton->setTitle(sprintf(_('Delete whole alias entry which includes %s recipients.'), sizeof($members))); $delButton->setTitle(sprintf(_('Delete whole alias entry which includes %s recipients.'), sizeof($members)));
$buttonGroup->addElement($delButton); $buttonGroup->addElement($delButton);
$mailTable->addElement($buttonGroup, true); $return->addField($buttonGroup);
} }
} }
$mailTable->addVerticalSpace('5px'); $return->addVerticalSpacer('1rem');
$addButton = new htmlAccountPageButton(get_class($this), 'add', 'mail' . $m, _('Add')); $addButton = new htmlAccountPageButton(get_class($this), 'add', 'mail' . $m, _('Add'));
$addButton->setIconClass('createButton'); $addButton->setIconClass('createButton');
$addButton->colspan = 5; $return->add($addButton, 12, 12, 12, 'text-center');
$mailTable->addElement($addButton, true);
if ((sizeof($mails) > 1) && ($m < (sizeof($mails) - 1))) { if ((sizeof($mails) > 1) && ($m < (sizeof($mails) - 1))) {
$mailTable->addVerticalSpace('20px'); $return->addVerticalSpacer('2rem');
} }
} }
$return->addElement($mailTable, true);
} }
return $return; return $return;
} }
@ -329,7 +321,7 @@ class nisMailAliasUser extends baseModule {
* @return htmlElement HTML meta data * @return htmlElement HTML meta data
*/ */
function display_html_add() { function display_html_add() {
$return = new htmlTable(); $return = new htmlResponsiveRow();
$aliases = $this->getMailAliasList(); $aliases = $this->getMailAliasList();
$userName = $this->getUserName(); $userName = $this->getUserName();
$mails = $this->getMailAddresses(); $mails = $this->getMailAddresses();
@ -349,11 +341,11 @@ class nisMailAliasUser extends baseModule {
} }
} }
} }
$return->addElement(new htmlOutputText(_('Recipient'))); $return->addLabel(new htmlOutputText(_('Recipient')));
$return->addElement(new htmlOutputText($recipient), true); $return->addField(new htmlOutputText($recipient));
$return->addElement(new htmlHiddenInput('recipient', $recipient), true); $return->add(new htmlHiddenInput('recipient', $recipient), 12);
// new mail alias // new mail alias
$return->addElement(new htmlSubTitle(_('Create new alias')), true); $return->add(new htmlSubTitle(_('Create new alias')), 12);
$typeManager = new \LAM\TYPES\TypeManager(); $typeManager = new \LAM\TYPES\TypeManager();
$mailAliasTypes = $typeManager->getConfiguredTypesForScope('mailAlias'); $mailAliasTypes = $typeManager->getConfiguredTypesForScope('mailAlias');
$ous = array(); $ous = array();
@ -362,22 +354,21 @@ class nisMailAliasUser extends baseModule {
} }
$ous = array_unique($ous); $ous = array_unique($ous);
usort($ous, 'compareDN'); usort($ous, 'compareDN');
$suffixSelect = new htmlTableExtendedSelect('new_ou', $ous, array(), _('Suffix'), 'suffix'); $suffixSelect = new htmlResponsiveSelect('new_ou', $ous, array(), _('Suffix'), 'suffix');
$suffixSelect->setRightToLeftTextDirection(true); $suffixSelect->setRightToLeftTextDirection(true);
$suffixSelect->setSortElements(false); $suffixSelect->setSortElements(false);
$return->addElement($suffixSelect, true); $return->add($suffixSelect, 12);
$newAliasCn = empty($_POST['new_cn']) ? '' : $_POST['new_cn']; $newAliasCn = empty($_POST['new_cn']) ? '' : $_POST['new_cn'];
$return->addElement(new htmlTableExtendedInputField(_('Alias name'), 'new_cn', $newAliasCn, 'newAlias'), true); $return->add(new htmlResponsiveInputField(_('Alias name'), 'new_cn', $newAliasCn, 'newAlias'), 12);
$return->addVerticalSpace('5px'); $return->addVerticalSpacer('1rem');
$addButton = new htmlAccountPageButton(get_class($this), 'attributes', 'create', _('Create')); $addButton = new htmlAccountPageButton(get_class($this), 'attributes', 'create', _('Create'));
$addButton->setIconClass('createButton'); $addButton->setIconClass('createButton');
$addButton->colspan = 5; $return->add($addButton, 12, 12, 12, 'text-center');
$return->addElement($addButton, true);
$return->addVerticalSpace('20px'); $return->addVerticalSpacer('2rem');
// add to existing alias // add to existing alias
$return->addElement(new htmlSubTitle(_('Add to existing alias')), true); $return->add(new htmlSubTitle(_('Add to existing alias')), 12);
$aliasesToAdd = array(); $aliasesToAdd = array();
foreach ($aliases as $index => $attrs) { foreach ($aliases as $index => $attrs) {
if (!empty($attrs['rfc822mailmember']) && in_array($recipient, $attrs['rfc822mailmember'])) { if (!empty($attrs['rfc822mailmember']) && in_array($recipient, $attrs['rfc822mailmember'])) {
@ -385,17 +376,19 @@ class nisMailAliasUser extends baseModule {
} }
$aliasesToAdd[$attrs['cn'][0]] = $index; $aliasesToAdd[$attrs['cn'][0]] = $index;
} }
$aliasSelect = new htmlTableExtendedSelect('ex_cn', $aliasesToAdd, array(), _('Alias names'), 'aliasNames', 20); $aliasSelect = new htmlResponsiveSelect('ex_cn', $aliasesToAdd, array(), _('Alias names'), 'aliasNames', 20);
$aliasSelect->setHasDescriptiveElements(true); $aliasSelect->setHasDescriptiveElements(true);
$aliasSelect->setMultiSelect(true); $aliasSelect->setMultiSelect(true);
$return->addElement($aliasSelect, true); $return->add($aliasSelect, 12);
$return->addVerticalSpace('5px'); $return->addVerticalSpacer('1rem');
$addButton = new htmlAccountPageButton(get_class($this), 'attributes', 'recipient', _('Add')); $addButton = new htmlAccountPageButton(get_class($this), 'attributes', 'recipient', _('Add'));
$addButton->setIconClass('createButton'); $addButton->setIconClass('createButton');
$addButton->colspan = 5; $return->add($addButton, 12, 12, 12, 'text-center');
$return->addElement($addButton, true);
$return->addElement(new htmlEqualWidth(array('new_ou', 'new_cn', 'ex_cn'))); $return->addVerticalSpacer('2rem');
$cancelButton = new htmlAccountPageButton(get_class($this), 'attributes', 'back', _('Cancel'));
$cancelButton->setIconClass('cancelButton');
$return->add($cancelButton, 12);
return $return; return $return;
} }