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