Tweak message log information display/element naming
authorMichael M Slusarz <slusarz@curecanti.org>
Tue, 16 Jun 2009 03:57:44 +0000 (21:57 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Tue, 16 Jun 2009 03:59:54 +0000 (21:59 -0600)
imp/compose-dimp.php
imp/js/src/DimpBase.js
imp/js/src/DimpCore.js
imp/js/src/compose-dimp.js
imp/js/src/fullmessage-dimp.js
imp/lib/DIMP.php
imp/lib/Views/ShowMessage.php
imp/templates/chunks/message.php
imp/templates/index/index-dimp.inc
imp/themes/screen-dimp.css
imp/themes/silver/screen-dimp.css

index fe02d57..6ec6e81 100644 (file)
@@ -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);
index adab2b3..d39759e 100644 (file)
@@ -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) {
index 3fe9a0f..bfbe9f1 100644 (file)
@@ -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 += '<li><span class="iconImg imp-' + entry.t + '"></span>' + entry.m + '</li>';
         });
-        $('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
                     }
                 });
index 3433850..5f54db4 100644 (file)
@@ -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);
index f0e3173..0c10929 100644 (file)
@@ -158,8 +158,8 @@ var DimpFullmessage = {
 
         /* Add message information. */
         if (this.log) {
-            $('msgInfo').show();
-            DimpCore.updateInfoList(this.log);
+            $('msgLogInfo').show();
+            DimpCore.updateMsgLog(this.log);
         }
     }
 
index 0cca8f5..4300be2 100644 (file)
@@ -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;
+    }
+
 }
index a3db8c7..c7cef7e 100644 (file)
@@ -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) {
index c637cbf..de98463 100644 (file)
@@ -91,11 +91,11 @@ function _createDAfmsg($text, $image, $id, $class = '', $show_text = true)
          </td>
         </tr>
 <?php endif; ?>
-        <tr id="msgInfo" style="display:none">
-         <td class="label"><a id="infolist_toggle"><span class="iconImg" id="infolist_col"></span><span class="iconImg" id="infolist_exp" style="display:none"></span></a></td>
+        <tr id="msgLogInfo" style="display:none">
+         <td class="label"><a id="msgloglist_toggle"><span class="iconImg" id="msgloglist_col"></span><span class="iconImg" id="msgloglist_exp" style="display:none"></span></a></td>
          <td>
-          <div><span class="infoLabel"><?php echo _("Message Information") ?></span></div>
-          <div id="infolist" style="display:none">
+          <div><span class="msgLogLabel"><?php echo _("Message Log Information") ?></span></div>
+          <div id="msgloglist" style="display:none">
            <ul></ul>
           </div>
          </td>
index 946ab71..a6d227c 100644 (file)
@@ -308,11 +308,11 @@ function _simpleButton($id, $text, $image, $imagedir = null)
               </div>
              </td>
             </tr>
-            <tr id="msgInfo" style="display:none">
-             <td class="label"><a id="infolist_toggle"><span class="iconImg" id="infolist_col"></span><span class="iconImg" id="infolist_exp" style="display:none"></span></a></td>
+            <tr id="msgLogInfo" style="display:none">
+             <td class="label"><a id="msgloglist_toggle"><span class="iconImg" id="msgloglist_col"></span><span class="iconImg" id="msgloglist_exp" style="display:none"></span></a></td>
              <td>
-              <div><span class="infoLabel"><?php echo _("Message Information") ?></span></div>
-              <div id="infolist" style="display:none">
+              <div><span class="msgLogLabel"><?php echo _("Message Log Information") ?></span></div>
+              <div id="msgloglist" style="display:none">
                <ul></ul>
               </div>
              </td>
index 91c16ba..034d7fe 100644 (file)
@@ -523,7 +523,7 @@ div.dimpActionsCompose, div.dimpActionsMsg {
 #msgAtc td {
     padding-bottom: 0;
 }
-.atcLabel, .infoLabel {
+.atcLabel, .msgLogLabel {
     font-weight: bold;
     padding-right: 5px;
 }
@@ -536,10 +536,10 @@ div.dimpActionsCompose, div.dimpActionsMsg {
     padding-bottom: 2px;
 }
 
-#infolist {
+#msgloglist {
     padding-top: 2px;
 }
-#infolist ul {
+#msgloglist ul {
     list-style-type: none;
 }
 
@@ -1000,10 +1000,10 @@ span.threadImg {
     width: 0;
     margin-right: 0;
 }
-#th_expand span.iconImg, #partlist_col, #infolist_col {
+#th_expand span.iconImg, #partlist_col, #msgloglist_col {
     background-image: url("graphics/arrow_collapsed.png");
 }
-#th_collapse span.iconImg, #partlist_exp, #infolist_exp {
+#th_collapse span.iconImg, #partlist_exp, #msgloglist_exp {
     background-image: url("graphics/arrow_expanded.png");
 }
 #msg_view_source span.iconImg {
index d06b8d0..5e2019f 100644 (file)
@@ -152,10 +152,10 @@ span.dimpactionDrafts {
     background-image: url("graphics/search.png");
 }
 
-#th_expand span.iconImg, #partlist_col, #infolist_col {
+#th_expand span.iconImg, #partlist_col, #msgloglist_col {
     background-image: url("graphics/arrow_collapsed.png");
 }
-#th_collapse span.iconImg, #partlist_exp, #infolist_exp {
+#th_collapse span.iconImg, #partlist_exp, #msgloglist_exp {
     background-image: url("graphics/arrow_expanded.png");
 }
 #msg_view_source span.iconImg {