Revision: 2178
          http://mrbs.svn.sourceforge.net/mrbs/?rev=2178&view=rev
Author:   cimorrison
Date:     2011-11-19 04:02:59 +0000 (Sat, 19 Nov 2011)
Log Message:
-----------
Fixed bug whereby dragging multi-day bookings in the week view wasn't working 
properly.

Modified Paths:
--------------
    mrbs/trunk/web/Themes/default/header.inc
    mrbs/trunk/web/edit_entry_handler.php

Modified: mrbs/trunk/web/Themes/default/header.inc
===================================================================
--- mrbs/trunk/web/Themes/default/header.inc    2011-11-12 07:19:15 UTC (rev 
2177)
+++ mrbs/trunk/web/Themes/default/header.inc    2011-11-19 04:02:59 UTC (rev 
2178)
@@ -1861,10 +1861,10 @@
  
                
         var upHandler = function(e) {
+            e.preventDefault();
+            var tolerance = 2; <?php // px ?>
             var box = downHandler.box;
-            var tolerance = 2; <?php // px ?>
-            e.preventDefault();
-            params = getBookingParams(box);
+            var params = getBookingParams(box);
             $(document).unbind('mousemove',moveHandler);
             $(document).unbind('mouseup', upHandler);
             <?php // Remove the resizing wrapper so that highlighting comes 
back on ?>
@@ -2100,22 +2100,36 @@
                   <?php // get the booking id ?>
                   data.id = divClone.data('id');
                   <?php // get the other parameters ?>
+                  var oldParams = getBookingParams(divBooking);
                   var newParams = getBookingParams(divClone);
                   if (newParams.seconds !== undefined)
                   {
-                    data.start_seconds = newParams.seconds[0];
-                    data.end_seconds = 
newParams.seconds[newParams.seconds.length - 1];
                     <?php
-                    if ($enable_periods)
+                    // We only send through the time parameters that have 
changed.
+                    // This is so that edit_entry_handler.php knows whether to 
use
+                    // the original booking parameters.    We need to do this 
so that
+                    // we can properly handle multi-day bookings in the week 
view.
+                    ?>
+                    if (newParams.seconds[0] != oldParams.seconds[0])
                     {
-                      // When we're dealing with periods the end time is 
defined as
-                      // the end of the last period (as opposed to the start 
of the
-                      // next slot in times mode)
+                      data.start_seconds = newParams.seconds[0];
+                    }
+                    if (newParams.seconds[newParams.seconds.length - 1] !=
+                        oldParams.seconds[oldParams.seconds.length - 1])
+                    {
+                      data.end_seconds = 
newParams.seconds[newParams.seconds.length - 1];
+                      <?php
+                      if ($enable_periods)
+                      {
+                        // When we're dealing with periods the end time is 
defined as
+                        // the end of the last period (as opposed to the start 
of the
+                        // next slot in times mode)
+                        ?>
+                        data.end_seconds -= 60;
+                        <?php
+                      }
                       ?>
-                      data.end_seconds -= 60;
-                      <?php
                     }
-                    ?>
                   }
                   <?php
                   if ($page == 'day')

Modified: mrbs/trunk/web/edit_entry_handler.php
===================================================================
--- mrbs/trunk/web/edit_entry_handler.php       2011-11-12 07:19:15 UTC (rev 
2177)
+++ mrbs/trunk/web/edit_entry_handler.php       2011-11-19 04:02:59 UTC (rev 
2178)
@@ -136,12 +136,27 @@
         case 'confirmed':
           $$var = !($old_booking['status'] & STATUS_TENTATIVE);
           break;
+        case 'start_seconds';
+          $date = getdate($old_booking['start_time']);
+          $start_year = $date['year'];
+          $start_month = $date['mon'];
+          $start_day = $date['mday'];
+          $start_seconds = $old_booking['start_time'] - mktime(0, 0, 0, 
$start_month, $start_day, $start_year);
+          break;
+        case 'end_seconds';
+          $date = getdate($old_booking['end_time']);
+          $end_year = $date['year'];
+          $end_month = $date['mon'];
+          $end_day = $date['mday'];
+          $end_seconds = $old_booking['end_time'] - mktime(0, 0, 0, 
$end_month, $end_day, $end_year);
+          break;
         default:
           $$var = $old_booking[$var];
           break;
       }
     }
   }
+
   // Now the custom fields
   $custom_fields = array();
   foreach ($fields as $field)

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. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to