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