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