Revision: 1129
          http://mrbs.svn.sourceforge.net/mrbs/?rev=1129&view=rev
Author:   cimorrison
Date:     2009-06-24 15:47:32 +0000 (Wed, 24 Jun 2009)

Log Message:
-----------
Made the private bookings config editable per-area, with the config variables 
being the default settings to be used when a new area is created.

Modified Paths:
--------------
    mrbs/trunk/web/config.inc.php
    mrbs/trunk/web/dbsys.inc
    mrbs/trunk/web/edit_area_room.php
    mrbs/trunk/web/functions.inc
    mrbs/trunk/web/lang.en
    mrbs/trunk/web/mrbs-ie.css
    mrbs/trunk/web/mrbs-ie8.css
    mrbs/trunk/web/mrbs.css.php

Added Paths:
-----------
    mrbs/trunk/web/upgrade/4/
    mrbs/trunk/web/upgrade/4/mysql.sql
    mrbs/trunk/web/upgrade/4/pgsql.sql
    mrbs/trunk/web/upgrade/4/post.inc

Modified: mrbs/trunk/web/config.inc.php
===================================================================
--- mrbs/trunk/web/config.inc.php       2009-06-23 15:02:08 UTC (rev 1128)
+++ mrbs/trunk/web/config.inc.php       2009-06-24 15:47:32 UTC (rev 1129)
@@ -120,10 +120,11 @@
 // TIMES SETTINGS
 // --------------
 
-// NOTE:  The "Times" settings can all be configured per area.    These are the
-// default settings to be used.   The "Times" settings are ignored if 
$enable_periods
-// is TRUE.
+// These settings are all set per area through MRBS.   These are the default
+// settings that are used when a new area is created.
 
+// The "Times" settings are ignored if $enable_periods is TRUE.
+
 // Resolution - what blocks can be booked, in seconds.
 // Default is half an hour: 1800 seconds.
 $resolution = (30 * 60);
@@ -337,7 +338,11 @@
                               // highlighting is used, whether or not 
$javascript_cursor is set.
 
 
-// Private Bookings Settings
+// PRIVATE BOOKINGS SETTINGS
+
+// These settings are all set per area through MRBS.   These are the default
+// settings that are used when a new area is created.
+
 // Only administrators or the person who booked a private event can see
 // details of the event.  Everyone else just sees that the time/period
 // is booked on the schedule.

Modified: mrbs/trunk/web/dbsys.inc
===================================================================
--- mrbs/trunk/web/dbsys.inc    2009-06-23 15:02:08 UTC (rev 1128)
+++ mrbs/trunk/web/dbsys.inc    2009-06-24 15:47:32 UTC (rev 1129)
@@ -15,7 +15,7 @@
 $tbl_variables = $db_tbl_prefix . "variables";
 
 
-$db_schema_version = 3;
+$db_schema_version = 4;
 $local_db_schema_version = 1;
 
 

Modified: mrbs/trunk/web/edit_area_room.php
===================================================================
--- mrbs/trunk/web/edit_area_room.php   2009-06-23 15:02:08 UTC (rev 1128)
+++ mrbs/trunk/web/edit_area_room.php   2009-06-24 15:47:32 UTC (rev 1129)
@@ -32,6 +32,10 @@
 $area_eveningends_minutes = get_form_var('area_eveningends_minutes', 'int');
 $area_evening_ampm = get_form_var('area_evening_ampm', 'string');
 $area_eveningends_t = get_form_var('area_eveningends_t', 'int');
+$area_private_enabled = get_form_var('area_private_enabled', 'string');
+$area_private_default = get_form_var('area_private_default', 'int');
+$area_private_mandatory = get_form_var('area_private_mandatory', 'string');
+$area_private_override = get_form_var('area_private_override', 'string');
 $change_done = get_form_var('change_done', 'string');
 $change_room = get_form_var('change_room', 'string');
 $change_area = get_form_var('change_area', 'string');
@@ -76,6 +80,9 @@
   }
 }
 
+$area_private_enabled = (!empty($area_private_enabled)) ? 1 : 0;
+$area_private_mandatory = (!empty($area_private_mandatory)) ? 1 : 0;
+
 $required_level = (isset($max_level) ? $max_level : 2);
 if (!getAuthorised($required_level))
 {
@@ -302,6 +309,11 @@
               . ", eveningends=" . $area_eveningends
               . ", eveningends_minutes=" . $area_eveningends_minutes;
       }
+      $sql .= ", private_enabled=" . $area_private_enabled
+            . ", private_default=" . $area_private_default
+            . ", private_mandatory=" . $area_private_mandatory
+            . ", private_override='" . $area_private_override . "'";
+            
       $sql .= " WHERE id=$area";
       if (sql_command($sql) < 0)
       {
@@ -345,17 +357,20 @@
       ?>
     </fieldset>
   
-    <input type="hidden" name="area" value="<?php echo $row["id"]?>">
+    <fieldset>
+    <legend><?php echo get_vocab("general_settings")?></legend>
+      <input type="hidden" name="area" value="<?php echo $row["id"]?>">
     
-    <div>
-    <label for="area_name"><?php echo get_vocab("name") ?>:</label>
-    <input type="text" id="area_name" name="area_name" value="<?php echo 
htmlspecialchars($row["area_name"]); ?>">
-    </div>
+      <div>
+      <label for="area_name"><?php echo get_vocab("name") ?>:</label>
+      <input type="text" id="area_name" name="area_name" value="<?php echo 
htmlspecialchars($row["area_name"]); ?>">
+      </div>
     
-    <div>
-    <label for="area_admin_email"><?php echo get_vocab("area_admin_email") 
?>:</label>
-    <input type="text" id="area_admin_email" name="area_admin_email" 
maxlength="75" value="<?php echo htmlspecialchars($row["area_admin_email"]); 
?>">
-    </div>
+      <div>
+      <label for="area_admin_email"><?php echo get_vocab("area_admin_email") 
?>:</label>
+      <input type="text" id="area_admin_email" name="area_admin_email" 
maxlength="75" value="<?php echo htmlspecialchars($row["area_admin_email"]); 
?>">
+      </div>
+    </fieldset>
     
     <?php
     if (!$enable_periods)
@@ -466,6 +481,8 @@
       //]]>
       </script>
       
+      <fieldset>
+      <legend><?php echo get_vocab("time_settings")?></legend>
       <div class="div_time">
         <label><?php echo get_vocab("area_first_slot_start")?>:</label>
         <?php
@@ -566,7 +583,74 @@
     }
     
     ?>
+    </fieldset>
     
+    <fieldset>
+    <legend><?php echo get_vocab("private_settings")?></legend>
+      <div>
+        <label for="area_private_enabled"><?php echo 
get_vocab("allow_private")?>:</label>
+        <?php $checked = ($private_enabled) ? " checked=\"checked\"" : "" ?>
+        <input class="checkbox" type="checkbox"<?php echo $checked ?> 
id="area_private_enabled" name="area_private_enabled">
+      </div>
+      <div>
+        <label for="area_private_mandatory"><?php echo 
get_vocab("force_private")?>:</label>
+        <?php $checked = ($private_mandatory) ? " checked=\"checked\"" : "" ?>
+        <input class="checkbox" type="checkbox"<?php echo $checked ?> 
id="area_private_mandatory" name="area_private_mandatory">
+      </div>
+      <label>
+        <?php echo get_vocab("default_settings")?>:
+      </label>
+      <div class="group">
+        <div>
+          <label>
+            <?php $checked = ($private_default) ? " checked=\"checked\"" : "" 
?>
+            <input class="radio" type="radio" name="area_private_default" 
value="1"<?php echo $checked ?>>
+            <?php echo get_vocab("default_private")?>
+          </label>
+        </div>
+        <div>
+          <label>
+            <?php $checked = ($private_default) ? "" : " checked=\"checked\"" 
?>
+            <input class="radio" type="radio" name="area_private_default" 
value="0"<?php echo $checked ?>>
+            <?php echo get_vocab("default_public")?>
+          </label>
+        </div>
+      </div>
+    </fieldset>
+    
+    <fieldset>
+    <legend><?php echo get_vocab("private_display")?></legend>
+      <label>
+        <?php echo get_vocab("private_display_label")?>
+        <span id="private_display_caution">
+          <?php echo get_vocab("private_display_caution")?>
+        </span>
+      </label>
+      <div class="group" id="private_override" >
+        <div>
+          <label>
+            <?php $checked = ($private_override == "none") ? " 
checked=\"checked\"" : "" ?>
+            <input class="radio" type="radio" name="area_private_override" 
value="none"<?php echo $checked ?>>
+            <?php echo get_vocab("treat_respect")?>
+          </label>
+        </div>
+        <div>
+          <label>
+            <?php $checked = ($private_override == "private") ? " 
checked=\"checked\"" : "" ?>
+            <input class="radio" type="radio" name="area_private_override" 
value="private"<?php echo $checked ?>>
+            <?php echo get_vocab("treat_private")?>
+          </label>
+        </div>
+        <div>
+          <label>
+            <?php $checked = ($private_override == "public") ? " 
checked=\"checked\"" : "" ?>
+            <input class="radio" type="radio" name="area_private_override" 
value="public"<?php echo $checked ?>>
+            <?php echo get_vocab("treat_public")?>
+          </label>
+        </div>
+      </div>
+    </fieldset>
+    
     <fieldset class="submit_buttons">
     <legend></legend>
       <div id="edit_area_room_submit_back">

Modified: mrbs/trunk/web/functions.inc
===================================================================
--- mrbs/trunk/web/functions.inc        2009-06-23 15:02:08 UTC (rev 1128)
+++ mrbs/trunk/web/functions.inc        2009-06-24 15:47:32 UTC (rev 1129)
@@ -280,11 +280,13 @@
   return ($area < 0 ? 0 : $area);
 }
 
-// Update the default timeslot settings with the ones specific to this area
+// Update the default timeslot settings with the ones specific to this area.
+// If no value is set in the database, use the value from the config file
 function get_area_settings($area)
 {
   global $tbl_area;
   global $resolution, $default_duration, $morningstarts, 
$morningstarts_minutes, $eveningends, $eveningends_minutes;
+  global $private_enabled, $private_default, $private_mandatory, 
$private_override;
   $sql = "SELECT *
           FROM $tbl_area 
           WHERE id=$area 
@@ -303,6 +305,10 @@
     $morningstarts_minutes = (isset($row['morningstarts_minutes']) ? 
$row['morningstarts_minutes'] : $morningstarts_minutes);
     $eveningends = (isset($row['eveningends']) ? $row['eveningends'] : 
$eveningends);
     $eveningends_minutes = (isset($row['eveningends_minutes']) ? 
$row['eveningends_minutes'] : $eveningends_minutes);
+    $private_enabled = (bool) (isset($row['private_enabled']) ? 
$row['private_enabled'] : $private_enabled);
+    $private_default = (bool) (isset($row['private_default']) ? 
$row['private_default'] : $private_default);
+    $private_mandatory = (bool) (isset($row['private_mandatory']) ? 
$row['private_mandatory'] : $private_mandatory);
+    $private_override = (isset($row['private_override']) ? 
$row['private_override'] : $private_override);
   }
 }
 

Modified: mrbs/trunk/web/lang.en
===================================================================
--- mrbs/trunk/web/lang.en      2009-06-23 15:02:08 UTC (rev 1128)
+++ mrbs/trunk/web/lang.en      2009-06-24 15:47:32 UTC (rev 1129)
@@ -240,27 +240,41 @@
 $vocab["invalid_area_name"]  = "This area name has already been used!";
 
 // Used in edit_area_room.php
-$vocab["editarea"]               = "Edit Area";
-$vocab["change"]                 = "Change";
-$vocab["backadmin"]              = "Back to Admin";
-$vocab["editroomarea"]           = "Edit Area or Room Description";
-$vocab["editroom"]               = "Edit Room";
-$vocab["update_room_failed"]     = "Update room failed: ";
-$vocab["error_room"]             = "Error: room ";
-$vocab["not_found"]              = " not found";
-$vocab["update_area_failed"]     = "Update area failed: ";
-$vocab["error_area"]             = "Error: area ";
-$vocab["room_admin_email"]       = "Room admin email";
-$vocab["area_admin_email"]       = "Area admin email";
-$vocab["area_first_slot_start"]  = "Start of first slot";
-$vocab["area_last_slot_start"]   = "Start of last slot";
-$vocab["area_res_mins"]          = "Resolution (minutes)";
-$vocab["area_def_duration_mins"] = "Default duration (minutes)";
-$vocab["invalid_area"]           = "Invalid area!";
-$vocab["invalid_room_name"]      = "This room name has already been used in 
the area!";
-$vocab["invalid_email"]          = "Invalid email!";
-$vocab["invalid_resolution"]     = "Invalid combination of first slot, last 
slot and resolution!";
-$vocab["too_many_slots"]         = 'You need to increase the value of 
$max_slots in the config file!';
+$vocab["editarea"]                = "Edit Area";
+$vocab["change"]                  = "Change";
+$vocab["backadmin"]               = "Back to Admin";
+$vocab["editroomarea"]            = "Edit Area or Room Description";
+$vocab["editroom"]                = "Edit Room";
+$vocab["update_room_failed"]      = "Update room failed: ";
+$vocab["error_room"]              = "Error: room ";
+$vocab["not_found"]               = " not found";
+$vocab["update_area_failed"]      = "Update area failed: ";
+$vocab["error_area"]              = "Error: area ";
+$vocab["room_admin_email"]        = "Room admin email";
+$vocab["area_admin_email"]        = "Area admin email";
+$vocab["area_first_slot_start"]   = "Start of first slot";
+$vocab["area_last_slot_start"]    = "Start of last slot";
+$vocab["area_res_mins"]           = "Resolution (minutes)";
+$vocab["area_def_duration_mins"]  = "Default duration (minutes)";
+$vocab["invalid_area"]            = "Invalid area!";
+$vocab["invalid_room_name"]       = "This room name has already been used in 
the area!";
+$vocab["invalid_email"]           = "Invalid email!";
+$vocab["invalid_resolution"]      = "Invalid combination of first slot, last 
slot and resolution!";
+$vocab["too_many_slots"]          = 'You need to increase the value of 
$max_slots in the config file!';
+$vocab["general_settings"]        = "General";
+$vocab["time_settings"]           = "Slot times";
+$vocab["private_settings"]        = "Private bookings";
+$vocab["allow_private"]           = "Allow private bookings";
+$vocab["force_private"]           = "Force private bookings";
+$vocab["default_settings"]        = "Default/forced settings";
+$vocab["default_private"]         = "Private";
+$vocab["default_public"]          = "Public";
+$vocab["private_display"]         = "Private bookings (display)";
+$vocab["private_display_label"]   = "How should private bookings be 
displayed?";
+$vocab["private_display_caution"] = "CAUTION: think carefully about the 
privacy implications before changing these settings!";
+$vocab["treat_respect"]           = "Respect the privacy setting of the 
booking";
+$vocab["treat_private"]           = "Treat all bookings as private, ignoring 
their privacy settings";
+$vocab["treat_public"]            = "Treat all bookings as public, ignoring 
their privacy settings";
 
 // Used in edit_users.php
 $vocab["name_empty"]         = "You must enter a name.";

Modified: mrbs/trunk/web/mrbs-ie.css
===================================================================
--- mrbs/trunk/web/mrbs-ie.css  2009-06-23 15:02:08 UTC (rev 1128)
+++ mrbs/trunk/web/mrbs-ie.css  2009-06-24 15:47:32 UTC (rev 1129)
@@ -19,6 +19,7 @@
 /*   used in EDIT_ENTRY.PHP and REPORT.PHP           */
 
 .form_general legend {margin-bottom: 2.0em}   /* by default IE gives no gap 
between legend and first form element */
+.form_general fieldset fieldset legend {margin-bottom: 5px}
 
 /* margin-bottom on some form controls does not work, so put it on the 
relevant divs instead */
 .form_general div#div_description, 

Modified: mrbs/trunk/web/mrbs-ie8.css
===================================================================
--- mrbs/trunk/web/mrbs-ie8.css 2009-06-23 15:02:08 UTC (rev 1128)
+++ mrbs/trunk/web/mrbs-ie8.css 2009-06-24 15:47:32 UTC (rev 1129)
@@ -5,6 +5,12 @@
 /* ------------ ADMIN.PHP ---------------------------*/
 .form_admin fieldset {padding-top: 0}
 
+/* ------------ FORM_GENERAL ------------------------*/
+/* Even though no max-height is set, IE8 will clip content */
+/* when overflow is set to hidden.    Therefore we need to */
+/* set it to visible explicitly for the y direction        */
+.form_general label {overflow-y: visible}
+
 /* ------------ TRAILER.INC ---------------------*/
 
 /* opacity for IE8 is implemented with filter, but only works if the element */

Modified: mrbs/trunk/web/mrbs.css.php
===================================================================
--- mrbs/trunk/web/mrbs.css.php 2009-06-23 15:02:08 UTC (rev 1128)
+++ mrbs/trunk/web/mrbs.css.php 2009-06-24 15:47:32 UTC (rev 1129)
@@ -403,7 +403,13 @@
 #del_room_confirm_links span:hover {text-decoration: underline}    /* for 
Firefox */
 
 
+/* ------------ EDIT_AREA_ROOM.PHP ------------------*/
+.edit_area_room .form_general fieldset fieldset {padding-top: 0.5em; 
padding-bottom: 0.5em}
+.edit_area_room .form_general fieldset fieldset legend {font-size: small; 
font-style: italic; font-weight: normal}
+span#private_display_caution {display: block; margin-top: 1em; font-style: 
italic; font-weight: normal}
 
+
+
 /* ------------ FORM_GENERAL ------------------------*/
 /*                                                   */
 /*   used in EDIT_ENTRY.PHP, REPORT.PHP,             */
@@ -460,6 +466,8 @@
 .form_general div div {float: none; clear: none; width: auto}
 .form_general div.group {float: left; width: <?php echo 
$general_right_col_width ?>%}
 .form_general div.group.ampm {width: <?php echo $edit_entry_ampm_width ?>em}
+.edit_area_room div.group {clear: none}
+.edit_area_room div.group#private_override div {clear: left}
 .form_general fieldset {width: auto; border: 0; padding-top: 2.0em}
 
 .form_general label {
@@ -498,6 +506,7 @@
 .form_general select {float: left; margin-left: <?php echo $general_gap ?>em; 
margin-right: -0.5em; margin-bottom: 0.5em}
 .form_general input.radio {margin-top: 0.1em}
 .form_general input.checkbox {margin-top: 0.1em}
+.edit_area_room .form_general input.checkbox {width: auto; margin-left: <?php 
echo $general_gap ?>em}
 .form_general input.submit {display: block; width: auto; float: left; clear: 
left; margin-top: 1.0em}
 
 div#edit_entry_submit {width: <?php echo $general_left_col_width ?>%; 
max-width: <?php echo $edit_entry_left_col_max_width ?>em}

Added: mrbs/trunk/web/upgrade/4/mysql.sql
===================================================================
--- mrbs/trunk/web/upgrade/4/mysql.sql                          (rev 0)
+++ mrbs/trunk/web/upgrade/4/mysql.sql  2009-06-24 15:47:32 UTC (rev 1129)
@@ -0,0 +1,7 @@
+# $Id$
+
+ALTER TABLE %DB_TBL_PREFIX%area 
+ADD COLUMN private_enabled       tinyint(1),
+ADD COLUMN private_default       tinyint(1),
+ADD COLUMN private_mandatory     tinyint(1),
+ADD COLUMN private_override      varchar(32);


Property changes on: mrbs/trunk/web/upgrade/4/mysql.sql
___________________________________________________________________
Added: svn:keywords
   + id
Added: svn:eol-style
   + native

Added: mrbs/trunk/web/upgrade/4/pgsql.sql
===================================================================
--- mrbs/trunk/web/upgrade/4/pgsql.sql                          (rev 0)
+++ mrbs/trunk/web/upgrade/4/pgsql.sql  2009-06-24 15:47:32 UTC (rev 1129)
@@ -0,0 +1,8 @@
+-- $Id$
+
+ALTER TABLE %DB_TBL_PREFIX%area 
+ADD COLUMN private_enabled       smallint,
+ADD COLUMN private_default       smallint,
+ADD COLUMN private_mandatory     smallint,
+ADD COLUMN private_override      varchar(32);
+


Property changes on: mrbs/trunk/web/upgrade/4/pgsql.sql
___________________________________________________________________
Added: svn:keywords
   + id
Added: svn:eol-style
   + native

Added: mrbs/trunk/web/upgrade/4/post.inc
===================================================================
--- mrbs/trunk/web/upgrade/4/post.inc                           (rev 0)
+++ mrbs/trunk/web/upgrade/4/post.inc   2009-06-24 15:47:32 UTC (rev 1129)
@@ -0,0 +1,29 @@
+<?php
+
+// $Id$
+
+// Populate the new columns in the area table with the default values taken
+// from the config file.
+
+global $tbl_area;
+global $private_enabled, $private_default, $private_mandatory, 
$private_override;
+
+$private_enabled = ($private_enabled) ? 1 : 0;
+$private_default = ($private_default) ? 1 : 0;
+$private_mandatory = ($private_mandatory) ? 1 : 0;
+
+$sql = "UPDATE $tbl_area SET
+        private_enabled = $private_enabled,
+        private_default = $private_default,
+        private_mandatory = $private_mandatory,
+        private_override = '$private_override'";
+    
+$res = sql_command($sql);
+if ($res == -1)
+{
+  echo sql_error();
+  // No need to localise, should never happen
+  print "<span class=\"error\">Failed to set default values for new columns in 
area table.</span>";
+}
+
+?>


Property changes on: mrbs/trunk/web/upgrade/4/post.inc
___________________________________________________________________
Added: svn:mime-type
   + text/plain
Added: svn:keywords
   + id
Added: svn:eol-style
   + native


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

------------------------------------------------------------------------------
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to