diff options
author | Stephen Beaver <sbeaver@netgate.com> | 2015-09-14 12:34:09 -0400 |
---|---|---|
committer | Stephen Beaver <sbeaver@netgate.com> | 2015-09-15 08:48:56 -0400 |
commit | 7c540a5ccc8d11a6317f2e10e65c2808937c19f2 (patch) | |
tree | 8d87c1a89e00d51fef1e534ea309b799d0529e58 /src/usr | |
parent | c7cb4071ffb72210600302acb157a77ca675f631 (diff) | |
download | pfsense-7c540a5ccc8d11a6317f2e10e65c2808937c19f2.zip pfsense-7c540a5ccc8d11a6317f2e10e65c2808937c19f2.tar.gz |
Partial fix #5014
Double-click to edit, single click to select, multiple delete functionality provided
Diffstat (limited to 'src/usr')
-rw-r--r-- | src/usr/local/www/firewall_nat.php | 112 | ||||
-rw-r--r-- | src/usr/local/www/jquery/pfSense.js | 15 |
2 files changed, 81 insertions, 46 deletions
diff --git a/src/usr/local/www/firewall_nat.php b/src/usr/local/www/firewall_nat.php index 82b5774..df6bef5 100644 --- a/src/usr/local/www/firewall_nat.php +++ b/src/usr/local/www/firewall_nat.php @@ -4,56 +4,56 @@ firewall_nat.php */ /* ==================================================================== - * Copyright (c) 2004-2015 Electric Sheep Fencing, LLC. All rights reserved. - * Copyright (c) 2004 Scott Ullrich + * 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 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. * - * ==================================================================== + * ==================================================================== * */ /* @@ -239,6 +239,7 @@ display_top_tabs($tab_array); <table class="table table-striped table-hover table-condensed"> <thead> <tr> + <th><!-- Checkbox --></th> <th><!-- Rule type --></th> <th><?=gettext("If")?></th> <th><?=gettext("Proto")?></th> @@ -270,8 +271,11 @@ foreach ($a_nat as $natent): if (!have_natpfruleint_access($natent['interface'])) continue; ?> - - <tr id="fr<?=$nnats?>"> + + <tr id="fr<?=$nnats;?>" onClick="fr_toggle(<?=$nnats;?>)" ondblclick="document.location='firewall_nat_edit.php?id=<?=$i;?>';"> + <td > + <input type="checkbox" id="frc<?=$nnats;?>" onClick="fr_toggle(<?=$nnats;?>)" name="rule[]" value="<?=$i;?>"/> + </td> <td> <?php if ($natent['associated-rule-id'] == "pass"): @@ -411,11 +415,37 @@ endforeach; <div class="pull-right"> <a href="firewall_nat_edit.php?after=-1" class="btn btn-sm btn-success" title="<?=gettext('Add new rule')?>"><?=gettext('Add new rule')?></a> - <input type="submit" id="order-store" class="btn btn-primary btn-sm" value="store changes" disabled="disabled" /> + <input name="del" 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="<?=gettext("Save changes")?>" disabled="disabled" /> </div> </form> <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({ diff --git a/src/usr/local/www/jquery/pfSense.js b/src/usr/local/www/jquery/pfSense.js index d1c9f65..6f8642f 100644 --- a/src/usr/local/www/jquery/pfSense.js +++ b/src/usr/local/www/jquery/pfSense.js @@ -51,8 +51,7 @@ $(function() { var group = $(this).parents('div.form-group'); var clone = group.clone(true); - clone.find('*').val(''); //removeAttr('value'); -// clone.find('*').removeAttr('value'); + clone.find('*').val(''); clone.appendTo(group.parent()); }); @@ -81,8 +80,7 @@ $(function() { var group = $(this).parents('div.form-group'); var clone = group.clone(true); - clone.find('*').removeAttr('value'); -// clone.find('*').val(''); + clone.find('*').removeAttr('value'); clone.appendTo(group.parent()); }); @@ -122,8 +120,15 @@ $(function() { }); // Add confirm to all btn-danger buttons + // Use element title in the confirmation message, or if not available + // the element value $('.btn-danger').on('click', function(e){ - var q = 'Are you sure you wish to '+ $.trim(this.textContent) +'?'; + var msg = $.trim(this.textContent); + + if(!msg) + var msg = $.trim(this.value); + + var q = 'Are you sure you wish to '+ msg +'?'; if ($(this).attr('title') != undefined) q = $(this).attr('title')+'?'; |