Request #7487: Link URLs/e-mails in subjects in message views.
authorMichael M Slusarz <slusarz@curecanti.org>
Mon, 30 Mar 2009 23:50:21 +0000 (17:50 -0600)
committerMichael M Slusarz <slusarz@curecanti.org>
Mon, 30 Mar 2009 23:50:21 +0000 (17:50 -0600)
imp/docs/CHANGES
imp/lib/UI/Message.php
imp/lib/Views/ShowMessage.php
imp/message.php

index 80e8aff..e8570ee 100644 (file)
@@ -2,6 +2,7 @@
 v5.0-git
 --------
 
+[mms] Link URLs/e-mails in subjects in message views (Request #7487).
 [mms] Implement spellcheck on send in DIMP.
 [mms] Sanity check - don't do message operations reliant on UID list if
       UIDVALIDITY of mailbox has changed.
index c82ec74..5f0fa6c 100644 (file)
@@ -414,4 +414,24 @@ class IMP_UI_Message
         return implode("\n", $out) . "\n</table>\n";
     }
 
+    /**
+     * Get the display subject (filtered, formatted, and linked).
+     *
+     * @param string $subject  The subject text.
+     *
+     * @return string  The display subject string.
+     */
+    public function getDisplaySubject($subject)
+    {
+        require_once 'Horde/Text.php';
+        require_once 'Horde/Text/Filter.php';
+
+        $subject = IMP::filterText($subject);
+        if (!($disp_subject = Text::htmlSpaces($subject))) {
+            $disp_subject = $subject;
+        }
+
+        return Text_Filter::filter($disp_subject, 'text2html', array('parselevel' => TEXT_HTML_MICRO, 'class' => null, 'callback' => null));
+    }
+
 }
index 53daf40..ae23cb9 100644 (file)
@@ -216,12 +216,9 @@ class IMP_Views_ShowMessage
         }
 
         /* Process the subject. */
-        if (($subject = $mime_headers->getValue('subject'))) {
-            require_once 'Horde/Text.php';
-            $result['subject'] = Text::htmlSpaces(IMP::filterText($subject));
-        } else {
-            $result['subject'] = htmlspecialchars(_("[No Subject]"));
-        }
+        $result['subject'] = ($subject = $mime_headers->getValue('subject'))
+            ? $imp_ui->getDisplaySubject($subject)
+            : htmlspecialchars(_("[No Subject]"));
 
         /* Get X-Priority. */
         $result['priority'] = $imp_ui->getXpriority($mime_headers->getValue('x-priority'));
index 369592d..7cb3f72 100644 (file)
@@ -287,13 +287,8 @@ foreach (array('to', 'cc', 'bcc') as $val) {
 }
 
 /* Process the subject now. */
-if (($subject = $mime_headers->getValue('subject'))) {
-    /* Filter the subject text, if requested. */
-    require_once 'Horde/Text.php';
-    $subject = IMP::filterText($subject);
-    $disp_subject = Text::htmlSpaces($subject);
-    $display_headers['subject'] = $disp_subject ? $disp_subject : $subject;
-
+if ($subject = $mime_headers->getValue('subject')) {
+    $display_headers['subject'] = $imp_ui->getDisplaySubject($subject);
     $title = sprintf(_("%s: %s"), $page_label, $subject);
     $shortsub = htmlspecialchars($subject);
 } else {