Commit 622e8dba authored by Ad Schellevis's avatar Ad Schellevis

firewall / add select all, for https://github.com/opnsense/core/issues/1514

parent 07f5033b
...@@ -216,6 +216,11 @@ $( document ).ready(function() { ...@@ -216,6 +216,11 @@ $( document ).ready(function() {
$("#iform").submit(); $("#iform").submit();
}); });
// select All
$("#selectAll").click(function(){
$(".rule_select").prop("checked", $(this).prop("checked"));
});
// watch scroll position and set to last known on page load // watch scroll position and set to last known on page load
watchScrollPosition(); watchScrollPosition();
}); });
...@@ -245,7 +250,7 @@ $( document ).ready(function() { ...@@ -245,7 +250,7 @@ $( document ).ready(function() {
<td colspan="2"> </td> <td colspan="2"> </td>
</tr> </tr>
<tr> <tr>
<th width="2%">&nbsp;</th> <th width="2%"><input type="checkbox" id="selectAll"></th>
<th width="2%">&nbsp;</th> <th width="2%">&nbsp;</th>
<th width="2%">&nbsp;</th> <th width="2%">&nbsp;</th>
<th><?=gettext("If");?></th> <th><?=gettext("If");?></th>
...@@ -293,7 +298,7 @@ $( document ).ready(function() { ...@@ -293,7 +298,7 @@ $( document ).ready(function() {
?> ?>
<tr <?=isset($natent['disabled'])?"class=\"text-muted\"":"";?> ondblclick="document.location='firewall_nat_edit.php?id=<?=$nnats;?>';"> <tr <?=isset($natent['disabled'])?"class=\"text-muted\"":"";?> ondblclick="document.location='firewall_nat_edit.php?id=<?=$nnats;?>';">
<td> <td>
<input type="checkbox" name="rule[]" value="<?=$nnats;?>" /> <input class="rule_select" type="checkbox" name="rule[]" value="<?=$nnats;?>" />
</td> </td>
<td> <td>
<?php if (isset($natent['nordr'])): ?> <?php if (isset($natent['nordr'])): ?>
......
...@@ -165,9 +165,13 @@ $main_buttons = array( ...@@ -165,9 +165,13 @@ $main_buttons = array(
$("#action").val("toggle"); $("#action").val("toggle");
$("#iform").submit(); $("#iform").submit();
}); });
// select All
$("#selectAll").click(function(){
$(".rule_select").prop("checked", $(this).prop("checked"));
});
// watch scroll position and set to last known on page load // watch scroll position and set to last known on page load
watchScrollPosition(); watchScrollPosition();
}); });
</script> </script>
...@@ -193,7 +197,7 @@ $main_buttons = array( ...@@ -193,7 +197,7 @@ $main_buttons = array(
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr> <tr>
<th>&nbsp;</th> <th><input type="checkbox" id="selectAll"></th>
<th>&nbsp;</th> <th>&nbsp;</th>
<th><?=gettext("Interface"); ?></th> <th><?=gettext("Interface"); ?></th>
<th><?=gettext("External IP"); ?></th> <th><?=gettext("External IP"); ?></th>
...@@ -210,7 +214,7 @@ $main_buttons = array( ...@@ -210,7 +214,7 @@ $main_buttons = array(
?> ?>
<tr <?=isset($natent['disabled'])?"class=\"text-muted\"":"";?> valign="top" ondblclick="document.location='firewall_nat_1to1_edit.php?id=<?=$i;?>';"> <tr <?=isset($natent['disabled'])?"class=\"text-muted\"":"";?> valign="top" ondblclick="document.location='firewall_nat_1to1_edit.php?id=<?=$i;?>';">
<td> <td>
<input type="checkbox" name="rule[]" value="<?=$i;?>" /> <input class="rule_select" type="checkbox" name="rule[]" value="<?=$i;?>" />
</td> </td>
<td> <td>
<a href="#" type="submit" id="toggle_<?=$i;?>" data-toggle="tooltip" title="<?=(!isset($natent['disabled'])) ? gettext("disable rule") : gettext("enable rule");?>" class="act_toggle"> <a href="#" type="submit" id="toggle_<?=$i;?>" data-toggle="tooltip" title="<?=(!isset($natent['disabled'])) ? gettext("disable rule") : gettext("enable rule");?>" class="act_toggle">
......
...@@ -167,6 +167,12 @@ $main_buttons = array( ...@@ -167,6 +167,12 @@ $main_buttons = array(
$("#action").val("toggle"); $("#action").val("toggle");
$("#iform").submit(); $("#iform").submit();
}); });
// select All
$("#selectAll").click(function(){
$(".rule_select").prop("checked", $(this).prop("checked"));
});
// watch scroll position and set to last known on page load // watch scroll position and set to last known on page load
watchScrollPosition(); watchScrollPosition();
}); });
...@@ -191,7 +197,7 @@ $main_buttons = array( ...@@ -191,7 +197,7 @@ $main_buttons = array(
<thead> <thead>
<tr> <tr>
<th width="2%">&nbsp;</th> <th width="2%">&nbsp;</th>
<th width="2%">&nbsp;</th> <th width="2%"><input type="checkbox" id="selectAll"></th>
<th width="2%">&nbsp;</th> <th width="2%">&nbsp;</th>
<th><?=gettext("Interface"); ?></th> <th><?=gettext("Interface"); ?></th>
<th><?=gettext("External Prefix"); ?></th> <th><?=gettext("External Prefix"); ?></th>
...@@ -207,7 +213,7 @@ $main_buttons = array( ...@@ -207,7 +213,7 @@ $main_buttons = array(
<tr <?=isset($natent['disabled'])?"class=\"text-muted\"":"";?> ondblclick="document.location='firewall_nat_npt_edit.php?id=<?=$i;?>';"> <tr <?=isset($natent['disabled'])?"class=\"text-muted\"":"";?> ondblclick="document.location='firewall_nat_npt_edit.php?id=<?=$i;?>';">
<td> </td> <td> </td>
<td> <td>
<input type="checkbox" name="rule[]" value="<?=$i;?>" /> <input class="rule_select" type="checkbox" name="rule[]" value="<?=$i;?>" />
</td> </td>
<td> <td>
<a href="#" class="act_toggle" id="toggle_<?=$i;?>" data-toggle="tooltip" title="<?=(!isset($natent['disabled'])) ? gettext("disable rule") : gettext("enable rule");?>"> <a href="#" class="act_toggle" id="toggle_<?=$i;?>" data-toggle="tooltip" title="<?=(!isset($natent['disabled'])) ? gettext("disable rule") : gettext("enable rule");?>">
......
...@@ -234,6 +234,12 @@ include("head.inc"); ...@@ -234,6 +234,12 @@ include("head.inc");
$("#action").val("toggle"); $("#action").val("toggle");
$("#iform").submit(); $("#iform").submit();
}); });
// select All
$("#selectAll").click(function(){
$(".rule_select").prop("checked", $(this).prop("checked"));
});
// watch scroll position and set to last known on page load // watch scroll position and set to last known on page load
watchScrollPosition(); watchScrollPosition();
}); });
...@@ -329,7 +335,7 @@ include("head.inc"); ...@@ -329,7 +335,7 @@ include("head.inc");
<thead> <thead>
<tr><th colspan="12"><?=gettext("Manual rules:"); ?></th></tr> <tr><th colspan="12"><?=gettext("Manual rules:"); ?></th></tr>
<tr> <tr>
<th>&nbsp;</th> <th><input type="checkbox" id="selectAll"></th>
<th>&nbsp;</th> <th>&nbsp;</th>
<th><?=gettext("Interface");?></th> <th><?=gettext("Interface");?></th>
<th class="hidden-xs hidden-sm"><?=gettext("Source");?></th> <th class="hidden-xs hidden-sm"><?=gettext("Source");?></th>
...@@ -350,7 +356,7 @@ include("head.inc"); ...@@ -350,7 +356,7 @@ include("head.inc");
?> ?>
<tr <?=$mode == "disabled" || $mode == "automatic" || isset($natent['disabled'])?"class=\"text-muted\"":"";?> ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$i;?>';"> <tr <?=$mode == "disabled" || $mode == "automatic" || isset($natent['disabled'])?"class=\"text-muted\"":"";?> ondblclick="document.location='firewall_nat_out_edit.php?id=<?=$i;?>';">
<td> <td>
<input type="checkbox" name="rule[]" value="<?=$i;?>" /> <input class="rule_select" type="checkbox" name="rule[]" value="<?=$i;?>" />
</td> </td>
<td> <td>
<?php <?php
......
...@@ -240,6 +240,11 @@ $( document ).ready(function() { ...@@ -240,6 +240,11 @@ $( document ).ready(function() {
$("#fw_category").addClass('hidden'); $("#fw_category").addClass('hidden');
} }
// select All
$("#selectAll").click(function(){
$(".rule_select").prop("checked", $(this).prop("checked"));
});
}); });
</script> </script>
...@@ -280,7 +285,7 @@ $( document ).ready(function() { ...@@ -280,7 +285,7 @@ $( document ).ready(function() {
<table class="table table-striped table-hover" id="rules"> <table class="table table-striped table-hover" id="rules">
<thead> <thead>
<tr> <tr>
<th>&nbsp;</th> <th><input type="checkbox" id="selectAll"></th>
<th>&nbsp;</th> <th>&nbsp;</th>
<th><?=gettext("Proto");?></th> <th><?=gettext("Proto");?></th>
<th><?=gettext("Source");?></th> <th><?=gettext("Source");?></th>
...@@ -436,7 +441,7 @@ $( document ).ready(function() { ...@@ -436,7 +441,7 @@ $( document ).ready(function() {
?> ?>
<tr class="rule" data-category="<?=!empty($filterent['category']) ? $filterent['category'] : "";?>"> <tr class="rule" data-category="<?=!empty($filterent['category']) ? $filterent['category'] : "";?>">
<td> <td>
<input type="checkbox" name="rule[]" value="<?=$i;?>" /> <input class="rule_select" type="checkbox" name="rule[]" value="<?=$i;?>" />
</td> </td>
<td> <td>
<a href="#" class="act_toggle" id="toggle_<?=$i;?>" data-toggle="tooltip" title="<?=(empty($filterent['disabled'])) ? gettext("disable rule") : gettext("enable rule");?>"><span class="glyphicon <?=$iconfn;?>"></span></a> <a href="#" class="act_toggle" id="toggle_<?=$i;?>" data-toggle="tooltip" title="<?=(empty($filterent['disabled'])) ? gettext("disable rule") : gettext("enable rule");?>"><span class="glyphicon <?=$iconfn;?>"></span></a>
......
...@@ -205,6 +205,10 @@ $( document ).ready(function() { ...@@ -205,6 +205,10 @@ $( document ).ready(function() {
}); });
$("#scrub_interface_disable").change(); $("#scrub_interface_disable").change();
// select All
$("#selectAll").click(function(){
$(".rule_select").prop("checked", $(this).prop("checked"));
});
// watch scroll position and set to last known on page load // watch scroll position and set to last known on page load
watchScrollPosition(); watchScrollPosition();
...@@ -295,7 +299,7 @@ $( document ).ready(function() { ...@@ -295,7 +299,7 @@ $( document ).ready(function() {
<th colspan="2"> </th> <th colspan="2"> </th>
</tr> </tr>
<tr> <tr>
<th>&nbsp;</th> <th><input type="checkbox" id="selectAll"></th>
<th><?=gettext("Interfaces");?></th> <th><?=gettext("Interfaces");?></th>
<th class="hidden-xs hidden-sm"><?=gettext("Source");?></th> <th class="hidden-xs hidden-sm"><?=gettext("Source");?></th>
<th class="hidden-xs hidden-sm"><?=gettext("Destination");?></th> <th class="hidden-xs hidden-sm"><?=gettext("Destination");?></th>
...@@ -310,7 +314,7 @@ $( document ).ready(function() { ...@@ -310,7 +314,7 @@ $( document ).ready(function() {
foreach ($a_scrub as $i => $scrubEntry):?> foreach ($a_scrub as $i => $scrubEntry):?>
<tr> <tr>
<td> <td>
<input type="checkbox" name="rule[]" value="<?=$i;?>" /> <input class="rule_select" type="checkbox" name="rule[]" value="<?=$i;?>" />
<a href="#" class="act_toggle" data-id="<?=$i;?>" data-toggle="tooltip" title="<?=(empty($scrubEntry['disabled'])) ? gettext("disable") : gettext("enable");?>"> <a href="#" class="act_toggle" data-id="<?=$i;?>" data-toggle="tooltip" title="<?=(empty($scrubEntry['disabled'])) ? gettext("disable") : gettext("enable");?>">
<span class="glyphicon glyphicon-play <?=(empty($scrubEntry['disabled'])) ? "text-success" : "text-muted";?>"></span> <span class="glyphicon glyphicon-play <?=(empty($scrubEntry['disabled'])) ? "text-success" : "text-muted";?>"></span>
</a> </a>
......
...@@ -256,6 +256,11 @@ $main_buttons = array( ...@@ -256,6 +256,11 @@ $main_buttons = array(
$("#action").val("move"); $("#action").val("move");
$("#iform").submit(); $("#iform").submit();
}); });
// select All
$("#selectAll").click(function(){
$(".rule_select").prop("checked", $(this).prop("checked"));
});
}); });
</script> </script>
<?php include("fbegin.inc"); ?> <?php include("fbegin.inc"); ?>
...@@ -280,7 +285,7 @@ $main_buttons = array( ...@@ -280,7 +285,7 @@ $main_buttons = array(
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr> <tr>
<td></td> <td><input type="checkbox" id="selectAll"></td>
<td><?=gettext("Virtual IP address");?></td> <td><?=gettext("Virtual IP address");?></td>
<td><?=gettext("Interface");?></td> <td><?=gettext("Interface");?></td>
<td><?=gettext("Type");?></td> <td><?=gettext("Type");?></td>
...@@ -297,7 +302,7 @@ $main_buttons = array( ...@@ -297,7 +302,7 @@ $main_buttons = array(
if(!empty($vipent['subnet']) || !empty($vipent['range']) || !empty($vipent['subnet_bits']) || (isset($vipent['range']['from']) && !empty($vipent['range']['from']))): ?> if(!empty($vipent['subnet']) || !empty($vipent['range']) || !empty($vipent['subnet_bits']) || (isset($vipent['range']['from']) && !empty($vipent['range']['from']))): ?>
<tr ondblclick="document.location='firewall_virtual_ip_edit.php?id=<?=$i;?>';"> <tr ondblclick="document.location='firewall_virtual_ip_edit.php?id=<?=$i;?>';">
<td> <td>
<input type="checkbox" name="rule[]" value="<?=$i;?>" /> <input class="rule_select" type="checkbox" name="rule[]" value="<?=$i;?>" />
</td> </td>
<td> <td>
<?=($vipent['type'] == "single" || $vipent['type'] == "network") && !empty($vipent['subnet_bits']) ? $vipent['subnet']."/".$vipent['subnet_bits'] : "";?> <?=($vipent['type'] == "single" || $vipent['type'] == "network") && !empty($vipent['subnet_bits']) ? $vipent['subnet']."/".$vipent['subnet_bits'] : "";?>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment