[dev] Patch for Kronolith - exuberant timeslots

Richard Heggs richard.heggs at nottinghamcity.gov.uk
Fri Apr 2 00:45:32 PST 2004


Well, that went better than I had expected. :o)

Quoting Chuck Hagenbuch <chuck at horde.org>:

> 1. You don't really neet to submit two diffs - one file is easier to
> handle, as
> long as only one logical change is in it.

Check.

>
> 2. You need to adjust this to Horde CS (horde/docs/CODING_STANDARDS) 
> for it to
> be committed - mostly indentation and brace conventions, but you 
> should take a
> quick read through the rest, too.

Read, marked and inwardly digested.

Revised patch attached.


--
Richard Heggs
Systems Analyst
Nottingham City Council

----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.


######################################################################
This e-mail (and any attachments) is confidential and may contain personal
views which are not the views of Nottingham City Council unless specifically
stated. If you have received it in error, please delete it from your system,
do not use, copy or disclose the information in any way nor act in reliance
on it and notify the sender immediately. Please note that Nottingham City
Council monitors e-mails sent or received. Further communication will
signify your consent to this.
######################################################################
-------------- next part --------------
diff -ru -x scripts -x 'ncc*' kronolith.orig/config/prefs.php.dist kronolith/config/prefs.php.dist
--- kronolith.orig/config/prefs.php.dist	2004-03-17 03:36:19.000000000 +0000
+++ kronolith/config/prefs.php.dist	2004-04-01 16:48:58.000000000 +0100
@@ -285,3 +285,13 @@
     'type' => 'checkbox',
     'desc' => _("Show category legend?")
 );
+
+// display the timeslots between each day column, in week view
+$_prefs['time_between_days'] = array(
+    'value' => 0,
+    'locked' => false,
+    'shared' => false,
+    'type' => 'checkbox',
+    'desc' => _("Show time slots between each day (in week views)?")
+);
+
diff -ru -x scripts -x 'ncc*' kronolith.orig/lib/WeekView.php kronolith/lib/WeekView.php
--- kronolith.orig/lib/WeekView.php	2003-11-02 23:22:33.000000000 +0000
+++ kronolith/lib/WeekView.php	2004-04-02 09:42:07.000000000 +0100
@@ -76,6 +76,7 @@
     function html($template_path = KRONOLITH_TEMPLATES)
     {
         global $prefs, $print_view;
+        $more_timeslots     = $prefs->getValue('time_between_days');
         $include_all_events = !$prefs->getValue('show_shared_side_by_side');
 
         if (!$this->parsed) {
@@ -97,7 +98,11 @@
                 reset($this->days[$j]->_all_day_events[$cid]);
             }
         }
-        $addeventurl = '<span class="hour">' . _("All day") . '</span>';
+        if ($more_timeslots) {
+            $addeventurl = null;
+        } else {
+            $addeventurl = '<span class="hour">' . _("All day") . '</span>';
+        }
         $rowspan = ' rowspan="1"';
 
         $first_row = true;
@@ -106,7 +111,9 @@
         $colors = Kronolith::categoryColors();
 
         for ($j = $this->startDay; $j <= $this->endDay; $j++) {
-            $row .= '<td width="1%" class="text">&nbsp;</td>';
+            if ($more_timeslots) {
+                $row .= '<td class="hour"><b>' . _("All day") . '</b></td>';
+            }
             $row .= '<td colspan="' . $this->days[$j]->_totalspan . '" valign="top" style="padding:0px"><table border="0" width="100%" cellspacing="0" cellpadding="0">';
             if ($this->days[$j]->_all_day_maxrowspan > 0) {
                 for($k = 0; $k < $this->days[$j]->_all_day_maxrowspan; $k++) {
@@ -153,9 +160,18 @@
             $row = '';
             for ($j = $this->startDay; $j <= $this->endDay; $j++) {
 
-                // add spacer between days
-                $row .= '<td width="1%" class="text">&nbsp;</td>';
-
+                // add spacer between days, or timeslots
+                if ($more_timeslots) {
+                    if ($prefs->getValue('half')) {
+                        $row .= '<td rowspan=1 class="hour">' . $time . '</td>';
+                    } else {
+                        if ($i%2 == 0) {
+		            $row .= '<td rowspan=2 class="hour">' . $time . '</td>';
+                        }
+                    }
+                } else {
+                    $row .= '<td width="1%" class="text">&nbsp;</td>';
+                }
                 foreach ($this->_currentCalendars as $cid => $cal) {
                     $hspan = 0;
                     foreach ($this->days[$j]->_event_matrix[$cid][$i] as $key) {
diff -ru -x scripts -x 'ncc*' kronolith.orig/templates/day/row.inc kronolith/templates/day/row.inc
--- kronolith.orig/templates/day/row.inc	2003-12-10 00:54:31.000000000 +0000
+++ kronolith/templates/day/row.inc	2004-04-01 16:39:54.000000000 +0100
@@ -1,10 +1,12 @@
 <tr class="<?php echo $style ?>">
   <td width="1%" class="<?php echo $style ?>" <?php if ($rowspan) echo 'rowspan="2" '; ?>align="right">
   
-    <?php if (Auth::getAuth()) : ?>
-    <?php echo isset($addeventurl) ? $addeventurl : '<span class="hour">' ?><?php echo $time ?><?php echo isset($addeventurl) ? '</a>' : '</span>' ?>
-    <?php else : ?>
-    <span class="hour"><?php echo $time ?></span>
+    <?php if (!$more_timeslots) : ?>
+      <?php if (Auth::getAuth()) : ?>
+      <?php echo isset($addeventurl) ? $addeventurl : '<span class="hour">' ?><?php echo $time ?><?php echo isset($addeventurl) ? '</a>' : '</span>' ?>
+      <?php else : ?>
+      <span class="hour"><?php echo $time ?></span>
+      <?php endif; ?>
     <?php endif; ?>
   </td>
   <td width="1%" class="<?php echo $style ?>"><?php echo Horde::img('clear.gif', '', 'width="5" height="10"'); ?></td>


More information about the dev mailing list