From 7c2e53a7b9b23c1388ed57237a0d3ef6d9100d73 Mon Sep 17 00:00:00 2001 From: Michael M Slusarz Date: Mon, 15 Jun 2009 21:57:44 -0600 Subject: [PATCH] Tweak message log information display/element naming --- imp/compose-dimp.php | 8 +++----- imp/js/src/DimpBase.js | 14 +++++++------- imp/js/src/DimpCore.js | 14 +++++++------- imp/js/src/compose-dimp.js | 2 +- imp/js/src/fullmessage-dimp.js | 4 ++-- imp/lib/DIMP.php | 23 +++++++++++++++++++++++ imp/lib/Views/ShowMessage.php | 10 +++------- imp/templates/chunks/message.php | 8 ++++---- imp/templates/index/index-dimp.inc | 8 ++++---- imp/themes/screen-dimp.css | 10 +++++----- imp/themes/silver/screen-dimp.css | 4 ++-- 11 files changed, 61 insertions(+), 44 deletions(-) diff --git a/imp/compose-dimp.php b/imp/compose-dimp.php index fe02d5780..6ec6e818e 100644 --- a/imp/compose-dimp.php +++ b/imp/compose-dimp.php @@ -185,11 +185,9 @@ if (count($_POST)) { /* Update maillog information. */ if (!empty($header['in_reply_to']) && - !empty($GLOBALS['conf']['maillog']['use_maillog'])) { - $result->log = array(); - foreach (IMP_Maillog::parseLog($header['in_reply_to']) as $val) { - $result->log[] = htmlspecialchars($val['msg']); - } + !empty($GLOBALS['conf']['maillog']['use_maillog']) && + ($tmp = DIMP::getMsgLogInfo($header['in_reply_to']))) { + $result->log = $tmp; } $res = DIMP::getFolderResponse($imptree); diff --git a/imp/js/src/DimpBase.js b/imp/js/src/DimpBase.js index adab2b3bb..d39759e06 100644 --- a/imp/js/src/DimpBase.js +++ b/imp/js/src/DimpBase.js @@ -1021,9 +1021,9 @@ var DimpBase = { // Add message information if (r.log) { - this.updateMsgInfo(r.log); + this.updateMsgLog(r.log); } else { - $('msgInfo').hide(); + $('msgLogInfo').hide(); } $('msgBody').update(r.msgtext); @@ -1040,21 +1040,21 @@ var DimpBase = { }, // opts = index, mailbox - updateMsgInfo: function(log, opts) + updateMsgLog: function(log, opts) { var tmp; if (!opts || (this.pp.imapuid == opts.index && this.pp.view == opts.mailbox)) { - $('msgInfo').show(); + $('msgLogInfo').show(); if (opts) { - $('infolist_col').show(); - $('infolist_exp').hide(); + $('msgloglist_col').show(); + $('msgloglist_exp').hide(); } - DimpCore.updateInfoList(log); + DimpCore.updateMsgLog(log); } if (opts) { diff --git a/imp/js/src/DimpCore.js b/imp/js/src/DimpCore.js index 3fe9a0f95..bfbe9f103 100644 --- a/imp/js/src/DimpCore.js +++ b/imp/js/src/DimpCore.js @@ -318,14 +318,14 @@ var DimpCore = { return elt; }, - /* Add message info to message view. */ - updateInfoList: function(log) + /* Add message log info to message view. */ + updateMsgLog: function(log) { var tmp = ''; log.each(function(entry) { tmp += '
  • ' + entry.m + '
  • '; }); - $('infolist').down('UL').update(tmp); + $('msgloglist').down('UL').update(tmp); }, /* Removes event handlers from address links. */ @@ -387,13 +387,13 @@ var DimpCore = { }); break; - case 'infolist_toggle': - $('infolist_col', 'infolist_exp').invoke('toggle'); - Effect.toggle('infolist', 'blind', { + case 'msgloglist_toggle': + $('msgloglist_col', 'msgloglist_exp').invoke('toggle'); + Effect.toggle('msgloglist', 'blind', { duration: 0.2, queue: { position: 'end', - scope: 'infolist', + scope: 'msgloglist', limit: 2 } }); diff --git a/imp/js/src/compose-dimp.js b/imp/js/src/compose-dimp.js index 3433850dd..5f54db489 100644 --- a/imp/js/src/compose-dimp.js +++ b/imp/js/src/compose-dimp.js @@ -249,7 +249,7 @@ var DimpCompose = { } if (d.log) { - DIMP.baseWindow.DimpBase.updateMsgInfo(d.log, { index: d.index, mailbox: d.reply_folder }); + DIMP.baseWindow.DimpBase.updateMsgLog(d.log, { index: d.index, mailbox: d.reply_folder }); } DIMP.baseWindow.DimpCore.showNotifications(r.msgs); diff --git a/imp/js/src/fullmessage-dimp.js b/imp/js/src/fullmessage-dimp.js index f0e317330..0c109297c 100644 --- a/imp/js/src/fullmessage-dimp.js +++ b/imp/js/src/fullmessage-dimp.js @@ -158,8 +158,8 @@ var DimpFullmessage = { /* Add message information. */ if (this.log) { - $('msgInfo').show(); - DimpCore.updateInfoList(this.log); + $('msgLogInfo').show(); + DimpCore.updateMsgLog(this.log); } } diff --git a/imp/lib/DIMP.php b/imp/lib/DIMP.php index 0cca8f54c..4300be2ab 100644 --- a/imp/lib/DIMP.php +++ b/imp/lib/DIMP.php @@ -358,4 +358,27 @@ class DIMP return array(); } + /** + * Build data structure needed by DimpCore javascript to display message + * log information. + * + * @var string $msg_id The Message-ID header of the message. + * + * @return array An array of information that can be parsed by + * DimpCore.updateInfoList(). + */ + static public function getMsgLogInfo($msg_id) + { + $ret = array(); + + foreach (IMP_Maillog::parseLog($msg_id) as $val) { + $ret[] = array_map('htmlspecialchars', array( + 'm' => $val['msg'], + 't' => $val['action'] + )); + } + + return $ret; + } + } diff --git a/imp/lib/Views/ShowMessage.php b/imp/lib/Views/ShowMessage.php index a3db8c756..c7cef7e92 100644 --- a/imp/lib/Views/ShowMessage.php +++ b/imp/lib/Views/ShowMessage.php @@ -188,13 +188,9 @@ class IMP_Views_ShowMessage } /* Grab maillog information. */ - if (!empty($GLOBALS['conf']['maillog']['use_maillog'])) { - foreach (IMP_Maillog::parseLog($envelope['message-id']) as $val) { - $result['log'][] = array_map('htmlspecialchars', array( - 'm' => $val['msg'], - 't' => $val['action'] - )); - } + if (!empty($GLOBALS['conf']['maillog']['use_maillog']) && + ($tmp = DIMP::getMsgLogInfo($envelope['message-id']))) { + $result['log'] = $tmp; } if ($preview) { diff --git a/imp/templates/chunks/message.php b/imp/templates/chunks/message.php index c637cbfcb..de98463f1 100644 --- a/imp/templates/chunks/message.php +++ b/imp/templates/chunks/message.php @@ -91,11 +91,11 @@ function _createDAfmsg($text, $image, $id, $class = '', $show_text = true) - - + + -
    - - - + + -
    -