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