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

Chris Stromsoe cbs at cts.ucla.edu
Fri Dec 8 08:04:14 PST 2006


On Fri, 8 Dec 2006, Chris Stromsoe wrote:

> 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.

A better (and actually functional) diff against FBView.php is attached.



-Chris
-------------- next part --------------
--- ../../horde-3.1.3/kronolith/lib/FBView.php	2006-11-29 03:23:36.000000000 -0800
+++ lib/FBView.php	2006-12-08 02:31:06.000000000 -0800
@@ -234,10 +241,32 @@ class Kronolith_FreeBusy_View {
                 continue;
             }
 
-            while ($end > $periodEnd &&
+// correct? need to figure out how to deal with this so that it does all the elements
+            while ($start > $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 : $periodEnd;
+
+                $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