Revision: 1047
          http://mrbs.svn.sourceforge.net/mrbs/?rev=1047&view=rev
Author:   cimorrison
Date:     2009-03-13 19:44:08 +0000 (Fri, 13 Mar 2009)

Log Message:
-----------
Fixed the display in the day and week views so that if there are timeslots that 
have more than one booking then the table is still displayed properly.    
Although normally it is not possible to have more than one booking in a 
timeslot, it can occur if (a) the resolution is increased, (b) the display day 
is shifted, or (c) bookings were made before Revision 1040 and the booking was 
not aligned to a timeslot.

Cells with more than one booking are now displayed as a mini table that can be 
maximised to see the details of the bookings.

Revision Links:
--------------
    http://mrbs.svn.sourceforge.net/mrbs/?rev=1040&view=rev

Modified Paths:
--------------
    mrbs/trunk/web/Themes/classic126.inc
    mrbs/trunk/web/Themes/default.inc
    mrbs/trunk/web/day.php
    mrbs/trunk/web/functions.inc
    mrbs/trunk/web/mrbs-ielte6.css
    mrbs/trunk/web/mrbs.css.php
    mrbs/trunk/web/style.inc
    mrbs/trunk/web/week.php

Added Paths:
-----------
    mrbs/trunk/web/mrbs-js-overrides.css.php
    mrbs/trunk/web/mrbs-js-overrides.js

Modified: mrbs/trunk/web/Themes/classic126.inc
===================================================================
--- mrbs/trunk/web/Themes/classic126.inc        2009-03-11 17:08:44 UTC (rev 
1046)
+++ mrbs/trunk/web/Themes/classic126.inc        2009-03-13 19:44:08 UTC (rev 
1047)
@@ -68,8 +68,11 @@
                                                     // NOTE: this colour is 
also used in xbLib.js (in more than one place)and 
                                                     // if you change it here 
you will also need to change it there.
 
-$help_highlight_color           = "#ffe6f0";        // highlighting text on 
the help page #ffffbb
+$help_highlight_color           = "#ffe6f0";        // highlighting text on 
the help page
 
+$multiple_control_color         = "#ffff44";        // background colour for 
the multiple booking controls
+
+
 // These are the colours used for distinguishing between the dfferent types of 
bookings in the main
 // displays in the day, week and month views
 $color_types = array(
@@ -89,7 +92,8 @@
 $banner_border_width          = '1';  // (px)  border width for the outside of 
the banner
 $banner_border_cell_width     = '1';  // (px)  border width for the cells of 
the banner
 $main_table_border_width      = '1';  // (px)  the border width for the 
outside of the main day/week/month tables
-$main_table_cell_border_width = '1';  // (px)  the border width for the cells 
of the main day/week/month tables    
+$main_table_cell_border_width = '1';  // (px)  the border width for the cells 
of the main day/week/month tables
+$main_cell_height             = '17'; // (px)  height of the cells in the main 
day/week tables
     
     
 // ***** FONTS ************************    

Modified: mrbs/trunk/web/Themes/default.inc
===================================================================
--- mrbs/trunk/web/Themes/default.inc   2009-03-11 17:08:44 UTC (rev 1046)
+++ mrbs/trunk/web/Themes/default.inc   2009-03-13 19:44:08 UTC (rev 1047)
@@ -68,8 +68,10 @@
                                                     // NOTE: this colour is 
also used in xbLib.js (in more than one place)and 
                                                     // if you change it here 
you will also need to change it there.
 
-$help_highlight_color           = "#ffe6f0";        // highlighting text on 
the help page #ffffbb
+$help_highlight_color           = "#ffe6f0";        // highlighting text on 
the help page
 
+$multiple_control_color         = "#ffff22";        // background colour for 
the multiple booking controls
+
 // These are the colours used for distinguishing between the dfferent types of 
bookings in the main
 // displays in the day, week and month views
 $color_types = array(
@@ -90,6 +92,7 @@
 $banner_border_cell_width     = '1';  // (px)  border width for the cells of 
the banner
 $main_table_border_width      = '0';  // (px)  border width for the outside of 
the main day/week/month tables    
 $main_table_cell_border_width = '1';  // (px)  border width for the cells of 
the main day/week/month tables
+$main_cell_height             = '17'; // (px)  height of the cells in the main 
day/week tables
          
     
 // ***** FONTS ************************    

Modified: mrbs/trunk/web/day.php
===================================================================
--- mrbs/trunk/web/day.php      2009-03-11 17:08:44 UTC (rev 1046)
+++ mrbs/trunk/web/day.php      2009-03-13 19:44:08 UTC (rev 1047)
@@ -7,6 +7,7 @@
 require_once "dbsys.inc";
 require_once "mrbs_auth.inc";
 require_once "mincals.inc";
+require_once "Themes/$theme.inc";
 
 // Get form variables
 $day = get_form_var('day', 'int');
@@ -177,13 +178,17 @@
    FROM $tbl_entry, $tbl_room
    WHERE $tbl_entry.room_id = $tbl_room.id
    AND area_id = $area
-   AND start_time <= $pm7 AND end_time > $am7";
-
+   AND start_time <= $pm7 AND end_time > $am7
+   ORDER BY start_time";   // necessary so that multiple bookings appear in 
the right order
+   
 $res = sql_query($sql);
 if (! $res)
 {
   fatal_error(0, sql_error());
 }
+
+$today = array();
+
 for ($i = 0; ($row = sql_row_keyed($res, $i)); $i++)
 {
   // Each row we've got here is an appointment.
@@ -194,51 +199,9 @@
   //  row['entry_id'] = id of this booking
   //  row['type'] = type (internal/external)
   //  row['entry_description'] = description
-
-  // $today is a map of the screen that will be displayed
-  // It looks like:
-  //     $today[Room ID][Time][id]
-  //                          [color]
-  //                          [data]
-  //                          [long_descr]
-  //                          [slots]
   
-  // slots records the duration of the booking in number of time slots.
-       // Used to calculate how high to make the block used for clipping
-       // overflow descriptions.
+  map_add_booking($row, $today[$row['room_id']][$day], $am7, $pm7, $format);
 
-  // Fill in the map for this meeting. Start at the meeting start time,
-  // or the day start time, whichever is later. End one slot before the
-  // meeting end time (since the next slot is for meetings which start then),
-  // or at the last slot in the day, whichever is earlier.
-  // Time is of the format HHMM without leading zeros.
-  //
-  // Note: int casts on database rows for max may be needed for PHP3.
-  // Adjust the starting and ending times so that bookings which don't
-  // start or end at a recognized time still appear.
-  $start_t = max(round_t_down($row['start_time'], $resolution, $am7), $am7);
-  $end_t = min(round_t_up($row['end_time'], $resolution, $am7) - $resolution, 
$pm7);
-  for ($t = $start_t; $t <= $end_t; $t += $resolution)
-  {
-    $today[$row['room_id']][date($format,$t)]["id"]    = $row['entry_id'];
-    $today[$row['room_id']][date($format,$t)]["color"] = $row['type'];
-    $today[$row['room_id']][date($format,$t)]["data"]  = "";
-    $today[$row['room_id']][date($format,$t)]["long_descr"]  = "";
-    $today[$row['room_id']][date($format,$t)]["slots"] = intval(($end_t - 
$start_t)/$resolution) + 1;
-  }
-
-  // Show the name of the booker in the first segment that the booking
-  // happens in, or at the start of the day if it started before today.
-  if ($row['start_time'] < $am7)
-  {
-    $today[$row['room_id']][date($format,$am7)]["data"] = $row['name'];
-    $today[$row['room_id']][date($format,$am7)]["long_descr"] = 
$row['entry_description'];
-  }
-  else
-  {
-    $today[$row['room_id']][date($format,$start_t)]["data"] = $row['name'];
-    $today[$row['room_id']][date($format,$start_t)]["long_descr"] = 
$row['entry_description'];
-  }
 }
 
 if ($debug_flag) 
@@ -384,14 +347,19 @@
   {
     // convert timestamps to HHMM format without leading zeros
     $time_t = date($format, $t);
+    // and get a stripped version for use with periods
+    $time_t_stripped = preg_replace( "/^0/", "", $time_t );
+    
+    // calculate hour and minute (needed for links)
+    $hour = date("H",$t);
+    $minute = date("i",$t);
 
     // Show the time linked to the URL for highlighting that time
     echo "<tr>";
     tdcell("times", 1);
     echo "<div class=\"celldiv1\">\n";
     if( $enable_periods )
-    {
-      $time_t_stripped = preg_replace( "/^0/", "", $time_t );
+    { 
       echo "<a href=\"$hilite_url=$time_t\"  title=\""
         . get_vocab("highlight_line") . "\">"
         . $periods[$time_t_stripped] . "</a>\n";
@@ -407,94 +375,15 @@
     // Loop through the list of rooms we have for this area
     while (list($key, $room_id) = each($rooms))
     {
-      if(isset($today[$room_id][$time_t]["id"]))
-      {
-        $id    = $today[$room_id][$time_t]["id"];
-        $color = $today[$room_id][$time_t]["color"];
-        $descr = htmlspecialchars($today[$room_id][$time_t]["data"]);
-        $long_descr = 
htmlspecialchars($today[$room_id][$time_t]["long_descr"]);
-        $slots = $today[$room_id][$time_t]["slots"];
-      }
-      else
-      {
-        unset($id);
-        $slots = 1;
-      }
-
-      // $c is the colour of the cell that the browser sees. Zebra stripes 
normally,
-      // row_highlight if we're highlighting that line and the appropriate 
colour if
-      // it is booked (determined by the type).
-      // We tell if its booked by $id having something in it
-      if (isset($id))
-      {
-        $c = $color;
-      }
-      else if (isset($timetohighlight) && ($time_t == $timetohighlight))
-      {
-        $c = "row_highlight";
-      }
-      else
-      {
-        $c = $row_class; // Use the default color class for the row.
-      }
-      
-      // Don't put in a <td> cell if the slot is booked and there's no 
description.
-      // This would mean that it's the second or subsequent slot of a booking 
and so the
-      // <td> for the first slot would have had a rowspan that extended the 
cell down for
-      // the number of slots of the booking.
-
-    if (!(isset($id) && ($descr == ""))) 
-      {
-        tdcell($c, $slots);
-  
-        // If the room isn't booked then allow it to be booked
-        if (!isset($id))
-        {
-          $hour = date("H",$t);
-          $minute  = date("i",$t);
-          echo "<div class=\"celldiv1\">\n";  // a bookable slot is only one 
unit high
-  
-          if ($javascript_cursor)
-          {
-            echo "<script type=\"text/javascript\">\n";
-            echo "//<![CDATA[\n";
-            echo "BeginActiveCell();\n";
-            echo "//]]>\n";
-            echo "</script>\n";
-          }
-          
-          if( $enable_periods )
-          {
-            echo "<a class=\"new_booking\" 
href=\"edit_entry.php?area=$area&amp;room=$room_id&amp;period=$time_t_stripped&amp;year=$year&amp;month=$month&amp;day=$day\">\n";
-            echo "<img src=\"new.gif\" alt=\"New\" width=\"10\" 
height=\"10\">\n";
-            echo "</a>\n";
-          }
-          else
-          {
-            echo "<a class=\"new_booking\" 
href=\"edit_entry.php?area=$area&amp;room=$room_id&amp;hour=$hour&amp;minute=$minute&amp;year=$year&amp;month=$month&amp;day=$day\">\n";
-            echo "<img src=\"new.gif\" alt=\"New\" width=\"10\" 
height=\"10\">\n";
-            echo "</a>\n";
-          }
-          
-          if ($javascript_cursor)
-          {
-            echo "<script type=\"text/javascript\">\n";
-            echo "//<![CDATA[\n";
-            echo "EndActiveCell();\n";
-            echo "//]]>\n";
-            echo "</script>\n";
-          }
-          echo "</div>\n";
-        }
-        else                 // if it is booked then show the booking
-        {    
-          echo "<div class=\"celldiv" . $slots . "\">\n";     // we want 
clipping of overflow
-          echo "  <a 
href=\"view_entry.php?id=$id&amp;area=$area&amp;day=$day&amp;month=$month&amp;year=$year\"
 title=\"$long_descr\">$descr</a>\n";
-          echo "</div>\n";
-        }
-        echo "</td>\n";
-      }
+      // set up the query strings to be used for the link in the cell
+      $query_strings = array();
+      $query_strings['new_periods'] = 
"area=$area&amp;room=$room_id&amp;period=$time_t_stripped&amp;year=$year&amp;month=$month&amp;day=$day";
+      $query_strings['new_times']   = 
"area=$area&amp;room=$room_id&amp;hour=$hour&amp;minute=$minute&amp;year=$year&amp;month=$month&amp;day=$day";
+      $query_strings['booking']     = 
"area=$area&amp;day=$day&amp;month=$month&amp;year=$year";
+      // and then draw the cell
+      draw_cell($today[$room_id][$day][$time_t], $query_strings, $row_class);
     }
+    
     // next lines to display times on right side
     if ( FALSE != $times_right_side )
     {
@@ -502,7 +391,6 @@
       echo "<div class=\"celldiv1\">\n";
       if ( $enable_periods )
       {
-        $time_t_stripped = preg_replace( "/^0/", "", $time_t );
         echo "<a href=\"$hilite_url=$time_t\"  title=\""
           . get_vocab("highlight_line") . "\">"
           . $periods[$time_t_stripped] . "</a>\n";

Modified: mrbs/trunk/web/functions.inc
===================================================================
--- mrbs/trunk/web/functions.inc        2009-03-11 17:08:44 UTC (rev 1046)
+++ mrbs/trunk/web/functions.inc        2009-03-13 19:44:08 UTC (rev 1047)
@@ -803,4 +803,401 @@
   global $hidden_days;
   return (isset($hidden_days) && in_array($dow, $hidden_days));
 }
+
+function map_add_booking ($row, &$column, $am7, $pm7, $format)
+{
+  // Enters the contents of the booking found in $row into $column, which is
+  // a column of the map of the bookings being prepared ready for display.
+  //
+  // $column    the column of the map that is being prepared (see below)
+  // $row       a booking from the database
+  // $am7       the start of the first slot of the booking day (Unix timestamp)
+  // $pm7       the start of the last slot of the booking day (Unix timestamp)
+  // $format    time format used for indexing the $map array
+  
+  // $row is expected to have the following field names, when present:
+  //       room_id
+  //       start_time
+  //       end_time
+  //       name
+  //       entry_id
+  //       type
+  //       entry_description
+  
+  // $column is a column of the map of the screen that will be displayed
+  // It looks like:
+  //     $column[Time][n][id]
+  //                     [color]
+  //                     [data]
+  //                     [long_descr]
+  //                     [start_time]
+  //                     [slots]
+  
+  // slots records the duration of the booking in number of time slots.
+       // Used to calculate how high to make the block used for clipping
+       // overflow descriptions.
+
+  // Fill in the map for this meeting. Start at the meeting start time,
+  // or the day start time, whichever is later. End one slot before the
+  // meeting end time (since the next slot is for meetings which start then),
+  // or at the last slot in the day, whichever is earlier.
+  // Time is of the format HHMM without leading zeros.
+  //
+  // [n] exists because it's possible that there may be multiple bookings
+  // in the same time slot.   Normally this won't be the case.   However it
+  // can arise legitimately if you increase the resolution, or shift the 
+  // displayed day.   For example if you previously had a resolution of 1800 
+  // seconds you might have a booking (A) for 1000-1130 and another (B) for 
1130-1230.
+  // If you then increase the resolution to 3600 seconds, these two bookings 
+  // will both occupy the 1100-1200 time slot.   [n] starts at 0.   For
+  // the example above the map for the room would look like this
+  //
+  //       0  1
+  // 1000  A
+  // 1100  A  B
+  // 1200  B
+  //
+  // Note: int casts on database rows for max may be needed for PHP3.
+  // Adjust the starting and ending times so that bookings which don't
+  // start or end at a recognized time still appear.
+  
+  global $resolution;
+  
+  $start_t = max(round_t_down($row['start_time'], $resolution, $am7), $am7);
+  $end_t = min(round_t_up($row['end_time'], $resolution, $am7) - $resolution, 
$pm7);
+  // calculate the times used for indexing
+  $time_start_t = date($format,$start_t);
+  $time_end_t = date($format,$end_t);
+  
+
+  for ($t = $start_t; $t <= $end_t; $t += $resolution)
+  { 
+    $time_t = date($format,$t);
+    
+    // find the first free index (in case there are multiple bookings in a 
timeslot)
+    $n = 0;
+    while (!empty($column[$time_t][$n]["id"]))
+    {
+      $n++;
+    }
+    
+    // fill in the id, type and start time
+    $column[$time_t][$n]["id"]    = $row['entry_id'];
+    $column[$time_t][$n]["color"] = $row['type'];
+    $column[$time_t][$n]["start_time"] = utf8_strftime(hour_min_format(), 
$row['start_time']);
+    // if it's a multiple booking also fill in the name and description
+    if ($n > 0)
+    {
+      $column[$time_t][$n]["data"]  = $row['name'];
+      $column[$time_t][$n]["long_descr"]  = $row['entry_description'];
+    }
+    // otherwise just leave them blank (we'll fill in the first whole slot 
later)
+    else
+    {
+      $column[$time_t][$n]["data"]  = "";
+      $column[$time_t][$n]["long_descr"]  = ""; 
+    }
+  } // end for
+  
+  
+  // Show the name of the booker, the description and the number of complete
+  // slots in the first complete slot that the booking happens in, or at the 
+  // start of the day if it started before today.
+
+  // Find the number of time slots that the booking occupies, and the index
+  // of the first slot that this booking has entirely to itself
+  $n_slots = intval(($end_t - $start_t)/$resolution) + 1;
+  $first_slot = $start_t;
+  
+  // If the last time slot is already occupied, we have a multiple
+  // booking in the last slot, so decrement the number of slots that
+  // we will display for this booking
+  if (isset($column[$time_end_t][1]["id"]))
+  {
+    $n_slots--;
+    // If we're only the second booking to land on this time slot
+    // then we'll have to adjust the information held for the first booking
+    // (unless it's just one slot long in the first place, when it 
+    // doesn't matter as it will now be part of a multiple booking).
+    // If we are the third booking or more, then it will have already
+    // been adjusted.
+    if (!isset($column[$time_end_t][2]["id"]))
+    {
+      if ($column[$time_end_t][0]["slots"] > 1)
+      {
+        // Move the name and description into the new first slot and decrement 
the number of slots
+        $column[date($format, $end_t + $resolution)][0]["data"] = 
$column[$time_end_t][0]["data"];
+        $column[date($format, $end_t + $resolution)][0]["long_descr"] = 
$column[$time_end_t][0]["long_descr"];
+        $column[date($format, $end_t + $resolution)][0]["slots"] = 
$column[$time_end_t][0]["slots"] - 1;
+      }
+    }
+  }
+  
+  // and if the first time slot is already occupied, decrement
+  // again, adjust the first slot for this booking
+  if (isset($column[$time_start_t][1]["id"]))
+  {
+    $n_slots--;
+    $first_slot += $resolution;
+    // If we're only the second booking to land on this time slot
+    // then we'll have to adjust the information held for the first booking
+    if (!isset($column[$time_start_t][2]["id"]))
+    {
+      // Find the first slot ($s) of the first booking, by going back through 
the slots
+      // until you get to a slot that has more than one booking, or else just
+      // one booking but a different one, or else no booking at all.    Then 
+      // you know you've gone back one slot too far.
+      $first_booking_id = $column[$time_start_t][0]["id"];
+      for ($s = $start_t -$resolution; $s >= $am7; $s -= $resolution)
+      {
+        if (isset($column[date($format,$s)][1]["id"]) || 
+            !isset($column[date($format,$s)][0]["id"]) ||
+            ($column[date($format,$s)][0]["id"] != $first_booking_id))   
+        {
+          $s += $resolution;  // Gone back one slot too far, so advance one.
+          break;
+        }
+      }
+      // and decrement the slot count for the first booking
+      $column[date($format,$s)][0]["slots"]--;
+      // and put the name and description in the multiply booked slot
+      $column[$time_start_t][0]["data"] = $column[date($format,$s)][0]["data"];
+      $column[$time_start_t][0]["long_descr"] = 
$column[date($format,$s)][0]["long_descr"];
+
+    }
+  }
+ 
+  // now we've got all the information we can enter it in the first complete
+  // slot for the booking (provided it's not a multiple booking slot)
+  if (!isset($column[date($format,$first_slot)][1]["id"]))
+  {
+    $column[date($format,$first_slot)][0]["data"] = $row['name'];
+    $column[date($format,$first_slot)][0]["long_descr"] = 
$row['entry_description'];
+    $column[date($format,$first_slot)][0]["slots"] = $n_slots;
+  }
+
+} // end function map_add_booking()
+
+
+
+function draw_cell($cell, $query_strings, $row_class)
+{
+  // draws a single cell in the main table of the day and week views
+  //
+  // $cell is a two dimensional array that is part of the map of the whole
+  // display and looks like this:
+  // 
+  // $cell[n][id]
+  //         [color]
+  //         [data]
+  //         [long_descr]
+  //         [start_time]
+  //         [slots]
+  //
+  // where n is the number of the booking in the cell.    There can be none, 
one or many 
+  // bookings in a cell.    If there are no bookings then a blank cell is 
drawn with a link
+  // to the edit entry form.     If there is one booking, then the booking is 
shown in that
+  // cell.    If there is more than one booking then all the bookings are 
shown, but they can 
+  // be shown in two different ways: minimised and maximised.   By default 
they are shown
+  // minimised, so that the standard row height is preserved.   By clicking a 
control
+  // the cell can be maximised.   (Multiple bookings can arise in a cell if 
the resolution
+  // of an existing database in increased or the booking day is shifted).
+  
+  // $query_strings is an array containg the query strings (or partial query 
strings) to be
+  // appended to the link used for the cell.    It is indexed as follows:
+  //    ['new_periods']   the string to be used for an empty cell if using 
periods
+  //    ['new_times']     the string to be used for an empty cell if using 
times
+  //    ['booking']       the string to be used for a full cell
+  //
+  // $row_class specifies whether the row is even or odd so that the zebra 
stripes can be drawn
+  
+  global $main_cell_height, $main_table_cell_border_width;
+  global $area, $year, $month, $timetohighlight;
+  global $javascript_cursor, $enable_periods;
+  
+  // if the time slot has got multiple bookings, then draw a mini-table
+  if(isset($cell[1]["id"]))
+  {
+    // Find out how many bookings there are (needed to calculate heights)
+    $n_bookings = 0;
+    while (isset($cell[$n_bookings]["id"]))
+    {
+      $n_bookings++;
+    }
+    
+    // Give the cell a unique id so that the JavaScript can use it
+    $td_id = uniqid('td', true);
+    
+    // Make the class maximized by default so that if you don't have 
JavaScript then
+    // you can still see all the bookings.    If you have JavaScript it will 
overwrite
+    // the class and make it minimized.
+    echo "<td class=\"multiple_booking maximized\" id=\"$td_id\">\n";
+    ?>
+    <script type="text/javascript">
+    //<![CDATA[
+      document.getElementById('<?php echo $td_id ?>').className = 
"multiple_booking minimized <?php echo $row_class ?>";
+    //]]>
+    </script>
+    <?php
+    
+    // First draw the mini table
+    echo "<div class=\"celldiv1 mini\">\n";
+    echo "<div class=\"multiple_control\" 
onClick=\"document.getElementById('$td_id').className = 'multiple_booking 
maximized $row_class'\">+</div>\n";
+    echo "<table>\n";
+    echo "<tbody>\n";
+    
+    $row_height = $main_cell_height - (($n_bookings-1) * 
$main_table_cell_border_width);   // subtract the borders (first row has no top 
border)
+    $row_height = $row_height/$n_bookings;  // split what's left between the 
bookings
+    $row_height = (int) ceil($row_height);  // round up, so that (a) there's 
no empty space at the bottom
+                                            // and (b) each stripe is at least 
1 unit high
+    for ($n=0; $n<$n_bookings; $n++)
+    {
+      $id    = $cell[$n]["id"];
+      $color = $cell[$n]["color"];
+      $descr = htmlspecialchars($cell[$n]["data"]);
+      $long_descr = htmlspecialchars($cell[$n]["long_descr"]);
+      echo "<tr>\n";
+      echo "<td class=\"$color\"" .
+           (($n==0) ? " style=\"border-top-width: 0\"" : "") .   // no border 
for first row
+           ">\n";
+      echo "<div style=\"overflow: hidden; " .
+           "height: " . $row_height . "px; " .
+           "max-height: " . $row_height . "px; " .
+           "min-height: " . $row_height . "px\">\n";
+      echo "&nbsp;\n";
+      echo "</div>\n";
+      echo "</td>\n";
+      echo "</tr>\n";
+    }
+    echo "</tbody>\n";
+    echo "</table>\n";
+    echo "</div>\n";
+    
+    // Now draw the maxi table
+    echo "<div class=\"maxi\">\n";
+    $total_height = $n_bookings * $main_cell_height;
+    $total_height += ($n_bookings - 1) * $main_table_cell_border_width;  // 
(first row has no top border)
+    echo "<div class=\"multiple_control\" " .
+         "onClick=\"document.getElementById('$td_id').className = 
'multiple_booking minimized $row_class'\" " .
+         "style =\"height: " . $total_height . "px; " .
+                  "min-height: " . $total_height . "px; " .
+                  "max-height: " . $total_height . "px; " .
+         "\">-</div>\n";  
+    echo "<table>\n";
+    echo "<tbody>\n";
+    for ($n=0; $n<$n_bookings; $n++)
+    {
+      $id    = $cell[$n]["id"];
+      $color = $cell[$n]["color"];
+      $descr = htmlspecialchars($cell[$n]["start_time"] . " " . 
$cell[$n]["data"]);
+      $long_descr = htmlspecialchars($cell[$n]["long_descr"]);
+      echo "<tr>\n";
+      echo "<td class=\"$color\"" .
+           (($n==0) ? " style=\"border-top-width: 0\"" : "") .   // no border 
for first row
+           ">\n";
+      echo "<div class=\"celldiv1\">\n";     // we want clipping of overflow
+      echo "  <a href=\"view_entry.php?id=$id&amp;". $query_strings['booking'] 
. "\" title=\"$long_descr\">$descr</a>\n";
+      echo "</div>\n";
+     
+      echo "</td>\n";
+      echo "</tr>\n";
+    }
+    echo "</tbody>\n";
+    echo "</table>\n";
+    echo "</div>\n";
+    
+    echo "</td>\n";
+  }  // end of if isset ( ...[1]..)
+  
+  // otherwise draw a cell, showing either the booking or a blank cell
+  else
+  {  
+    if(isset($cell[0]["id"]))
+    {       
+      $id    = $cell[0]["id"];
+      $color = $cell[0]["color"];
+      $descr = htmlspecialchars($cell[0]["data"]);
+      $long_descr = htmlspecialchars($cell[0]["long_descr"]);
+      $slots = $cell[0]["slots"];
+    }
+    else  // id not set
+    {
+      unset($id);
+      $slots = 1;
+    }
+
+    // $c is the colour of the cell that the browser sees. Zebra stripes 
normally,
+    // row_highlight if we're highlighting that line and the appropriate 
colour if
+    // it is booked (determined by the type).
+    // We tell if its booked by $id having something in it
+    if (isset($id))
+    {
+      $c = $color;
+    }
+    else if (isset($timetohighlight) && ($time_t == $timetohighlight))
+    {
+      $c = "row_highlight";
+    }
+    else
+    {
+      $c = $row_class; // Use the default color class for the row.
+    }
+    
+    // Don't put in a <td> cell if the slot is booked and there's no 
description.
+    // This would mean that it's the second or subsequent slot of a booking 
and so the
+    // <td> for the first slot would have had a rowspan that extended the cell 
down for
+    // the number of slots of the booking.
+
+    if (!(isset($id) && ($descr == ""))) 
+    {
+      tdcell($c, $slots);
+
+      // If the room isn't booked then allow it to be booked
+      if (!isset($id))
+      {
+        echo "<div class=\"celldiv1\">\n";  // a bookable slot is only one 
unit high
+
+        if ($javascript_cursor)
+        {
+          echo "<script type=\"text/javascript\">\n";
+          echo "//<![CDATA[\n";
+          echo "BeginActiveCell();\n";
+          echo "//]]>\n";
+          echo "</script>\n";
+        }
+        
+        if( $enable_periods )
+        {
+          echo "<a class=\"new_booking\" href=\"edit_entry.php?" . 
$query_strings['new_periods'] . "\">\n";
+          echo "<img src=\"new.gif\" alt=\"New\" width=\"10\" 
height=\"10\">\n";
+          echo "</a>\n";
+        }
+        else
+        {
+          echo "<a class=\"new_booking\" href=\"edit_entry.php?" . 
$query_strings['new_times'] . "\">\n";
+          echo "<img src=\"new.gif\" alt=\"New\" width=\"10\" 
height=\"10\">\n";
+          echo "</a>\n";
+        }
+        
+        if ($javascript_cursor)
+        {
+          echo "<script type=\"text/javascript\">\n";
+          echo "//<![CDATA[\n";
+          echo "EndActiveCell();\n";
+          echo "//]]>\n";
+          echo "</script>\n";
+        }
+        echo "</div>\n";
+      }
+      else                 // if it is booked then show the booking
+      {    
+        echo "<div class=\"celldiv" . $slots . "\">\n";     // we want 
clipping of overflow
+        echo "  <a href=\"view_entry.php?id=$id&amp;". 
$query_strings['booking'] . "\" title=\"$long_descr\">$descr</a>\n";
+        echo "</div>\n";
+      }
+      echo "</td>\n";
+    }
+  }
+}  // end function draw_cell
+
 ?>

Modified: mrbs/trunk/web/mrbs-ielte6.css
===================================================================
--- mrbs/trunk/web/mrbs-ielte6.css      2009-03-11 17:08:44 UTC (rev 1046)
+++ mrbs/trunk/web/mrbs-ielte6.css      2009-03-13 19:44:08 UTC (rev 1047)
@@ -14,6 +14,14 @@
                                              /* also change the value of 
min-height in mrbs.css.php */
 div.booking_list {overflow: visible}         /* scrollbars don't work properly 
in IE6, so forget them and just let the cell expand*/
 
+/* We don't want the controls for multiple bookings for IE6, because they rely 
on div:hover working   */
+/* which is not supported by IE6.   So reverse the JavaScript overrides and 
just treat IE6 as though  */
+/* JavaScript was disabled.                                                    
                       */
+div.multiple_control {display: none}
+.multiple_booking .maxi a {padding-left: 2px}
+.minimized div.mini {display: none}   /* Ignore the minimized class and always 
display the maxi table */
+.minimized div.maxi {display: block}
+
 /* ------------ EDIT_AREA_ROOM.PHP ------------------*/
 .form_edit_area_room label {height: 2.0em}   /* min-height not recognised by 
IE6 and below */
 

Added: mrbs/trunk/web/mrbs-js-overrides.css.php
===================================================================
--- mrbs/trunk/web/mrbs-js-overrides.css.php                            (rev 0)
+++ mrbs/trunk/web/mrbs-js-overrides.css.php    2009-03-13 19:44:08 UTC (rev 
1047)
@@ -0,0 +1,20 @@
+<?php 
+require_once "config.inc.php";
+require_once "Themes/$theme.inc";
+header("Content-type: text/css"); 
+
+// $Id$
+
+// Only used if JavaScript is enabled
+
+?>
+
+<?php
+// Over-rides for multiple bookings.  If JavaScript is enabled then we want to 
see the JavaScript controls.
+// And we will need to extend the padding so that the controls don't overwrite 
the booking text
+?>
+
+div.multiple_control {
+    display: block;   /* if JavaScript is enabled then we want to see the 
JavaScript controls */
+  }
+.multiple_booking .maxi a {padding-left: <?php echo $main_cell_height + 
$main_table_cell_border_width + 2 ?>px}


Property changes on: mrbs/trunk/web/mrbs-js-overrides.css.php
___________________________________________________________________
Added: svn:keywords
   + Id
Added: svn:eol-style
   + native

Added: mrbs/trunk/web/mrbs-js-overrides.js
===================================================================
--- mrbs/trunk/web/mrbs-js-overrides.js                         (rev 0)
+++ mrbs/trunk/web/mrbs-js-overrides.js 2009-03-13 19:44:08 UTC (rev 1047)
@@ -0,0 +1,10 @@
+/* $Id$  */
+
+/* Creates a link to a JavaScript over-ride stylesheet */
+
+var cssNode = document.createElement('link');
+cssNode.setAttribute('rel', 'stylesheet');
+cssNode.setAttribute('type', 'text/css');
+cssNode.setAttribute('href', 'mrbs-js-overrides.css.php');
+document.getElementsByTagName('head')[0].appendChild(cssNode);
+


Property changes on: mrbs/trunk/web/mrbs-js-overrides.js
___________________________________________________________________
Added: svn:mime-type
   + text/x-js
Added: svn:keywords
   + Id
Added: svn:eol-style
   + native

Modified: mrbs/trunk/web/mrbs.css.php
===================================================================
--- mrbs/trunk/web/mrbs.css.php 2009-03-11 17:08:44 UTC (rev 1046)
+++ mrbs/trunk/web/mrbs.css.php 2009-03-13 19:44:08 UTC (rev 1047)
@@ -4,7 +4,7 @@
 
 header("Content-type: text/css"); 
 require_once "config.inc.php";
-include "Themes/$theme.inc";
+require_once "Themes/$theme.inc";
 
 
 // ***** SETTINGS ***********************
@@ -164,17 +164,17 @@
     border-bottom: 0;
     border-right: 0}
 .dwm_main td:first-child {border-left: 0}
-.dwm_main th {font-size: small; font-weight: normal; vertical-align: top; 
padding: 0 2px 0 2px;
+.dwm_main th {font-size: small; font-weight: normal; vertical-align: top; 
padding: 0 2px;
     color: <?php echo $header_font_color ?>; 
     background-color: <?php echo $header_back_color ?>;
     border-left: <?php echo $main_table_cell_border_width ?>px solid <?php 
echo $main_table_header_border_color ?>}
 .dwm_main th:first-child {border-left: 0}
 .dwm_main a {display: block; height: 100%}
+.dwm_main tbody a {padding: 0 2px}
 .dwm_main th a:link    {color: <?php echo $anchor_link_color_header ?>;    
text-decoration: none; font-weight: normal}
 .dwm_main th a:visited {color: <?php echo $anchor_visited_color_header ?>; 
text-decoration: none; font-weight: normal}
 .dwm_main th a:hover   {color: <?php echo $anchor_hover_color_header ?>;   
text-decoration:underline; font-weight: normal}
 .dwm_main#day_main th.first_last {width: <?php echo $column_times_width ?>%}
-.dwm_main#day_main td, .dwm_main#week_main td {padding: 0 2px 0 2px}
 .dwm_main#week_main th {width: <?php echo $column_week ?>%}
 .dwm_main#week_main th.first_last {width: <?php echo $column_times_width ?>%; 
vertical-align: bottom}
 .dwm_main#month_main th {width: <?php echo $column_month ?>%}
@@ -327,12 +327,6 @@
 (2) NOT CLIPPED
 The cells expand to fit the content.
 
-The cell height can be specified in pixels or ems.    Specifying it in pixels 
has the advantage that we 
-are able to calculate the true height of merged cells and make them clickable 
for the entire height.  If
-the units are in ems, we cannot calculate this and there will be an area at 
the bottom that is not clickable -
-the effect will be most noticeable on long bookings.   However specifying 
pixels may cause zooming problems
-on older browsers.
-
 (Although the style information could be put in an inline style declaration, 
this would mean that every
 cell in the display would carry the extra size of the style declaration, 
whereas the classes here mean
 that we only need the style declaration for each row.) 
@@ -348,8 +342,6 @@
 
 */
 
-$main_cell_height = '17';        // Units specified below
-$main_cell_height_units = 'px';  // Set to "em" or "px" as desired
 $clipped = TRUE;                 // Set to TRUE for clipping, FALSE if not   
 
 if ($clipped)
@@ -368,36 +360,47 @@
   for ($i=1; $i<=$n_slots; $i++) 
   {
     $div_height = $main_cell_height * $i;
+    $div_height = $div_height + (($i-1)*$main_table_cell_border_width);
+    $div_height = (int) $div_height;    // Make absolutely sure it's an int to 
avoid generating invalid CSS
     
-    // need to add the height of the inter-cell borders to the height of the 
div, but
-    // we can only do this if the cell height is specified in pixels otherwise 
we end
-    // up with a mixture of ems and pixels
-    if ('px' == $main_cell_height_units)
-    {
-      $div_height = $div_height + (($i-1)*$main_table_cell_border_width);
-      $div_height = (int) $div_height;    // Make absolutely sure it's an int 
to avoid generating invalid CSS
-    }
-    
-    // need to make sure the height is formatted with a '.' as the decimal 
point,
-    // otherwise in some locales you will get invalid CSS (eg 1,1em will not 
work as CSS).
-    // This step isn't necessary if the cell height is in pixels and
-    // therefore guaranteed to be an integer.
-    else
-    {
-      $div_height = number_format($div_height, 2, '.', '');
-    }
-    
     echo "div.celldiv" . $i . " {" . 
       "display: block; overflow: hidden; margin: 0; padding: 0; " . 
-       "height:"      . $div_height . $main_cell_height_units . "; " . 
-       "max-height: " . $div_height . $main_cell_height_units . "; " . 
-       "min-height: " . $div_height . $main_cell_height_units . ";}\n";
+       "height:"      . $div_height . "px; " . 
+       "max-height: " . $div_height . "px; " . 
+       "min-height: " . $div_height . "px;}\n";
   }
 }
+
+
+
+// Multiple bookings.  These rules control the styling of the cells and 
controls when there is more than
+// one booking in a time slot.
 ?>
+div.mini, div.maxi {position: relative}     /* establish a relative position 
for the absolute position to follow */
+div.multiple_control {
+    display: none;       /* will be over-ridden by JavaScript if enabled */
+    position: absolute; z-index: 20;
+    width: <?php echo $main_cell_height ?>px;
+    text-align: center;
+    padding: 0;
+    border-right: <?php echo $main_table_cell_border_width . "px solid " . 
$main_table_body_v_border_color ?>;
+    background-color: <?php echo $multiple_control_color ?>}
+.mini div.multiple_control {                /* heights for maxi are set using 
in-line styles */
+    height: <?php echo $main_cell_height ?>px;
+    max-height: <?php echo $main_cell_height ?>px;
+    min-height: <?php echo $main_cell_height ?>px}
+div:hover.multiple_control {cursor: pointer}
+.multiple_booking table {height: 100%; width: 100%; border-spacing: 0; 
border-collapse: collapse}
+.multiple_booking td {border-left: 0}
 
+/* used for toggling multiple bookings from mini to maxi size */
+.maximized div.mini {display: none}
+.maximized div.maxi {display: block}
+.minimized div.mini {display: block}
+.minimized div.maxi {display: none}
 
 
+
 /* ------------ DEL.PHP -----------------------------*/
 div#del_room_confirm {padding-bottom: 3em}
 #del_room_confirm p {text-align: center; font-size: large; font-weight: bold}

Modified: mrbs/trunk/web/style.inc
===================================================================
--- mrbs/trunk/web/style.inc    2009-03-11 17:08:44 UTC (rev 1046)
+++ mrbs/trunk/web/style.inc    2009-03-13 19:44:08 UTC (rev 1047)
@@ -13,6 +13,11 @@
 ?>
     <link rel="stylesheet" href="mrbs.css.php" type="text/css">
     <link rel="stylesheet" media="print" href="mrbs-print.css.php" 
type="text/css">
+    <?php
+    // JavaScript overrides first, followed by the IE overrides.   This allows
+    // the IE overrides to override the JavaScript overrides.
+    ?>
+    <script src="mrbs-js-overrides.js" type="text/javascript"></script>
     <!--[if IE]>
     <link rel="stylesheet" href="mrbs-ie.css" type="text/css">
     <![endif]-->
@@ -25,6 +30,7 @@
     <!--[if lte IE 6]>
     <link rel="stylesheet" href="mrbs-ielte6.css" type="text/css">
     <![endif]-->
+
     <meta http-equiv="Content-Type" content="text/html; charset=<?php
 
 if ($unicode_encoding)

Modified: mrbs/trunk/web/week.php
===================================================================
--- mrbs/trunk/web/week.php     2009-03-11 17:08:44 UTC (rev 1046)
+++ mrbs/trunk/web/week.php     2009-03-13 19:44:08 UTC (rev 1047)
@@ -9,6 +9,7 @@
 require_once "dbsys.inc";
 require_once "mrbs_auth.inc";
 require_once "mincals.inc";
+require_once "Themes/$theme.inc";
 
 // Get form variables
 $debug_flag = get_form_var('debug_flag', 'int');
@@ -247,15 +248,19 @@
 // row['id'] = Entry ID
 // row['description'] = Complete description
 // This data will be retrieved day-by-day
+
+$week_map = array();
+
 for ($j = 0; $j<=($num_of_days-1) ; $j++)
 {
-  $sql = "SELECT start_time, end_time, type, name, id, description
+  $sql = "SELECT start_time, end_time, type, name, id AS entry_id, description 
AS entry_description
           FROM $tbl_entry
           WHERE room_id = $room
-          AND start_time <= $pm7[$j] AND end_time > $am7[$j]";
+          AND start_time <= $pm7[$j] AND end_time > $am7[$j]
+          ORDER BY start_time";   // necessary so that multiple bookings 
appear in the right order
 
   // Each row returned from the query is a meeting. Build an array of the
-  // form:  d[weekday][slot][x], where x = id, color, data, long_desc.
+  // form:  $week_map[room][weekday][slot][x], where x = id, color, data, 
long_desc.
   // [slot] is based at 000 (HHMM) for midnight, but only slots within
   // the hours of interest (morningstarts : eveningends) are filled in.
   // [id], [data] and [long_desc] are only filled in when the meeting
@@ -267,6 +272,7 @@
   {
     echo "<p>DEBUG: query=$sql</p>\n";
   }
+  
   $res = sql_query($sql);
   if (! $res)
   {
@@ -280,95 +286,12 @@
       {
         echo "<p>DEBUG: result $i, id ".$row['id'].", starts 
".$row['start_time'],", ends ".$row['end_time']."</p>\n";
       }
-
-      // $d is a map of the screen that will be displayed
-      // It looks like:
-      //     $d[Day][Time][id]
-      //                  [color]
-      //                  [data]
-      //                  [slots]
-      // where Day is in the range 0 to $num_of_days.
-       
-      // slots records the duration of the booking in number of slots.
-      // Used to calculate how high to make the block used for clipping
-      // overflow descriptions.
-      
-      // Fill in the map for this meeting. Start at the meeting start time,
-      // or the day start time, whichever is later. End one slot before the
-      // meeting end time (since the next slot is for meetings which start 
then),
-      // or at the last slot in the day, whichever is earlier.
-      // Note: int casts on database rows for max may be needed for PHP3.
-      // Adjust the starting and ending times so that bookings which don't
-      // start or end at a recognized time still appear.
- 
-      $start_t = max(round_t_down($row['start_time'],
-                                  $resolution, $am7[$j]), $am7[$j]);
-      $end_t = min(round_t_up($row['end_time'],
-                              $resolution, $am7[$j]) - $resolution, $pm7[$j]);
-
-      for ($t = $start_t; $t <= $end_t; $t += $resolution)
-      {
-        $d[$j][date($format,$t)]["id"]    = $row['id'];
-        $d[$j][date($format,$t)]["color"] = $row['type'];
-        $d[$j][date($format,$t)]["data"]  = "";
-        $d[$j][date($format,$t)]["long_descr"]  = "";
-        $d[$j][date($format,$t)]["slots"] = intval(($end_t - 
$start_t)/$resolution) + 1; 
-      }
- 
-      // Show the name of the booker in the first segment that the booking
-      // happens in, or at the start of the day if it started before today.
-      if ($row['end_time'] < $am7[$j])
-      {
-        $d[$j][date($format,$am7[$j])]["data"] = $row['name'];
-        $d[$j][date($format,$am7[$j])]["long_descr"] = $row['description'];
-      }
-      else
-      {
-        $d[$j][date($format,$start_t)]["data"] = $row['name'];
-        $d[$j][date($format,$start_t)]["long_descr"] = $row['description'];
-      }
+      map_add_booking($row, $week_map[$room][$j], $am7[$j], $pm7[$j], $format);
     }
   }
 } 
 
-if ($debug_flag) 
-{
-  echo "<p>DEBUG:<pre>\n";
-  echo "\$dst_change = ";
-  print_r( $dst_change );
-  print "\n";
-  print "\$am7 =\n";
-  foreach ( $am7 as $am7_val)
-  {
-    print "$am7_val - " . date("r", $am7_val) . "\n";
-  }
-  print "\$pm7 =\n";
-  foreach( $pm7 as $pm7_val)
-  {
-    print "$pm7_val - " . date("r", $pm7_val) . "\n";
-  }
-  echo "</pre></p>\n";
 
-  echo "<p><pre>\$d =\n";
-  if (gettype($d) == "array")
-  {
-    while (list($w_k, $w_v) = each($d))
-    {
-      while (list($t_k, $t_v) = each($w_v))
-      {
-        while (list($k_k, $k_v) = each($t_v))
-        {
-          echo "d[$w_k][$t_k][$k_k] = '$k_v'\n";
-        }
-      }
-    }
-  }
-  else
-  {
-    echo "d is not an array!\n";
-  }
-  echo "</pre><p>\n";
-}
 
 // Include the active cell content management routines. 
 // Must be included before the beginnning of the main table.
@@ -455,13 +378,19 @@
 {
   // use hour:minute format
   $time_t = date($format, $t);
+  // and get a stripped version for use with periods
+  $time_t_stripped = preg_replace( "/^0/", "", $time_t );
+  
+  // calculate hour and minute (needed for links)
+  $hour = date("H",$t);
+  $minute  = date("i",$t);
+  
   // Show the time linked to the URL for highlighting that time:
   echo "<tr>";
   tdcell("times", 1);
   echo "<div class=\"celldiv1\">\n";
   if ( $enable_periods )
   {
-    $time_t_stripped = preg_replace( "/^0/", "", $time_t );
     echo "<a href=\"$hilite_url=$time_t\"  title=\""
       . get_vocab("highlight_line") . "\">"
       . $periods[$time_t_stripped] . "</a>";
@@ -485,109 +414,21 @@
     }
     else
     {
-      // Three cases:
-      // color:  id:   Slot is:   Color:                  Link to:
-      // -----   ----- --------   ---------               
-----------------------
-      // unset   -     empty      zebra or row_highlight  add new entry
-      // set     unset used       by type                 none (unlabelled 
slot)
-      // set     set   used       by type                 view entry
-  
+      // set up the query strings to be used for the link in the cell
       $wt = mktime( 12, 0, 0, $month, $day_start_week+$thisday, $year );
       $wday = date("d", $wt);
       $wmonth = date("m", $wt);
       $wyear = date("Y", $wt);
-  
-      if (isset($d[$thisday][$time_t]["id"]))
-      {
-        $id    = $d[$thisday][$time_t]["id"];
-        $color = $d[$thisday][$time_t]["color"];
-        $descr = htmlspecialchars($d[$thisday][$time_t]["data"]);
-        $long_descr = htmlspecialchars($d[$thisday][$time_t]["long_descr"]);
-        $slots = $d[$thisday][$time_t]["slots"];
-      }
-      else
-      {
-        unset($id);
-        $slots = 1;
-      }
       
-      // $c is the colour of the cell that the browser sees. Zebra stripes 
normally,
-      // row_highlight if we're highlighting that line and the appropriate 
colour if
-      // it is booked (determined by the type).
-      // We tell if its booked by $id having something in it
-      if (isset($id))
-      {
-        $c = $color;
-      }
-      else if (isset($timetohighlight) && ($time_t == $timetohighlight))
-      {
-        $c = "row_highlight";
-      }
-      else
-      {
-        $c = $row_class;
-      }
+      $query_strings = array();
+      $query_strings['new_periods'] = 
"room=$room&amp;area=$area&amp;period=$time_t_stripped&amp;year=$wyear&amp;month=$wmonth&amp;day=$wday";
+      $query_strings['new_times']   = 
"room=$room&amp;area=$area&amp;hour=$hour&amp;minute=$minute&amp;year=$wyear&amp;month=$wmonth&amp;day=$wday";
+      $query_strings['booking']     = 
"area=$area&amp;day=$wday&amp;month=$wmonth&amp;year=$wyear";
       
-      // Don't put in a <td> cell if the slot is booked and there's no 
description.
-      // This would mean that it's the second or subsequent slot of a booking 
and so the
-      // <td> for the first slot would have had a rowspan that extended the 
cell down for
-      // the number of slots of the booking.
-      
-      if (!(isset($id) && ($descr == "")))
-      {
-        tdcell($c, $slots);
-        
-        // If the room isnt booked then allow it to be booked
-        if (!isset($id))
-        {
-          $hour = date("H",$t);
-          $minute  = date("i",$t);
-          
-          echo "<div class=\"celldiv1\">\n";  // a bookable slot is only one 
unit high
-          if ($javascript_cursor)
-          {
-            echo "<script type=\"text/javascript\">\n";
-            echo "//<![CDATA[\n";
-            echo "BeginActiveCell();\n";
-            echo "//]]>\n";
-            echo "</script>\n";
-          }
-    
-          if ( $enable_periods )
-          {
-            echo "<a class=\"new_booking\" 
href=\"edit_entry.php?room=$room&amp;area=$area&amp;period=$time_t_stripped&amp;year=$wyear&amp;month=$wmonth&amp;day=$wday\">\n";
-            echo "<img src=\"new.gif\" alt=\"New\" width=\"10\" 
height=\"10\">\n";
-            echo "</a>\n";
-          }
-          else
-          {
-            echo "<a class=\"new_booking\" 
href=\"edit_entry.php?room=$room&amp;area=$area&amp;hour=$hour&amp;minute=$minute&amp;year=$wyear&amp;month=$wmonth&amp;day=$wday\">\n";
-            echo "<img src=\"new.gif\" alt=\"New\" width=\"10\" 
height=\"10\">\n";
-            echo "</a>\n";
-          }
-    
-          if ($javascript_cursor)
-          {
-            echo "<script type=\"text/javascript\">\n";
-            echo "//<![CDATA[\n";
-            echo "EndActiveCell();\n";
-                echo "//]]>\n";
-            echo "</script>\n";
-          }
-          echo "</div>\n";
-        }
-        else      //if it is booked then show the booking
-        { 
-               echo "<div class=\"celldiv" . $slots . "\">\n";     // we want 
clipping of overflow
-          echo " <a class=\"booking\" href=\"view_entry.php?id=$id"
-            . 
"&amp;area=$area&amp;day=$wday&amp;month=$wmonth&amp;year=$wyear\" "
-            . "title=\"$long_descr\">$descr</a>\n";
-          echo "</div>\n";
-        }
-        
-        echo "</td>\n";
-      }
-    }  // if this is a day that is not hidden
+      // and then draw the cell
+      draw_cell($week_map[$room][$thisday][$time_t], $query_strings, 
$row_class);
+    }
+
   }    // for loop
 
   // next lines to display times on right side
@@ -597,7 +438,6 @@
       echo "<div class=\"celldiv1\">\n";
       if ( $enable_periods )
       {
-        $time_t_stripped = preg_replace( "/^0/", "", $time_t );
         echo "<a href=\"$hilite_url=$time_t\"  title=\""
           . get_vocab("highlight_line") . "\">"
           . $periods[$time_t_stripped] . "</a>";


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

------------------------------------------------------------------------------
Apps built with the Adobe(R) Flex(R) framework and Flex Builder(TM) are
powering Web 2.0 with engaging, cross-platform capabilities. Quickly and
easily build your RIAs with Flex Builder, the Eclipse(TM)based development
software that enables intelligent coding and step-through debugging.
Download the free 60 day trial. http://p.sf.net/sfu/www-adobe-com
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to