]>
Commit | Line | Data |
---|---|---|
f8e080ef MT |
1 | #!/usr/bin/perl |
2 | ||
3 | sub showmenu() { | |
4 | print <<EOF | |
5 | <div id="menu"> | |
6 | <ul> | |
7 | EOF | |
8 | ; | |
9 | foreach my $k1 ( sort keys %$menu ) { | |
10 | if (! $menu->{$k1}{'enabled'}) { | |
11 | next; | |
12 | } | |
13 | my $link = getlink($menu->{$k1}); | |
14 | if ($link eq '') { | |
15 | next; | |
16 | } | |
17 | if (! is_menu_visible($link)) { | |
18 | next; | |
19 | } | |
20 | if ($menu->{$k1}->{'selected'}) { | |
21 | print "<li><a href=\"$link\" class=\"active\">$menu->{$k1}{'caption'}</a></li>"; | |
22 | } else { | |
23 | print "<li><a href=\"$link\">$menu->{$k1}{'caption'}</a></li>"; | |
24 | } | |
25 | } | |
26 | print <<EOF | |
27 | </ul> | |
28 | </div> | |
29 | EOF | |
30 | ; | |
31 | } | |
32 | ||
33 | sub getselected($) { | |
34 | my $root = shift; | |
35 | if (!$root) { | |
36 | return 0; | |
37 | } | |
38 | ||
39 | foreach my $item (%$root) { | |
40 | if ($root->{$item}{'selected'}) { | |
41 | return $root->{$item}; | |
42 | } | |
43 | } | |
44 | } | |
45 | ||
46 | sub showsubsection($$) { | |
47 | my $root = shift; | |
48 | ||
49 | if (! $root) { | |
50 | return; | |
51 | } | |
52 | my $selected = getselected($root); | |
53 | if (! $selected) { | |
54 | return; | |
55 | } | |
56 | my $submenus = $selected->{'subMenu'}; | |
57 | if (! $submenus) { | |
58 | return; | |
59 | } | |
60 | ||
61 | print <<EOF | |
62 | <h4><span>Side</span>menu</h4> | |
63 | <ul class="links"> | |
64 | EOF | |
65 | ; | |
66 | foreach my $item (sort keys %$submenus) { | |
67 | my $hash = $submenus->{$item}; | |
68 | if (! $hash->{'enabled'}) { | |
69 | next; | |
70 | } | |
71 | my $link = getlink($hash); | |
72 | if ($link eq '') { | |
73 | next; | |
74 | } | |
75 | if (! is_menu_visible($link)) { | |
76 | next; | |
77 | } | |
78 | if ($hash->{'selected'}) { | |
79 | print '<li class="selected">'; | |
80 | } else { | |
81 | print '<li>'; | |
82 | } | |
83 | ||
84 | print "<a href=\"$link\">$hash->{'caption'}</a></li>"; | |
85 | } | |
86 | ||
87 | print <<EOF | |
88 | </ul> | |
89 | EOF | |
90 | ; | |
91 | } | |
92 | ||
93 | ||
94 | sub showsubsubsection($) { | |
95 | my $root = shift; | |
96 | if (!$root) { | |
97 | return; | |
98 | } | |
99 | my $selected = getselected($root); | |
100 | if (! $selected) { | |
101 | return | |
102 | } | |
103 | if (! $selected->{'subMenu'}) { | |
104 | return | |
105 | } | |
106 | ||
107 | showsubsection($selected->{'subMenu'}, 'menu-subtop'); | |
108 | } | |
109 | ||
110 | sub openpage { | |
111 | my $title = shift; | |
112 | my $boh = shift; | |
113 | my $extrahead = shift; | |
114 | ||
115 | @URI=split ('\?', $ENV{'REQUEST_URI'} ); | |
6be4dd24 | 116 | &General::readhash("${swroot}/main/settings", \%settings); |
f8e080ef MT |
117 | &genmenu(); |
118 | ||
119 | my $h2 = gettitle($menu); | |
120 | ||
121 | $title = "IPFire - $title"; | |
122 | if ($settings{'WINDOWWITHHOSTNAME'} eq 'on') { | |
123 | $title = "$settings{'HOSTNAME'}.$settings{'DOMAINNAME'} - $title"; | |
124 | } | |
125 | ||
126 | print <<END | |
127 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
128 | ||
129 | <html> | |
130 | <head> | |
131 | <title>$title</title> | |
132 | ||
133 | $extrahead | |
134 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> | |
135 | END | |
136 | ; | |
137 | if ($settings{'FX'} ne 'off') { | |
138 | print <<END | |
139 | <meta http-equiv="Page-Enter" content="blendTrans(Duration=0.5,Transition=12)" /> | |
140 | <meta http-equiv="Page-Exit" content="blendTrans(Duration=0.5,Transition=12)" /> | |
141 | END | |
142 | ; | |
143 | } | |
144 | print <<END | |
145 | <link rel="shortcut icon" href="/favicon.ico" /> | |
146 | <link rel="stylesheet" type="text/css" href="/themes/ipfire/include/style.css" /> | |
147 | <script language="javascript" type="text/javascript"> | |
148 | ||
149 | function swapVisibility(id) { | |
150 | el = document.getElementById(id); | |
151 | if(el.style.display != 'block') { | |
152 | el.style.display = 'block' | |
153 | } | |
154 | else { | |
155 | el.style.display = 'none' | |
156 | } | |
157 | } | |
158 | </script> | |
16f6c28c MT |
159 | <script type="text/javascript" language="javascript"> |
160 | ||
161 | var http_request = false; | |
162 | ||
163 | function LoadInetInfo(url) { | |
164 | ||
165 | http_request = false; | |
166 | ||
167 | if (window.XMLHttpRequest) { // Mozilla, Safari,... | |
168 | http_request = new XMLHttpRequest(); | |
169 | if (http_request.overrideMimeType) { | |
170 | http_request.overrideMimeType('text/xml'); | |
171 | // zu dieser Zeile siehe weiter unten | |
172 | } | |
173 | } else if (window.ActiveXObject) { // IE | |
174 | try { | |
175 | http_request = new ActiveXObject("Msxml2.XMLHTTP"); | |
176 | } catch (e) { | |
177 | try { | |
178 | http_request = new ActiveXObject("Microsoft.XMLHTTP"); | |
179 | } catch (e) {} | |
180 | } | |
181 | } | |
182 | ||
183 | if (!http_request) { | |
184 | alert('Ende :( Kann keine XMLHTTP-Instanz erzeugen'); | |
185 | return false; | |
186 | } | |
187 | http_request.onreadystatechange = DisplayInetInfo; | |
188 | http_request.open('GET', url, true); | |
189 | http_request.send(null); | |
190 | ||
191 | } | |
192 | ||
193 | function DisplayInetInfo() { | |
194 | if (http_request.readyState == 4) { | |
195 | var xmldoc = http_request.responseXML; | |
196 | var root1_node = xmldoc.getElementsByTagName('rx_kbs').item(0); | |
197 | var root2_node = xmldoc.getElementsByTagName('tx_kbs').item(0); | |
198 | var root3_node = xmldoc.getElementsByTagName('rxb').item(0); | |
199 | var root4_node = xmldoc.getElementsByTagName('txb').item(0); | |
200 | ||
201 | document.forms['speed'].txkb.value = root1_node.firstChild.data; | |
202 | document.forms['speed'].rxkb.value = root2_node.firstChild.data; | |
203 | ||
204 | // document.getElementsByTagName("input")[0].style.color = "#00FF00"; | |
3ef6c343 | 205 | url = "/cgi-bin/speed.cgi?rxb_last=" + root3_node.firstChild.data + "&txb_last=" + root4_node.firstChild.data; |
16f6c28c MT |
206 | |
207 | window.setTimeout("LoadInetInfo(url)", 3000); | |
208 | } | |
209 | ||
210 | } | |
211 | </script> | |
f8e080ef | 212 | </head> |
4aedc962 | 213 | <body onLoad="LoadInetInfo('/cgi-bin/speed.cgi')"> |
f8e080ef MT |
214 | <!-- IPFIRE HEADER --> |
215 | ||
216 | <div id="header"> | |
217 | ||
218 | <div id="header_inner" class="fixed"> | |
219 | ||
220 | <div id="logo"> | |
d86ddb48 MT |
221 | END |
222 | ; | |
223 | if ($settings{'WINDOWWITHHOSTNAME'} eq 'on') { | |
224 | print "<h1><span>$settings{'HOSTNAME'}.$settings{'DOMAINNAME'}</span></h1><br />"; | |
225 | } else { | |
226 | print "<h1><span>IPFire</span></h1><br />"; | |
227 | } | |
228 | print <<END | |
f8e080ef MT |
229 | <h2>$h2</h2> |
230 | </div> | |
231 | ||
232 | END | |
233 | ; | |
234 | &showmenu(); | |
235 | ||
e455cafe | 236 | print <<END |
f8e080ef MT |
237 | </div> |
238 | </div> | |
239 | ||
240 | <div id="main"> | |
241 | <div id="main_inner" class="fixed"> | |
242 | <div id="primaryContent_2columns"> | |
243 | <div id="columnA_2columns"> | |
244 | END | |
245 | ; | |
246 | } | |
247 | ||
248 | sub openpagewithoutmenu { | |
249 | my $title = shift; | |
250 | my $boh = shift; | |
251 | my $extrahead = shift; | |
252 | ||
253 | @URI=split ('\?', $ENV{'REQUEST_URI'} ); | |
6be4dd24 | 254 | &General::readhash("${swroot}/main/settings", \%settings); |
f8e080ef MT |
255 | &genmenu(); |
256 | ||
257 | my $h2 = gettitle($menu); | |
258 | ||
259 | $title = "IPFire - $title"; | |
260 | if ($settings{'WINDOWWITHHOSTNAME'} eq 'on') { | |
261 | $title = "$settings{'HOSTNAME'}.$settings{'DOMAINNAME'} - $title"; | |
262 | } | |
263 | ||
264 | print <<END | |
265 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
266 | ||
267 | <html> | |
268 | <head> | |
269 | <title>$title</title> | |
270 | ||
271 | $extrahead | |
272 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> | |
273 | END | |
274 | ; | |
275 | if ($settings{'FX'} ne 'off') { | |
276 | print <<END | |
277 | <meta http-equiv="Page-Enter" content="blendTrans(Duration=0.5,Transition=12)" /> | |
278 | <meta http-equiv="Page-Exit" content="blendTrans(Duration=0.5,Transition=12)" /> | |
279 | END | |
280 | ; | |
281 | } | |
282 | print <<END | |
283 | <link rel="shortcut icon" href="/favicon.ico" /> | |
284 | <link rel="stylesheet" type="text/css" href="/include/style.css" /> | |
285 | <script language="javascript" type="text/javascript"> | |
286 | ||
287 | function swapVisibility(id) { | |
288 | el = document.getElementById(id); | |
289 | if(el.style.display != 'block') { | |
290 | el.style.display = 'block' | |
291 | } | |
292 | else { | |
293 | el.style.display = 'none' | |
294 | } | |
295 | } | |
296 | </script> | |
297 | ||
298 | </head> | |
299 | <body> | |
300 | <!-- IPFIRE HEADER --> | |
301 | ||
302 | <div id="header"> | |
303 | ||
304 | <div id="header_inner" class="fixed"> | |
305 | ||
306 | <div id="logo"> | |
307 | <h1><span>IPFire</span></h1> | |
308 | <h2>$h2</h2> | |
309 | </div> | |
310 | </div> | |
311 | </div> | |
312 | ||
313 | <div id="main"> | |
314 | <div id="main_inner" class="fixed"> | |
315 | <div id="primaryContent_2columns"> | |
316 | <div id="columnA_2columns"> | |
317 | END | |
318 | ; | |
319 | } | |
320 | ||
321 | sub closepage () { | |
322 | my $status = &connectionstatus(); | |
323 | $uptime = `/usr/bin/uptime`; | |
324 | ||
325 | print <<END | |
326 | </div> | |
327 | </div> | |
328 | ||
329 | <div id="secondaryContent_2columns"> | |
330 | ||
331 | <div id="columnC_2columns"> | |
332 | END | |
333 | ; | |
334 | &showsubsection($menu); | |
335 | &showsubsubsection($menu); | |
336 | ||
337 | print <<END | |
338 | </div> | |
339 | </div> | |
340 | ||
341 | <br class="clear" /> | |
342 | <div id="footer" class="fixed"> | |
343 | <b>Status:</b> $status <b>Uptime:</b>$uptime <b>Version:</b> $FIREBUILD | |
16f6c28c MT |
344 | <br /> |
345 | <form name='speed'> | |
346 | <b>$Lang::tr{'bandwidth usage'}:</b> $Lang::tr{'incoming'}:<input type="text" name="rxkb" size="16" value="0,00 kb/s" style="border: 1px solid #FFFFFF; padding: 0; background-color: #FFFFFF" /> | |
347 | $Lang::tr{'outgoing'}: <input type="text" name="txkb" size="16" value="0,00 kb/s" style="border: 1px solid #FFFFFF; padding: 0; background-color: #FFFFFF" /> | |
348 | </form> | |
f8e080ef MT |
349 | </div> |
350 | </div> | |
e455cafe MT |
351 | </div> |
352 | </body> | |
f8e080ef MT |
353 | </html> |
354 | END | |
355 | ; | |
356 | } | |
357 | ||
358 | sub openbigbox | |
359 | { | |
360 | } | |
361 | ||
362 | sub closebigbox | |
363 | { | |
364 | } | |
365 | ||
366 | sub openbox | |
367 | { | |
368 | $width = $_[0]; | |
369 | $align = $_[1]; | |
370 | $caption = $_[2]; | |
371 | ||
372 | print <<END | |
373 | <!-- openbox --> | |
374 | <div class="post" align="$align"> | |
375 | END | |
376 | ; | |
377 | ||
378 | if ($caption) { print "<h3>$caption</h3>\n"; } else { print " "; } | |
379 | } | |
380 | ||
381 | sub closebox | |
382 | { | |
383 | print <<END | |
384 | </div> | |
385 | <br class="clear" /> | |
386 | <!-- closebox --> | |
387 | END | |
388 | ; | |
389 | } | |
390 | ||
391 | 1; |