--- rat/client/parameter.html 2000/11/19 03:23:54 1.2 +++ rat/client/parameter.html 2001/12/19 17:22:29 1.16 @@ -2,7 +2,35 @@ LON-CAPA @@ -239,6 +267,38 @@ function intcalc() { 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); @@ -251,32 +311,35 @@ function intervaldis() { +cmins+' mins '+csecs+' secs'); } - - -function afterproc() { - choicewrite('Error after rounding: ' - +''); -} - function draw() { choicestart(); - choicewrite('
'); + choicewrite(''); if (ptype=='tolerance') { // 0: pscat -// 1: after processing if (pscat=='default') { tablestart('Use default value or algorithm of resource'); } - if (pscat=='exact') { - tablestart('Accept only exact value, zero tolerance'); - afterproc(); - } 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 (pscat=='relative') { // 2: left @@ -286,27 +349,47 @@ function draw() { tablestart('Percentage error, asymmetric around value'); valline('Upper percentage',2,3); valline('Lower percentage',4,5); - afterproc(); + 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=parseFloat(range[0]); + if (range[0].indexOf('+')!=-1) { + choices.document.forms.sch.val3.checked=true; + } + choices.document.forms.sch.val4.value=parseFloat(range[1]); + if (range[1].indexOf('+')!=-1) { + choices.document.forms.sch.val5.checked=true; + } + } } 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 (pscat=='absolute') { tablestart('Absolute error, asymmetric around value'); valline('Upper value',2,3); valline('Lower value',4,5); - afterproc(); - } - if (pscat=='sigdigits') { - tablestart('Agreement on significant digits'); - choicewrite('Number of digits: ' - +''); - - choicewrite('Accept if more digits given: ' - +''); - + 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=parseFloat(range[0]); + if (range[0].indexOf('+')!=-1) { + choices.document.forms.sch.val3.checked=true; + } + choices.document.forms.sch.val4.value=parseFloat(range[1]); + if (range[1].indexOf('+')!=-1) { + choices.document.forms.sch.val5.checked=true; + } + } } } @@ -344,17 +427,85 @@ function draw() { } } - if (ptype=='value') { + if (ptype=='int') { + 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') { - } choicewrite('
'); choiceend(); } @@ -377,8 +528,46 @@ 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; - alert(stype+' '+svalue); } @@ -390,13 +579,17 @@ function init() { for (i=0;i'); - selwrite('

'+pname+'

'); + selwrite(''+pname+'
'); selwrite('
'); selwrite('Store  '); + + selwrite('Delete  '); + + selwrite('Store'); + selwrite('">Cancel'); selwrite(''); this.window.selector.document.close(); @@ -487,4 +735,4 @@ function init() { - \ No newline at end of file +