Ignore:
Timestamp:
11/17/05 14:00:59 (19 years ago)
Author:
mar637
Message:

removed hidden naming prefix, added source selection

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/monitor/htdocs/asapmon.js

    r703 r711  
    1 function validateranges() {
    2     var fields = ["plotwindow","brangewindow"];
    3 }
    4 
    5 function baselineswitch(par) {
     1var repopulate = function() {
     2    unitswitch(document.getElementById('cunit').value);
     3    baselineswitch();
     4    checkbuttons("cdoppler",["doppler0","doppler1"]);
     5    checkbuttons("cframe",["frame0","frame1"]);
     6    selectFiles();
     7    selectIFs();
     8    selectSources();
     9    var sumtext = document.getElementById('sum').value;
     10    if (sumtext == "") {
     11        document.getElementById('summary').style.display = 'none';
     12    } else {
     13        document.getElementById('summary').style.display = 'inline';
     14    }
     15    var csource = document.getElementById('csource').value;
     16    if (csource == "") {
     17        document.getElementById('sourcelbl').style.display = 'none';
     18    } else {
     19        document.getElementById('sourcelbl').style.display = 'inline';
     20    }
     21}
     22
     23function summaryPopUp() {
     24    var sumtext = document.getElementById('sum').value;
     25    if (sumtext == "") {return false;}
     26    TheNewWin = window.open('','name','height=500,width=600,toolbar=no,directories=no,status=no,menubar=no');
     27    TheNewWin.document.write('<!DOCTYPE html PUBLIC"-//W3C//DTD XHTML 1.0 Transitional//EN" "http:\/\/www.w3.org\/TR\/xhtml1\/DTD\/xhtml1-transitional.dtd"><html xmlns="http:\/\/www.w3.org\/1999\/xhtml">');
     28    TheNewWin.document.write('<head><title>Popup<\/title><\/head><body style="overflow:hidden" bgcolor="#ffffff"><pre>');
     29    TheNewWin.document.write(sumtext);
     30    TheNewWin.document.write('</pre><hr \/> <p align="right"><a href="#" onclick="self.close();return false;">Close');
     31    TheNewWin.document.write(' Window<\/a><\/p> <\/body><\/html>');
     32    return false;
     33}
     34
     35function checkbuttons(hiddenfields, fields){
     36    var theval = document.getElementById(hiddenfields).value;
     37    for (i=0; i<fields.length;++i ){
     38        var elem = document.getElementById(fields[i]);
     39        if ( elem.value == theval ) {
     40            elem.checked = 'checked';
     41        }
     42    }
     43}
     44
     45function selectSources() {
     46    var sl = document.getElementById("sourcelist");
     47    var cs = document.getElementById("csource").value;
     48    var opts = sl.options;
     49    for (k=0; k<opts.length;++k) {
     50        if (opts[k].value == cs ) {
     51            opts[k].selected = 'selected';
     52        }
     53    }
     54    if (cs) {
     55        var sourcediv = document.getElementById("sourcelbl");
     56        sourcediv.style.display = "inline";
     57    }
     58}
     59
     60function selectFiles() {
     61    var indeces = eval(document.getElementById("cfilesel").value);
     62    var fl = document.getElementById("filelist");
     63    var opts = fl.options;
     64    for (k=0; k<indeces.length;++k) {
     65        opts[indeces[k]].selected = 'selected';
     66    }
     67}
     68
     69function selectIFs() {
     70    nif = eval(document.getElementById("nif").value);
     71    for (i=0; i<nif.length;++i ) {
     72        p0 = "cif"+nif[i]
     73        p1 = "rest"+nif[i]
     74        var ifsel = eval(document.getElementById(p0).value);
     75        var f = document.getElementById(p1);
     76        f.options[ifsel].selected = 'selected';
     77    }
     78}
     79
     80function baselineswitch() {
    681    var fields = ["polyorder","baselinerange"];
     82    var elem = document.getElementById("baseline");
    783    for (i=0; i<fields.length; ++i) {
    884        var cont = document.getElementById(fields[i]);
    9         if (par.checked) {
    10             this.value = "True";
     85        if (elem.checked) {
     86            elem.value = 1;
    1187            cont.style.display = "block";
    1288        } else {
    1389            cont.style.display = "none";
    14             this.value = "False";
     90            elem.value = 0;
    1591        }
    1692    }
     
    46122    ulblcont.innerHTML = "";
    47123    ulblcont.innerHTML = unitval;
    48     clearunit();
     124    if ( unitval != document.getElementById('cunit').value ) {
     125        clearunit();
     126    }
    49127}
    50128
     
    82160    var opts = document.getElementById("directory");
    83161    var path = opts.selectedIndex;
    84     listFiles(path,"http://localhost/cgi-bin/asapmon/filelist.py", callbackHandler);
     162    scripturl = new String(window.document.location);
     163    scripturl = scripturl.replace(/\w+\.py.*$/gi,"filelist.py");
     164    listFiles(path,scripturl, callbackHandler);
    85165    return;
    86166}
    87167
     168
     169function invalidateSources() {
     170    var opts = document.getElementById("sourcelist");
     171    var fileopt = opts.options;
     172    //clear
     173    for (i=0;i<fileopt.length;++i) {
     174        fileopt[i] = null;
     175    }
     176    fileopt.length = 0;
     177    var sourcediv = document.getElementById("sourcelbl");
     178    sourcediv.style.display = "none";
     179}
     180
     181function invalidateFiles() {
     182    insertFields();
     183    invalidateSources();
     184}
    88185
    89186var callbackHandler = {
Note: See TracChangeset for help on using the changeset viewer.