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