6.0.0-beta1
10/16/25

[#599] diff patch to enable automatic contrasting forground
Summary diff patch to enable automatic contrasting forground
Queue Kronolith
Queue Version HEAD
Type Enhancement
State Resolved
Priority 1. Low
Owners
Requester branche (at) subharmonics (dot) com
Created 09/16/2004 (7700 days ago)
Due
Updated 09/17/2004 (7699 days ago)
Assigned
Resolved 09/17/2004 (7699 days ago)
Milestone
Patch No

History
09/17/2004 04:30:16 PM Jan Schneider Comment #3
State ⇒ Resolved
Reply to this comment
Has been implemented in CVS already.
09/17/2004 04:04:48 PM branche (at) subharmonics (dot) com Comment #2
New Attachment: horde.diff.txt Download
Reply to this comment
Here is the latest revision that works for the legend, but doesn't 
work for menus.  My strategy has been to modify event->getLink() to 
accept an attributes array, which then passes that array to 
Horde::linkTooltip() and further on to Horde::link()which already has 
support for an attribute array. Once the code for month.php (which 
should really be named MonthView.php to be consistent with other view 
names) works then it will be simple to transplant it to wherever else 
its called.
09/16/2004 09:26:27 PM   New Attachment: kronolith.patch.txt Download
 
09/16/2004 09:24:31 PM branche (at) subharmonics (dot) com Comment #1
State ⇒ New
Priority ⇒ 1. Low
Type ⇒ Enhancement
Summary ⇒ diff patch to enable automatic contrasting forground
Queue ⇒ Kronolith
Reply to this comment
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">';




Saved Queries