[kronolith] partial hour appointments don't show up as a busy hour in freebusy

Chris Stromsoe cbs at cts.ucla.edu
Fri Dec 8 02:26:24 PST 2006


On Thu, 7 Dec 2006, Chuck Hagenbuch wrote:
> Quoting Chris Stromsoe <cbs at cts.ucla.edu>:
>
>> If I make an appointment that lasts from XX:00 to XX:50, the hour shows 
>> up as free in my freebusy, when really it should show up as busy. 
>> This is with Kronolith 2.1.4.  Is this a bug or intentional behavior 
>> (since there is 10 minutes of time "free" in the hour)?
>
> I'm actually not sure what the correct solution here is, but by 
> instinct, I think anything >= half an hour should mark the hour as busy 
> if the resolution is an hour.

What about using a div inside the table td with position:relative, using 
left and width as a percentage of 100 to control how much of the hour is 
covered?

I have a rough partially functional implementation of the above against 
stable kronolith.  Work in progress is attached.  Line numbers are 
probably off by 4 or 5 for libFBView.php.



-Chris
-------------- next part --------------
diff -rpu ../../horde-3.1.3/kronolith/templates/fbview/busyblock.tpl ./templates/fbview/busyblock.tpl
--- ../../horde-3.1.3/kronolith/templates/fbview/busyblock.tpl	2005-10-18 05:27:43.000000000 -0700
+++ ./templates/fbview/busyblock.tpl	2006-12-08 02:01:35.000000000 -0800
@@ -1 +1 @@
-<td class="busy">&nbsp;</td>
+<td><div class="busy" style="left:<tag:left />;width:<tag:width />;">&nbsp;</div></td>
diff -rpu ../../horde-3.1.3/kronolith/templates/fbview/meetingblock.tpl ./templates/fbview/meetingblock.tpl
--- ../../horde-3.1.3/kronolith/templates/fbview/meetingblock.tpl	2005-10-18 05:27:43.000000000 -0700
+++ ./templates/fbview/meetingblock.tpl	2006-12-08 02:00:55.000000000 -0800
@@ -1 +1 @@
-<td class="free">&nbsp;</td>
+<td><div class="free" style="left:<tag:left />;width:<tag:width />;">&nbsp;</div></td>
diff -rpu ../../horde-3.1.3/kronolith/themes/screen.css ./themes/screen.css
--- ../../horde-3.1.3/kronolith/themes/screen.css	2005-12-17 09:09:01.000000000 -0800
+++ ./themes/screen.css	2006-12-08 02:01:14.000000000 -0800
@@ -162,12 +162,14 @@ a.newEvent img {
 
 /* Free/busy grid. */
 .busy {
+    position:relative;
     background: #f00;
 }
 .unknown {
     background: #d4d0c8 url("graphics/unknown-background.png") repeat top left;
 }
 .free {
+    position:relative;
     background: #28b22b;
     color: #fff;
 }
@@ -175,6 +177,7 @@ a.newEvent img {
 div.fbgrid {
     background-color: #fff;
     overflow: auto;
+    padding:0 1ex 0 1ex;
 }
 .fbgrid table {
     width: 100%;
diff -rup ../../horde-3.1.3/kronolith/lib/FBView.php lib/FBView.php
--- ../../horde-3.1.3/kronolith/lib/FBView.php	2006-11-29 03:23:36.000000000 -0800
+++ lib/FBView.php	2006-12-08 02:21:49.000000000 -0800
@@ -234,10 +241,32 @@ class Kronolith_FreeBusy_View {
                 continue;
             }
 
+/*
             while ($end > $periodEnd &&
                    list($periodStart, $periodEnd) = each($periods));
 
             if ($start <= $periodEnd && $end >= $periodStart) {
+*/
+
+            // start is the start of one grid block; end is the end of one grid block
+            // periodStart is the event start; periodEnd is the event end
+
+            if (($periodStart <= $start && $periodEnd >= $start) ||
+                ($periodStart <= $end && $periodEnd >= $end) ||
+                ($periodStart <= $start && $periodEnd >= $end) ||
+                ($periodStart >= $start && $periodEnd <= $end)) {
+
+                $plen = ($end - $start) / 100.0;
+
+                $l_start = ($periodStart < $start) ? $start : $periodStart;
+                $l_end = ($periodEnd > $end) ? $end : $period$end;
+
+                $left = ($l_start - $start) / $plen;
+                $width = ($l_end - $l_start) / $plen;
+ 
+                $template->set('left', $left . '%');
+                $template->set('width', $width . '%');
+
                 $blocks .= $template->fetch(KRONOLITH_TEMPLATES . '/fbview/' . $blockfile);
             } else {
                 $blocks .= $template->fetch(KRONOLITH_TEMPLATES . '/fbview/emptyblock.tpl');


More information about the kronolith mailing list