mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-25 05:41:12 +00:00
Bug 302588 Test for valid recurrence values when creating an event. r=mvl npotb
This commit is contained in:
parent
d2d90df8ec
commit
5d9ad19f0e
@ -388,6 +388,13 @@ function radioGroupIndexOf(radioGroup, id)
|
|||||||
return -1; // not found
|
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)
|
function debug(text)
|
||||||
{
|
{
|
||||||
|
@ -790,7 +790,34 @@ function checkSetRecur()
|
|||||||
recurUntilDate.getMonth() == endDate.getMonth() &&
|
recurUntilDate.getMonth() == endDate.getMonth() &&
|
||||||
recurUntilDate.getDate() == endDate.getDate() ) );
|
recurUntilDate.getDate() == endDate.getDate() ) );
|
||||||
setRecurError(untilDateIsBeforeEndDate);
|
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -550,8 +550,8 @@
|
|||||||
<textbox id="repeat-length-field"
|
<textbox id="repeat-length-field"
|
||||||
class="cursor-pointer"
|
class="cursor-pointer"
|
||||||
disable-controller="repeat"
|
disable-controller="repeat"
|
||||||
value=""
|
value="1"
|
||||||
oninput="repeatLengthKeyDown( this )"/>
|
oninput="repeatLengthKeyDown( this ); commandUntil()"/>
|
||||||
<menulist crop="none"
|
<menulist crop="none"
|
||||||
oncommand="repeatUnitCommand( this )"
|
oncommand="repeatUnitCommand( this )"
|
||||||
labelnumber="label2"
|
labelnumber="label2"
|
||||||
@ -652,6 +652,10 @@
|
|||||||
</radiogroup>
|
</radiogroup>
|
||||||
</vbox>
|
</vbox>
|
||||||
</hbox>
|
</hbox>
|
||||||
|
<label id="repeat-interval-warning"
|
||||||
|
class="warning-text-class"
|
||||||
|
value="&newevent.recurinterval.warning;"
|
||||||
|
hidden="true"/>
|
||||||
<spacer height="10" />
|
<spacer height="10" />
|
||||||
<hbox align="center">
|
<hbox align="center">
|
||||||
<spacer class="repeat-left-spacer" />
|
<spacer class="repeat-left-spacer" />
|
||||||
@ -670,8 +674,14 @@
|
|||||||
label="&newevent.numberoftimes.label;"
|
label="&newevent.numberoftimes.label;"
|
||||||
oncommand="commandUntil()"/>
|
oncommand="commandUntil()"/>
|
||||||
<textbox id="repeat-numberoftimes-textbox"
|
<textbox id="repeat-numberoftimes-textbox"
|
||||||
disable-controller="repeat"/>
|
disable-controller="repeat"
|
||||||
|
value="1"
|
||||||
|
oninput="commandUntil()"/>
|
||||||
</hbox>
|
</hbox>
|
||||||
|
<label id="repeat-numberoftimes-warning"
|
||||||
|
class="warning-text-class"
|
||||||
|
value="&newevent.recurnumberoftimes.warning;"
|
||||||
|
hidden="true"/>
|
||||||
<hbox class="indent">
|
<hbox class="indent">
|
||||||
<radio id="repeat-until-radio"
|
<radio id="repeat-until-radio"
|
||||||
disable-controller="repeat"
|
disable-controller="repeat"
|
||||||
|
@ -102,6 +102,8 @@
|
|||||||
<!ENTITY newevent.enddate.warning "Your start date is after your end date.">
|
<!ENTITY newevent.enddate.warning "Your start date is after your end date.">
|
||||||
<!ENTITY newevent.repeatdate.tooltip "Choose a date to end on" >
|
<!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.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.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.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." >
|
<!ENTITY newevent.recurendtimeerror.alertmessage "Your event's repeat time cannot be before the event end time. Please fix this, or disable repeating." >
|
||||||
|
Loading…
Reference in New Issue
Block a user