responsive

This commit is contained in:
Roland Gruber 2019-08-30 22:32:38 +02:00
parent ab3d13cf28
commit 60c3053901
1 changed files with 36 additions and 38 deletions

View File

@ -215,13 +215,13 @@ class imapAccess extends baseModule {
* @return array HTML meta data * @return array HTML meta data
*/ */
function display_html_attributes() { function display_html_attributes() {
$return = new htmlTable(); $return = new htmlResponsiveRow();
if (!checkIfWriteAccessIsAllowed($this->get_scope())) { if (!checkIfWriteAccessIsAllowed($this->get_scope())) {
return $return; return $return;
} }
$msg = $this->extractUserAndEmail(); $msg = $this->extractUserAndEmail();
if ($msg != null) { if ($msg != null) {
$return->addElement($msg); $return->add($msg, 12);
return $return; return $return;
} }
$prefix = $this->getMailboxPrefix(); $prefix = $this->getMailboxPrefix();
@ -232,8 +232,8 @@ class imapAccess extends baseModule {
return $this->display_html_password(); return $this->display_html_password();
} }
$return->addElement(new htmlOutputText(_('Email address'))); $return->addLabel(new htmlOutputText(_('Email address')));
$return->addElement(new htmlOutputText($this->email), true); $return->addField(new htmlOutputText($this->email));
$imap_server_address = $this->getServerAddress(); $imap_server_address = $this->getServerAddress();
$imap_admin_user = $this->getAdminUser(); $imap_admin_user = $this->getAdminUser();
@ -243,33 +243,31 @@ class imapAccess extends baseModule {
return $this->display_html_password(); return $this->display_html_password();
} }
$return->addElement(new htmlOutputText(_('Mailbox'))); $return->addLabel(new htmlOutputText(_('Mailbox')));
$return->addElement(new htmlOutputText($prefix . $this->getSep() . $this->user)); $mailboxGroup = new htmlGroup();
$return->addElement(new htmlHelpLink('MailAddress'), true); $mailboxGroup->addElement(new htmlOutputText($prefix . $this->getSep() . $this->user));
$return->addElement(new htmlSpacer(null, '10px'), true); $mailboxGroup->addElement(new htmlHelpLink('MailAddress'), true);
$return->addField($mailboxGroup);
$return->addVerticalSpacer('2rem');
$list = imap_list($mbox, "{" . $imap_server_address . "}", $prefix . $this->getSep() . $this->user); $list = imap_list($mbox, "{" . $imap_server_address . "}", $prefix . $this->getSep() . $this->user);
if (is_array($list) && sizeof($list) == 1) { if (is_array($list) && sizeof($list) == 1) {
$this->renderQuotasForMailbox($return, $mbox, $prefix . $this->getSep() . $this->user); $this->renderQuotasForMailbox($return, $mbox, $prefix . $this->getSep() . $this->user);
$mailboxMessage = new htmlOutputText(_("Mailbox already exists on IMAP server.")); $return->addVerticalSpacer('2rem');
$mailboxMessage->colspan = 3; $return->add(new htmlButton('deleteMailbox', _('Delete mailbox')), 12, 12, 12, 'text-center');
$return->addElement($mailboxMessage, true);
$return->addElement(new htmlSpacer(null, '10px'), true);
$return->addElement(new htmlButton('deleteMailbox', _('Delete mailbox')));
} }
else { else {
$mailboxMessage = new htmlOutputText(_("Mailbox does not exist on IMAP server.")); $mailboxMessage = new htmlOutputText(_("Mailbox does not exist on IMAP server."));
$mailboxMessage->colspan = 3; $return->add($mailboxMessage, 12, 12, 12, 'text-center');
$return->addElement($mailboxMessage, true); $return->addVerticalSpacer('2rem');
$return->addElement(new htmlSpacer(null, '10px'), true);
$createButton = new htmlButton('createMailbox', _('Create mailbox'));
$message = '';
if ($this->isWrongDomain($email_domain)) { if ($this->isWrongDomain($email_domain)) {
$createButton->setIsEnabled(false); $return->add(new htmlStatusMessage('INFO', $this->messages['managemailbox'][4][1]), 12);
$message = '<< ' . $this->messages['managemailbox'][4][1]; $return->addVerticalSpacer('1rem');
}
else {
$createButton = new htmlButton('createMailbox', _('Create mailbox'));
$return->add($createButton, 12, 12, 12, 'text-center');
} }
$return->addElement($createButton);
$return->addElement(new htmlOutputText($message));
} }
imap_close($mbox); imap_close($mbox);
return $return; return $return;
@ -301,12 +299,12 @@ class imapAccess extends baseModule {
/** /**
* Display the mailbox quota. * Display the mailbox quota.
* *
* @param htmlTable $htmlTable structure that contained information to be displayed * @param htmlTable $container structure that contained information to be displayed
* @param stream $mbox stream to open IMAP session * @param stream $mbox stream to open IMAP session
* @param String $username user name to connect to IMAP server * @param String $username user name to connect to IMAP server
* @return htmlTable table with added information about user quotas or controls to add quota * @return htmlResponsiveRow table with added information about user quotas or controls to add quota
*/ */
function renderQuotasForMailbox($htmlTable, $mbox, $username) { function renderQuotasForMailbox($container, $mbox, $username) {
if (($this->profileQuotaLimit != null) && ($this->profileQuotaLimit != '')) { if (($this->profileQuotaLimit != null) && ($this->profileQuotaLimit != '')) {
@imap_set_quota($mbox, $username, $this->profileQuotaLimit); @imap_set_quota($mbox, $username, $this->profileQuotaLimit);
$this->profileQuotaLimit = null; $this->profileQuotaLimit = null;
@ -316,24 +314,24 @@ class imapAccess extends baseModule {
if (is_array($quota_values) && (sizeof($quota_values) > 0)) { if (is_array($quota_values) && (sizeof($quota_values) > 0)) {
if (isset($quota_values['STORAGE']) && is_array($quota_values['STORAGE'])) { if (isset($quota_values['STORAGE']) && is_array($quota_values['STORAGE'])) {
$quotaLimit = $quota_values['STORAGE']['limit']; $quotaLimit = $quota_values['STORAGE']['limit'];
$htmlTable->addElement(new htmlOutputText(_("Current usage (kB)"))); $container->addLabel(new htmlOutputText(_("Current usage (kB)")));
$htmlTable->addElement(new htmlOutputText($quota_values['STORAGE']['usage']), true); $container->addField(new htmlOutputText($quota_values['STORAGE']['usage']), true);
$quotaLimitInput = new htmlTableExtendedInputField(_("Quota limit (kB)"), 'ImapUserQuotaLimit', $quotaLimit, 'ImapUserQuotaLimit'); $quotaLimitInput = new htmlResponsiveInputField(_("Quota limit (kB)"), 'ImapUserQuotaLimit', $quotaLimit, 'ImapUserQuotaLimit');
$htmlTable->addElement($quotaLimitInput, false); $container->add($quotaLimitInput, 12);
$htmlTable->addElement(new htmlSpacer('10px', null), false); $container->addVerticalSpacer('2rem');
$htmlTable->addElement(new htmlButton('updateQuota', _('Update quota')), true); $container->add(new htmlButton('updateQuota', _('Update quota')), 12, 12, 12, 'text-center');
$htmlTable->addElement(new htmlSpacer(null, '10px'), true); $container->addVerticalSpacer('1rem');
} }
} }
else { else {
$quotaLimit = ""; $quotaLimit = "";
$quotaLimitInput = new htmlTableExtendedInputField(_("Quota limit (kB)"), 'ImapUserQuotaLimit', $quotaLimit, 'ImapUserQuotaLimit'); $quotaLimitInput = new htmlResponsiveInputField(_("Quota limit (kB)"), 'ImapUserQuotaLimit', $quotaLimit, 'ImapUserQuotaLimit');
$htmlTable->addElement($quotaLimitInput, false); $container->add($quotaLimitInput, 12);
$htmlTable->addElement(new htmlSpacer('10px', null), false); $container->addVerticalSpacer('2rem');
$htmlTable->addElement(new htmlButton('updateQuota', _('Update quota')), true); $container->add(new htmlButton('updateQuota', _('Update quota')), 12, 12, 12, 'text-center');
$htmlTable->addElement(new htmlSpacer(null, '10px'), true); $container->addVerticalSpacer('1rem');
} }
return $htmlTable; return $container;
} }
/** /**