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