Monotone-Parent: 777b207d77d598bd67693cff03a72a05da47bdd0

Monotone-Revision: 252f24f39a4b52374651e35bc9542a9ce32f6183

Monotone-Author: wsourdeau@inverse.ca
Monotone-Date: 2009-03-24T20:37:30
Monotone-Branch: ca.inverse.sogo
This commit is contained in:
Wolfgang Sourdeau 2009-03-24 20:37:30 +00:00
parent 9b8ecdda16
commit b6706ba54c

View file

@ -270,18 +270,46 @@ function handleMonthlyRecurrence() {
return validate; return validate;
} }
function validateYearlyRecurrence() {
var errors = ["Please specify a numerical value in the Year(s)"
+ " field greater or equal to 1.",
"Please specify a numerical value in the month day"
+ " field greater or equal to 1."];
var errorToShow = 0;
var fieldValue = "" + $('yearlyYearsField').value;
if (fieldValue.length > 0) {
// We check if the yearlyYearsField really contains an integer
var v = parseInt(fieldValue);
if (!isNaN(v) && v > 0) {
errorToShow = 1;
fieldValue = "" + $('yearlyDayField').value;
if (fieldValue.length > 0) {
// We check if the yearlyYearsField really contains an integer
var v = parseInt(fieldValue);
if (!isNaN(v) && v > 0) {
errorToShow = -1;
}
}
}
}
if (errorToShow > -1)
window.alert(errors[errorToShow]);
return (errorToShow == -1);
}
function handleYearlyRecurrence() { function handleYearlyRecurrence() {
var validate = false; var validate = false;
var radioValue = $('recurrence_form').getRadioValue('yearlyRadioButtonName'); var radioValue = $('recurrence_form').getRadioValue('yearlyRadioButtonName');
// FIXME - right now we do not support rules // FIXME - right now we do not support rules
// such as Every Second Tuesday of February // such as Every Second Tuesday of February
if (radioValue == 1) if (radioValue == 1)
window.alert("This type of recurrence is currently unsupported."); window.alert("This type of recurrence is currently unsupported.");
else { else {
var showError = true; if (validateYearlyRecurrence()) {
var fieldValue = "" + $('yearlyYearsField').value; var fieldValue = "" + $('yearlyYearsField').value;
if (fieldValue.length > 0) { if (fieldValue.length > 0) {
// We check if the yearlyYearsField really contains an integer // We check if the yearlyYearsField really contains an integer
@ -298,9 +326,9 @@ function handleYearlyRecurrence() {
parent$("repeat7").value = $('yearlyMonth2').value; parent$("repeat7").value = $('yearlyMonth2').value;
} }
} }
}
if (showError) else
window.alert("Please specify a numerical value in the Year(s) field greater or equal to 1."); validate = false;
} }
return validate; return validate;