From 5c4c1fe5deffe78bf375646e89688cbd2b5e345b Mon Sep 17 00:00:00 2001 From: Steve Beaver Date: Mon, 3 Oct 2016 09:29:32 -0400 Subject: Fixed #6835 by revising Javascript show/hide (cherry picked from commit 850c3d8b9352e7467beca8502c24ca8d4fbbbd29) --- src/usr/local/www/firewall_nat_out_edit.php | 32 ++++++++++++++++++++++++++--- src/usr/local/www/js/pfSenseHelpers.js | 10 +-------- 2 files changed, 30 insertions(+), 12 deletions(-) (limited to 'src') diff --git a/src/usr/local/www/firewall_nat_out_edit.php b/src/usr/local/www/firewall_nat_out_edit.php index 1fc3a62..e0e0e80 100644 --- a/src/usr/local/www/firewall_nat_out_edit.php +++ b/src/usr/local/www/firewall_nat_out_edit.php @@ -574,7 +574,7 @@ $section->addInput(new Form_IpAddress( 'targetip', 'Other subnet', $pconfig['targetip'] -))->addMask('targetip_subnet', $pconfig['targetip_subnet'])->addClass('othersubnet')->setHelp( +))->addMask('targetip_subnet', $pconfig['targetip_subnet'])->setHelp( 'Packets matching this rule will be mapped to the IP address given here.' . '
' . 'To apply this rule to a different IP address than the IP address of the interface chosen above, ' . 'select it here (' . @@ -603,6 +603,16 @@ $section->addInput(new Form_Select( '
  • ' . 'Sticky Address: The Sticky Address option can be used with the Random and Round Robin pool types to ensure that a particular source address is always mapped to the same translation address.' . '
  • ' . ''); +<<<<<<< HEAD +======= +$section->addInput(new Form_Input( + 'source_hash_key', + 'Source Hash Key', + 'text', + $pconfig['source_hash_key'] +))->setHelp('The key that is fed to the hashing algorithm in hex format, preceeded by "0x", or any string. A non-hex string is hashed using md5 to a hexadecimal key. Defaults to a randomly generated value.')->setWidth(10); + +>>>>>>> 850c3d8... Fixed #6835 by revising Javascript show/hide $group = new Form_Group('Port'); $group->addClass('natportgrp'); @@ -746,17 +756,33 @@ events.push(function() { function poolopts_change() { if ($('#target option:selected').text().trim().substring(0,4) == "Host") { hideInput('poolopts', false); - hideGroupClass('othersubnet', true); + hideInput('source_host_key', true); + hideIpAddress('targetip', true); } else if ($('#target option:selected').text().trim().substring(0,6) == "Subnet") { hideInput('poolopts', false); - hideGroupClass('othersubnet', true); + hideInput('source_host_key', true); + hideIpAddress('targetip', true); } else if ($('#target option:selected').text().trim().substring(0,5) == "Other") { hideInput('poolopts', false); +<<<<<<< HEAD hideGroupClass('othersubnet', false); } else { $('#poolopts').prop('selectedIndex',0); hideInput('poolopts', true); hideGroupClass('othersubnet', true); +======= + hideIpAddress('targetip', false); + if ($('#poolopts option:selected').text().trim().substring(0,6) == "Source") { + hideInput('source_hash_key', false); + }else { + hideInput('source_hash_key', true); + } + } else { + $('#poolopts').prop('selectedIndex',0); + hideInput('poolopts', true); + hideInput('source_host_key', true); + hideIpAddress('targetip', true); +>>>>>>> 850c3d8... Fixed #6835 by revising Javascript show/hide $('#targetip').val(''); $('#targetip_subnet').val('0'); } diff --git a/src/usr/local/www/js/pfSenseHelpers.js b/src/usr/local/www/js/pfSenseHelpers.js index 68b6899..6be2b68 100644 --- a/src/usr/local/www/js/pfSenseHelpers.js +++ b/src/usr/local/www/js/pfSenseHelpers.js @@ -90,14 +90,6 @@ function hideClass(s_class, hide) { $('.' + s_class).show(); } -// Hides all elements of the specified class assigned to a group. This will usually be a group -function hideGroupClass(s_class, hide) { - if (hide) - $('.' + s_class).parent().parent().parent().hide(); - else - $('.' + s_class).parent().parent().parent().show(); -} - function hideSelect(id, hide) { if (hide) $('#' + id).parent('div').parent('div').addClass('hidden'); @@ -112,7 +104,7 @@ function hideMultiCheckbox(id, hide) { $("[name=" + id + "]").parent().removeClass('hidden'); } -// Hides the
    in which the specified IP address element lives so that the input, its label and help text are hidden +// Hides the
    in which the specified IP address element lives so that the input, any mask selector, its label and help text are hidden function hideIpAddress(id, hide) { if (hide) $('#' + id).parent().parent().parent('div').addClass('hidden'); -- cgit v1.1