From: Michael M Slusarz Date: Fri, 30 Oct 2009 20:04:56 +0000 (-0600) Subject: Better formatStatusMsg() implementation X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=ffc696492441891f7fda6d49ce1432531de71d66;p=horde.git Better formatStatusMsg() implementation --- diff --git a/imp/lib/UI/Message.php b/imp/lib/UI/Message.php index 6894277fd..8f304eb47 100644 --- a/imp/lib/UI/Message.php +++ b/imp/lib/UI/Message.php @@ -435,28 +435,32 @@ class IMP_UI_Message */ public function formatStatusMsg($data) { - if (empty($data)) { - return ''; - } + $out = ''; - $class = 'mimeStatusMessage'; + foreach ($data as $val) { + if (empty($val)) { + continue; + } - $out = array('
'); + $out .= '
'; - /* If no image, simply print out the message. */ - if (empty($data['icon'])) { - foreach ($data['text'] as $val) { - $out[] = ''; - } - } else { - $out[] = ''; + + $out .= '
' . $val . '
' . $data['icon'] . ''; - foreach ($data['text'] as $val) { - $out[] = ''; + /* If no image, simply print out the message. */ + if (empty($val['icon'])) { + foreach ($val['text'] as $val) { + $out .= ''; + } + } else { + $out .= ''; } - $out[] = '
' . $val . '
' . $val . '
' . $val['icon'] . ''; + foreach ($val['text'] as $val) { + $out .= ''; + } + $out .= '
' . $val . '
'; } - return implode("\n", $out) . "\n\n"; + return $out; } /** diff --git a/imp/lib/Views/ShowMessage.php b/imp/lib/Views/ShowMessage.php index 58131f196..5df837964 100644 --- a/imp/lib/Views/ShowMessage.php +++ b/imp/lib/Views/ShowMessage.php @@ -260,7 +260,7 @@ class IMP_Views_ShowMessage /* Do MDN processing now. */ if ($imp_ui->MDNCheck($mailbox, $uid, $mime_headers)) { - $result['msgtext'] .= $imp_ui->formatStatusMsg(array('text' => array(_("The sender of this message is requesting a Message Disposition Notification from you when you have read this message."), sprintf(_("Click %s to send the notification message."), Horde::link('', '', '', '', 'DimpCore.doAction(\'SendMDN\',{folder:\'' . $mailbox . '\',uid:' . $uid . '}); return false;', '', '') . _("HERE") . '')))); + $result['msgtext'] .= $imp_ui->formatStatusMsg(array(array('text' => array(_("The sender of this message is requesting a Message Disposition Notification from you when you have read this message."), sprintf(_("Click %s to send the notification message."), Horde::link('', '', '', '', 'DimpCore.doAction(\'SendMDN\',{folder:\'' . $mailbox . '\',uid:' . $uid . '}); return false;', '', '') . _("HERE") . ''))))); } /* Build body text. This needs to be done before we build the @@ -296,13 +296,9 @@ class IMP_Views_ShowMessage continue; } - $tmp_status = array(); - - foreach ($info['status'] as $val) { - $tmp_status[] = $imp_ui->formatStatusMsg($val); - } - - $result['msgtext'] .= $imp_ui->formatSummary($imp_contents->getSummary($id, $contents_mask), $part_info_display) . implode("\n", $tmp_status) . $info['data']; + $result['msgtext'] .= $imp_ui->formatSummary($imp_contents->getSummary($id, $contents_mask), $part_info_display) . + $imp_ui->formatStatusMsg($info['status']) . + $info['data']; if (isset($info['js'])) { $result['js'] = array_merge($result['js'], $info['js']); @@ -311,7 +307,7 @@ class IMP_Views_ShowMessage } if (!strlen($result['msgtext'])) { - $result['msgtext'] = $imp_ui->formatStatusMsg(array('text' => array(_("There are no parts that can be shown inline.")))); + $result['msgtext'] = $imp_ui->formatStatusMsg(array(array('text' => array(_("There are no parts that can be shown inline."))))); } if (count($atc_parts) || diff --git a/imp/message.php b/imp/message.php index a45f866ae..826c76d6e 100644 --- a/imp/message.php +++ b/imp/message.php @@ -575,7 +575,7 @@ $msgtext = ''; /* Do MDN processing now. */ if ($imp_ui->MDNCheck($imp_mbox['mailbox'], $uid, $mime_headers, Horde_Util::getFormData('mdn_confirm'))) { - $msgtext .= $imp_ui->formatStatusMsg(array('text' => array(_("The sender of this message is requesting a Message Disposition Notification from you when you have read this message."), sprintf(_("Click %s to send the notification message."), Horde::link(htmlspecialchars(Horde_Util::addParameter($selfURL, 'mdn_confirm', 1))) . _("HERE") . '')))); + $msgtext .= $imp_ui->formatStatusMsg(array(array('text' => array(_("The sender of this message is requesting a Message Disposition Notification from you when you have read this message."), sprintf(_("Click %s to send the notification message."), Horde::link(htmlspecialchars(Horde_Util::addParameter($selfURL, 'mdn_confirm', 1))) . _("HERE") . ''))))); } $show_parts = Horde_Util::getFormData('show_parts', $prefs->getValue('parts_display')); @@ -627,13 +627,8 @@ foreach ($parts_list as $mime_id => $mime_type) { continue; } - $tmp_status = array(); - foreach ($info['status'] as $val) { - $tmp_status[] = $imp_ui->formatStatusMsg($val); - } - $msgtext .= $imp_ui->formatSummary($imp_contents->getSummary($id, $contents_mask), $part_info_display) . - implode("\n", $tmp_status) . + $imp_ui->formatStatusMsg($info['status']) . $info['data']; if (isset($info['js'])) { @@ -643,7 +638,7 @@ foreach ($parts_list as $mime_id => $mime_type) { } if (!strlen($msgtext)) { - $msgtext = $imp_ui->formatStatusMsg(array('text' => array(_("There are no parts that can be shown inline.")))); + $msgtext = $imp_ui->formatStatusMsg(array(array('text' => array(_("There are no parts that can be shown inline."))))); } /* Build the Attachments menu. */