1: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"
2: "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">
3: <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
4: <!--
5: The LearningOnline Network with CAPA
6: Parameter Input Window
7: //
8: // $Id: parameter.html,v 1.70 2016/03/15 14:25:41 raeburn Exp $
9: //
10: // Copyright Michigan State University Board of Trustees
11: //
12: // This file is part of the LearningOnline Network with CAPA (LON-CAPA).
13: //
14: // LON-CAPA is free software; you can redistribute it and/or modify
15: // it under the terms of the GNU General Public License as published by
16: // the Free Software Foundation; either version 2 of the License, or
17: // (at your option) any later version.
18: //
19: // LON-CAPA is distributed in the hope that it will be useful,
20: // but WITHOUT ANY WARRANTY; without even the implied warranty of
21: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22: // GNU General Public License for more details.
23: //
24: // You should have received a copy of the GNU General Public License
25: // along with LON-CAPA; if not, write to the Free Software
26: // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27: //
28: // /home/httpd/html/adm/gpl.txt
29: //
30: // http://www.lon-capa.org/
31: //
32: -->
33: <head>
34: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
35: <title>LON-CAPA</title>
36:
37: <script type="text/javascript">
38: // <![CDATA[
39:
40: var ptype='';
41: var pvalue='';
42: var pmodval='';
43: var pextraval='';
44: var preturn='';
45: var pcode='';
46: var pscat='';
47: var pmarker='';
48: var pmodal='';
49: var pname='';
50:
51: var defhour=0;
52: var defmin=0;
53: var defsec=0;
54:
55: var svalue;
56: var stype;
57: var smarker;
58:
59: var vars=new Array();
60:
61: var cdate=new Date();
62:
63: var csec;
64: var cmin;
65: var chour;
66: var cday;
67:
68: var months=new Array();
69:
70:
71: function selwrite(text) {
72: this.window.selector.document.write(text);
73: }
74:
75: function choicestart() {
76: this.window.choices.document.open();
77: choicewrite('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
78: choicewrite('<html xmlns="http://www.w3.org/1999/xhtml">');
79: choicewrite('<head>');
80: choicewrite('<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />');
81: choicewrite('<title>LON-CAPA</title>');
82: choicewrite('<style type="text/css">');
83: choicewrite('<!--');
84: choicewrite('body {');
85: choicewrite('font-family: Verdana,Arial,Helvetica,sans-serif;');
86: choicewrite('line-height:130%;');
87: choicewrite('font-size:0.83em;');
88: choicewrite('background: #FFFFFF;');
89: choicewrite('}');
90: choicewrite('table.LC_parmsel_table {font-size: 90%;}');
91: choicewrite('table.LC_parmsel_table tr td { padding: 5px; border: 1px solid #C8C8C8;}');
92: choicewrite('-->');
93: choicewrite('</style>');
94: choicewrite('</head>');
95: choicewrite('<body>');
96: }
97:
98: function choiceend() {
99: choicewrite('</body></html>');
100: this.window.choices.document.close();
101: }
102:
103: function choicewrite(text) {
104: this.window.choices.document.write(text);
105: }
106:
107: function tablestart(headtext) {
108: choicewrite('<table class="LC_parmsel_table"><tr bgcolor="#C5DB99"><th colspan="3">'+
109: headtext+'</th></tr>');
110: }
111:
112: function valline(text,id1,id2) {
113: choicewrite('<tr><td>'+text+
114: '</td><td><input type="text" size="4" name="val'+
115: id1+'" /></td><td>incl:<input type="checkbox" name="val'+
116: id2+'" /></td></tr>');
117: }
118:
119: function escapeHTML(text) {
120: text = text.replace(/&/g, '&');
121: text = text.replace(/"/g, '"');
122: text = text.replace(/</g, '<');
123: text = text.replace(/>/g, '>');
124: return text;
125: }
126:
127: function datecalc() {
128: var sform=choices.document.forms.sch;
129:
130: cdate.setHours(sform.hours.options[sform.hours.selectedIndex].value);
131: cdate.setMinutes(sform.minutes.options[sform.minutes.selectedIndex].value);
132: cdate.setSeconds(sform.minutes.options[sform.seconds.selectedIndex].value);
133: cdate.setDate(sform.date.options[sform.date.selectedIndex].value);
134: cdate.setMonth(sform.month.options[sform.month.selectedIndex].value);
135: cdate.setFullYear(sform.year.options[sform.year.selectedIndex].value);
136:
137: draw();
138: }
139:
140: function hour() {
141: var thishour=cdate.getHours();
142: var i; var j;
143: choicewrite('<select name="hours" onchange="parent.datecalc();">');
144: for (i=0;i<=23;i++) {
145: choicewrite('<option value="'+i+'"');
146: if (i==thishour) {
147: choicewrite(' selected="selected"');
148: }
149: choicewrite('>');
150: if (i==12) { choicewrite('noon'); } else {
151: if (i==0) { choicewrite('midnight') } else {
152:
153: if (i<12) { choicewrite(i+' am'); } else {
154: j=i-12; choicewrite(j+' pm');
155: }
156:
157: }
158: }
159: choicewrite('</option>');
160: }
161: choicewrite('</select>');
162: }
163:
164: function minute() {
165: var thisminutes=cdate.getMinutes();
166: var i;
167: choicewrite('<select name="minutes" onchange="parent.datecalc();">');
168: for (i=0;i<=59;i++) {
169: choicewrite('<option value="'+i+'"');
170: if (i==thisminutes) {
171: choicewrite(' selected="selected"');
172: }
173: choicewrite('>'+i+'</option>');
174: }
175: choicewrite('</select>');
176: }
177:
178: function second() {
179: var thisseconds=cdate.getSeconds();
180: var i;
181: choicewrite('<select name="seconds" onchange="parent.datecalc();">');
182: for (i=0;i<=59;i++) {
183: choicewrite('<option value="'+i+'"');
184: if (i==thisseconds) {
185: choicewrite(' selected="selected"');
186: }
187: choicewrite('>'+i+'</option>');
188: }
189: choicewrite('</select>');
190: }
191:
192:
193: function date() {
194: var thisdate=cdate.getDate();
195: var i;
196: choicewrite('<select name="date" onchange="parent.datecalc();">');
197: for (i=1;i<=31;i++) {
198: choicewrite('<option value="'+i+'"');
199: if (i==thisdate) {
200: choicewrite(' selected="selected"');
201: }
202: choicewrite('>'+i+'</option>');
203: }
204: choicewrite('</select>');
205: }
206:
207: function year() {
208: var thisyear=cdate.getFullYear();
209: var nowdate=new Date();
210: var nowyear=nowdate.getFullYear();
211: if ( !thisyear ) { thisyear=nowyear; }
212: var loweryear=thisyear-2;
213: var upperyear=thisyear+5;
214: if (thisyear>nowyear) { loweryear=nowyear-2; }
215: if (thisyear<nowyear) { upperyear=nowyear+5; }
216: var i;
217: choicewrite('<select name="year" onchange="parent.datecalc();">');
218: for (i=loweryear;i<=upperyear;i++) {
219: choicewrite('<option value="'+i+'"');
220: if (i==thisyear) {
221: choicewrite(' selected="selected"');
222: }
223: choicewrite('>'+i+'</option>');
224: }
225: choicewrite('</select>');
226: }
227:
228: function month() {
229: var thismonth=cdate.getMonth();
230: var i;
231: choicewrite('<select name="month" onchange="parent.datecalc();">');
232: for (i=0;i<=11;i++) {
233: choicewrite('<option value="'+i+'"');
234: if (i==thismonth) {
235: choicewrite(' selected="selected"');
236: }
237: choicewrite('>'+months[i]+'</option>');
238: }
239: choicewrite('</select>');
240: }
241:
242:
243: function intminute() {
244: var thisminutes=cmins;
245: var i;
246: var result = '';
247: result += '<select name="minutes" onchange="parent.intcalc();">';
248: for (i=0;i<=59;i++) {
249: result += '<option value="'+i+'"';
250: if (i==thisminutes) {
251: result += ' selected="selected"';
252: }
253: result += '>'+i+'</option>';
254: }
255: result += '</select>';
256: return result;
257: }
258:
259: function inthour() {
260: var thishours=chours;
261: var i;
262: var result = '';
263: result += '<select name="hours" onchange="parent.intcalc();">';
264: for (i=0;i<=23;i++) {
265: result += '<option value="'+i+'"';
266: if (i==thishours) {
267: result += ' selected="selected"';
268: }
269: result += '>'+i+'</option>';
270: }
271: result += '</select>';
272: return result;
273: }
274:
275: function intsecond() {
276: var thisseconds=csecs;
277: var i;
278: var result = '';
279: result += '<select name="seconds" onchange="parent.intcalc();">';
280: for (i=0;i<=59;i++) {
281: result += '<option value="'+i+'"';
282: if (i==thisseconds) {
283: result += ' selected="selected"';
284: }
285: result += '>'+i+'</option>';
286: }
287: result += '</select>';
288: return result;
289: }
290:
291:
292: function intday() {
293: var thisdate=cdays;
294: var i;
295: var result ='';
296: result += '<select name="date" onchange="parent.intcalc();">';
297: for (i=0;i<=31;i++) {
298: result += '<option value="'+i+'"';
299: if (i==thisdate) {
300: result += ' selected="selected"';
301: }
302: result += '>'+i+'</option>';
303: }
304: result += '</select>';
305: return result;
306: }
307:
308: function intcalc() {
309: var sform=choices.document.forms.sch;
310: svalue=((sform.date.options[sform.date.selectedIndex].value*24+
311: sform.hours.options[sform.hours.selectedIndex].value*1)*60+
312: sform.minutes.options[sform.minutes.selectedIndex].value*1)*60+
313: sform.seconds.options[sform.seconds.selectedIndex].value*1;
314: if ((ptype=='date') && (pscat=='interval')) {
315: var newpmodval = '';
316: var newpextraval = '';
317: if (sform.donebutton.length) {
318: for (var i=0; i<sform.donebutton.length; i++) {
319: if (sform.donebutton[i].checked) {
320: if (sform.donebutton[i].value == '_done') {
321: newpmodval = sform.donebutton[i].value;
322: } else {
323: if (sform.donebutton[i].value == '_done_proctor') {
324: newpmodval = sform.donebutton[i].value;
325: newpextraval = sform.donebutton_proctorkey.value;
326: }
327: }
328: }
329: }
330: }
331: pmodval = newpmodval;
332: pextraval = newpextraval;
333: draw();
334: if (pmodval) {
335: svalue += pmodval;
336: }
337: if (pextraval != '') {
338: svalue += '_'+pextraval;
339: }
340: } else {
341: draw();
342: }
343: }
344:
345: function toggleSecret() {
346: var sform=choices.document.forms.sch;
347: if (sform.donebutton.length) {
348: for (var i=0; i<sform.donebutton.length; i++) {
349: if (sform.donebutton[i].checked) {
350: if (sform.donebutton[i].value == '_done_proctor') {
351: if (document.getElementById('done_proctorkey')) {
352: document.getElementById('done_proctorkey').type='text';
353: }
354: } else {
355: if (document.getElementById('done_proctorkey')) {
356: document.getElementById('done_proctorkey').type='hidden';
357: document.getElementById('done_proctorkey').value='';
358: }
359: }
360: }
361: }
362: }
363: }
364:
365: function validateInterval() {
366: var sform=choices.document.forms.sch;
367: if (sform.donebutton.length) {
368: for (var i=0; i<sform.donebutton.length; i++) {
369: if (sform.donebutton[i].checked) {
370: if (sform.donebutton[i].value == '_done_proctor') {
371: if ((sform.donebutton_proctorkey.value == '') ||
372: (sform.donebutton_proctorkey.value == null)) {
373: alert('Please provide a key for a proctor to enter when a student uses the "Done" button.');
374: return;
375: }
376: }
377: }
378: }
379: }
380: intcalc();
381: assemble();
382: }
383:
384: function integereval() {
385: svalue=choices.document.forms.sch.intval.value;
386: svalue=Math.round(svalue);
387: if (pscat=='zeropos') { svalue=Math.abs(svalue); }
388: if ((pscat=='pos') && (svalue==0)) {
389: svalue='';
390: }
391: if (pscat.indexOf('inrange')!=-1) {
392: var rangeparts=new Array;
393: rangeparts=split('_',pscat);
394: rangeparts=split(',',rangeparts[1]);
395: if (svalue<rangeparts[0]) { svalue=rangeparts[0]; }
396: if (svalue>rangeparts[1]) { svalue=rangeparts[1]; }
397: }
398: draw();
399: }
400:
401: function floateval() {
402: svalue=choices.document.forms.sch.floatval.value;
403: svalue=1.0*svalue;
404: if (pscat=='pos') { svalue=Math.abs(svalue); }
405: if ((pscat=='zeroone') && ((svalue<0) || (svalue>1))) {
406: svalue='';
407: }
408: draw();
409: }
410:
411: function stringeval() {
412: svalue=choices.document.forms.sch.stringval.value;
413: draw();
414: }
415:
416: function radiostringeval(newval) {
417: svalue=newval;
418: draw();
419: }
420:
421: function callradiostringeval(newval) {
422: return 'onclick="parent.radiostringeval(\''+newval+'\')"';
423: }
424:
425: function callintervalpmodval() {
426: return 'onclick="parent.intcalc();parent.toggleSecret()"';
427: }
428:
429: function intervaldis() {
430: csecs=svalue;
431: cdays=Math.floor(csecs/86400);
432: csecs-=cdays*86400;
433: chours=Math.floor(csecs/3600);
434: csecs-=chours*3600;
435: cmins=Math.floor(csecs/60);
436: csecs-=cmins*60;
437: return cdays+' days '+chours+' hours '+cmins+' mins '+csecs+' secs';
438: }
439:
440: function pickcolor(picked) {
441: svalue=picked;
442: draw();
443: }
444:
445: function colorfield(ir,ig,ib) {
446: var col=new Array;
447: col=["00","11","22","44","66","88","AA","CC","DD","EE","FF"];
448: var color='#'+col[ir]+col[ig]+col[ib];
449: var selection="<font color='"+color+"'>X</font>";
450: if (color==svalue) { selection="<font color='#"+col[10-ir]+col[10-ig]+col[10-ib]+"'>X</font>"; }
451: choicewrite('<td bgcolor="'+color+'"><a href="javascript:parent.pickcolor('+"'"+
452: color+"'"+')">'+selection+'</a></td>');
453:
454: }
455:
456: function draw() {
457: choicestart();
458: choicewrite('<form name="sch"');
459: if (ptype=='int') {
460: choicewrite(' action="javascript:integereval();"');
461: }
462: if (ptype=='float') {
463: choicewrite(' action="javascript:floateval();"');
464: }
465: if (ptype=='string') {
466: choicewrite(' action="javascript:stringeval();"');
467: }
468: if (ptype != 'int' && ptype != 'float' && ptype != 'string') {
469: choicewrite(' action=""');
470: }
471: choicewrite('>');
472: if (ptype=='tolerance') {
473: // 0: pscat
474: if (pscat=='default') {
475: tablestart('Use default value or algorithm of resource');
476: }
477: if (pscat=='relative_sym') {
478: // 2: percentage
479: // 3: open
480: tablestart('Percentage error, symmetric around value');
481: valline('Percentage',2,3);
482: if ((svalue!='') && (typeof(svalue)!="undefined")) {
483: choices.document.forms.sch.val2.value=parseInt(svalue);
484: if (svalue.indexOf('+')!=-1) {
485: choices.document.forms.sch.val3.checked=true;
486: }
487: }
488: }
489: if (pscat=='relative') {
490: // 2: left
491: // 3: open
492: // 4: right
493: // 5: open
494: tablestart('Percentage error, asymmetric around value');
495: valline('Upper percentage',2,3);
496: valline('Lower percentage',4,5);
497: var range1=new Array;
498: if ((svalue!='') && (typeof(svalue)!="undefined")) {
499: range1=svalue.split(',');
500: if (typeof(range1[1])=='undefined') { range1[1]=range1[0]; }
501: choices.document.forms.sch.val2.value=parseFloat(range1[0]);
502: if (range1[0].indexOf('+')!=-1) {
503: choices.document.forms.sch.val3.checked=true;
504: }
505: choices.document.forms.sch.val4.value=parseFloat(range1[1]);
506: if (range1[1].indexOf('+')!=-1) {
507: choices.document.forms.sch.val5.checked=true;
508: }
509: }
510: }
511: if (pscat=='absolute_sym') {
512: tablestart('Absolute error, symmetric around value');
513: valline('Value',2,3);
514: if ((svalue!='') && (typeof(svalue)!="undefined")) {
515: choices.document.forms.sch.val2.value=parseFloat(svalue);
516: if (svalue.indexOf('+')!=-1) {
517: choices.document.forms.sch.val3.checked=true;
518: }
519: }
520: }
521: if (pscat=='absolute') {
522: tablestart('Absolute error, asymmetric around value');
523: valline('Upper value',2,3);
524: valline('Lower value',4,5);
525: var range2=new Array;
526: if ((svalue!='') && (typeof(svalue)!="undefined")) {
527: range=svalue.split(',');
528: if (typeof(range2[1])=='undefined') { range2[1]=range2[0]; }
529: choices.document.forms.sch.val2.value=parseFloat(range2[0]);
530: if (range2[0].indexOf('+')!=-1) {
531: choices.document.forms.sch.val3.checked=true;
532: }
533: choices.document.forms.sch.val4.value=parseFloat(range2[1]);
534: if (range2[1].indexOf('+')!=-1) {
535: choices.document.forms.sch.val5.checked=true;
536: }
537: }
538: }
539: }
540:
541: if (ptype=='date') {
542: if (pscat=='default') {
543: tablestart('Default value or none');
544: choicewrite('</table>');
545: } else {
546: if (pscat=='start') {
547: tablestart('Date and time');
548: }
549: if (pscat=='end') {
550: tablestart('Date and time');
551: }
552: if (pscat=='interval') {
553: var proctorkeytype = 'hidden';
554: if (pmodval == '_done_proctor') {
555: proctorkeytype = 'text';
556: }
557: tablestart('Time interval');
558: choicewrite( [
559: '<tr><td colspan="3">'+intervaldis()+'</td></tr>',
560: '<tr><td>Time:</td><td colspan="2">',
561: '<span style="white-space:nowrap">'+intday()+' days </span>',
562: '<span style="white-space:nowrap">'+inthour()+' hours</span>',
563: '<span style="white-space:nowrap">'+intminute()+' mins</span>',
564: '<span style="white-space:nowrap">'+intsecond()+' secs</span>',
565: '</td></tr>',
566: '</table>',
567: '<br />',
568: ].join("\n"));
569: tablestart('Provide a "Done" button to students?');
570: choicewrite('<tr><td>Value:</td><td colspan="2">');
571: choicewrite('<label><input name="donebutton" value=""'+
572: ' type="radio" '+callintervalpmodval());
573: if (pmodval == '') { choicewrite(' checked="checked"'); }
574: choicewrite(' /> No</label><br />');
575: choicewrite('<label><input name="donebutton" value="_done"'+
576: ' type="radio" '+callintervalpmodval());
577: if (pmodval == '_done') { choicewrite(' checked="checked"'); }
578: choicewrite(' /> Yes</label><br />');
579: choicewrite('<span style="white-space:nowrap">'+
580: '<label><input name="donebutton" value="_done_proctor"'+
581: ' type="radio" '+callintervalpmodval());
582: if (pmodval == '_done_proctor') { choicewrite(' checked="checked"'); }
583: choicewrite(' /> Yes, with proctor key</label>');
584: choicewrite(' <input name="donebutton_proctorkey" value='+
585: '"'+escapeHTML(pextraval)+'" type="'+proctorkeytype+
586: '" id="done_proctorkey"'+' size="10"'+
587: ' onblur="parent.intcalc();" /></span>');
588: choicewrite('</td></tr></table>');
589: } else {
590: choicewrite('<tr><td colspan="3">'
591: +cdate.toString()+
592: '</td></tr><tr><td>Date:</td><td colspan="2">');
593: month();date();year();
594: choicewrite('</td></tr><tr><td>Time:'
595: +'</td><td colspan="2">');hour();choicewrite('h ');minute();
596: choicewrite('m ');second();
597: choicewrite('s</td></tr></table>');
598: }
599: }
600: }
601:
602: if (ptype=='int') {
603: var pscatparts=new Array;
604: pscatparts=pscat.split(',');
605: pscat=pscatparts[0];
606: if (pscat=='default') {
607: tablestart('Default value or none');
608: choicewrite('</table>');
609: } else {
610: if (pscat=='range') {
611: tablestart('Integer range');
612: choicewrite('<tr><td>Lower Value:'+
613: '</td><td colspan="2"><input type="text" size="4" name="val2'+
614: '" /></td></tr>');
615: choicewrite('<tr><td>Upper Value:'+
616: '</td><td colspan="2"><input type="text" size="4" name="val4'+
617: '" /></td></tr></table>');
618: var range=new Array;
619: if ((svalue!='') && (typeof(svalue)!="undefined")) {
620: range=svalue.split(',');
621: if (typeof(range[1])=='undefined') { range[1]=range[0]; }
622: choices.document.forms.sch.val2.value=parseInt(range[0]);
623: choices.document.forms.sch.val4.value=parseInt(range[1]);
624: }
625: } else {
626: if (pscat=='pos') {
627: tablestart('Positive (non-zero) integer');
628: }
629: if (pscat=='zeropos') {
630: tablestart('Positive integer or zero');
631: }
632: if (pscat.indexOf('inrange')!=-1) {
633: var rangeparts=new Array;
634: rangeparts=split(',',pscat);
635: tablestart('Integer in the range ['+rangeparts[1]+']');
636: }
637: if (pscat=='any') {
638: tablestart('Integer');
639: }
640: choicewrite('<tr><td>Value:</td><td colspan="2">');
641: choicewrite('<input name="intval" size="10" value="'+escapeHTML(svalue)+
642: '" onchange="parent.integereval()" />');
643: choicewrite('</td></tr></table>');
644: }
645: }
646: }
647:
648: if (ptype=='float') {
649: if (pscat=='default') {
650: tablestart('Default value or none');
651: choicewrite('</table>');
652: } else {
653: if (pscat=='pos') {
654: tablestart('Positive floating point number or zero');
655: }
656: if (pscat=='zeroone') {
657: tablestart('Floating point number between zero and one');
658: }
659: if (pscat=='any') {
660: tablestart('Floating point number');
661: }
662: choicewrite('<tr><td>Value:</td><td colspan="2">');
663: choicewrite('<input name="floatval" size="10" value="'+escapeHTML(svalue)+
664: '" onchange="parent.floateval()" />');
665: choicewrite('</td></tr></table>');
666: }
667: }
668:
669: if (ptype=='string') {
670: if ((pscat=='any') || (pscat=='') || (pscat=='default') ||
671: (typeof(pscat)=='undefined')) {
672: tablestart('Text');
673: choicewrite('<tr><td>Value:</td><td colspan="2">');
674: choicewrite('<input name="stringval" size="20" value="'+escapeHTML(svalue)+
675: '" type="text" onchange="parent.stringeval()" />');
676: }
677: if (pscat=='yesno') {
678: tablestart('Yes/No');
679: choicewrite('<tr><td>Value:</td><td colspan="2">');
680: choicewrite('<label><input name="stringval" value="yes"'+
681: ' type="radio" '+callradiostringeval('yes'));
682: if (svalue=='yes') { choicewrite(' checked="checked"'); }
683: choicewrite(' /> Yes</label><br />');
684: choicewrite('<label><input name="stringval" value="no"'+
685: ' type="radio" '+callradiostringeval('no'));
686: if (svalue=='no') { choicewrite(' checked="checked"'); }
687: choicewrite(' /> No</label><br />');
688: }
689: if (pscat=='problemstatus') {
690: tablestart('Problem Status');
691: choicewrite('<tr><td>Value:</td><td colspan="2">');
692: choicewrite('<label><input name="stringval" value="yes"'+
693: ' type="radio" '+callradiostringeval('yes'));
694: if (svalue=='yes') { choicewrite(' checked="checked"'); }
695: choicewrite(' /> Yes</label><br />');
696: choicewrite('<label><input name="stringval" value="answer"'+
697: ' type="radio" '+callradiostringeval('answer'));
698: if (svalue=='answer') { choicewrite(' checked="checked"'); }
699: choicewrite(' /> Yes, and show correct answer if they exceed the maximum number of tries.</label><br />');
700: choicewrite('<label><input name="stringval" value="no"'+
701: ' type="radio" '+callradiostringeval('no'));
702: if (svalue=='no') { choicewrite(' checked="checked"'); }
703: choicewrite(' /> No, don\'t show correct/incorrect feedback.</label><br />');
704: choicewrite('<label><input name="stringval" value="no_feedback_ever"'+
705: ' type="radio" '+callradiostringeval('no_feedback_ever'));
706: if (svalue=='no_feedback_ever') { choicewrite(' checked="checked"'); }
707: choicewrite(' /> No, show no feedback at all.</label><br />');
708: }
709: if (pscat=='examtype') {
710: tablestart('Exam Type');
711: choicewrite('<tr><td>Value:</td><td colspan="2">');
712: choicewrite('<label><input name="stringval" value="online"'+
713: ' type="radio" '+callradiostringeval('online'));
714: if (svalue=='online') { choicewrite(' checked="checked"'); }
715: choicewrite(' /> Online</label><br />');
716: choicewrite('<label><input name="stringval" value="checkout"'+
717: ' type="radio" '+callradiostringeval('checkout'));
718: if (svalue=='checkout') { choicewrite(' checked="checked"'); }
719: choicewrite(' /> Check out</label><br />');
720: }
721: if (pscat=='questiontype') {
722: tablestart('Question Type');
723: choicewrite('<tr><td>Value:</td><td colspan="2">');
724: choicewrite('<label><input name="stringval" value="problem"'+
725: ' type="radio" '+callradiostringeval('problem'));
726: if (svalue=='problem') { choicewrite(' checked="checked"'); }
727: choicewrite(' /> Standard Problem</label><br />');
728: // choicewrite('<label><input name="stringval" value="quiz"'+
729: // ' type="radio" '+callradiostringeval('quiz'));
730: // if (svalue=='quiz') { choicewrite(' checked="checked"'); }
731: // choicewrite(' /> Quiz</label><br />');
732: choicewrite('<label><input name="stringval" value="practice"'+
733: ' type="radio" '+callradiostringeval('practice'));
734: if (svalue=='practice') { choicewrite(' checked="checked"'); }
735: choicewrite(' /> Practice</label><br />');
736: choicewrite('<label><input name="stringval" value="exam"'+
737: ' type="radio" '+callradiostringeval('exam'));
738: if (svalue=='exam') { choicewrite(' checked="checked"'); }
739: choicewrite(' /> Bubblesheet Exam</label><br />');
740: // choicewrite('<label><input name="stringval" value="assess"'+
741: // ' type="radio" '+callradiostringeval('assess'));
742: // if (svalue=='assess') { choicewrite(' checked="checked"'); }
743: // choicewrite(' /> Assessment</label><br />');
744: choicewrite('<label><input name="stringval" value="survey"'+
745: ' type="radio" '+callradiostringeval('survey'));
746: if (svalue=='survey') { choicewrite(' checked="checked"'); }
747: choicewrite(' /> Survey</label><br />');
748: // choicewrite('<label><input name="stringval" value="form"'+
749: // ' type="radio" '+callradiostringeval('form'));
750: // if (svalue=='form') { choicewrite(' checked="checked"'); }
751: // choicewrite('> Input Form</label><br />');
752: choicewrite('<label><input name="stringval" value="surveycred"'+
753: ' type="radio" '+callradiostringeval('surveycred'));
754: if (svalue=='surveycred') { choicewrite(' checked="checked"'); }
755: choicewrite('> Survey (credit for submission)</label><br />');
756: choicewrite('<label><input name="stringval" value="anonsurvey"'+
757: ' type="radio" '+callradiostringeval('anonsurvey'));
758: if (svalue=='anonsurvey') { choicewrite(' checked="checked"'); }
759: choicewrite('> Anonymous Survey</label><br />');
760: choicewrite('<label><input name="stringval" value="anonsurveycred"'+
761: ' type="radio" '+callradiostringeval('anonsurveycred'));
762: if (svalue=='anonsurveycred') { choicewrite(' checked="checked"'); }
763: choicewrite('> Anonymous Survey (credit for submission)</label><br />');
764: choicewrite('<label><input name="stringval" value="randomizetry"'+
765: ' type="radio" '+callradiostringeval('randomizetry'));
766: if (svalue=='randomizetry') { choicewrite(' checked="checked"'); }
767: choicewrite('> New Randomization Each N Tries (default N=1)</label><br />');
768: choicewrite('<label><input name="stringval" value="library"'+
769: ' type="radio" '+callradiostringeval('library'));
770: if (svalue=='library') { choicewrite(' checked="checked"'); }
771: choicewrite(' /> Library</label><br />');
772: }
773: if (pscat=='lenient') {
774: tablestart('Lenient Grading (Partial Credit)');
775: choicewrite('<tr><td>Value:</td><td colspan="2">');
776: choicewrite('<label><input name="stringval" value="yes"'+
777: ' type="radio" '+callradiostringeval('yes'));
778: if (svalue=='yes') { choicewrite(' checked="checked"'); }
779: choicewrite(' /> Yes</label><br />');
780: choicewrite('<label><input name="stringval" value="no"'+
781: ' type="radio" '+callradiostringeval('no'));
782: if (svalue=='no') { choicewrite(' checked="checked"'); }
783: choicewrite(' /> No</label><br />');
784: choicewrite('<label><input name="stringval" value="default"'+
785: ' type="radio" '+callradiostringeval('default'));
786: if (svalue=='default') { choicewrite(' checked="checked"'); }
787: choicewrite(' /> Default (only bubblesheet grading is lenient)</label><br />');
788: }
789: if (pscat=='discussvote') {
790: tablestart('Discussion Voting');
791: choicewrite('<tr><td>Value:</td><td colspan="2">');
792: choicewrite('<label><input name="stringval" value="yes"'+
793: ' type="radio" '+callradiostringeval('yes'));
794: if (svalue=='yes') { choicewrite(' checked="checked"'); }
795: choicewrite(' /> Yes</label><br />');
796: choicewrite('<label><input name="stringval" value="notended"'+
797: ' type="radio" '+callradiostringeval('notended'));
798: if (svalue=='notended') { choicewrite(' checked="checked"'); }
799: choicewrite(' /> Yes, unless discussion ended</label><br />');
800: choicewrite('<label><input name="stringval" value="no"'+
801: ' type="radio" '+callradiostringeval('no'));
802: if (svalue=='no') { choicewrite(' checked="checked"'); }
803: choicewrite(' /> No</label><br />');
804: }
805: if (pscat=='ip') {
806: tablestart('IP Number/Name');
807: choicewrite('<tr><td>Value:</td><td colspan="2">');
808: choicewrite('<input name="stringval" size="20" value="'+escapeHTML(svalue)+
809: '" onchange="parent.stringeval()" />');
810: }
811: if (pscat=='fileext') {
812: tablestart('Allowed File Extensions');
813: choicewrite('<tr><td>Value:</td><td colspan="2">');
814: choicewrite('<label><input name="radstringval" value="txt"'+
815: ' type="radio" '+callradiostringeval('txt'));
816: if (svalue=='txt') { choicewrite(' checked="checked"'); }
817: choicewrite(' /> Plain Text</label><br />');
818: choicewrite('<label><input name="radstringval" value="png,jpg,jpeg,gif"'+
819: ' type="radio" '+callradiostringeval('png,jpg,jpeg,gif'));
820: if (svalue=='png,jpg,jpeg,gif') { choicewrite(' checked="checked"'); }
821: choicewrite(' /> Picture File</label><br />');
822: choicewrite('<label><input name="radstringval" value="doc,docx,xls,xlsx,ppt,pptx"'+
823: ' type="radio" '+callradiostringeval('doc,docx,xls,xlsx,ppt,pptx'));
824: if (svalue=='doc,docx,xls,xlsx,ppt,pptx') { choicewrite(' checked="checked"'); }
825: if (svalue=='doc,xls,ppt') { choicewrite(' checked="checked"'); }
826: choicewrite(' /> Office Document</label><br />');
827: choicewrite('<input name="stringval" size="20" value="'+escapeHTML(svalue)+
828: '" onchange="parent.stringeval()" />');
829: }
830: if (pscat=='useslots') {
831: tablestart('Slots control access');
832: choicewrite('<tr><td>Value:</td><td colspan="2">');
833: choicewrite('<label><input name="stringval" value="no"'+
834: ' type="radio" '+callradiostringeval('no'));
835: if (svalue=='no') { choicewrite(' checked="checked"'); }
836: choicewrite(' /> No</label><br />');
837: choicewrite('<label><input name="stringval" value="resource"'+
838: ' type="radio" '+callradiostringeval('resource'));
839: if (svalue=='resource') { choicewrite(' checked="checked"'); }
840: choicewrite(' /> Yes, and the scope of student selected slot is a single resource.</label><br />');
841: choicewrite('<label><input name="stringval" value="map"'+
842: ' type="radio" '+callradiostringeval('map'));
843: if (svalue=='map') { choicewrite(' checked="checked"'); }
844: choicewrite(' /> Yes, and the scope of student selected slot is the enclosing map/folder. When checking in, it applies to only one resource.</label><br />');
845: choicewrite('<label><input name="stringval" value="map_map"'+
846: ' type="radio" '+callradiostringeval('map_map'));
847: if (svalue=='map_map') { choicewrite(' checked="checked"'); }
848: choicewrite(' /> Yes, and the scope of student selected slot is the enclosing map/folder. When checking in, all resources in the map/folder are checked in.</label><br />');
849: choicewrite('</td></tr></table>');
850: }
851: }
852:
853: if (ptype=='color') {
854: tablestart('Choose a Color');
855: choicewrite('<table>');
856: if (svalue) {
857: choicewrite('<tr><td colspan="9">Current choice:</td><td bgcolor="'+
858: escapeHTML(svalue)+'" colspan="2"> </td></tr>');
859: }
860: for (var ir=0; ir<=10; ir++) {
861: for (var ig=0; ig<=10; ig++) {
862: choicewrite('<tr>');
863: for (var ib=0; ib<=10; ib++) {
864: colorfield(ir,ig,ib);
865: }
866: choicewrite('</tr>');
867: }
868: }
869: choicewrite('</table></td></table>');
870: }
871:
872: choicewrite('</form>');
873: choiceend();
874: }
875:
876: function sopt(va,text) {
877: selwrite('<option value="'+va+'"');
878: if (va==pscat) {
879: selwrite(' selected="selected"');
880: }
881: selwrite('>'+text+'</option>');
882: }
883:
884: function catchange() {
885: var sform=selector.document.forms.fsel.fcat;
886: pscat=sform.options[sform.selectedIndex].value;
887: draw();
888: }
889:
890: function assemble() {
891: if ((ptype=='date') && (pscat!='interval')) {
892: svalue=Math.floor(cdate.getTime()/1000);
893: }
894: if (ptype=='tolerance') {
895: if (pscat=='relative_sym') {
896: svalue=choices.document.forms.sch.val2.value+'%';
897: if (choices.document.forms.sch.val3.checked) {
898: svalue+='+';
899: }
900: }
901: if (pscat=='absolute_sym') {
902: svalue=choices.document.forms.sch.val2.value;
903: if (choices.document.forms.sch.val3.checked) {
904: svalue+='+';
905: }
906: }
907: if (pscat=='absolute') {
908: svalue=choices.document.forms.sch.val2.value;
909: if (choices.document.forms.sch.val3.checked) {
910: svalue+='+';
911: }
912: svalue+=','+choices.document.forms.sch.val4.value;
913: if (choices.document.forms.sch.val5.checked) {
914: svalue+='+';
915: }
916: }
917: if (pscat=='relative') {
918: svalue=choices.document.forms.sch.val2.value+'%';
919: if (choices.document.forms.sch.val3.checked) {
920: svalue+='+';
921: }
922: svalue+=','+choices.document.forms.sch.val4.value+'%';
923: if (choices.document.forms.sch.val5.checked) {
924: svalue+='+';
925: }
926: }
927: }
928: if ((ptype=='int') && (pscat=='range')) {
929: svalue=choices.document.forms.sch.val2.value+','+
930: choices.document.forms.sch.val4.value;
931: }
932: if (pscat=='default') { svalue=''; }
933: stype=ptype+'_'+pscat;
934: }
935:
936:
937: function init() {
938: var i;
939: var subs=new Array();
940: var doneRegExp = /_done/;
941: var doneproctorRegExp = /_done_proctor/;
942: var proctorkeyRegExp = /^(\d+)_(.+)$/;
943: var namevalue=this.window.location.search.split('&');
944: namevalue[0]=namevalue[0].substr(1,namevalue[0].length-1);
945:
946: for (i=0;i<namevalue.length;i++) {
947: var pair=namevalue[i].split('=');
948: pair[1]=unescape(pair[1]);
949: if (pair[0]=='value') { pvalue=pair[1]; }
950: if (pair[0]=='type') { subs=pair[1].split('_');
951: ptype=subs[0];
952: pscat=subs[1];
953: if (typeof(subs[2])!="undefined") {
954: pscat+='_'+subs[2];
955: }
956: if ((pscat=='') || (typeof(pscat)=="undefined")) {
957: pscat='default';
958: }
959: }
960: if (pair[0]=='return') { preturn=pair[1]; }
961: if (pair[0]=='call') { pcode=pair[1]; }
962: if (pair[0]=='marker') { pmarker=pair[1]; }
963: if (pair[0]=='name') { pname=pair[1]; }
964: if (pair[0]=='modal') { pmodal=pair[1]; }
965: if (pair[0]=='defhour' && pair[1] >= 0 && pair[1] < 24 ) {
966: defhour=pair[1];
967: }
968: if (pair[0]=='defmin' && pair[1] >= 0 && pair[1] < 60) { defmin=pair[1]; }
969: if (pair[0]=='defsec' && pair[1] >= 0 && pair[1] < 60) { defsec=pair[1]; }
970: }
971:
972: if (ptype=='date' && pscat == 'interval') {
973: if (doneproctorRegExp.test(pvalue)) {
974: pmodval = pvalue.match(doneproctorRegExp);
975: var intervalwithkey = pvalue.replace(doneproctorRegExp,'');
976: if (proctorkeyRegExp.test(intervalwithkey)) {
977: var currvals = intervalwithkey.match(proctorkeyRegExp);
978: if (currvals.length == 3) {
979: pvalue = currvals[1];
980: pextraval = currvals[2];
981: } else {
982: pmodval = '';
983: }
984: }
985: } else {
986: if (doneRegExp.test(pvalue)) {
987: var pnumval = pvalue.replace(doneRegExp,'');
988: pmodval = pvalue.match(doneRegExp);
989: pvalue = pnumval;
990: }
991: }
992: }
993: svalue=pvalue;
994: if (((ptype=='float') || (ptype=='string') || (ptype=='int')) &&
995: (pscat=='default') &&
996: (typeof(svalue)!="undefined") &&
997: (svalue!=0) && (svalue!='')) { pscat='any'; }
998:
999: if (ptype=='tolerance') {
1000: var tperc=0;
1001: var trange=0;
1002: if (typeof(svalue)!='undefined') {
1003: if (svalue.indexOf('%')!=-1) { tperc=1; }
1004: if (svalue.indexOf(',')!=-1) { trange=1; }
1005: if (trange) {
1006: if (tperc) { pscat='relative'; } else { pscat='absolute'; }
1007: } else {
1008: if (tperc) { pscat='relative_sym'; } else { pscat='absolute_sym'; }
1009: }
1010: }
1011: }
1012:
1013: this.window.selector.document.open();
1014: selwrite('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
1015: selwrite('<html xmlns="http://www.w3.org/1999/xhtml">');
1016: selwrite('<head>');
1017: selwrite('<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />');
1018: selwrite('<title>LON-CAPA</title>');
1019: selwrite('<style type="text/css">');
1020: selwrite('<!--');
1021: selwrite('body {');
1022: selwrite('font-family: Verdana,Arial,Helvetica,sans-serif;');
1023: selwrite('line-height:130%;');
1024: selwrite('font-size:0.83em;');
1025: selwrite('background: #FFFFFF;');
1026: selwrite('}');
1027: selwrite('-->');
1028: selwrite('</style>');
1029: selwrite('</head>');
1030: selwrite('<body>');
1031: selwrite('<form name="fsel" action=""><b>'+pname+'</b><br />');
1032: selwrite('Format of Value(s): <select name="fcat" onchange="parent.catchange();">');
1033:
1034: if (ptype=='tolerance') {
1035: sopt('default','Default');
1036: sopt('relative_sym','Relative Tolerance, Symmetric (percent)');
1037: sopt('relative','Relative Tolerance (percentages)');
1038: sopt('absolute_sym','Absolute Tolerance, Symmetric (value)');
1039: sopt('absolute','Absolute Tolerance (values)');
1040: }
1041:
1042: if (ptype=='date') {
1043: if (pscat != 'interval') {
1044: sopt('default','Default');
1045: sopt('start','Starting Date');
1046: sopt('end','Ending Date');
1047: } else {
1048: sopt('interval','Time Interval');
1049: }
1050:
1051: if ((pvalue!='') && (typeof(pvalue)!="undefined")) {
1052: cdate.setTime(pvalue*1000);
1053: } else {
1054: cdate.setSeconds(defsec);
1055: cdate.setMinutes(defmin);
1056: cdate.setHours(defhour);
1057: }
1058:
1059: months[0]='January';
1060: months[1]='February';
1061: months[2]='March';
1062: months[3]='April';
1063: months[4]='May';
1064: months[5]='June';
1065: months[6]='July';
1066: months[7]='August';
1067: months[8]='September';
1068: months[9]='October';
1069: months[10]='November';
1070: months[11]='December';
1071: }
1072:
1073: if (ptype=='int') {
1074: sopt('default','Default');
1075: sopt('pos','Positive Integer, Not Zero');
1076: sopt('zeropos','Positive Integer or Zero');
1077: sopt('inrange','Integer in Range');
1078: sopt('range','Range of Integers');
1079: sopt('any','Integer');
1080: }
1081:
1082: if (ptype=='float') {
1083: sopt('default','Default');
1084: sopt('zeroone','Floating Point between 0 and 1');
1085: sopt('pos','Positive Floating Point');
1086: sopt('any','Floating Point');
1087:
1088: }
1089:
1090: if (ptype=='string') {
1091: //sopt('default','Default');
1092: if (pscat == 'yesno') { sopt('yesno','Yes/No'); }
1093: else if (pscat == 'problemstatus'){ sopt('problemstatus','Problem Status'); }
1094: else if (pscat == 'examtype') { sopt('examtype','Exam Type'); }
1095: else if (pscat == 'questiontype') { sopt('questiontype','Question Type'); }
1096: else if (pscat == 'lenient') { sopt('lenient','Lenient Grading (Partial Credit)'); }
1097: else if (pscat == 'discussvote') { sopt('discussvote','Discussion Voting'); }
1098: else if (pscat == 'ip') { sopt('ip','IP Number/Name'); }
1099: else if (pscat == 'fileext') { sopt('fileext','File Extension'); }
1100: else if (pscat == 'useslots') { sopt('useslots','Slots control access'); }
1101: else { pscat = 'any'; }
1102: sopt('any','String Value');
1103: }
1104:
1105: if (ptype=='color') {
1106: sopt('default','Use Default Color');
1107: sopt('custom','Use Custom Color');
1108: }
1109:
1110: selwrite('</select></form>');
1111: var targ='parent.opener';
1112: if (pmodal==1) {
1113: targ='parent.parent';
1114: }
1115: if ((ptype=='date') && (pscat=='interval')) {
1116: selwrite('<a href="javascript:parent.validateInterval();');
1117: } else {
1118: selwrite('<a href="javascript:parent.assemble();');
1119: }
1120: if (preturn!='') {
1121: selwrite(targ+'.document.'+preturn+'_value.value=parent.window.svalue;');
1122: selwrite(targ+'.document.'+preturn+'_type.value=parent.window.stype;');
1123: }
1124: if (pmarker!='') {
1125: selwrite(targ+'.document.'+preturn+'_marker.value=parent.window.pmarker;');
1126: }
1127: if (pcode!='') {
1128: selwrite(targ+'.'+pcode+'();');
1129: }
1130: selwrite('">Save</a> ');
1131:
1132: selwrite('<a href="javascript:');
1133: selwrite(targ+'.document.'+preturn+'_value.value='+"'';");
1134: if (pmarker!='') {
1135: selwrite(
1136: targ+'.document.'+preturn+'_marker.value=parent.window.pmarker;');
1137: }
1138: if (pcode!='') {
1139: selwrite(targ+'.'+pcode+'();');
1140: }
1141: selwrite('">Delete</a> ');
1142:
1143: selwrite('</body></html>');
1144: this.window.selector.document.close();
1145: draw();
1146:
1147: }
1148:
1149: // ]]>
1150: </script>
1151: </head>
1152:
1153: <frameset rows="120,*" onload="init();">
1154: <frame name="selector" src="empty.html" />
1155: <frame name="choices" src="empty.html" />
1156: </frameset>
1157:
1158:
1159:
1160: </html>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>