Bug 302588 Test for valid recurrence values when creating an event. r=mvl npotb

This commit is contained in:
jminta%gmail.com 2005-08-05 20:19:41 +00:00
parent d2d90df8ec
commit 5d9ad19f0e
4 changed files with 50 additions and 4 deletions

View File

@ -388,6 +388,13 @@ function radioGroupIndexOf(radioGroup, id)
return -1; // not found
}
function hasPositiveIntegerValue(elementId)
{
var value = document.getElementById(elementId).value;
if (value && (parseInt(value) == value) && value > 0)
return true;
return false;
}
function debug(text)
{

View File

@ -790,7 +790,34 @@ function checkSetRecur()
recurUntilDate.getMonth() == endDate.getMonth() &&
recurUntilDate.getDate() == endDate.getDate() ) );
setRecurError(untilDateIsBeforeEndDate);
return(!untilDateIsBeforeEndDate);
var missingField = false;
// Make sure the user puts data in all the necessary fields
if (getElementValue("repeat-numberoftimes-radio", "selected") &&
!hasPositiveIntegerValue("repeat-numberoftimes-textbox")) {
setElementValue("repeat-numberoftimes-warning", false, "hidden");
missingField = true;
}
else
setElementValue("repeat-numberoftimes-warning", true, "hidden");
if (getElementValue("repeat-checkbox", "checked")) {
if (!hasPositiveIntegerValue("repeat-length-field")) {
setElementValue("repeat-interval-warning", false, "hidden");
missingField = true;
}
else
setElementValue("repeat-interval-warning", true, "hidden");
}
// If recur isn't selected, there shouldn't be warnings.
else {
missingField = false;
setElementValue("repeat-numberoftimes-warning", true, "hidden");
setElementValue("repeat-interval-warning", true, "hidden");
}
return (!untilDateIsBeforeEndDate && !missingField);
}

View File

@ -550,8 +550,8 @@
<textbox id="repeat-length-field"
class="cursor-pointer"
disable-controller="repeat"
value=""
oninput="repeatLengthKeyDown( this )"/>
value="1"
oninput="repeatLengthKeyDown( this ); commandUntil()"/>
<menulist crop="none"
oncommand="repeatUnitCommand( this )"
labelnumber="label2"
@ -652,6 +652,10 @@
</radiogroup>
</vbox>
</hbox>
<label id="repeat-interval-warning"
class="warning-text-class"
value="&newevent.recurinterval.warning;"
hidden="true"/>
<spacer height="10" />
<hbox align="center">
<spacer class="repeat-left-spacer" />
@ -670,8 +674,14 @@
label="&newevent.numberoftimes.label;"
oncommand="commandUntil()"/>
<textbox id="repeat-numberoftimes-textbox"
disable-controller="repeat"/>
disable-controller="repeat"
value="1"
oninput="commandUntil()"/>
</hbox>
<label id="repeat-numberoftimes-warning"
class="warning-text-class"
value="&newevent.recurnumberoftimes.warning;"
hidden="true"/>
<hbox class="indent">
<radio id="repeat-until-radio"
disable-controller="repeat"

View File

@ -102,6 +102,8 @@
<!ENTITY newevent.enddate.warning "Your start date is after your end date.">
<!ENTITY newevent.repeatdate.tooltip "Choose a date to end on" >
<!ENTITY newevent.recurend.warning "Your repeat-until time is before your end time.">
<!ENTITY newevent.recurnumberoftimes.warning "Your must specify the number of times to repeat.">
<!ENTITY newevent.recurinterval.warning "Your must specify how often to repeat.">
<!ENTITY newevent.endtime.tooltip "Choose an end time for this event" >
<!ENTITY newevent.starttimeerror.alertmessage "Your event cannot end before it has started. Please fix either the start time or the end time." >
<!ENTITY newevent.recurendtimeerror.alertmessage "Your event's repeat time cannot be before the event end time. Please fix this, or disable repeating." >