[dev] [turba-patch] display flag

Francois Marier francois at nit.ca
Tue Jul 27 16:57:35 PDT 2004


Here's a very small patch that takes advantage of the flag function in
NLS to add some color to the display page of Turba.

I don't know if you'll be interested in this but I figured that since
IMP has something similar I might as well send it over to you guys.

Francois
-------------- next part --------------
diff -rpuN -X ../ignorelist ../build/turba/lib/Renderer.php turba/lib/Renderer.php
--- ../build/turba/lib/Renderer.php	Mon Jul 12 21:10:03 2004
+++ turba/lib/Renderer.php	Mon Jul 12 21:10:24 2004
@@ -33,6 +33,18 @@ class Turba_Renderer extends Horde_Form_
 
     function _sectionHeader($title)
     {
+        // Add a flag to the title bar based on the email address
+        if (is_object($this->_object)) {
+            $from = $this->_object->getValue('email');
+            $parsed = imap_rfc822_parse_adrlist($from, '');
+            if (is_array($parsed) && (count($parsed) > 0)) {
+                $email_ob = $parsed[0];
+                $flag_img = NLS::generateFlagImageByHost($email_ob->host);
+                if (!empty($flag_img)) {
+                    $title .= " $flag_img";
+                }
+            }
+        }
 ?><table border="0" cellpadding="2" cellspacing="0" width="100%">
 <tr><td align="left" class="header"><b><?php echo $title ?></b></td>
 <?php


More information about the dev mailing list