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