Firewall: completed michaels JQuery code and some language changes. This is BETA2...
authorAlexander Marx <amarx@ipfire.org>
Wed, 16 Oct 2013 12:27:08 +0000 (14:27 +0200)
committerAlexander Marx <amarx@ipfire.org>
Wed, 16 Oct 2013 12:27:08 +0000 (14:27 +0200)
html/cgi-bin/forwardfw.cgi
langs/de/cgi-bin/de.pl
langs/en/cgi-bin/en.pl

index 3810b8b324a35b905b0f86e4b6fc58ab559be4b6..afd5ece35aa01ee6ba01caac30effa71e7a24bed 100755 (executable)
@@ -137,8 +137,8 @@ print<<END;
                update_protocol();
 
                // When nat not used, hide it
-               if (\$("#nat").attr("checked")) {
-                       \$("#natpart").show();
+               if (\$("#nat").attr("checked")) {
+                       \$("#natpart").hide();
                }
 
                // Show NAT area when "use nat" checkbox is clicked
@@ -168,6 +168,23 @@ if ($fwdfwsettings{'ACTION'} eq 'saverule')
        &General::readhasharray("$configfwdfw", \%configfwdfw);
        &General::readhasharray("$configinput", \%configinputfw);
        &General::readhasharray("$configoutgoing", \%configoutgoingfw);
+       #Set Variables according to the JQuery code in protocol section
+       if ($fwdfwsettings{'PROT'} eq 'TCP' || $fwdfwsettings{'PROT'} eq 'UDP')
+       {
+               if ($fwdfwsettings{'SRC_PORT'} ne '')
+               {
+                       $fwdfwsettings{'USE_SRC_PORT'} = 'ON';
+               }
+               if ($fwdfwsettings{'TGT_PORT'} ne '')
+               {
+                       $fwdfwsettings{'USESRV'} = 'ON';
+                       $fwdfwsettings{'grp3'} = 'TGT_PORT';
+               }
+       }
+       if ($fwdfwsettings{'PROT'} eq 'template')
+       {
+               $fwdfwsettings{'USESRV'} = 'ON';
+       }
        $errormessage=&checksource;
        if(!$errormessage){&checktarget;}
        if(!$errormessage){&checkrule;}
@@ -823,7 +840,7 @@ sub checkrule
                return;
        }
        #when icmp selected, no targetport allowed
-       if (($fwdfwsettings{'PROT'} ne '' && $fwdfwsettings{'PROT'} ne 'TCP' && $fwdfwsettings{'PROT'} ne 'UDP') && ($fwdfwsettings{'USESRV'} eq 'ON' || $fwdfwsettings{'USE_SRC_PORT'} eq 'ON')){
+       if (($fwdfwsettings{'PROT'} ne '' && $fwdfwsettings{'PROT'} ne 'TCP' && $fwdfwsettings{'PROT'} ne 'UDP' && $fwdfwsettings{'PROT'} ne 'template') && ($fwdfwsettings{'USESRV'} eq 'ON' || $fwdfwsettings{'USE_SRC_PORT'} eq 'ON')){
                $errormessage.=$Lang::tr{'fwdfw err prot_port'};
                return;
        }
@@ -874,6 +891,12 @@ sub checkrule
                $fwdfwsettings{'ICMP_TYPES'}='';
                $fwdfwsettings{'USESRV'}='';
                $fwdfwsettings{'TGT_PORT'}='';
+       }elsif($fwdfwsettings{'PROT'} eq 'IGMP'){
+               $fwdfwsettings{'USE_SRC_PORT'}='';
+               $fwdfwsettings{'SRC_PORT'}='';
+               $fwdfwsettings{'ICMP_TYPES'}='';
+               $fwdfwsettings{'USESRV'}='';
+               $fwdfwsettings{'TGT_PORT'}='';
        }elsif($fwdfwsettings{'PROT'} ne 'TCP' && $fwdfwsettings{'PROT'} ne 'UDP' && $fwdfwsettings{'PROT'} ne 'ICMP'){
                $fwdfwsettings{'ICMP_TYPES'}='';
                $fwdfwsettings{'PROT'} = '';
@@ -1670,6 +1693,10 @@ END
                &Header::closebox;
                #---PROTOCOL------------------------------------------------------
                &Header::openbox('100%', 'left', $Lang::tr{'fwhost prot'});
+               #Fix Protocol for JQuery
+               if ($fwdfwsettings{'grp3'} eq 'cust_srv' || $fwdfwsettings{'grp3'} eq 'cust_srvgrp'){
+                       $fwdfwsettings{'PROT'} = 'template';
+               }
                print<<END;
                <div id="prt">
                        <table width='15%' border='0' style="float:left;">
@@ -1684,7 +1711,7 @@ END
                print ">$Lang::tr{'all'}</option>";
 
                print "<option value=\"template\"";
-               # XXX set selected
+               print " selected=\"selected\"" if ($fwdfwsettings{'grp3'} eq 'cust_srv' || $fwdfwsettings{'grp3'} eq 'cust_srvgrp');
                print ">- $Lang::tr{'template'} -</option>";
 
                foreach (@PROTOCOLS) {
@@ -1736,16 +1763,19 @@ END
                                <tr>
                                        <!-- #SOURCEPORT -->
                                        <td>
-                                               $Lang::tr{'fwdfw man port'}
+                                               $Lang::tr{'fwdfw use srcport'}
                                        </td>
                                        <td>
                                                <input type='text' name='SRC_PORT' value='$fwdfwsettings{'SRC_PORT'}' maxlength='20' size='18'>
                                        </td>
+                                       <td width='10%'>
+                                       </td>
 
                                        <!-- #TARGETPORT -->
                                        <td>
-                                               $Lang::tr{'fwdfw man port'}
+                                               $Lang::tr{'fwdfw use srv'}
                                        </td>
+
                                        <td>
                                                <input type='text' name='TGT_PORT' value='$fwdfwsettings{'TGT_PORT'}' maxlength='20' size='18'>
                                        </td>
index a894ba022a11365acc3fd1ea9231ce05fdb65cc4..b0875068cdcc2cfc7a84be423b94bf0c2c0e6780 100644 (file)
 'fwdfw toggle' => 'Aktivieren oder deaktivieren',
 'fwdfw togglelog' => 'Log aktivieren oder deaktivieren',
 'fwdfw use nat' => 'NAT benutzen',
-'fwdfw use srcport' => 'Quellport benutzen',
-'fwdfw use srv' => 'Zielport benutzen',
+'fwdfw use srcport' => 'Quellport(s) benutzen:',
+'fwdfw use srv' => 'Zielport(s) benutzen:',
 'fwdfw useless rule' => 'Diese Regel ist nicht sinnvoll.',
 'fwdfw wd_fri' => 'Fr',
 'fwdfw wd_mon' => 'Mo',
index 9eb9a832417cb43afa4225ff93fcf93f052791a1..4b4b153c82ab69d977b4bdb094ee3eb42d13e1fe 100644 (file)
 'fwdfw toggle' => 'Activate or deactivate',
 'fwdfw togglelog' => 'Activate or deactivate logging',
 'fwdfw use nat' => 'Use NAT',
-'fwdfw use srcport' => 'Use source port',
-'fwdfw use srv' => 'Use destination port',
+'fwdfw use srcport' => 'Use source port(s):',
+'fwdfw use srv' => 'Use destination port(s):',
 'fwdfw useless rule' => 'This rule is useless.',
 'fwdfw wd_fri' => 'Fri',
 'fwdfw wd_mon' => 'Mon',