version 1.71, 2016/05/13 22:48:14
|
version 1.75, 2016/05/21 22:59:58
|
Line 440 function stringeval() {
|
Line 440 function stringeval() {
|
draw(); |
draw(); |
} |
} |
|
|
|
function ipstringeval() { |
|
var patternIp = /^([\[\]a-zA-Z\.\d\*\-]+)$/; |
|
var acctypes = new Array; |
|
acctypes = ['allow','deny']; |
|
svalue = ''; |
|
for (var i=0; i<acctypes.length; i++) { |
|
var items = choices.document.getElementsByName('setip'+acctypes[i]); |
|
if (items.length > 0) { |
|
for (var j=0; j<items.length; j++) { |
|
if (items[j].type == "text") { |
|
var possip = items[j].value |
|
possip = possip.replace(/^\s+|\s+$/g,''); |
|
if (patternIp.test(possip)) { |
|
if (acctypes[i] == 'deny') { |
|
possip = '!'+possip; |
|
} |
|
if (svalue == '') { |
|
svalue = possip; |
|
} else { |
|
svalue += ','+possip; |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
} |
|
|
|
function addIpRule(iptype) { |
|
var frame = window.frames["choices"]; |
|
if (frame.document.getElementById('LC_string_ipacc_inner_'+iptype)) { |
|
var innerDiv = frame.document.getElementById('LC_string_ipacc_inner_'+iptype); |
|
var count = innerDiv.childNodes.length |
|
var ipDiv = frame.document.createElement('div'); |
|
ipDiv.innerHTML = '<input type="text" size="10" name="setip'+iptype+'" onblur="parent.ipstringeval();" />'+ |
|
'<a href="#" onclick="parent.removeIpRule(\''+iptype+'\',\''+count+'\')">Remove</a>'; |
|
frame.document.getElementById('LC_string_ipacc_inner_'+iptype).appendChild(ipDiv); |
|
} |
|
return false; |
|
} |
|
|
|
function removeIpRule(iptype,num) { |
|
var frame = window.frames["choices"]; |
|
if (frame.document.getElementById('LC_string_ipacc_inner_'+iptype)) { |
|
var innerDiv = frame.document.getElementById('LC_string_ipacc_inner_'+iptype); |
|
for (var i=0; i<innerDiv.childNodes.length; i++) { |
|
if (i==num) { |
|
innerDiv.removeChild(innerDiv.childNodes[i]); |
|
ipstringeval(); |
|
break; |
|
} |
|
} |
|
} |
|
} |
|
|
function radiostringeval(newval) { |
function radiostringeval(newval) { |
svalue=newval; |
svalue=newval; |
draw(); |
draw(); |
Line 449 function callradiostringeval(newval) {
|
Line 504 function callradiostringeval(newval) {
|
return 'onclick="parent.radiostringeval(\''+newval+'\')"'; |
return 'onclick="parent.radiostringeval(\''+newval+'\')"'; |
} |
} |
|
|
|
function lenienteval(newval) { |
|
if (newval == 'weighted') { |
|
if (document.getElementById('lenientweighteddiv')) { |
|
document.getElementById('lenientweighteddiv').style.display='block'; |
|
} |
|
var patternRelWeight = /^\-?[\d.]+$/; |
|
var sform=choices.document.forms.sch; |
|
if ((sform.lenientrelwt.length != 'undefined') && (sform.lenientrelwt.length) != 'null') { |
|
for (var i=0; i<sform.lenientrelwt.length; i++) { |
|
var relweight = sform.lenientrelwt[i].value; |
|
relweight = relweight.replace(/^\s+|\s+$/g,''); |
|
if (!patternRelWeight.test(relweight)) { |
|
if (i<2) { |
|
relweight = '1.0'; |
|
} else { |
|
relweight = '0.0'; |
|
} |
|
} |
|
sform.lenientrelwt[i].value = relweight; |
|
if (i==0) { |
|
svalue = relweight; |
|
} else { |
|
svalue += ','+relweight; |
|
} |
|
} |
|
} |
|
} else { |
|
if (document.getElementById('lenientweighteddiv')) { |
|
document.getElementById('lenientweighteddiv').style.display='none'; |
|
} |
|
svalue=newval; |
|
} |
|
draw(); |
|
} |
|
|
|
function calllenientradioeval(newval) { |
|
return 'onclick="parent.lenienteval(\''+newval+'\')"'; |
|
} |
|
|
function callintervalpmodval() { |
function callintervalpmodval() { |
return 'onclick="parent.intcalc();parent.toggleSecret()"'; |
return 'onclick="parent.intcalc();parent.toggleSecret()"'; |
} |
} |
Line 490 function draw() {
|
Line 584 function draw() {
|
choicewrite(' action="javascript:floateval();"'); |
choicewrite(' action="javascript:floateval();"'); |
} |
} |
if (ptype=='string') { |
if (ptype=='string') { |
choicewrite(' action="javascript:stringeval();"'); |
if (pscat == 'ip') { |
|
choicewrite(' action="javascript:ipstringeval();"'); |
|
} else { |
|
choicewrite(' action="javascript:stringeval();"'); |
|
} |
} |
} |
if (ptype != 'int' && ptype != 'float' && ptype != 'string') { |
if (ptype != 'int' && ptype != 'float' && ptype != 'string') { |
choicewrite(' action=""'); |
choicewrite(' action=""'); |
Line 809 function draw() {
|
Line 907 function draw() {
|
choicewrite(' /> Library</label><br />'); |
choicewrite(' /> Library</label><br />'); |
} |
} |
if (pscat=='lenient') { |
if (pscat=='lenient') { |
|
var patternLenientStd = /^(yes|no|default)$/; |
|
var patternLenientRel = /^([\-\d\.]+)\,([\-\d\.]+)\,([\-\d\.]+)\,([\-\d\.]+)$/; |
|
var lenientweighted = 'none'; |
|
var relatives = new Array; |
tablestart('Lenient Grading (Partial Credit)'); |
tablestart('Lenient Grading (Partial Credit)'); |
choicewrite('<tr><td>Value:</td><td colspan="2">'); |
choicewrite('<tr><td>Value:</td><td colspan="2">'); |
choicewrite('<label><input name="stringval" value="yes"'+ |
choicewrite('<label><input name="stringval" value="yes"'+ |
' type="radio" '+callradiostringeval('yes')); |
' type="radio" '+calllenientradioeval('yes')); |
if (svalue=='yes') { choicewrite(' checked="checked"'); } |
if (svalue=='yes') { choicewrite(' checked="checked"'); } |
choicewrite(' /> Yes</label><br />'); |
choicewrite(' /> Yes</label><br />'); |
choicewrite('<label><input name="stringval" value="no"'+ |
choicewrite('<label><input name="stringval" value="no"'+ |
' type="radio" '+callradiostringeval('no')); |
' type="radio" '+calllenientradioeval('no')); |
if (svalue=='no') { choicewrite(' checked="checked"'); } |
if (svalue=='no') { choicewrite(' checked="checked"'); } |
choicewrite(' /> No</label><br />'); |
choicewrite(' /> No</label><br />'); |
choicewrite('<label><input name="stringval" value="default"'+ |
choicewrite('<label><input name="stringval" value="default"'+ |
' type="radio" '+callradiostringeval('default')); |
' type="radio" '+calllenientradioeval('default')); |
if (svalue=='default') { choicewrite(' checked="checked"'); } |
if (svalue=='default') { choicewrite(' checked="checked"'); } |
choicewrite(' /> Default (only bubblesheet grading is lenient)</label><br />'); |
choicewrite(' /> Default (only bubblesheet grading is lenient)</label><br />'); |
|
choicewrite('<label><input name="stringval" value="weighted"'+ |
|
' type="radio" '+calllenientradioeval('weighted')); |
|
if (!patternLenientStd.test(svalue) && svalue != '') { |
|
choicewrite(' checked="checked"'); |
|
lenientweighted='block'; |
|
var relatives = svalue.match(patternLenientRel); |
|
} |
|
choicewrite(' />Yes, weighted (optionresponse in checkbox mode)</label><br /><br />'+ |
|
'<div id="lenientweighteddiv" style="display:'+lenientweighted+'">'+ |
|
'<table class="LC_parmsel_table"><tr bgcolor="#C5DB99">'+ |
|
'<th colspan="2">Foil submission status</th><th>Points</th></tr>'); |
|
var lenienttypes = ['Correct (checked)','Correct (unchecked)','Incorrect (checked)','Incorrect (unchecked)']; |
|
for (var i=0; i<lenienttypes.length; i++) { |
|
var j = i+1; |
|
if (relatives[j] == '') { |
|
if (i < 2) { |
|
relatives[j] = '1.0'; |
|
} else { |
|
relatives[j] = '0.0'; |
|
} |
|
} |
|
choicewrite('<tr><td colspan="2">'+lenienttypes[i]+'</td>'+ |
|
'<td><input type="text" name="lenientrelwt" value="'+relatives[j]+'"'+ |
|
' size="3" onblur="parent.lenienteval(\'weighted\')" /></td></tr>'); |
|
} |
|
choicewrite('</table></div>'); |
} |
} |
if (pscat=='discussvote') { |
if (pscat=='discussvote') { |
tablestart('Discussion Voting'); |
tablestart('Discussion Voting'); |
Line 841 function draw() {
|
Line 969 function draw() {
|
choicewrite(' /> No</label><br />'); |
choicewrite(' /> No</label><br />'); |
} |
} |
if (pscat=='ip') { |
if (pscat=='ip') { |
tablestart('IP Number/Name'); |
var currallow = new Array; |
choicewrite('<tr><td>Value:</td><td colspan="2">'); |
var currdeny = new Array; |
choicewrite('<input name="stringval" size="20" value="'+escapeHTML(svalue)+ |
if ((svalue != '') && (svalue != null)) { |
'" onchange="parent.stringeval()" />'); |
var patternComma = /,/; |
|
var patternAllow = /^([\[\]a-zA-Z\.\d\*\-]+)$/; |
|
var patternDeny = /^\!([\[\]a-zA-Z\.\d\*\-]+)$/; |
|
var current = new Array; |
|
if (patternComma.test(svalue)) { |
|
current = svalue.split(','); |
|
} else { |
|
current = (svalue); |
|
} |
|
for (var i=0; i<current.length; i++) { |
|
if (patternDeny.test(current[i])) { |
|
var denied = current[i].replace(/^!/,''); |
|
currdeny.push(denied); |
|
} else { |
|
if (patternAllow.test(current[i])) { |
|
currallow.push(current[i]); |
|
} |
|
} |
|
} |
|
} |
|
if (currdeny.length == 0) { |
|
currdeny = (''); |
|
} |
|
if (currallow.length == 0) { |
|
currallow = (''); |
|
} |
|
var curripaccess = [currallow,currdeny]; |
|
tablestart('IP Number/Name'); |
|
choicewrite('<tr><th>Allow from</th><th>Deny from</th></tr><tr>'); |
|
var acctypes = ['allow','deny']; |
|
for (var i=0; i<acctypes.length; i++) { |
|
choicewrite('<td valign="top">'+ |
|
'<div class="LC_string_ipacc_wrap" id="LC_string_ipacc_'+acctypes[i]+'">'+ |
|
'<div class="LC_string_ipacc_inner" id="LC_string_ipacc_inner_'+acctypes[i]+'">'); |
|
for (var j=0; j<curripaccess[i].length; j++) { |
|
choicewrite('<div><input type="text" size="10" name="setip'+acctypes[i]+'" value="'+curripaccess[i][j]+'" onblur="parent.ipstringeval();" />'); |
|
choicewrite('<a href="#" onclick="parent.removeIpRule(\''+acctypes[i]+'\',\''+j+'\')">Remove</a>'); |
|
choicewrite('</div>'); |
|
} |
|
choicewrite('</div><button onclick="parent.addIpRule(\''+acctypes[i]+'\');">Add item</button>'); |
|
} |
|
choicewrite('</div></td></tr></table>'); |
} |
} |
if (pscat=='fileext') { |
if (pscat=='fileext') { |
tablestart('Allowed File Extensions'); |
tablestart('Allowed File Extensions'); |