Annotation of rat/client/parameter.html, revision 1.56.2.1
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.56.2.1! 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.32 albertel 639: choicewrite('<label><input name="stringval" value="library"'+
1.29 www 640: ' type="radio" '+callradiostringeval('library'));
1.53 bisitz 641: if (svalue=='library') { choicewrite(' checked="checked"'); }
642: choicewrite(' /> Library</label><br />');
1.25 www 643: }
644: if (pscat=='ip') {
645: tablestart('IP Number/Name');
1.52 bisitz 646: choicewrite('<tr><td>Value:</td><td colspan="2">');
1.46 albertel 647: choicewrite('<input name="stringval" size="20" value="'+escapeHTML(svalue)+
1.53 bisitz 648: '" onchange="parent.stringeval()" />');
1.6 www 649: }
1.26 www 650: if (pscat=='fileext') {
651: tablestart('Allowed File Extensions');
1.52 bisitz 652: choicewrite('<tr><td>Value:</td><td colspan="2">');
1.32 albertel 653: choicewrite('<label><input name="radstringval" value="txt"'+
1.29 www 654: ' type="radio" '+callradiostringeval('txt'));
1.53 bisitz 655: if (svalue=='txt') { choicewrite(' checked="checked"'); }
656: choicewrite(' /> Plain Text</label><br />');
1.32 albertel 657: choicewrite('<label><input name="radstringval" value="png,jpg,jpeg,gif"'+
1.29 www 658: ' type="radio" '+callradiostringeval('png,jpg,jpeg,gif'));
1.53 bisitz 659: if (svalue=='png,jpg,jpeg,gif') { choicewrite(' checked="checked"'); }
660: choicewrite(' /> Picture File</label><br />');
1.56.2.1! raeburn 661: choicewrite('<label><input name="radstringval" value="doc,docx,xls,xlsx,ppt,pptx"'+
! 662: ' type="radio" '+callradiostringeval('doc,docx,xls,xlsx,ppt,pptx'));
! 663: if (svalue=='doc,docx,xls,xlsx,ppt,pptx') { choicewrite(' checked="checked"'); }
1.53 bisitz 664: if (svalue=='doc,xls,ppt') { choicewrite(' checked="checked"'); }
665: choicewrite(' /> Office Document</label><br />');
1.46 albertel 666: choicewrite('<input name="stringval" size="20" value="'+escapeHTML(svalue)+
1.53 bisitz 667: '" onchange="parent.stringeval()" />');
1.26 www 668: }
1.37 albertel 669: if (pscat=='useslots') {
670: tablestart('Slots control access');
1.52 bisitz 671: choicewrite('<tr><td>Value:</td><td colspan="2">');
1.37 albertel 672: choicewrite('<label><input name="stringval" value="no"'+
673: ' type="radio" '+callradiostringeval('no'));
1.53 bisitz 674: if (svalue=='no') { choicewrite(' checked="checked"'); }
675: choicewrite(' /> No</label><br />');
1.37 albertel 676: choicewrite('<label><input name="stringval" value="resource"'+
677: ' type="radio" '+callradiostringeval('resource'));
1.53 bisitz 678: if (svalue=='resource') { choicewrite(' checked="checked"'); }
679: choicewrite(' /> Yes, and the scope of student selected slot is a single resource.</label><br />');
1.38 albertel 680: choicewrite('<label><input name="stringval" value="map"'+
681: ' type="radio" '+callradiostringeval('map'));
1.53 bisitz 682: if (svalue=='map') { choicewrite(' checked="checked"'); }
683: 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 684: choicewrite('<label><input name="stringval" value="map_map"'+
1.40 albertel 685: ' type="radio" '+callradiostringeval('map_map'));
1.53 bisitz 686: if (svalue=='map_map') { choicewrite(' checked="checked"'); }
1.55 bisitz 687: 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 688: choicewrite('</td></tr></table>');
1.6 www 689: }
1.21 www 690: }
691:
692: if (ptype=='color') {
693: tablestart('Choose a Color');
694: choicewrite('<table>');
695: if (svalue) {
1.23 www 696: choicewrite('<tr><td colspan="9">Current choice:</td><td bgcolor="'+
1.46 albertel 697: escapeHTML(svalue)+'" colspan="2"> </td></tr>');
1.21 www 698: }
1.23 www 699: for (var ir=0; ir<=10; ir++) {
700: for (var ig=0; ig<=10; ig++) {
1.21 www 701: choicewrite('<tr>');
1.23 www 702: for (var ib=0; ib<=10; ib++) {
1.21 www 703: colorfield(ir,ig,ib);
704: }
705: choicewrite('</tr>');
706: }
707: }
708: choicewrite('</table></td></table>');
1.1 www 709: }
710:
1.40 albertel 711: choicewrite('</form>');
1.1 www 712: choiceend();
713: }
714:
715: function sopt(va,text) {
716: selwrite('<option value="'+va+'"');
1.2 www 717: if (va==pscat) {
1.54 bisitz 718: selwrite(' selected="selected"');
1.1 www 719: }
720: selwrite('>'+text+'</option>');
721: }
722:
723: function catchange() {
724: var sform=selector.document.forms.fsel.fcat;
1.2 www 725: pscat=sform.options[sform.selectedIndex].value;
1.1 www 726: draw();
727: }
728:
729: function assemble() {
1.2 www 730: if ((ptype=='date') && (pscat!='interval')) {
1.41 www 731: svalue=Math.floor(cdate.getTime()/1000);
1.2 www 732: }
1.12 www 733: if (ptype=='tolerance') {
734: if (pscat=='relative_sym') {
735: svalue=choices.document.forms.sch.val2.value+'%';
736: if (choices.document.forms.sch.val3.checked) {
737: svalue+='+';
738: }
739: }
740: if (pscat=='absolute_sym') {
741: svalue=choices.document.forms.sch.val2.value;
742: if (choices.document.forms.sch.val3.checked) {
743: svalue+='+';
744: }
745: }
746: if (pscat=='absolute') {
747: svalue=choices.document.forms.sch.val2.value;
748: if (choices.document.forms.sch.val3.checked) {
749: svalue+='+';
750: }
751: svalue+=','+choices.document.forms.sch.val4.value;
752: if (choices.document.forms.sch.val5.checked) {
753: svalue+='+';
754: }
755: }
756: if (pscat=='relative') {
757: svalue=choices.document.forms.sch.val2.value+'%';
758: if (choices.document.forms.sch.val3.checked) {
759: svalue+='+';
760: }
761: svalue+=','+choices.document.forms.sch.val4.value+'%';
762: if (choices.document.forms.sch.val5.checked) {
763: svalue+='+';
764: }
765: }
1.14 www 766: }
767: if ((ptype=='int') && (pscat=='range')) {
768: svalue=choices.document.forms.sch.val2.value+','+
769: choices.document.forms.sch.val4.value;
1.12 www 770: }
1.6 www 771: if (pscat=='default') { svalue=''; }
1.2 www 772: stype=ptype+'_'+pscat;
1.1 www 773: }
774:
775:
776: function init() {
777: var i;
1.2 www 778: var subs=new Array();
1.1 www 779: var namevalue=this.window.location.search.split('&');
780: namevalue[0]=namevalue[0].substr(1,namevalue[0].length-1);
781:
782: for (i=0;i<namevalue.length;i++) {
783: var pair=namevalue[i].split('=');
1.3 www 784: pair[1]=unescape(pair[1]);
1.1 www 785: if (pair[0]=='value') { pvalue=pair[1]; }
1.2 www 786: if (pair[0]=='type') { subs=pair[1].split('_');
787: ptype=subs[0];
788: pscat=subs[1];
1.11 www 789: if (typeof(subs[2])!="undefined") {
790: pscat+='_'+subs[2];
791: }
792: if ((pscat=='') || (typeof(pscat)=="undefined")) {
1.6 www 793: pscat='default';
794: }
1.2 www 795: }
1.1 www 796: if (pair[0]=='return') { preturn=pair[1]; }
797: if (pair[0]=='call') { pcode=pair[1]; }
1.2 www 798: if (pair[0]=='marker') { pmarker=pair[1]; }
1.1 www 799: if (pair[0]=='name') { pname=pair[1]; }
1.34 albertel 800: if (pair[0]=='defhour' && pair[1] >= 0 && pair[1] < 24 ) {
801: defhour=pair[1];
802: }
803: if (pair[0]=='defmin' && pair[1] >= 0 && pair[1] < 60) { defmin=pair[1]; }
804: if (pair[0]=='defsec' && pair[1] >= 0 && pair[1] < 60) { defsec=pair[1]; }
1.1 www 805: }
806:
807: svalue=pvalue;
1.6 www 808: if (((ptype=='float') || (ptype=='string') || (ptype=='int')) &&
809: (pscat=='default') &&
1.11 www 810: (typeof(svalue)!="undefined") &&
811: (svalue!=0) && (svalue!='')) { pscat='any'; }
1.1 www 812:
1.13 www 813: if (ptype=='tolerance') {
814: var tperc=0;
815: var trange=0;
816: if (typeof(svalue)!='undefined') {
817: if (svalue.indexOf('%')!=-1) { tperc=1; }
818: if (svalue.indexOf(',')!=-1) { trange=1; }
819: if (trange) {
820: if (tperc) { pscat='relative'; } else { pscat='absolute'; }
821: } else {
822: if (tperc) { pscat='relative_sym'; } else { pscat='absolute_sym'; }
823: }
824: }
825: }
826:
1.1 www 827: this.window.selector.document.clear();
1.55 bisitz 828: selwrite('<html><body>');
829: selwrite('<head>');
830: selwrite('<style type="text/css">');
831: selwrite('<!--');
832: selwrite('body {');
833: selwrite('font-family: Verdana,Arial,Helvetica,sans-serif;');
834: selwrite('line-height:130%;');
835: selwrite('font-size:0.83em;');
836: selwrite('background: #FFFFFF;');
837: selwrite('}');
838: selwrite('-->');
839: selwrite('</style>');
840: selwrite('</head>');
1.51 bisitz 841: selwrite('<form name="fsel"><b>'+pname+'</b><br />');
1.53 bisitz 842: selwrite('<select name="fcat" onchange="parent.catchange();">');
1.12 www 843:
1.1 www 844: if (ptype=='tolerance') {
845: sopt('default','Default');
846: sopt('relative_sym','Relative Tolerance, Symmetric (percent)');
847: sopt('relative','Relative Tolerance (percentages)');
848: sopt('absolute_sym','Absolute Tolerance, Symmetric (value)');
849: sopt('absolute','Absolute Tolerance (values)');
850: }
851:
852: if (ptype=='date') {
1.48 albertel 853: if (pscat != 'interval') {
854: sopt('default','Default');
855: sopt('start','Starting Date');
856: sopt('end','Ending Date');
857: } else {
858: sopt('interval','Time Interval');
859: }
860:
1.11 www 861: if ((pvalue!='') && (typeof(pvalue)!="undefined")) {
1.2 www 862: cdate.setTime(pvalue*1000);
1.30 www 863: } else {
1.31 www 864: cdate.setSeconds(defsec);
865: cdate.setMinutes(defmin);
866: cdate.setHours(defhour);
1.2 www 867: }
868:
869: months[0]='January';
870: months[1]='February';
871: months[2]='March';
872: months[3]='April';
873: months[4]='May';
874: months[5]='June';
875: months[6]='July';
876: months[7]='August';
877: months[8]='September';
878: months[9]='October';
879: months[10]='November';
880: months[11]='December';
1.1 www 881: }
1.2 www 882:
1.6 www 883: if (ptype=='int') {
884: sopt('default','Default');
885: sopt('pos','Positive Integer, Not Zero');
886: sopt('zeropos','Positive Integer or Zero');
1.13 www 887: sopt('inrange','Integer in Range');
888: sopt('range','Range of Integers');
1.6 www 889: sopt('any','Integer');
1.1 www 890: }
891:
1.6 www 892: if (ptype=='float') {
893: sopt('default','Default');
894: sopt('zeroone','Floating Point between 0 and 1');
895: sopt('pos','Positive Floating Point');
896: sopt('any','Floating Point');
1.1 www 897:
898: }
899:
1.6 www 900: if (ptype=='string') {
1.44 albertel 901: //sopt('default','Default');
902: if (pscat == 'yesno') { sopt('yesno','Yes/No'); }
1.47 albertel 903: else if (pscat == 'problemstatus'){ sopt('problemstatus','Problem Status'); }
1.45 albertel 904: else if (pscat == 'examtype') { sopt('examtype','Exam Type'); }
905: else if (pscat == 'questiontype') { sopt('questiontype','Question Type'); }
906: else if (pscat == 'ip') { sopt('ip','IP Number/Name'); }
907: else if (pscat == 'fileext') { sopt('fileext','File Extension'); }
908: else if (pscat == 'useslots') { sopt('useslots','Slots control access'); }
909: else { pscat = 'any'; }
1.28 albertel 910: sopt('any','String Value');
1.22 www 911: }
912:
913: if (ptype=='color') {
914: sopt('default','Use Default Color');
915: sopt('custom','Use Custom Color');
1.1 www 916: }
917:
918: selwrite('</select></form>');
919:
1.2 www 920: selwrite('<a href="javascript:parent.assemble();');
1.1 www 921: if (preturn!='') {
1.4 www 922: selwrite(
923: 'parent.opener.document.'+preturn+'_value.value=parent.window.svalue;');
924: selwrite(
925: 'parent.opener.document.'+preturn+'_type.value=parent.window.stype;');
1.2 www 926: }
927: if (pmarker!='') {
1.4 www 928: selwrite(
929: 'parent.opener.document.'+preturn+'_marker.value=parent.window.pmarker;');
1.1 www 930: }
931: if (pcode!='') {
1.4 www 932: selwrite('parent.opener.'+pcode+'();');
1.1 www 933: }
1.43 albertel 934: selwrite('">Save</a> ');
1.5 www 935:
936: selwrite('<a href="javascript:');
937: selwrite(
938: 'parent.opener.document.'+preturn+'_value.value='+"'';");
939: if (pmarker!='') {
940: selwrite(
941: 'parent.opener.document.'+preturn+'_marker.value=parent.window.pmarker;');
942: }
943: if (pcode!='') {
944: selwrite('parent.opener.'+pcode+'();');
945: }
946: selwrite('">Delete</a> ');
1.4 www 947:
948: selwrite('<a href="javascript:');
1.17 matthew 949: // Old code :
950: //----------------------------------------------------------------------
951: // if (preturn!='') {
952: // selwrite('parent.opener.document.'+preturn+'_value.value='+"'';");
953: // selwrite('parent.opener.document.'+preturn+'_type.value='+"'';");
954: // }
955: // if (pmarker!='') {
956: // selwrite('parent.opener.document.'+preturn+'_marker.value='+"'';");
957: // }
958: // if (pcode!='') {
959: // selwrite('parent.opener.'+pcode+'();');
960: // }
961: //----------------------------------------------------------------------
962: // Just close the window to 'cancel' the operation. There are javascript
963: // errors in the above commented out code that I have not been able to
964: // track down. I think they reside in 'parent.opener.'+pcode+'();'
965: //
966: selwrite('this.parent.close();');
1.4 www 967: selwrite('">Cancel</a>');
1.1 www 968:
969: selwrite('</body></html>');
970: this.window.selector.document.close();
1.2 www 971: draw();
1.1 www 972:
973: }
974:
1.56 raeburn 975: // ]]>
1.1 www 976: </script>
1.56 raeburn 977: </head>
1.1 www 978:
1.56 raeburn 979: <frameset rows="120,*" onload="init();">
980: <frame name="selector" src="empty.html" />
981: <frame name="choices" src="empty.html" />
1.1 www 982: </frameset>
983:
984:
985:
1.16 albertel 986: </html>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>