From: Michael M Slusarz Date: Thu, 29 Oct 2009 06:31:10 +0000 (-0600) Subject: Add IMP_UI_Message::formatSummary() X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=7d56aa35c0f3d8232c590dbd0bc070f7855970e6;p=horde.git Add IMP_UI_Message::formatSummary() --- diff --git a/imp/lib/UI/Message.php b/imp/lib/UI/Message.php index a4a19e04f..6894277fd 100644 --- a/imp/lib/UI/Message.php +++ b/imp/lib/UI/Message.php @@ -408,7 +408,25 @@ class IMP_UI_Message } /** - * Prints out a MIME status message. + * Prints out a MIME summary (in HTML). + * + * @param array $summary Summary information from + * IMP_Summary::getSummary(). + * @param array $display The fields to display (in this order). + * + * @return string The formatted summary string. + */ + public function formatSummary($summary, $display) + { + $tmp_summary = array(); + foreach ($display as $val) { + $tmp_summary[] = $summary[$val]; + } + return '
' . implode(' ', $tmp_summary) . '
'; + } + + /** + * Prints out a MIME status message (in HTML). * * @param array $data An array of information (as returned from Horde_Mime_Viewer::render()). diff --git a/imp/lib/Views/ShowMessage.php b/imp/lib/Views/ShowMessage.php index e8e2266c3..58131f196 100644 --- a/imp/lib/Views/ShowMessage.php +++ b/imp/lib/Views/ShowMessage.php @@ -296,18 +296,13 @@ class IMP_Views_ShowMessage continue; } - $tmp_summary = $tmp_status = array(); - - $summary = $imp_contents->getSummary($id, $contents_mask); - foreach ($part_info_display as $val) { - $tmp_summary[] = $summary[$val]; - } + $tmp_status = array(); foreach ($info['status'] as $val) { $tmp_status[] = $imp_ui->formatStatusMsg($val); } - $result['msgtext'] .= '
' . implode(' ', $tmp_summary) . '
' . implode("\n", $tmp_status) . $info['data']; + $result['msgtext'] .= $imp_ui->formatSummary($imp_contents->getSummary($id, $contents_mask), $part_info_display) . implode("\n", $tmp_status) . $info['data']; if (isset($info['js'])) { $result['js'] = array_merge($result['js'], $info['js']); diff --git a/imp/message.php b/imp/message.php index 718c277b9..a45f866ae 100644 --- a/imp/message.php +++ b/imp/message.php @@ -627,18 +627,12 @@ foreach ($parts_list as $mime_id => $mime_type) { continue; } - $tmp_summary = $tmp_status = array(); - - $summary = $imp_contents->getSummary($id, $contents_mask); - foreach ($part_info_display as $val) { - $tmp_summary[] = $summary[$val]; - } - + $tmp_status = array(); foreach ($info['status'] as $val) { $tmp_status[] = $imp_ui->formatStatusMsg($val); } - $msgtext .= '
' . implode(' ', $tmp_summary) . '
' . + $msgtext .= $imp_ui->formatSummary($imp_contents->getSummary($id, $contents_mask), $part_info_display) . implode("\n", $tmp_status) . $info['data'];