From 296ab3acac649cb38a0e40ddac159b54117e32be Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Tue, 11 Nov 2008 13:04:57 -0700 Subject: [PATCH] Output status messages. --- imp/lib/UI/Message.php | 59 ++++++++++++++++++++++++++++++++++++++++++-------- imp/message.php | 5 ++--- 2 files changed, 52 insertions(+), 12 deletions(-) diff --git a/imp/lib/UI/Message.php b/imp/lib/UI/Message.php index 256c3e5d1..62b8eee10 100644 --- a/imp/lib/UI/Message.php +++ b/imp/lib/UI/Message.php @@ -15,7 +15,7 @@ class IMP_UI_Message { /** */ - function basicHeaders() + public function basicHeaders() { return array( 'date' => _("Date"), @@ -33,7 +33,7 @@ class IMP_UI_Message * * @return array TODO */ - function getUserHeaders() + public function getUserHeaders() { $user_hdrs = $GLOBALS['prefs']->getValue('mail_hdr'); @@ -55,7 +55,7 @@ class IMP_UI_Message /** */ - function MDNCheck($headers, $confirmed = false) + public function MDNCheck($headers, $confirmed = false) { if (!$GLOBALS['prefs']->getValue('disposition_send_mdn')) { return; @@ -96,7 +96,7 @@ class IMP_UI_Message * @return string The date string with the local time added on. The * output has been run through htmlspecialchars(). */ - function addLocalTime($date) + public function addLocalTime($date) { if (empty($date)) { $ltime = false; @@ -132,7 +132,7 @@ class IMP_UI_Message * * @return array TODO */ - function parseAllListHeaders($headers) + public function parseAllListHeaders($headers) { $ret = array(); @@ -154,7 +154,7 @@ class IMP_UI_Message * * @return string The header value. */ - function parseListHeaders($data, $raw = false) + public function parseListHeaders($data, $raw = false) { $output = ''; @@ -214,7 +214,7 @@ class IMP_UI_Message * * @return string 'high', 'low', or 'normal'. */ - function getXpriority($headers) + public function getXpriority($headers) { if (($priority = $headers->getValue('x-priority')) && preg_match('/\s*(\d+)\s*/', $priority, $matches)) { @@ -235,7 +235,7 @@ class IMP_UI_Message * * @return array An array with 2 elements: 'exists' and 'reply_list'. */ - function getListInformation($headers) + public function getListInformation($headers) { $ret = array('exists' => false, 'reply_list' => null); @@ -262,7 +262,7 @@ class IMP_UI_Message * * @return string String containing the formatted address list. */ - function buildAddressLinks($addrlist, $addURL, $link = true) + public function buildAddressLinks($addrlist, $addURL, $link = true) { global $prefs, $registry; @@ -363,4 +363,45 @@ class IMP_UI_Message return $ret; } + /** + * Prints out a MIME status message. + * + * @param array $data An array of information (as returned from + Horde_Mime_Viewer::render()). + * + * @return string The formatted status message string. + */ + public function formatStatusMsg($data) + { + if (empty($data)) { + return ''; + } + + // TODO - $data['type'] + $class = 'mimeStatusMessage'; + + $out = array(''); + + /* If no image, simply print out the message. */ + if (empty($data['icon'])) { + foreach ($data['text'] as $val) { + $out[] = ''; + } + } else { + $out[] = ''; + } + + return implode("\n", $out) . "\n
' . $val . '
' . $data['icon'] . ''; + if (count($data['text']) == 1) { + $out[] = $msg[0]; + } else { + $out[] = ''; + foreach ($data['text'] as $val) { + $out[] = ''; + } + $out[] = '
' . $val . '
'; + } + $out[] = '
\n"; + } + } diff --git a/imp/message.php b/imp/message.php index 1280233b7..5c9fb068f 100644 --- a/imp/message.php +++ b/imp/message.php @@ -686,14 +686,13 @@ foreach ($summary['info']['render'] as $mime_id => $type) { } foreach ($render_part['status'] as $val) { - // TODO: status msgs. - //$tmp_status[] = $render_part['status']['text']; + $tmp_status[] = $imp_ui->formatStatusMsg($val); } $msgtext .= '' . implode(' ', $tmp_part) . '' . - //implode(' ', $tmp_status) . + implode("\n", $tmp_status) . $render_part['data']; } -- 2.11.0