Revision: 1593
          http://mrbs.svn.sourceforge.net/mrbs/?rev=1593&view=rev
Author:   cimorrison
Date:     2010-11-10 17:13:40 +0000 (Wed, 10 Nov 2010)

Log Message:
-----------
Added the ability to prevent ordinary users from selecting multiple rooms on 
the edit_entry form, controlled by the config variable 
$auth['only_admin_can_select_multiple'].   Thanks to a patch from Chris Cook on 
the mailing list.

Modified Paths:
--------------
    mrbs/trunk/web/edit_entry.php
    mrbs/trunk/web/systemdefaults.inc.php

Modified: mrbs/trunk/web/edit_entry.php
===================================================================
--- mrbs/trunk/web/edit_entry.php       2010-11-05 14:56:55 UTC (rev 1592)
+++ mrbs/trunk/web/edit_entry.php       2010-11-10 17:13:40 UTC (rev 1593)
@@ -126,6 +126,8 @@
 $repeats_allowed = $is_admin || empty($auth['only_admin_can_book_repeat']);
 // Similarly for multi-day
 $multiday_allowed = $is_admin || empty($auth['only_admin_can_book_multiday']);
+// Similarly for multiple room selection
+$multiselect_allowed = $is_admin || 
empty($auth['only_admin_can_select_multiple']);
 
 // This page will either add or modify a booking
 
@@ -911,21 +913,26 @@
     <div id="div_rooms">
     <label for="rooms"><?php echo get_vocab("rooms") ?>:</label>
     <div class="group">
-      <select id="rooms" name="rooms[]" multiple="multiple" size="5">
-        <?php 
-        foreach ($rooms as $r)
+      <?php
+      echo "<select id=\"rooms\" name=\"rooms[]\"" .
+           (($multiselect_allowed) ? " multiple=\"multiple\"" : "") .
+           " size=\"5\">\n";  
+      foreach ($rooms as $r)
+      {
+        if ($r['area_id'] == $area_id)
         {
-          if ($r['area_id'] == $area_id)
-          {
-            $selected = ($r['id'] == $room_id) ? "selected=\"selected\"" : "";
-            echo "<option $selected value=\"" . $r['id'] . "\">" . 
htmlspecialchars($r['room_name']) . "</option>\n";
-            // store room names for emails
-            $room_names[$i] = $r['room_name'];
-          }
+          $selected = ($r['id'] == $room_id) ? "selected=\"selected\"" : "";
+          echo "<option $selected value=\"" . $r['id'] . "\">" . 
htmlspecialchars($r['room_name']) . "</option>\n";
+          // store room names for emails
+          $room_names[$i] = $r['room_name'];
         }
-        ?>
-      </select>
-      <span><?php echo get_vocab("ctrl_click") ?></span>
+      }
+      echo "</select>\n";
+      if ($multiselect_allowed)
+      {
+        echo "<span>" . get_vocab("ctrl_click") . "</span>\n";
+      }
+      ?>
       </div>
     </div>
     <div id="div_type">

Modified: mrbs/trunk/web/systemdefaults.inc.php
===================================================================
--- mrbs/trunk/web/systemdefaults.inc.php       2010-11-05 14:56:55 UTC (rev 
1592)
+++ mrbs/trunk/web/systemdefaults.inc.php       2010-11-10 17:13:40 UTC (rev 
1593)
@@ -696,6 +696,10 @@
 // If you want only administrators to be able to make bookings spanning
 // more than one day, set this variable to TRUE
 $auth['only_admin_can_book_multiday'] = FALSE;
+// If you want only administrators to be able to select multiple rooms
+// on the booking form then set this to TRUE.  (It doesn't stop ordinary users
+// making separate bookings for the same time slot, but it does slow them 
down).
+$auth['only_admin_can_select_multiple'] = FALSE;
 // If you don't want ordinary users to be able to see the other users'
 // details then set this to TRUE.  (Only relevant when using 'db' 
authentication]
 $auth['only_admin_can_see_other_users'] = FALSE;


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

------------------------------------------------------------------------------
The Next 800 Companies to Lead America's Growth: New Video Whitepaper
David G. Thomson, author of the best-selling book "Blueprint to a 
Billion" shares his insights and actions to help propel your 
business during the next growth cycle. Listen Now!
http://p.sf.net/sfu/SAP-dev2dev
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to