Revision: 2810
http://ipcop.svn.sourceforge.net/ipcop/?rev=2810&view=rev
Author: riddles
Date: 2009-05-07 18:01:20 +0000 (Thu, 07 May 2009)
Log Message:
-----------
Merged /ipcop/trunk:r2808-r2809
Template iptablesgui.cgi
Modified Paths:
--------------
ipcop/branches/template-branch/config/rootfiles/common/ipcop-gui
ipcop/branches/template-branch/html/cgi-bin/iptablesgui.cgi
ipcop/branches/template-branch/langs/ipcop.new.en.pl
Added Paths:
-----------
ipcop/branches/template-branch/html/html/pages/iptablesgui.tpl
Property Changed:
----------------
ipcop/branches/template-branch/
Property changes on: ipcop/branches/template-branch
___________________________________________________________________
Modified: svn:mergeinfo
- /ipcop/trunk:2760-2807
+ /ipcop/trunk:2760-2809
Modified: ipcop/branches/template-branch/config/rootfiles/common/ipcop-gui
===================================================================
--- ipcop/branches/template-branch/config/rootfiles/common/ipcop-gui
2009-05-07 17:51:55 UTC (rev 2809)
+++ ipcop/branches/template-branch/config/rootfiles/common/ipcop-gui
2009-05-07 18:01:20 UTC (rev 2810)
@@ -141,6 +141,7 @@
home/httpd/html/pages/credits.tpl
home/httpd/html/pages/gui.tpl
home/httpd/html/pages/index.tpl
+home/httpd/html/pages/iptablesgui.tpl
home/httpd/html/pages/modem.tpl
home/httpd/html/pages/proxygraphs.tpl
home/httpd/html/pages/remote.tpl
Modified: ipcop/branches/template-branch/html/cgi-bin/iptablesgui.cgi
===================================================================
--- ipcop/branches/template-branch/html/cgi-bin/iptablesgui.cgi 2009-05-07
17:51:55 UTC (rev 2809)
+++ ipcop/branches/template-branch/html/cgi-bin/iptablesgui.cgi 2009-05-07
18:01:20 UTC (rev 2810)
@@ -2,22 +2,38 @@
#
################################################################################
#
-# IPCop iptables Web-Iface
+# IPCop SysInfo Web-Iface
#
-# Copyright (C) 2007 Olaf (weizen_42) Westrik
+# 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.
#
################################################################################
#
@@ -27,6 +43,7 @@
#
use strict;
+use Template;
# enable only the following on debugging purpose
use warnings;
@@ -38,54 +55,29 @@
require '/usr/lib/ipcop/lang.pl';
require '/usr/lib/ipcop/header.pl';
-my $option_table = '';
-
-
my %cgiparams=();
$cgiparams{'ACTION'} = ''; # refresh
$cgiparams{'TABLE'} = 'filter'; # filter / mangle / nat / raw
$cgiparams{'CHAIN'} = '';
-&General::getcgihash(\%cgiparams);
+my $page_vars = &Header::get_page_vars();
+##
+## 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";
-if ( $cgiparams{'ACTION'} eq $Lang::tr{'refresh'} ) {
-}
-
+##
+## Start Page
+##
&Header::showhttpheaders();
-&Header::openpage('iptables', 1, '');
-&Header::openbigbox('100%', 'left');
+&General::getcgihash(\%cgiparams);
-foreach my $table ( ("filter", "mangle", "nat", "raw") ) {
- if ( $cgiparams{'TABLE'} eq $table ) {
- $option_table = $option_table ."<option value='$table'
selected='selected'>$table</option>";
- }
- else {
- $option_table = $option_table ."<option value='$table'>$table</option>";
- }
-}
-
-&Header::openbox('100%', 'left', 'iptables:');
-
-print <<END
-<form method='post' action='$ENV{'SCRIPT_NAME'}'>
-<table width='100%'>
-<tr>
- <td width='20%' class='base'>Table:</td><td colspan='3'><select
name='TABLE'>$option_table</select></td>
-</tr><tr>
- <td width='20%' class='base'>Chain: <img src='/blob.gif' alt='*'
/></td><td colspan='3'><input type='text' name='CHAIN'
value='$cgiparams{'CHAIN'}' size='20' /></td>
-</tr>
-</table>
-<hr />
-<table width='100%'>
-<tr>
- <td width='70%' class='base' valign='top'><img src='/blob.gif' alt='*'
/> $Lang::tr{'this field may be blank'}</td>
- <td width='30%'><input type='submit' name='ACTION'
value='$Lang::tr{'refresh'}' /></td>
-</tr>
-</table></form>
-<hr />
-END
-;
-
my $output = '';
if ($cgiparams{'CHAIN'} eq '') {
$output = `/usr/local/bin/iptableswrapper $cgiparams{'TABLE'} 2>&1`;
@@ -94,18 +86,16 @@
$output = `/usr/local/bin/iptableswrapper chain $cgiparams{'TABLE'}
$cgiparams{'CHAIN'} 2>&1`;
}
$output = &Header::cleanhtml($output);
-
(my @lines) = split(/\n/, $output);
-print "<pre>";
-foreach my $line ( @lines )
-{
- $line = substr($line, 0, rindex($line, ' ', 120)) . "\n" . substr($line,
rindex($line, ' ', 120)) if ( length($line) > 120 );
- print $line ."\n";
-}
-print "</pre>";
+##
+## Process Template and Exit
+##
+$tt->process('iptablesgui.tpl', {
+ 'page' => $page_vars,
+ 'system' => \&Header::get_system_vars,
+ 'table' => $cgiparams{'TABLE'},
+ 'chain' => $cgiparams{'CHAIN'},
+ 'output' => \...@lines,
+}) || die $tt->error(), "\n";
-&Header::closebox();
-
-&Header::closebigbox();
-&Header::closepage();
Added: ipcop/branches/template-branch/html/html/pages/iptablesgui.tpl
===================================================================
--- ipcop/branches/template-branch/html/html/pages/iptablesgui.tpl
(rev 0)
+++ ipcop/branches/template-branch/html/html/pages/iptablesgui.tpl
2009-05-07 18:01:20 UTC (rev 2810)
@@ -0,0 +1,51 @@
+[% location = 'status' | loc %]
+[% sublocation = 'iptables' | loc %]
+[% title = 'iptables' | 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" %]
+
+[% caption = 'iptables' | loc %]
+[% INCLUDE "$page.theme/openbox.tpl"
+ width = '100%'
+ align = 'left'
+ caption = caption _ ":" %]
+<form method='post' action='[% page.url %]'>
+<table width='100%'>
+<tr>
+ <td width='20%' class='base'>[% 'table' | loc %]:</td>
+ <td colspan='3'>
+ <select name='TABLE'>
+ <option value='filter' [% 'selected=\'selected\'' IF table ==
'filter' %]>filter</option>
+ <option value='mangle' [% 'selected=\'selected\'' IF table ==
'mangle' %]>mangle</option>
+ <option value='nat' [% 'selected=\'selected\'' IF table ==
'nat' %]>nat</option>
+ <option value='raw' [% 'selected=\'selected\'' IF table ==
'raw' %]>raw</option>
+ </select>
+ </td>
+</tr><tr>
+ <td width='20%' class='base'>[% 'chain' | loc %]: <img
src='/blob.gif' alt='*' /></td>
+ <td colspan='3'><input type='text' name='CHAIN' value='[% chain %]'
size='20' /></td>
+</tr>
+</table>
+<hr />
+<table width='100%'>
+<tr>
+ <td width='70%' class='base' valign='top'><img src='/blob.gif' alt='*'
/> [% 'this field may be blank' | loc %]</td>
+ <td width='30%'><input type='submit' name='ACTION' value='[% 'refresh' | loc
%]' /></td>
+</tr>
+</table></form>
+<hr />
+[% USE Wrap %]
+<pre>[% FOREACH line IN output -%]
+[% line | wrap(120) %]
+[% END -%]</pre>
+[% INCLUDE "$page.theme/closebox.tpl" %]
+
+[% INCLUDE "$page.theme/closebigbox.tpl" %]
+[% INCLUDE "$page.theme/footer.tpl" %]
Modified: ipcop/branches/template-branch/langs/ipcop.new.en.pl
===================================================================
--- ipcop/branches/template-branch/langs/ipcop.new.en.pl 2009-05-07
17:51:55 UTC (rev 2809)
+++ ipcop/branches/template-branch/langs/ipcop.new.en.pl 2009-05-07
18:01:20 UTC (rev 2810)
@@ -685,6 +685,10 @@
'chgwebpwd SUCCESS' => 'S U C C E S S :',
'chgwebpwd ERROR' => 'E R R O R :',
+# from iptablesgui.cgi
+'iptables' => 'IPTables',
+'table' => 'Table',
+
######## Stop Edit above ##########
);
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