diff options
author | Phil Davis <phil.davis@inf.org> | 2017-03-30 10:01:23 +0545 |
---|---|---|
committer | Phil Davis <phil.davis@inf.org> | 2017-03-30 10:01:23 +0545 |
commit | 1d3510cf6cc471b179d52e03f4cfe77e23b4b20b (patch) | |
tree | 51deff4531bf7b02da13f93e4b865cef6116515b /src/etc | |
parent | fe255e99389cb6f75a06c55797890c52bd934f0f (diff) | |
download | pfsense-1d3510cf6cc471b179d52e03f4cfe77e23b4b20b.zip pfsense-1d3510cf6cc471b179d52e03f4cfe77e23b4b20b.tar.gz |
Add user option to sort interface names
Diffstat (limited to 'src/etc')
-rw-r--r-- | src/etc/inc/auth.inc | 2 | ||||
-rw-r--r-- | src/etc/inc/pfsense-utils.inc | 20 | ||||
-rw-r--r-- | src/etc/inc/util.inc | 9 |
3 files changed, 28 insertions, 3 deletions
diff --git a/src/etc/inc/auth.inc b/src/etc/inc/auth.inc index 59114d6..168af38 100644 --- a/src/etc/inc/auth.inc +++ b/src/etc/inc/auth.inc @@ -1580,6 +1580,7 @@ function get_user_settings($username) { $settings['webgui']['dashboardcolumns'] = $config['system']['webgui']['dashboardcolumns']; $settings['webgui']['webguihostnamemenu'] = $config['system']['webgui']['webguihostnamemenu']; $settings['webgui']['webguicss'] = $config['system']['webgui']['webguicss']; + $settings['webgui']['interfacessort'] = isset($config['system']['webgui']['interfacessort']); $settings['webgui']['dashboardavailablewidgetspanel'] = isset($config['system']['webgui']['dashboardavailablewidgetspanel']); $settings['webgui']['webguifixedmenu'] = isset($config['system']['webgui']['webguifixedmenu']); $settings['webgui']['webguileftcolumnhyper'] = isset($config['system']['webgui']['webguileftcolumnhyper']); @@ -1604,6 +1605,7 @@ function get_user_settings($username) { if (isset($user['webguihostnamemenu'])) { $settings['webgui']['webguihostnamemenu'] = $user['webguihostnamemenu']; } + $settings['webgui']['interfacessort'] = isset($user['interfacessort']); $settings['webgui']['dashboardavailablewidgetspanel'] = isset($user['dashboardavailablewidgetspanel']); $settings['webgui']['webguifixedmenu'] = isset($user['webguifixedmenu']); $settings['webgui']['webguileftcolumnhyper'] = isset($user['webguileftcolumnhyper']); diff --git a/src/etc/inc/pfsense-utils.inc b/src/etc/inc/pfsense-utils.inc index 81a2ea3..ded6b3f 100644 --- a/src/etc/inc/pfsense-utils.inc +++ b/src/etc/inc/pfsense-utils.inc @@ -255,6 +255,25 @@ function gen_dashboardcolumns_field(&$section, $value) { )); } +/****f* pfsense-utils/gen_interfacessort_field + * NAME + * gen_interfacessort_field + * INPUTS + * Pointer to section object + * Initial value for the field + * RESULT + * no return value, section object is updated + ******/ +function gen_interfacessort_field(&$section, $value) { + + $section->addInput(new Form_Checkbox( + 'interfacessort', + 'Interfaces Sort', + 'Sort Alphabetically', + $value + ))->setHelp('If selected, lists of interfaces will be sorted by description, otherwise they are listed wan,lan,optn...'); +} + /****f* pfsense-utils/gen_associatedpanels_fields * NAME * gen_associatedpanels_fields @@ -375,6 +394,7 @@ function gen_user_settings_fields(&$section, $pconfig) { gen_webguifixedmenu_field($section, $pconfig['webguifixedmenu']); gen_webguihostnamemenu_field($section, $pconfig['webguihostnamemenu']); gen_dashboardcolumns_field($section, $pconfig['dashboardcolumns']); + gen_interfacessort_field($section, $pconfig['interfacessort']); gen_associatedpanels_fields( $section, $pconfig['dashboardavailablewidgetspanel'], diff --git a/src/etc/inc/util.inc b/src/etc/inc/util.inc index 74ffd9f..491405b 100644 --- a/src/etc/inc/util.inc +++ b/src/etc/inc/util.inc @@ -1416,7 +1416,7 @@ function get_configured_interface_list_by_realif($only_opt = false, $withdisable /* return the configured interfaces list with their description. */ function get_configured_interface_with_descr($only_opt = false, $withdisabled = false) { - global $config; + global $config, $user_settings; $iflist = array(); @@ -1433,8 +1433,11 @@ function get_configured_interface_with_descr($only_opt = false, $withdisabled = } } } - - asort($iflist); + + if ($user_settings['webgui']['interfacessort']) { + asort($iflist); + } + return $iflist; } |