From 255ad1dcc5efed4a7ed088622cb08ad9e09c3651 Mon Sep 17 00:00:00 2001 From: Scott Ullrich Date: Mon, 7 Nov 2005 18:34:11 +0000 Subject: MFC 7444 7445 Keep track of the number of items the user has requested to shape. If at the end of the wizard the count is still 0 then unset the shaper configuration and alert the user that they have not picked anything to shape Ticket #642 --- usr/local/www/wizards/traffic_shaper_wizard.xml | 28 ++++++++++++++++++------- 1 file changed, 21 insertions(+), 7 deletions(-) (limited to 'usr') diff --git a/usr/local/www/wizards/traffic_shaper_wizard.xml b/usr/local/www/wizards/traffic_shaper_wizard.xml index a7af95e..b10abb3 100644 --- a/usr/local/www/wizards/traffic_shaper_wizard.xml +++ b/usr/local/www/wizards/traffic_shaper_wizard.xml @@ -54,14 +54,8 @@ /* wipe previous */ unset($config['shaper']['queue']); unset($config['shaper']['rule']); - /* XXX: billm - this is breaking things :) */ - /* - * unset($config['interfaces']['wan']['bandwidth']); - * unset($config['interfaces']['wan']['bandwidthtype']); - * unset($config['interfaces']['lan']['bandwidth']); - * unset($config['interfaces']['lan']['bandwidthtype']); - */ $config['shaper']['enable'] = FALSE; + $config['shaper']['itemsshaped'] = "0"; @@ -478,6 +472,7 @@ foreach ($voiplist as $voip) { foreach (array('source', 'destination') as $srcdest) { $rule = array(); + $config['shaper']['itemsshaped']++; if ($srcdest == 'source') { $destsrc = 'destination'; $rule['outqueue'] = 'qVOIPUp'; @@ -724,6 +719,7 @@ foreach ($p2plist as $p2pclient) { foreach (array('source', 'destination') as $srcdest) { $rule = array(); + $config['shaper']['itemsshaped']++; if ($srcdest == 'source') { $destsrc = 'destination'; $rule['outqueue'] = 'qP2PUp'; @@ -1102,6 +1098,7 @@ foreach ($gamesplist as $Gameclient) { foreach (array('source', 'destination') as $srcdest) { $rule = array(); + $config['shaper']['itemsshaped']++; if ($srcdest == 'source') { $destsrc = 'destination'; $rule['outqueue'] = 'qGamesUp'; @@ -1865,6 +1862,7 @@ foreach ($othersplist as $otherclient) { foreach (array('source', 'destination') as $srcdest) { $rule = array(); + $config['shaper']['itemsshaped']++; if ($srcdest == 'source') { $destsrc = 'destination'; $rule['outqueue'] = 'qOthersUp' . $otherclient[5]; /* posted value H or L */ @@ -1912,6 +1910,22 @@ submit + + if($config['shaper']['itemsshaped'] == "0") { + /* no shaper items have been selected + * wipe previous + */ + unset($config['shaper']['queue']); + unset($config['shaper']['rule']); + $config['shaper']['enable'] = FALSE; + $config['shaper']['itemsshaped'] = "0"; + $message = "No items have been selected to shape. Exiting traffic shaper wizard."; + write_config("No shaper items picked, unsetting shaper configuration"); + header("Location: /wizard.php?xml=traffic_shaper_wizard.xml&stepid=8&message={$message}"); + filter_configure(); + exit; + } + $config['shaper']['enable'] = TRUE; filter_configure_sync(); -- cgit v1.1