Revision: 2121
          http://mrbs.svn.sourceforge.net/mrbs/?rev=2121&view=rev
Author:   cimorrison
Date:     2011-10-20 08:01:20 +0000 (Thu, 20 Oct 2011)
Log Message:
-----------
Provided the ability to cancel a click on a new booking by moving outside the 
table

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

Modified: mrbs/branches/draggable_bookings/web/Themes/default/header.inc
===================================================================
--- mrbs/branches/draggable_bookings/web/Themes/default/header.inc      
2011-10-19 22:12:02 UTC (rev 2120)
+++ mrbs/branches/draggable_bookings/web/Themes/default/header.inc      
2011-10-20 08:01:20 UTC (rev 2121)
@@ -1403,6 +1403,17 @@
         
         
         <?php
+        // Tests whether the point p with coordinates x and y is outside the 
table
+        ?>
+        function outsideTable(p)
+        {
+          return ((p.x < tableData.x.data[0].coord) ||
+                  (p.y < tableData.y.data[0].coord) ||
+                  (p.x > tableData.x.data[tableData.x.data.length - 1].coord) 
||
+                  (p.y > tableData.y.data[tableData.y.data.length - 1].coord) 
);
+        }
+        
+        <?php
         // Given 'div', snap the side specified (can be 'left', 'right', 'top' 
or 'bottom') with X or Y
         // coordinate coord to the nearest grid line, if the side is within 
the snapping range.
         // If force is true, then the side is snapped regardless of where it 
is.
@@ -1578,6 +1589,21 @@
           
         var moveHandler = function(e) {
             var box = downHandler.box;
+            <?php 
+            // Check to see if we've moved outside the table and if we have
+            // then give some visual feedback.   If we've moved back into the 
box
+            // remove the feedback.
+            ?>
+            if (outsideTable({x: e.pageX, y: e.pageY}))
+            {
+              box.addClass('outside');
+              moveHandler.outside = true;
+            }
+            else if (moveHandler.outside)
+            {
+              box.removeClass('outside');
+              moveHandler.ourside = false;
+            }
             if (e.pageX < downHandler.origin.left)
             {
               if (e.pageY < downHandler.origin.top)
@@ -1599,7 +1625,7 @@
             }
             box.width(Math.abs(e.pageX - downHandler.origin.left))
             box.height(Math.abs(e.pageY - downHandler.origin.top));
-            boxSides = getSides(box);
+            var boxSides = getSides(box);
             snapToGrid(box, boxSides.n, 'top');
             snapToGrid(box, boxSides.s, 'bottom');
             snapToGrid(box, boxSides.e, 'right');
@@ -1615,6 +1641,16 @@
             <?php // Remove the resizing wrapper so that highlighting comes 
back on ?>
             $('table.dwm_main').unwrap();
             params = getBookingParams(box);
+            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
+            ?>
+            if (outsideTable({x: e.pageX, y: e.pageY}))
+            {
+              return;
+            }
             var queryString = 'area=<?php echo $area ?>';
             queryString += '&start_seconds=' + params.seconds[0];
             queryString += '&end_seconds=' + 
params.seconds[params.seconds.length - 1];
@@ -1640,11 +1676,13 @@
               <?php
             }
             ?>
-            box.remove();
             window.location = 'edit_entry.php?' + queryString;
           };
 
-                
+        <?php
+        // Turn all the empty cells where a new multi-cell selection
+        // can be created by dragging the mouse
+        ?>     
         table.find('td.new').each(function() {
             $(this).find('a').click(function(event) {
                 event.preventDefault();

Modified: mrbs/branches/draggable_bookings/web/mrbs.css.php
===================================================================
--- mrbs/branches/draggable_bookings/web/mrbs.css.php   2011-10-19 22:12:02 UTC 
(rev 2120)
+++ mrbs/branches/draggable_bookings/web/mrbs.css.php   2011-10-20 08:01:20 UTC 
(rev 2121)
@@ -422,8 +422,12 @@
   border: 0;
   opacity: 0.2;
   background-color: <?php echo $main_table_labels_back_color ?>;
-}    
+}
 
+div.div_select.outside {
+  background-color: transparent;
+}   
+
 /* booking privacy status */
 .private {opacity: 0.6; font-style: italic}
 

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