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