Revision: 1526
          http://mrbs.svn.sourceforge.net/mrbs/?rev=1526&view=rev
Author:   cimorrison
Date:     2010-10-21 13:57:25 +0000 (Thu, 21 Oct 2010)

Log Message:
-----------
Fixed bug whereby the duration was being shown on the selected start time

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

Modified: mrbs/branches/from_to_bookings/web/Themes/default/header.inc
===================================================================
--- mrbs/branches/from_to_bookings/web/Themes/default/header.inc        
2010-10-21 13:44:45 UTC (rev 1525)
+++ mrbs/branches/from_to_bookings/web/Themes/default/header.inc        
2010-10-21 13:57:25 UTC (rev 1526)
@@ -325,21 +325,26 @@
     // model is different and you are allowed to have the start and 
     // end period the same
     ?>
-    var startIndex = form.start_seconds.selectedIndex;
-    var startValue = parseInt(form.start_seconds.options[startIndex].value);
-    var endIndex = form.end_seconds.selectedIndex;
-    var endValue = parseInt(form.end_seconds.options[endIndex].value);
+    var startSelect = form.start_seconds;
+    var startIndex = startSelect.selectedIndex;
+    var startValue = parseInt(startSelect.options[startIndex].value);
+    
+    var endSelect = form.end_seconds;
+    var endIndex = endSelect.selectedIndex;
+    var endValue = parseInt(endSelect.options[endIndex].value);
+    
     var text, durationText, isSelected, i, j;
     var nbsp = '\u00A0';
     var errorText = '<?php echo get_vocab("start_after_end")?>';
-    var dateDifference = getDateDifference(form);
     
-    form.start_seconds.disabled = (dateDifference < 0);
-    form.end_seconds.disabled = (dateDifference < 0);
+    var dateDifference = getDateDifference(form); 
+    startSelect.disabled = (dateDifference < 0);
+    endSelect.disabled = (dateDifference < 0);
 
-    while (form.start_seconds.options.length > 0)
+    <?php // Destroy and rebuild the start select ?>
+    while (startSelect.options.length > 0)
     {
-      form.start_seconds.remove(0);
+      startSelect.remove(0);
     }
 
     for (i = 0; i < nStartOptions; i++)
@@ -356,18 +361,19 @@
         else
         {
           text = startOptions[i]['text'];
-          if (dateDifference == 0)
+          if ((dateDifference == 0) && !isSelected)
           {
             text = text + nbsp + nbsp + '(' + durationText + ')';
           }
         }
-        form.start_seconds.options[i] = new Option(text, 
startOptions[i]['value'], false, isSelected);
+        startSelect.options[i] = new Option(text, startOptions[i]['value'], 
false, isSelected);
       }
     }
     
-    while (form.end_seconds.options.length > 0)
+    <?php // Destroy and rebuild the end select ?>
+    while (endSelect.options.length > 0)
     {
-      form.end_seconds.remove(0);
+      endSelect.remove(0);
     }
 
     j = 0;
@@ -391,7 +397,7 @@
           }
         }
           
-        form.end_seconds.options[j] = new Option(text, endOptions[i]['value'], 
false, isSelected);
+        endSelect.options[j] = new Option(text, endOptions[i]['value'], false, 
isSelected);
         j++;
       }
     }


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

------------------------------------------------------------------------------
Nokia and AT&T present the 2010 Calling All Innovators-North America contest
Create new apps & games for the Nokia N8 for consumers in  U.S. and Canada
$10 million total in prizes - $4M cash, 500 devices, nearly $6M in marketing
Develop with Nokia Qt SDK, Web Runtime, or Java and Publish to Ovi Store 
http://p.sf.net/sfu/nokia-dev2dev
_______________________________________________
Mrbs-commits mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/mrbs-commits

Reply via email to