Revision: 2122
          http://mrbs.svn.sourceforge.net/mrbs/?rev=2122&view=rev
Author:   cimorrison
Date:     2011-10-20 09:14:39 +0000 (Thu, 20 Oct 2011)
Log Message:
-----------
Made a single click without dragging (more than a few pixels) behave in the 
traditional fashion - ie it goes to the edit_entry page and you get the default 
duration etc.

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

Modified: mrbs/branches/draggable_bookings/web/Themes/default/header.inc
===================================================================
--- mrbs/branches/draggable_bookings/web/Themes/default/header.inc      
2011-10-20 08:01:20 UTC (rev 2121)
+++ mrbs/branches/draggable_bookings/web/Themes/default/header.inc      
2011-10-20 09:14:39 UTC (rev 2122)
@@ -1582,6 +1582,12 @@
             <?php // Apply a wrapper to turn off highlighting ?>
             table.wrap('<div class="resizing"><\/div>');
             downHandler.origin = $(e.target).offset();
+            downHandler.firstPosition = {x: e.pageX, y: e.pageY};
+            <?php
+            // Get the original link in case we need it later.    We can't be 
sure whether
+            // the target was the <a> or the <td> so play safe and get all 
possibilities
+            ?>
+            downHandler.originalLink = 
$(e.target).find('a').andSelf('a').attr('href');
             downHandler.box = $('<div class="div_select">');
             downHandler.box.offset(downHandler.origin);
             $(document.body).append(downHandler.box);
@@ -1635,6 +1641,7 @@
                
         var upHandler = function(e) {
             var box = downHandler.box;
+            var tolerance = 2; <?php // px ?>
             e.preventDefault();
             $(document).unbind('mousemove',moveHandler);
             $(document).unbind('mouseup', upHandler);
@@ -1644,13 +1651,27 @@
             box.remove();
             <?php
             // If the user has released the button while outside the table it 
means
-            // they want to canel, so just return.   Otherwise go to the 
edit_entry
-            // page with the right parameters
+            // they want to canel, so just return. 
             ?>
             if (outsideTable({x: e.pageX, y: e.pageY}))
             {
               return;
             }
+            <?php
+            // If the user has hardly moved the mouse then just treat this as a
+            // traditional click and follow the original link.   This will mean
+            // that things such as the default duration are used.
+            
+            ?>
+            else if ((Math.abs(e.pageX - downHandler.firstPosition.x) <= 
tolerance) &&
+                     (Math.abs(e.pageY - downHandler.firstPosition.y) <= 
tolerance))
+            {
+              window.location = downHandler.originalLink;
+              return;
+            }
+            <?php
+            // Otherwise get the selected parameters and go to the edit_entry 
page
+            ?>
             var queryString = 'area=<?php echo $area ?>';
             queryString += '&start_seconds=' + params.seconds[0];
             queryString += '&end_seconds=' + 
params.seconds[params.seconds.length - 1];
@@ -1677,6 +1698,7 @@
             }
             ?>
             window.location = 'edit_entry.php?' + queryString;
+            return;
           };
 
         <?php

Modified: mrbs/branches/draggable_bookings/web/edit_entry.php
===================================================================
--- mrbs/branches/draggable_bookings/web/edit_entry.php 2011-10-20 08:01:20 UTC 
(rev 2121)
+++ mrbs/branches/draggable_bookings/web/edit_entry.php 2011-10-20 09:14:39 UTC 
(rev 2122)
@@ -136,16 +136,19 @@
 $start_date = get_form_var('start_date', 'string');
 $end_date = get_form_var('end_date', 'string');
 
-$minutes = intval($start_seconds/60);
-if ($enable_periods)
+if (isset($start_seconds))
 {
-  $period = $minutes - (12*60);
+  $minutes = intval($start_seconds/60);
+  if ($enable_periods)
+  {
+    $period = $minutes - (12*60);
+  }
+  else
+  {
+    $hour = intval($minutes/60);
+    $minute = $minutes%60;
+  }
 }
-else
-{
-  $hour = intval($minutes/60);
-  $minute = $minutes%60;
-}
 
 if (isset($start_date))
 {

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


------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Ciosco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to