]>
Commit | Line | Data |
---|---|---|
af731c7d AM |
1 | #!/usr/bin/perl |
2 | ############################################################################### | |
3 | # # | |
4 | # IPFire.org - A linux based firewall # | |
5 | # Copyright (C) 2007 Michael Tremer & Christian Schmidt # | |
6 | # # | |
7 | # This program is free software: you can redistribute it and/or modify # | |
8 | # it under the terms of the GNU General Public License as published by # | |
9 | # the Free Software Foundation, either version 3 of the License, or # | |
10 | # (at your option) any later version. # | |
11 | # # | |
12 | # This program is distributed in the hope that it will be useful, # | |
13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of # | |
14 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # | |
15 | # GNU General Public License for more details. # | |
16 | # # | |
17 | # You should have received a copy of the GNU General Public License # | |
18 | # along with this program. If not, see <http://www.gnu.org/licenses/>. # | |
19 | # # | |
20 | ############################################################################### | |
21 | # # | |
22 | # Theme file for IPfire (based on ipfire theme) # | |
23 | # Author kay-michael köhler kmk <michael@koehler.tk> # | |
24 | # # | |
25 | # Version 1.0 March, 6th 2013 # | |
26 | ############################################################################### | |
27 | # # | |
28 | # Modyfied theme by a.marx@ipfire.org January 2014 # | |
29 | # # | |
30 | # Cleanup code, deleted unused code and rewrote the rest to get a new working # | |
31 | # IPFire default theme. # | |
32 | ############################################################################### | |
33 | ||
af731c7d AM |
34 | require "${General::swroot}/lang.pl"; |
35 | ############################################################################### | |
36 | # | |
37 | # print menu html elements for submenu entries | |
38 | # @param submenu entries | |
39 | sub showsubmenu() { | |
40 | my $submenus = shift; | |
41 | ||
42 | print "<ul>"; | |
43 | foreach my $item (sort keys %$submenus) { | |
44 | $link = getlink($submenus->{$item}); | |
45 | next if (!is_menu_visible($link) or $link eq ''); | |
46 | ||
47 | my $subsubmenus = $submenus->{$item}->{'subMenu'}; | |
48 | ||
49 | if ($subsubmenus) { | |
50 | print '<li class="has-sub ">'; | |
51 | } else { | |
52 | print '<li>'; | |
53 | } | |
697a4d52 | 54 | print '<a href="'.$link.'">'.$submenus->{$item}->{'caption'}.'</a>'; |
af731c7d AM |
55 | |
56 | &showsubmenu($subsubmenus) if ($subsubmenus); | |
57 | print '</li>'; | |
58 | } | |
59 | print "</ul>" | |
60 | } | |
61 | ||
62 | ############################################################################### | |
63 | # | |
64 | # print menu html elements | |
65 | sub showmenu() { | |
697a4d52 | 66 | print '<div id="cssmenu" class="bigbox fixed">'; |
865c7615 | 67 | |
af731c7d | 68 | if ($settings{'SPEED'} ne 'off') { |
865c7615 MT |
69 | print <<EOF; |
70 | <div id='traffic'> | |
71 | <strong>Traffic:</strong> | |
72 | In <span id='rx_kbs'>--.-- Bit/s</span> | |
73 | Out <span id='tx_kbs'>--.-- Bit/s</span> | |
74 | </div> | |
75 | EOF | |
af731c7d | 76 | } |
865c7615 | 77 | |
697a4d52 MT |
78 | print "<ul>"; |
79 | foreach my $k1 ( sort keys %$menu ) { | |
80 | $link = getlink($menu->{$k1}); | |
81 | next if (!is_menu_visible($link) or $link eq ''); | |
82 | print '<li class="has-sub "><a><span>'.$menu->{$k1}->{'caption'}.'</span></a>'; | |
83 | my $submenus = $menu->{$k1}->{'subMenu'}; | |
84 | &showsubmenu($submenus) if ($submenus); | |
85 | print "</li>"; | |
86 | } | |
87 | ||
88 | print "</ul></div>"; | |
af731c7d AM |
89 | } |
90 | ||
91 | ############################################################################### | |
92 | # | |
93 | # print page opening html layout | |
94 | # @param page title | |
95 | # @param boh | |
96 | # @param extra html code for html head section | |
97 | # @param suppress menu option, can be numeric 1 or nothing. | |
98 | # menu will be suppressed if param is 1 | |
99 | sub openpage { | |
100 | my $title = shift; | |
101 | my $boh = shift; | |
102 | my $extrahead = shift; | |
103 | my $suppressMenu = shift; | |
104 | my @tmp = split(/\./, basename($0)); | |
105 | my $scriptName = @tmp[0]; | |
af731c7d AM |
106 | |
107 | @URI=split ('\?', $ENV{'REQUEST_URI'} ); | |
108 | &General::readhash("${swroot}/main/settings", \%settings); | |
109 | &genmenu(); | |
110 | ||
697a4d52 | 111 | my $headline = "IPFire"; |
af731c7d | 112 | if ($settings{'WINDOWWITHHOSTNAME'} eq 'on') { |
697a4d52 | 113 | $headline = "$settings{'HOSTNAME'}.$settings{'DOMAINNAME'}"; |
af731c7d AM |
114 | } |
115 | ||
116 | print <<END | |
117 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> | |
118 | <html> | |
119 | <head> | |
697a4d52 | 120 | <title>$headline - $title</title> |
af731c7d AM |
121 | $extrahead |
122 | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/> | |
123 | <link rel="shortcut icon" href="/favicon.ico" /> | |
124 | <link href="/themes/ipfire-new/include/css/style.css" rel="stylesheet" type="text/css" /> | |
125 | <script type="text/javascript" src="/include/jquery-1.9.1.min.js"></script> | |
126 | END | |
127 | ; | |
128 | if ($settings{'SPEED'} ne 'off') { | |
129 | print <<END | |
130 | <script type="text/javascript" src="/themes/ipfire-new/include/js/refreshInetInfo.js"></script> | |
131 | END | |
132 | ; | |
133 | } | |
134 | ||
135 | if ($settings{'FX'} ne 'off') { | |
136 | print <<END | |
137 | <meta http-equiv="Page-Enter" content="blendTrans(Duration=0.5,Transition=12)" /> | |
138 | <meta http-equiv="Page-Exit" content="blendTrans(Duration=0.5,Transition=12)" /> | |
139 | END | |
140 | ; | |
141 | } | |
142 | ||
143 | print <<END | |
697a4d52 MT |
144 | </head> |
145 | <body> | |
146 | <div id="header" class="fixed"> | |
af731c7d AM |
147 | <div id="logo"> |
148 | END | |
149 | ; | |
150 | if ($settings{'WINDOWWITHHOSTNAME'} eq 'on') { | |
697a4d52 | 151 | print "<h1>$settings{'HOSTNAME'}.$settings{'DOMAINNAME'}</h1>"; |
af731c7d | 152 | } else { |
697a4d52 | 153 | print "<h1>IPFire</h1>"; |
af731c7d AM |
154 | } |
155 | ||
156 | print <<END | |
af731c7d AM |
157 | </div> |
158 | </div> | |
159 | END | |
160 | ; | |
161 | ||
162 | &showmenu() if ($suppressMenu != 1); | |
163 | ||
164 | print <<END | |
697a4d52 MT |
165 | <div class="bigbox fixed"> |
166 | <div id="main_inner" class="fixed"> | |
167 | <h1>$title</h1> | |
af731c7d AM |
168 | END |
169 | ; | |
170 | } | |
171 | ||
172 | ############################################################################### | |
173 | # | |
174 | # print page opening html layout without menu | |
175 | # @param page title | |
176 | # @param boh | |
177 | # @param extra html code for html head section | |
178 | sub openpagewithoutmenu { | |
179 | openpage(shift,shift,shift,1); | |
180 | return; | |
181 | } | |
182 | ||
af731c7d AM |
183 | ############################################################################### |
184 | # | |
185 | # print page closing html layout | |
186 | ||
187 | sub closepage () { | |
c3f00878 MT |
188 | open(FILE, "</etc/system-release"); |
189 | my $system_release = <FILE>; | |
190 | $system_release =~ s/core/Core Update/; | |
191 | close(FILE); | |
af731c7d | 192 | |
697a4d52 | 193 | print <<END; |
af731c7d AM |
194 | </div> |
195 | </div> | |
697a4d52 MT |
196 | |
197 | <div id="footer" class='bigbox fixed'> | |
c3f00878 MT |
198 | <span class="pull-right"> |
199 | <a href="http://www.ipfire.org/" target="_blank"><strong>IPFire.org</strong></a> • | |
200 | <a href="http://www.ipfire.org/donate" target="_blank">$Lang::tr{'support donation'}</a> | |
201 | </span> | |
202 | ||
203 | <strong>$system_release</strong> | |
697a4d52 | 204 | </div> |
af731c7d AM |
205 | </body> |
206 | </html> | |
af731c7d AM |
207 | END |
208 | ; | |
209 | } | |
210 | ||
211 | ############################################################################### | |
212 | # | |
213 | # print big box opening html layout | |
697a4d52 | 214 | sub openbigbox { |
af731c7d AM |
215 | } |
216 | ||
217 | ############################################################################### | |
218 | # | |
219 | # print big box closing html layout | |
697a4d52 | 220 | sub closebigbox { |
af731c7d AM |
221 | } |
222 | ||
223 | ############################################################################### | |
224 | # | |
225 | # print box opening html layout | |
226 | # @param page width | |
227 | # @param page align | |
228 | # @param page caption | |
697a4d52 | 229 | sub openbox { |
af731c7d AM |
230 | $width = $_[0]; |
231 | $align = $_[1]; | |
232 | $caption = $_[2]; | |
233 | ||
697a4d52 MT |
234 | print "<div class='post' align='$align'>\n"; |
235 | ||
236 | if ($caption) { | |
237 | print "<h2>$caption</h2>\n"; | |
238 | } | |
af731c7d AM |
239 | } |
240 | ||
241 | ############################################################################### | |
242 | # | |
243 | # print box closing html layout | |
697a4d52 MT |
244 | sub closebox { |
245 | print "</div>"; | |
af731c7d AM |
246 | } |
247 | ||
248 | 1; |