1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
|
//-------------------------------------------------------------------------|
// A few basic actions to get the url of the application Web Page without |
// asking the Web Server. These methods are used by a number of other |
// java acripts. |
// |
// Also the entry point for all necessary javascripts for the |
// DQM application |
//-------------------------------------------------------------------------|
var WebLib = {};
WebLib.http_request = null;
WebLib.view_all_contents = true;
//-------------------------------------------------------------------------- // Get the url location of the application web page removing the
// last part without asking the server...
//
WebLib.getApplicationURL = function()
{
try {
var url = window.location.href;
// remove the cgi request from the end of the string
var index = url.indexOf("?");
if (index >= 0) {
url = url.substring(0, index);
}
// remove the trailing '/' from the end of the string
index = url.lastIndexOf("/");
url = url.substring(0, index);
return url;
} catch (errorMessage) {
alert("[WebLib.getApplicationURL] Exeuction/syntax error: " + errorMessage ) ;
}
}
//-------------------------------------------------------------------------- // Get the url of the application webpage with correct LID
// without asking the server...
//
WebLib.getApplicationURLWithLID = function()
{
try
{
var url = window.location.href;
// remove the cgi request from the end of the string
var index = url.indexOf("?");
if (index >= 0) {
url = url.substring(0, index);
}
index = url.lastIndexOf("temporary");
url = url.substring(0, index);
// add the cgi request
var s0 = (url.lastIndexOf(":")+1);
var s1 = url.lastIndexOf("/");
var port_number = url.substring(s0, s1);
if (port_number == "40000") {
url += "urn:xdaq-application:lid=27/moduleWeb?module=SiStripAnalyser&";
} else if (port_number == "1972") {
url += "urn:xdaq-application:lid=15/Request?";
}
return url;
} catch (errorMessage) {
alert("[WebLib.getApplicationURL2] Exeuction/syntax error: " + errorMessage ) ;
}
}
//-------------------------------------------------------------------------- // Get the context url location of the application web page, i.e.
// the string up to the port number
WebLib.getContextURL = function()
{
try
{
var app_url = WebLib.getApplicationURL();
var index = app_url.lastIndexOf("/");
return app_url.substring(0, index);
} catch (errorMessage) {
alert("[WebLib.getContextURL] Exeuction/syntax error: " + errorMessage ) ;
}
}
//-------------------------------------------------------------------------- //
// -- This function submits a generic request in the form of a url
// -- and calls the receiver_function when the state of the request
// -- changes.
//
WebLib.makeRequest = function(url, receiver_function)
{
try
{
WebLib.http_request = null;
if (window.XMLHttpRequest) {
WebLib.http_request = new XMLHttpRequest();
if (WebLib.http_request.overrideMimeType){
WebLib.http_request.overrideMimeType('text/xml');
}
} else if (window.ActiveXObject) {
WebLib.http_request = new ActiveXObject("Msxml2.XMLHTTP");
if (WebLib.http_request == null) {
WebLib.http_request = new ActiveXObject("Microsoft.XMLHTTP");
}
}
if (WebLib.http_request) {
WebLib.initReq("GET", url, true, receiver_function);
} else {
alert('Giving up :( Cannot create an XMLHTTP instance');
}
} catch (errorMessage) {
alert("[WebLib.makeRequest] Exeuction/syntax error: " + errorMessage ) ;
}
}
//-------------------------------------------------------------------------- //
// -- Initialize a request object that is already constructed
//
WebLib.initReq = function(reqType, url, bool, respHandle)
{
try {
// Specify the function that will handle the HTTP response
if (respHandle != null) WebLib.http_request.onreadystatechange = respHandle;
WebLib.http_request.open(reqType, url, bool);
// if the reqType parameter is POST, then the
// 5th argument to the function is the POSTed data
if (reqType.toLowerCase() == "post") {
WebLib.http_request.setRequestHeader("Content-Type",
"application/x-www-form-urlencoded; charset=UTF-8");
WebLib.http_request.send(arguments[4]);
} else {
WebLib.http_request.send(null);
}
}
catch (errv) {
alert (
"The application cannot contact " +
"the server at the moment. " +
"Please try again in a few seconds.\\n" +
"Error detail: " + errv.message);
}
}
document.write('<script src="SERVED_DIRECTORY_URL/js_files/RequestHistos.js"><\/script>');
document.write('<script src="SERVED_DIRECTORY_URL/js_files/CommonActions.js"><\/script>');
document.write('<script src="SERVED_DIRECTORY_URL/js_files/tab-view.js"><\/script>');
document.write('<script src="SERVED_DIRECTORY_URL/js_files/context-menu.js"><\/script>');
document.write('<script src="SERVED_DIRECTORY_URL/js_files/folder-tree-static.js"><\/script>');
document.write('<script src="SERVED_DIRECTORY_URL/js_files/SlideShow.js"><\/script>');
|