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