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