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