Changeset 1754

Show
Ignore:
Timestamp:
04/28/06 08:37:45 (7 years ago)
Author:
qldrob
Message:

Wrote error checknig code for new time conditions layout. Woot!

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • modules/branches/2.1/timeconditions/page.timeconditions.php

    r1678 r1754  
    5353</div> 
    5454 
    55 <div style="float: right; padding: 5; background: #e0e0ff; border: #2E78A7 solid 1px;"> 
     55<div style="float: right; padding: 5px; background: #e0e0ff; border: #2E78A7 solid 1px;"> 
    5656  <?php echo _("Server time:")?> <span id="idTime">00:00:00</span> 
    5757</div> 
     
    505505function edit_onsubmit() { 
    506506  var msgInvalidTimeCondName = "<?php echo _('Please enter a valid Time Conditions Name'); ?>"; 
    507   var msgInvalidTimeMatch = "<?php echo _('Please enter the Time to Match'); ?>"; 
    508  
    509   setDestinations(edit,2); 
     507  var msgInvalidTimeMatch = "<?php echo _('Please enter the Time to Match, or set all to - to match all times.'); ?>"; 
     508  var msgInvalidDay = "<?php echo _('Please select BOTH or NO days, not just one.'); ?>"; 
     509  var msgInvalidMday = "<?php echo _('Please select BOTH or NO days of the month, not just one.'); ?>"; 
     510  var msgInvalidMth = "<?php echo _('Please select BOTH or NO months, not just one.'); ?>"; 
     511 
    510512   
    511513  defaultEmptyOK = false; 
     
    513515    return warnInvalid(theForm.displayname, msgInvalidTimeCondName); 
    514516   
    515   if (isEmpty(theForm.time.value) || isWhitespace(theForm.time.value)) 
    516     return warnInvalid(theForm.time, msgInvalidTimeMatch); 
     517  // Check to see that they're either all '-' or all numbers. 
     518  if ((theForm.hour_start.value == "-" || theForm.hour_finish.value == "-"  || theForm.minute_start.value == "-" || theForm.minute_finish.value == "-") && (theForm.hour_start.value != "-" || theForm.hour_finish.value != "-"  || theForm.minute_start.value != "-" || theForm.minute_finish.value != "-"))  
     519    return warnInvalid(theForm.displayname, msgInvalidTimeMatch); 
     520 
     521  if ((theForm.wday_start.value == "-" || theForm.wday_finish.value == "-") && (theForm.wday_start.value != "-" ||theForm.wday_finish.value != "-" )) 
     522    return warnInvalid(theForm.displayname, msgInvalidDay); 
     523 
     524  if ((theForm.mday_start.value == "-" || theForm.mday_finish.value == "-") && (theForm.mday_start.value != "-" || theForm.mday_finish.value != "-" )) 
     525    return warnInvalid(theForm.displayname, msgInvalidMday); 
     526 
     527  if ((theForm.month_start.value == "-" || theForm.month_finish.value == "-") && (theForm.month_start.value != "-" || theForm.month_finish.value != "-" )) 
     528    return warnInvalid(theForm.displayname, msgInvalidMth); 
    517529     
    518530  if (!validateDestinations(edit,2,true))