Annotation of rat/client/parameter.html, revision 1.51
1.1 www 1: <html>
2: <!--
3: The LearningOnline Network with CAPA
4: Parameter Input Window
1.16 albertel 5: //
1.51 ! bisitz 6: // $Id: parameter.html,v 1.50 2008/04/05 16:11:03 www Exp $
1.16 albertel 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: //
1.1 www 30: -->
31: <head>
32: <title>LON-CAPA</title>
33: </head>
34:
1.46 albertel 35: <script type="text/javascript">
1.1 www 36:
37: var ptype='';
38: var pvalue='';
39: var preturn='';
40: var pcode='';
1.2 www 41: var pscat='';
42: var pmarker='';
1.1 www 43: var pname='';
44:
1.31 www 45: var defhour=0;
46: var defmin=0;
47: var defsec=0;
48:
1.1 www 49: var svalue;
1.2 www 50: var stype;
51: var smarker;
1.1 www 52:
53: var vars=new Array();
54:
1.2 www 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:
1.1 www 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) {
1.51 ! bisitz 84: choicewrite('<table><tr bgcolor="#AAFFAA"><th colspan="3">'+
1.1 www 85: headtext+'</th></tr>');
86: }
87:
88: function valline(text,id1,id2) {
89: choicewrite('<tr bgcolor="#AAFFAA"><td>'+text+
1.51 ! bisitz 90: '</td><td><input type="text" size="4" name="val'+
! 91: id1+'"></td><td>incl:<input type="checkbox" name="val'+
! 92: id2+'"></td></tr>');
1.1 www 93: }
94:
1.46 albertel 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:
1.2 www 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;
1.51 ! bisitz 119: choicewrite('<select name="hours" onChange="parent.datecalc();">');
1.2 www 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;
1.51 ! bisitz 143: choicewrite('<select name="minutes" onChange="parent.datecalc();">');
1.2 www 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;
1.51 ! bisitz 157: choicewrite('<select name="seconds" onChange="parent.datecalc();">');
1.2 www 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;
1.51 ! bisitz 172: choicewrite('<select name="date" onChange="parent.datecalc();">');
1.2 www 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();
1.19 www 185: var nowdate=new Date();
186: var nowyear=nowdate.getFullYear();
1.33 albertel 187: if ( !thisyear ) { thisyear=nowyear; }
1.19 www 188: var loweryear=thisyear-2;
189: var upperyear=thisyear+5;
190: if (thisyear>nowyear) { loweryear=nowyear-2; }
191: if (thisyear<nowyear) { upperyear=nowyear+5; }
1.2 www 192: var i;
1.51 ! bisitz 193: choicewrite('<select name="year" onChange="parent.datecalc();">');
1.19 www 194: for (i=loweryear;i<=upperyear;i++) {
1.2 www 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;
1.51 ! bisitz 207: choicewrite('<select name="month" onChange="parent.datecalc();">');
1.2 www 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;
1.51 ! bisitz 222: choicewrite('<select name="minutes" onChange="parent.intcalc();">');
1.2 www 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;
1.51 ! bisitz 236: choicewrite('<select name="hours" onChange="parent.intcalc();">');
1.2 www 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;
1.51 ! bisitz 250: choicewrite('<select name="seconds" onChange="parent.intcalc();">');
1.2 www 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;
1.51 ! bisitz 265: choicewrite('<select name="date" onChange="parent.intcalc();">');
1.2 www 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:
1.6 www 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: }
1.12 www 292: if (pscat.indexOf('inrange')!=-1) {
1.10 www 293: var rangeparts=new Array;
294: rangeparts=split('_',pscat);
1.12 www 295: rangeparts=split(',',rangeparts[1]);
1.10 www 296: if (svalue<rangeparts[0]) { svalue=rangeparts[0]; }
297: if (svalue>rangeparts[1]) { svalue=rangeparts[1]; }
298: }
1.6 www 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:
1.25 www 317: function radiostringeval(newval) {
318: svalue=newval;
319: draw();
320: }
321:
1.29 www 322: function callradiostringeval(newval) {
323: return 'onChange="parent.radiostringeval(\''
324: +newval+'\')" onClick="parent.radiostringeval(\''
325: +newval+'\')"';
326: }
327:
1.2 www 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: }
1.21 www 339:
340: function pickcolor(picked) {
341: svalue=picked;
342: draw();
343: }
344:
345: function colorfield(ir,ig,ib) {
346: var col=new Array;
1.23 www 347: col=["00","11","22","44","66","88","AA","CC","DD","EE","FF"];
1.21 www 348: var color='#'+col[ir]+col[ig]+col[ib];
1.23 www 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>"; }
1.21 www 351: choicewrite('<td bgcolor="'+color+'"><a href="javascript:parent.pickcolor('+"'"+
352: color+"'"+')">'+selection+'</a></td>');
353:
354: }
355:
1.1 www 356: function draw() {
357: choicestart();
1.51 ! bisitz 358: choicewrite('<form name="sch"');
1.6 www 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('>');
1.1 www 369: if (ptype=='tolerance') {
1.2 www 370: // 0: pscat
371: if (pscat=='default') {
1.1 www 372: tablestart('Use default value or algorithm of resource');
373: }
1.2 www 374: if (pscat=='relative_sym') {
1.1 www 375: // 2: percentage
376: // 3: open
377: tablestart('Percentage error, symmetric around value');
378: valline('Percentage',2,3);
1.13 www 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: }
1.1 www 385: }
1.2 www 386: if (pscat=='relative') {
1.1 www 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);
1.17 matthew 394: var range1=new Array;
1.13 www 395: if ((svalue!='') && (typeof(svalue)!="undefined")) {
1.17 matthew 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) {
1.13 www 400: choices.document.forms.sch.val3.checked=true;
401: }
1.17 matthew 402: choices.document.forms.sch.val4.value=parseFloat(range1[1]);
403: if (range1[1].indexOf('+')!=-1) {
1.13 www 404: choices.document.forms.sch.val5.checked=true;
405: }
406: }
1.1 www 407: }
1.2 www 408: if (pscat=='absolute_sym') {
1.1 www 409: tablestart('Absolute error, symmetric around value');
410: valline('Value',2,3);
1.13 www 411: if ((svalue!='') && (typeof(svalue)!="undefined")) {
1.15 www 412: choices.document.forms.sch.val2.value=parseFloat(svalue);
1.13 www 413: if (svalue.indexOf('+')!=-1) {
414: choices.document.forms.sch.val3.checked=true;
415: }
416: }
1.1 www 417: }
1.2 www 418: if (pscat=='absolute') {
1.1 www 419: tablestart('Absolute error, asymmetric around value');
420: valline('Upper value',2,3);
421: valline('Lower value',4,5);
1.17 matthew 422: var range2=new Array;
1.13 www 423: if ((svalue!='') && (typeof(svalue)!="undefined")) {
424: range=svalue.split(',');
1.17 matthew 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) {
1.13 www 428: choices.document.forms.sch.val3.checked=true;
429: }
1.17 matthew 430: choices.document.forms.sch.val4.value=parseFloat(range2[1]);
431: if (range2[1].indexOf('+')!=-1) {
1.13 www 432: choices.document.forms.sch.val5.checked=true;
433: }
434: }
1.1 www 435: }
436: }
437:
438: if (ptype=='date') {
1.2 www 439: if (pscat=='default') {
440: tablestart('Default value or none');
441: choicewrite('</table>');
442: } else {
443: if (pscat=='start') {
1.24 www 444: tablestart('Date and time');
1.2 www 445: }
446: if (pscat=='end') {
1.24 www 447: tablestart('Date and time');
1.2 www 448: }
449: if (pscat=='interval') {
450: tablestart('Time interval');
1.51 ! bisitz 451: choicewrite('<tr bgcolor="#AAFFAA"><td colspan="3">');
1.2 www 452: intervaldis();
453: choicewrite('</td></tr><tr bgcolor="#AAFFAA"><td>Time:'
1.51 ! bisitz 454: +'</td><td colspan="2">');
1.2 www 455: intday();choicewrite('days ');
456: inthour();choicewrite('hours ');
457: intminute(); choicewrite('mins '); intsecond();
458: choicewrite('secs</td></tr></table>');
459: } else {
1.51 ! bisitz 460: choicewrite('<tr bgcolor="#AAFFAA"><td colspan="3">'
1.2 www 461: +cdate.toString()+
1.51 ! bisitz 462: '</td></tr><tr bgcolor="#AAFFAA"><td>Date:</td><td colspan="2">');
1.2 www 463: month();date();year();
464: choicewrite('</td></tr><tr bgcolor="#AAFFAA"><td>Time:'
1.51 ! bisitz 465: +'</td><td colspan="2">');hour();choicewrite('h ');minute();
1.2 www 466: choicewrite('m ');second();
467: choicewrite('s</td></tr></table>');
468: }
469: }
1.1 www 470: }
471:
1.6 www 472: if (ptype=='int') {
1.19 www 473: var pscatparts=new Array;
474: pscatparts=pscat.split(',');
475: pscat=pscatparts[0];
1.6 www 476: if (pscat=='default') {
477: tablestart('Default value or none');
1.14 www 478: choicewrite('</table>');
1.6 www 479: } else {
1.14 www 480: if (pscat=='range') {
481: tablestart('Integer range');
482: choicewrite('<tr bgcolor="#AAFFAA"><td>Lower Value:'+
1.51 ! bisitz 483: '</td><td colspan="2"><input type="text" size="4" name="val2'+
! 484: '"></td></tr>');
1.14 www 485: choicewrite('<tr bgcolor="#AAFFAA"><td>Upper Value:'+
1.51 ! bisitz 486: '</td><td colspan="2"><input type="text" size="4" name="val4'+
! 487: '"></td></tr></table>');
1.14 www 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 {
1.6 www 496: if (pscat=='pos') {
497: tablestart('Positive (non-zero) integer');
498: }
499: if (pscat=='zeropos') {
500: tablestart('Positive integer or zero');
501: }
1.12 www 502: if (pscat.indexOf('inrange')!=-1) {
1.10 www 503: var rangeparts=new Array;
1.12 www 504: rangeparts=split(',',pscat);
1.10 www 505: tablestart('Integer in the range ['+rangeparts[1]+']');
506: }
1.6 www 507: if (pscat=='any') {
508: tablestart('Integer');
509: }
1.51 ! bisitz 510: choicewrite('<tr bgcolor="#AAFFAA"><td>Value:</td><td colspan="2">');
! 511: choicewrite('<input name="intval" size="10" value="'+escapeHTML(svalue)+
1.6 www 512: '" name=intval onChange="parent.integereval()">');
513: choicewrite('</td></table>');
514: }
1.14 www 515: }
1.1 www 516: }
517:
1.6 www 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: }
1.51 ! bisitz 532: choicewrite('<tr bgcolor="#AAFFAA"><td>Value:</td><td colspan="2">');
! 533: choicewrite('<input name="floatval" size="10" value="'+escapeHTML(svalue)+
1.6 www 534: '" name=floatval onChange="parent.floateval()">');
535: choicewrite('</td></table>');
536: }
1.1 www 537: }
538:
1.6 www 539: if (ptype=='string') {
1.42 albertel 540: if ((pscat=='any') || (pscat=='') || (pscat=='default') ||
541: (typeof(pscat)=='undefined')) {
1.6 www 542: tablestart('Text');
1.51 ! bisitz 543: choicewrite('<tr bgcolor="#AAFFAA"><td>Value:</td><td colspan="2">');
1.46 albertel 544: choicewrite('<input name="stringval" size="20" value="'+escapeHTML(svalue)+
1.25 www 545: '" type="text" onChange="parent.stringeval()">');
546: }
547: if (pscat=='yesno') {
548: tablestart('Yes/No');
1.51 ! bisitz 549: choicewrite('<tr bgcolor="#AAFFAA"><td>Value:</td><td colspan="2">');
1.32 albertel 550: choicewrite('<label><input name="stringval" value="yes"'+
1.29 www 551: ' type="radio" '+callradiostringeval('yes'));
1.25 www 552: if (svalue=='yes') { choicewrite(' checked'); }
1.32 albertel 553: choicewrite('> Yes</label><br />');
554: choicewrite('<label><input name="stringval" value="no"'+
1.29 www 555: ' type="radio" '+callradiostringeval('no'));
1.25 www 556: if (svalue=='no') { choicewrite(' checked'); }
1.32 albertel 557: choicewrite('> No</label><br />');
1.25 www 558: }
1.47 albertel 559: if (pscat=='problemstatus') {
560: tablestart('Problem Status');
1.51 ! bisitz 561: choicewrite('<tr bgcolor="#AAFFAA"><td>Value:</td><td colspan="2">');
1.47 albertel 562: choicewrite('<label><input name="stringval" value="yes"'+
563: ' type="radio" '+callradiostringeval('yes'));
564: if (svalue=='yes') { choicewrite(' checked'); }
565: choicewrite('> Yes</label><br />');
1.49 albertel 566: choicewrite('<label><input name="stringval" value="answer"'+
567: ' type="radio" '+callradiostringeval('answer'));
568: if (svalue=='answer') { choicewrite(' checked'); }
1.50 www 569: choicewrite('> Yes, and show correct answer if they exceed the maximum number of tries.</label><br />');
1.47 albertel 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: }
1.25 www 579: if (pscat=='examtype') {
580: tablestart('Exam Type');
1.51 ! bisitz 581: choicewrite('<tr bgcolor="#AAFFAA"><td>Value:</td><td colspan="2">');
1.32 albertel 582: choicewrite('<label><input name="stringval" value="online"'+
1.29 www 583: ' type="radio" '+callradiostringeval('online'));
1.25 www 584: if (svalue=='online') { choicewrite(' checked'); }
1.32 albertel 585: choicewrite('> Online</label><br />');
586: choicewrite('<label><input name="stringval" value="checkout"'+
1.29 www 587: ' type="radio" '+callradiostringeval('checkout'));
1.25 www 588: if (svalue=='checkout') { choicewrite(' checked'); }
1.32 albertel 589: choicewrite('> Check out</label><br />');
1.25 www 590: }
591: if (pscat=='questiontype') {
592: tablestart('Question Type');
1.51 ! bisitz 593: choicewrite('<tr bgcolor="#AAFFAA"><td>Value:</td><td colspan="2">');
1.32 albertel 594: choicewrite('<label><input name="stringval" value="problem"'+
1.29 www 595: ' type="radio" '+callradiostringeval('problem'));
1.25 www 596: if (svalue=='problem') { choicewrite(' checked'); }
1.32 albertel 597: choicewrite('> Standard Problem</label><br />');
1.36 albertel 598: // choicewrite('<label><input name="stringval" value="quiz"'+
599: // ' type="radio" '+callradiostringeval('quiz'));
600: // if (svalue=='quiz') { choicewrite(' checked'); }
601: // choicewrite('> Quiz</label><br />');
1.35 albertel 602: choicewrite('<label><input name="stringval" value="practice"'+
603: ' type="radio" '+callradiostringeval('practice'));
604: if (svalue=='practice') { choicewrite(' checked'); }
605: choicewrite('> Practice</label><br />');
1.32 albertel 606: choicewrite('<label><input name="stringval" value="exam"'+
1.29 www 607: ' type="radio" '+callradiostringeval('exam'));
1.25 www 608: if (svalue=='exam') { choicewrite(' checked'); }
1.32 albertel 609: choicewrite('> Exam</label><br />');
1.36 albertel 610: // choicewrite('<label><input name="stringval" value="assess"'+
611: // ' type="radio" '+callradiostringeval('assess'));
612: // if (svalue=='assess') { choicewrite(' checked'); }
613: // choicewrite('> Assessment</label><br />');
1.32 albertel 614: choicewrite('<label><input name="stringval" value="survey"'+
1.29 www 615: ' type="radio" '+callradiostringeval('survey'));
1.25 www 616: if (svalue=='survey') { choicewrite(' checked'); }
1.32 albertel 617: choicewrite('> Survey</label><br />');
1.36 albertel 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 />');
1.32 albertel 622: choicewrite('<label><input name="stringval" value="library"'+
1.29 www 623: ' type="radio" '+callradiostringeval('library'));
1.25 www 624: if (svalue=='library') { choicewrite(' checked'); }
1.32 albertel 625: choicewrite('> Library</label><br />');
1.25 www 626: }
627: if (pscat=='ip') {
628: tablestart('IP Number/Name');
1.51 ! bisitz 629: choicewrite('<tr bgcolor="#AAFFAA"><td>Value:</td><td colspan="2">');
1.46 albertel 630: choicewrite('<input name="stringval" size="20" value="'+escapeHTML(svalue)+
1.25 www 631: '" onChange="parent.stringeval()">');
1.6 www 632: }
1.26 www 633: if (pscat=='fileext') {
634: tablestart('Allowed File Extensions');
1.51 ! bisitz 635: choicewrite('<tr bgcolor="#AAFFAA"><td>Value:</td><td colspan="2">');
1.32 albertel 636: choicewrite('<label><input name="radstringval" value="txt"'+
1.29 www 637: ' type="radio" '+callradiostringeval('txt'));
1.26 www 638: if (svalue=='txt') { choicewrite(' checked'); }
1.32 albertel 639: choicewrite('> Plain Text</label><br />');
640: choicewrite('<label><input name="radstringval" value="png,jpg,jpeg,gif"'+
1.29 www 641: ' type="radio" '+callradiostringeval('png,jpg,jpeg,gif'));
1.26 www 642: if (svalue=='png,jpg,jpeg,gif') { choicewrite(' checked'); }
1.32 albertel 643: choicewrite('> Picture File</label><br />');
644: choicewrite('<label><input name="radstringval" value="doc,xls,ppt"'+
1.29 www 645: ' type="radio" '+callradiostringeval('doc,xls,ppt'));
1.26 www 646: if (svalue=='doc,xls,ppt') { choicewrite(' checked'); }
1.32 albertel 647: choicewrite('> Office Document</label><br />');
1.46 albertel 648: choicewrite('<input name="stringval" size="20" value="'+escapeHTML(svalue)+
1.26 www 649: '" onChange="parent.stringeval()">');
650: }
1.37 albertel 651: if (pscat=='useslots') {
652: tablestart('Slots control access');
1.51 ! bisitz 653: choicewrite('<tr bgcolor="#AAFFAA"><td>Value:</td><td colspan="2">');
1.37 albertel 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 />');
1.38 albertel 662: choicewrite('<label><input name="stringval" value="map"'+
663: ' type="radio" '+callradiostringeval('map'));
664: if (svalue=='map') { choicewrite(' checked'); }
1.39 albertel 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"'+
1.40 albertel 667: ' type="radio" '+callradiostringeval('map_map'));
1.39 albertel 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 />');
1.6 www 670: choicewrite('</td></table>');
671: }
1.21 www 672: }
673:
674: if (ptype=='color') {
675: tablestart('Choose a Color');
676: choicewrite('<table>');
677: if (svalue) {
1.23 www 678: choicewrite('<tr><td colspan="9">Current choice:</td><td bgcolor="'+
1.46 albertel 679: escapeHTML(svalue)+'" colspan="2"> </td></tr>');
1.21 www 680: }
1.23 www 681: for (var ir=0; ir<=10; ir++) {
682: for (var ig=0; ig<=10; ig++) {
1.21 www 683: choicewrite('<tr>');
1.23 www 684: for (var ib=0; ib<=10; ib++) {
1.21 www 685: colorfield(ir,ig,ib);
686: }
687: choicewrite('</tr>');
688: }
689: }
690: choicewrite('</table></td></table>');
1.1 www 691: }
692:
1.40 albertel 693: choicewrite('</form>');
1.1 www 694: choiceend();
695: }
696:
697: function sopt(va,text) {
698: selwrite('<option value="'+va+'"');
1.2 www 699: if (va==pscat) {
1.1 www 700: selwrite(' selected');
701: }
702: selwrite('>'+text+'</option>');
703: }
704:
705: function catchange() {
706: var sform=selector.document.forms.fsel.fcat;
1.2 www 707: pscat=sform.options[sform.selectedIndex].value;
1.1 www 708: draw();
709: }
710:
711: function assemble() {
1.2 www 712: if ((ptype=='date') && (pscat!='interval')) {
1.41 www 713: svalue=Math.floor(cdate.getTime()/1000);
1.2 www 714: }
1.12 www 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: }
1.14 www 748: }
749: if ((ptype=='int') && (pscat=='range')) {
750: svalue=choices.document.forms.sch.val2.value+','+
751: choices.document.forms.sch.val4.value;
1.12 www 752: }
1.6 www 753: if (pscat=='default') { svalue=''; }
1.2 www 754: stype=ptype+'_'+pscat;
1.1 www 755: }
756:
757:
758: function init() {
759: var i;
1.2 www 760: var subs=new Array();
1.1 www 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('=');
1.3 www 766: pair[1]=unescape(pair[1]);
1.1 www 767: if (pair[0]=='value') { pvalue=pair[1]; }
1.2 www 768: if (pair[0]=='type') { subs=pair[1].split('_');
769: ptype=subs[0];
770: pscat=subs[1];
1.11 www 771: if (typeof(subs[2])!="undefined") {
772: pscat+='_'+subs[2];
773: }
774: if ((pscat=='') || (typeof(pscat)=="undefined")) {
1.6 www 775: pscat='default';
776: }
1.2 www 777: }
1.1 www 778: if (pair[0]=='return') { preturn=pair[1]; }
779: if (pair[0]=='call') { pcode=pair[1]; }
1.2 www 780: if (pair[0]=='marker') { pmarker=pair[1]; }
1.1 www 781: if (pair[0]=='name') { pname=pair[1]; }
1.34 albertel 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]; }
1.1 www 787: }
788:
789: svalue=pvalue;
1.6 www 790: if (((ptype=='float') || (ptype=='string') || (ptype=='int')) &&
791: (pscat=='default') &&
1.11 www 792: (typeof(svalue)!="undefined") &&
793: (svalue!=0) && (svalue!='')) { pscat='any'; }
1.1 www 794:
1.13 www 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:
1.1 www 809: this.window.selector.document.clear();
810: selwrite('<html><body bgcolor="#FFFFFF">');
811:
1.51 ! bisitz 812: selwrite('<form name="fsel"><b>'+pname+'</b><br />');
1.1 www 813: selwrite('<select name="fcat" onChange="parent.catchange();">');
1.12 www 814:
1.1 www 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') {
1.48 albertel 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:
1.11 www 832: if ((pvalue!='') && (typeof(pvalue)!="undefined")) {
1.2 www 833: cdate.setTime(pvalue*1000);
1.30 www 834: } else {
1.31 www 835: cdate.setSeconds(defsec);
836: cdate.setMinutes(defmin);
837: cdate.setHours(defhour);
1.2 www 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';
1.1 www 852: }
1.2 www 853:
1.6 www 854: if (ptype=='int') {
855: sopt('default','Default');
856: sopt('pos','Positive Integer, Not Zero');
857: sopt('zeropos','Positive Integer or Zero');
1.13 www 858: sopt('inrange','Integer in Range');
859: sopt('range','Range of Integers');
1.6 www 860: sopt('any','Integer');
1.1 www 861: }
862:
1.6 www 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');
1.1 www 868:
869: }
870:
1.6 www 871: if (ptype=='string') {
1.44 albertel 872: //sopt('default','Default');
873: if (pscat == 'yesno') { sopt('yesno','Yes/No'); }
1.47 albertel 874: else if (pscat == 'problemstatus'){ sopt('problemstatus','Problem Status'); }
1.45 albertel 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'; }
1.28 albertel 881: sopt('any','String Value');
1.22 www 882: }
883:
884: if (ptype=='color') {
885: sopt('default','Use Default Color');
886: sopt('custom','Use Custom Color');
1.1 www 887: }
888:
889: selwrite('</select></form>');
890:
1.2 www 891: selwrite('<a href="javascript:parent.assemble();');
1.1 www 892: if (preturn!='') {
1.4 www 893: selwrite(
894: 'parent.opener.document.'+preturn+'_value.value=parent.window.svalue;');
895: selwrite(
896: 'parent.opener.document.'+preturn+'_type.value=parent.window.stype;');
1.2 www 897: }
898: if (pmarker!='') {
1.4 www 899: selwrite(
900: 'parent.opener.document.'+preturn+'_marker.value=parent.window.pmarker;');
1.1 www 901: }
902: if (pcode!='') {
1.4 www 903: selwrite('parent.opener.'+pcode+'();');
1.1 www 904: }
1.43 albertel 905: selwrite('">Save</a> ');
1.5 www 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> ');
1.4 www 918:
919: selwrite('<a href="javascript:');
1.17 matthew 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();');
1.4 www 938: selwrite('">Cancel</a>');
1.1 www 939:
940: selwrite('</body></html>');
941: this.window.selector.document.close();
1.2 www 942: draw();
1.1 www 943:
944: }
945:
946: </script>
947:
1.2 www 948: <frameset rows="120,*" onLoad="init();">
1.51 ! bisitz 949: <frame name="selector" src="empty.html">
! 950: <frame name="choices" src="empty.html">
1.1 www 951: </frameset>
952:
953:
954:
1.16 albertel 955: </html>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>