[dev] PATCH Mnemo add summary colors.

Mike Cochrane mike@graftonhall.co.nz
Fri, 9 Aug 2002 04:27:54 +0100


Add little summary boxes next to the Mnemo summary to match the style of Nag so
you can see what category your memos are in.

- Mike :-)

Index: mnemo/config/prefs.php.dist
===================================================================
RCS file: /httpd/horde/mnemo/config/prefs.php.dist,v
retrieving revision 1.2
diff -I$Horde -I$Revision -I$Date -u -r1.2 prefs.php.dist
--- mnemo/config/prefs.php.dist	2002/08/04 02:31:07	1.2
+++ mnemo/config/prefs.php.dist	2002/08/09 03:22:51
@@ -14,7 +14,7 @@
     'column' => _("Other Options"),
     'label' => _("Display Options"),
     'desc' => _("Change your memo sorting and display options."),
-    'members' => array('sortby', 'sortdir'));
+    'members' => array('sortby', 'sortdir', 'summary_show_colors'));
 
 $prefGroups['categories'] = array(
     'column'  => _("Other Options"),
@@ -77,4 +77,13 @@
     'shared' => false,
     'type' => 'implicit',
     'desc' => _("Choose Color")
+);
+
+// show highlight colors in summary
+$_prefs['summary_show_colors'] = array(
+    'value' => 1,
+    'locked' => false,
+    'shared' => false,
+    'type' => 'checkbox',
+    'desc' => _("Show highlight colors in the summary view?")
 );
Index: mnemo/lib/api.php
===================================================================
RCS file: /httpd/horde/mnemo/lib/api.php,v
retrieving revision 1.5
diff -I$Horde -I$Revision -I$Date -u -r1.5 api.php
--- mnemo/lib/api.php	2002/07/28 06:36:00	1.5
+++ mnemo/lib/api.php	2002/08/09 03:20:53
@@ -85,9 +85,20 @@
 
     $html .= '</td></tr><tr><td class="summarytext"><table border="0"
cellpadding="0" cellspacing="0">';
 
+    $colors = Mnemo::categoryColors();
+
     $memos = _mnemo_list();
     foreach ($memos as $id => $memo) {
-        $html .= '<tr><td class="text">';
+        $html .= '  <tr>';
+
+        if ($prefs->getValue('summary_show_colors')) {
+            $color = isset($colors[$memo['category']]) ?
$colors[$memo['category']] : '#ffffff';
+            $priority_cell = '<td width="20" align="center"
style="background-color:' . $color . '"></td>';
+            $spacer_cell = '<td width="3"></td>';
+            $html .= $priority_cell . $spacer_cell;
+        }
+        
+        $html .= '<td class="text">';
         $html .= Horde::link(Horde::applicationUrl('view.php?memo=' . $id),
$memo['desc']) . htmlspecialchars($memo['desc']) . '</a>';
         $html .= "</td></tr>\n";
     }

-------------------------------------------------------------------------
This mail sent from Mike's CVS HEAD install of IMP: http://horde.org/imp/