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