Annotation of rat/client/parameter.html, revision 1.59.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! raeburn 8: // $Id: parameter.html,v 1.59 2010/12/18 23:18:50 raeburn Exp $
1.16 albertel 9: //
10: // Copyright Michigan State University Board of Trustees
11: //
12: // This file is part of the LearningOnline Network with CAPA (LON-CAPA).
13: //
14: // LON-CAPA is free software; you can redistribute it and/or modify
15: // it under the terms of the GNU General Public License as published by
16: // the Free Software Foundation; either version 2 of the License, or
17: // (at your option) any later version.
18: //
19: // LON-CAPA is distributed in the hope that it will be useful,
20: // but WITHOUT ANY WARRANTY; without even the implied warranty of
21: // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
22: // GNU General Public License for more details.
23: //
24: // You should have received a copy of the GNU General Public License
25: // along with LON-CAPA; if not, write to the Free Software
26: // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
27: //
28: // /home/httpd/html/adm/gpl.txt
29: //
30: // http://www.lon-capa.org/
31: //
1.1 www 32: -->
33: <head>
1.56 raeburn 34: <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
1.1 www 35: <title>LON-CAPA</title>
36:
1.46 albertel 37: <script type="text/javascript">
1.56 raeburn 38: // <![CDATA[
1.1 www 39:
40: var ptype='';
41: var pvalue='';
42: var preturn='';
43: var pcode='';
1.2 www 44: var pscat='';
45: var pmarker='';
1.1 www 46: var pname='';
47:
1.31 www 48: var defhour=0;
49: var defmin=0;
50: var defsec=0;
51:
1.1 www 52: var svalue;
1.2 www 53: var stype;
54: var smarker;
1.1 www 55:
56: var vars=new Array();
57:
1.2 www 58: var cdate=new Date();
59:
60: var csec;
61: var cmin;
62: var chour;
63: var cday;
64:
65: var months=new Array();
66:
67:
1.1 www 68: function selwrite(text) {
69: this.window.selector.document.write(text);
70: }
71:
72: function choicestart() {
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: }
667: if (pscat=='ip') {
668: tablestart('IP Number/Name');
1.52 bisitz 669: choicewrite('<tr><td>Value:</td><td colspan="2">');
1.46 albertel 670: choicewrite('<input name="stringval" size="20" value="'+escapeHTML(svalue)+
1.53 bisitz 671: '" onchange="parent.stringeval()" />');
1.6 www 672: }
1.26 www 673: if (pscat=='fileext') {
674: tablestart('Allowed File Extensions');
1.52 bisitz 675: choicewrite('<tr><td>Value:</td><td colspan="2">');
1.32 albertel 676: choicewrite('<label><input name="radstringval" value="txt"'+
1.29 www 677: ' type="radio" '+callradiostringeval('txt'));
1.53 bisitz 678: if (svalue=='txt') { choicewrite(' checked="checked"'); }
679: choicewrite(' /> Plain Text</label><br />');
1.32 albertel 680: choicewrite('<label><input name="radstringval" value="png,jpg,jpeg,gif"'+
1.29 www 681: ' type="radio" '+callradiostringeval('png,jpg,jpeg,gif'));
1.53 bisitz 682: if (svalue=='png,jpg,jpeg,gif') { choicewrite(' checked="checked"'); }
683: choicewrite(' /> Picture File</label><br />');
1.58 raeburn 684: choicewrite('<label><input name="radstringval" value="doc,docx,xls,xlsx,ppt,pptx"'+
685: ' type="radio" '+callradiostringeval('doc,docx,xls,xlsx,ppt,pptx'));
686: if (svalue=='doc,docx,xls,xlsx,ppt,pptx') { choicewrite(' checked="checked"'); }
1.53 bisitz 687: if (svalue=='doc,xls,ppt') { choicewrite(' checked="checked"'); }
688: choicewrite(' /> Office Document</label><br />');
1.46 albertel 689: choicewrite('<input name="stringval" size="20" value="'+escapeHTML(svalue)+
1.53 bisitz 690: '" onchange="parent.stringeval()" />');
1.26 www 691: }
1.37 albertel 692: if (pscat=='useslots') {
693: tablestart('Slots control access');
1.52 bisitz 694: choicewrite('<tr><td>Value:</td><td colspan="2">');
1.37 albertel 695: choicewrite('<label><input name="stringval" value="no"'+
696: ' type="radio" '+callradiostringeval('no'));
1.53 bisitz 697: if (svalue=='no') { choicewrite(' checked="checked"'); }
698: choicewrite(' /> No</label><br />');
1.37 albertel 699: choicewrite('<label><input name="stringval" value="resource"'+
700: ' type="radio" '+callradiostringeval('resource'));
1.53 bisitz 701: if (svalue=='resource') { choicewrite(' checked="checked"'); }
702: choicewrite(' /> Yes, and the scope of student selected slot is a single resource.</label><br />');
1.38 albertel 703: choicewrite('<label><input name="stringval" value="map"'+
704: ' type="radio" '+callradiostringeval('map'));
1.53 bisitz 705: if (svalue=='map') { choicewrite(' checked="checked"'); }
706: 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 707: choicewrite('<label><input name="stringval" value="map_map"'+
1.40 albertel 708: ' type="radio" '+callradiostringeval('map_map'));
1.53 bisitz 709: if (svalue=='map_map') { choicewrite(' checked="checked"'); }
1.55 bisitz 710: 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 711: choicewrite('</td></tr></table>');
1.6 www 712: }
1.21 www 713: }
714:
715: if (ptype=='color') {
716: tablestart('Choose a Color');
717: choicewrite('<table>');
718: if (svalue) {
1.23 www 719: choicewrite('<tr><td colspan="9">Current choice:</td><td bgcolor="'+
1.46 albertel 720: escapeHTML(svalue)+'" colspan="2"> </td></tr>');
1.21 www 721: }
1.23 www 722: for (var ir=0; ir<=10; ir++) {
723: for (var ig=0; ig<=10; ig++) {
1.21 www 724: choicewrite('<tr>');
1.23 www 725: for (var ib=0; ib<=10; ib++) {
1.21 www 726: colorfield(ir,ig,ib);
727: }
728: choicewrite('</tr>');
729: }
730: }
731: choicewrite('</table></td></table>');
1.1 www 732: }
733:
1.40 albertel 734: choicewrite('</form>');
1.1 www 735: choiceend();
736: }
737:
738: function sopt(va,text) {
739: selwrite('<option value="'+va+'"');
1.2 www 740: if (va==pscat) {
1.54 bisitz 741: selwrite(' selected="selected"');
1.1 www 742: }
743: selwrite('>'+text+'</option>');
744: }
745:
746: function catchange() {
747: var sform=selector.document.forms.fsel.fcat;
1.2 www 748: pscat=sform.options[sform.selectedIndex].value;
1.1 www 749: draw();
750: }
751:
752: function assemble() {
1.2 www 753: if ((ptype=='date') && (pscat!='interval')) {
1.41 www 754: svalue=Math.floor(cdate.getTime()/1000);
1.2 www 755: }
1.12 www 756: if (ptype=='tolerance') {
757: if (pscat=='relative_sym') {
758: svalue=choices.document.forms.sch.val2.value+'%';
759: if (choices.document.forms.sch.val3.checked) {
760: svalue+='+';
761: }
762: }
763: if (pscat=='absolute_sym') {
764: svalue=choices.document.forms.sch.val2.value;
765: if (choices.document.forms.sch.val3.checked) {
766: svalue+='+';
767: }
768: }
769: if (pscat=='absolute') {
770: svalue=choices.document.forms.sch.val2.value;
771: if (choices.document.forms.sch.val3.checked) {
772: svalue+='+';
773: }
774: svalue+=','+choices.document.forms.sch.val4.value;
775: if (choices.document.forms.sch.val5.checked) {
776: svalue+='+';
777: }
778: }
779: if (pscat=='relative') {
780: svalue=choices.document.forms.sch.val2.value+'%';
781: if (choices.document.forms.sch.val3.checked) {
782: svalue+='+';
783: }
784: svalue+=','+choices.document.forms.sch.val4.value+'%';
785: if (choices.document.forms.sch.val5.checked) {
786: svalue+='+';
787: }
788: }
1.14 www 789: }
790: if ((ptype=='int') && (pscat=='range')) {
791: svalue=choices.document.forms.sch.val2.value+','+
792: choices.document.forms.sch.val4.value;
1.12 www 793: }
1.6 www 794: if (pscat=='default') { svalue=''; }
1.2 www 795: stype=ptype+'_'+pscat;
1.1 www 796: }
797:
798:
799: function init() {
800: var i;
1.2 www 801: var subs=new Array();
1.1 www 802: var namevalue=this.window.location.search.split('&');
803: namevalue[0]=namevalue[0].substr(1,namevalue[0].length-1);
804:
805: for (i=0;i<namevalue.length;i++) {
806: var pair=namevalue[i].split('=');
1.3 www 807: pair[1]=unescape(pair[1]);
1.1 www 808: if (pair[0]=='value') { pvalue=pair[1]; }
1.2 www 809: if (pair[0]=='type') { subs=pair[1].split('_');
810: ptype=subs[0];
811: pscat=subs[1];
1.11 www 812: if (typeof(subs[2])!="undefined") {
813: pscat+='_'+subs[2];
814: }
815: if ((pscat=='') || (typeof(pscat)=="undefined")) {
1.6 www 816: pscat='default';
817: }
1.2 www 818: }
1.1 www 819: if (pair[0]=='return') { preturn=pair[1]; }
820: if (pair[0]=='call') { pcode=pair[1]; }
1.2 www 821: if (pair[0]=='marker') { pmarker=pair[1]; }
1.1 www 822: if (pair[0]=='name') { pname=pair[1]; }
1.34 albertel 823: if (pair[0]=='defhour' && pair[1] >= 0 && pair[1] < 24 ) {
824: defhour=pair[1];
825: }
826: if (pair[0]=='defmin' && pair[1] >= 0 && pair[1] < 60) { defmin=pair[1]; }
827: if (pair[0]=='defsec' && pair[1] >= 0 && pair[1] < 60) { defsec=pair[1]; }
1.1 www 828: }
829:
830: svalue=pvalue;
1.6 www 831: if (((ptype=='float') || (ptype=='string') || (ptype=='int')) &&
832: (pscat=='default') &&
1.11 www 833: (typeof(svalue)!="undefined") &&
834: (svalue!=0) && (svalue!='')) { pscat='any'; }
1.1 www 835:
1.13 www 836: if (ptype=='tolerance') {
837: var tperc=0;
838: var trange=0;
839: if (typeof(svalue)!='undefined') {
840: if (svalue.indexOf('%')!=-1) { tperc=1; }
841: if (svalue.indexOf(',')!=-1) { trange=1; }
842: if (trange) {
843: if (tperc) { pscat='relative'; } else { pscat='absolute'; }
844: } else {
845: if (tperc) { pscat='relative_sym'; } else { pscat='absolute_sym'; }
846: }
847: }
848: }
849:
1.59.2.1! raeburn 850: this.window.selector.document.open();
! 851: selwrite('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">');
! 852: selwrite('<html xmlns="http://www.w3.org/1999/xhtml">');
1.55 bisitz 853: selwrite('<head>');
1.59.2.1! raeburn 854: selwrite('<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />');
! 855: selwrite('<title>LON-CAPA</title>');
1.55 bisitz 856: selwrite('<style type="text/css">');
857: selwrite('<!--');
858: selwrite('body {');
859: selwrite('font-family: Verdana,Arial,Helvetica,sans-serif;');
860: selwrite('line-height:130%;');
861: selwrite('font-size:0.83em;');
862: selwrite('background: #FFFFFF;');
863: selwrite('}');
864: selwrite('-->');
865: selwrite('</style>');
866: selwrite('</head>');
1.59.2.1! raeburn 867: selwrite('<body>');
! 868: selwrite('<form name="fsel" action=""><b>'+pname+'</b><br />');
1.53 bisitz 869: selwrite('<select name="fcat" onchange="parent.catchange();">');
1.12 www 870:
1.1 www 871: if (ptype=='tolerance') {
872: sopt('default','Default');
873: sopt('relative_sym','Relative Tolerance, Symmetric (percent)');
874: sopt('relative','Relative Tolerance (percentages)');
875: sopt('absolute_sym','Absolute Tolerance, Symmetric (value)');
876: sopt('absolute','Absolute Tolerance (values)');
877: }
878:
879: if (ptype=='date') {
1.48 albertel 880: if (pscat != 'interval') {
881: sopt('default','Default');
882: sopt('start','Starting Date');
883: sopt('end','Ending Date');
884: } else {
885: sopt('interval','Time Interval');
886: }
887:
1.11 www 888: if ((pvalue!='') && (typeof(pvalue)!="undefined")) {
1.2 www 889: cdate.setTime(pvalue*1000);
1.30 www 890: } else {
1.31 www 891: cdate.setSeconds(defsec);
892: cdate.setMinutes(defmin);
893: cdate.setHours(defhour);
1.2 www 894: }
895:
896: months[0]='January';
897: months[1]='February';
898: months[2]='March';
899: months[3]='April';
900: months[4]='May';
901: months[5]='June';
902: months[6]='July';
903: months[7]='August';
904: months[8]='September';
905: months[9]='October';
906: months[10]='November';
907: months[11]='December';
1.1 www 908: }
1.2 www 909:
1.6 www 910: if (ptype=='int') {
911: sopt('default','Default');
912: sopt('pos','Positive Integer, Not Zero');
913: sopt('zeropos','Positive Integer or Zero');
1.13 www 914: sopt('inrange','Integer in Range');
915: sopt('range','Range of Integers');
1.6 www 916: sopt('any','Integer');
1.1 www 917: }
918:
1.6 www 919: if (ptype=='float') {
920: sopt('default','Default');
921: sopt('zeroone','Floating Point between 0 and 1');
922: sopt('pos','Positive Floating Point');
923: sopt('any','Floating Point');
1.1 www 924:
925: }
926:
1.6 www 927: if (ptype=='string') {
1.44 albertel 928: //sopt('default','Default');
929: if (pscat == 'yesno') { sopt('yesno','Yes/No'); }
1.47 albertel 930: else if (pscat == 'problemstatus'){ sopt('problemstatus','Problem Status'); }
1.45 albertel 931: else if (pscat == 'examtype') { sopt('examtype','Exam Type'); }
932: else if (pscat == 'questiontype') { sopt('questiontype','Question Type'); }
933: else if (pscat == 'ip') { sopt('ip','IP Number/Name'); }
934: else if (pscat == 'fileext') { sopt('fileext','File Extension'); }
935: else if (pscat == 'useslots') { sopt('useslots','Slots control access'); }
936: else { pscat = 'any'; }
1.28 albertel 937: sopt('any','String Value');
1.22 www 938: }
939:
940: if (ptype=='color') {
941: sopt('default','Use Default Color');
942: sopt('custom','Use Custom Color');
1.1 www 943: }
944:
945: selwrite('</select></form>');
946:
1.2 www 947: selwrite('<a href="javascript:parent.assemble();');
1.1 www 948: if (preturn!='') {
1.4 www 949: selwrite(
950: 'parent.opener.document.'+preturn+'_value.value=parent.window.svalue;');
951: selwrite(
952: 'parent.opener.document.'+preturn+'_type.value=parent.window.stype;');
1.2 www 953: }
954: if (pmarker!='') {
1.4 www 955: selwrite(
956: 'parent.opener.document.'+preturn+'_marker.value=parent.window.pmarker;');
1.1 www 957: }
958: if (pcode!='') {
1.4 www 959: selwrite('parent.opener.'+pcode+'();');
1.1 www 960: }
1.43 albertel 961: selwrite('">Save</a> ');
1.5 www 962:
963: selwrite('<a href="javascript:');
964: selwrite(
965: 'parent.opener.document.'+preturn+'_value.value='+"'';");
966: if (pmarker!='') {
967: selwrite(
968: 'parent.opener.document.'+preturn+'_marker.value=parent.window.pmarker;');
969: }
970: if (pcode!='') {
971: selwrite('parent.opener.'+pcode+'();');
972: }
973: selwrite('">Delete</a> ');
1.4 www 974:
975: selwrite('<a href="javascript:');
1.17 matthew 976: // Old code :
977: //----------------------------------------------------------------------
978: // if (preturn!='') {
979: // selwrite('parent.opener.document.'+preturn+'_value.value='+"'';");
980: // selwrite('parent.opener.document.'+preturn+'_type.value='+"'';");
981: // }
982: // if (pmarker!='') {
983: // selwrite('parent.opener.document.'+preturn+'_marker.value='+"'';");
984: // }
985: // if (pcode!='') {
986: // selwrite('parent.opener.'+pcode+'();');
987: // }
988: //----------------------------------------------------------------------
989: // Just close the window to 'cancel' the operation. There are javascript
990: // errors in the above commented out code that I have not been able to
991: // track down. I think they reside in 'parent.opener.'+pcode+'();'
992: //
993: selwrite('this.parent.close();');
1.4 www 994: selwrite('">Cancel</a>');
1.1 www 995:
996: selwrite('</body></html>');
997: this.window.selector.document.close();
1.2 www 998: draw();
1.1 www 999:
1000: }
1001:
1.56 raeburn 1002: // ]]>
1.1 www 1003: </script>
1.56 raeburn 1004: </head>
1.1 www 1005:
1.56 raeburn 1006: <frameset rows="120,*" onload="init();">
1007: <frame name="selector" src="empty.html" />
1008: <frame name="choices" src="empty.html" />
1.1 www 1009: </frameset>
1010:
1011:
1012:
1.16 albertel 1013: </html>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>