Tweak summary attachment display.
authorMichael M Slusarz <slusarz@curecanti.org>
Fri, 22 Jan 2010 20:48:08 +0000 (13:48 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Fri, 22 Jan 2010 20:48:08 +0000 (13:48 -0700)
Add 'none' option to 'parts_display' pref.
Include part in the attachment list if it has an inline 'info' rendered
display.

imp/config/prefs.php.dist
imp/lib/Ui/Message.php
imp/message.php

index 3198a4b..e293ea7 100644 (file)
@@ -939,7 +939,8 @@ $_prefs['parts_display'] = array(
     'type' => 'enum',
     'enum' => array(
         'all' => _("Show all parts"),
-        'atc' => _("Show attachments")
+        'atc' => _("Show all attachments"),
+        'none' => _("Do not show parts")
     ),
     'desc' => _("Which message parts do you want to display in the summary?"));
 
index 2ba9470..b6441a3 100644 (file)
@@ -460,7 +460,7 @@ class IMP_Ui_Message
      * @param integer $contents_mask    The mask needed for a
      *                                  IMP_Contents::getSummary() call.
      * @param array $part_info_display  The list of summary fields to display.
-     * @param string $show_parts        The value of the 'show_parts' pref.
+     * @param string $show_parts        The value of the 'parts_display' pref.
      *
      * @return array  An array with the following keys:
      * <pre>
@@ -486,7 +486,13 @@ class IMP_Ui_Message
                 continue;
             }
 
-            if (!($render_mode = $imp_contents->canDisplay($mime_id, IMP_Contents::RENDER_INLINE | IMP_Contents::RENDER_INFO))) {
+            if ($render_mode = $imp_contents->canDisplay($mime_id, IMP_Contents::RENDER_INLINE | IMP_Contents::RENDER_INFO)) {
+                if (($show_parts == 'atc') &&
+                    !($render_mode & IMP_Contents::RENDER_INLINE) &&
+                    $imp_contents->isAttachment($mime_type)) {
+                    $atc_parts[] = $mime_id;
+                }
+            } else {
                 if ($imp_contents->isAttachment($mime_type)) {
                     if ($show_parts == 'atc') {
                         $atc_parts[] = $mime_id;
index 95327d0..2d9d040 100644 (file)
@@ -599,8 +599,7 @@ $inlineout = $imp_ui->getInlineOutput($imp_contents, $contents_mask, $part_info_
 $a_template->set('atc', Horde::widget('#', _("Attachments"), 'widget hasmenu', '', '', _("Attachments"), true));
 if ($show_parts == 'atc') {
     $a_template->set('show_parts_all', Horde::widget($headersURL->copy()->add(array('show_parts' => 'all')), _("Show All Message Parts"), 'widget', '', '', _("Show All Message Parts"), true));
-}
-if ($show_parts == 'all') {
+} elseif ($show_parts == 'all') {
     $a_template->set('show_parts_atc', Horde::widget($headersURL->copy()->add(array('show_parts' => 'atc')), _("Show Attachments Only"), 'widget', '', '', _("Show Attachments Only"), true));
 }
 if (count($inlineout['display_ids']) > 2) {
@@ -610,7 +609,8 @@ if (count($inlineout['display_ids']) > 2) {
     }
 }
 
-/* Show attachment information in headers? */
+/* Show attachment information in headers? 'atc_parts' will be empty if
+ * 'parts_display' pref is 'none'. */
 if (!empty($inlineout['atc_parts'])) {
     $tmp = array();