summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Beaver <sbeaver@netgate.com>2017-02-13 17:46:42 -0500
committerSteve Beaver <sbeaver@netgate.com>2017-02-13 17:46:42 -0500
commit24fc15e6d7ff9aa389fba5fb29fc93019d88cf77 (patch)
treee2d582fd63badc25838b23d838bbcd43df10467f
parent1a8b65541c3a3185792f41ed293aaf763a4caf01 (diff)
downloadpfsense-24fc15e6d7ff9aa389fba5fb29fc93019d88cf77.zip
pfsense-24fc15e6d7ff9aa389fba5fb29fc93019d88cf77.tar.gz
Fixed DIVIDER issue caused by the addition of msorts to the menu
-rw-r--r--src/usr/local/www/head.inc35
1 files changed, 20 insertions, 15 deletions
diff --git a/src/usr/local/www/head.inc b/src/usr/local/www/head.inc
index a908a12..722d7a2 100644
--- a/src/usr/local/www/head.inc
+++ b/src/usr/local/www/head.inc
@@ -187,23 +187,30 @@ function output_menu($arrayitem, $target = null, $section = "") {
$output = "";
foreach ($arrayitem as $item) {
+
/* If the user has access to help pages, also show the full help menu. See #5909 */
if (isAllowedPage($item[1]) || $item[1] == "/index.php?logout" ||
(($section == "Help") && isAllowedPage("help.php")) ||
(substr($item[1], 0, 8) == "https://")) {
$attr = sprintf("href=\"%s\"", htmlentities($item[1]));
+
if ($target) {
$attr .= sprintf(" target=\"%s\"", htmlentities($target));
}
+
$class = "navlnk";
+
if ($item['class']) {
$class .= " {$item['class']}";
}
+
$attr .= sprintf(" class=\"%s\"", htmlentities($class));
+
if ($item['style']) {
$attr .= sprintf(" style=\"%s\"", htmlentities($item['style']));
}
+
if ($item[0] == '-DIVIDER-') {
$output .= ' <li class="divider"></li>';
} else {
@@ -217,10 +224,6 @@ function output_menu($arrayitem, $target = null, $section = "") {
$ext_menu_path_data = read_ext_menu_path_data();
-
-// NOTE:
-// $your_menu[] = array("-DIVIDER-", ""); adds a horizontal divider to the menu. See $interfaces_menu[] for example
-
// System
$system_menu = array();
$system_menu[] = array(gettext("Logout") . " (" . $_SESSION['Username'] . ")", "/index.php?logout");
@@ -244,33 +247,35 @@ if ($user_settings['customsettings'] && isAllowedPage("system_user_settings.php*
$system_menu = msort(array_merge($system_menu, return_ext_menu("System")), 0);
-$div = false;
-
// Interfaces
+// NOTE:
+// Now that menus are sorted, adding a DIVIDER must be done after the sorting so an array is formed of the
+// items above the divider and another for below it. THese are then sorted and combined with the divider
$interfaces_menu = array();
+$interfaces_top = array();
+$interfaces_bottom = array();
+
if (!isset($config['system']['webgui']['noassigninterfaces'])) {
- $interfaces_menu[] = array(gettext("Assignments"), "/interfaces_assign.php");
+ $interfaces_top[] = array(gettext("Assignments"), "/interfaces_assign.php");
$div = true;
}
$platform = system_identify_specific_platform();
if ($platform['name'] == "uFW") {
- $interfaces_menu[] = array(gettext("Switches"), "/switch_system.php");
- $div = true;
-}
-
-if ($div) {
- $interfaces_menu[] = array("-DIVIDER-", "");
+ $interfaces_top[] = array(gettext("Switches"), "/switch_system.php");
}
$opts = get_configured_interface_with_descr(false, true);
+
foreach ($opts as $oif => $odescr) {
if (!isset($config['interfaces'][$oif]['ovpn'])) {
- $interfaces_menu[] = array(htmlspecialchars($odescr), "/interfaces.php?if={$oif}");
+ $interfaces_bottom[] = array(htmlspecialchars($odescr), "/interfaces.php?if={$oif}");
}
}
-$interfaces_menu = msort(array_merge($interfaces_menu, return_ext_menu("Interfaces")), 0);
+
+// COmbine the top section, the divider and hte bottom section of this menu
+$interfaces_menu = array_merge($interfaces_top, [array(0 => "-DIVIDER-")], msort(array_merge($interfaces_bottom, return_ext_menu("Interfaces")), 0));
// Firewall
$firewall_menu = array();
OpenPOWER on IntegriCloud