Patch for alternating colors in the summary

zorzella@zorzella.com zorzella@zorzella.com
Wed, 27 Feb 2002 10:24:51 -0800 (PST)


Hi,

I'm not sure if this interests you, but I found it somewhat hard to match emails
from the subject/sender with their proper checkboxes. I decided to patch imp to
give me alternating colors for both old and new messages (though not deleted
ones).

The patch, unfortunatelly, is against an installed version of imp 2.2.6, as this
is the latest available as a Debian package. The patch is trivial, and, if there
is interest, I'm sure it would be trivially ported to your version 3, if there
is any interest in it (this is what I need you to tell me, as I have some other
minor improvement ideas I'll work on, but after upgrading to imp 3...).

I'm not subscribed to the list, so any replies, send a copy to me.

For the patch to work, /etc/imp/html.php3 needs to have 3 more variables (2 for
the new colors and one for a counter, I'm pretty sure is not necessary, but did
not have the time to find a better approach). I'm giving all the pertinent color
definitions, as this combination looks good to me...

*******

$default->text_bg                   = '#ccffcc';
$default->text_bg2                  = '#ffffff';

$default->new_item_bg               = '#ffff99';
$default->new_item_bg2              = '#ffff33';

$default->zcounter                      = 0;

********

The patch is:

********

purple:/usr/share/horde/imp/templates/mailbox# diff -u
message_summaries.inc.orig message_summaries.inc.z          
--- message_summaries.inc.orig  Sat Jan 26 15:35:26 2002
+++ message_summaries.inc.z     Tue Feb 26 09:42:20 2002
@@ -1,7 +1,20 @@
 <?php
+ $default->zcounter = $default->zcounter + 1;
  if ($h->Deleted == 'D') { $bg = $default->del_item_bg; }
- else if ($imp->servtype != 'pop3' && ($h->Unseen == 'U' ||
$h->Recent == 'N'))
{ $bg = $default->new_item_bg; }
- else { $bg = $default->text_bg; }
+ else if ($imp->servtype != 'pop3' && ($h->Unseen == 'U' ||
$h->Recent == 'N'))
{ 
+       if ($default->zcounter % 2 == 0) {
+               $bg = $default->new_item_bg; 
+       } else {
+               $bg = $default->new_item_bg2; 
+       }
+ }
+ else { 
+       if ($default->zcounter % 2 == 0) {
+               $bg = $default->text_bg; 
+       } else {
+               $bg = $default->text_bg2; 
+       }
+ }
 ?>
 
 <tr bgcolor="<?php echo $bg ?>">
 *************************


Zorzella