summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPhil Davis <phil.davis@inf.org>2016-03-17 04:40:17 +0545
committerPhil Davis <phil.davis@inf.org>2016-03-17 04:40:17 +0545
commit770e3f4c3090c097a91785479282d465910e82e8 (patch)
treeef60ce855bbddf680952f852bf9e26ed96a8e1b5 /src
parenta6caf5f5838b013a9fa58eb9cb5b192d377ab660 (diff)
downloadpfsense-770e3f4c3090c097a91785479282d465910e82e8.zip
pfsense-770e3f4c3090c097a91785479282d465910e82e8.tar.gz
Redmine #5994 Standardize source port button
in firewall_rules_edit 1) Put some common code fragments into show_source_port_range() and use code that actually successfully changes the button text Display/Hide. Around line 1808. 2) Make the button itself be hidden when a protocol is selected that does not use source port range (as well as the source port fields being hidden) - line 1908-1909 3) When the user re-selects a protocol that can use source port range, unhide the button and set the button text and hide/unhide of source port fields appropriately depending on the run-time values in the source port fields - line 1900-1905 This standardizes the behavior of the source port Advanced button. I will do the other general advanced button separately.
Diffstat (limited to 'src')
-rw-r--r--src/usr/local/www/firewall_rules_edit.php28
1 files changed, 19 insertions, 9 deletions
diff --git a/src/usr/local/www/firewall_rules_edit.php b/src/usr/local/www/firewall_rules_edit.php
index b61b41e..e7e7717 100644
--- a/src/usr/local/www/firewall_rules_edit.php
+++ b/src/usr/local/www/firewall_rules_edit.php
@@ -1363,7 +1363,7 @@ foreach (['src' => 'Source', 'dst' => 'Destination'] as $type => $name) {
if ($type == 'src') {
$section->addInput(new Form_Button(
'btnsrcadv',
- 'Show advanced',
+ 'Display Advanced',
null,
'fa-cog'
))->addClass('btn-info');
@@ -1744,7 +1744,7 @@ events.push(function() {
var portsenabled = 1;
var editenabled = 1;
var optionsvisible = 0;
- var srcportsvisible = 0;
+ var srcportsvisible = false;
function ext_change() {
@@ -1805,6 +1805,13 @@ events.push(function() {
function show_source_port_range() {
hideClass('srcprtr', !srcportsvisible);
+
+ if (srcportsvisible) {
+ text = "<?=gettext('Hide Advanced');?>";
+ } else {
+ text = "<?=gettext('Display Advanced');?>";
+ }
+ $('#btnsrcadv').html('<i class="fa fa-cog"></i> ' + text);
}
function typesel_change() {
@@ -1890,14 +1897,19 @@ events.push(function() {
if ($('#proto').find(":selected").index() <= 2) {
hideClass('dstprtr', false);
- hideClass('srcprtr', !srcportsvisible);
- $("#btnsrcadv").prop('value', srcportsvisible ? 'Hide advanced':'Show advanced');
+ hideInput('btnsrcadv', false);
+ if (($('#srcbeginport').val() == "any") && ($('#srcendport').val() == "any")) {
+ srcportsvisible = false;
+ } else {
+ srcportsvisible = true;
+ }
} else {
- hideClass('srcprtr', true);
hideClass('dstprtr', true);
- srcportsvisible = 0;
- $("#btnsrcadv").prop('value', srcportsvisible ? 'Hide advanced':'Show advanced');
+ hideInput('btnsrcadv', true);
+ srcportsvisible = false;
}
+
+ show_source_port_range();
}
function src_rep_change() {
@@ -1921,7 +1933,6 @@ events.push(function() {
<?php if ((!empty($pconfig['srcbeginport']) && $pconfig['srcbeginport'] != "any") || (!empty($pconfig['srcendport']) && $pconfig['srcendport'] != "any")): ?>
srcportsvisible = true;
show_source_port_range();
- hideInput('btnsrcadv', true);
<?php endif; ?>
// Make it a regular button, not a submit
@@ -1937,7 +1948,6 @@ events.push(function() {
$('#btnsrcadv').click(function() {
srcportsvisible = !srcportsvisible;
show_source_port_range();
- $("#btnsrcadv").prop('value', srcportsvisible ? 'Hide advanced':'Show advanced');
});
$('#srcendport').on('change', function() {
OpenPOWER on IntegriCloud