summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Beaver <sbeaver@netgate.com>2017-08-11 15:28:44 -0400
committerSteve Beaver <sbeaver@netgate.com>2017-08-11 15:30:45 -0400
commit8150bd51a7179da5d9aa1af49c44983b075bb962 (patch)
tree5a5361a966180b22e28ea435fb52ecb1c5c609f4
parenta0678b0bd89ef33a5ec272fd2a6544dc898938b8 (diff)
downloadpfsense-8150bd51a7179da5d9aa1af49c44983b075bb962.zip
pfsense-8150bd51a7179da5d9aa1af49c44983b075bb962.tar.gz
Fixed #7625
By: Separating the source and destination onChange functions Preventing the mask selector from being automatically updated if it is disabled Simplifying the auto mask JavaScript
-rw-r--r--src/usr/local/www/firewall_rules_edit.php17
-rw-r--r--src/usr/local/www/js/pfSense.js27
-rw-r--r--src/usr/local/www/widgets/widgets/system_information.widget.php2
3 files changed, 33 insertions, 13 deletions
diff --git a/src/usr/local/www/firewall_rules_edit.php b/src/usr/local/www/firewall_rules_edit.php
index 3a462c3..b30e3f3 100644
--- a/src/usr/local/www/firewall_rules_edit.php
+++ b/src/usr/local/www/firewall_rules_edit.php
@@ -329,7 +329,7 @@ if ($_POST['save']) {
if (!(is_string($_POST['type']) && in_array($_POST['type'], $valid))) {
$input_errors[] = gettext("A valid rule type is not selected.");
unset($_POST['type']);
- }
+ }
if (isset($_POST['tracker']) && !is_numericint($_POST['tracker'])) {
unset($_POST['tracker']); // silently unset hidden input if invalid
@@ -1865,10 +1865,16 @@ events.push(function() {
} else {
text = "<?=gettext('Display Advanced');?>";
}
+
$('#btnsrctoggle').html('<i class="fa fa-cog"></i> ' + text);
}
function typesel_change() {
+ src_typesel_change();
+ dst_typesel_change();
+ }
+
+ function src_typesel_change() {
if (editenabled) {
switch ($('#srctype').find(":selected").index()) {
case 1: // single
@@ -1887,6 +1893,11 @@ events.push(function() {
disableInput('srcmask', true);
break;
}
+ }
+ }
+
+ function dst_typesel_change() {
+ if (editenabled) {
switch ($('#dsttype').find(":selected").index()) {
case 1: // single
disableInput('dst', false);
@@ -2037,11 +2048,11 @@ events.push(function() {
});
$('#srctype').on('change', function() {
- typesel_change();
+ src_typesel_change();
});
$('#dsttype').on('change', function() {
- typesel_change();
+ dst_typesel_change();
});
$('#ipprotocol').on('change', function() {
diff --git a/src/usr/local/www/js/pfSense.js b/src/usr/local/www/js/pfSense.js
index 3070074..67dc654 100644
--- a/src/usr/local/www/js/pfSense.js
+++ b/src/usr/local/www/js/pfSense.js
@@ -119,21 +119,30 @@ $(function() {
input.on('change', function(e){
var isV6 = (input.val().indexOf(':') != -1), min = 0, max = 128;
+
if (!isV6)
max = 32;
- if (input.val() == "")
+ if (input.val() == "") {
return;
+ }
+
+ var attr = $(select).attr('disabled');
- // Eat all of the options with a value greater than max. We don't want them to be available
- while (select.options[0].value > max)
- select.remove(0);
+ // DOn't do anything if the mask selector is disabled
+ if (typeof attr === typeof undefined || attr === false) {
+ // Remove all options
+ $(select).find('option').remove().end();
+
+ // Then re-install the required ones
+ if (select.options.length < max) {
+ for (var i=select.options.length; i<=max; i++) {
+ select.options.add(new Option(i, i), 0);
+ }
- if (select.options.length < max) {
- for (var i=select.options.length; i<=max; i++)
- select.options.add(new Option(i, i), 0);
- // Make sure index 0 is selected otherwise it will stay in "32" for V6
- select.options.selectedIndex = "0";
+ // Make sure index 0 is selected otherwise it will stay in "32" for V6
+ select.options.selectedIndex = "0";
+ }
}
});
diff --git a/src/usr/local/www/widgets/widgets/system_information.widget.php b/src/usr/local/www/widgets/widgets/system_information.widget.php
index fd21790..26c9abb 100644
--- a/src/usr/local/www/widgets/widgets/system_information.widget.php
+++ b/src/usr/local/www/widgets/widgets/system_information.widget.php
@@ -51,7 +51,7 @@ $sysinfo_items = array(
'disk_usage' => gettext('Disk Usage')
);
-// Declared here so that JavaScript cann access it
+// Declared here so that JavaScript can access it
$updtext = sprintf(gettext("Obtaining update status %s"), "<i class='fa fa-cog fa-spin'></i>");
if ($_REQUEST['getupdatestatus']) {
OpenPOWER on IntegriCloud