Revision: 2139
          http://mrbs.svn.sourceforge.net/mrbs/?rev=2139&view=rev
Author:   cimorrison
Date:     2011-10-20 21:10:42 +0000 (Thu, 20 Oct 2011)
Log Message:
-----------
Added highlighting of the row labels when you are drag-selecting a new booking 
to make it easier to see what you've selected

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-20 17:28:00 UTC (rev 2138)
+++ mrbs/branches/draggable_bookings/web/Themes/default/header.inc      
2011-10-20 21:10:42 UTC (rev 2139)
@@ -1645,6 +1645,19 @@
           }
           return params;
         }
+        
+        
+        function getRowNumber(y)
+        {
+          for (var i=0; i<tableData.y.data.length - 1; i++)
+          {
+            if (y >= tableData.y.data[i].coord && y < 
tableData.y.data[i+1].coord)
+            {
+              return i;
+            }
+          }
+          return null;
+        }
               
               
         var tableData = {};
@@ -1665,6 +1678,13 @@
             table.find('td').not('td.new, td.row_labels').each(function() {
                 bookedMap.push(getSides($(this)));
               });
+            <?php // Cache the row label cells in an array ?>
+            downHandler.rowLabels = [];
+            downHandler.nRows = 0;
+            table.find('tbody tr').each(function() {
+                downHandler.rowLabels.push($(this).find('td.row_labels'));
+                downHandler.nRows++;
+              });
             <?php // Apply a wrapper to turn off highlighting ?>
             table.wrap('<div class="resizing"><\/div>');
             var jqTarget = $(e.target);
@@ -1716,21 +1736,6 @@
             var oldBoxWidth = box.outerWidth();
             var oldBoxHeight = box.outerHeight();
             
-            <?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.outside = false;
-            }
             <?php
             // Check to see if we're only allowed to go one slot wide/high
             // and have gone over that limit.  If so, do nothing and return
@@ -1775,8 +1780,51 @@
               box.offset(oldBoxOffset)
                  .width(oldBoxWidth)
                  .height(oldBoxHeight);
-              return;
             }
+            <?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}))
+            {
+              if (!moveHandler.outside)
+              {
+                box.addClass('outside');
+                moveHandler.outside = true;
+                <?php // and remove the row highlighting ?>
+                for (var i=0; i<downHandler.nRows; i++)
+                {
+                  downHandler.rowLabels[i].removeClass('selected');
+                }
+              }
+            }
+            else if (moveHandler.outside)
+            {
+              box.removeClass('outside');
+              moveHandler.outside = false;
+            }
+            <?php 
+            // Highlight the corresponding row label cells (provided we are 
+            // inside the table
+            ?>
+            if (!moveHandler.outside)
+            {
+              var boxStartRow = getRowNumber(box.offset().top);
+              var boxEndRow = getRowNumber(box.offset().top + 
box.outerHeight());
+              for (var i=0; i<downHandler.nRows ; i++)
+              {
+                if (((boxStartRow === null) || (boxStartRow <= i)) && 
+                    ((boxEndRow === null) || (i < boxEndRow)))
+                {
+                  downHandler.rowLabels[i].addClass('selected');
+                }
+                else
+                {
+                  downHandler.rowLabels[i].removeClass('selected');
+                }
+              }
+            }
           };
  
                

Modified: mrbs/branches/draggable_bookings/web/mrbs.css.php
===================================================================
--- mrbs/branches/draggable_bookings/web/mrbs.css.php   2011-10-20 17:28:00 UTC 
(rev 2138)
+++ mrbs/branches/draggable_bookings/web/mrbs.css.php   2011-10-20 21:10:42 UTC 
(rev 2139)
@@ -304,7 +304,11 @@
 .resizing .row_labels a:hover {text-decoration: none}
 .resizing .dwm_main tbody tr:hover td.row_labels a:link {color: <?php echo 
$anchor_link_color_header ?>}
 .resizing .dwm_main tbody tr:hover td.row_labels a:visited {color: <?php echo 
$anchor_link_color_header ?>}
+.resizing .dwm_main tr td.row_labels.selected {background-color: <?php echo 
$row_highlight_color ?>}
+.resizing .dwm_main tr td.row_labels.selected a:link {color: <?php echo 
$standard_font_color ?>}
+.resizing .dwm_main tr td.row_labels.selected a:visited {color: <?php echo 
$standard_font_color ?>}
 
+
 .dwm_main .ui-resizable-handle {z-index: 1000}
 .dwm_main .ui-resizable-n {top: -1px}
 .dwm_main .ui-resizable-e {right: -1px}

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@Cisco 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