001
002 // ************************************************************
003 // $Id: compare.js,v 1.1 2008/09/17 12:36:36 mgwilson Exp $
004 // ************************************************************
005
006 var xmlDoc;
007 var xmlhttp;
008
009 function loadXMLDoc(url,hisname)
010 {
011 xmlhttp=null;
012 if (window.XMLHttpRequest)
013 {// code for IE7, Firefox, Mozilla, etc.
014 xmlhttp=new XMLHttpRequest();
015 }
016 else if (window.ActiveXObject)
017 {// code for IE5, IE6
018 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
019 }
020 if (xmlhttp!=null)
021 {
022 xmlhttp.onreadystatechange=function(){
023 onResponse(hisname);
024 }
025 xmlhttp.open("GET",url,true);
026 xmlhttp.send(null);
027 }
028 else
029 {
030 alert("Your browser does not support XMLHTTP.");
031 }
032 }
033
034
035 function isThere(url) {
036 var req= new XMLHttpRequest(); // XMLHttpRequest object
037 try {
038 req.open("HEAD", url, false);
039 req.send(null);
040 return req.status== 200 ? true : false;
041 }
042 catch (er) {
043 return false;
044 }
045 }
046
047 function onResponse(hisname)
048 {
049 if(xmlhttp.readyState!=4) return;
050 if(xmlhttp.status!=200)
051 {
052 alert("Problem retrieving XML data");
053 return;
054 }
055 xmlDoc = xmlhttp.responseXML;
056 createStreamMenu(hisname);
057 }
058
059 function createStreamMenu(hisname){
060 x=xmlDoc.getElementsByTagName("Stream");
061 text ="<select id=\"StreamInput\" onchange=\"createRunMenu(\'"+hisname+"\');\" >\n";
062 text +="<option>Select Stream</option>\n";
063 for (i=0;i<x.length;i++)
064 {
065 urlList = x[i].getElementsByTagName("html");
066 url = urlList[urlList.length-1].childNodes[0].nodeValue+"/"+hisname+".html";
067 if (isThere(url))
068 {
069 text +="<option>";
070 text +=x[i].getAttribute("id");
071 text += "</option>\n";
072 }
073 }
074 text +="</select>\n";
075 document.getElementById("streamSelect").innerHTML=text;
076 }
077
078 function createRunMenu(hisname){
079 var mylist = document.getElementById("StreamInput");
080 stream = mylist.options[mylist.selectedIndex].text;
081 x=xmlDoc.getElementsByTagName("Stream");
082 text = " ";
083 for (i=0;i<x.length;i++){
084 y = x[i].getAttribute("id");
085 if (y==stream){
086 runs = x[i].getElementsByTagName("Run");
087 text +="<select id=\"RunInput\" onchange=\"find2ndHisto(\'"+hisname+"\',\'"+stream+"\');\" >\n";
088 text +="<option>Select Run</option>\n";
089 for (j=0;j<runs.length;j++){
090 urlList = runs[j].getElementsByTagName("html");
091 url = urlList[0].childNodes[0].nodeValue+"/"+hisname+".html";
092 if (isThere(url))
093 {
094 text +="<option>";
095 text +=runs[j].getAttribute("runNumber");
096 text += "</option>\n";
097 }
098 }
099 }
100 }
101 text +="</select>\n";
102 document.getElementById("runSelect").innerHTML=text;
103 }
104
105
106 function compare(runlist,hisname){
107 loadXMLDoc(runlist,hisname);
108 }
109
110 function insertIFrame(fromSource,tag){
111 var insertionPt = document.getElementById(tag);
112 insertionPt.innerHTML='';
113 var iframe=document.createElement('iframe');
114 iframe.setAttribute('id', 'contentFRM');
115 iframe.setAttribute('frameborder', '0');
116 iframe.setAttribute('src',fromSource);
117 iframe.setAttribute('width', '100%');
118 iframe.setAttribute('height','900');
119 // iframe.setAttribute('scrolling','no');
120 insertionPt.appendChild(iframe);
121 }
122
123 function find2ndHisto(hisname,stream){
124 mydiv = document.getElementById("compareButton");
125 mydiv.style.display = "none"; //to hide it
126 var mylist = document.getElementById("RunInput");
127 run = mylist.options[mylist.selectedIndex].text;
128 x=xmlDoc.getElementsByTagName("Stream");
129 html="";
130 for (i=0;i<x.length;i++){
131 y = x[i].getAttribute("id");
132 if (y==stream){
133 runs = x[i].getElementsByTagName("Run");
134 for (j=0;j<runs.length;j++){
135 if(runs[j].getAttribute("runNumber")==run){
136 html += (runs[j].getElementsByTagName("html")[0].childNodes[0].nodeValue+"/"+hisname+".html");
137 }
138 }
139 }
140 }
141 // document.write(html);
142 insertIFrame(html,'secondHisto');
143 mydiv = document.getElementById("compareButton");
144 mydiv.style.display = "none"; //to hide it
145 test =document.getElementById('contentFRM');
146 mydiv = test.getElementById("compareButton");
147 document.write(mydiv.style.display);
148 mydiv.style.display = "none";
149 document.write(mydiv.style.display);
150
151 }
152
153
154
155
156
Due to the LXR bug, the updates fail sometimes to remove references to deleted files. The Saturday's full rebuilds fix these problems |
This page was automatically generated by the
LXR engine.
|
|