From d4fbdf726102515cfd5b33677aab6a36aaf7c5c5 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Fri, 5 Jun 2009 13:05:14 -0600 Subject: [PATCH] Add message information to preview screen --- imp/docs/CHANGES | 1 + imp/js/src/DimpBase.js | 27 +++++++++++++++++++++++++++ imp/lib/Maillog.php | 35 +++++++++++++++++++++++++++-------- imp/lib/Views/ShowMessage.php | 13 +++++++++---- imp/templates/index/index-dimp.inc | 9 +++++++++ imp/themes/screen-dimp.css | 6 +++--- imp/themes/silver/screen-dimp.css | 4 ++-- 7 files changed, 78 insertions(+), 17 deletions(-) diff --git a/imp/docs/CHANGES b/imp/docs/CHANGES index 51b6439ee..01cccf2cd 100644 --- a/imp/docs/CHANGES +++ b/imp/docs/CHANGES @@ -2,6 +2,7 @@ v5.0-git -------- +[mms] Add message information to preview screen (DIMP). [mms] Add Alt + PGUP/PGDN shortcut to scroll through preview message (DIMP). [jan] Show possible event conflicts in iTip viewer (Request #3991, Gonçalo Queirós ). diff --git a/imp/js/src/DimpBase.js b/imp/js/src/DimpBase.js index c171b390d..45d8a3d6f 100644 --- a/imp/js/src/DimpBase.js +++ b/imp/js/src/DimpBase.js @@ -1004,6 +1004,21 @@ var DimpBase = { $('msgAtc').hide(); } + // Add message information + if (r.log) { + $('msgInfo').show(); + $('infolist_col').show(); + $('infolist_exp').hide(); + + tmp = ''; + r.log.each(function(entry) { + tmp += '' + entry + ''; + }); + $('infolist').down('TABLE').update(tmp); + } else { + $('msgInfo').hide(); + } + $('msgBody').update(r.msgtext); this.loadingImg('msg', false); $('previewInfo').hide(); @@ -1602,6 +1617,18 @@ var DimpBase = { $('qsearch_input').focus(); break; + case 'infolist_toggle': + $('infolist_col', 'infolist_exp').invoke('toggle'); + Effect.toggle('infolist', 'blind', { + duration: 0.2, + queue: { + position: 'end', + scope: 'infolist', + limit: 2 + } + }); + break; + default: if (elt.hasClassName('RBFolderOk')) { this.cfolderaction(e); diff --git a/imp/lib/Maillog.php b/imp/lib/Maillog.php index eb2980f69..9d254b0cd 100644 --- a/imp/lib/Maillog.php +++ b/imp/lib/Maillog.php @@ -115,25 +115,38 @@ class IMP_Maillog } /** - * Retrieve any history for the given Message-ID and display via the - * Horde notification system. + * Retrieve any history for the given Message-ID and (optionally) display + * via the Horde notification system. * * @param string $msg_id The Message-ID of the message. */ static public function displayLog($msg_id) { + foreach (self::parseLog($msg_id) as $entry) { + $GLOBALS['notification']->push($entry['msg'], 'imp.' . $entry['action']); + } + } + + /** + * TODO + */ + static public function parseLog($msg_id) + { try { - $msg_history = self::getLog($msg_id); + if (!$msg_history = self::getLog($msg_id)) { + return array(); + } } catch (Horde_Exception $e) { - return; + return array(); } - if (!$msg_history) { - return; - } + $df = $GLOBALS['prefs']->getValue('date_format'); + $tf = $GLOBALS['prefs']->getValue('time_format'); + $ret = array(); foreach ($msg_history->getData() as $entry) { $msg = null; + if (isset($entry['desc'])) { $msg = $entry['desc']; } else { @@ -155,10 +168,16 @@ class IMP_Maillog break; } } + if ($msg) { - $GLOBALS['notification']->push(htmlspecialchars(@sprintf($msg, strftime($GLOBALS['prefs']->getValue('date_format') . ' ' . $GLOBALS['prefs']->getValue('time_format'), $entry['ts']))), 'imp.' . $entry['action']); + $ret[] = array( + 'action' => $entry['action'], + 'msg' => @sprintf($msg, strftime($df . ' ' . $tf, $entry['ts'])) + ); } } + + return $ret; } /** diff --git a/imp/lib/Views/ShowMessage.php b/imp/lib/Views/ShowMessage.php index cc1c6b6d5..c472b0067 100644 --- a/imp/lib/Views/ShowMessage.php +++ b/imp/lib/Views/ShowMessage.php @@ -186,18 +186,23 @@ class IMP_Views_ShowMessage } } - /* Get minidate. */ if ($preview) { + /* Get minidate. */ $imp_mailbox_ui = new IMP_UI_Mailbox(); $minidate = $imp_mailbox_ui->getDate($envelope['date']); if (empty($minidate)) { $minidate = _("Unknown Date"); } $result['minidate'] = htmlspecialchars($minidate); - } - /* Display the user-specified headers for the current identity. */ - if (!$preview) { + /* Grab maillog information. */ + if (!empty($GLOBALS['conf']['maillog']['use_maillog'])) { + foreach (IMP_Maillog::parseLog($envelope['message-id']) as $val) { + $result['log'][] = htmlspecialchars($val['msg']); + } + } + } else { + /* Display the user-specified headers for the current identity. */ $user_hdrs = $imp_ui->getUserHeaders(); foreach ($user_hdrs as $user_hdr) { $user_val = $mime_headers->getValue($user_hdr); diff --git a/imp/templates/index/index-dimp.inc b/imp/templates/index/index-dimp.inc index 61833bacd..525e84b92 100644 --- a/imp/templates/index/index-dimp.inc +++ b/imp/templates/index/index-dimp.inc @@ -306,6 +306,15 @@ function _simpleButton($id, $text, $image, $imagedir = null) + + + +
+ + + diff --git a/imp/themes/screen-dimp.css b/imp/themes/screen-dimp.css index 2a714a16f..967b1c167 100644 --- a/imp/themes/screen-dimp.css +++ b/imp/themes/screen-dimp.css @@ -527,7 +527,7 @@ div.dimpActionsCompose, div.dimpActionsMsg { #msgAtc td { padding-bottom: 0; } -.atcLabel { +.atcLabel, .infoLabel { font-weight: bold; padding-right: 5px; } @@ -997,10 +997,10 @@ span.threadImg { width: 0; margin-right: 0; } -#th_expand span.iconImg, #partlist_col { +#th_expand span.iconImg, #partlist_col, #infolist_col { background-image: url("graphics/arrow_collapsed.png"); } -#th_collapse span.iconImg, #partlist_exp { +#th_collapse span.iconImg, #partlist_exp, #infolist_exp { background-image: url("graphics/arrow_expanded.png"); } #msg_view_source span.iconImg { diff --git a/imp/themes/silver/screen-dimp.css b/imp/themes/silver/screen-dimp.css index 40258d0b2..65759f960 100644 --- a/imp/themes/silver/screen-dimp.css +++ b/imp/themes/silver/screen-dimp.css @@ -155,10 +155,10 @@ span.dimpactionDrafts { background-image: url("graphics/search.png"); } -#th_expand span.iconImg, #partlist_col { +#th_expand span.iconImg, #partlist_col, #infolist_col { background-image: url("graphics/arrow_collapsed.png"); } -#th_collapse span.iconImg, #partlist_exp { +#th_collapse span.iconImg, #partlist_exp, #infolist_exp { background-image: url("graphics/arrow_expanded.png"); } #msg_view_source span.iconImg { -- 2.11.0