1 | function validateranges() {
|
---|
2 | var fields = ["plotwindow","brangewindow"];
|
---|
3 | }
|
---|
4 |
|
---|
5 | function baselineswitch(par) {
|
---|
6 | var fields = ["polyorder","baselinerange"];
|
---|
7 | for (i=0; i<fields.length; ++i) {
|
---|
8 | var cont = document.getElementById(fields[i]);
|
---|
9 | if (par.checked) {
|
---|
10 | this.value = "True";
|
---|
11 | cont.style.display = "block";
|
---|
12 | } else {
|
---|
13 | cont.style.display = "none";
|
---|
14 | this.value = "False";
|
---|
15 | }
|
---|
16 | }
|
---|
17 | }
|
---|
18 |
|
---|
19 | function clearunit() {
|
---|
20 | var fields = ["plotwindow","brangewindow"];
|
---|
21 | for (i=0; i<fields.length; ++i) {
|
---|
22 | var cont = document.getElementById(fields[i]);
|
---|
23 | cont.value = "";
|
---|
24 | }
|
---|
25 | }
|
---|
26 |
|
---|
27 | function unitswitch(unitval) {
|
---|
28 | var fields = ["velframe","veldoppler","velrest"];
|
---|
29 | for (i=0; i<fields.length; ++i) {
|
---|
30 | var cont = document.getElementById(fields[i]);
|
---|
31 | if (unitval == "channel") {
|
---|
32 | cont.style.display = "none";
|
---|
33 | } else {
|
---|
34 | if (unitval == "GHz") {
|
---|
35 | if (fields[i] == "velrest" || fields[i] == "veldoppler") cont.style.display = "none";
|
---|
36 | else cont.style.display = "block";
|
---|
37 | } else {
|
---|
38 | cont.style.display = "block";
|
---|
39 | }
|
---|
40 | }
|
---|
41 | }
|
---|
42 | var ulblcont = document.getElementById("prangeunit");
|
---|
43 | ulblcont.innerHTML = "";
|
---|
44 | ulblcont.innerHTML = unitval;
|
---|
45 | var ulblcont = document.getElementById("brangeunit");
|
---|
46 | ulblcont.innerHTML = "";
|
---|
47 | ulblcont.innerHTML = unitval;
|
---|
48 | clearunit();
|
---|
49 | }
|
---|
50 |
|
---|
51 |
|
---|
52 | function listFiles(name, serviceURL) {
|
---|
53 | var callback = (arguments.length == 3 ? arguments[2] : null);
|
---|
54 | var request = new Ajax.Request(serviceURL, {
|
---|
55 | parameters: "path=" + name,
|
---|
56 | onComplete: function(transport) {
|
---|
57 | var resolutions = processResolutions(transport.responseXML.documentElement);
|
---|
58 | if (callback != null) {
|
---|
59 | callback.process(resolutions);
|
---|
60 | } else {
|
---|
61 | return resolutions;
|
---|
62 | }
|
---|
63 | }
|
---|
64 | });
|
---|
65 | }
|
---|
66 |
|
---|
67 | function processResolutions(result) {
|
---|
68 | //var results = result.getElementsByTagName("Listing");
|
---|
69 |
|
---|
70 | var fnames = result.getElementsByTagName("File");
|
---|
71 | var files = [];
|
---|
72 | if (fnames.length > 0 ) {
|
---|
73 | for (i=0;i<fnames.length;++i) {
|
---|
74 | files.push(fnames[i].firstChild.nodeValue)
|
---|
75 | }
|
---|
76 | }
|
---|
77 | return files;
|
---|
78 | }
|
---|
79 |
|
---|
80 |
|
---|
81 | function insertFields() {
|
---|
82 | var opts = document.getElementById("directory");
|
---|
83 | var path = opts.selectedIndex;
|
---|
84 | listFiles(path,"http://localhost/cgi-bin/asapmon/filelist.py", callbackHandler);
|
---|
85 | return;
|
---|
86 | }
|
---|
87 |
|
---|
88 |
|
---|
89 | var callbackHandler = {
|
---|
90 | process: function(parm) {
|
---|
91 | var opts = document.getElementById("filelist");
|
---|
92 | var fileopt = opts.options;
|
---|
93 | //clear
|
---|
94 | for (i=0;i<fileopt.length;++i) {
|
---|
95 | fileopt[i] = null;
|
---|
96 | }
|
---|
97 | fileopt.length = 0;
|
---|
98 | for (i=0;i<parm.length;++i) {
|
---|
99 | var opt = document.createElement("option");
|
---|
100 | opt.text = parm[i];
|
---|
101 | opt.value = i;
|
---|
102 | fileopt.add(opt);
|
---|
103 | }
|
---|
104 | // last file is selected
|
---|
105 | if (fileopt.length > 0)
|
---|
106 | opt.selected = fileopt.length-1;
|
---|
107 | }
|
---|
108 | }
|
---|