diff options
author | jim-p <jimp@pfsense.org> | 2016-12-22 10:19:17 -0500 |
---|---|---|
committer | jim-p <jimp@pfsense.org> | 2016-12-22 10:20:29 -0500 |
commit | aa64bb6565db2f788846eee9a62bccde280a605a (patch) | |
tree | 01e13f88272ea15e9d9dcc6c19e6fb839e6b0183 /src | |
parent | 5e866e1280c42f6b62abd48cab8099763e80c448 (diff) | |
download | pfsense-aa64bb6565db2f788846eee9a62bccde280a605a.zip pfsense-aa64bb6565db2f788846eee9a62bccde280a605a.tar.gz |
Be more forthcoming with errors about ALTQ interfaces in relevant areas of the GUI. In particular, note when there are no capable interfaces assigned. Implements #7032
Diffstat (limited to 'src')
8 files changed, 56 insertions, 12 deletions
diff --git a/src/usr/local/www/firewall_shaper.php b/src/usr/local/www/firewall_shaper.php index 54f38bb..82410cc 100644 --- a/src/usr/local/www/firewall_shaper.php +++ b/src/usr/local/www/firewall_shaper.php @@ -452,6 +452,14 @@ if (!$dfltmsg && $sform) { </table> </div> +<?php if (empty(get_interface_list_to_show())): ?> +<div> + <div class="infoblock blockopen"> + <?php print_info_box(gettext("This firewall does not have any interfaces assigned that are capable of using ALTQ traffic shaping."), 'danger', false); ?> + </div> +</div> +<?php endif; ?> + <?php if ($dfltmsg) { ?> diff --git a/src/usr/local/www/firewall_shaper_queues.php b/src/usr/local/www/firewall_shaper_queues.php index d91e16c..0bdb99e 100644 --- a/src/usr/local/www/firewall_shaper_queues.php +++ b/src/usr/local/www/firewall_shaper_queues.php @@ -231,6 +231,14 @@ display_top_tabs($tab_array); </div> </form> +<?php if (empty(get_interface_list_to_show())): ?> +<div> + <div class="infoblock blockopen"> + <?php print_info_box(gettext("This firewall does not have any interfaces assigned that are capable of using ALTQ traffic shaping."), 'danger', false); ?> + </div> +</div> +<?php endif; ?> + <?php include("foot.inc"); ?> diff --git a/src/usr/local/www/firewall_shaper_wizards.php b/src/usr/local/www/firewall_shaper_wizards.php index 440f8c8..594ed63 100644 --- a/src/usr/local/www/firewall_shaper_wizards.php +++ b/src/usr/local/www/firewall_shaper_wizards.php @@ -59,6 +59,8 @@ if ($_POST['apply']) { clear_subsystem_dirty('shaper'); } +$shaperIFlist = get_configured_interface_with_descr(); + $pgtitle = array(gettext("Firewall"), gettext("Traffic Shaper"), gettext("Wizards")); $shortcut_section = "trafficshaper"; @@ -108,5 +110,13 @@ endforeach; </dl> </div> </div> +<?php if (empty(get_interface_list_to_show())): ?> +<div> + <div class="infoblock blockopen"> + <?php print_info_box(gettext("This firewall does not have any interfaces assigned that are capable of using ALTQ traffic shaping."), 'danger', false); ?> + </div> +</div> +<?php endif; ?> + <?php include("foot.inc"); diff --git a/src/usr/local/www/guiconfig.inc b/src/usr/local/www/guiconfig.inc index dc67b62..d4fc383 100644 --- a/src/usr/local/www/guiconfig.inc +++ b/src/usr/local/www/guiconfig.inc @@ -276,13 +276,15 @@ function verify_gzip_file($fname) { } } -// print_info_box() has been updated so that any required button is explicitly created, rather than relying on the detection of certain +// sprint_info_box() returns a string with a formatted informational box, it does not print the box. +// To format and print in one step, call print_info_box() as usual. +// Any required button is explicitly created, rather than relying on the detection of certain // strings in the message (such as "apply"). print_info_box_np() has been exterminated. // $class = the bootstrap style class (default, info, warning, success, danger) // $btnname and btntext describe the optional button and its display text, the default is an 'x' Close button. // Note that there is also a shortcut function print_apply_box here that creates a standard "apply" box for you. // In many cases just substitute that for print_info_box_np() to easily get a warning style "Apply changes" box. -function print_info_box($msg, $class="alert-warning", $btnname = "close", $btntext = "", $btnicon = "", $btnclass = "default") { +function sprint_info_box($msg, $class="alert-warning", $btnname = "close", $btntext = "", $btnicon = "", $btnclass = "default") { if (strpos($class, "alert-") !== 0) { $class = 'alert-' . $class; @@ -309,7 +311,12 @@ function print_info_box($msg, $class="alert-warning", $btnname = "close", $btnte $msg .= '</form>'; } - echo '<div class="alert ' . $class . ' clearfix" role="alert">' . $msg . '</div>'; + return '<div class="alert ' . $class . ' clearfix" role="alert">' . $msg . '</div>'; +} + +// Format and print an info box. See sprint_info_box() for details. +function print_info_box($msg, $class="alert-warning", $btnname = "close", $btntext = "", $btnicon = "", $btnclass = "default") { + echo sprint_info_box($msg, $class, $btnname, $btntext, $btnicon, $btnclass); } function print_apply_box($msg) { diff --git a/src/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc b/src/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc index f5c0448..6bd7a05 100644 --- a/src/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc +++ b/src/usr/local/www/wizards/traffic_shaper_wizard_dedicated.inc @@ -38,8 +38,12 @@ function step1_stepbeforeformdisplay() { } foreach ($fields as &$field) - if ($field['name'] == 'numberofconnections') + if ($field['name'] == 'numberofconnections') { $field['value'] = ($wans < $lans ? $wans : $lans); + if (($wans == 0) && ($lans == 0)) { + $field['description'] .= sprint_info_box(gettext("This firewall does not have any interfaces assigned that are capable of using ALTQ traffic shaping."), 'danger', false); + } + } } function step1_submitphpaction() { @@ -76,7 +80,7 @@ function step2_stepbeforeformdisplay() { } $numberofconnections = intval($config['ezshaper']['step1']['numberofconnections']); if ($numberofconnections > ($wans < $lans ? $wans : $lans)) { - $savemsg=gettext("There are less interfaces than number of connections!"); + $savemsg=gettext("The specified number of connections is greater than the number of ALTQ-capable assigned interfaces!"); $stepid--; return; } diff --git a/src/usr/local/www/wizards/traffic_shaper_wizard_dedicated.xml b/src/usr/local/www/wizards/traffic_shaper_wizard_dedicated.xml index ce74605..edaa98d 100644 --- a/src/usr/local/www/wizards/traffic_shaper_wizard_dedicated.xml +++ b/src/usr/local/www/wizards/traffic_shaper_wizard_dedicated.xml @@ -40,7 +40,7 @@ <name>numberofconnections</name> <type>input</type> <validate>^[0-9]+$</validate> - <description>Number of connections the system has</description> + <description>Number of WAN-type connections (Gateway selected on their interface settings, or dynamic assignment.)</description> <bindstofield>ezshaper->step1->numberofconnections</bindstofield> </field> <field> diff --git a/src/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc b/src/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc index 81e8ac1..e14bc18 100644 --- a/src/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc +++ b/src/usr/local/www/wizards/traffic_shaper_wizard_multi_all.inc @@ -39,10 +39,17 @@ function step1_stepbeforeformdisplay() { } foreach ($fields as &$field) { - if ($field['name'] == 'numberofconnections') + if ($field['name'] == 'numberofconnections') { $field['value'] = $wans; - else if ($field['name'] == 'numberoflocalinterfaces') + if ($wans == 0) { + $field['description'] .= sprint_info_box(gettext("This firewall does not have any WAN-type interfaces assigned that are capable of using ALTQ traffic shaping."), 'danger', false); + } + } else if ($field['name'] == 'numberoflocalinterfaces') { $field['value'] = $lans; + if ($lans == 0) { + $field['description'] .= sprint_info_box(gettext("This firewall does not have any LAN-type interfaces assigned that are capable of using ALTQ traffic shaping."), 'danger', false); + } + } } } @@ -96,14 +103,14 @@ function step2_stepbeforeformdisplay() { } $numberofconnections = intval($config['ezshaper']['step1']['numberofconnections']); if ($numberofconnections > $wans) { - $savemsg=gettext("There are less interfaces than number of connections!"); + $savemsg=gettext("The specified number of connections is greater than the number of ALTQ-capable assigned interfaces!"); $stepid--; return; } $numberoflocalinterfaces = intval($config['ezshaper']['step1']['numberoflocalinterfaces']); if ($numberoflocalinterfaces > $lans) { - $savemsg=gettext("There are less interfaces than number of connections!"); + $savemsg=gettext("The specified number of connections is greater than the number of ALTQ-capable assigned interfaces!"); $stepid--; return; } diff --git a/src/usr/local/www/wizards/traffic_shaper_wizard_multi_all.xml b/src/usr/local/www/wizards/traffic_shaper_wizard_multi_all.xml index e0a5850..64a42c7 100644 --- a/src/usr/local/www/wizards/traffic_shaper_wizard_multi_all.xml +++ b/src/usr/local/www/wizards/traffic_shaper_wizard_multi_all.xml @@ -40,7 +40,7 @@ <name>numberofconnections</name> <type>input</type> <validate>^[0-9]+$</validate> - <description>Number of connections the system has</description> + <description>Number of WAN-type connections (Gateway selected on their interface settings, or dynamic assignment.)</description> <bindstofield>ezshaper->step1->numberofconnections</bindstofield> </field> <field> @@ -48,7 +48,7 @@ <name>numberoflocalinterfaces</name> <type>input</type> <validate>^[0-9]+$</validate> - <description>Number of local interfaces the system has</description> + <description>Number of local connections (No gateway selected on their interface settings.)</description> <bindstofield>ezshaper->step1->numberoflocalinterfaces</bindstofield> </field> <field> |