diff options
author | Stephen Beaver <sbeaver@netgate.com> | 2016-01-28 12:49:28 -0500 |
---|---|---|
committer | Stephen Beaver <sbeaver@netgate.com> | 2016-01-28 13:00:26 -0500 |
commit | a4eef0c7caa4b8dbfdc37b2d5310a2fb7b23714e (patch) | |
tree | f022e6b89264822bfb467c211e9131d0d2d0c761 /src/usr/local/www | |
parent | a341b67f98968f190c375f51f3616bcd3c2742ff (diff) | |
download | pfsense-a4eef0c7caa4b8dbfdc37b2d5310a2fb7b23714e.zip pfsense-a4eef0c7caa4b8dbfdc37b2d5310a2fb7b23714e.tar.gz |
Adjest separators on rule move or delete
Diffstat (limited to 'src/usr/local/www')
-rw-r--r-- | src/usr/local/www/firewall_rules.php | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/src/usr/local/www/firewall_rules.php b/src/usr/local/www/firewall_rules.php index 4e1304a..0e3db1d 100644 --- a/src/usr/local/www/firewall_rules.php +++ b/src/usr/local/www/firewall_rules.php @@ -220,6 +220,17 @@ if ($_GET['act'] == "del") { delete_nat_association($a_filter[$_GET['id']]['associated-rule-id']); } unset($a_filter[$_GET['id']]); + + // Update the separators + $a_separators = &$config['filter']['separator'][$if]; + + for ($idx=0; isset($a_separators['sep' . $idx]); $idx++ ) { + $seprow = substr($a_separators['sep' . $idx]['row']['0'], 2); + if ($seprow >= $_GET['id']) { + $a_separators['sep' . $idx]['row']['0'] = 'fr' . ($seprow - 1); + } + } + if (write_config()) { mark_subsystem_dirty('filter'); } @@ -239,10 +250,20 @@ if (isset($_POST['del_x'])) { $deleted = false; if (is_array($_POST['rule']) && count($_POST['rule'])) { + $a_separators = &$config['filter']['separator'][$if]; + foreach ($_POST['rule'] as $rulei) { delete_nat_association($a_filter[$rulei]['associated-rule-id']); unset($a_filter[$rulei]); $deleted = true; + + // Update the separators + for ($idx=0; isset($a_separators['sep' . $idx]); $idx++ ) { + $seprow = substr($a_separators['sep' . $idx]['row']['0'], 2); + if ($seprow >= $rulei) { + $a_separators['sep' . $idx]['row']['0'] = 'fr' . ($seprow - 1); + } + } } if ($deleted) { @@ -861,6 +882,7 @@ events.push(function() { cursor: 'grabbing', update: function(event, ui) { $('#order-store').removeAttr('disabled'); + reindex_rules(ui.item.parent('tbody'), ui.item.index); dirty = true; } }); @@ -991,6 +1013,18 @@ events.push(function() { }); } + function reindex_rules(section, startingat) { + var row = 0; + + section.find('tr').each(function() { + if(this.id) { +// $(this).attr("id", bumpStringInt($(this).attr("id"))); + $(this).attr("id", "fr" + row); + row++; + } + }) + } + function handle_colors() { $('[id^=sepclr]').prop("type", "button"); |