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