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