From 36c9e5fc2dc1e4485984337e33d2c2c6f47890f6 Mon Sep 17 00:00:00 2001 From: Stephen Beaver Date: Fri, 11 Sep 2015 10:27:47 -0400 Subject: jQuery autocomplete added as required --- src/usr/local/www/firewall_aliases_edit.php | 17 +++- src/usr/local/www/firewall_nat_1to1_edit.php | 93 ++++++++++++---------- src/usr/local/www/firewall_nat_edit.php | 13 ++- src/usr/local/www/firewall_nat_out_edit.php | 11 +++ src/usr/local/www/firewall_rules_edit.php | 50 +++++++----- src/usr/local/www/load_balancer_pool_edit.php | 15 ++++ .../www/load_balancer_virtual_server_edit.php | 20 ++++- .../local/www/services_router_advertisements.php | 14 +++- src/usr/local/www/system_routes_edit.php | 33 +++++--- 9 files changed, 187 insertions(+), 79 deletions(-) (limited to 'src') diff --git a/src/usr/local/www/firewall_aliases_edit.php b/src/usr/local/www/firewall_aliases_edit.php index 8aecd17..9187b2a 100755 --- a/src/usr/local/www/firewall_aliases_edit.php +++ b/src/usr/local/www/firewall_aliases_edit.php @@ -878,6 +878,10 @@ events.push(function(){ }); setMasks(); + + $('[id^=address]').autocomplete({ + source: addressarray + }); } function typechange() { @@ -894,16 +898,23 @@ events.push(function(){ // Set the input field label by tab var labelstr = ; - $('.repeatable:first').find('label').text(labelstr[tab]); + $('.repeatable:first').find('label').text(labelstr[tab]); } - + // These are action buttons, not submit buttons $('[id^=addrow]').prop('type','button'); $('[id^=delete]').prop('type','button'); // On load . . typechange(); - + + // Autocomplete + var addressarray = ; + + $('[id^=address]').autocomplete({ + source: addressarray + }); + // on click . . $('[id^=addrow]').click(function() { add_row(); diff --git a/src/usr/local/www/firewall_nat_1to1_edit.php b/src/usr/local/www/firewall_nat_1to1_edit.php index d5b432b..2b8834f 100644 --- a/src/usr/local/www/firewall_nat_1to1_edit.php +++ b/src/usr/local/www/firewall_nat_1to1_edit.php @@ -4,55 +4,55 @@ firewall_nat_1to1_edit.php */ /* ==================================================================== - * Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved. - * Copyright (c) 2003-2004 Manuel Kasper + * Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved. + * Copyright (c) 2003-2004 Manuel Kasper * part of m0n0wall (http://m0n0.ch/wall) * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: + * Redistribution and use in source and binary forms, with or without modification, + * are permitted provided that the following conditions are met: * - * 1. Redistributions of source code must retain the above copyright notice, - * this list of conditions and the following disclaimer. + * 1. Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. * - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in - * the documentation and/or other materials provided with the - * distribution. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in + * the documentation and/or other materials provided with the + * distribution. * - * 3. All advertising materials mentioning features or use of this software - * must display the following acknowledgment: - * "This product includes software developed by the pfSense Project - * for use in the pfSense software distribution. (http://www.pfsense.org/). + * 3. All advertising materials mentioning features or use of this software + * must display the following acknowledgment: + * "This product includes software developed by the pfSense Project + * for use in the pfSense software distribution. (http://www.pfsense.org/). * - * 4. The names "pfSense" and "pfSense Project" must not be used to - * endorse or promote products derived from this software without - * prior written permission. For written permission, please contact - * coreteam@pfsense.org. + * 4. The names "pfSense" and "pfSense Project" must not be used to + * endorse or promote products derived from this software without + * prior written permission. For written permission, please contact + * coreteam@pfsense.org. * - * 5. Products derived from this software may not be called "pfSense" - * nor may "pfSense" appear in their names without prior written - * permission of the Electric Sheep Fencing, LLC. + * 5. Products derived from this software may not be called "pfSense" + * nor may "pfSense" appear in their names without prior written + * permission of the Electric Sheep Fencing, LLC. * - * 6. Redistributions of any form whatsoever must retain the following - * acknowledgment: + * 6. Redistributions of any form whatsoever must retain the following + * acknowledgment: * - * "This product includes software developed by the pfSense Project - * for use in the pfSense software distribution (http://www.pfsense.org/). + * "This product includes software developed by the pfSense Project + * for use in the pfSense software distribution (http://www.pfsense.org/). * - * THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY - * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR - * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, - * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) - * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED - * OF THE POSSIBILITY OF SUCH DAMAGE. + * THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY + * EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR + * ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, + * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, + * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED + * OF THE POSSIBILITY OF SUCH DAMAGE. * - * ==================================================================== + * ==================================================================== * */ /* @@ -135,8 +135,8 @@ if ($_POST) { unset($input_errors); $pconfig = $_POST; - /* run through $_POST items encoding HTML entities so that the user - * cannot think he is slick and perform a XSS attack on the unwilling + /* run through $_POST items encoding HTML entities so that the user + * cannot think he is slick and perform a XSS attack on the unwilling */ foreach ($_POST as $key => $value) { $temp = str_replace(">", "", $value); @@ -303,9 +303,9 @@ function build_srctype_list() { function srctype_selected() { global $pconfig; - + $sel = is_specialnet($pconfig['src']); - + if (!$sel) { if (($pconfig['srcmask'] == 32) || (!isset($pconfig['srcmask']))) return('single'); @@ -369,7 +369,7 @@ function dsttype_selected() { if (empty($pconfig['dst'] || $pconfig['dst'] == "any")) return('any'); - + if (!$sel) { if ($pconfig['dstmask'] == 32) return('single'); @@ -574,6 +574,13 @@ events.push(function(){ // Initial page load typesel_change(); + + // --------- Autocomplete ----------------------------------------------------------------------------------------- + var addressarray = ; + + $('#dst').autocomplete({ + source: addressarray + }); }); //]]> diff --git a/src/usr/local/www/firewall_nat_edit.php b/src/usr/local/www/firewall_nat_edit.php index ae76679..633380e 100644 --- a/src/usr/local/www/firewall_nat_edit.php +++ b/src/usr/local/www/firewall_nat_edit.php @@ -1249,7 +1249,18 @@ events.push(function(){ typesel_change(); proto_change(); nordr_change(); - + + // --------- Autocomplete ----------------------------------------------------------------------------------------- + var addressarray = ; + var customarray = ; + + $('#localip, #ser, #dst').autocomplete({ + source: addressarray + }); + + $('#dstbeginport_cust, #dstendport_cust, #srcbeginport_cust, #srcendport_cust, localbeginport_cust').autocomplete({ + source: customarray + }); }); //]]> diff --git a/src/usr/local/www/firewall_nat_out_edit.php b/src/usr/local/www/firewall_nat_out_edit.php index 222ad52..d7e8309 100644 --- a/src/usr/local/www/firewall_nat_out_edit.php +++ b/src/usr/local/www/firewall_nat_out_edit.php @@ -844,6 +844,17 @@ events.push(function(){ proto_change(); poolopts_change(); + // --------- Autocomplete ----------------------------------------------------------------------------------------- + var addressarray = ; + var customarray = ; + + $('#localip, #source').autocomplete({ + source: addressarray + }); + + $('#dstbeginport_cust, #sourceport, #destination, #dstport').autocomplete({ + source: customarray + }); }); //]]> diff --git a/src/usr/local/www/firewall_rules_edit.php b/src/usr/local/www/firewall_rules_edit.php index a3dee0c..306fb36 100644 --- a/src/usr/local/www/firewall_rules_edit.php +++ b/src/usr/local/www/firewall_rules_edit.php @@ -86,16 +86,16 @@ function is_aoadv_used($rule_config) { // Note that the user could set "tag" or "tagged" to the string "0", which is valid but empty(). // And if the user enters "0" in other fields, we want to present an error message, and keep the Advanced Options section open. if ((isset($rule_config['allowopts'])) || - (isset($rule_config['disablereplyto'])) || - ($rule_config['tag'] != "") || - ($rule_config['tagged'] != "") || - ($rule_config['max'] != "") || - ($rule_config['max-src-nodes'] != "") || - ($rule_config['max-src-conn'] != "") || - ($rule_config['max-src-states'] != "") || - ($rule_config['max-src-conn-rate'] != "") || - ($rule_config['max-src-conn-rates'] != "") || - ($rule_config['statetimeout'] != "")) { + (isset($rule_config['disablereplyto'])) || + ($rule_config['tag'] != "") || + ($rule_config['tagged'] != "") || + ($rule_config['max'] != "") || + ($rule_config['max-src-nodes'] != "") || + ($rule_config['max-src-conn'] != "") || + ($rule_config['max-src-states'] != "") || + ($rule_config['max-src-conn-rate'] != "") || + ($rule_config['max-src-conn-rates'] != "") || + ($rule_config['statetimeout'] != "")) { return true; } return false; @@ -450,12 +450,12 @@ if ($_POST) { } if (isset($a_filter[$id]['associated-rule-id']) === false && - (!(is_specialnet($_POST['srctype']) || ($_POST['srctype'] == "single")))) { + (!(is_specialnet($_POST['srctype']) || ($_POST['srctype'] == "single")))) { $reqdfields[] = "srcmask"; $reqdfieldsn[] = "Source bit count"; } if (isset($a_filter[$id]['associated-rule-id']) === false && - (!(is_specialnet($_POST['dsttype']) || ($_POST['dsttype'] == "single")))) { + (!(is_specialnet($_POST['dsttype']) || ($_POST['dsttype'] == "single")))) { $reqdfields[] = "dstmask"; $reqdfieldsn[] = gettext("Destination bit count"); } @@ -493,7 +493,7 @@ if ($_POST) { $input_errors[] = 'The same port alias must be used in Source port range from: and to: fields'; } if ((is_alias($_POST['srcbeginport_cust']) && (!is_alias($_POST['srcendport_cust']) && $_POST['srcendport_cust'] != '')) || - ((!is_alias($_POST['srcbeginport_cust']) && $_POST['srcbeginport_cust'] != '') && is_alias($_POST['srcendport_cust']))) { + ((!is_alias($_POST['srcbeginport_cust']) && $_POST['srcbeginport_cust'] != '') && is_alias($_POST['srcendport_cust']))) { $input_errors[] = 'You cannot specify numbers and port aliases at the same time in Source port range from: and to: field'; } } @@ -507,7 +507,7 @@ if ($_POST) { $input_errors[] = 'The same port alias must be used in Destination port range from: and to: fields'; } if ((is_alias($_POST['dstbeginport_cust']) && (!is_alias($_POST['dstendport_cust']) && $_POST['dstendport_cust'] != '')) || - ((!is_alias($_POST['dstbeginport_cust']) && $_POST['dstbeginport_cust'] != '') && is_alias($_POST['dstendport_cust']))) { + ((!is_alias($_POST['dstbeginport_cust']) && $_POST['dstbeginport_cust'] != '') && is_alias($_POST['dstendport_cust']))) { $input_errors[] = 'You cannot specify numbers and port aliases at the same time in Destination port range from: and to: field'; } } @@ -702,7 +702,7 @@ if ($_POST) { } if ((($_POST['max-src-conn-rate'] <> "" and $_POST['max-src-conn-rates'] == "")) || - (($_POST['max-src-conn-rate'] == "" and $_POST['max-src-conn-rates'] <> ""))) { + (($_POST['max-src-conn-rate'] == "" and $_POST['max-src-conn-rates'] <> ""))) { $input_errors[] = gettext("Both maximum new connections per host and the interval (per second(s)) must be specified"); } @@ -1245,8 +1245,8 @@ foreach (['src' => 'Source', 'dst' => 'Destination'] as $type => $name) { if (is_specialnet($pconfig[$type])) $ruleType = 'network'; elseif ((is_ipaddrv6($pconfig[$type]) && $pconfig[$type.'mask'] == 128) || - (is_ipaddrv4($pconfig[$type]) && $pconfig[$type.'mask'] == 32) || - (is_alias($pconfig[$type]))) + (is_ipaddrv4($pconfig[$type]) && $pconfig[$type.'mask'] == 32) || + (is_alias($pconfig[$type]))) $ruleType = 'single'; $ruleValues = array( @@ -1877,11 +1877,11 @@ events.push(function(){ hideClass('advanced-options', true); hideClass('srcportrange', true); - + show_source_port_range(); - + // Make it a regular button, not a submit $('#toggle-advanced').prop('type','button'); $("#btnsrcadv").prop('type','button'); @@ -1969,6 +1969,18 @@ events.push(function(){ // At page load . . setOptText('statetype', $('#statetype').val()) + + // --------- Autocomplete ----------------------------------------------------------------------------------------- + var addressarray = ; + var customarray = ; + + $('#src, #dst').autocomplete({ + source: addressarray + }); + + $('#dstbeginport_cust, #dstendport_cust, #srcbeginport_cust, #srcendport_cust').autocomplete({ + source: customarray + }); }); //]]> diff --git a/src/usr/local/www/load_balancer_pool_edit.php b/src/usr/local/www/load_balancer_pool_edit.php index 66f7acf..95dbfee 100644 --- a/src/usr/local/www/load_balancer_pool_edit.php +++ b/src/usr/local/www/load_balancer_pool_edit.php @@ -448,5 +448,20 @@ if (isset($id) && $a_pool[$id] && $_GET['act'] != 'dup') { $form->add($section); print($form); +?> + + +add($section); print($form); print_info_box(gettext('Don\'t forget to add a firewall rule for the virtual server/pool after you have finished setting it up.')); - +?> + +add($section); $section = new Form_Section('DNS Configuration'); -for($idx=0; $idx<4; $idx++) { +for($idx=1; $idx=<4; $idx++) { $section->addInput(new Form_IpAddress( 'radns' . $idx, - 'Server ' . ($idx + 1), + 'Server ' . $idx, $pconfig['radns' . $idx] - ))->setHelp($idx < 3 ? '':'Leave blank to use the system default DNS servers - this interface\'s IP if DNS Forwarder or Resolver is enabled, otherwise the servers configured on the General page'); + ))->setHelp(($idx < 4) ? '':'Leave blank to use the system default DNS servers - this interface\'s IP if DNS Forwarder or Resolver is enabled, otherwise the servers configured on the General page'); } $section->addInput(new Form_Input( @@ -571,6 +571,14 @@ events.push(function(){ else alert(''); }); + + // --------- Autocomplete ----------------------------------------------------------------------------------------- + var addressarray = ; + + $('#radns1, #radns2, #radns3, #radns4').autocomplete({ + source: addressarray + }); + }); //]]> diff --git a/src/usr/local/www/system_routes_edit.php b/src/usr/local/www/system_routes_edit.php index 9c7b294..74b55a1 100644 --- a/src/usr/local/www/system_routes_edit.php +++ b/src/usr/local/www/system_routes_edit.php @@ -30,7 +30,7 @@ POSSIBILITY OF SUCH DAMAGE. */ /* - pfSense_MODULE: routing + pfSense_MODULE: routing */ ##|+PRIV @@ -176,16 +176,16 @@ if ($_POST) { if (is_array($config['interfaces'])) { foreach ($config['interfaces'] as $if) { if (is_ipaddrv4($_POST['network']) && - isset($if['ipaddr']) && isset($if['subnet']) && - is_ipaddrv4($if['ipaddr']) && is_numeric($if['subnet']) && - ($_POST['network_subnet'] == $if['subnet']) && - (gen_subnet($_POST['network'], $_POST['network_subnet']) == gen_subnet($if['ipaddr'], $if['subnet']))) { + isset($if['ipaddr']) && isset($if['subnet']) && + is_ipaddrv4($if['ipaddr']) && is_numeric($if['subnet']) && + ($_POST['network_subnet'] == $if['subnet']) && + (gen_subnet($_POST['network'], $_POST['network_subnet']) == gen_subnet($if['ipaddr'], $if['subnet']))) { $input_errors[] = sprintf(gettext("This network conflicts with address configured on interface %s."), $if['descr']); } else if (is_ipaddrv6($_POST['network']) && - isset($if['ipaddrv6']) && isset($if['subnetv6']) && - is_ipaddrv6($if['ipaddrv6']) && is_numeric($if['subnetv6']) && - ($_POST['network_subnet'] == $if['subnetv6']) && - (gen_subnetv6($_POST['network'], $_POST['network_subnet']) == gen_subnetv6($if['ipaddrv6'], $if['subnetv6']))) { + isset($if['ipaddrv6']) && isset($if['subnetv6']) && + is_ipaddrv6($if['ipaddrv6']) && is_numeric($if['subnetv6']) && + ($_POST['network_subnet'] == $if['subnetv6']) && + (gen_subnetv6($_POST['network'], $_POST['network_subnet']) == gen_subnetv6($if['ipaddrv6'], $if['subnetv6']))) { $input_errors[] = sprintf(gettext("This network conflicts with address configured on interface %s."), $if['descr']); } } @@ -289,4 +289,19 @@ $form->add($section); print $form; +?> + +