From 0c44534434df22f1c14487a2669a452d888003f2 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Sun, 8 Nov 2009 01:56:05 -0700 Subject: [PATCH] Bug #7981: Fix multipart/alternative display --- imp/lib/Contents.php | 2 ++ imp/lib/Mime/Viewer/Alternative.php | 2 ++ imp/lib/UI/Message.php | 16 +++++++++++++--- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/imp/lib/Contents.php b/imp/lib/Contents.php index 551ddac9f..e14bcca85 100644 --- a/imp/lib/Contents.php +++ b/imp/lib/Contents.php @@ -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. diff --git a/imp/lib/Mime/Viewer/Alternative.php b/imp/lib/Mime/Viewer/Alternative.php index cc34d4f6c..733a76525 100644 --- a/imp/lib/Mime/Viewer/Alternative.php +++ b/imp/lib/Mime/Viewer/Alternative.php @@ -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); } } diff --git a/imp/lib/UI/Message.php b/imp/lib/UI/Message.php index 48f27242d..7810e8420 100644 --- a/imp/lib/UI/Message.php +++ b/imp/lib/UI/Message.php @@ -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']) . - '
' . $info['data'] . '
'; + if (empty($info['attach'])) { + $msgtext .= $this->formatSummary($imp_contents->getSummary($id, $contents_mask), $part_info_display) . + $this->formatStatusMsg($info['status']) . + '
' . $info['data'] . '
'; + } 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']); -- 2.11.0