summaryrefslogtreecommitdiffstats
path: root/src/usr/local/www/firewall_nat_out.php
diff options
context:
space:
mode:
authorStephen Beaver <sbeaver@netgate.com>2015-09-14 12:56:31 -0400
committerStephen Beaver <sbeaver@netgate.com>2015-09-15 08:48:56 -0400
commitf185aaacee31428358349d6e68f1321ab1983df1 (patch)
treee880d6f9dd4ecdd6664416115bae379fe071f418 /src/usr/local/www/firewall_nat_out.php
parent7c540a5ccc8d11a6317f2e10e65c2808937c19f2 (diff)
downloadpfsense-f185aaacee31428358349d6e68f1321ab1983df1.zip
pfsense-f185aaacee31428358349d6e68f1321ab1983df1.tar.gz
Partial fix #5014 Double-click to edit, single click to select, multiple delete functionality provided
Diffstat (limited to 'src/usr/local/www/firewall_nat_out.php')
-rw-r--r--src/usr/local/www/firewall_nat_out.php130
1 files changed, 81 insertions, 49 deletions
diff --git a/src/usr/local/www/firewall_nat_out.php b/src/usr/local/www/firewall_nat_out.php
index d1c97b5..ce4ad68 100644
--- a/src/usr/local/www/firewall_nat_out.php
+++ b/src/usr/local/www/firewall_nat_out.php
@@ -4,56 +4,56 @@
firewall_nat_out.php
*/
/* ====================================================================
- * Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
- * Copyright (c) 2004 Scott Ullrich
- * Copyright (c) 2003-2004 Manuel Kasper <mk@neon1.net>
+ * Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved.
+ * Copyright (c) 2004 Scott Ullrich
+ * Copyright (c) 2003-2004 Manuel Kasper <mk@neon1.net>
* Originally part of pfSense (https://www.pfsense.org)
*
- * 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.
*
- * ====================================================================
+ * ====================================================================
*
*/
/*
@@ -94,10 +94,10 @@ if (is_array($_POST['rule']) && !empty($_POST['rule'])) {
$a_out_new[] = $a_out[$id];
$a_out = $a_out_new;
-
+
if (write_config())
mark_subsystem_dirty('filter');
-
+
header("Location: firewall_nat_out.php");
exit;
}
@@ -152,10 +152,10 @@ if (isset($_POST['save']) && $_POST['save'] == "Save") {
$found = false;
foreach ($a_out as $rule) {
if ($rule['interface'] == $natent['interface'] &&
- $rule['source']['network'] == $natent['source']['network'] &&
- $rule['dstport'] == $natent['dstport'] &&
- $rule['target'] == $natent['target'] &&
- $rule['descr'] == $natent['descr']) {
+ $rule['source']['network'] == $natent['source']['network'] &&
+ $rule['dstport'] == $natent['dstport'] &&
+ $rule['target'] == $natent['target'] &&
+ $rule['descr'] == $natent['descr']) {
$found = true;
break;
}
@@ -387,6 +387,7 @@ print($form);
<table class="table table-striped table-hover table-condensed">
<thead>
<tr>
+ <th><!-- checkbox --></th>
<th><!-- status --></th>
<th><?=gettext("Interface")?></th>
<th><?=gettext("Source")?></th>
@@ -417,7 +418,12 @@ print($form);
pprint_port($natent['destination']['port'])
);
?>
- <tr id="fr<?=$i?>">
+
+ <tr id="fr<?=$nnats;?>" onClick="fr_toggle(<?=$i;?>)" ondblclick="document.location='firewall_nat_edit.php?id=<?=$i;?>';">
+ <td >
+ <input type="checkbox" id="frc<?=$i;?>" onClick="fr_toggle(<?=$i;?>)" name="rule[]" value="<?=$i;?>"/>
+ </td>
+
<td>
<?php
if ($mode == "disabled" || $mode == "automatic"):
@@ -467,7 +473,7 @@ print($form);
if (!$natent['sourceport']) {
echo "*";
} else {
-
+
if (isset($alias['srcport'])):
?>
<a href="/firewall_aliases_edit.php?id=<?=$alias['srcport']?>" data-toggle="popover" data-trigger="hover focus" title="Alias details" data-content="<?=alias_info_popup($alias['srcport'])?>" data-html="true">
@@ -492,7 +498,7 @@ print($form);
} else {
if (isset($natent['destination']['not']))
echo "!&nbsp;";
-
+
if (isset($alias['dst'])):
?>
@@ -506,7 +512,7 @@ print($form);
?>
<i class='icon icon-pencil'></i></a>
<?php
- endif;
+ endif;
}
?>
</td>
@@ -589,6 +595,7 @@ print($form);
<nav class="action-buttons">
<a href="firewall_nat_out_edit.php?after=-1" class="btn btn-sm btn-success" title="<?=gettext('Add new mapping')?>"><?=gettext('Add new mapping')?></a>&nbsp;
+ <input name="del_x" type="submit" class="btn btn-danger btn-sm" value="<?=gettext("Delete selected rules"); ?>" />
<input type="submit" id="order-store" class="btn btn-primary btn-sm" value="store changes" disabled="disabled" />
</nav>
@@ -722,6 +729,31 @@ endif;
</div>
<script>
+function fr_toggle(id, prefix) {
+ if (!prefix)
+ prefix = 'fr';
+
+ var checkbox = document.getElementById(prefix + 'c' + id);
+ checkbox.checked = !checkbox.checked;
+ fr_bgcolor(id, prefix);
+}
+
+function fr_bgcolor(id, prefix) {
+ if (!prefix)
+ prefix = 'fr';
+
+ var row = document.getElementById(prefix + id);
+ var checkbox = document.getElementById(prefix + 'c' + id);
+ var cells = row.getElementsByTagName('td');
+ var cellcnt = cells.length;
+
+ for (i = 0; i < cellcnt-1; i++) {
+ cells[i].style.backgroundColor = checkbox.checked ? "#DDF4FF" : "#FFFFFF";
+ }
+}
+</script>
+
+<script>
events.push(function() {
// Make rules draggable/sortable
$('table tbody.user-entries').sortable({
OpenPOWER on IntegriCloud