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