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