"+text[6]+"<\/th>";
- textbox +=" | "+_('Irregularity?')+"<\/a><\/td>\n";
- textbox +=" | <\/td>\n";
+ textbox +=" | <\/td>\n";
textbox +="<\/tr><\/table>\n";
}
@@ -415,12 +519,17 @@ var textbox = '';
function irregularity_check(){
document.f.irreg_check.value = 1; // Irregularity button now pushed
var periodicity = document.f.periodicity.value;
- var rollover = document.f.issuesexpected1.value;
- if(document.f.whenmorethantemp2){
- rollover = document.f.whenmorethantemp2.value;
+ var rollover = document.f.issuesexpected1.value;
+ if( (document.f.whenmorethan2) && ( document.f.whenmorethan2.value > 0) ){
+ rollover = document.f.whenmorethan2.value;
}
- if(document.f.whenmorethantemp3){
- rollover = document.f.whenmorethantemp3.value;
+ if((document.f.whenmorethan3) && document.f.whenmorethan3.value > 0 ){
+ // FIXME: Irregularity check assumes that the full prediction pattern repeats each year.
+ // In cases where the outermost periodicity is > 1 year,
+ // e.g. where a volume spans two years, the irregularity check will be incorrect,
+ // but you can safely ignore the check, submit the form, and the prediction pattern should be correct.
+ // a way to distinguish between these two cases is needed.
+ rollover = document.f.whenmorethan3.value * document.f.whenmorethan2.value;
}
var error='';
var toobig;
@@ -441,13 +550,6 @@ function irregularity_check(){
toobig=1;
}
break;
- case "13":
- if(rollover < 156) expected =156;
- if(rollover > 156) {
- expectedover=156;
- toobig=1;
- }
- break;
case "2":
if(rollover < 52) expected =52;
if(rollover > 52){
@@ -515,66 +617,58 @@ function irregularity_check(){
break;
}
if(expected){
- if(expected == 365 || expected==730){
- var daynames = new Array(_('Monday'),_('Tuesday'),_('Wednesday'),_('Thursday'),_('Friday'),_('Saturday'),_('Sunday'));
+ if(expected == 365 || expected==730){ // what about leap years ?
+ // FIXME: We interpret irregularity as which days per week for periodicity==1.
+ // We need two cases: one in which we're published n days/week, in which case irregularity should be per week,
+ // and a regular daily pub, where irregularity should be per year.
errortext += _("Please indicate which days of the week you DO NOT<\/b> expect to receive issues. ");
- for(var j=0;j"+daynames[j]+" ";
- }
- error=errortext;
} else {
errortext +=expected+_(" issues expected, ")+rollover+_(" were entered. Please indicate which date(s) an issue is not expected ");
- var count=0;
- for(var i=rollover;i\n";
- errortext +=irregular_options(periodicity);
- errortext +="<\/select>\n";
- count++;
- }
- error=errortext;
- }
+ irregular_issues.numskipped = expected - rollover;
+ }
+ errortext +="\n ";
+ error=errortext;
}
if(toobig){
- errortext +=expectedover+_(" issues expected, ")+rollover+_(" were entered. You seem to have indicated more issues per year than expected.");
+ errortext +=expectedover+_(" issues expected, ")+rollover+_(" were entered. You seem to have indicated more issues per year than expected. ");
error=errortext;
}
if(error.length ==0){
- error=_('No irregularities noticed');
+ error=_("No irregularities noticed");
}
- display_example(expected);
+ display_example(expected);
document.getElementById("irregularity").innerHTML = error;
+ irregular_issues.update();
}
function irregular_options(periodicity){
var titles;
var count;
-
- var weeks = new Array();
-
- var months = new Array(_('January'),_('February'),_('March'),_('April'),_('May'),_('June'),_('July'),_('August'),_('September'),_('October'),_('November'),_('December'));
- var seasons = new Array(_('Autumn'),_('Winter'),_('Spring'),_('Summer'),_('Fall'));
var errortext='';
if(periodicity == 1) {
- expected = 366;
- titles = "Day";
+ expected = 7;
+ titles = irregular_issues.daynames;
count = 1;
}
if(periodicity == 2 || periodicity == 3 || periodicity == 4) {
- expected = 52;
-
- titles = weeks;
- count = ;
-
- titles = "Week";
- count = 1;
-
+ titles = irregular_issues.weeks;
+ count = 1;
+ if(periodicity==3) { // 1/2 wks
+ expected = 26;
+ } else if(periodicity == 4) { // 1/3 wks
+ expected = 17;
+ } else {
+ expected = 52;
+ }
}
if(periodicity == 5 || periodicity == 6 || periodicity == 7 || periodicity == 8 || periodicity == 9) {
- if(periodicity == 8) {
+ if(periodicity == 8 && numberpattern==8) {
is_season = 1; // setting up from edit page
}
if(is_season){
- titles = seasons;
+ titles = irregular_issues.seasons;
expected = 4;
if(is_hemisphere == 2){
count = 2;
@@ -582,12 +676,15 @@ function irregular_options(periodicity){
count = 1;
}
} else {
- titles = months;
+ titles = irregular_issues.months;
expected = 12;
count = 1;
}
}
- for(var j=1;j<=expected;j++){
+ if( !expected) {
+ return ''; // don't know how to deal with irregularity.
+ }
+ for(var j=0;jexpected){
count = count-expected;
@@ -598,31 +695,27 @@ function irregular_options(periodicity){
} else if(is_season && is_hemisphere == 2){
errortext +=" |
---|