diff options
author | Erik Fonnesbeck <efonnes@gmail.com> | 2010-10-13 22:54:47 -0600 |
---|---|---|
committer | Erik Fonnesbeck <efonnes@gmail.com> | 2010-10-13 22:54:47 -0600 |
commit | 4b0c83c3ad71ee8c4c92a30e39239c64b0da4c2a (patch) | |
tree | 89816087d9af153e7f5265df62f89ac074e9a7f1 /usr | |
parent | f91060852cd28d14fa2cfa100c358e3c4a7fab2c (diff) | |
download | pfsense-4b0c83c3ad71ee8c4c92a30e39239c64b0da4c2a.zip pfsense-4b0c83c3ad71ee8c4c92a30e39239c64b0da4c2a.tar.gz |
Hide ports when protocol does not use ports. Ticket #953
Diffstat (limited to 'usr')
-rwxr-xr-x | usr/local/www/firewall_nat_out_edit.php | 35 |
1 files changed, 29 insertions, 6 deletions
diff --git a/usr/local/www/firewall_nat_out_edit.php b/usr/local/www/firewall_nat_out_edit.php index 97d50e1..fccb2e7 100755 --- a/usr/local/www/firewall_nat_out_edit.php +++ b/usr/local/www/firewall_nat_out_edit.php @@ -257,6 +257,7 @@ include("head.inc"); <script language="JavaScript"> <!-- +var portsenabled = 1; function staticportchange() { if(document.iform.staticnatport.checked) { document.iform.natport.value = ""; @@ -300,6 +301,27 @@ function nonat_change() { document.getElementById("transtable").style.display = ''; } } +function proto_change() { + if (document.iform.protocol.selectedIndex >= 0 && document.iform.protocol.selectedIndex <= 3) { + portsenabled = 1; + } else { + portsenabled = 0; + } + + if (portsenabled) { + document.getElementById("sport_tr").style.display = ''; + document.getElementById("dport_tr").style.display = ''; + document.getElementById("tport_tr").style.display = ''; + document.getElementById("tporttext_tr").style.display = ''; + document.getElementById("tportstatic_tr").style.display = ''; + } else { + document.getElementById("sport_tr").style.display = 'none'; + document.getElementById("dport_tr").style.display = 'none'; + document.getElementById("tport_tr").style.display = 'none'; + document.getElementById("tporttext_tr").style.display = 'none'; + document.getElementById("tportstatic_tr").style.display = 'none'; + } +} //--> </script> </head> @@ -362,7 +384,7 @@ function nonat_change() { <tr> <td width="22%" valign="top" class="vncellreq"><?=gettext("Protocol");?></td> <td width="78%" class="vtable"> - <select name="protocol" class="formselect"> + <select name="protocol" class="formselect" onChange="proto_change();"> <?php $protocols = explode(" ", "any TCP UDP TCP/UDP ICMP ESP AH GRE IGMP carp pfsync"); foreach ($protocols as $proto): ?> <option value="<?=strtolower($proto);?>" <?php if (strtolower($proto) == $pconfig['protocol']) echo "selected"; ?>><?=htmlspecialchars($proto);?></option> @@ -394,7 +416,7 @@ function nonat_change() { <td> </td> <td><span class="vexpl"><?=gettext("Enter the source network for the outbound NAT mapping.");?></span></td> </tr> - <tr> + <tr name="sport_tr" id="sport_tr"> <td><?=gettext("Source port:");?> </td> <td><input name="sourceport" type="text" class="formfld unknown" id="sourceport" size="5" value="<?=htmlspecialchars($pconfig['sourceport']);?>"> <?=gettext("(leave blank for any)");?></td> @@ -433,7 +455,7 @@ blank for any)");?></td> <td><span class="vexpl"><?=gettext("Enter the destination network for ". "the outbound NAT mapping.");?></span></td> </tr> - <tr> + <tr name="dport_tr" id="dport_tr"> <td><?=gettext("Destination port:");?> </td> <td><input name="dstport" type="text" class="formfld unknown" id="dstport" size="5" value="<?=htmlspecialchars($pconfig['dstport']);?>"> <?=gettext("(leave blank for any)");?></td> @@ -477,14 +499,14 @@ any)");?></td> <?=gettext("Also note that if you are trying to redirect connections on the LAN select the \"any\" option.");?> </span> </td></tr> - <tr> + <tr name="tport_tr" id="tport_tr"> <td><?=gettext("Port:");?> </td> <td><input name="natport" type="text" class="formfld unknown" id="natport" size="5" value="<?=htmlspecialchars($pconfig['natport']);?>"></td> </tr> - <tr><td> </td><td> + <tr name="tporttext_tr" id="tporttext_tr"><td> </td><td> <span class="vexpl"><?=gettext("Enter the source port for the outbound NAT mapping.");?></span> </td></tr> - <tr> + <tr name="tportstatic_tr" id="tportstatic_tr"> <td><?=gettext("Static-port:");?> </td> <td><input onChange="staticportchange();" name="staticnatport" type="checkbox" class="formfld" id="staticnatport" size="5"<?php if($pconfig['staticnatport']) echo " CHECKED";?>></td> </tr> @@ -522,6 +544,7 @@ sourcesel_change(); typesel_change(); staticportchange(); nonat_change(); +proto_change(); //--> </script> <?php include("fend.inc"); ?> |