diff --git a/html/cgi-bin/fwhosts.cgi b/html/cgi-bin/fwhosts.cgi index 73dabaadb..d7a519a37 100755 --- a/html/cgi-bin/fwhosts.cgi +++ b/html/cgi-bin/fwhosts.cgi @@ -80,6 +80,24 @@ unless (-e $configsrvgrp) { system("touch $configsrvgrp"); } &Header::openpage($Lang::tr{'fwhost hosts'}, 1, ''); &Header::openbigbox('100%', 'center'); +#### JAVA SCRIPT #### +print< + \$(document).ready(function() { + // Automatically select radio buttons when corresponding + // dropdown menu changes. + \$("select").change(function() { + var id = \$(this).attr("name"); + //When using SNAT or DNAT, check "USE NAT" Checkbox + if ( id === 'snat' || id === 'dnat') { + \$('#USE_NAT').prop('checked', true); + } + \$('#' + id).prop("checked", true); + }); + }); + +END + ## ACTION #### if ($fwhostsettings{'ACTION'} eq $Lang::tr{'fwdfw reread'}) { @@ -373,8 +391,7 @@ if ($fwhostsettings{'ACTION'} eq 'savenet' ) } &addnet; &viewtablenet; - }else - { + }else { &addnet; &viewtablenet; } @@ -1066,10 +1083,10 @@ sub showmenu &Header::openbox('100%', 'left',$Lang::tr{'fwhost menu'}); print "$Lang::tr{'fwhost welcome'}"; print< - - - + + + + END &Header::closebox(); @@ -1083,20 +1100,20 @@ sub addnet $fwhostsettings{'orgname'}=$fwhostsettings{'HOSTNAME'}; $fwhostsettings{'orgnetremark'}=$fwhostsettings{'NETREMARK'}; print< - $Lang::tr{'name'}: + + $Lang::tr{'name'}: $Lang::tr{'fwhost netaddress'}: $Lang::tr{'netmask'}: $Lang::tr{'remark'}: - + END if ($fwhostsettings{'ACTION'} eq 'editnet' || $fwhostsettings{'error'} eq 'on') { - print ""; + print ""; }else{ print ""; } - print ""; + print ""; &Header::closebox(); } sub addhost @@ -1107,11 +1124,11 @@ sub addhost $fwhostsettings{'orgname'}=$fwhostsettings{'HOSTNAME'}; $fwhostsettings{'orgremark'}=$fwhostsettings{'HOSTREMARK'}; print< - $Lang::tr{'name'}: + + $Lang::tr{'name'}: IP/MAC: $Lang::tr{'remark'}: - + END if ($fwhostsettings{'ACTION'} eq 'edithost' || $fwhostsettings{'error'} eq 'on') @@ -1119,9 +1136,9 @@ END print " "; }else{ - print " "; + print " "; } - print " "; + print " "; &Header::closebox(); } sub addgrp @@ -1147,8 +1164,8 @@ sub addgrp my $rem=$fwhostsettings{'remark'}; if ($fwhostsettings{'update'} eq ''){ print< - $Lang::tr{'fwhost addgrpname'} + + $Lang::tr{'fwhost addgrpname'} $Lang::tr{'remark'}: END @@ -1166,7 +1183,7 @@ END - $Lang::tr{'fwhost stdnet'} + $Lang::tr{'fwhost stdnet'} END foreach my $network (sort keys %defaultNetworks) { @@ -1186,14 +1203,14 @@ END } print""; if (! -z $confignet){ - print"$Lang::tr{'fwhost cust net'}"; + print"$Lang::tr{'fwhost cust net'}"; foreach my $key (sort { ncmp($customnetwork{$a}[0],$customnetwork{$b}[0]) } keys %customnetwork) { print"$customnetwork{$key}[0]"; } print""; } if (! -z $confighost){ - print"$Lang::tr{'fwhost cust addr'}"; + print"$Lang::tr{'fwhost cust addr'}"; foreach my $key (sort { ncmp($customhost{$a}[0],$customhost{$b}[0]) } keys %customhost) { print"$customhost{$key}[0]"; } @@ -1204,7 +1221,7 @@ END print""; #OVPN networks if (! -z $configccdnet){ - print"$Lang::tr{'fwhost ccdnet'}"; + print"$Lang::tr{'fwhost ccdnet'}"; foreach my $key (sort { ncmp($ccdnet{$a}[0],$ccdnet{$b}[0]) } keys %ccdnet) { print"$ccdnet{$key}[0]"; @@ -1224,7 +1241,7 @@ END #OVPN n2n networks foreach my $key (sort { ncmp($ccdhost{$a}[1],$ccdhost{$b}[1]) } keys %ccdhost) { if($ccdhost{$key}[3] eq 'net'){ - print"$Lang::tr{'fwhost ovpn_n2n'}" if ($show eq ''); + print"$Lang::tr{'fwhost ovpn_n2n'}" if ($show eq ''); $show='1'; print"$ccdhost{$key}[1]"; } @@ -1233,7 +1250,7 @@ END #IPsec networks foreach my $key (sort { ncmp($ipsecconf{$a}[0],$ipsecconf{$b}[0]) } keys %ipsecconf) { if ($ipsecconf{$key}[3] eq 'net'){ - print"$Lang::tr{'fwhost ipsec net'}" if ($show eq ''); + print"$Lang::tr{'fwhost ipsec net'}" if ($show eq ''); $show='1'; print"$ipsecconf{$key}[1]"; } @@ -1244,7 +1261,7 @@ END print"$Lang::tr{'fwhost attention'}: $Lang::tr{'fwhost macwarn'}"; } print""; - print""; + print""; &Header::closebox(); } sub addservice @@ -1370,7 +1387,7 @@ sub viewtablenet }else{ print< - $Lang::tr{'name'}$Lang::tr{'fwhost netaddress'}$Lang::tr{'remark'}$Lang::tr{'used'} + $Lang::tr{'name'}$Lang::tr{'fwhost netaddress'}$Lang::tr{'remark'}$Lang::tr{'used'} END } my $count=0; @@ -1385,7 +1402,7 @@ END print" "; } my $colnet="$customnetwork{$key}[1]/".&General::subtocidr($customnetwork{$key}[2]); - print"$customnetwork{$key}[0]".&Header::colorize($colnet)."$customnetwork{$key}[3]$customnetwork{$key}[4]x"; + print"$customnetwork{$key}[0]".&Header::colorize($colnet)."$customnetwork{$key}[3]$customnetwork{$key}[4]x"; print< @@ -1399,7 +1416,7 @@ END { print""; }else{ - print""; + print""; } $count++; } @@ -1419,7 +1436,7 @@ sub viewtablehost }else{ print< - $Lang::tr{'name'}$Lang::tr{'fwhost ip_mac'}$Lang::tr{'remark'}$Lang::tr{'used'} + $Lang::tr{'name'}$Lang::tr{'fwhost ip_mac'}$Lang::tr{'remark'}$Lang::tr{'used'} END } my $count=0; @@ -1430,15 +1447,15 @@ END else{ print" ";} my ($ip,$sub)=split(/\//,$customhost{$key}[2]); $customhost{$key}[4]=~s/\s+//g; - print"$customhost{$key}[0]".&Header::colorize($ip)."$customhost{$key}[3]$customhost{$key}[4]x"; + print"$customhost{$key}[0]".&Header::colorize($ip)."$customhost{$key}[3]$customhost{$key}[4]x"; print< + - + END if($customhost{$key}[4] == '0') { @@ -1490,8 +1507,8 @@ sub viewtablegrp if ($customgrp{$key}[2] eq "none"){$customgrp{$key}[2]=$Lang::tr{'fwhost empty'};} $grpname=$customgrp{$key}[0]; $remark="$customgrp{$key}[1]"; - if($count >=2){print"";} - print "$grpname    "; + if($count gt 2){ print"";} + print "$grpname "; print " $Lang::tr{'remark'}:  $remark   " if ($remark ne ''); print "$Lang::tr{'used'}: $customgrp{$key}[4]x"; if($customgrp{$key}[4] == '0') @@ -1548,7 +1565,7 @@ sub viewtableservice &General::readhasharray("$configsrv", \%customservice); print< - $Lang::tr{'fwhost srv_name'}$Lang::tr{'fwhost prot'}$Lang::tr{'fwhost port'}ICMP$Lang::tr{'fwhost used'} + $Lang::tr{'fwhost srv_name'}$Lang::tr{'fwhost prot'}$Lang::tr{'fwhost port'}ICMP$Lang::tr{'fwhost used'} END foreach my $key (sort { ncmp($customservice{$a}[0],$customservice{$b}[0])} keys %customservice) { @@ -1614,9 +1631,9 @@ sub viewtableservicegrp } $remark="$customservicegrp{$key}[1]"; if($count >=2){print"";} - print "$grpname     "; - print "$Lang::tr{'remark'}:  $remark " if ($remark ne ''); - print "  $Lang::tr{'used'}: $customservicegrp{$key}[3]x"; + print "$grpname "; + print "$Lang::tr{'remark'}: $remark " if ($remark ne ''); + print " $Lang::tr{'used'}: $customservicegrp{$key}[3]x"; if($customservicegrp{$key}[3] == '0') { print""; @@ -1676,7 +1693,6 @@ sub checkip } sub checksubnet { - my %hash=%{(shift)}; &General::readhasharray("$confignet", \%hash); foreach my $key (keys %hash) {