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