57 |
use Common::Options; |
use Common::Options; |
58 |
use Common::Log; |
use Common::Log; |
59 |
|
|
60 |
|
# |
61 |
|
# Set this option to 0 if you don't want JavaScript roll-up/roll-down |
62 |
|
# of images to be created |
63 |
|
# |
64 |
|
my $dynamic_js = 1; |
65 |
|
|
66 |
Common::Options::commonOptions( 'baseURL=s' => \$gBaseURL ); |
Common::Options::commonOptions( 'baseURL=s' => \$gBaseURL ); |
67 |
initConst(); |
initConst(); |
68 |
|
|
116 |
print OUT "<html><head><title>$key</title>"; |
print OUT "<html><head><title>$key</title>"; |
117 |
print OUT '<meta content="no-cache" http-equiv="Pragma"> |
print OUT '<meta content="no-cache" http-equiv="Pragma"> |
118 |
<meta content="300" http-equiv="Refresh">' if ($filename =~ m/Daily/i); |
<meta content="300" http-equiv="Refresh">' if ($filename =~ m/Daily/i); |
119 |
|
print OUT <<'HTMLEND' if ($dynamic_js); |
120 |
|
|
121 |
|
<script language="JavaScript"> |
122 |
|
var Selected = ""; |
123 |
|
|
124 |
|
function Switch(elm) |
125 |
|
{ |
126 |
|
var cookie = Get_Cookie("overview"); |
127 |
|
|
128 |
|
var elmref; |
129 |
|
|
130 |
|
// uncomment following lines for just 1 selected content |
131 |
|
/* |
132 |
|
if (Selected != "") |
133 |
|
{ |
134 |
|
elmref = eval("document.getElementById('" + Selected + "_h1')"); |
135 |
|
if (elmref) elmref.style.display = 'none'; |
136 |
|
elmref = eval("document.getElementById('" + Selected + "_h0')"); |
137 |
|
// roll-up color |
138 |
|
if (elmref) elmref.bgColor = '#eeeeee'; |
139 |
|
} |
140 |
|
if (Selected != elm.name) |
141 |
|
{ |
142 |
|
Selected = elm.name; |
143 |
|
elmref = eval("document.getElementById('" + Selected + "_h1')"); |
144 |
|
if (elmref) |
145 |
|
{ |
146 |
|
if (elmref.style.display=='none') elmref.style.display=''; |
147 |
|
else elmref.style.display = 'none'; |
148 |
|
} |
149 |
|
elmref = eval("document.getElementById('" + Selected + "_h0')"); |
150 |
|
// roll-down color |
151 |
|
if (elmref) elmref.bgColor = '#ffffff'; |
152 |
|
} |
153 |
|
else |
154 |
|
Selected=""; |
155 |
|
*/ |
156 |
|
|
157 |
|
// or use this to unroll more than one line |
158 |
|
Selected = elm.name; |
159 |
|
elmref = eval("document.getElementById('" + Selected + "_h1')"); |
160 |
|
if (elmref) |
161 |
|
{ |
162 |
|
if (elmref.style.display=='none') elmref.style.display=''; |
163 |
|
else elmref.style.display = 'none'; |
164 |
|
cookie ^= 1 << Selected; |
165 |
|
} |
166 |
|
|
167 |
|
Set_Cookie("overview",cookie); |
168 |
|
return false; |
169 |
|
} |
170 |
|
|
171 |
|
function SwitchThis() |
172 |
|
{ |
173 |
|
return Switch(this); |
174 |
|
} |
175 |
|
|
176 |
|
|
177 |
|
</script> |
178 |
|
|
179 |
|
<table border=0 id=DynamicTable bgColor='#e0e0e0' cellpadding=2 cellspacing=1> |
180 |
|
|
181 |
|
HTMLEND |
182 |
print OUT "</head><body>"; |
print OUT "</head><body>"; |
183 |
print OUT $html_file{$key}; |
print OUT $html_file{$key}; |
184 |
|
print OUT <<'HTMLEND' if ($dynamic_js); |
185 |
|
</table> |
186 |
|
|
187 |
|
<script language=javascript> |
188 |
|
|
189 |
|
function Get_Cookie(name) { |
190 |
|
var start = document.cookie.indexOf(name+"="); |
191 |
|
var len = start+name.length+1; |
192 |
|
if ((!start) && (name != document.cookie.substring(0,name.length))) return null; |
193 |
|
if (start == -1) return null; |
194 |
|
var end = document.cookie.indexOf(";",len); |
195 |
|
if (end == -1) end = document.cookie.length; |
196 |
|
return unescape(document.cookie.substring(len,end)); |
197 |
|
} |
198 |
|
|
199 |
|
function Set_Cookie(name,value,expires,path,domain,secure) { |
200 |
|
document.cookie = name + "=" +escape(value) + |
201 |
|
( (expires) ? ";expires=" + expires.toGMTString() : "") + |
202 |
|
( (path) ? ";path=" + path : "") + |
203 |
|
( (domain) ? ";domain=" + domain : "") + |
204 |
|
( (secure) ? ";secure" : ""); |
205 |
|
} |
206 |
|
|
207 |
|
function Delete_Cookie(name,path,domain) { |
208 |
|
if (Get_Cookie(name)) document.cookie = name + "=" + |
209 |
|
( (path) ? ";path=" + path : "") + |
210 |
|
( (domain) ? ";domain=" + domain : "") + |
211 |
|
";expires=Thu, 01-Jan-70 00:00:01 GMT"; |
212 |
|
} |
213 |
|
|
214 |
|
var table = document.getElementById("DynamicTable"); |
215 |
|
var links = table.getElementsByTagName("a"); |
216 |
|
var cookie = Get_Cookie("overview"); |
217 |
|
var new_cookie = 0; |
218 |
|
for (var i = 0; i < links.length; i++) { |
219 |
|
if (links[i].id == "DynMessLink") { |
220 |
|
links[i].onclick = SwitchThis; |
221 |
|
elmref = eval("document.getElementById('" + links[i].name + "_h1')"); |
222 |
|
if (elmref && cookie) { |
223 |
|
if (cookie & 1 << links[i].name) { |
224 |
|
elmref.style.display=''; |
225 |
|
} else { |
226 |
|
elmref.style.display = 'none'; |
227 |
|
} |
228 |
|
} else if(elmref) { |
229 |
|
if (elmref.style.display=='none') { |
230 |
|
elmref.style.display=''; |
231 |
|
new_cookie |= 1 << links[i].name; |
232 |
|
} else { |
233 |
|
elmref.style.display = 'none'; |
234 |
|
//new_cookie &= !( 1 << links[i].name ); |
235 |
|
} |
236 |
|
} |
237 |
|
} |
238 |
|
} |
239 |
|
if (new_cookie) Set_Cookie("overview",new_cookie); |
240 |
|
</script> |
241 |
|
HTMLEND |
242 |
|
|
243 |
print OUT "</body></html>"; |
print OUT "</body></html>"; |
244 |
close(OUT); |
close(OUT); |
245 |
|
|
247 |
|
|
248 |
exit; |
exit; |
249 |
|
|
250 |
|
sub do_html { |
251 |
|
my ($desc,$url,$img) = @_; |
252 |
|
if ($dynamic_js) { |
253 |
|
my $html =<<'HTMLEND'; |
254 |
|
<tr bgcolor='#eeeeee' id=##id##_h0> |
255 |
|
<td><a href="#" id=DynMessLink name=##id## >##desc##</a></td> |
256 |
|
</tr> |
257 |
|
<tr id=##id##_h1 style='display:none' bgcolor='#ffffff' > |
258 |
|
<td><a href="##url##"><img src="##img##"</td> |
259 |
|
</tr> |
260 |
|
HTMLEND |
261 |
|
$html =~ s/##desc##/$desc/; |
262 |
|
$html =~ s/##url##/$url/; |
263 |
|
$html =~ s/##img##/$img/; |
264 |
|
$html =~ s/##id##/$dynamic_js/g; |
265 |
|
$dynamic_js++; # increment usage counter |
266 |
|
return $html; |
267 |
|
} else { |
268 |
|
return "$desc<br><a href=\"$url\"><img src=\"$img\"></a><br>\n"; |
269 |
|
} |
270 |
|
} |
271 |
|
|
272 |
sub localHandleTargetInstance { |
sub localHandleTargetInstance { |
273 |
my($Name, $target) = @_; |
my($Name, $target) = @_; |
274 |
|
|
342 |
Info("Retrieving graph for $desc"); |
Info("Retrieving graph for $desc"); |
343 |
# getURL($URL,"$path/$name-$vname-$rangeLabel.png"); |
# getURL($URL,"$path/$name-$vname-$rangeLabel.png"); |
344 |
$tmp_URL = "$gBaseURL?target=$paramtarget&range=d:w:m:y&view=$vname"; |
$tmp_URL = "$gBaseURL?target=$paramtarget&range=d:w:m:y&view=$vname"; |
345 |
$html{"$rangeLabel\t$paramtarget"}.="$desc<br><a href=\"$tmp_URL\"><img src=$URL></a><br>\n"; |
$html{"$rangeLabel\t$paramtarget"}.=do_html($desc,$tmp_URL,$URL); |
346 |
} |
} |
347 |
} else { |
} else { |
348 |
$dslist = $ttRef->{'ds'}; |
$dslist = $ttRef->{'ds'}; |
361 |
|
|
362 |
# getURL($URL,"$path/$name-$rangeLabel.png"); |
# getURL($URL,"$path/$name-$rangeLabel.png"); |
363 |
$tmp_URL = "$gBaseURL?target=$paramtarget&range=d:w:m:y"; |
$tmp_URL = "$gBaseURL?target=$paramtarget&range=d:w:m:y"; |
364 |
$html{"$rangeLabel\t$paramtarget"}.="$desc:<br><a href=\"$tmp_URL\"><img src=$URL><a/><br>"; |
$html{"$rangeLabel\t$paramtarget"}.=do_html($desc,$tmp_URL,$URL); |
365 |
} |
} |
366 |
} |
} |
367 |
} |
} |