[Tickets #599] NEW: diff patch to enable automatic contrasting forground

bugs at bugs.horde.org bugs at bugs.horde.org
Thu Sep 16 14:24:31 PDT 2004


DO NOT REPLY TO THIS MESSAGE. THIS EMAIL ADDRESS IS NOT MONITORED.

Ticket URL: http://bugs.horde.org/ticket/?id=599
-----------------------------------------------------------------------
 Ticket     | 599
 Created By | branche at subharmonics.com
 Summary    | diff patch to enable automatic contrasting forground 
 Queue      | Kronolith
 Version    | HEAD
 State      | New
 Priority   | 1. Low
 Type       | Enhancement
 Owners     | 
-----------------------------------------------------------------------


branche at subharmonics.com (2004-09-16 14:24) wrote:

Index: horde/kronolith/month.php
==================================
--- month.php.bak       2004-09-16 13:37:22.000000000 -0400
+++ month.php   2004-09-16 14:50:06.000000000 -0400
@@ -70,6 +70,7 @@
 }
 
 $colors = $cManager->colors();
+$fgcolors = $cManager->fgColors();
 $eventCategories = array();
 
 foreach ($currentCalendars as $id => $cal) {
@@ -131,8 +132,8 @@
                 if (!$sidebyside || $event->getCalendar() == $id) {
                     $eventCategories[$event->getCategory()] = true;
                     $categoryColor = isset($colors[$event->getCategory()])
? $colors[$event->getCategory()] : $colors['_default_'];
-
-                    $cell .= '<div class="month-eventbox"
style="background-color: ' . $categoryColor . '; ';
+                    $fgColor       =
isset($fgcolors[$event->getCategory()]) ? $fgcolors[$event->getCategory()] :
$fgcolors['_default_'];
+                    $cell .= '<div class="month-eventbox" style="color: ' .
$fgColor . '; background-color: ' . $categoryColor . '; ';
                     $cell .= 'border-color: ' .
Kronolith::borderColor($categoryColor) . ';">';
                     $cell .= $event->getLink($timestamp);
                     $cell .= '</div>';

===============================
Index: horde/kronolith/lib/DayView.php
===============================
--- DayView.php.bak     2004-09-16 15:47:34.000000000 -0400
+++ DayView.php 2004-09-16 15:47:40.000000000 -0400
@@ -72,7 +72,7 @@
         $first_row = true;
 
         $colors = $cManager->colors();
-
+        $fgcolors = $cManager->fgColors();
         if ($this->_sidebyside) {
             require $template_path . '/day/head_side_by_side.inc';
         } else {
@@ -109,7 +109,8 @@
                     // yet. Put one into this row.
                     $event = $this->_all_day_events[$cid][$k];
                     $categoryColor = isset($colors[$event->getCategory()])
? $colors[$event->getCategory()] : '#ccffcc';
-                    $row .= '<td class="day-eventbox"
style="background-color: ' . $categoryColor . '; ';
+                    $fgColor       =
isset($fgcolors[$event->getCategory()]) ? $fgcolors[$event->getCategory()] :
$fgcolors['_default_'];
+                    $row .= '<td class="day-eventbox" style="color: ' .
$fgColor . '; background-color: ' . $categoryColor . '; ';
                     $row .= 'border-color:' .
Kronolith::borderColor($categoryColor) . ';" ';
                     $row .= 'valign="top" colspan="' . $this->_span[$cid] .
'">';
                     $row .= $event->getLink($this->getStamp());

================================
Index: horde/kronolith/lib/WeekView.php
================================
--- WeekView.php.bak    2004-09-16 15:53:43.000000000 -0400
+++ WeekView.php        2004-09-16 15:55:09.000000000 -0400
@@ -111,6 +111,7 @@
         $row = '';
 
         $colors = $cManager->colors();
+        $fgcolors = $cManager->fgColors();
 
         for ($j = $this->startDay; $j <= $this->endDay; $j++) {
             $row .= '<td class="hour" align="right">' . ($more_timeslots ?
_("All day") : '&nbsp;') . '</td>';
@@ -124,7 +125,8 @@
                         } elseif
(count($this->days[$j]->_all_day_events[$cid]) > $k) {
                             $event =
$this->days[$j]->_all_day_events[$cid][$k];
                             $categoryColor =
isset($colors[$event->getCategory()]) ? $colors[$event->getCategory()] :
'#ccffcc';
-                            $row .= '<td class="week-eventbox"
style="background-color: ' . $categoryColor . '; ';
+                            $fgColor       =
isset($fgcolors[$event->getCategory()]) ? $fgcolors[$event->getCategory()] :
$fgcolors['_default_'];
+                            $row .= '<td class="week-eventbox"
style="color: ' . $fgColor . '; background-color: ' . $categoryColor . ';
';
                             $row .= 'border-color: ' .
Kronolith::borderColor($categoryColor) . ';" ';
                             $row .= 'width="' .
round(99/count($this->days[$j]->_currentCalendars)) . '%" ';
                             $row .= 'valign="top">';

==============================
Index: horde/kronolith/templates/category_legend.inc
==============================
--- category_legend.inc.bak     2004-09-16 16:01:22.000000000 -0400
+++ category_legend.inc 2004-09-16 16:34:25.000000000 -0400
@@ -3,6 +3,7 @@
     $html = '<br />';
 
     $colors = $cManager->colors();
+    $fgcolors = $cManager->fgColors();
     ksort($eventCategories);
     foreach ($eventCategories as $category => $v) {
         if (empty($category)) {
@@ -10,7 +11,8 @@
         }
 
         $categoryColor = isset($colors[$category]) ? $colors[$category] :
$colors['_default_'];
-        $html .= ' <span class="legend-eventbox" style="background-color: '
. $categoryColor . '; ';
+        $fgColor       = isset($fgcolors[$category]) ? $fgcolors[$category]
: $fgcolors['_default_'];
+        $html .= ' <span class="legend-eventbox" style="color: ' . $fgColor
. '; background-color: ' . $categoryColor . '; ';
         $html .= 'border-color: ' . Kronolith::borderColor($categoryColor)
. '"><span class="event">' . Text::htmlAllSpaces($category) .
'</span></span>';
     }

====================================
Index: horde/kronolith/lib/Block/monthlist.php
====================================

--- monthlist.php.bak   2004-09-16 16:04:41.000000000 -0400
+++ monthlist.php       2004-09-16 16:08:41.000000000 -0400
@@ -65,6 +65,7 @@
         $today = date('j');
         $current_month = '';
         $colors = $cManager->colors();
+        $fgcolors = $cManager->fgColors();
 
         /* Get timestamps. */
         $startDate = mktime(0, 0, 0, date('n'), 1);
@@ -178,8 +179,9 @@
                 }
 
                 $categoryColor = isset($colors[$event->getCategory()]) ?
$colors[$event->getCategory()] : $colors['_default_'];
+                $fgColor       = isset($fgcolors[$event->getCategory()]) ?
$fgcolors[$event->getCategory()] : $fgcolors['_default_'];
                 $htmlday .= '</td><td
class="text">&nbsp;&nbsp;&nbsp;</td>';
-                $htmlday .= '<td class="block-eventbox"
style="background-color: ' . $categoryColor . '; ';
+                $htmlday .= '<td class="block-eventbox" style="color: ' .
$fgColor . '; background-color: ' . $categoryColor . '; ';
                 $htmlday .= 'border-color: ' .
Kronolith::borderColor($categoryColor) . ';" ';
                 $htmlday .= 'valign="top">';

============================
Index: horde/kronolith/lib/Block/summary.php
============================
--- summary.php.bak     2004-09-16 16:04:53.000000000 -0400
+++ summary.php 2004-09-16 16:10:55.000000000 -0400
@@ -63,6 +63,7 @@
         $today = date('j');
         $cManager = &new Prefs_CategoryManager();
         $colors = $cManager->colors();
+        $fgcolors = $cManager->fgColors();
         $startDate = Kronolith::timestampToObject(mktime(0, 0, 0));
         $endDate = Kronolith::timestampToObject(mktime(0, 0, 0, date('n'),
$today + $prefs->getValue('summary_days')));
 
@@ -168,8 +169,9 @@
                 }
 
                 $categoryColor = isset($colors[$event->getCategory()]) ?
$colors[$event->getCategory()] : $colors['_default_'];
+                $fgColor       = isset($fgcolors[$event->getCategory()]) ?
$fgcolors[$event->getCategory()] : $fgcolors['_default_'];
                 $htmlday .= '</td><td
class="text">&nbsp;&nbsp;&nbsp;</td>';
-                $htmlday .= '<td class="block-eventbox"
style="background-color: ' . $categoryColor . '; ';
+                $htmlday .= '<td class="block-eventbox" style="color: ' .
$fgColor . '; background-color: ' . $categoryColor . '; ';
                 $htmlday .= 'border-color: ' .
Kronolith::borderColor($categoryColor) . ';" ';
                 $htmlday .= 'valign="top">';

===================================
Index: horde/kronolith/lib/Block/prevmonthlist.php
===================================
--- prevmonthlist.php.bak       2004-09-16 16:05:09.000000000 -0400
+++ prevmonthlist.php   2004-09-16 16:12:42.000000000 -0400
@@ -61,6 +61,7 @@
         $today = date('j');
         $current_month = '';
         $colors = $cManager->colors();
+        $fgcolors = $cManager->fgColors();
 
         /* Get timestamps. */
         $startDate = mktime(0, 0, 0, date('n') - 2, 1);
@@ -170,8 +171,9 @@
                 }
 
                 $categoryColor = isset($colors[$event->getCategory()]) ?
$colors[$event->getCategory()] : $colors['_default_'];
+                $fgColor       = isset($fgcolors[$event->getCategory()]) ?
$fgcolors[$event->getCategory()] : $fgcolors['_default_'];
                 $htmlday .= '</td><td
class="text">&nbsp;&nbsp;&nbsp;</td>';
-                $htmlday .= '<td class="block-eventbox"
style="background-color: ' . $categoryColor . '; ';
+                $htmlday .= '<td class="block-eventbox" style="color: ' .
$fgColor . '; background-color: ' . $categoryColor . '; ';
                 $htmlday .= 'border-color: ' .
Kronolith::borderColor($categoryColor) . ';" ';
                 $htmlday .= 'valign="top">';






More information about the bugs mailing list