--- rat/client/parameter.html 2000/06/28 03:41:48 1.1 +++ rat/client/parameter.html 2003/04/19 15:34:06 1.22 @@ -2,7 +2,34 @@ LON-CAPA @@ -14,14 +41,26 @@ var ptype=''; var pvalue=''; var preturn=''; var pcode=''; -var poptions=''; +var pscat=''; +var pmarker=''; var pname=''; var svalue; +var stype; +var smarker; -var scat; var vars=new Array(); +var cdate=new Date(); + +var csec; +var cmin; +var chour; +var cday; + +var months=new Array(); + + function selwrite(text) { this.window.selector.document.write(text); } @@ -52,32 +91,278 @@ function valline(text,id1,id2) { id2+'>'); } -function afterproc() { - choicewrite('Error after rounding: ' - +''); +function datecalc() { + var sform=choices.document.forms.sch; + + cdate.setHours(sform.hours.options[sform.hours.selectedIndex].value); + cdate.setMinutes(sform.minutes.options[sform.minutes.selectedIndex].value); + cdate.setSeconds(sform.minutes.options[sform.seconds.selectedIndex].value); + cdate.setDate(sform.date.options[sform.date.selectedIndex].value); + cdate.setMonth(sform.month.options[sform.month.selectedIndex].value); + cdate.setFullYear(sform.year.options[sform.year.selectedIndex].value); + + draw(); +} + +function hour() { + var thishour=cdate.getHours(); + var i; var j; + choicewrite(''); +} + +function minute() { + var thisminutes=cdate.getMinutes(); + var i; + choicewrite(''); +} + +function second() { + var thisseconds=cdate.getSeconds(); + var i; + choicewrite(''); +} + + +function date() { + var thisdate=cdate.getDate(); + var i; + choicewrite(''); +} + +function year() { + var thisyear=cdate.getFullYear(); + var nowdate=new Date(); + var nowyear=nowdate.getFullYear(); + var loweryear=thisyear-2; + var upperyear=thisyear+5; + if (thisyear>nowyear) { loweryear=nowyear-2; } + if (thisyear'); + for (i=loweryear;i<=upperyear;i++) { + choicewrite(''); + } + choicewrite(''); +} + +function month() { + var thismonth=cdate.getMonth(); + var i; + choicewrite(''); +} + + +function intminute() { + var thisminutes=cmins; + var i; + choicewrite(''); +} + +function inthour() { + var thishours=chours; + var i; + choicewrite(''); +} + +function intsecond() { + var thisseconds=csecs; + var i; + choicewrite(''); +} + + +function intday() { + var thisdate=cdays; + var i; + choicewrite(''); +} + +function intcalc() { + var sform=choices.document.forms.sch; + svalue=((sform.date.options[sform.date.selectedIndex].value*24+ + sform.hours.options[sform.hours.selectedIndex].value*1)*60+ + sform.minutes.options[sform.minutes.selectedIndex].value*1)*60+ + sform.seconds.options[sform.seconds.selectedIndex].value*1; + draw(); +} + +function integereval() { + svalue=choices.document.forms.sch.intval.value; + svalue=Math.round(svalue); + if (pscat=='zeropos') { svalue=Math.abs(svalue); } + if ((pscat=='pos') && (svalue==0)) { + svalue=''; + } + if (pscat.indexOf('inrange')!=-1) { + var rangeparts=new Array; + rangeparts=split('_',pscat); + rangeparts=split(',',rangeparts[1]); + if (svaluerangeparts[1]) { svalue=rangeparts[1]; } + } + draw(); +} + +function floateval() { + svalue=choices.document.forms.sch.floatval.value; + svalue=1.0*svalue; + if (pscat=='pos') { svalue=Math.abs(svalue); } + if ((pscat=='zeroone') && ((svalue<0) || (svalue>1))) { + svalue=''; + } + draw(); } +function stringeval() { + svalue=choices.document.forms.sch.stringval.value; + draw(); +} + +function intervaldis() { + csecs=svalue; + cdays=Math.floor(csecs/86400); + csecs-=cdays*86400; + chours=Math.floor(csecs/3600); + csecs-=chours*3600; + cmins=Math.floor(csecs/60); + csecs-=cmins*60; + choicewrite(cdays+' days '+chours+' hours ' + +cmins+' mins '+csecs+' secs'); +} + +function pickcolor(picked) { + svalue=picked; + draw(); +} + +function colorfield(ir,ig,ib) { + var col=new Array; + col=["00","11","22","33","44","55","66","77","88","99","AA","BB","CC","DD","EE","FF"]; + var color='#'+col[ir]+col[ig]+col[ib]; + var selection="   "; + if (color==svalue) { selection="X"; } + choicewrite(''+selection+''); + +} + function draw() { choicestart(); - choicewrite('
'); + choicewrite(''); if (ptype=='tolerance') { -// 0: scat -// 1: after processing - if (scat=='default') { +// 0: pscat + if (pscat=='default') { tablestart('Use default value or algorithm of resource'); } - if (scat=='exact') { - tablestart('Accept only exact value, zero tolerance'); - afterproc(); - } - if (scat=='relative_sym') { + if (pscat=='relative_sym') { // 2: percentage // 3: open tablestart('Percentage error, symmetric around value'); valline('Percentage',2,3); - afterproc(); + if ((svalue!='') && (typeof(svalue)!="undefined")) { + choices.document.forms.sch.val2.value=parseInt(svalue); + if (svalue.indexOf('+')!=-1) { + choices.document.forms.sch.val3.checked=true; + } + } } - if (scat=='relative') { + if (pscat=='relative') { // 2: left // 3: open // 4: right @@ -85,52 +370,192 @@ function draw() { tablestart('Percentage error, asymmetric around value'); valline('Upper percentage',2,3); valline('Lower percentage',4,5); - afterproc(); + var range1=new Array; + if ((svalue!='') && (typeof(svalue)!="undefined")) { + range1=svalue.split(','); + if (typeof(range1[1])=='undefined') { range1[1]=range1[0]; } + choices.document.forms.sch.val2.value=parseFloat(range1[0]); + if (range1[0].indexOf('+')!=-1) { + choices.document.forms.sch.val3.checked=true; + } + choices.document.forms.sch.val4.value=parseFloat(range1[1]); + if (range1[1].indexOf('+')!=-1) { + choices.document.forms.sch.val5.checked=true; + } + } } - if (scat=='absolute_sym') { + if (pscat=='absolute_sym') { tablestart('Absolute error, symmetric around value'); valline('Value',2,3); - afterproc(); + if ((svalue!='') && (typeof(svalue)!="undefined")) { + choices.document.forms.sch.val2.value=parseFloat(svalue); + if (svalue.indexOf('+')!=-1) { + choices.document.forms.sch.val3.checked=true; + } + } } - if (scat=='absolute') { + if (pscat=='absolute') { tablestart('Absolute error, asymmetric around value'); valline('Upper value',2,3); valline('Lower value',4,5); - afterproc(); - } - if (scat=='sigdigits') { - tablestart('Agreement on significant digits'); - choicewrite('Number of digits: ' - +''); - - choicewrite('Accept if more digits given: ' - +''); - + var range2=new Array; + if ((svalue!='') && (typeof(svalue)!="undefined")) { + range=svalue.split(','); + if (typeof(range2[1])=='undefined') { range2[1]=range2[0]; } + choices.document.forms.sch.val2.value=parseFloat(range2[0]); + if (range2[0].indexOf('+')!=-1) { + choices.document.forms.sch.val3.checked=true; + } + choices.document.forms.sch.val4.value=parseFloat(range2[1]); + if (range2[1].indexOf('+')!=-1) { + choices.document.forms.sch.val5.checked=true; + } + } } } if (ptype=='date') { - choicewrite(''); + if (pscat=='default') { + tablestart('Default value or none'); + choicewrite(''); + } else { + if (pscat=='start') { + tablestart('Starting or opening date and time'); + } + if (pscat=='end') { + tablestart('Ending or closing date and time'); + } + if (pscat=='interval') { + tablestart('Time interval'); + choicewrite(''); + intervaldis(); + choicewrite('Time:' + +''); + intday();choicewrite('days '); + inthour();choicewrite('hours '); + intminute(); choicewrite('mins '); intsecond(); + choicewrite('secs'); + } else { + choicewrite('' + +cdate.toString()+ + 'Date:'); + month();date();year(); + choicewrite('Time:' + +'');hour();choicewrite('h ');minute(); + choicewrite('m ');second(); + choicewrite('s'); + } + } } - if (ptype=='value') { + if (ptype=='int') { + var pscatparts=new Array; + pscatparts=pscat.split(','); + pscat=pscatparts[0]; + if (pscat=='default') { + tablestart('Default value or none'); + choicewrite(''); + } else { + if (pscat=='range') { + tablestart('Integer range'); + choicewrite('Lower Value:'+ + ''); + choicewrite('Upper Value:'+ + ''); + var range=new Array; + if ((svalue!='') && (typeof(svalue)!="undefined")) { + range=svalue.split(','); + if (typeof(range[1])=='undefined') { range[1]=range[0]; } + choices.document.forms.sch.val2.value=parseInt(range[0]); + choices.document.forms.sch.val4.value=parseInt(range[1]); + } + } else { + if (pscat=='pos') { + tablestart('Positive (non-zero) integer'); + } + if (pscat=='zeropos') { + tablestart('Positive integer or zero'); + } + if (pscat.indexOf('inrange')!=-1) { + var rangeparts=new Array; + rangeparts=split(',',pscat); + tablestart('Integer in the range ['+rangeparts[1]+']'); + } + if (pscat=='any') { + tablestart('Integer'); + } + choicewrite('Value:'); + choicewrite(''); + choicewrite(''); + } + } } - if (ptype=='truefalse') { + if (ptype=='float') { + if (pscat=='default') { + tablestart('Default value or none'); + choicewrite(''); + } else { + if (pscat=='pos') { + tablestart('Positive floating point number or zero'); + } + if (pscat=='zeroone') { + tablestart('Floating point number between zero and one'); + } + if (pscat=='any') { + tablestart('Floating point number'); + } + choicewrite('Value:'); + choicewrite(''); + choicewrite(''); + } } - if (ptype=='check') { + if (ptype=='string') { + if (pscat=='default') { + tablestart('Default value or none'); + choicewrite(''); + } else { + if (pscat=='any') { + tablestart('Text'); + } + choicewrite('Value:'); + choicewrite(''); + choicewrite(''); + } } - - if (ptype=='radio') { + + if (ptype=='color') { + tablestart('Choose a Color'); + choicewrite(''); + if (svalue) { + choicewrite(''); + } + for (var ir=1; ir<=15; ir++) { + for (var ig=1; ig<=15; ig++) { + choicewrite(''); + for (var ib=1; ib<=15; ib++) { + colorfield(ir,ig,ib); + } + choicewrite(''); + } + } + choicewrite('
Current choice: 
'); } + choicewrite('
'); choiceend(); } function sopt(va,text) { selwrite(''); @@ -138,91 +563,232 @@ function sopt(va,text) { function catchange() { var sform=selector.document.forms.fsel.fcat; - scat=sform.options[sform.selectedIndex].value; + pscat=sform.options[sform.selectedIndex].value; draw(); } function assemble() { + if ((ptype=='date') && (pscat!='interval')) { + svalue=Math.round(cdate.getTime()/1000); + } + if (ptype=='tolerance') { + if (pscat=='relative_sym') { + svalue=choices.document.forms.sch.val2.value+'%'; + if (choices.document.forms.sch.val3.checked) { + svalue+='+'; + } + } + if (pscat=='absolute_sym') { + svalue=choices.document.forms.sch.val2.value; + if (choices.document.forms.sch.val3.checked) { + svalue+='+'; + } + } + if (pscat=='absolute') { + svalue=choices.document.forms.sch.val2.value; + if (choices.document.forms.sch.val3.checked) { + svalue+='+'; + } + svalue+=','+choices.document.forms.sch.val4.value; + if (choices.document.forms.sch.val5.checked) { + svalue+='+'; + } + } + if (pscat=='relative') { + svalue=choices.document.forms.sch.val2.value+'%'; + if (choices.document.forms.sch.val3.checked) { + svalue+='+'; + } + svalue+=','+choices.document.forms.sch.val4.value+'%'; + if (choices.document.forms.sch.val5.checked) { + svalue+='+'; + } + } + } + if ((ptype=='int') && (pscat=='range')) { + svalue=choices.document.forms.sch.val2.value+','+ + choices.document.forms.sch.val4.value; + } + if (pscat=='default') { svalue=''; } + stype=ptype+'_'+pscat; } -function disassemble() { -} function init() { var i; - + var subs=new Array(); var namevalue=this.window.location.search.split('&'); namevalue[0]=namevalue[0].substr(1,namevalue[0].length-1); for (i=0;i'); - selwrite('

'+pname+'

'); + selwrite(''+pname+'
'); selwrite('
'); - selwrite('Store  '); + + selwrite('Store'); + selwrite('">Delete  '); + + selwrite('Cancel'); selwrite(''); this.window.selector.document.close(); + draw(); } - + - \ No newline at end of file +