[imp] Customizing Header Display

Adam Tauno Williams awilliam at opengroupware.us
Wed Sep 23 14:22:04 UTC 2009


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));
        }
    }
}

.....



More information about the imp mailing list