Revision: 2791
http://ipcop.svn.sourceforge.net/ipcop/?rev=2791&view=rev
Author: riddles
Date: 2009-05-05 08:26:59 +0000 (Tue, 05 May 2009)
Log Message:
-----------
Template sysinfo.cgi
Modified Paths:
--------------
ipcop/branches/template-branch/config/rootfiles/common/Template-Toolkit
ipcop/branches/template-branch/config/rootfiles/common/ipcop-gui
ipcop/branches/template-branch/config/rootfiles/common/perl
ipcop/branches/template-branch/html/cgi-bin/sysinfo.cgi
Added Paths:
-----------
ipcop/branches/template-branch/html/html/pages/sysinfo.tpl
Modified:
ipcop/branches/template-branch/config/rootfiles/common/Template-Toolkit
===================================================================
--- ipcop/branches/template-branch/config/rootfiles/common/Template-Toolkit
2009-05-05 08:05:53 UTC (rev 2790)
+++ ipcop/branches/template-branch/config/rootfiles/common/Template-Toolkit
2009-05-05 08:26:59 UTC (rev 2791)
@@ -53,7 +53,7 @@
#usr/lib/perl5/site_perl/5.8.8/MACHINE-linux/Template/Plugin/Table.pm
#usr/lib/perl5/site_perl/5.8.8/MACHINE-linux/Template/Plugin/URL.pm
#usr/lib/perl5/site_perl/5.8.8/MACHINE-linux/Template/Plugin/View.pm
-#usr/lib/perl5/site_perl/5.8.8/MACHINE-linux/Template/Plugin/Wrap.pm
+usr/lib/perl5/site_perl/5.8.8/MACHINE-linux/Template/Plugin/Wrap.pm
usr/lib/perl5/site_perl/5.8.8/MACHINE-linux/Template/Plugins.pm
usr/lib/perl5/site_perl/5.8.8/MACHINE-linux/Template/Provider.pm
usr/lib/perl5/site_perl/5.8.8/MACHINE-linux/Template/Service.pm
Modified: ipcop/branches/template-branch/config/rootfiles/common/ipcop-gui
===================================================================
--- ipcop/branches/template-branch/config/rootfiles/common/ipcop-gui
2009-05-05 08:05:53 UTC (rev 2790)
+++ ipcop/branches/template-branch/config/rootfiles/common/ipcop-gui
2009-05-05 08:26:59 UTC (rev 2791)
@@ -144,6 +144,7 @@
home/httpd/html/pages/remote.tpl
home/httpd/html/pages/scheduler.tpl
home/httpd/html/pages/shutdown.tpl
+home/httpd/html/pages/sysinfo.tpl
home/httpd/html/pages/updates.tpl
home/httpd/html/themes/default/closebigbox.tpl
home/httpd/html/themes/default/closebox.tpl
Modified: ipcop/branches/template-branch/config/rootfiles/common/perl
===================================================================
--- ipcop/branches/template-branch/config/rootfiles/common/perl 2009-05-05
08:05:53 UTC (rev 2790)
+++ ipcop/branches/template-branch/config/rootfiles/common/perl 2009-05-05
08:26:59 UTC (rev 2791)
@@ -367,8 +367,8 @@
#usr/lib/perl5/5.8.8/Text/Balanced.pm
#usr/lib/perl5/5.8.8/Text/ParseWords.pm
#usr/lib/perl5/5.8.8/Text/Soundex.pm
-#usr/lib/perl5/5.8.8/Text/Tabs.pm
-#usr/lib/perl5/5.8.8/Text/Wrap.pm
+usr/lib/perl5/5.8.8/Text/Tabs.pm
+usr/lib/perl5/5.8.8/Text/Wrap.pm
#usr/lib/perl5/5.8.8/Thread
usr/lib/perl5/5.8.8/Thread.pm
usr/lib/perl5/5.8.8/Thread/Queue.pm
Modified: ipcop/branches/template-branch/html/cgi-bin/sysinfo.cgi
===================================================================
--- ipcop/branches/template-branch/html/cgi-bin/sysinfo.cgi 2009-05-05
08:05:53 UTC (rev 2790)
+++ ipcop/branches/template-branch/html/cgi-bin/sysinfo.cgi 2009-05-05
08:26:59 UTC (rev 2791)
@@ -6,18 +6,34 @@
#
# Copyright (C) 2007-2008 Tom 'wintermute' Eichstaedt <[email protected]>
#
-# 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 2 of the License, or (at your option) any
later version.
+# 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 2 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.
+# 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, write to the Free Software Foundation, Inc., 51 Franklin
St, Fifth Floor, Boston, MA 02110, USA
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#
-# Dieses Programm ist freie Software. Sie k\xF6nnen es unter den Bedingungen
der GNU General Public License, wie von der Free Software Foundation
ver\xF6ffentlicht, weitergeben und/oder modifizieren, entweder gem\xE4\xDF
Version 2 der Lizenz oder (nach Ihrer Option) jeder sp\xE4teren Version.
+# Dieses Programm ist freie Software. Sie k\xF6nnen es unter den Bedingungen
+# der GNU General Public License, wie von der Free Software Foundation
+# ver\xF6ffentlicht, weitergeben und/oder modifizieren, entweder gem\xE4\xDF
+# Version 2 der Lizenz oder (nach Ihrer Option) jeder sp\xE4teren Version.
#
-# Die Ver\xF6ffentlichung dieses Programms erfolgt in der Hoffnung, da\xDF es
Ihnen von Nutzen sein wird, aber OHNE IRGENDEINE GARANTIE, sogar ohne die
implizite Garantie der MARKTREIFE oder der VERWENDBARKEIT F\xDCR EINEN
BESTIMMTEN ZWECK. Details finden Sie in der GNU General Public License.
+# Die Ver\xF6ffentlichung dieses Programms erfolgt in der Hoffnung, da\xDF es
+# Ihnen von Nutzen sein wird, aber OHNE IRGENDEINE GARANTIE, sogar ohne
+# die implizite Garantie der MARKTREIFE oder der VERWENDBARKEIT F\xDCR EINEN
+# BESTIMMTEN ZWECK. Details finden Sie in der GNU General Public License.
#
-# Sie sollten ein Exemplar der GNU General Public License zusammen mit diesem
Programm erhalten haben. Falls nicht, schreiben Sie an die Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110, USA.
+# Sie sollten ein Exemplar der GNU General Public License zusammen mit
+# diesem Programm erhalten haben. Falls nicht, schreiben Sie an die Free
+# Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110,
USA.
#
################################################################################
#
@@ -32,10 +48,11 @@
#
use strict;
+use Template;
# enable only the following on debugging purpose
-#use warnings;
-#use CGI::Carp 'fatalsToBrowser';
+use warnings;
+use CGI::Carp 'fatalsToBrowser';
use LWP::UserAgent;
@@ -43,151 +60,82 @@
require '/usr/lib/ipcop/lang.pl';
require '/usr/lib/ipcop/header.pl';
-my %cgiparams=();
-my @lines;
-my $i;
-my $output;
+my $page_vars = &Header::get_page_vars();
+##
+## Output Diskinfo for 1 disk
+##
+sub diskinfo
+{
+ my @lines = ();
+ my $dev = shift;
+ my $outputhdd = `/usr/local/bin/sysinfo --disk=$dev`;
+ $outputhdd = &Header::cleanhtml($outputhdd);
+
+ my (@split) = split(/\n/, $outputhdd);
+ my $counter = 0;
+ foreach my $line (@split) {
+ push (@lines, $line."\r") if ($counter++ > 2);
+ }
+ return \...@lines;
+}
+##
+## Initialize Template
+##
+my $tt = Template->new({
+ INCLUDE_PATH => '/home/httpd/html/pages:/home/httpd/html/themes',
+ FILTERS => {
+ 'loc' => \&Header::maketext,
+ 'color_devices' => \&General::color_devices,
+ },
+}) || die "$Template::ERROR\n";
+
+##
+## Start Page
+##
&Header::showhttpheaders();
-&Header::openpage($Lang::tr{'system info page'}, 1, '');
-
-&Header::openbigbox('100%', 'left');
-
-my $acobalt = '';
-$acobalt = "<a href='#cobalt'>$Lang::tr{'system info cobalt submenu'}</a> |"
if (-e "/proc/cobalt");
-
-print <<END
-<table width='100%' cellspacing='0' cellpadding='5'border='0'>
-<tr><td style="background-color: #FFFFFF;" align='left'>
- <a href='#cpu'>$Lang::tr{'system info cpu submenu'}</a> |
- $acobalt
- <a href='#hdd'>$Lang::tr{'system info hdd submenu'}</a> |
- <a href='#pci'>$Lang::tr{'system info pci submenu'}</a> |
- <a href='#nic'>$Lang::tr{'system info nic submenu'}</a> |
- <a href='#link'>$Lang::tr{'system info link submenu'}</a> |
- <a href='#usb'>$Lang::tr{'system info usb submenu'}</a> |
- <a href='#irq'>$Lang::tr{'system info irq submenu'}</a> |
- <a href='#ps'>$Lang::tr{'system info ps submenu'}</a> |
- <a href='#modules'>$Lang::tr{'loaded modules'}</a>
-</td></tr></table>
-END
-;
-
-print "<a name='cpu'/>\n";
-&Header::openbox('100%', 'left', "$Lang::tr{'system info cpu'}:");
-
+##
+## CPU Information
+##
my $outputcpu = `/bin/cat /proc/cpuinfo`;
-my $cpumhz;
-my $bogomips;
-my $bogoeff;
$outputcpu = &Header::cleanhtml($outputcpu);
-chomp($outputcpu);
+my (@cpu) = split(/\n/, $outputcpu);
-my $outputcpuleft;
-my $outputcpumid;
-my $outputcpuright;
-(@lines) = split(/\n/, $outputcpu);
-$outputcpu = '';
-
-foreach my $line (@lines) {
- unless ( $line =~ /(.*?)\s*:\s*(.*)/ ) {
- $outputcpuleft .= "\n";
- $outputcpumid .= "\n";
- $outputcpuright .= "\n";
- next;
- }
-
- my $left = $1;
- my $right = $2;
- $outputcpuleft .= "$left\n";
- $outputcpumid .= " : \n";
- if (length($right) > 100) {
- $outputcpuleft .= "\n";
- $outputcpumid .= "\n";
- $outputcpuright .= substr($right, 0, rindex($right, ' ', 100)) . "\n"
. substr($right, rindex($right, ' ', 100)) . "\n";
- }
- else {
- $outputcpuright .= "$right\n";
- }
- $cpumhz = $1 if ($line =~ /cpu MHz.*: (.*)/);
- if ($line =~ /bogomips.*: (.*)/) {
- $bogomips = $1;
- $bogoeff = $bogomips / $cpumhz * 50;
- $outputcpuleft .= "bogomips eff.\n";
- $outputcpumid .= " : \n";
- $outputcpuright .= sprintf("%.4f %%\n", $bogoeff);
- }
-}
-print <<END
-<table cellspacing='0' cellpadding='0' border='0'><tr>
- <td valign='top'><pre>$outputcpuleft</pre></td>
- <td valign='top'><pre>$outputcpumid</pre></td>
- <td valign='top'><pre>$outputcpuright</pre></td>
-</tr></table>
-END
-;
-&Header::closebox();
-
-
-#
-# This is where platform specific information will be shown.
-#
-if (-e "/proc/cobalt") {
- print "<a name='cobalt'/>\n";
- &Header::openbox('100%', 'left', "$Lang::tr{'system info cobalt'}:");
-
- my $outputsystype = `/bin/cat /proc/cobalt/systype`;
- my $outputserialnumber = `/bin/cat /proc/cobalt/serialnumber`;
- my $outputfan = `/bin/cat /proc/cobalt/faninfo`;
- my $outputvoltage = `/bin/cat /proc/cobalt/sensors/voltage`;
- my $outputthermal = `/bin/cat /proc/cobalt/sensors/thermal`;
- my $outputraminfo = `/bin/cat /proc/cobalt/raminfo`;
-
- $outputsystype = &Header::cleanhtml($outputsystype);
- $outputserialnumber = &Header::cleanhtml($outputserialnumber);
- $outputfan = &Header::cleanhtml($outputfan);
- if (index($outputsystype, 'Alpine') != -1) {
- (@lines) = split(/\n/, $outputfan);
- $outputfan = "";
+##
+## This is where platform specific information will be shown.
+##
+my %cobalt = ();
+if (-e "/proc/cobalt") {
+ $cobalt{'systype'} = &Header::cleanhtml(`/bin/cat /proc/cobalt/systype`);
+ $cobalt{'serialnumber'} = &Header::cleanhtml(`/bin/cat
/proc/cobalt/serialnumber`);
+ $cobalt{'fan'} = &Header::cleanhtml(`/bin/cat /proc/cobalt/faninfo`);
+ if (index($cobalt{'systype'}, 'Alpine') != -1) {
+ my $outputfan = '';
+ my (@lines) = split(/\n/, $outputfan);
+ my @fan = ();
foreach my $line (@lines) {
next if ($line =~ /fan 0|fan 4/);
- $outputfan .= $line."\n";
+ push(@fan, $line);
}
}
- $outputthermal = &Header::cleanhtml($outputthermal);
- $outputvoltage = &Header::cleanhtml($outputvoltage);
- $outputraminfo = &Header::cleanhtml($outputraminfo);
-
- print "<pre>Cobalt System Type:\n$outputsystype \n";
- print "Cobalt System Serial Number:\n$outputserialnumber \n";
- if (index($outputsystype, 'Alpine') != -1) {
- print "Fan Info:\n$outputfan \n";
- print "Voltage:\n$outputvoltage \n";
- }
- else {
- print "Cpu Temperature In Degrees Celsius:\n$outputthermal \n";
- }
- print "Ram Slot Information:\n$outputraminfo<\/pre>";
-
- &Header::closebox();
+ $cobalt{'thermal'} = &Header::cleanhtml(`/bin/cat
/proc/cobalt/sensors/voltage`);
+ $cobalt{'voltage'} = &Header::cleanhtml(`/bin/cat
/proc/cobalt/sensors/thermal`);
+ $cobalt{'raminfo'} = &Header::cleanhtml(`/bin/cat /proc/cobalt/raminfo`);
}
-
-print "<a name='hdd'/>\n";
-&Header::openbox('100%', 'left', "$Lang::tr{'system info hdd'}:");
+##
+## Harddisk
+##
+my %mdstat = ();
+my %diskstat = ();
+my $outputscsi = '';
if (-e "/proc/mdstat") {
- $i = 0;
open(MDADM, "/usr/local/bin/sysinfo --raid=md0 |");
while(<MDADM>) {
if ($_ =~ m/^\s+(\d+).*\/dev\/(.*)\d$/) {
- if ($i) {
- print "<br /><hr />";
- }
- print "<b>$2</b><br />";
- &diskinfo($2);
- $i++;
+ mdstat{$2}=diskinfo($2);
}
}
close MDADM;
@@ -195,120 +143,100 @@
elsif (! -e "/proc/scsi/scsi") {
my $systemdisk = `ls -la /dev/disk/by-label/root`;
$systemdisk =~ m/\.\.\/\.\.\/(.*)\d/;
- &diskinfo($1);
+ $diskstat{$1}=&diskinfo($1);
}
else {
- my $outputscsi = `/bin/cat /proc/scsi/scsi`;
+ $outputscsi = `/bin/cat /proc/scsi/scsi`;
$outputscsi = &Header::cleanhtml($outputscsi);
- print "<pre>$outputscsi</pre>\n";
}
-&Header::closebox();
-print "<a name='pci'/>\n";
-&Header::openbox('100%', 'left', "$Lang::tr{'system info pci'}:");
-my $outputpci = `/usr/sbin/lspci -nn`;
-$outputpci = &Header::cleanhtml($outputpci);
-print "<pre>$outputpci</pre>\n";
-&Header::closebox();
+##
+## PCI
+##
+my @pci = ();
+my (@lines) = split(/\n/, `/usr/sbin/lspci -nn`);
+foreach my $line (@lines) {
+ push(@pci, &Header::cleanhtml($line));
+}
-print "<a name='nic'/>\n";
-&Header::openbox('100%', 'left', "$Lang::tr{'system info nic'}:");
-my $outputnic = `/usr/sbin/lspci -nn`;
-$outputnic = &Header::cleanhtml($outputnic);
-
-print "<pre>";
-(@lines) = split(/\n/, $outputnic);
+##
+## Network Card
+##
+my @nic = ();
+(@lines) = split(/\n/, `/usr/sbin/lspci -nn`);
foreach my $line (@lines) {
next if ($line !~ /Ethernet|Network/);
- print $line."\r";
+ push (@nic, &Header::cleanhtml($line));
(my $slot) = split(/ /, $line);
- $outputnic = `/usr/local/bin/sysinfo --pci=$slot`;
+ my $outputnic = `/usr/local/bin/sysinfo --pci=$slot`;
$outputnic =~ s/$slot/ /;
- $outputnic = &Header::cleanhtml($outputnic);
- print $outputnic;
+ my (@lines2) = split(/\n/, $outputnic);
+ foreach my $line2 (@lines2) {
+ push (@nic, &Header::cleanhtml($line2));
+ }
}
-print "</pre>";
-&Header::closebox();
-print "<a name='link'/>\n";
-&Header::openbox('100%', 'left', "$Lang::tr{'system info link'}:");
-print "<table cellspacing='0' cellpadding='0'border='0'><tr>";
-print "<td colspan='2'><pre style='font: 12px; margin: 0px;'>$Lang::tr{'system
info linkmii'}:</pre></td>";
-print "</tr><tr>";
-print "<td><pre style='font: 12px; margin: 0px;'> </pre></td>";
-print "<td><pre>";
-
+##
+## Network device link
+##
+my %miilink = ();
(@lines) = split(/\n/, `/bin/cat /proc/net/dev`);
foreach my $line (@lines) {
$line =~ /\s*(.*):(.*)/;
my $iface = $1;
next if (($iface eq "") || ($iface eq "lo") || ($iface =~
/ipsec|mast0|ppp|tun/));
- $output = `/sbin/mii-tool $iface 2>/dev/null`;
+ my $output = `/sbin/mii-tool $iface 2>/dev/null`;
if (length ($output) < 5) {
- $output = "$iface: link status: unknown (MII not supported)\n";
+ $miilink{$iface} = '';
}
- $output = &General::color_devices($output);
- print $output;
+ else {
+ $miilink{$iface} = $output;
+ }
}
-print "</pre></td>";
-print "</tr></table>";
-
-print "<table cellspacing='0' cellpadding='0'border='0'><tr>";
-print "<td colspan='2'><pre style='font: 12px; margin: 0px;'>$Lang::tr{'system
info linketh'}:</pre></td>";
-print "</tr><tr>";
-print "<td><pre style='font: 12px; margin: 0px;'> </pre></td>";
-print "<td>";
-
+my %ethlink = ();
(@lines) = split(/\n/, `/bin/cat /proc/net/dev`);
foreach my $line (@lines) {
$line =~ /\s*(.*):(.*)/;
my $iface = $1;
next if (($iface eq "") || ($iface eq "lo") || ($iface =~
/ipsec|mast0|ppp|tun/));
- $output = `/usr/local/bin/sysinfo --link=$iface | /bin/grep Settings`;
+ my $output = `/usr/local/bin/sysinfo --link=$iface | /bin/grep Settings`;
my $outputethtoolspd = `/usr/local/bin/sysinfo --link=$iface | /bin/grep
Speed`;
my $outputethtooldup = `/usr/local/bin/sysinfo --link=$iface | /bin/grep
Duplex`;
my $outputethtoollnk = `/usr/local/bin/sysinfo --link=$iface | /bin/grep
Link`;
- $output = &General::color_devices($output);
- $outputethtoolspd = &Header::cleanhtml($outputethtoolspd);
- $outputethtooldup = &Header::cleanhtml($outputethtooldup);
- $outputethtoollnk = &Header::cleanhtml($outputethtoollnk);
- print "<pre>$output $outputethtoolspd $outputethtooldup
$outputethtoollnk</pre>";
+ $ethlink{$iface} = {
+ 'settings' => $output,
+ 'speed' => &Header::cleanhtml($outputethtoolspd),
+ 'dup' => &Header::cleanhtml($outputethtooldup),
+ 'link' => &Header::cleanhtml($outputethtoollnk),
+ };
}
-print "</td>";
-print "</tr></table>";
-&Header::closebox();
+##
+## USB
+##
+my $usb = `/usr/local/bin/sysinfo --usb`;
+$usb = &Header::cleanhtml($usb);
-print "<a name='usb'/>\n";
-&Header::openbox('100%', 'left', "$Lang::tr{'system info usb'}:");
-my $outputusb = `/usr/local/bin/sysinfo --usb`;
-$outputusb = &Header::cleanhtml($outputusb);
-print "<pre>$outputusb</pre>\n";
-&Header::closebox();
+##
+## Interrupts
+##
+my $interrupts = `/bin/cat /proc/interrupts`;
+$interrupts = &Header::cleanhtml($interrupts);
-print "<a name='irq'/>\n";
-&Header::openbox('100%', 'left', "$Lang::tr{'system info irq'}:");
-$output = `/bin/cat /proc/interrupts`;
-$output = &General::color_devices($output);
-print "<pre>$output</pre>\n";
-&Header::closebox();
+##
+## Processes
+##
+my $process = `ps fax -o
user,pid,ppid,%cpu,%mem,vsz,rss,tty,stat,start,time,command --cols 128`;
+$process = &Header::cleanhtml($process);
-print "<a name='ps'/>\n";
-&Header::openbox('100%', 'left', "$Lang::tr{'system info ps'}:");
-my $outputps = `ps fax -o
user,pid,ppid,%cpu,%mem,vsz,rss,tty,stat,start,time,command --cols 128`;
-$outputps = &Header::cleanhtml($outputps);
-print "<pre>$outputps</pre>\n";
-&Header::closebox();
-
-print "<a name='modules'></a>\n";
-&Header::openbox('100%', 'left', "$Lang::tr{'loaded modules'}:");
+##
+## Modules
+##
+my @modules = ();
my @lsmod = qx+/bin/lsmod+;
-
-my $boldclass = "class='boldbase'";
-print "<table width='100%'>";
foreach my $line (@lsmod) {
chomp($line);
($line = &Header::cleanhtml($line,"y")) =~ s/\[.*\]//g;
@@ -322,44 +250,29 @@
$printusedby.=',';
}
$printusedby.=$module;
- if ($i % 5 == 0) {
- $printusedby.="<br />";
- }
$i++;
}
-
- printf <<END
-<tr valign='top'>
- <td width='12%' $boldclass>$split[0] </td>
- <td width='5%' align='right' $boldclass>$split[1] </td>
- <td width='5%' align='right' $boldclass>$split[2] </td>
- <td width='78%' $boldclass>$printusedby</td>
-</tr>
-END
-;
- $boldclass = '';
+ push (@modules, [ $split[0], $split[1], $split[2], $printusedby ]);
}
-print "</table>\n";
-&Header::closebox();
-&Header::closebigbox();
-
-&Header::closepage();
-
##
-## Output Diskinfo for 1 disk
+## Process Template and Exit
##
-sub diskinfo
-{
- my $dev = shift;
- my $outputhdd = `/usr/local/bin/sysinfo --disk=$dev`;
- $outputhdd = &Header::cleanhtml($outputhdd);
-
- print "<pre>";
- (@lines) = split(/\n/, $outputhdd);
- my $counter = 0;
- foreach my $line (@lines) {
- print $line."\r" if ($counter++ > 2);
- }
- print "</pre>\n";
-}
+$tt->process('sysinfo.tpl', {
+ 'page' => $page_vars,
+ 'system' => \&Header::get_system_vars,
+ 'cpu' => \...@cpu,
+ 'cobalt' => \%cobalt,
+ 'mdstat' => \%mdstat,
+ 'diskstat' => \%diskstat,
+ 'scsi' => $outputscsi,
+ 'pci' => \...@pci,
+ 'nic' => \...@nic,
+ 'miilink' => \%miilink,
+ 'ethlink' => \%ethlink,
+ 'usb' => $usb,
+ 'interrupts' => $interrupts,
+ 'process' => $process,
+ 'modules' => \...@modules,
+}) || die $tt->error(), "\n";
+
Added: ipcop/branches/template-branch/html/html/pages/sysinfo.tpl
===================================================================
--- ipcop/branches/template-branch/html/html/pages/sysinfo.tpl
(rev 0)
+++ ipcop/branches/template-branch/html/html/pages/sysinfo.tpl 2009-05-05
08:26:59 UTC (rev 2791)
@@ -0,0 +1,210 @@
+[% location = 'status' | loc %]
+[% sublocation = 'system info menu' | loc %]
+[% title = 'system info menu' | loc %]
+
+[% PROCESS "$page.theme/vars.tpl" %]
+[% INCLUDE "$page.theme/header.tpl" %]
+[% INCLUDE "$page.theme/openbigbox.tpl"
+ width = '100%'
+ align = 'left' %]
+
+[% INCLUDE "$page.theme/errorbox.tpl" %]
+[% INCLUDE "$page.theme/warningbox.tpl" %]
+
+<table width='100%' cellspacing='0' cellpadding='5'border='0'>
+<tr><td style="background-color: #FFFFFF;" align='left'>
+ <a href='#cpu'>[% 'system info cpu submenu' | loc %]</a> |
+ [% IF cobalt.size > 0 %]<a href='#cobalt'>[% 'system info cobalt submenu'
| loc %]</a> |[% END %]
+ <a href='#hdd'>[% 'system info hdd submenu' | loc %]</a> |
+ <a href='#pci'>[% 'system info pci submenu' | loc %]</a> |
+ <a href='#nic'>[% 'system info nic submenu' | loc %]</a> |
+ <a href='#link'>[% 'system info link submenu' | loc %]</a> |
+ <a href='#usb'>[% 'system info usb submenu' | loc %]</a> |
+ <a href='#irq'>[% 'system info irq submenu' | loc %]</a> |
+ <a href='#ps'>[% 'system info ps submenu' | loc %]</a> |
+ <a href='#modules'>[% 'loaded modules' | loc %]</a>
+</td></tr></table>
+
+<a name='cpu'/>
+[% caption = 'system info cpu' | loc %]
+[% INCLUDE "$page.theme/openbox.tpl"
+ width = '100%'
+ align = 'left'
+ caption = caption _ ":" %]
+<table cellspacing='0' cellpadding='0' cellspacing='0' border='0'><tr>
+ [% FOREACH line IN cpu %]
+ [% matches = line.match('^(.*?)\s*:\s*(.*)$') %]
+ [% NEXT IF ! matches %]
+ [% left = matches.0 %]
+ [% right = matches.1 %]
+ [% cpumatch = line.match('cpu MHz.*: (.*)') %]
+ [% IF cpumatch.0 %][% cpumhz = cpumatch.0 %][% END %]
+ [% bogomatch = line.match('bogomips.*: (.*)$') %]
+ [% IF bogomatch.0 %]
+ [% left = 'bogomips eff.' %]
+ [% right = bogomatch.0 / cpumhz * 50 | format('%.4f %%') %]
+ [% END %]
+ <tr><td valign='top'><pre style="display: inline;">[% left
%]</pre></td>
+ <td valign='top'><pre style="display: inline;">:</pre></td>
+ <td valign='top'><pre style="display: inline;">[% USE Wrap %][%
right | wrap(100) %]</pre></td>
+ </tr>
+ [% END %]
+</tr></table>
+[% INCLUDE "$page.theme/closebox.tpl" %]
+
+[% IF cobalt.size > 0 %]
+ <a name='cobalt'/>
+ [% caption = 'system info cobalt' | loc %]
+ [% INCLUDE "$page.theme/openbox.tpl"
+ width = '100%'
+ align = 'left'
+ caption = caption _ ":" %]
+ <pre>Cobalt System Type:
+[% cobalt.systype %]
+Cobalt System Serial Number:
+[% cobalt.serialnumber %]
+[% IF cobalt.systype.match('Alpine') -%]
+Cpu Temperature in Degrees Celsius:
+[% cobalt.thermal %]
+[% ELSE -%]
+Fan Info:
+[% FOREACH line IN cobalt.fan -%]
+[% line %]
+[% END -%]
+Voltage:
+[% cobalt.voltage %]
+[% END -%]
+Ram Slot Information:
+[% cobalt.raminfo %]</pre>
+ [% INCLUDE "$page.theme/closebox.tpl" %]
+[%END %]
+
+<a name='hdd'/>
+[% caption = 'system info hdd' | loc %]
+[% INCLUDE "$page.theme/openbox.tpl"
+ width = '100%'
+ align = 'left'
+ caption = caption _ ":" %]
+ [% IF mdstat.size > 0 %]
+ <br /><hr />
+ [% FOREACH md IN mdstat %]
+ <b>[% md.key %]</b><br />
+ <pre>[% FOREACH line IN md.value -%]
+[% line %]
+[% END -%]</pre>
+ [% END %]
+ [% ELSIF diskstat.size > 0 %]
+ [% FOREACH disk IN diskstat %]
+ <b>[% disk.key %]</b><br />
+ <pre>[% FOREACH line IN disk.value -%]
+[% line %]
+[% END -%]</pre>
+ [% END %]
+ [% ELSE %]
+ <pre>[% scsi %]</pre>
+ [% END %]
+[% INCLUDE "$page.theme/closebox.tpl" %]
+
+<a name='pci'/>
+[% caption = 'system info pci' | loc %]
+[% INCLUDE "$page.theme/openbox.tpl"
+ width = '100%'
+ align = 'left'
+ caption = caption _ ":" %]
+<pre>[% FOREACH line IN pci -%]
+[% line %]
+[% END -%]</pre>
+[% INCLUDE "$page.theme/closebox.tpl" %]
+
+<a name='nic'/>
+[% caption = 'system info nic' | loc %]
+[% INCLUDE "$page.theme/openbox.tpl"
+ width = '100%'
+ align = 'left'
+ caption = caption _ ":" %]
+<pre>[% FOREACH line IN nic -%]
+[% line %]
+[% END -%]</pre>
+[% INCLUDE "$page.theme/closebox.tpl" %]
+
+<a name='link'/>
+[% caption = 'system info link' | loc %]
+[% INCLUDE "$page.theme/openbox.tpl"
+ width = '100%'
+ align = 'left'
+ caption = caption _ ":" %]
+<table cellspacing='0' cellpadding='0'border='0'>
+<tr>
+ <td colspan='2'><pre style='font: 12px; margin: 0px;'>[% 'system info
linkmii' | loc %]:</pre></td>
+</tr>
+<tr>
+ <td><pre style='font: 12px; margin: 0px;'> </pre></td>
+ <td>
+ <pre>[% FOREACH iface IN miilink -%]
+[% IF iface.value %][% iface.value | color_devices %][% ELSE %][% iface.key |
color_devices %]: link status: unknown (MII not supported)[% END %]
+[% END -%]</pre>
+ </td>
+</tr></table>
+
+<table cellspacing='0' cellpadding='0'border='0'>
+<tr>
+ <td colspan='2'><pre style='font: 12px; margin: 0px;'>[% 'system info
linketh' | loc %]:</pre></td>
+</tr><tr>
+ <td><pre style='font: 12px; margin: 0px;'> </pre></td>
+ <td>
+ [% FOREACH iface IN ethlink %]
+ <pre>[% iface.value.settings | color_devices %] [%
iface.value.speed %] [% iface.value.dup %] [% iface.value.link %]</pre>
+ [% END %]
+ </td>
+</tr></table>
+[% INCLUDE "$page.theme/closebox.tpl" %]
+
+<a name='usb'/>
+[% caption = 'system info usb' | loc %]
+[% INCLUDE "$page.theme/openbox.tpl"
+ width = '100%'
+ align = 'left'
+ caption = caption _ ":" %]
+<pre>[% usb %]</pre>
+[% INCLUDE "$page.theme/closebox.tpl" %]
+
+<a name='irq'/>
+[% caption = 'system info irq' | loc %]
+[% INCLUDE "$page.theme/openbox.tpl"
+ width = '100%'
+ align = 'left'
+ caption = caption _ ":" %]
+<pre>[% interrupts | color_devices %]</pre>
+[% INCLUDE "$page.theme/closebox.tpl" %]
+
+<a name='ps'/>
+[% caption = 'system info ps' | loc %]
+[% INCLUDE "$page.theme/openbox.tpl"
+ width = '100%'
+ align = 'left'
+ caption = caption _ ":" %]
+<pre>[% process %]</pre>
+[% INCLUDE "$page.theme/closebox.tpl" %]
+
+<a name='modules'/>
+[% caption = 'loaded modules' | loc %]
+[% INCLUDE "$page.theme/openbox.tpl"
+ width = '100%'
+ align = 'left'
+ caption = caption _ ":" %]
+<table width='100%'>
+ [% firstbold = 'class=\'boldbase\'' %]
+ [% FOREACH module IN modules %]
+ <tr valign='top'>
+ <td width='12%' [% firstbold %]>[% module.0 %] </td>
+ <td width='5%' align='right' [% firstbold %]>[% module.1 %] </td>
+ <td width='5%' align='right' [% firstbold %]>[% module.2 %] </td>
+ <td width='78%' [% firstbold %]>[% module.3 %]</td>
+ [% firstbold = '' %]
+ </tr>
+ [% END %]
+</table>
+[% INCLUDE "$page.theme/closebox.tpl" %]
+
+[% INCLUDE "$page.theme/closebigbox.tpl" %]
+[% INCLUDE "$page.theme/footer.tpl" %]
This was sent by the SourceForge.net collaborative development platform, the
world's largest Open Source development site.
------------------------------------------------------------------------------
The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
production scanning environment may not be a perfect world - but thanks to
Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700
Series Scanner you'll get full speed at 300 dpi even with all image
processing features enabled. http://p.sf.net/sfu/kodak-com
_______________________________________________
Ipcop-svn mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ipcop-svn