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