From: Michael M Slusarz Date: Fri, 23 Apr 2010 16:55:27 +0000 (-0600) Subject: Further cleanup of mailbox template output X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=4610569c2a8015d47b0dd6c41ed5258c2a04b3c9;p=horde.git Further cleanup of mailbox template output Makes things a bit more templateable - move CSS-related stuff out of PHP script. Also, try to remove some complexity/wordiness/excessive layout. --- diff --git a/imp/mailbox.php b/imp/mailbox.php index 85324a127..8bad7531c 100644 --- a/imp/mailbox.php +++ b/imp/mailbox.php @@ -24,13 +24,6 @@ function _outputSummaries($msgs) if (!isset($template)) { $template = $GLOBALS['injector']->createInstance('Horde_Template'); $template->setOption('gettext', true); - - // Some browsers have trouble with hidden overflow in table cells - // but not in divs. - if ($GLOBALS['browser']->hasQuirk('no_hidden_overflow_tables')) { - $template->set('overflow_begin', '
'); - $template->set('overflow_end', '
'); - } } $template->set('messages', $msgs, true); @@ -250,13 +243,6 @@ if ($readonly) { $showdelete['purge'] = false; } -/* Generate mailbox summary string. */ -if (!empty($pageOb['end'])) { - $msg_count = sprintf(_("%d to %d of %d Messages"), $pageOb['begin'], $pageOb['end'], $pageOb['msgcount']); -} else { - $msg_count = sprintf(_("No Messages")); -} - /* Generate paging links. */ if ($pageOb['pagecount']) { $rtl = !empty(Horde_Nls::$config['rtl'][$language]); @@ -345,7 +331,7 @@ if ($prefs->getValue('nav_popup') || $prefs->getValue('nav_audio')) { $newmsgs = $imp_mailbox->newMessages(Horde_Imap_Client::SORT_RESULTS_COUNT); } -$pagetitle = $rawtitle = $title = IMP::getLabel($imp_mbox['mailbox']); +$pagetitle = $title = IMP::getLabel($imp_mbox['mailbox']); $refresh_title = sprintf(_("_Refresh %s"), $title); $refresh_ak = Horde::getAccessKey($refresh_title); $refresh_title = Horde::stripAccessKey($refresh_title); @@ -412,39 +398,48 @@ if ($readonly) { } $hdr_template->set('refresh', Horde::link($refresh_url, $refresh_title, '', '', '', '', $refresh_ak)); if (isset($filter_url)) { - $hdr_template->set('filter', Horde::link($filter_url, sprintf(_("Apply Filters to %s"), $rawtitle)) . Horde::img('filters.png', _("Apply Filters")) . ''); + $hdr_template->set('filter_url', $filter_url); + $hdr_template->set('filter_img', Horde::img('filters.png', _("Apply Filters"))); } $hdr_template->set('search', false); if ($_SESSION['imp']['protocol'] != 'pop') { + $hdr_template->set('search_img', Horde::img('search.png', _("Search"))); + if (!$search_mbox) { - $hdr_template->set('search', Horde::link(Horde::applicationUrl('search-basic.php')->add('search_mailbox', $imp_mbox['mailbox']), sprintf(_("Search %s"), $rawtitle)) . Horde::img('search.png', _("Search")) . ''); + $hdr_template->set('search_url', Horde::applicationUrl('search-basic.php')->add('search_mailbox', $imp_mbox['mailbox'])); if (!$readonly) { $hdr_template->set('empty', $mailbox_imp_url->copy()->add(array('actionID' => 'empty_mailbox', 'mailbox' => $imp_mbox['mailbox'], 'mailbox_token' => $mailbox_token))); $hdr_template->set('empty_img', Horde::img('empty_spam.png', _("Empty folder"))); } } else { if ($imp_search->isEditableVFolder()) { - $edit_search = sprintf(_("Edit Virtual Folder Definition for %s"), htmlspecialchars($rawtitle)); + $edit_search = _("Edit Virtual Folder"); $hdr_template->set('delete_vfolder_url', $imp_search->deleteUrl()); - $hdr_template->set('delete_vfolder_label', sprintf(_("Delete Virtual Folder Definition for %s"), htmlspecialchars($rawtitle))); - $hdr_template->set('delete_vfolder_img', Horde::img('delete.png', sprintf(_("Delete Virtual Folder Definition for %s"), $rawtitle))); + $hdr_template->set('delete_vfolder_img', Horde::img('delete.png', _("Delete Virtual Folder"))); } elseif ($search_mbox && !isset($query_text)) { /* Mini search results. */ $search_mailbox = reset($imp_search->getSearchFolders()); - $hdr_template->set('search', Horde::link(Horde::applicationUrl('search-basic.php')->add(array('search_mailbox' => $search_mailbox)), sprintf(_("Search %s"), IMP::getLabel($search_mailbox))) . Horde::img('search.png', _("Search")) . ''); - $hdr_template->set('searchclose', Horde::link(IMP::generateIMPUrl('mailbox.php', $search_mailbox), _("Exit Search"))); + $hdr_template->set('search_url', Horde::applicationUrl('search-basic.php')->add('search_mailbox', $search_mailbox)); + $hdr_template->set('searchclose', IMP::generateIMPUrl('mailbox.php', $search_mailbox)); } elseif (!$vfolder) { $edit_search = _("Edit Search Query"); } if (isset($edit_search)) { - $hdr_template->set('search', Horde::link($imp_search->editUrl(), $edit_search) . Horde::img('edit.png', $edit_search) . ''); + $hdr_template->set('edit_search_url', $imp_search->editUrl()); + $hdr_template->set('edit_search_title', $edit_search); + $hdr_template->set('edit_search_img', Horde::img('edit.png', $edit_search)); } } } -$hdr_template->set('msgcount', $msg_count); -if ($pageOb['pagecount'] > 1) { +/* Generate mailbox summary string. */ +if (empty($pageOb['end'])) { + $hdr_template->set('msgcount', _("No Messages")); +} elseif ($pageOb['pagecount'] > 1) { + $hdr_template->set('msgcount', sprintf(_("%d - %d of %d Messages"), $pageOb['begin'], $pageOb['end'], $pageOb['msgcount'])); $hdr_template->set('page', sprintf(_("Page %d of %d"), $pageOb['page'], $pageOb['pagecount'])); +} else { + $hdr_template->set('msgcount', sprintf(_("%d Messages"), $pageOb['msgcount'])); } echo $hdr_template->fetch(IMP_TEMPLATES . '/imp/mailbox/header.html'); @@ -587,100 +582,94 @@ if ($sortpref['by'] == Horde_Imap_Client::SORT_THREAD) { $threadtree = $imp_thread->getThreadImageTree(reset($mbox_info['uids']), $sortpref['dir']); } -/* Don't show header row if this is a search mailbox or if no messages in the - current mailbox. */ $mh_count = 0; -if ($pageOb['msgcount']) { - $sortImg = ($sortpref['dir']) ? 'za.png' : 'az.png'; - $sortText = ($sortpref['dir']) ? '\/' : '/\\'; - $headers = array( - IMP::IMAP_SORT_DATE => array( - 'stext' => _("Sort by Date"), - 'text' => _("Dat_e"), - 'width' => '14%' - ), - Horde_Imap_Client::SORT_TO => array( - 'stext' => _("Sort by To Address"), - 'text' => _("To"), - 'width' => '20%' - ), - Horde_Imap_Client::SORT_FROM => array( - 'stext' => _("Sort by From Address"), - 'text' => _("Fro_m"), - 'width' => '20%' - ), - Horde_Imap_Client::SORT_THREAD => array( - 'stext' => _("Sort by Thread"), - 'text' => _("_Thread"), - 'width' => '52%' - ), - Horde_Imap_Client::SORT_SUBJECT => array( - 'stext' => _("Sort by Subject"), - 'text' => _("Sub_ject"), - 'width' => '52%' - ), - Horde_Imap_Client::SORT_SIZE => array( - 'stext' => _("Sort by Message Size"), - 'text' => _("Si_ze"), - 'width' => '6%' - ) - ); +$sortImg = ($sortpref['dir']) ? 'za.png' : 'az.png'; +$sortText = ($sortpref['dir']) ? '\/' : '/\\'; +$headers = array( + IMP::IMAP_SORT_DATE => array( + 'id' => 'mboxdate', + 'stext' => _("Sort by Date"), + 'text' => _("Dat_e") + ), + Horde_Imap_Client::SORT_TO => array( + 'id' => 'mboxto', + 'stext' => _("Sort by To Address"), + 'text' => _("To") + ), + Horde_Imap_Client::SORT_FROM => array( + 'id' => 'mboxfrom', + 'stext' => _("Sort by From Address"), + 'text' => _("Fro_m") + ), + Horde_Imap_Client::SORT_THREAD => array( + 'id' => 'mboxthread', + 'stext' => _("Sort by Thread"), + 'text' => _("_Thread") + ), + Horde_Imap_Client::SORT_SUBJECT => array( + 'id' => 'mboxsubject', + 'stext' => _("Sort by Subject"), + 'text' => _("Sub_ject") + ), + Horde_Imap_Client::SORT_SIZE => array( + 'id' => 'mboxsize', + 'stext' => _("Sort by Message Size"), + 'text' => _("Si_ze") + ) +); + +/* If this is the Drafts or Sent-Mail Folder, sort by To instead of From. */ +if (IMP::isSpecialFolder($imp_mbox['mailbox'])) { + unset($headers[Horde_Imap_Client::SORT_FROM]); +} else { + unset($headers[Horde_Imap_Client::SORT_TO]); +} - /* If this is the Drafts or Sent-Mail Folder, sort by To instead of - * From. */ - if (IMP::isSpecialFolder($imp_mbox['mailbox'])) { - unset($headers[Horde_Imap_Client::SORT_FROM]); +/* Determine which of Subject/Thread to emphasize. */ +if (!IMP::threadSortAvailable($imp_mbox['mailbox'])) { + unset($headers[Horde_Imap_Client::SORT_THREAD]); +} else { + if ($sortpref['by'] == Horde_Imap_Client::SORT_THREAD) { + $extra = Horde_Imap_Client::SORT_SUBJECT; + $standard = Horde_Imap_Client::SORT_THREAD; } else { - unset($headers[Horde_Imap_Client::SORT_TO]); + $extra = Horde_Imap_Client::SORT_THREAD; + $standard = Horde_Imap_Client::SORT_SUBJECT; } + $headers[$standard]['altsort'] = Horde::widget($mailbox_imp_url->copy()->add(array('sortby' => $extra, 'actionID' => 'change_sort', 'mailbox_token' => $mailbox_token)), $headers[$extra]['stext'], 'widget', null, null, $headers[$extra]['text']); + unset($headers[$extra]); +} - /* Determine which of Subject/Thread to emphasize. */ - if (!IMP::threadSortAvailable($imp_mbox['mailbox'])) { - unset($headers[Horde_Imap_Client::SORT_THREAD]); - } else { - if ($sortpref['by'] == Horde_Imap_Client::SORT_THREAD) { - $extra = Horde_Imap_Client::SORT_SUBJECT; - $standard = Horde_Imap_Client::SORT_THREAD; - } else { - $extra = Horde_Imap_Client::SORT_THREAD; - $standard = Horde_Imap_Client::SORT_SUBJECT; - } - $headers[$standard]['extra'] = '[' . Horde::widget($mailbox_imp_url->copy()->add(array('sortby' => $extra, 'actionID' => 'change_sort', 'mailbox_token' => $mailbox_token)), $headers[$extra]['stext'], 'widget', null, null, $headers[$extra]['text']) . ']'; - unset($headers[$extra]); - } +foreach ($headers as $key => $val) { + $ptr = &$headers[$key]; + $ptr['class'] = ($sortpref['by'] == $key) ? 'selected' : 'item'; - foreach ($headers as $key => $val) { - $ptr = &$headers[$key]; - $ptr['class'] = ($sortpref['by'] == $key) ? 'selected' : 'item'; - if ($sortpref['by'] == $key) { - $ptr['change_sort_link'] = Horde::link($sort_url->copy()->add(array('sortby' => $key, 'actionID' => 'change_sort', 'mailbox_token' => $mailbox_token)), $val['stext'], null, null, null, $val['stext']) . Horde::img($sortImg, $sortText) . ''; - } else { - $ptr['change_sort_link'] = null; - } + $ptr['change_sort_link'] = ($sortpref['by'] == $key) + ? Horde::link($sort_url->copy()->add(array('sortby' => $key, 'actionID' => 'change_sort', 'mailbox_token' => $mailbox_token)), $val['stext'], null, null, null, $val['stext']) . Horde::img($sortImg, $sortText) . '' + : null; - $tmp = ($sortpref['by'] == $key) ? $sort_url : $mailbox_imp_url; - $ptr['change_sort'] = addslashes($tmp->copy()->add(array('sortby' => $key, 'actionID' => 'change_sort', 'mailbox_token' => $mailbox_token))); - $ptr['change_sort_widget'] = Horde::widget($tmp->copy()->add(array('sortby' => $key, 'actionID' => 'change_sort', 'mailbox_token' => $mailbox_token)), $val['stext'], 'widget', null, null, $val['text']); - if (!isset($val['extra'])) { - $ptr['extra'] = null; - } - } + $tmp = ($sortpref['by'] == $key) ? $sort_url : $mailbox_imp_url; + $ptr['change_sort_widget'] = Horde::widget($tmp->copy()->add(array('sortby' => $key, 'actionID' => 'change_sort', 'mailbox_token' => $mailbox_token)), $val['stext'], 'widget', null, null, $val['text']); +} - /* Prepare the message headers template. */ - $mh_template = $injector->createInstance('Horde_Template'); - $mh_template->setOption('gettext', true); - $mh_template->set('check_all', Horde::getAccessKeyAndTitle(_("Check _All/None"))); - $mh_template->set('form_tag', true); - $mh_template->set('mailbox_url', $mailbox_url); - $mh_template->set('mailbox', htmlspecialchars($imp_mbox['mailbox'])); - $mh_template->set('mailbox_token', $mailbox_token); - $mh_template->set('sessiontag', Horde_Util::formInput()); - $mh_template->set('headers', $headers); +/* Output the form start. */ +$f_template = $injector->createInstance('Horde_Template'); +$f_template->set('mailbox', htmlspecialchars($imp_mbox['mailbox'])); +$f_template->set('mailbox_token', $mailbox_token); +$f_template->set('mailbox_url', $mailbox_url); +$f_template->set('sessiontag', Horde_Util::formInput()); +$f_template->set('page', $pageOb['page']); +echo $f_template->fetch(IMP_TEMPLATES . '/imp/mailbox/form_start.html'); - if (!$search_mbox) { - $mh_template->set('mh_count', $mh_count++); - echo $mh_template->fetch(IMP_TEMPLATES . '/imp/mailbox/message_headers.html'); - } +/* Prepare the message headers template. */ +$mh_template = $injector->createInstance('Horde_Template'); +$mh_template->setOption('gettext', true); +$mh_template->set('check_all', Horde::getAccessKeyAndTitle(_("Check _All/None"))); +$mh_template->set('headers', $headers); + +if (!$search_mbox) { + $mh_template->set('show_checkbox', !$mh_count++); + echo $mh_template->fetch(IMP_TEMPLATES . '/imp/mailbox/message_headers.html'); } /* Initialize repetitively used variables. */ @@ -706,10 +695,7 @@ while (list(,$ob) = each($mbox_info['overview'])) { $search_template->set('folder_link', $folder_link); echo $search_template->fetch(IMP_TEMPLATES . '/imp/mailbox/searchfolder.html'); - if ($mh_count) { - $mh_template->set('form_tag', false); - } - $mh_template->set('mh_count', $mh_count++); + $mh_template->set('show_checkbox', !$mh_count++); echo $mh_template->fetch(IMP_TEMPLATES . '/imp/mailbox/message_headers.html'); } } @@ -834,10 +820,7 @@ while (list(,$ob) = each($mbox_info['overview'])) { _outputSummaries($msgs); -/* Prepare the message footers template. */ -$mf_template = $injector->createInstance('Horde_Template'); -$mf_template->set('page', $pageOb['page']); -echo $mf_template->fetch(IMP_TEMPLATES . '/imp/mailbox/message_footers.html'); +echo ''; /* If there are 20 messages or less, don't show the actions/navbar again. */ if (($pageOb['end'] - $pageOb['begin']) >= 20) { diff --git a/imp/templates/imp/mailbox/actions.html b/imp/templates/imp/mailbox/actions.html index bc4b9a806..0552443f1 100644 --- a/imp/templates/imp/mailbox/actions.html +++ b/imp/templates/imp/mailbox/actions.html @@ -1,6 +1,6 @@ - +
- class="" style="background-color:"> + + + + - - - -
+
    @@ -10,17 +10,27 @@
      - -
    • -
    • -
    • -
    • -
      -
    • - -
    • -
    • -
      + +
    • +
      + +
    • +
      + +
    • +
      + +
    • +
      + +
    • +
      + +
    • +
      + +
    • +
    diff --git a/imp/templates/imp/mailbox/actions_deleted.html b/imp/templates/imp/mailbox/actions_deleted.html index 76072ddd0..81eb7600b 100644 --- a/imp/templates/imp/mailbox/actions_deleted.html +++ b/imp/templates/imp/mailbox/actions_deleted.html @@ -1,6 +1,8 @@
    • -
    • + +
    • +
    diff --git a/imp/templates/imp/mailbox/empty_mailbox.html b/imp/templates/imp/mailbox/empty_mailbox.html index 2dfa25234..44de2d7fc 100644 --- a/imp/templates/imp/mailbox/empty_mailbox.html +++ b/imp/templates/imp/mailbox/empty_mailbox.html @@ -1,3 +1,9 @@
    - No messages matched your search criteria.There are no messages in this mailbox. + + + No messages matched your search criteria. + + There are no messages in this mailbox. + +
    diff --git a/imp/templates/imp/mailbox/form_start.html b/imp/templates/imp/mailbox/form_start.html new file mode 100644 index 000000000..903a32a2b --- /dev/null +++ b/imp/templates/imp/mailbox/form_start.html @@ -0,0 +1,9 @@ +
    + + + + + + + + diff --git a/imp/templates/imp/mailbox/header.html b/imp/templates/imp/mailbox/header.html index f3bc4e21b..2b750952c 100644 --- a/imp/templates/imp/mailbox/header.html +++ b/imp/templates/imp/mailbox/header.html @@ -1,27 +1,36 @@
    -
    style="width:40%" class="leftFloat"> - - - - - - - - - - - - +
    +
    -
    - +
    + ()
    -
    - -
    - - + +
    + + + + + + + + + + + + + + + + + + + + + + +
    diff --git a/imp/templates/imp/mailbox/mailbox.html b/imp/templates/imp/mailbox/mailbox.html index 01097049a..9e7959cc8 100644 --- a/imp/templates/imp/mailbox/mailbox.html +++ b/imp/templates/imp/mailbox/mailbox.html @@ -1,12 +1,23 @@
- + + + + + + + + +   
diff --git a/imp/templates/imp/mailbox/message_footers.html b/imp/templates/imp/mailbox/message_footers.html deleted file mode 100644 index fe2785d12..000000000 --- a/imp/templates/imp/mailbox/message_footers.html +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/imp/templates/imp/mailbox/message_headers.html b/imp/templates/imp/mailbox/message_headers.html index cd5c70b28..b7ccf5453 100644 --- a/imp/templates/imp/mailbox/message_headers.html +++ b/imp/templates/imp/mailbox/message_headers.html @@ -1,22 +1,18 @@ - -
- - - - - +
- - - - - + - diff --git a/imp/themes/screen.css b/imp/themes/screen.css index 4095fe42c..73f48db4b 100644 --- a/imp/themes/screen.css +++ b/imp/themes/screen.css @@ -1,8 +1,39 @@ -/* Mailbox header styling. */ +/* Mailbox page styling. */ .mboxheader { font-size: 110%; text-align: left; } +.mboxheader .pageCount { + padding-right: 10px; +} + +table.mboxactions { + border-collapse: collapse; + width: 100%; +} + +#checkheader { + width: 8%; +} +#checkheader input { + float: left; +} + +#mboxdate { + width: 14%; +} + +#mboxto, #mboxfrom { + width: 20%; +} + +#mboxthread, #mboxsubject { + width: 52%; +} + +#mboxsize { + width: 6%; +} /* Message list table styles. */ .searchfolder a.smallheader { @@ -39,9 +70,6 @@ border: 1px solid #ddd; vertical-align: middle; } -.messageList td label { - padding-right: 2px; -} .messageList td label input { vertical-align: middle; } @@ -59,10 +87,6 @@ margin-left: 3px; } -#checkheader input { - float: left; -} - /* Newmail alerts. */ #newmail { padding: 1em;
  + + /> - + + + + + [] +