--- rat/client/parameter.html 2013/01/28 18:17:21 1.65 +++ rat/client/parameter.html 2016/03/15 14:25:41 1.70 @@ -5,7 +5,7 @@ The LearningOnline Network with CAPA Parameter Input Window // -// $Id: parameter.html,v 1.65 2013/01/28 18:17:21 bisitz Exp $ +// $Id: parameter.html,v 1.70 2016/03/15 14:25:41 raeburn Exp $ // // Copyright Michigan State University Board of Trustees // @@ -39,6 +39,8 @@ Parameter Input Window var ptype=''; var pvalue=''; +var pmodval=''; +var pextraval=''; var preturn=''; var pcode=''; var pscat=''; @@ -241,58 +243,66 @@ function month() { function intminute() { var thisminutes=cmins; var i; - choicewrite(''; for (i=0;i<=59;i++) { - choicewrite(''); + result += '>'+i+''; } - choicewrite(''); + result += ''; + return result; } function inthour() { var thishours=chours; var i; - choicewrite(''; for (i=0;i<=23;i++) { - choicewrite(''); + result += '>'+i+''; } - choicewrite(''); + result += ''; + return result; } function intsecond() { - var thisseconds=csecs; + var thisseconds=csecs; var i; - choicewrite(''; for (i=0;i<=59;i++) { - choicewrite(''); + result += '>'+i+''; } - choicewrite(''); + result += ''; + return result; } function intday() { var thisdate=cdays; var i; - choicewrite(''; for (i=0;i<=31;i++) { - choicewrite(''); + result += '>'+i+''; } - choicewrite(''); + result += ''; + return result; } function intcalc() { @@ -301,7 +311,74 @@ function intcalc() { sform.hours.options[sform.hours.selectedIndex].value*1)*60+ sform.minutes.options[sform.minutes.selectedIndex].value*1)*60+ sform.seconds.options[sform.seconds.selectedIndex].value*1; - draw(); + if ((ptype=='date') && (pscat=='interval')) { + var newpmodval = ''; + var newpextraval = ''; + if (sform.donebutton.length) { + for (var i=0; i'); - intervaldis(); - choicewrite('Time:' - +''); - intday();choicewrite('days '); - inthour();choicewrite('hours '); - intminute(); choicewrite('mins '); intsecond(); - choicewrite('secs'); - } else { + choicewrite( [ + ''+intervaldis()+'', + 'Time:', + ''+intday()+' days ', + ''+inthour()+' hours', + ''+intminute()+' mins', + ''+intsecond()+' secs', + '', + '', + '
', + ].join("\n")); + tablestart('Provide a "Done" button to students?'); + choicewrite('Value:'); + choicewrite('
'); + choicewrite('
'); + choicewrite(''+ + ''); + choicewrite(' '); + choicewrite(''); + } else { choicewrite('' +cdate.toString()+ 'Date:'); @@ -832,6 +937,9 @@ function assemble() { function init() { var i; var subs=new Array(); + var doneRegExp = /_done/; + var doneproctorRegExp = /_done_proctor/; + var proctorkeyRegExp = /^(\d+)_(.+)$/; var namevalue=this.window.location.search.split('&'); namevalue[0]=namevalue[0].substr(1,namevalue[0].length-1); @@ -861,6 +969,27 @@ function init() { if (pair[0]=='defsec' && pair[1] >= 0 && pair[1] < 60) { defsec=pair[1]; } } + if (ptype=='date' && pscat == 'interval') { + if (doneproctorRegExp.test(pvalue)) { + pmodval = pvalue.match(doneproctorRegExp); + var intervalwithkey = pvalue.replace(doneproctorRegExp,''); + if (proctorkeyRegExp.test(intervalwithkey)) { + var currvals = intervalwithkey.match(proctorkeyRegExp); + if (currvals.length == 3) { + pvalue = currvals[1]; + pextraval = currvals[2]; + } else { + pmodval = ''; + } + } + } else { + if (doneRegExp.test(pvalue)) { + var pnumval = pvalue.replace(doneRegExp,''); + pmodval = pvalue.match(doneRegExp); + pvalue = pnumval; + } + } + } svalue=pvalue; if (((ptype=='float') || (ptype=='string') || (ptype=='int')) && (pscat=='default') && @@ -900,7 +1029,7 @@ function init() { selwrite(''); selwrite(''); selwrite('
'+pname+'
'); - selwrite(''); if (ptype=='tolerance') { sopt('default','Default'); @@ -982,8 +1111,12 @@ function init() { var targ='parent.opener'; if (pmodal==1) { targ='parent.parent'; - } - selwrite('