[imp] Customizing Header Display

Jan Schneider jan at horde.org
Thu Sep 24 15:19:28 UTC 2009


Zitat von Adam Tauno Williams <awilliam at opengroupware.us>:

> I've customized some of the header display in the IMP message view,  but
> by hacking imp/message.php.  It works but I'm curious is there is a more
> kosher way to customize the display of message headers.
>
> ----- imp/message.php ----
> ....
>
> /* Display the user-specified headers for the current identity. */
> $custom_hdrs = array();
> if (!empty($user_hdrs) && !$all_headers) {
>     foreach ($user_hdrs as $user_hdr) {
>         foreach ($full_h as $head => $val) {
>             if (stristr($head, $user_hdr) !== false) {
>                if(stristr($user_hdr, 'X-OpenGroupware-Regarding')) {
>                    $custom_hdrs[$head] = "<a href=
> \"https://iv5.mormail.com/Tasks/view/$val/History/\" target=\"t_$val
> \">OGo#$val</a>";
>                } else {
>                    $custom_hdrs[$head] = $val;
>                }
>             }
>         }
>     }
> }
>
> .....
>
> if (!empty($user_hdrs) && count($custom_hdrs) > 0) {
>     foreach ($custom_hdrs as $head => $val) {
>         if (stristr($head, 'X-OpenGroupware-Regarding')) {
>             $hdrs[] = array('name' => 'Regarding', 'val' => $val, 'i' =>
> (++$i % 2));
>         } elseif (stristr($head, 'X-Spam-Status')) {
>             $hdrs[] = array('name' => 'Ranking', 'val' => $val, 'i' =>
> (++$i % 2));
>         } elseif (stristr($head, 'Message-Id')) {
>             $hdrs[] = array('name' => 'Id', 'val' => $val, 'i' => (++$i
> % 2));
>         } else {
>             $hdrs[] = array('name' => $head, 'val' => $val, 'i' => (++$i
> % 2));
>         }
>     }
> }

The code snippet already points you into the right direction.  
$user_hdrs contains the header list from the user's preference.

Jan.

-- 
Do you need professional PHP or Horde consulting?
http://horde.org/consulting/



More information about the imp mailing list