]> git.ipfire.org Git - people/teissler/ipfire-2.x.git/blobdiff - html/html/themes/maniac/include/functions.pl
Fix missing closing DIV tag in maniac's theme.
[people/teissler/ipfire-2.x.git] / html / html / themes / maniac / include / functions.pl
index 730105454f233c9da8f457d39fa775aa51b3be8b..62bbf101e724e6f4e44ab72b04f94059c4b76c83 100644 (file)
@@ -1,4 +1,23 @@
 #!/usr/bin/perl
+###############################################################################
+#                                                                             #
+# IPFire.org - A linux based firewall                                         #
+# Copyright (C) 2007  Michael Tremer & Christian Schmidt                      #
+#                                                                             #
+# This program is free software: you can redistribute it and/or modify        #
+# it under the terms of the GNU General Public License as published by        #
+# the Free Software Foundation, either version 3 of the License, or           #
+# (at your option) any later version.                                         #
+#                                                                             #
+# This program is distributed in the hope that it will be useful,             #
+# but WITHOUT ANY WARRANTY; without even the implied warranty of              #
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               #
+# GNU General Public License for more details.                                #
+#                                                                             #
+# You should have received a copy of the GNU General Public License           #
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.       #
+#                                                                             #
+###############################################################################
 
 sub showmenu() {
     print <<EOF
@@ -124,14 +143,12 @@ sub openpage {
     }
 
     print <<END
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-
-<html>
-  <head>
-  <title>$title</title>
-
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+               <title>$title</title>
     $extrahead
-    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
 END
 ;
     if ($settings{'FX'} ne 'off') {
@@ -148,17 +165,66 @@ END
       
         function swapVisibility(id) {
             el = document.getElementById(id);
-           if(el.style.display != 'block') {
-               el.style.display = 'block'
-           }
-           else {
-               el.style.display = 'none'
-           }
+            if(el.style.display != 'block') {
+                el.style.display = 'block'
+            }
+            else {
+                el.style.display = 'none'
+            }
         }
     </script>
-
+END
+;
+if ($settings{'SPEED'} ne 'off') {
+print <<END
+    <script type="text/javascript" src="/include/jquery-1.9.1.min.js"></script>
+    <script type="text/javascript">
+        var t_current;
+        var t_last;
+        var rxb_current;
+        var rxb_last;
+        var txb_current;
+        var txb_last;
+                               function refreshInetInfo() {
+                                               \$.ajax({
+                                                               url: '/cgi-bin/speed.cgi',
+                                                                                       success: function(xml){
+                                                                                       t_current = new Date();
+                                                                                       var t_diff = t_current - t_last;
+                                                                                       t_last = t_current;
+                               
+                                                                                       rxb_current = \$("rxb",xml).text();
+                                                                                       var rxb_diff = rxb_current - rxb_last;
+                                                                                       rxb_last = rxb_current;
+                               
+                                                                                       var rx_kbs = rxb_diff/t_diff;
+                                                                                       rx_kbs = Math.round(rx_kbs*10)/10;
+                               
+                                                                                       txb_current = \$("txb",xml).text();
+                                                                                       var txb_diff = txb_current - txb_last;
+                                                                                       txb_last = txb_current;
+                               
+                                                                                       var tx_kbs = txb_diff/t_diff;
+                                                                                       tx_kbs = Math.round(tx_kbs*10)/10;
+                               
+                                                                                       \$("#rx_kbs").text(rx_kbs + ' kb/s');
+                                                                                       \$("#tx_kbs").text(tx_kbs + ' kb/s');
+                                                                                       }
+                                                               });
+                                                               window.setTimeout("refreshInetInfo()", 3000);
+                                               }
+                                               \$(document).ready(function(){
+                                               refreshInetInfo();
+                               });
+    </script>
   </head>
   <body>
+END
+;
+}
+else {
+print "</head>\n<body>";}
+print <<END
 <!-- IPFIRE HEADER -->
 
 <div id="header">
@@ -210,14 +276,12 @@ sub openpagewithoutmenu {
     }
 
     print <<END
-<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
-
-<html>
-  <head>
-  <title>$title</title>
-
-    $extrahead
-    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
+<?xml version='1.0' encoding='UTF-8'?>
+<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
+<html xmlns='http://www.w3.org/1999/xhtml'>
+<head>
+               <title>$title</title>
+               $extrahead
 END
 ;
     if ($settings{'FX'} ne 'off') {
@@ -267,9 +331,14 @@ END
 }
 
 sub closepage () {
-    my $status = &connectionstatus();
-    $uptime = `/usr/bin/uptime`;
-       
+       my $status = &connectionstatus();
+       my $uptime = `/usr/bin/uptime|cut -d \" \" -f 4-`;
+       $uptime =~ s/year(s|)/$Lang::tr{'year'}/;
+       $uptime =~ s/month(s|)/$Lang::tr{'month'}/;
+       $uptime =~ s/day(s|)/$Lang::tr{'day'}/;
+       $uptime =~ s/user(s|)/$Lang::tr{'user'}/;
+       $uptime =~ s/load average/$Lang::tr{'uptime load average'}/;     
+                               
     print <<END
                        </div>
                </div>
@@ -282,15 +351,26 @@ END
     &showsubsection($menu);
     &showsubsubsection($menu);
 
-       print <<END                     
+       print <<END
+                               </div>
                        </div>
-               </div>
+                       <br class="clear" />    
+                       <div id="footer" class="fixed">
+                               <b>Status:</b> $status <b>Uptime:</b> $uptime
+END
+;
+if ($settings{'SPEED'} ne 'off') {
+print <<END                        
+                        <br />
+                                <b>$Lang::tr{'bandwidth usage'}:</b>
+                               $Lang::tr{'incoming'}: <span id="rx_kbs"></span>&nbsp;$Lang::tr{'outgoing'}: <span id="tx_kbs"></span>
 
-               <br class="clear" />    
-               <div id="footer" class="fixed">
-                       <b>Status:</b> $status <b>Uptime:</b>$uptime <b>Version:</b> $FIREBUILD
-               </div>
-       </div>
+END
+;
+}
+print <<END
+                </div>
+        </div>
 </div>
 </body>
 </html>