Add message information to preview screen
authorMichael M Slusarz <slusarz@curecanti.org>
Fri, 5 Jun 2009 19:05:14 +0000 (13:05 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Fri, 5 Jun 2009 19:05:34 +0000 (13:05 -0600)
imp/docs/CHANGES
imp/js/src/DimpBase.js
imp/lib/Maillog.php
imp/lib/Views/ShowMessage.php
imp/templates/index/index-dimp.inc
imp/themes/screen-dimp.css
imp/themes/silver/screen-dimp.css

index 51b6439..01cccf2 100644 (file)
@@ -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 <goncalo.queiros@portugalmail.net>).
index c171b39..45d8a3d 100644 (file)
@@ -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 += '<tr><td>' + entry + '</td></tr>';
+            });
+            $('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);
index eb2980f..9d254b0 100644 (file)
@@ -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;
     }
 
     /**
index cc1c6b6..c472b00 100644 (file)
@@ -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);
index 61833ba..525e84b 100644 (file)
@@ -306,6 +306,15 @@ 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>
+             <td>
+              <div><span class="infoLabel"><?php echo _("Message Information") ?></span></div>
+              <div id="infolist" style="display:none">
+               <table cellspacing="2"></table>
+              </div>
+             </td>
+            </tr>
            </thead>
           </table>
          </div>
index 2a714a1..967b1c1 100644 (file)
@@ -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 {
index 40258d0..65759f9 100644 (file)
@@ -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 {