From 518f99048e2a7a0d8fd8deb1ff4fb096474b02d8 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Fri, 22 Jan 2010 13:48:08 -0700 Subject: [PATCH] Tweak summary attachment display. 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 | 3 ++- imp/lib/Ui/Message.php | 10 ++++++++-- imp/message.php | 6 +++--- 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/imp/config/prefs.php.dist b/imp/config/prefs.php.dist index 3198a4b8c..e293ea74f 100644 --- a/imp/config/prefs.php.dist +++ b/imp/config/prefs.php.dist @@ -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?")); diff --git a/imp/lib/Ui/Message.php b/imp/lib/Ui/Message.php index 2ba947089..b6441a308 100644 --- a/imp/lib/Ui/Message.php +++ b/imp/lib/Ui/Message.php @@ -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: *
@@ -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;
diff --git a/imp/message.php b/imp/message.php
index 95327d0a8..2d9d04071 100644
--- a/imp/message.php
+++ b/imp/message.php
@@ -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();
 
-- 
2.11.0