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