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

Log Message:
-----------
Added a check to see that the start day is not after the end day

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 12:51:20 UTC (rev 1522)
+++ mrbs/branches/from_to_bookings/web/Themes/default/header.inc        
2010-10-21 13:16:59 UTC (rev 1523)
@@ -304,6 +304,7 @@
     var endValue = parseInt(form.end_seconds.options[endIndex].value);
     var text, durationText, isSelected, i, j;
     var nbsp = '\u00A0';
+    var errorText = '<?php echo get_vocab("start_after_end")?>';
     
     <?php
     // Work out whether the start date is before, after or the same
@@ -328,6 +329,9 @@
       }
     }
     
+    form.start_seconds.disabled = (dateDifference < 0);
+    form.end_seconds.disabled = (dateDifference < 0);
+
     while (form.start_seconds.options.length > 0)
     {
       form.start_seconds.remove(0);
@@ -340,11 +344,18 @@
       {
         isSelected = (startOptions[i]['value'] == startValue);
         durationText = getDuration(startOptions[i]['value'], endValue);
-        text = startOptions[i]['text'];
-        if (!isSelected && (dateDifference == 0))
+        if (dateDifference < 0)
         {
-          text = text + nbsp + nbsp + '(' + durationText + ')';
+          text = errorText;
         }
+        else
+        {
+          text = startOptions[i]['text'];
+          if (dateDifference == 0)
+          {
+            text = text + nbsp + nbsp + '(' + durationText + ')';
+          }
+        }
         form.start_seconds.options[i] = new Option(text, 
startOptions[i]['value'], false, isSelected);
       }
     }
@@ -362,11 +373,19 @@
       {
         isSelected = (endOptions[i]['value'] == endValue);
         durationText = getDuration(startValue, endOptions[i]['value']);
-        text = endOptions[i]['text'];
-        if (dateDifference == 0)
+        if (dateDifference < 0)
         {
-          text = text + nbsp + nbsp + '(' + durationText + ')';
+          text = errorText;
         }
+        else
+        {
+          text = endOptions[i]['text'];
+          if (dateDifference == 0)
+          {
+            text = text + nbsp + nbsp + '(' + durationText + ')';
+          }
+        }
+          
         form.end_seconds.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