]>
Commit | Line | Data |
---|---|---|
4b4aec3a CS |
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'} ); | |
116 | &readhash("${swroot}/main/settings", \%settings); | |
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/maniac/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> | |
159 | ||
160 | </head> | |
161 | <body> | |
162 | <!-- IPFIRE HEADER --> | |
163 | ||
164 | <div id="header"> | |
165 | ||
166 | <div id="header_inner" class="fixed"> | |
167 | ||
168 | <div id="logo"> | |
169 | END | |
170 | ; | |
171 | if ($settings{'WINDOWWITHHOSTNAME'} eq 'on') { | |
172 | print "<h1><span>$settings{'HOSTNAME'}.$settings{'DOMAINNAME'}</span></h1><br />"; | |
173 | } else { | |
174 | print "<h1><span>-= IPFire =-</span></h1><br />"; | |
175 | } | |
176 | print <<END | |
177 | <h2>+ $h2 +</h2> | |
178 | </div> | |
179 | ||
180 | END | |
181 | ; | |
182 | &showmenu(); | |
183 | ||
184 | print <<END | |
185 | </div> | |
186 | </div> | |
187 | ||
188 | <div id="main"> | |
189 | <div id="main_inner" class="fixed"> | |
190 | <div id="primaryContent_2columns"> | |
191 | <div id="columnA_2columns"> | |
192 | END | |
193 | ; | |
194 | } | |
195 | ||
196 | sub openpagewithoutmenu { | |
197 | my $title = shift; | |
198 | my $boh = shift; | |
199 | my $extrahead = shift; | |
200 | ||
201 | @URI=split ('\?', $ENV{'REQUEST_URI'} ); | |
202 | &readhash("${swroot}/main/settings", \%settings); | |
203 | &genmenu(); | |
204 | ||
205 | my $h2 = gettitle($menu); | |
206 | ||
207 | $title = "-= IPFire - $title =-"; | |
208 | if ($settings{'WINDOWWITHHOSTNAME'} eq 'on') { | |
209 | $title = "$settings{'HOSTNAME'}.$settings{'DOMAINNAME'} - $title"; | |
210 | } | |
211 | ||
212 | print <<END | |
213 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
214 | ||
215 | <html> | |
216 | <head> | |
217 | <title>$title</title> | |
218 | ||
219 | $extrahead | |
220 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> | |
221 | END | |
222 | ; | |
223 | if ($settings{'FX'} ne 'off') { | |
224 | print <<END | |
225 | <meta http-equiv="Page-Enter" content="blendTrans(Duration=0.5,Transition=12)" /> | |
226 | <meta http-equiv="Page-Exit" content="blendTrans(Duration=0.5,Transition=12)" /> | |
227 | END | |
228 | ; | |
229 | } | |
230 | print <<END | |
231 | <link rel="shortcut icon" href="/favicon.ico" /> | |
232 | <link rel="stylesheet" type="text/css" href="/include/style.css" /> | |
233 | <script language="javascript" type="text/javascript"> | |
234 | ||
235 | function swapVisibility(id) { | |
236 | el = document.getElementById(id); | |
237 | if(el.style.display != 'block') { | |
238 | el.style.display = 'block' | |
239 | } | |
240 | else { | |
241 | el.style.display = 'none' | |
242 | } | |
243 | } | |
244 | </script> | |
245 | ||
246 | </head> | |
247 | <body> | |
248 | <!-- IPFIRE HEADER --> | |
249 | ||
250 | <div id="header"> | |
251 | ||
252 | <div id="header_inner" class="fixed"> | |
253 | ||
254 | <div id="logo"> | |
255 | <h1><span>-= IPFire =-</span></h1> | |
256 | <h2>+ $h2 +</h2> | |
257 | </div> | |
258 | </div> | |
259 | </div> | |
260 | ||
261 | <div id="main"> | |
262 | <div id="main_inner" class="fixed"> | |
263 | <div id="primaryContent_2columns"> | |
264 | <div id="columnA_2columns"> | |
265 | END | |
266 | ; | |
267 | } | |
268 | ||
269 | sub closepage () { | |
270 | my $status = &connectionstatus(); | |
271 | $uptime = `/usr/bin/uptime`; | |
272 | ||
273 | print <<END | |
274 | </div> | |
275 | </div> | |
276 | ||
277 | <div id="secondaryContent_2columns"> | |
278 | ||
279 | <div id="columnC_2columns"> | |
280 | END | |
281 | ; | |
282 | &showsubsection($menu); | |
283 | &showsubsubsection($menu); | |
284 | ||
285 | print <<END | |
286 | </div> | |
287 | </div> | |
288 | ||
289 | <br class="clear" /> | |
290 | <div id="footer" class="fixed"> | |
291 | <b>Status:</b> $status <b>Uptime:</b>$uptime <b>Version:</b> $FIREBUILD | |
292 | </div> | |
293 | </div> | |
294 | </div> | |
295 | </body> | |
296 | </html> | |
297 | END | |
298 | ; | |
299 | } | |
300 | ||
301 | sub openbigbox | |
302 | { | |
303 | } | |
304 | ||
305 | sub closebigbox | |
306 | { | |
307 | } | |
308 | ||
309 | sub openbox | |
310 | { | |
311 | $width = $_[0]; | |
312 | $align = $_[1]; | |
313 | $caption = $_[2]; | |
314 | ||
315 | print <<END | |
316 | <!-- openbox --> | |
317 | <div class="post" align="$align"> | |
318 | END | |
319 | ; | |
320 | ||
321 | if ($caption) { print "<h3>$caption</h3>\n"; } else { print " "; } | |
322 | } | |
323 | ||
324 | sub closebox | |
325 | { | |
326 | print <<END | |
327 | </div> | |
328 | <br class="clear" /> | |
329 | <!-- closebox --> | |
330 | END | |
331 | ; | |
332 | } | |
333 | ||
334 | 1; |