Revision: 1059
          http://mrbs.svn.sourceforge.net/mrbs/?rev=1059&view=rev
Author:   cimorrison
Date:     2009-03-22 11:58:14 +0000 (Sun, 22 Mar 2009)

Log Message:
-----------
Restored the highlighting of single rows (achieved through clicking on a time) 
that got lost when support for the display of multiple bookings in a timeslot 
was added.

Modified Paths:
--------------
    mrbs/trunk/web/day.php
    mrbs/trunk/web/functions.inc
    mrbs/trunk/web/week.php

Modified: mrbs/trunk/web/day.php
===================================================================
--- mrbs/trunk/web/day.php      2009-03-21 13:24:11 UTC (rev 1058)
+++ mrbs/trunk/web/day.php      2009-03-22 11:58:14 UTC (rev 1059)
@@ -392,7 +392,15 @@
       {
         $today[$room_id][$day][$time_t] = array();  // to avoid an undefined 
index NOTICE error
       }
-      draw_cell($today[$room_id][$day][$time_t], $query_strings, $row_class);
+      if (isset($timetohighlight) && ($time_t == $timetohighlight))
+      {
+        $cell_class = "row_highlight";
+      }
+      else
+      {
+        $cell_class = $row_class;
+      }
+      draw_cell($today[$room_id][$day][$time_t], $query_strings, $cell_class);
     }
     
     // next lines to display times on right side

Modified: mrbs/trunk/web/functions.inc
===================================================================
--- mrbs/trunk/web/functions.inc        2009-03-21 13:24:11 UTC (rev 1058)
+++ mrbs/trunk/web/functions.inc        2009-03-22 11:58:14 UTC (rev 1059)
@@ -1059,7 +1059,7 @@
 
 
 
-function draw_cell($cell, $query_strings, $row_class)
+function draw_cell($cell, $query_strings, $cell_class)
 {
   // draws a single cell in the main table of the day and week views
   //
@@ -1088,7 +1088,8 @@
   //    ['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
+  // $cell_class specifies the default class for the cell (odd_row, even_row 
or row_highlight)
+  // so that the zebra stripes can be drawn, or else to allow the whole row to 
be highlighted.
   
   global $main_cell_height, $main_table_cell_border_width;
   global $area, $year, $month, $timetohighlight;
@@ -1114,14 +1115,14 @@
     ?>
     <script type="text/javascript">
     //<![CDATA[
-      document.getElementById('<?php echo $td_id ?>').className = 
"multiple_booking minimized <?php echo $row_class ?>";
+      document.getElementById('<?php echo $td_id ?>').className = 
"multiple_booking minimized <?php echo $cell_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 "<div class=\"multiple_control\" 
onClick=\"document.getElementById('$td_id').className = 'multiple_booking 
maximized $cell_class'\">+</div>\n";
     echo "<table>\n";
     echo "<tbody>\n";
     
@@ -1157,7 +1158,7 @@
     $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'\" " .
+         "onClick=\"document.getElementById('$td_id').className = 
'multiple_booking minimized $cell_class'\" " .
          "style =\"height: " . $total_height . "px; " .
                   "min-height: " . $total_height . "px; " .
                   "max-height: " . $total_height . "px; " .
@@ -1213,13 +1214,9 @@
     {
       $c = $color;
     }
-    else if (isset($timetohighlight) && ($time_t == $timetohighlight))
-    {
-      $c = "row_highlight";
-    }
     else
     {
-      $c = $row_class; // Use the default color class for the row.
+      $c = $cell_class; // Use the default color class (zebra stripes or 
highlighting).
     }
     
     // Don't put in a <td> cell if the slot is booked and there's no 
description.

Modified: mrbs/trunk/web/week.php
===================================================================
--- mrbs/trunk/web/week.php     2009-03-21 13:24:11 UTC (rev 1058)
+++ mrbs/trunk/web/week.php     2009-03-22 11:58:14 UTC (rev 1059)
@@ -437,7 +437,15 @@
       {
         $week_map[$room][$thisday][$time_t] = array();  // to avoid an 
undefined index NOTICE error
       }
-      draw_cell($week_map[$room][$thisday][$time_t], $query_strings, 
$row_class);
+      if (isset($timetohighlight) && ($time_t == $timetohighlight))
+      {
+        $cell_class = "row_highlight";
+      }
+      else
+      {
+        $cell_class = $row_class;
+      }
+      draw_cell($week_map[$room][$thisday][$time_t], $query_strings, 
$cell_class);
     }
 
   }    // for loop


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