Bug #7981: Fix multipart/alternative display
authorMichael M Slusarz <slusarz@curecanti.org>
Sun, 8 Nov 2009 08:56:05 +0000 (01:56 -0700)
committerMichael M Slusarz <slusarz@curecanti.org>
Mon, 9 Nov 2009 19:30:29 +0000 (12:30 -0700)
imp/lib/Contents.php
imp/lib/Mime/Viewer/Alternative.php
imp/lib/UI/Message.php

index 551ddac..e14bcca 100644 (file)
@@ -380,6 +380,8 @@ class IMP_Contents
      * @return array  See Horde_Mime_Viewer_Driver::render(). The following
      *                fields may also be present in addition to the fields
      *                defined in Horde_Mime_Viewer_Driver:
+     *                'attach' - (boolean) Force display of this part as an
+     *                           attachment.
      *                'js' - (array) A list of javascript commands to run
      *                       after the content is displayed on screen.
      *                'name' - (string) Contains the MIME name information.
index cc34d4f..733a765 100644 (file)
@@ -110,6 +110,8 @@ class IMP_Horde_Mime_Viewer_Alternative extends Horde_Mime_Viewer_Driver
                     $ret[$id] = $render[$id];
                     unset($display_ids[$id]);
                 }
+            } elseif ($disp_id != $val) {
+                $ret[$val] = array('attach' => true);
             }
         }
 
index 48f2724..7810e84 100644 (file)
@@ -545,9 +545,19 @@ class IMP_UI_Message
                     $wrap_ids[] = $mime_id;
                 }
 
-                $msgtext .= $this->formatSummary($imp_contents->getSummary($id, $contents_mask), $part_info_display) .
-                    $this->formatStatusMsg($info['status']) .
-                    '<div class="mimePartData">' . $info['data'] . '</div>';
+                if (empty($info['attach'])) {
+                    $msgtext .= $this->formatSummary($imp_contents->getSummary($id, $contents_mask), $part_info_display) .
+                        $this->formatStatusMsg($info['status']) .
+                        '<div class="mimePartData">' . $info['data'] . '</div>';
+                } else {
+                    if ($show_parts == 'atc') {
+                        $atc_parts[] = $id;
+                    }
+
+                    if ($GLOBALS['prefs']->getValue('atc_display')) {
+                        $msgtext .= $this->formatSummary($imp_contents->getSummary($id, $contents_mask), $part_info_display, true);
+                    }
+                }
 
                 if (isset($info['js'])) {
                     $js_onload = array_merge($js_onload, $info['js']);