Annotation of rat/client/parameter.html, revision 1.64.2.2
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.2.2! raeburn 8: // $Id: parameter.html,v 1.64.2.1 2014/02/26 18:56:58 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.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.64.2.2! raeburn 345: return 'onclick="parent.radiostringeval(\''+newval+'\')"';
1.29 www 346: }
347:
1.2 www 348: function intervaldis() {
349: csecs=svalue;
350: cdays=Math.floor(csecs/86400);
351: csecs-=cdays*86400;
352: chours=Math.floor(csecs/3600);
353: csecs-=chours*3600;
354: cmins=Math.floor(csecs/60);
355: csecs-=cmins*60;
356: choicewrite(cdays+' days '+chours+' hours '
357: +cmins+' mins '+csecs+' secs');
358: }
1.21 www 359:
360: function pickcolor(picked) {
361: svalue=picked;
362: draw();
363: }
364:
365: function colorfield(ir,ig,ib) {
366: var col=new Array;
1.23 www 367: col=["00","11","22","44","66","88","AA","CC","DD","EE","FF"];
1.21 www 368: var color='#'+col[ir]+col[ig]+col[ib];
1.23 www 369: var selection="<font color='"+color+"'>X</font>";
370: if (color==svalue) { selection="<font color='#"+col[10-ir]+col[10-ig]+col[10-ib]+"'>X</font>"; }
1.21 www 371: choicewrite('<td bgcolor="'+color+'"><a href="javascript:parent.pickcolor('+"'"+
372: color+"'"+')">'+selection+'</a></td>');
373:
374: }
375:
1.1 www 376: function draw() {
377: choicestart();
1.51 bisitz 378: choicewrite('<form name="sch"');
1.6 www 379: if (ptype=='int') {
380: choicewrite(' action="javascript:integereval();"');
381: }
382: if (ptype=='float') {
383: choicewrite(' action="javascript:floateval();"');
384: }
385: if (ptype=='string') {
386: choicewrite(' action="javascript:stringeval();"');
387: }
1.62 raeburn 388: if (ptype != 'int' && ptype != 'float' && ptype != 'string') {
389: choicewrite(' action=""');
390: }
1.6 www 391: choicewrite('>');
1.1 www 392: if (ptype=='tolerance') {
1.2 www 393: // 0: pscat
394: if (pscat=='default') {
1.1 www 395: tablestart('Use default value or algorithm of resource');
396: }
1.2 www 397: if (pscat=='relative_sym') {
1.1 www 398: // 2: percentage
399: // 3: open
400: tablestart('Percentage error, symmetric around value');
401: valline('Percentage',2,3);
1.13 www 402: if ((svalue!='') && (typeof(svalue)!="undefined")) {
403: choices.document.forms.sch.val2.value=parseInt(svalue);
404: if (svalue.indexOf('+')!=-1) {
405: choices.document.forms.sch.val3.checked=true;
406: }
407: }
1.1 www 408: }
1.2 www 409: if (pscat=='relative') {
1.1 www 410: // 2: left
411: // 3: open
412: // 4: right
413: // 5: open
414: tablestart('Percentage error, asymmetric around value');
415: valline('Upper percentage',2,3);
416: valline('Lower percentage',4,5);
1.17 matthew 417: var range1=new Array;
1.13 www 418: if ((svalue!='') && (typeof(svalue)!="undefined")) {
1.17 matthew 419: range1=svalue.split(',');
420: if (typeof(range1[1])=='undefined') { range1[1]=range1[0]; }
421: choices.document.forms.sch.val2.value=parseFloat(range1[0]);
422: if (range1[0].indexOf('+')!=-1) {
1.13 www 423: choices.document.forms.sch.val3.checked=true;
424: }
1.17 matthew 425: choices.document.forms.sch.val4.value=parseFloat(range1[1]);
426: if (range1[1].indexOf('+')!=-1) {
1.13 www 427: choices.document.forms.sch.val5.checked=true;
428: }
429: }
1.1 www 430: }
1.2 www 431: if (pscat=='absolute_sym') {
1.1 www 432: tablestart('Absolute error, symmetric around value');
433: valline('Value',2,3);
1.13 www 434: if ((svalue!='') && (typeof(svalue)!="undefined")) {
1.15 www 435: choices.document.forms.sch.val2.value=parseFloat(svalue);
1.13 www 436: if (svalue.indexOf('+')!=-1) {
437: choices.document.forms.sch.val3.checked=true;
438: }
439: }
1.1 www 440: }
1.2 www 441: if (pscat=='absolute') {
1.1 www 442: tablestart('Absolute error, asymmetric around value');
443: valline('Upper value',2,3);
444: valline('Lower value',4,5);
1.17 matthew 445: var range2=new Array;
1.13 www 446: if ((svalue!='') && (typeof(svalue)!="undefined")) {
447: range=svalue.split(',');
1.17 matthew 448: if (typeof(range2[1])=='undefined') { range2[1]=range2[0]; }
449: choices.document.forms.sch.val2.value=parseFloat(range2[0]);
450: if (range2[0].indexOf('+')!=-1) {
1.13 www 451: choices.document.forms.sch.val3.checked=true;
452: }
1.17 matthew 453: choices.document.forms.sch.val4.value=parseFloat(range2[1]);
454: if (range2[1].indexOf('+')!=-1) {
1.13 www 455: choices.document.forms.sch.val5.checked=true;
456: }
457: }
1.1 www 458: }
459: }
460:
461: if (ptype=='date') {
1.2 www 462: if (pscat=='default') {
463: tablestart('Default value or none');
464: choicewrite('</table>');
465: } else {
466: if (pscat=='start') {
1.24 www 467: tablestart('Date and time');
1.2 www 468: }
469: if (pscat=='end') {
1.24 www 470: tablestart('Date and time');
1.2 www 471: }
472: if (pscat=='interval') {
473: tablestart('Time interval');
1.52 bisitz 474: choicewrite('<tr><td colspan="3">');
1.2 www 475: intervaldis();
1.52 bisitz 476: choicewrite('</td></tr><tr><td>Time:'
1.51 bisitz 477: +'</td><td colspan="2">');
1.2 www 478: intday();choicewrite('days ');
479: inthour();choicewrite('hours ');
480: intminute(); choicewrite('mins '); intsecond();
481: choicewrite('secs</td></tr></table>');
482: } else {
1.52 bisitz 483: choicewrite('<tr><td colspan="3">'
1.2 www 484: +cdate.toString()+
1.52 bisitz 485: '</td></tr><tr><td>Date:</td><td colspan="2">');
1.2 www 486: month();date();year();
1.52 bisitz 487: choicewrite('</td></tr><tr><td>Time:'
1.51 bisitz 488: +'</td><td colspan="2">');hour();choicewrite('h ');minute();
1.2 www 489: choicewrite('m ');second();
490: choicewrite('s</td></tr></table>');
491: }
492: }
1.1 www 493: }
494:
1.6 www 495: if (ptype=='int') {
1.19 www 496: var pscatparts=new Array;
497: pscatparts=pscat.split(',');
498: pscat=pscatparts[0];
1.6 www 499: if (pscat=='default') {
500: tablestart('Default value or none');
1.14 www 501: choicewrite('</table>');
1.6 www 502: } else {
1.14 www 503: if (pscat=='range') {
504: tablestart('Integer range');
1.52 bisitz 505: choicewrite('<tr><td>Lower Value:'+
1.51 bisitz 506: '</td><td colspan="2"><input type="text" size="4" name="val2'+
1.53 bisitz 507: '" /></td></tr>');
1.52 bisitz 508: choicewrite('<tr><td>Upper Value:'+
1.51 bisitz 509: '</td><td colspan="2"><input type="text" size="4" name="val4'+
1.53 bisitz 510: '" /></td></tr></table>');
1.14 www 511: var range=new Array;
512: if ((svalue!='') && (typeof(svalue)!="undefined")) {
513: range=svalue.split(',');
514: if (typeof(range[1])=='undefined') { range[1]=range[0]; }
515: choices.document.forms.sch.val2.value=parseInt(range[0]);
516: choices.document.forms.sch.val4.value=parseInt(range[1]);
517: }
518: } else {
1.6 www 519: if (pscat=='pos') {
520: tablestart('Positive (non-zero) integer');
521: }
522: if (pscat=='zeropos') {
523: tablestart('Positive integer or zero');
524: }
1.12 www 525: if (pscat.indexOf('inrange')!=-1) {
1.10 www 526: var rangeparts=new Array;
1.12 www 527: rangeparts=split(',',pscat);
1.10 www 528: tablestart('Integer in the range ['+rangeparts[1]+']');
529: }
1.6 www 530: if (pscat=='any') {
531: tablestart('Integer');
532: }
1.52 bisitz 533: choicewrite('<tr><td>Value:</td><td colspan="2">');
1.51 bisitz 534: choicewrite('<input name="intval" size="10" value="'+escapeHTML(svalue)+
1.53 bisitz 535: '" onchange="parent.integereval()" />');
1.54 bisitz 536: choicewrite('</td></tr></table>');
1.6 www 537: }
1.14 www 538: }
1.1 www 539: }
540:
1.6 www 541: if (ptype=='float') {
542: if (pscat=='default') {
543: tablestart('Default value or none');
544: choicewrite('</table>');
545: } else {
546: if (pscat=='pos') {
547: tablestart('Positive floating point number or zero');
548: }
549: if (pscat=='zeroone') {
550: tablestart('Floating point number between zero and one');
551: }
552: if (pscat=='any') {
553: tablestart('Floating point number');
554: }
1.52 bisitz 555: choicewrite('<tr><td>Value:</td><td colspan="2">');
1.51 bisitz 556: choicewrite('<input name="floatval" size="10" value="'+escapeHTML(svalue)+
1.53 bisitz 557: '" onchange="parent.floateval()" />');
1.54 bisitz 558: choicewrite('</td></tr></table>');
1.6 www 559: }
1.1 www 560: }
561:
1.6 www 562: if (ptype=='string') {
1.42 albertel 563: if ((pscat=='any') || (pscat=='') || (pscat=='default') ||
564: (typeof(pscat)=='undefined')) {
1.6 www 565: tablestart('Text');
1.54 bisitz 566: choicewrite('<tr><td>Value:</td><td colspan="2">');
1.46 albertel 567: choicewrite('<input name="stringval" size="20" value="'+escapeHTML(svalue)+
1.53 bisitz 568: '" type="text" onchange="parent.stringeval()" />');
1.25 www 569: }
570: if (pscat=='yesno') {
571: tablestart('Yes/No');
1.52 bisitz 572: choicewrite('<tr><td>Value:</td><td colspan="2">');
1.32 albertel 573: choicewrite('<label><input name="stringval" value="yes"'+
1.29 www 574: ' type="radio" '+callradiostringeval('yes'));
1.53 bisitz 575: if (svalue=='yes') { choicewrite(' checked="checked"'); }
576: choicewrite(' /> Yes</label><br />');
1.32 albertel 577: choicewrite('<label><input name="stringval" value="no"'+
1.29 www 578: ' type="radio" '+callradiostringeval('no'));
1.53 bisitz 579: if (svalue=='no') { choicewrite(' checked="checked"'); }
580: choicewrite(' /> No</label><br />');
1.25 www 581: }
1.47 albertel 582: if (pscat=='problemstatus') {
583: tablestart('Problem Status');
1.52 bisitz 584: choicewrite('<tr><td>Value:</td><td colspan="2">');
1.47 albertel 585: choicewrite('<label><input name="stringval" value="yes"'+
586: ' type="radio" '+callradiostringeval('yes'));
1.53 bisitz 587: if (svalue=='yes') { choicewrite(' checked="checked"'); }
588: choicewrite(' /> Yes</label><br />');
1.49 albertel 589: choicewrite('<label><input name="stringval" value="answer"'+
590: ' type="radio" '+callradiostringeval('answer'));
1.53 bisitz 591: if (svalue=='answer') { choicewrite(' checked="checked"'); }
592: choicewrite(' /> Yes, and show correct answer if they exceed the maximum number of tries.</label><br />');
1.47 albertel 593: choicewrite('<label><input name="stringval" value="no"'+
594: ' type="radio" '+callradiostringeval('no'));
1.53 bisitz 595: if (svalue=='no') { choicewrite(' checked="checked"'); }
596: choicewrite(' /> No, don\'t show correct/incorrect feedback.</label><br />');
1.47 albertel 597: choicewrite('<label><input name="stringval" value="no_feedback_ever"'+
598: ' type="radio" '+callradiostringeval('no_feedback_ever'));
1.53 bisitz 599: if (svalue=='no_feedback_ever') { choicewrite(' checked="checked"'); }
600: choicewrite(' /> No, show no feedback at all.</label><br />');
1.47 albertel 601: }
1.25 www 602: if (pscat=='examtype') {
603: tablestart('Exam Type');
1.52 bisitz 604: choicewrite('<tr><td>Value:</td><td colspan="2">');
1.32 albertel 605: choicewrite('<label><input name="stringval" value="online"'+
1.29 www 606: ' type="radio" '+callradiostringeval('online'));
1.53 bisitz 607: if (svalue=='online') { choicewrite(' checked="checked"'); }
608: choicewrite(' /> Online</label><br />');
1.32 albertel 609: choicewrite('<label><input name="stringval" value="checkout"'+
1.29 www 610: ' type="radio" '+callradiostringeval('checkout'));
1.53 bisitz 611: if (svalue=='checkout') { choicewrite(' checked="checked"'); }
612: choicewrite(' /> Check out</label><br />');
1.25 www 613: }
614: if (pscat=='questiontype') {
615: tablestart('Question Type');
1.52 bisitz 616: choicewrite('<tr><td>Value:</td><td colspan="2">');
1.32 albertel 617: choicewrite('<label><input name="stringval" value="problem"'+
1.29 www 618: ' type="radio" '+callradiostringeval('problem'));
1.53 bisitz 619: if (svalue=='problem') { choicewrite(' checked="checked"'); }
620: choicewrite(' /> Standard Problem</label><br />');
1.36 albertel 621: // choicewrite('<label><input name="stringval" value="quiz"'+
622: // ' type="radio" '+callradiostringeval('quiz'));
1.53 bisitz 623: // if (svalue=='quiz') { choicewrite(' checked="checked"'); }
624: // choicewrite(' /> Quiz</label><br />');
1.35 albertel 625: choicewrite('<label><input name="stringval" value="practice"'+
626: ' type="radio" '+callradiostringeval('practice'));
1.53 bisitz 627: if (svalue=='practice') { choicewrite(' checked="checked"'); }
628: choicewrite(' /> Practice</label><br />');
1.32 albertel 629: choicewrite('<label><input name="stringval" value="exam"'+
1.29 www 630: ' type="radio" '+callradiostringeval('exam'));
1.53 bisitz 631: if (svalue=='exam') { choicewrite(' checked="checked"'); }
632: choicewrite(' /> Exam</label><br />');
1.36 albertel 633: // choicewrite('<label><input name="stringval" value="assess"'+
634: // ' type="radio" '+callradiostringeval('assess'));
1.53 bisitz 635: // if (svalue=='assess') { choicewrite(' checked="checked"'); }
636: // choicewrite(' /> Assessment</label><br />');
1.32 albertel 637: choicewrite('<label><input name="stringval" value="survey"'+
1.29 www 638: ' type="radio" '+callradiostringeval('survey'));
1.53 bisitz 639: if (svalue=='survey') { choicewrite(' checked="checked"'); }
640: choicewrite(' /> Survey</label><br />');
1.36 albertel 641: // choicewrite('<label><input name="stringval" value="form"'+
642: // ' type="radio" '+callradiostringeval('form'));
1.53 bisitz 643: // if (svalue=='form') { choicewrite(' checked="checked"'); }
1.36 albertel 644: // choicewrite('> Input Form</label><br />');
1.57 raeburn 645: choicewrite('<label><input name="stringval" value="surveycred"'+
646: ' type="radio" '+callradiostringeval('surveycred'));
647: if (svalue=='surveycred') { choicewrite(' checked="checked"'); }
648: choicewrite('> Survey (credit for submission)</label><br />');
649: choicewrite('<label><input name="stringval" value="anonsurvey"'+
650: ' type="radio" '+callradiostringeval('anonsurvey'));
651: if (svalue=='anonsurvey') { choicewrite(' checked="checked"'); }
652: choicewrite('> Anonymous Survey</label><br />');
653: choicewrite('<label><input name="stringval" value="anonsurveycred"'+
654: ' type="radio" '+callradiostringeval('anonsurveycred'));
655: if (svalue=='anonsurveycred') { choicewrite(' checked="checked"'); }
656: choicewrite('> Anonymous Survey (credit for submission)</label><br />');
1.59 raeburn 657: choicewrite('<label><input name="stringval" value="randomizetry"'+
658: ' type="radio" '+callradiostringeval('randomizetry'));
659: if (svalue=='randomizetry') { choicewrite(' checked="checked"'); }
660: choicewrite('> New Randomization Each N Tries (default N=1)</label><br />');
1.32 albertel 661: choicewrite('<label><input name="stringval" value="library"'+
1.29 www 662: ' type="radio" '+callradiostringeval('library'));
1.53 bisitz 663: if (svalue=='library') { choicewrite(' checked="checked"'); }
664: choicewrite(' /> Library</label><br />');
1.25 www 665: }
1.60 raeburn 666: if (pscat=='lenient') {
667: tablestart('Lenient Grading (Partial Credit)');
668: choicewrite('<tr><td>Value:</td><td colspan="2">');
669: choicewrite('<label><input name="stringval" value="yes"'+
670: ' type="radio" '+callradiostringeval('yes'));
671: if (svalue=='yes') { choicewrite(' checked="checked"'); }
672: choicewrite(' /> Yes</label><br />');
673: choicewrite('<label><input name="stringval" value="no"'+
674: ' type="radio" '+callradiostringeval('no'));
675: if (svalue=='no') { choicewrite(' checked="checked"'); }
676: choicewrite(' /> No</label><br />');
677: choicewrite('<label><input name="stringval" value="default"'+
678: ' type="radio" '+callradiostringeval('default'));
679: if (svalue=='default') { choicewrite(' checked="checked"'); }
680: choicewrite(' /> Default (only bubblesheet grading is lenient)</label><br />');
681: }
1.64 raeburn 682: if (pscat=='discussvote') {
683: tablestart('Discussion Voting');
684: choicewrite('<tr><td>Value:</td><td colspan="2">');
685: choicewrite('<label><input name="stringval" value="yes"'+
686: ' type="radio" '+callradiostringeval('yes'));
687: if (svalue=='yes') { choicewrite(' checked="checked"'); }
688: choicewrite(' /> Yes</label><br />');
689: choicewrite('<label><input name="stringval" value="notended"'+
690: ' type="radio" '+callradiostringeval('notended'));
691: if (svalue=='notended') { choicewrite(' checked="checked"'); }
692: choicewrite(' /> Yes, unless discussion ended</label><br />');
693: choicewrite('<label><input name="stringval" value="no"'+
694: ' type="radio" '+callradiostringeval('no'));
695: if (svalue=='no') { choicewrite(' checked="checked"'); }
696: choicewrite(' /> No</label><br />');
697: }
1.25 www 698: if (pscat=='ip') {
699: tablestart('IP Number/Name');
1.52 bisitz 700: choicewrite('<tr><td>Value:</td><td colspan="2">');
1.46 albertel 701: choicewrite('<input name="stringval" size="20" value="'+escapeHTML(svalue)+
1.53 bisitz 702: '" onchange="parent.stringeval()" />');
1.6 www 703: }
1.26 www 704: if (pscat=='fileext') {
705: tablestart('Allowed File Extensions');
1.52 bisitz 706: choicewrite('<tr><td>Value:</td><td colspan="2">');
1.32 albertel 707: choicewrite('<label><input name="radstringval" value="txt"'+
1.29 www 708: ' type="radio" '+callradiostringeval('txt'));
1.53 bisitz 709: if (svalue=='txt') { choicewrite(' checked="checked"'); }
710: choicewrite(' /> Plain Text</label><br />');
1.32 albertel 711: choicewrite('<label><input name="radstringval" value="png,jpg,jpeg,gif"'+
1.29 www 712: ' type="radio" '+callradiostringeval('png,jpg,jpeg,gif'));
1.53 bisitz 713: if (svalue=='png,jpg,jpeg,gif') { choicewrite(' checked="checked"'); }
714: choicewrite(' /> Picture File</label><br />');
1.58 raeburn 715: choicewrite('<label><input name="radstringval" value="doc,docx,xls,xlsx,ppt,pptx"'+
716: ' type="radio" '+callradiostringeval('doc,docx,xls,xlsx,ppt,pptx'));
717: if (svalue=='doc,docx,xls,xlsx,ppt,pptx') { choicewrite(' checked="checked"'); }
1.53 bisitz 718: if (svalue=='doc,xls,ppt') { choicewrite(' checked="checked"'); }
719: choicewrite(' /> Office Document</label><br />');
1.46 albertel 720: choicewrite('<input name="stringval" size="20" value="'+escapeHTML(svalue)+
1.53 bisitz 721: '" onchange="parent.stringeval()" />');
1.26 www 722: }
1.37 albertel 723: if (pscat=='useslots') {
724: tablestart('Slots control access');
1.52 bisitz 725: choicewrite('<tr><td>Value:</td><td colspan="2">');
1.37 albertel 726: choicewrite('<label><input name="stringval" value="no"'+
727: ' type="radio" '+callradiostringeval('no'));
1.53 bisitz 728: if (svalue=='no') { choicewrite(' checked="checked"'); }
729: choicewrite(' /> No</label><br />');
1.37 albertel 730: choicewrite('<label><input name="stringval" value="resource"'+
731: ' type="radio" '+callradiostringeval('resource'));
1.53 bisitz 732: if (svalue=='resource') { choicewrite(' checked="checked"'); }
733: choicewrite(' /> Yes, and the scope of student selected slot is a single resource.</label><br />');
1.38 albertel 734: choicewrite('<label><input name="stringval" value="map"'+
735: ' type="radio" '+callradiostringeval('map'));
1.53 bisitz 736: if (svalue=='map') { choicewrite(' checked="checked"'); }
737: 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 738: choicewrite('<label><input name="stringval" value="map_map"'+
1.40 albertel 739: ' type="radio" '+callradiostringeval('map_map'));
1.53 bisitz 740: if (svalue=='map_map') { choicewrite(' checked="checked"'); }
1.55 bisitz 741: 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 742: choicewrite('</td></tr></table>');
1.6 www 743: }
1.21 www 744: }
745:
746: if (ptype=='color') {
747: tablestart('Choose a Color');
748: choicewrite('<table>');
749: if (svalue) {
1.23 www 750: choicewrite('<tr><td colspan="9">Current choice:</td><td bgcolor="'+
1.46 albertel 751: escapeHTML(svalue)+'" colspan="2"> </td></tr>');
1.21 www 752: }
1.23 www 753: for (var ir=0; ir<=10; ir++) {
754: for (var ig=0; ig<=10; ig++) {
1.21 www 755: choicewrite('<tr>');
1.23 www 756: for (var ib=0; ib<=10; ib++) {
1.21 www 757: colorfield(ir,ig,ib);
758: }
759: choicewrite('</tr>');
760: }
761: }
762: choicewrite('</table></td></table>');
1.1 www 763: }
764:
1.40 albertel 765: choicewrite('</form>');
1.1 www 766: choiceend();
767: }
768:
769: function sopt(va,text) {
770: selwrite('<option value="'+va+'"');
1.2 www 771: if (va==pscat) {
1.54 bisitz 772: selwrite(' selected="selected"');
1.1 www 773: }
774: selwrite('>'+text+'</option>');
775: }
776:
777: function catchange() {
778: var sform=selector.document.forms.fsel.fcat;
1.2 www 779: pscat=sform.options[sform.selectedIndex].value;
1.1 www 780: draw();
781: }
782:
783: function assemble() {
1.2 www 784: if ((ptype=='date') && (pscat!='interval')) {
1.41 www 785: svalue=Math.floor(cdate.getTime()/1000);
1.2 www 786: }
1.12 www 787: if (ptype=='tolerance') {
788: if (pscat=='relative_sym') {
789: svalue=choices.document.forms.sch.val2.value+'%';
790: if (choices.document.forms.sch.val3.checked) {
791: svalue+='+';
792: }
793: }
794: if (pscat=='absolute_sym') {
795: svalue=choices.document.forms.sch.val2.value;
796: if (choices.document.forms.sch.val3.checked) {
797: svalue+='+';
798: }
799: }
800: if (pscat=='absolute') {
801: svalue=choices.document.forms.sch.val2.value;
802: if (choices.document.forms.sch.val3.checked) {
803: svalue+='+';
804: }
805: svalue+=','+choices.document.forms.sch.val4.value;
806: if (choices.document.forms.sch.val5.checked) {
807: svalue+='+';
808: }
809: }
810: if (pscat=='relative') {
811: svalue=choices.document.forms.sch.val2.value+'%';
812: if (choices.document.forms.sch.val3.checked) {
813: svalue+='+';
814: }
815: svalue+=','+choices.document.forms.sch.val4.value+'%';
816: if (choices.document.forms.sch.val5.checked) {
817: svalue+='+';
818: }
819: }
1.14 www 820: }
821: if ((ptype=='int') && (pscat=='range')) {
822: svalue=choices.document.forms.sch.val2.value+','+
823: choices.document.forms.sch.val4.value;
1.12 www 824: }
1.6 www 825: if (pscat=='default') { svalue=''; }
1.2 www 826: stype=ptype+'_'+pscat;
1.1 www 827: }
828:
829:
830: function init() {
831: var i;
1.2 www 832: var subs=new Array();
1.1 www 833: var namevalue=this.window.location.search.split('&');
834: namevalue[0]=namevalue[0].substr(1,namevalue[0].length-1);
835:
836: for (i=0;i<namevalue.length;i++) {
837: var pair=namevalue[i].split('=');
1.3 www 838: pair[1]=unescape(pair[1]);
1.1 www 839: if (pair[0]=='value') { pvalue=pair[1]; }
1.2 www 840: if (pair[0]=='type') { subs=pair[1].split('_');
841: ptype=subs[0];
842: pscat=subs[1];
1.11 www 843: if (typeof(subs[2])!="undefined") {
844: pscat+='_'+subs[2];
845: }
846: if ((pscat=='') || (typeof(pscat)=="undefined")) {
1.6 www 847: pscat='default';
848: }
1.2 www 849: }
1.1 www 850: if (pair[0]=='return') { preturn=pair[1]; }
851: if (pair[0]=='call') { pcode=pair[1]; }
1.2 www 852: if (pair[0]=='marker') { pmarker=pair[1]; }
1.1 www 853: if (pair[0]=='name') { pname=pair[1]; }
1.63 www 854: if (pair[0]=='modal') { pmodal=pair[1]; }
1.34 albertel 855: if (pair[0]=='defhour' && pair[1] >= 0 && pair[1] < 24 ) {
856: defhour=pair[1];
857: }
858: if (pair[0]=='defmin' && pair[1] >= 0 && pair[1] < 60) { defmin=pair[1]; }
859: if (pair[0]=='defsec' && pair[1] >= 0 && pair[1] < 60) { defsec=pair[1]; }
1.1 www 860: }
861:
862: svalue=pvalue;
1.6 www 863: if (((ptype=='float') || (ptype=='string') || (ptype=='int')) &&
864: (pscat=='default') &&
1.11 www 865: (typeof(svalue)!="undefined") &&
866: (svalue!=0) && (svalue!='')) { pscat='any'; }
1.1 www 867:
1.13 www 868: if (ptype=='tolerance') {
869: var tperc=0;
870: var trange=0;
871: if (typeof(svalue)!='undefined') {
872: if (svalue.indexOf('%')!=-1) { tperc=1; }
873: if (svalue.indexOf(',')!=-1) { trange=1; }
874: if (trange) {
875: if (tperc) { pscat='relative'; } else { pscat='absolute'; }
876: } else {
877: if (tperc) { pscat='relative_sym'; } else { pscat='absolute_sym'; }
878: }
879: }
880: }
881:
1.61 raeburn 882: this.window.selector.document.open();
1.62 raeburn 883: selwrite('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
884: selwrite('<html xmlns="http://www.w3.org/1999/xhtml">');
1.55 bisitz 885: selwrite('<head>');
1.62 raeburn 886: selwrite('<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />');
887: selwrite('<title>LON-CAPA</title>');
1.55 bisitz 888: selwrite('<style type="text/css">');
889: selwrite('<!--');
890: selwrite('body {');
891: selwrite('font-family: Verdana,Arial,Helvetica,sans-serif;');
892: selwrite('line-height:130%;');
893: selwrite('font-size:0.83em;');
894: selwrite('background: #FFFFFF;');
895: selwrite('}');
896: selwrite('-->');
897: selwrite('</style>');
898: selwrite('</head>');
1.62 raeburn 899: selwrite('<body>');
900: selwrite('<form name="fsel" action=""><b>'+pname+'</b><br />');
1.64.2.1 raeburn 901: selwrite('Format of Value(s): <select name="fcat" onchange="parent.catchange();">');
1.12 www 902:
1.1 www 903: if (ptype=='tolerance') {
904: sopt('default','Default');
905: sopt('relative_sym','Relative Tolerance, Symmetric (percent)');
906: sopt('relative','Relative Tolerance (percentages)');
907: sopt('absolute_sym','Absolute Tolerance, Symmetric (value)');
908: sopt('absolute','Absolute Tolerance (values)');
909: }
910:
911: if (ptype=='date') {
1.48 albertel 912: if (pscat != 'interval') {
913: sopt('default','Default');
914: sopt('start','Starting Date');
915: sopt('end','Ending Date');
916: } else {
917: sopt('interval','Time Interval');
918: }
919:
1.11 www 920: if ((pvalue!='') && (typeof(pvalue)!="undefined")) {
1.2 www 921: cdate.setTime(pvalue*1000);
1.30 www 922: } else {
1.31 www 923: cdate.setSeconds(defsec);
924: cdate.setMinutes(defmin);
925: cdate.setHours(defhour);
1.2 www 926: }
927:
928: months[0]='January';
929: months[1]='February';
930: months[2]='March';
931: months[3]='April';
932: months[4]='May';
933: months[5]='June';
934: months[6]='July';
935: months[7]='August';
936: months[8]='September';
937: months[9]='October';
938: months[10]='November';
939: months[11]='December';
1.1 www 940: }
1.2 www 941:
1.6 www 942: if (ptype=='int') {
943: sopt('default','Default');
944: sopt('pos','Positive Integer, Not Zero');
945: sopt('zeropos','Positive Integer or Zero');
1.13 www 946: sopt('inrange','Integer in Range');
947: sopt('range','Range of Integers');
1.6 www 948: sopt('any','Integer');
1.1 www 949: }
950:
1.6 www 951: if (ptype=='float') {
952: sopt('default','Default');
953: sopt('zeroone','Floating Point between 0 and 1');
954: sopt('pos','Positive Floating Point');
955: sopt('any','Floating Point');
1.1 www 956:
957: }
958:
1.6 www 959: if (ptype=='string') {
1.44 albertel 960: //sopt('default','Default');
961: if (pscat == 'yesno') { sopt('yesno','Yes/No'); }
1.47 albertel 962: else if (pscat == 'problemstatus'){ sopt('problemstatus','Problem Status'); }
1.45 albertel 963: else if (pscat == 'examtype') { sopt('examtype','Exam Type'); }
964: else if (pscat == 'questiontype') { sopt('questiontype','Question Type'); }
1.60 raeburn 965: else if (pscat == 'lenient') { sopt('lenient','Lenient Grading (Partial Credit)'); }
1.64 raeburn 966: else if (pscat == 'discussvote') { sopt('discussvote','Discussion Voting'); }
1.45 albertel 967: else if (pscat == 'ip') { sopt('ip','IP Number/Name'); }
968: else if (pscat == 'fileext') { sopt('fileext','File Extension'); }
969: else if (pscat == 'useslots') { sopt('useslots','Slots control access'); }
970: else { pscat = 'any'; }
1.28 albertel 971: sopt('any','String Value');
1.22 www 972: }
973:
974: if (ptype=='color') {
975: sopt('default','Use Default Color');
976: sopt('custom','Use Custom Color');
1.1 www 977: }
978:
979: selwrite('</select></form>');
1.63 www 980: var targ='parent.opener';
981: if (pmodal==1) {
982: targ='parent.parent';
983: }
1.2 www 984: selwrite('<a href="javascript:parent.assemble();');
1.1 www 985: if (preturn!='') {
1.63 www 986: selwrite(targ+'.document.'+preturn+'_value.value=parent.window.svalue;');
987: selwrite(targ+'.document.'+preturn+'_type.value=parent.window.stype;');
1.2 www 988: }
989: if (pmarker!='') {
1.63 www 990: selwrite(targ+'.document.'+preturn+'_marker.value=parent.window.pmarker;');
1.1 www 991: }
992: if (pcode!='') {
1.63 www 993: selwrite(targ+'.'+pcode+'();');
1.1 www 994: }
1.43 albertel 995: selwrite('">Save</a> ');
1.5 www 996:
997: selwrite('<a href="javascript:');
1.63 www 998: selwrite(targ+'.document.'+preturn+'_value.value='+"'';");
1.5 www 999: if (pmarker!='') {
1000: selwrite(
1.63 www 1001: targ+'.document.'+preturn+'_marker.value=parent.window.pmarker;');
1.5 www 1002: }
1003: if (pcode!='') {
1.63 www 1004: selwrite(targ+'.'+pcode+'();');
1.5 www 1005: }
1006: selwrite('">Delete</a> ');
1.4 www 1007:
1.1 www 1008: selwrite('</body></html>');
1009: this.window.selector.document.close();
1.2 www 1010: draw();
1.1 www 1011:
1012: }
1013:
1.56 raeburn 1014: // ]]>
1.1 www 1015: </script>
1.56 raeburn 1016: </head>
1.1 www 1017:
1.56 raeburn 1018: <frameset rows="120,*" onload="init();">
1019: <frame name="selector" src="empty.html" />
1020: <frame name="choices" src="empty.html" />
1.1 www 1021: </frameset>
1022:
1023:
1024:
1.16 albertel 1025: </html>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>