]>
git.ipfire.org Git - ipfire-2.x.git/blob - html/html/themes/ipfire/include/functions.pl
2 ###############################################################################
4 # IPFire.org - A linux based firewall #
5 # Copyright (C) 2007 Michael Tremer & Christian Schmidt #
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. #
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. #
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/>. #
20 ###############################################################################
28 foreach my $k1 ( sort keys %$menu ) {
29 if (! $menu->{$k1}{'enabled'}) {
32 my $link = getlink
($menu->{$k1});
36 if (! is_menu_visible
($link)) {
39 if ($menu->{$k1}->{'selected'}) {
40 print "<li><a href=\"$link\" class=\"active\">$menu->{$k1}{'caption'}</a></li>";
42 print "<li><a href=\"$link\">$menu->{$k1}{'caption'}</a></li>";
58 foreach my $item (%$root) {
59 if ($root->{$item}{'selected'}) {
60 return $root->{$item};
65 sub showsubsection
($$) {
71 my $selected = getselected
($root);
75 my $submenus = $selected->{'subMenu'};
81 <h4><span>Side</span>menu</h4>
85 foreach my $item (sort keys %$submenus) {
86 my $hash = $submenus->{$item};
87 if (! $hash->{'enabled'}) {
90 my $link = getlink
($hash);
94 if (! is_menu_visible
($link)) {
97 if ($hash->{'selected'}) {
98 print '<li class="selected">';
103 print "<a href=\"$link\">$hash->{'caption'}</a></li>";
113 sub showsubsubsection
($) {
118 my $selected = getselected
($root);
122 if (! $selected->{'subMenu'}) {
126 showsubsection
($selected->{'subMenu'}, 'menu-subtop');
132 my $extrahead = shift;
134 @URI=split ('\?', $ENV{'REQUEST_URI'} );
135 &General
::readhash
("${swroot}/main/settings", \
%settings);
138 my $h2 = gettitle
($menu);
140 $title = "IPFire - $title";
141 if ($settings{'WINDOWWITHHOSTNAME'} eq 'on') {
142 $title = "$settings{'HOSTNAME'}.$settings{'DOMAINNAME'} - $title";
146 <?xml version='1.0' encoding='UTF-8'?>
147 <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
148 <html xmlns='http://www.w3.org/1999/xhtml'>
150 <title>$title</title>
154 if ($settings{'FX'} ne 'off') {
156 <meta http-equiv="Page-Enter" content="blendTrans(Duration=0.5,Transition=12)" />
157 <meta http-equiv="Page-Exit" content="blendTrans(Duration=0.5,Transition=12)" />
162 <link rel="shortcut icon" href="/favicon.ico" />
163 <link rel="stylesheet" type="text/css" href="/themes/ipfire/include/style.css" />
164 <script language="javascript" type="text/javascript">
166 function swapVisibility(id) {
167 el = document.getElementById(id);
168 if(el.style.display != 'block') {
169 el.style.display = 'block'
172 el.style.display = 'none'
178 if ($settings{'SPEED'} ne 'off') {
180 <script type="text/javascript" src="/include/jquery.js"></script>
181 <script type="text/javascript">
188 function refreshInetInfo() {
190 url: '/cgi-bin/speed.cgi',
191 success: function(xml){
192 t_current = new Date();
193 var t_diff = t_current - t_last;
196 rxb_current = \$("rxb",xml).text();
197 var rxb_diff = rxb_current - rxb_last;
198 rxb_last = rxb_current;
200 var rx_kbs = rxb_diff/t_diff;
201 rx_kbs = Math.round(rx_kbs*10)/10;
203 txb_current = \$("txb",xml).text();
204 var txb_diff = txb_current - txb_last;
205 txb_last = txb_current;
207 var tx_kbs = txb_diff/t_diff;
208 tx_kbs = Math.round(tx_kbs*10)/10;
210 \$("#rx_kbs").text(rx_kbs + ' kb/s');
211 \$("#tx_kbs").text(tx_kbs + ' kb/s');
214 window.setTimeout("refreshInetInfo()", 3000);
216 \$(document).ready(function(){
226 print "</head><body>";}
228 <!-- IPFIRE HEADER -->
232 <div id="header_inner" class="fixed">
237 if ($settings{'WINDOWWITHHOSTNAME'} eq 'on') {
238 print "<h1><span>$settings{'HOSTNAME'}.$settings{'DOMAINNAME'}</span></h1><br />";
240 print "<h1><span>IPFire</span></h1><br />";
255 <div id="main_inner" class="fixed">
256 <div id="primaryContent_2columns">
257 <div id="columnA_2columns">
262 sub openpagewithoutmenu
{
265 my $extrahead = shift;
267 @URI=split ('\?', $ENV{'REQUEST_URI'} );
268 &General
::readhash
("${swroot}/main/settings", \
%settings);
271 my $h2 = gettitle
($menu);
273 $title = "IPFire - $title";
274 if ($settings{'WINDOWWITHHOSTNAME'} eq 'on') {
275 $title = "$settings{'HOSTNAME'}.$settings{'DOMAINNAME'} - $title";
279 <?xml version='1.0' encoding='UTF-8'?>
280 <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
281 <html xmlns='http://www.w3.org/1999/xhtml'>
283 <title>$title</title>
287 if ($settings{'FX'} ne 'off') {
289 <meta http-equiv="Page-Enter" content="blendTrans(Duration=0.5,Transition=12)" />
290 <meta http-equiv="Page-Exit" content="blendTrans(Duration=0.5,Transition=12)" />
295 <link rel="shortcut icon" href="/favicon.ico" />
296 <link rel="stylesheet" type="text/css" href="/include/style.css" />
297 <script language="javascript" type="text/javascript">
299 function swapVisibility(id) {
300 el = document.getElementById(id);
301 if(el.style.display != 'block') {
302 el.style.display = 'block'
305 el.style.display = 'none'
312 <!-- IPFIRE HEADER -->
316 <div id="header_inner" class="fixed">
319 <h1><span>IPFire</span></h1>
326 <div id="main_inner" class="fixed">
327 <div id="primaryContent_2columns">
328 <div id="columnA_2columns">
334 my $status = &connectionstatus
();
335 my $uptime = `/usr/bin/uptime|cut -d \" \" -f 4-`;
336 $uptime =~ s/year(s|)/$Lang::tr{'year'}/;
337 $uptime =~ s/month(s|)/$Lang::tr{'month'}/;
338 $uptime =~ s/day(s|)/$Lang::tr{'day'}/;
339 $uptime =~ s/user(s|)/$Lang::tr{'user'}/;
340 $uptime =~ s/load average/$Lang::tr{'uptime load average'}/;
346 <div id="secondaryContent_2columns">
348 <div id="columnC_2columns">
351 &showsubsection
($menu);
352 &showsubsubsection
($menu);
358 <div id="footer" class="fixed">
359 <b>Status:</b> $status <b>Uptime:</b> $uptime
362 if ($settings{'SPEED'} ne 'off') {
365 <b>$Lang::tr{'bandwidth usage'}:</b>
366 $Lang::tr{'incoming'}: <span id="rx_kbs"></span> $Lang::tr{'outgoing'}: <span id="tx_kbs"></span>
397 <div class="post" align="$align">
401 if ($caption) { print "<h3>$caption</h3>\n"; } else { print " "; }