Revision: 2102
          http://mrbs.svn.sourceforge.net/mrbs/?rev=2102&view=rev
Author:   cimorrison
Date:     2011-10-17 20:55:34 +0000 (Mon, 17 Oct 2011)
Log Message:
-----------
Prevented non-admins from dragging across days in the week view, and thereby 
trying to create repeat bookings, when $auth['only_admin_can_book_repeat'] is 
set.

Modified Paths:
--------------
    mrbs/branches/draggable_bookings/web/Themes/default/header.inc

Modified: mrbs/branches/draggable_bookings/web/Themes/default/header.inc
===================================================================
--- mrbs/branches/draggable_bookings/web/Themes/default/header.inc      
2011-10-17 20:24:29 UTC (rev 2101)
+++ mrbs/branches/draggable_bookings/web/Themes/default/header.inc      
2011-10-17 20:55:34 UTC (rev 2102)
@@ -71,7 +71,7 @@
          $search_str, $locale_warning;
   global $tbl_entry, $tbl_room, $tbl_area;
   global $PHP_SELF, $HTTP_HOST, $QUERY_STRING;
-  global $view_week_number, $weekstarts;
+  global $view_week_number, $weekstarts, $times_along_top;
   global $auth, $max_level;
   global $default_language_tokens, $disable_automatic_language_changing, 
$override_locale;
   global $lang_map_windows, $langs, $server_os;
@@ -1708,15 +1708,20 @@
                   data.start_year = startDate[0];
                   data.start_month = startDate[1];
                   data.start_day = startDate[2];
-                  if (newParams.date.length > 1)
+                  <?php
+                  if ($is_admin || !$auth['only_admin_can_book_repeat'])
                   {
-                    data.rep_type = <?php echo REP_DAILY ?>;
-                    var repEndDate = newParams.date[newParams.date.length - 
1].split('-');
-                    data.rep_end_year = repEndDate[0];
-                    data.rep_end_month = repEndDate[1];
-                    data.rep_end_day = repEndDate[2];
+                    ?>
+                    if (newParams.date.length > 1)
+                    {
+                      data.rep_type = <?php echo REP_DAILY ?>;
+                      var repEndDate = newParams.date[newParams.date.length - 
1].split('-');
+                      data.rep_end_year = repEndDate[0];
+                      data.rep_end_month = repEndDate[1];
+                      data.rep_end_day = repEndDate[2];
+                    }
+                    <?php
                   }
-                  <?php
                 }
                 ?>
                 data.end_day = data.start_day;
@@ -1751,7 +1756,32 @@
               }
             }  <?php // divResizeStop ?>
             
-
+            <?php
+            if ($page == 'week')
+            {
+              // If we're in the week view then if non-admins aren't allowed to
+              // make repeat bookings then we want to restrict the handles we
+              // offer them so that they can't get that far.
+              if ($is_admin || !$auth['only_admin_can_book_repeat'])
+              {
+                ?>
+                var handles = 'all';
+                <?php
+              }
+              elseif ($times_along_top)
+              {
+                ?>
+                var handles = 'e, w';
+                <?php
+              }
+              else
+              {
+                ?>
+                var handles = 'n, s';
+                <?php
+              }
+            }
+            ?>
             var divBooking = $(this).children('div');
             var divClone = divBooking.clone();
             divBooking.css('visibility', 'hidden');
@@ -1764,7 +1794,7 @@
                     .css('min-height', '<?php echo $main_cell_height ?>px')
                     .width(divBooking.outerWidth())
                     .height(divBooking.outerHeight())
-                    .resizable({handles: 'all',
+                    .resizable({handles: handles,
                                 resize: divResize,
                                 start: divResizeStart,
                                 stop: divResizeStop})

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


------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2d-oct
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to