responsive

This commit is contained in:
Roland Gruber 2019-09-27 19:00:05 +02:00
parent 807925d9a7
commit 0eff6e7065
2 changed files with 50 additions and 39 deletions

View File

@ -153,15 +153,16 @@ class nisMailAlias 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();
// alias name // alias name
$alias = ''; $alias = '';
if (isset($this->attributes['cn'][0])) { if (isset($this->attributes['cn'][0])) {
$alias = $this->attributes['cn'][0]; $alias = $this->attributes['cn'][0];
} }
$nameInput = new htmlTableExtendedInputField(_('Alias name'), 'cn', $alias, 'alias'); $nameInput = new htmlResponsiveInputField(_('Alias name'), 'cn', $alias, 'alias');
$nameInput->setRequired(true); $nameInput->setRequired(true);
$return->addElement($nameInput, true); $nameInput->setCSSClasses(array('maxwidth20'));
$return->add($nameInput, 12);
// list current recipients // list current recipients
$mailList = $this->getMailList(); $mailList = $this->getMailList();
$userList = $this->getUserList(); $userList = $this->getUserList();
@ -177,45 +178,50 @@ class nisMailAlias extends baseModule {
if ($recipientCount < nisMailAlias::DISPLAY_LIMIT) { if ($recipientCount < nisMailAlias::DISPLAY_LIMIT) {
for ($i = 0; $i < $recipientCount; $i++) { for ($i = 0; $i < $recipientCount; $i++) {
if (($i == 0) && ($recipientCount == 1)) { if (($i == 0) && ($recipientCount == 1)) {
$return->addElement(new htmlOutputText(_('Recipient'))); $return->addLabel(new htmlOutputText(_('Recipient')));
} }
elseif (($i == 0) && ($recipientCount > 1)) { elseif (($i == 0) && ($recipientCount > 1)) {
$return->addElement(new htmlOutputText(_('Recipients'))); $return->addLabel(new htmlOutputText(_('Recipients')));
} }
else { else {
$return->addElement(new htmlOutputText('')); $return->addLabel(new htmlOutputText('&nbsp;', false));
} }
$mailField = new htmlInputField('rfc822MailMember' . $i, $this->attributes['rfc822MailMember'][$i]); $mailField = new htmlInputField('rfc822MailMember' . $i, $this->attributes['rfc822MailMember'][$i]);
if (sizeof($autoList) > 0) { if (sizeof($autoList) > 0) {
$mailField->enableAutocompletion($autoList); $mailField->enableAutocompletion($autoList);
} }
$return->addElement($mailField); $mailField->setCSSClasses(array('maxwidth20'));
$return->addElement(new htmlAccountPageButton(get_class($this), 'selectMail', 'recipient' . $i, 'mailAlias.png', true, _('Select mail'))); $mailGroup = new htmlGroup();
$return->addElement(new htmlAccountPageButton(get_class($this), 'selectUser', 'recipient' . $i, 'user.png', true, _('Select user'))); $mailGroup->addElement($mailField);
$return->addElement(new htmlButton('delRec' . $i, 'del.png', true)); $mailGroup->addElement(new htmlAccountPageButton(get_class($this), 'selectMail', 'recipient' . $i, 'mailAlias.png', true, _('Select mail')));
$return->addElement(new htmlHelpLink('recipient'), true); $mailGroup->addElement(new htmlAccountPageButton(get_class($this), 'selectUser', 'recipient' . $i, 'user.png', true, _('Select user')));
$mailGroup->addElement(new htmlButton('delRec' . $i, 'del.png', true));
$mailGroup->addElement(new htmlHelpLink('recipient'));
$return->addField($mailGroup);
} }
} }
else { else {
$memberText = implode("\r\n", $this->attributes['rfc822MailMember']); $memberText = implode("\r\n", $this->attributes['rfc822MailMember']);
$return->addElement(new htmlTableExtendedInputTextarea('rfc822MailMember', $memberText, 50, 30, _('Recipients'), 'recipient'), true); $return->add(new htmlResponsiveInputTextarea('rfc822MailMember', $memberText, 50, 30, _('Recipients'), 'recipient'), 12);
$return->addElement(new htmlEqualWidth(array('cn', 'rfc822MailMember')), true);
} }
} }
if ($recipientCount < nisMailAlias::DISPLAY_LIMIT) { if ($recipientCount < nisMailAlias::DISPLAY_LIMIT) {
// input box for new recipient // input box for new recipient
$return->addElement(new htmlOutputText(_('New recipient'))); $return->addLabel(new htmlOutputText(_('New recipient')));
$newMailField = new htmlInputField('rfc822MailMember'); $newMailField = new htmlInputField('rfc822MailMember');
$newMailField->setOnKeyPress('SubmitForm(\'addRec\', event);'); $newMailField->setOnKeyPress('SubmitForm(\'addRec\', event);');
if (sizeof($autoList) > 0) { if (sizeof($autoList) > 0) {
$newMailField->enableAutocompletion($autoList); $newMailField->enableAutocompletion($autoList);
} }
$return->addElement($newMailField); $newMailField->setCSSClasses(array('maxwidth20'));
$return->addElement(new htmlAccountPageButton(get_class($this), 'selectMail', 'recipient' . 'New', 'mailAlias.png', true, _('Select mail'))); $newGroup = new htmlGroup();
$return->addElement(new htmlAccountPageButton(get_class($this), 'selectUser', 'recipient' . 'New', 'user.png', true, _('Select user'))); $newGroup->addElement($newMailField);
$return->addElement(new htmlButton('addRec', 'add.png', true)); $newGroup->addElement(new htmlAccountPageButton(get_class($this), 'selectMail', 'recipient' . 'New', 'mailAlias.png', true, _('Select mail')));
$return->addElement(new htmlHelpLink('recipient')); $newGroup->addElement(new htmlAccountPageButton(get_class($this), 'selectUser', 'recipient' . 'New', 'user.png', true, _('Select user')));
$return->addElement(new htmlHiddenInput('rec_number', $recipientCount)); $newGroup->addElement(new htmlButton('addRec', 'add.png', true));
$newGroup->addElement(new htmlHelpLink('recipient'));
$newGroup->addElement(new htmlHiddenInput('rec_number', $recipientCount));
$return->addField($newGroup);
} }
return $return; return $return;
} }
@ -348,13 +354,9 @@ class nisMailAlias extends baseModule {
$suffix = 'User'; $suffix = 'User';
$label = _('User'); $label = _('User');
} }
$return = new htmlTable(); $return = new htmlResponsiveRow();
$postKeys = array_keys($_POST); $postKeys = array_keys($_POST);
$position = 'New'; $position = 'New';
$filter = '';
if (isset($_POST['dofilter'])) {
$filter = $_POST['filter'];
}
for ($i = 0; $i < sizeof($postKeys); $i++) { for ($i = 0; $i < sizeof($postKeys); $i++) {
if (strpos($postKeys[$i], 'form_subpage_' . get_class($this) . '_select' . $suffix . '_recipient') === 0) { if (strpos($postKeys[$i], 'form_subpage_' . get_class($this) . '_select' . $suffix . '_recipient') === 0) {
$position = substr($postKeys[$i], strlen('form_subpage_' . get_class($this) . '_select' . $suffix . '_recipient')); $position = substr($postKeys[$i], strlen('form_subpage_' . get_class($this) . '_select' . $suffix . '_recipient'));
@ -364,27 +366,28 @@ class nisMailAlias extends baseModule {
// load list with all mail addresses // load list with all mail addresses
$count = sizeof($options); $count = sizeof($options);
for ($i = 0; $i < $count; $i++) { for ($i = 0; $i < $count; $i++) {
if (!get_preg($options[$i], $regex) || (!empty($filter) && !preg_match('/' . str_replace('*', '.*', $filter) . '/ui', $options[$i]))) { if (!get_preg($options[$i], $regex)) {
unset($options[$i]); unset($options[$i]);
} }
} }
$options = array_values($options); $options = array_values($options);
$return->addElement(new htmlOutputText(_('Filter'))); $return->addLabel(new htmlOutputText(_('Filter')));
$return->addElement(new htmlInputField('filter', $filter)); $filterGroup = new htmlGroup();
$return->addElement(new htmlButton('dofilter', _('Ok'))); $filterInput = new htmlInputField('filter', null);
$return->addElement(new htmlHelpLink('filter'), true); $filterInput->setCSSClasses(array('maxwidth10'));
$return->addElement(new htmlOutputText($label)); $filterInput->filterSelectBox('selectBox');
$filterGroup->addElement($filterInput);
$filterGroup->addElement(new htmlHelpLink('filter'));
$return->addField($filterGroup);
$return->addLabel(new htmlOutputText($label));
$mailSelect = new htmlSelect('selectBox', $options, array(), 15); $mailSelect = new htmlSelect('selectBox', $options, array(), 15);
$mailSelect->setMultiSelect($position === 'New'); $mailSelect->setMultiSelect($position === 'New');
$mailSelect->colspan = 5; $mailSelect->colspan = 5;
$return->addElement($mailSelect, true); $return->addField($mailSelect);
$return->addElement(new htmlSpacer(null, '10px'), true); $return->addVerticalSpacer('2rem');
$buttonContainer = new htmlTable(); $return->addLabel(new htmlAccountPageButton(get_class($this), 'attributes', 'select', _('Ok')));
$buttonContainer->addElement(new htmlAccountPageButton(get_class($this), 'attributes', 'select', _('Ok'))); $return->addField(new htmlAccountPageButton(get_class($this), 'attributes', 'back', _('Cancel')));
$buttonContainer->addElement(new htmlAccountPageButton(get_class($this), 'attributes', 'back', _('Cancel'))); $return->add(new htmlHiddenInput('position', $position), 12);
$buttonContainer->colspan = 4;
$return->addElement($buttonContainer, true);
$return->addElement(new htmlHiddenInput('position', $position));
return $return; return $return;
} }

View File

@ -48,6 +48,14 @@
width: auto; width: auto;
} }
input.maxwidth10 {
max-width: 10rem;
}
input.maxwidth20 {
max-width: 20rem;
}
img.max16 { img.max16 {
max-width: 16px; max-width: 16px;
} }