Project

General

Profile

« Previous | Next » 

Revision a4eef0c7

Added by Stephen Beaver over 9 years ago

Adjest separators on rule move or delete

View differences:

src/usr/local/www/firewall_rules.php
220 220
			delete_nat_association($a_filter[$_GET['id']]['associated-rule-id']);
221 221
		}
222 222
		unset($a_filter[$_GET['id']]);
223

  
224
		// Update the separators
225
		$a_separators = &$config['filter']['separator'][$if];
226

  
227
		for ($idx=0; isset($a_separators['sep' . $idx]); $idx++ ) {
228
			$seprow = substr($a_separators['sep' . $idx]['row']['0'], 2);
229
			if ($seprow >= $_GET['id']) {
230
				$a_separators['sep' . $idx]['row']['0'] = 'fr' . ($seprow - 1);
231
			}
232
		}
233

  
223 234
		if (write_config()) {
224 235
			mark_subsystem_dirty('filter');
225 236
		}
......
239 250
	$deleted = false;
240 251

  
241 252
	if (is_array($_POST['rule']) && count($_POST['rule'])) {
253
		$a_separators = &$config['filter']['separator'][$if];
254

  
242 255
		foreach ($_POST['rule'] as $rulei) {
243 256
			delete_nat_association($a_filter[$rulei]['associated-rule-id']);
244 257
			unset($a_filter[$rulei]);
245 258
			$deleted = true;
259

  
260
			// Update the separators
261
			for ($idx=0; isset($a_separators['sep' . $idx]); $idx++ ) {
262
				$seprow = substr($a_separators['sep' . $idx]['row']['0'], 2);
263
				if ($seprow >= $rulei) {
264
					$a_separators['sep' . $idx]['row']['0'] = 'fr' . ($seprow - 1);
265
				}
266
			}
246 267
		}
247 268

  
248 269
		if ($deleted) {
......
861 882
		cursor: 'grabbing',
862 883
		update: function(event, ui) {
863 884
			$('#order-store').removeAttr('disabled');
885
			reindex_rules(ui.item.parent('tbody'), ui.item.index);
864 886
			dirty = true;
865 887
		}
866 888
	});
......
991 1013
		});
992 1014
	}
993 1015

  
1016
	function reindex_rules(section, startingat) {
1017
		var row = 0;
1018

  
1019
		section.find('tr').each(function() {
1020
			if(this.id) {
1021
//				$(this).attr("id", bumpStringInt($(this).attr("id")));
1022
				$(this).attr("id", "fr" + row);
1023
				row++;
1024
			}
1025
		})
1026
	}
1027

  
994 1028
	function handle_colors() {
995 1029
		$('[id^=sepclr]').prop("type", "button");
996 1030

  

Also available in: Unified diff