Annotation of rat/client/parameter.html, revision 1.46
1.1 www 1: <html>
2: <!--
3: The LearningOnline Network with CAPA
4: Parameter Input Window
1.16 albertel 5: //
1.46 ! albertel 6: // $Id: parameter.html,v 1.45 2007/06/13 01:01:33 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: }
559: if (pscat=='examtype') {
560: tablestart('Exam Type');
561: choicewrite('<tr bgcolor="#AAFFAA"><td>Value:</td><td colspan=2>');
1.32 albertel 562: choicewrite('<label><input name="stringval" value="online"'+
1.29 www 563: ' type="radio" '+callradiostringeval('online'));
1.25 www 564: if (svalue=='online') { choicewrite(' checked'); }
1.32 albertel 565: choicewrite('> Online</label><br />');
566: choicewrite('<label><input name="stringval" value="checkout"'+
1.29 www 567: ' type="radio" '+callradiostringeval('checkout'));
1.25 www 568: if (svalue=='checkout') { choicewrite(' checked'); }
1.32 albertel 569: choicewrite('> Check out</label><br />');
1.25 www 570: }
571: if (pscat=='questiontype') {
572: tablestart('Question Type');
573: choicewrite('<tr bgcolor="#AAFFAA"><td>Value:</td><td colspan=2>');
1.32 albertel 574: choicewrite('<label><input name="stringval" value="problem"'+
1.29 www 575: ' type="radio" '+callradiostringeval('problem'));
1.25 www 576: if (svalue=='problem') { choicewrite(' checked'); }
1.32 albertel 577: choicewrite('> Standard Problem</label><br />');
1.36 albertel 578: // choicewrite('<label><input name="stringval" value="quiz"'+
579: // ' type="radio" '+callradiostringeval('quiz'));
580: // if (svalue=='quiz') { choicewrite(' checked'); }
581: // choicewrite('> Quiz</label><br />');
1.35 albertel 582: choicewrite('<label><input name="stringval" value="practice"'+
583: ' type="radio" '+callradiostringeval('practice'));
584: if (svalue=='practice') { choicewrite(' checked'); }
585: choicewrite('> Practice</label><br />');
1.32 albertel 586: choicewrite('<label><input name="stringval" value="exam"'+
1.29 www 587: ' type="radio" '+callradiostringeval('exam'));
1.25 www 588: if (svalue=='exam') { choicewrite(' checked'); }
1.32 albertel 589: choicewrite('> Exam</label><br />');
1.36 albertel 590: // choicewrite('<label><input name="stringval" value="assess"'+
591: // ' type="radio" '+callradiostringeval('assess'));
592: // if (svalue=='assess') { choicewrite(' checked'); }
593: // choicewrite('> Assessment</label><br />');
1.32 albertel 594: choicewrite('<label><input name="stringval" value="survey"'+
1.29 www 595: ' type="radio" '+callradiostringeval('survey'));
1.25 www 596: if (svalue=='survey') { choicewrite(' checked'); }
1.32 albertel 597: choicewrite('> Survey</label><br />');
1.36 albertel 598: // choicewrite('<label><input name="stringval" value="form"'+
599: // ' type="radio" '+callradiostringeval('form'));
600: // if (svalue=='form') { choicewrite(' checked'); }
601: // choicewrite('> Input Form</label><br />');
1.32 albertel 602: choicewrite('<label><input name="stringval" value="library"'+
1.29 www 603: ' type="radio" '+callradiostringeval('library'));
1.25 www 604: if (svalue=='library') { choicewrite(' checked'); }
1.32 albertel 605: choicewrite('> Library</label><br />');
1.25 www 606: }
607: if (pscat=='ip') {
608: tablestart('IP Number/Name');
609: choicewrite('<tr bgcolor="#AAFFAA"><td>Value:</td><td colspan=2>');
1.46 ! albertel 610: choicewrite('<input name="stringval" size="20" value="'+escapeHTML(svalue)+
1.25 www 611: '" onChange="parent.stringeval()">');
1.6 www 612: }
1.26 www 613: if (pscat=='fileext') {
614: tablestart('Allowed File Extensions');
615: choicewrite('<tr bgcolor="#AAFFAA"><td>Value:</td><td colspan=2>');
1.32 albertel 616: choicewrite('<label><input name="radstringval" value="txt"'+
1.29 www 617: ' type="radio" '+callradiostringeval('txt'));
1.26 www 618: if (svalue=='txt') { choicewrite(' checked'); }
1.32 albertel 619: choicewrite('> Plain Text</label><br />');
620: choicewrite('<label><input name="radstringval" value="png,jpg,jpeg,gif"'+
1.29 www 621: ' type="radio" '+callradiostringeval('png,jpg,jpeg,gif'));
1.26 www 622: if (svalue=='png,jpg,jpeg,gif') { choicewrite(' checked'); }
1.32 albertel 623: choicewrite('> Picture File</label><br />');
624: choicewrite('<label><input name="radstringval" value="doc,xls,ppt"'+
1.29 www 625: ' type="radio" '+callradiostringeval('doc,xls,ppt'));
1.26 www 626: if (svalue=='doc,xls,ppt') { choicewrite(' checked'); }
1.32 albertel 627: choicewrite('> Office Document</label><br />');
1.46 ! albertel 628: choicewrite('<input name="stringval" size="20" value="'+escapeHTML(svalue)+
1.26 www 629: '" onChange="parent.stringeval()">');
630: }
1.37 albertel 631: if (pscat=='useslots') {
632: tablestart('Slots control access');
633: choicewrite('<tr bgcolor="#AAFFAA"><td>Value:</td><td colspan=2>');
634: choicewrite('<label><input name="stringval" value="no"'+
635: ' type="radio" '+callradiostringeval('no'));
636: if (svalue=='no') { choicewrite(' checked'); }
637: choicewrite('> No</label><br />');
638: choicewrite('<label><input name="stringval" value="resource"'+
639: ' type="radio" '+callradiostringeval('resource'));
640: if (svalue=='resource') { choicewrite(' checked'); }
641: choicewrite('> Yes, and the scope of student selected slot is a single resource.</label><br />');
1.38 albertel 642: choicewrite('<label><input name="stringval" value="map"'+
643: ' type="radio" '+callradiostringeval('map'));
644: if (svalue=='map') { choicewrite(' checked'); }
1.39 albertel 645: 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 />');
646: choicewrite('<label><input name="stringval" value="map_map"'+
1.40 albertel 647: ' type="radio" '+callradiostringeval('map_map'));
1.39 albertel 648: if (svalue=='map_map') { choicewrite(' checked'); }
649: 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 650: choicewrite('</td></table>');
651: }
1.21 www 652: }
653:
654: if (ptype=='color') {
655: tablestart('Choose a Color');
656: choicewrite('<table>');
657: if (svalue) {
1.23 www 658: choicewrite('<tr><td colspan="9">Current choice:</td><td bgcolor="'+
1.46 ! albertel 659: escapeHTML(svalue)+'" colspan="2"> </td></tr>');
1.21 www 660: }
1.23 www 661: for (var ir=0; ir<=10; ir++) {
662: for (var ig=0; ig<=10; ig++) {
1.21 www 663: choicewrite('<tr>');
1.23 www 664: for (var ib=0; ib<=10; ib++) {
1.21 www 665: colorfield(ir,ig,ib);
666: }
667: choicewrite('</tr>');
668: }
669: }
670: choicewrite('</table></td></table>');
1.1 www 671: }
672:
1.40 albertel 673: choicewrite('</form>');
1.1 www 674: choiceend();
675: }
676:
677: function sopt(va,text) {
678: selwrite('<option value="'+va+'"');
1.2 www 679: if (va==pscat) {
1.1 www 680: selwrite(' selected');
681: }
682: selwrite('>'+text+'</option>');
683: }
684:
685: function catchange() {
686: var sform=selector.document.forms.fsel.fcat;
1.2 www 687: pscat=sform.options[sform.selectedIndex].value;
1.1 www 688: draw();
689: }
690:
691: function assemble() {
1.2 www 692: if ((ptype=='date') && (pscat!='interval')) {
1.41 www 693: svalue=Math.floor(cdate.getTime()/1000);
1.2 www 694: }
1.12 www 695: if (ptype=='tolerance') {
696: if (pscat=='relative_sym') {
697: svalue=choices.document.forms.sch.val2.value+'%';
698: if (choices.document.forms.sch.val3.checked) {
699: svalue+='+';
700: }
701: }
702: if (pscat=='absolute_sym') {
703: svalue=choices.document.forms.sch.val2.value;
704: if (choices.document.forms.sch.val3.checked) {
705: svalue+='+';
706: }
707: }
708: if (pscat=='absolute') {
709: svalue=choices.document.forms.sch.val2.value;
710: if (choices.document.forms.sch.val3.checked) {
711: svalue+='+';
712: }
713: svalue+=','+choices.document.forms.sch.val4.value;
714: if (choices.document.forms.sch.val5.checked) {
715: svalue+='+';
716: }
717: }
718: if (pscat=='relative') {
719: svalue=choices.document.forms.sch.val2.value+'%';
720: if (choices.document.forms.sch.val3.checked) {
721: svalue+='+';
722: }
723: svalue+=','+choices.document.forms.sch.val4.value+'%';
724: if (choices.document.forms.sch.val5.checked) {
725: svalue+='+';
726: }
727: }
1.14 www 728: }
729: if ((ptype=='int') && (pscat=='range')) {
730: svalue=choices.document.forms.sch.val2.value+','+
731: choices.document.forms.sch.val4.value;
1.12 www 732: }
1.6 www 733: if (pscat=='default') { svalue=''; }
1.2 www 734: stype=ptype+'_'+pscat;
1.1 www 735: }
736:
737:
738: function init() {
739: var i;
1.2 www 740: var subs=new Array();
1.1 www 741: var namevalue=this.window.location.search.split('&');
742: namevalue[0]=namevalue[0].substr(1,namevalue[0].length-1);
743:
744: for (i=0;i<namevalue.length;i++) {
745: var pair=namevalue[i].split('=');
1.3 www 746: pair[1]=unescape(pair[1]);
1.1 www 747: if (pair[0]=='value') { pvalue=pair[1]; }
1.2 www 748: if (pair[0]=='type') { subs=pair[1].split('_');
749: ptype=subs[0];
750: pscat=subs[1];
1.11 www 751: if (typeof(subs[2])!="undefined") {
752: pscat+='_'+subs[2];
753: }
754: if ((pscat=='') || (typeof(pscat)=="undefined")) {
1.6 www 755: pscat='default';
756: }
1.2 www 757: }
1.1 www 758: if (pair[0]=='return') { preturn=pair[1]; }
759: if (pair[0]=='call') { pcode=pair[1]; }
1.2 www 760: if (pair[0]=='marker') { pmarker=pair[1]; }
1.1 www 761: if (pair[0]=='name') { pname=pair[1]; }
1.34 albertel 762: if (pair[0]=='defhour' && pair[1] >= 0 && pair[1] < 24 ) {
763: defhour=pair[1];
764: }
765: if (pair[0]=='defmin' && pair[1] >= 0 && pair[1] < 60) { defmin=pair[1]; }
766: if (pair[0]=='defsec' && pair[1] >= 0 && pair[1] < 60) { defsec=pair[1]; }
1.1 www 767: }
768:
769: svalue=pvalue;
1.6 www 770: if (((ptype=='float') || (ptype=='string') || (ptype=='int')) &&
771: (pscat=='default') &&
1.11 www 772: (typeof(svalue)!="undefined") &&
773: (svalue!=0) && (svalue!='')) { pscat='any'; }
1.1 www 774:
1.13 www 775: if (ptype=='tolerance') {
776: var tperc=0;
777: var trange=0;
778: if (typeof(svalue)!='undefined') {
779: if (svalue.indexOf('%')!=-1) { tperc=1; }
780: if (svalue.indexOf(',')!=-1) { trange=1; }
781: if (trange) {
782: if (tperc) { pscat='relative'; } else { pscat='absolute'; }
783: } else {
784: if (tperc) { pscat='relative_sym'; } else { pscat='absolute_sym'; }
785: }
786: }
787: }
788:
1.1 www 789: this.window.selector.document.clear();
790: selwrite('<html><body bgcolor="#FFFFFF">');
791:
1.8 www 792: selwrite('<form name="fsel"><b>'+pname+'</b><br>');
1.1 www 793: selwrite('<select name="fcat" onChange="parent.catchange();">');
1.12 www 794:
1.1 www 795: if (ptype=='tolerance') {
796: sopt('default','Default');
797: sopt('relative_sym','Relative Tolerance, Symmetric (percent)');
798: sopt('relative','Relative Tolerance (percentages)');
799: sopt('absolute_sym','Absolute Tolerance, Symmetric (value)');
800: sopt('absolute','Absolute Tolerance (values)');
801: }
802:
803: if (ptype=='date') {
804: sopt('default','Default');
805: sopt('start','Starting Date');
806: sopt('end','Ending Date');
1.2 www 807: sopt('interval','Time Interval');
808:
1.11 www 809: if ((pvalue!='') && (typeof(pvalue)!="undefined")) {
1.2 www 810: cdate.setTime(pvalue*1000);
1.30 www 811: } else {
1.31 www 812: cdate.setSeconds(defsec);
813: cdate.setMinutes(defmin);
814: cdate.setHours(defhour);
1.2 www 815: }
816:
817: months[0]='January';
818: months[1]='February';
819: months[2]='March';
820: months[3]='April';
821: months[4]='May';
822: months[5]='June';
823: months[6]='July';
824: months[7]='August';
825: months[8]='September';
826: months[9]='October';
827: months[10]='November';
828: months[11]='December';
1.1 www 829: }
1.2 www 830:
1.6 www 831: if (ptype=='int') {
832: sopt('default','Default');
833: sopt('pos','Positive Integer, Not Zero');
834: sopt('zeropos','Positive Integer or Zero');
1.13 www 835: sopt('inrange','Integer in Range');
836: sopt('range','Range of Integers');
1.6 www 837: sopt('any','Integer');
1.1 www 838: }
839:
1.6 www 840: if (ptype=='float') {
841: sopt('default','Default');
842: sopt('zeroone','Floating Point between 0 and 1');
843: sopt('pos','Positive Floating Point');
844: sopt('any','Floating Point');
1.1 www 845:
846: }
847:
1.6 www 848: if (ptype=='string') {
1.44 albertel 849: //sopt('default','Default');
850: if (pscat == 'yesno') { sopt('yesno','Yes/No'); }
1.45 albertel 851: else if (pscat == 'examtype') { sopt('examtype','Exam Type'); }
852: else if (pscat == 'questiontype') { sopt('questiontype','Question Type'); }
853: else if (pscat == 'ip') { sopt('ip','IP Number/Name'); }
854: else if (pscat == 'fileext') { sopt('fileext','File Extension'); }
855: else if (pscat == 'useslots') { sopt('useslots','Slots control access'); }
856: else { pscat = 'any'; }
1.28 albertel 857: sopt('any','String Value');
1.22 www 858: }
859:
860: if (ptype=='color') {
861: sopt('default','Use Default Color');
862: sopt('custom','Use Custom Color');
1.1 www 863: }
864:
865: selwrite('</select></form>');
866:
1.2 www 867: selwrite('<a href="javascript:parent.assemble();');
1.1 www 868: if (preturn!='') {
1.4 www 869: selwrite(
870: 'parent.opener.document.'+preturn+'_value.value=parent.window.svalue;');
871: selwrite(
872: 'parent.opener.document.'+preturn+'_type.value=parent.window.stype;');
1.2 www 873: }
874: if (pmarker!='') {
1.4 www 875: selwrite(
876: 'parent.opener.document.'+preturn+'_marker.value=parent.window.pmarker;');
1.1 www 877: }
878: if (pcode!='') {
1.4 www 879: selwrite('parent.opener.'+pcode+'();');
1.1 www 880: }
1.43 albertel 881: selwrite('">Save</a> ');
1.5 www 882:
883: selwrite('<a href="javascript:');
884: selwrite(
885: 'parent.opener.document.'+preturn+'_value.value='+"'';");
886: if (pmarker!='') {
887: selwrite(
888: 'parent.opener.document.'+preturn+'_marker.value=parent.window.pmarker;');
889: }
890: if (pcode!='') {
891: selwrite('parent.opener.'+pcode+'();');
892: }
893: selwrite('">Delete</a> ');
1.4 www 894:
895: selwrite('<a href="javascript:');
1.17 matthew 896: // Old code :
897: //----------------------------------------------------------------------
898: // if (preturn!='') {
899: // selwrite('parent.opener.document.'+preturn+'_value.value='+"'';");
900: // selwrite('parent.opener.document.'+preturn+'_type.value='+"'';");
901: // }
902: // if (pmarker!='') {
903: // selwrite('parent.opener.document.'+preturn+'_marker.value='+"'';");
904: // }
905: // if (pcode!='') {
906: // selwrite('parent.opener.'+pcode+'();');
907: // }
908: //----------------------------------------------------------------------
909: // Just close the window to 'cancel' the operation. There are javascript
910: // errors in the above commented out code that I have not been able to
911: // track down. I think they reside in 'parent.opener.'+pcode+'();'
912: //
913: selwrite('this.parent.close();');
1.4 www 914: selwrite('">Cancel</a>');
1.1 www 915:
916: selwrite('</body></html>');
917: this.window.selector.document.close();
1.2 www 918: draw();
1.1 www 919:
920: }
921:
922: </script>
923:
1.2 www 924: <frameset rows="120,*" onLoad="init();">
1.1 www 925: <frame name=selector src="empty.html">
926: <frame name=choices src="empty.html">
927: </frameset>
928:
929:
930:
1.16 albertel 931: </html>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>