Annotation of rat/client/parameter.html, revision 1.25
1.1 www 1: <html>
2: <!--
3: The LearningOnline Network with CAPA
4: Parameter Input Window
1.16 albertel 5: //
1.25 ! www 6: // $Id: parameter.html,v 1.24 2003/05/22 23:13:58 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>');
! 593: choicewrite('<input name=stringval size=20 value="'+svalue+
! 594: '" onChange="parent.stringeval()">');
1.6 www 595: }
596: choicewrite('</td></table>');
597: }
1.21 www 598: }
599:
600: if (ptype=='color') {
601: tablestart('Choose a Color');
602: choicewrite('<table>');
603: if (svalue) {
1.23 www 604: choicewrite('<tr><td colspan="9">Current choice:</td><td bgcolor="'+
605: svalue+'" colspan="2"> </td></tr>');
1.21 www 606: }
1.23 www 607: for (var ir=0; ir<=10; ir++) {
608: for (var ig=0; ig<=10; ig++) {
1.21 www 609: choicewrite('<tr>');
1.23 www 610: for (var ib=0; ib<=10; ib++) {
1.21 www 611: colorfield(ir,ig,ib);
612: }
613: choicewrite('</tr>');
614: }
615: }
616: choicewrite('</table></td></table>');
1.1 www 617: }
618:
619: choicewrite('</table></form>');
620: choiceend();
621: }
622:
623: function sopt(va,text) {
624: selwrite('<option value="'+va+'"');
1.2 www 625: if (va==pscat) {
1.1 www 626: selwrite(' selected');
627: }
628: selwrite('>'+text+'</option>');
629: }
630:
631: function catchange() {
632: var sform=selector.document.forms.fsel.fcat;
1.2 www 633: pscat=sform.options[sform.selectedIndex].value;
1.1 www 634: draw();
635: }
636:
637: function assemble() {
1.2 www 638: if ((ptype=='date') && (pscat!='interval')) {
639: svalue=Math.round(cdate.getTime()/1000);
640: }
1.12 www 641: if (ptype=='tolerance') {
642: if (pscat=='relative_sym') {
643: svalue=choices.document.forms.sch.val2.value+'%';
644: if (choices.document.forms.sch.val3.checked) {
645: svalue+='+';
646: }
647: }
648: if (pscat=='absolute_sym') {
649: svalue=choices.document.forms.sch.val2.value;
650: if (choices.document.forms.sch.val3.checked) {
651: svalue+='+';
652: }
653: }
654: if (pscat=='absolute') {
655: svalue=choices.document.forms.sch.val2.value;
656: if (choices.document.forms.sch.val3.checked) {
657: svalue+='+';
658: }
659: svalue+=','+choices.document.forms.sch.val4.value;
660: if (choices.document.forms.sch.val5.checked) {
661: svalue+='+';
662: }
663: }
664: if (pscat=='relative') {
665: svalue=choices.document.forms.sch.val2.value+'%';
666: if (choices.document.forms.sch.val3.checked) {
667: svalue+='+';
668: }
669: svalue+=','+choices.document.forms.sch.val4.value+'%';
670: if (choices.document.forms.sch.val5.checked) {
671: svalue+='+';
672: }
673: }
1.14 www 674: }
675: if ((ptype=='int') && (pscat=='range')) {
676: svalue=choices.document.forms.sch.val2.value+','+
677: choices.document.forms.sch.val4.value;
1.12 www 678: }
1.6 www 679: if (pscat=='default') { svalue=''; }
1.2 www 680: stype=ptype+'_'+pscat;
1.1 www 681: }
682:
683:
684: function init() {
685: var i;
1.2 www 686: var subs=new Array();
1.1 www 687: var namevalue=this.window.location.search.split('&');
688: namevalue[0]=namevalue[0].substr(1,namevalue[0].length-1);
689:
690: for (i=0;i<namevalue.length;i++) {
691: var pair=namevalue[i].split('=');
1.3 www 692: pair[1]=unescape(pair[1]);
1.1 www 693: if (pair[0]=='value') { pvalue=pair[1]; }
1.2 www 694: if (pair[0]=='type') { subs=pair[1].split('_');
695: ptype=subs[0];
696: pscat=subs[1];
1.11 www 697: if (typeof(subs[2])!="undefined") {
698: pscat+='_'+subs[2];
699: }
700: if ((pscat=='') || (typeof(pscat)=="undefined")) {
1.6 www 701: pscat='default';
702: }
1.2 www 703: }
1.1 www 704: if (pair[0]=='return') { preturn=pair[1]; }
705: if (pair[0]=='call') { pcode=pair[1]; }
1.2 www 706: if (pair[0]=='marker') { pmarker=pair[1]; }
1.1 www 707: if (pair[0]=='name') { pname=pair[1]; }
708: }
709:
710: svalue=pvalue;
1.6 www 711: if (((ptype=='float') || (ptype=='string') || (ptype=='int')) &&
712: (pscat=='default') &&
1.11 www 713: (typeof(svalue)!="undefined") &&
714: (svalue!=0) && (svalue!='')) { pscat='any'; }
1.1 www 715:
1.13 www 716: if (ptype=='tolerance') {
717: var tperc=0;
718: var trange=0;
719: if (typeof(svalue)!='undefined') {
720: if (svalue.indexOf('%')!=-1) { tperc=1; }
721: if (svalue.indexOf(',')!=-1) { trange=1; }
722: if (trange) {
723: if (tperc) { pscat='relative'; } else { pscat='absolute'; }
724: } else {
725: if (tperc) { pscat='relative_sym'; } else { pscat='absolute_sym'; }
726: }
727: }
728: }
729:
1.1 www 730: this.window.selector.document.clear();
731: selwrite('<html><body bgcolor="#FFFFFF">');
732:
1.8 www 733: selwrite('<form name="fsel"><b>'+pname+'</b><br>');
1.1 www 734: selwrite('<select name="fcat" onChange="parent.catchange();">');
1.12 www 735:
1.1 www 736: if (ptype=='tolerance') {
737: sopt('default','Default');
738: sopt('relative_sym','Relative Tolerance, Symmetric (percent)');
739: sopt('relative','Relative Tolerance (percentages)');
740: sopt('absolute_sym','Absolute Tolerance, Symmetric (value)');
741: sopt('absolute','Absolute Tolerance (values)');
742: }
743:
744: if (ptype=='date') {
745: sopt('default','Default');
746: sopt('start','Starting Date');
747: sopt('end','Ending Date');
1.2 www 748: sopt('interval','Time Interval');
749:
1.11 www 750: if ((pvalue!='') && (typeof(pvalue)!="undefined")) {
1.2 www 751: cdate.setTime(pvalue*1000);
752: }
753:
754: months[0]='January';
755: months[1]='February';
756: months[2]='March';
757: months[3]='April';
758: months[4]='May';
759: months[5]='June';
760: months[6]='July';
761: months[7]='August';
762: months[8]='September';
763: months[9]='October';
764: months[10]='November';
765: months[11]='December';
1.1 www 766: }
1.2 www 767:
1.6 www 768: if (ptype=='int') {
769: sopt('default','Default');
770: sopt('pos','Positive Integer, Not Zero');
771: sopt('zeropos','Positive Integer or Zero');
1.13 www 772: sopt('inrange','Integer in Range');
773: sopt('range','Range of Integers');
1.6 www 774: sopt('any','Integer');
1.1 www 775: }
776:
1.6 www 777: if (ptype=='float') {
778: sopt('default','Default');
779: sopt('zeroone','Floating Point between 0 and 1');
780: sopt('pos','Positive Floating Point');
781: sopt('any','Floating Point');
1.1 www 782:
783: }
784:
1.6 www 785: if (ptype=='string') {
786: sopt('default','Default');
787: sopt('string','String Value');
1.22 www 788: }
789:
790: if (ptype=='color') {
791: sopt('default','Use Default Color');
792: sopt('custom','Use Custom Color');
1.1 www 793: }
794:
795: selwrite('</select></form>');
796:
1.2 www 797: selwrite('<a href="javascript:parent.assemble();');
1.1 www 798: if (preturn!='') {
1.4 www 799: selwrite(
800: 'parent.opener.document.'+preturn+'_value.value=parent.window.svalue;');
801: selwrite(
802: 'parent.opener.document.'+preturn+'_type.value=parent.window.stype;');
1.2 www 803: }
804: if (pmarker!='') {
1.4 www 805: selwrite(
806: 'parent.opener.document.'+preturn+'_marker.value=parent.window.pmarker;');
1.1 www 807: }
808: if (pcode!='') {
1.4 www 809: selwrite('parent.opener.'+pcode+'();');
1.1 www 810: }
1.4 www 811: selwrite('">Store</a> ');
1.5 www 812:
813: selwrite('<a href="javascript:');
814: selwrite(
815: 'parent.opener.document.'+preturn+'_value.value='+"'';");
816: if (pmarker!='') {
817: selwrite(
818: 'parent.opener.document.'+preturn+'_marker.value=parent.window.pmarker;');
819: }
820: if (pcode!='') {
821: selwrite('parent.opener.'+pcode+'();');
822: }
823: selwrite('">Delete</a> ');
1.4 www 824:
825: selwrite('<a href="javascript:');
1.17 matthew 826: // Old code :
827: //----------------------------------------------------------------------
828: // if (preturn!='') {
829: // selwrite('parent.opener.document.'+preturn+'_value.value='+"'';");
830: // selwrite('parent.opener.document.'+preturn+'_type.value='+"'';");
831: // }
832: // if (pmarker!='') {
833: // selwrite('parent.opener.document.'+preturn+'_marker.value='+"'';");
834: // }
835: // if (pcode!='') {
836: // selwrite('parent.opener.'+pcode+'();');
837: // }
838: //----------------------------------------------------------------------
839: // Just close the window to 'cancel' the operation. There are javascript
840: // errors in the above commented out code that I have not been able to
841: // track down. I think they reside in 'parent.opener.'+pcode+'();'
842: //
843: selwrite('this.parent.close();');
1.4 www 844: selwrite('">Cancel</a>');
1.1 www 845:
846: selwrite('</body></html>');
847: this.window.selector.document.close();
1.2 www 848: draw();
1.1 www 849:
850: }
851:
852: </script>
853:
1.2 www 854: <frameset rows="120,*" onLoad="init();">
1.1 www 855: <frame name=selector src="empty.html">
856: <frame name=choices src="empty.html">
857: </frameset>
858:
859:
860:
1.16 albertel 861: </html>
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>