[dev] Patch for Kronolith - exuberant timeslots

Richard Heggs richard.heggs at nottinghamcity.gov.uk
Thu Apr 1 08:09:36 PST 2004


Hi list,

/me peers around nervously, and wonders if the coast is clear to submit
his first Kronolith patch.

Oh what the hey... please be nice. :)

This is based on a suggestion from one of my users, who has to manage
the calendars of several others.  She finds it irritating when she is
scrolling across the screen, because the timeslots disappear off to the
left.  Of this irritation, 'exuberant timeslots' were born.  With the
attached patches, the user is able to display the timeslots between
each day.

The first patch includes the logic, the second is the diff against
prefs.php.dist.

Both patches are against the snapshot dated 2004-03-31.


--
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 --------------
Only in kronolith: invite.php
diff -ru -x config -x scripts 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-01 16:41:57.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,10 @@
                 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 +110,8 @@
         $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++) {
@@ -154,8 +159,16 @@
             for ($j = $this->startDay; $j <= $this->endDay; $j++) {
 
                 // add spacer between days
-                $row .= '<td width="1%" class="text">&nbsp;</td>';
-
+                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 config -x scripts 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>
-------------- next part --------------
--- 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)?")
+);
+


More information about the dev mailing list