Changeset:
        ff4f3916c8eb
        
https://sourceforge.net/p/mrbs/hg-code/ci/ff4f3916c8ebe12c41a3e8f8ba8bce2f495861d2
Author:
        Campbell Morrison <[email protected]>
Date:
        Fri Jan 20 20:48:38 2017 +0000
Log message:

Fixed bug that allowed the type colour to be shown even when the type was 
private.   See SF bugs #372.

diffstat:

 web/Themes/classic126/styling.inc |   1 +
 web/Themes/default/styling.inc    |   1 +
 web/css/mrbs.css.php              |  34 ++++++++++++++++++++++++++-----
 web/functions_table.inc           |   8 +++++-
 web/month.php                     |  41 ++++++++++++++++----------------------
 5 files changed, 53 insertions(+), 32 deletions(-)

diffs (168 lines):

diff -r 532717464595 -r ff4f3916c8eb web/Themes/classic126/styling.inc
--- a/web/Themes/classic126/styling.inc Fri Jan 20 18:56:07 2017 +0000
+++ b/web/Themes/classic126/styling.inc Fri Jan 20 20:48:38 2017 +0000
@@ -32,6 +32,7 @@
 $main_table_month_color         = "#ffffff";    // background colour for days 
in the month view
 $main_table_month_invalid_color = "#d1d9de";    // background colour for 
invalid days in the month view
 $main_table_slot_invalid_color  = "#d1d9de";    // background colour for 
invalid slots in the day and week views
+$main_table_slot_private_type_color = "#d1d9de";   // background colour when 
the type has to kept private
 $main_table_labels_back_color   = "#fff0f0";    // background colour for the 
row labels column
 
 // border colours for the main table when it is printed.     These are used by 
mrbs-print.css.php
diff -r 532717464595 -r ff4f3916c8eb web/Themes/default/styling.inc
--- a/web/Themes/default/styling.inc    Fri Jan 20 18:56:07 2017 +0000
+++ b/web/Themes/default/styling.inc    Fri Jan 20 20:48:38 2017 +0000
@@ -32,6 +32,7 @@
 $main_table_month_color         = "#ffffff";    // background colour for days 
in the month view
 $main_table_month_invalid_color = "#d1d9de";    // background colour for 
invalid days in the month view
 $main_table_slot_invalid_color  = "#d1d9de";    // background colour for 
invalid slots in the day and week views
+$main_table_slot_private_type_color = "#d1d9de";          // background colour 
when the type has to kept private
 $main_table_labels_back_color   = $header_back_color;     // background colour 
for the row labels column
 
 // border colours for the main table when it is printed.     These are used by 
mrbs-print.css.php
diff -r 532717464595 -r ff4f3916c8eb web/css/mrbs.css.php
--- a/web/css/mrbs.css.php      Fri Jan 20 18:56:07 2017 +0000
+++ b/web/css/mrbs.css.php      Fri Jan 20 20:48:38 2017 +0000
@@ -385,6 +385,25 @@
   width: 100%;
 }
 
+.booking_list div {
+  float: left;
+  min-height: 1.3em;
+  overflow: hidden;
+}
+
+<?php
+if ($clipped_month)
+{
+  ?>
+  .booking_list div {
+    height: 1.3em;
+    max-height: 1.3em;
+  }
+  <?php
+}
+?>
+
+
 .booking_list a {
   font-size: x-small;
 }
@@ -394,15 +413,15 @@
 // Generate the classes to give the colour coding by booking type in the 
day/week/month views
 foreach ($color_types as $type => $col)
 {
-  echo "td.$type {background-color: $col}\n";         // used in the day and 
week views
-  if( $clipped_month )
-    echo ".month div.$type {float: left; max-height: 1.3em; height: 1.3em; 
min-height: 1.3em; overflow: hidden; background-color: $col}\n";   // used in 
the month viewa
-  else
-    echo ".month div.$type {float: left; min-height: 1.3em; overflow: hidden; 
background-color: $col}\n";   // used in the month view
+  echo ".$type {background-color: $col}\n";
 }
 
 ?>
 
+.private_type {
+  background-color: <?php echo $main_table_slot_private_type_color;?>;
+}
+
 /* For floating header in the day and week views */
 
 .floatingHeader {
@@ -589,7 +608,10 @@
 }   
 
 /* booking privacy status */
-.private {opacity: 0.6; font-style: italic}
+.private {
+  opacity: 0.6;
+  font-style: italic;
+}
 
 /* booking approval status */
 .awaiting_approval {opacity: 0.6}
diff -r 532717464595 -r ff4f3916c8eb web/functions_table.inc
--- a/web/functions_table.inc   Fri Jan 20 18:56:07 2017 +0000
+++ b/web/functions_table.inc   Fri Jan 20 20:48:38 2017 +0000
@@ -87,11 +87,15 @@
     $entry['status'] |= STATUS_PRIVATE;   // Set the private bit
     if ($is_private_field['entry.name'])
     {
-      $entry['name']= "[".get_vocab('unavailable')."]";
+      $entry['name'] = "[".get_vocab('unavailable')."]";
     }
     if ($is_private_field['entry.description'])
     {
-      $entry['description']= "[".get_vocab('unavailable')."]";
+      $entry['description'] = "[".get_vocab('unavailable')."]";
+    }
+    if (!empty($is_private_field['entry.type']))
+    {
+      $entry['type'] = 'private_type';
     }
   }
   else
diff -r 532717464595 -r ff4f3916c8eb web/month.php
--- a/web/month.php     Fri Jan 20 18:56:07 2017 +0000
+++ b/web/month.php     Fri Jan 20 20:48:38 2017 +0000
@@ -174,42 +174,35 @@
       {
         $html .= "<br>DEBUG: Entry ".$entry['id']." day $day_num\n";
       }
-      $d[$day_num]["id"][] = $entry['id'];
-      $d[$day_num]["color"][] = $entry['type'];
-      $d[$day_num]["is_repeat"][] = isset($entry['repeat_id']);
       
       // Handle private events
-      if (is_private_event($entry['status'] & STATUS_PRIVATE)) 
+      if (is_private_event($entry['status'] & STATUS_PRIVATE)  &&
+          !getWritable($entry['create_by'], $user, $room))
       {
-        if (getWritable($entry['create_by'], $user, $room)) 
+        $entry['status'] |= STATUS_PRIVATE;   // Set the private bit
+        if ($is_private_field['entry.name'])
         {
-          $private = FALSE;
+          $entry['name'] = "[".get_vocab('unavailable')."]";
         }
-        else 
+        if (!empty($is_private_field['entry.type']))
         {
-          $private = TRUE;
+          $entry['type'] = 'private_type';
         }
       }
-      else 
-      {
-        $private = FALSE;
-      }
-
-      if ($private & $is_private_field['entry.name']) 
-      {
-        $d[$day_num]["status"][] = $entry['status'] | STATUS_PRIVATE;  // Set 
the private bit
-        $d[$day_num]["shortdescrip"][] = '['.get_vocab('unavailable').']';
-      }
       else
       {
-        $d[$day_num]["status"][] = $entry['status'] & ~STATUS_PRIVATE;  // 
Clear the private bit
-        $d[$day_num]["shortdescrip"][] = htmlspecialchars($entry['name']);
+        $entry['status'] &= ~STATUS_PRIVATE;  // Clear the private bit
       }
       
-      $d[$day_num]["data"][] = get_booking_summary($entry['start_time'],
-                                                   $entry['end_time'],
-                                                   $start_first_slot,
-                                                   $end_last_slot);
+      $d[$day_num]["shortdescrip"][] = htmlspecialchars($entry['name']);
+      $d[$day_num]["id"][]           = $entry['id'];
+      $d[$day_num]["color"][]        = $entry['type'];
+      $d[$day_num]["status"][]       = $entry['status'];
+      $d[$day_num]["is_repeat"][]    = isset($entry['repeat_id']);
+      $d[$day_num]["data"][]         = 
get_booking_summary($entry['start_time'],
+                                                           $entry['end_time'],
+                                                           $start_first_slot,
+                                                           $end_last_slot);
     }
   }
 

------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to