version 1.114, 2010/01/20 16:46:23
|
version 1.115, 2010/02/02 05:56:09
|
Line 4839 sub setsections_javascript {
|
Line 4839 sub setsections_javascript {
|
function setSections(formname,crstype) { |
function setSections(formname,crstype) { |
var re1 = /^currsec_/; |
var re1 = /^currsec_/; |
var re2 =/\\W/; |
var re2 =/\\W/; |
|
var trimleading = /^\\s+/; |
|
var trimtrailing = /\\s+\$/; |
var groups = new Array($groupslist); |
var groups = new Array($groupslist); |
for (var i=0;i<formname.elements.length;i++) { |
for (var i=0;i<formname.elements.length;i++) { |
var str = formname.elements[i].name; |
var str = formname.elements[i].name; |
var checkcurr = str.match(re1); |
var checkcurr = str.match(re1); |
if (checkcurr != null) { |
if (checkcurr != null) { |
|
var num = i; |
if ($checkincluded) { |
if ($checkincluded) { |
$rolecode |
$rolecode |
if (role == 'cc' || role == 'co') { |
if (role == 'cc' || role == 'co') { |
Line 4855 function setSections(formname,crstype) {
|
Line 4858 function setSections(formname,crstype) {
|
} else { |
} else { |
var sections = ''; |
var sections = ''; |
var numsec = 0; |
var numsec = 0; |
var sections; |
var fromexisting = new Array(); |
for (var j=0; j<formname.elements[i].length; j++) { |
for (var j=0; j<formname.elements[num].length; j++) { |
if (formname.elements[i].options[j].selected == true ) { |
if (formname.elements[num].options[j].selected == true ) { |
if (formname.elements[i].options[j].value != "") { |
var addsec = formname.elements[num].options[j].value; |
|
if (addsec != "") { |
|
fromexisting.push(addsec); |
if (numsec == 0) { |
if (numsec == 0) { |
if (formname.elements[i].options[j].value != "") { |
sections = addsec; |
sections = formname.elements[i].options[j].value; |
} else { |
numsec ++; |
sections = sections + "," + addsec; |
} |
|
} |
|
else { |
|
sections = sections + "," + formname.elements[i].options[j].value |
|
numsec ++; |
|
} |
} |
|
numsec ++; |
} |
} |
} |
} |
} |
} |
if (numsec > 0) { |
var newsecs = formname.elements[num+1].value; |
if (formname.elements[i+1].value != "" && formname.elements[i+1].value != null) { |
|
sections = sections + "," + formname.elements[i+1].value; |
|
} |
|
} |
|
else { |
|
sections = formname.elements[i+1].value; |
|
} |
|
var newsecs = formname.elements[i+1].value; |
|
var numsplit; |
|
var validsecs = new Array(); |
var validsecs = new Array(); |
|
var validsecstr = ''; |
var badsecs = new Array(); |
var badsecs = new Array(); |
if (newsecs != null && newsecs != "") { |
if (newsecs != null && newsecs != "") { |
numsplit = newsecs.split(/,/g); |
var numsplit; |
|
if (newsecs.indexOf(',') == -1) { |
|
numsplit = new Array(newsecs); |
|
} else { |
|
numsplit = newsecs.split(/,/g); |
|
} |
for (var i=0; i<numsplit.length; i++) { |
for (var i=0; i<numsplit.length; i++) { |
if (re2.test(numsplit[i]) == true) { |
var newsec = numsplit[i]; |
badsecs.push(numsplit[i]); |
newsec = newsec.replace(trimleading,''); |
|
newsec = newsec.replace(trimtrailing,''); |
|
if (re2.test(newsec) == true) { |
|
badsecs.push(newsec); |
} else { |
} else { |
validsecs.push(numsplit[i]); |
if (newsec != '') { |
|
var isnew = 1; |
|
if (fromexisting != null) { |
|
for (var m=0; m<fromexisting.length; m++) { |
|
if (newsec == fromexisting[m]) { |
|
isnew = 0; |
|
} |
|
} |
|
} |
|
if (isnew == 1) { |
|
validsecs.push(newsec); |
|
} |
|
} |
} |
} |
} |
} |
if (badsecs.length > 0) { |
if (badsecs.length > 0) { |
Line 4899 function setSections(formname,crstype) {
|
Line 4912 function setSections(formname,crstype) {
|
} |
} |
numsec = numsec + validsecs.length; |
numsec = numsec + validsecs.length; |
} |
} |
|
|
if ((role == 'st') && (numsec > 1)) { |
if ((role == 'st') && (numsec > 1)) { |
if (crstype == 'Community') { |
if (crstype == 'Community') { |
alert("$alerts{'inea'} $alerts{'youh'} "+numsec+" $alerts{'secs'}\\n$alerts{'plmo'}"); |
alert("$alerts{'inea'} $alerts{'youh'} "+numsec+" $alerts{'secs'}\\n$alerts{'plmo'}"); |
Line 4907 function setSections(formname,crstype) {
|
Line 4919 function setSections(formname,crstype) {
|
alert("$alerts{'inco'} $alerts{'youh'} "+numsec+" $alerts{'secs'}\\n$alerts{'plmo'}"); |
alert("$alerts{'inco'} $alerts{'youh'} "+numsec+" $alerts{'secs'}\\n$alerts{'plmo'}"); |
} |
} |
return; |
return; |
} |
} else { |
else { |
if (validsecs != null) { |
if (numsplit != null) { |
for (var j=0; j<validsecs.length; j++) { |
for (var j=0; j<numsplit.length; j++) { |
if (validsecstr == '' || validsecstr == null) { |
if ((numsplit[j] == 'all') || |
validsecstr = validsecs[j]; |
(numsplit[j] == 'none')) { |
} else { |
alert("'"+numsplit[j]+"' $alerts{'mayn'}\\n$alerts{'plch'}"); |
validsecstr += ','+validsecs[j]; |
|
} |
|
if ((validsecs[j] == 'all') || |
|
(validsecs[j] == 'none')) { |
|
alert("'"+validsecs[j]+"' $alerts{'mayn'}\\n$alerts{'plch'}"); |
return; |
return; |
} |
} |
for (var k=0; k<groups.length; k++) { |
for (var k=0; k<groups.length; k++) { |
if (numsplit[j] == groups[k]) { |
if (validsecs[j] == groups[k]) { |
alert("'"+numsplit[j]+"' $alerts{'mnot'}\\n$alerts{'secn'}"); |
alert("'"+validsecs[j]+"' $alerts{'mnot'}\\n$alerts{'secn'}"); |
return; |
return; |
} |
} |
} |
} |
} |
} |
} |
} |
formname.elements[i+2].value = sections; |
|
} |
} |
|
if ((validsecstr != '') && (validsecstr != null)) { |
|
if (numsec > 0) { |
|
sections = sections + "," + validsecstr; |
|
} else { |
|
sections = validsecstr; |
|
} |
|
} |
|
formname.elements[num+2].value = sections; |
} |
} |
} |
} |
} |
} |