diff options
author | Julius Haertl <jus@bitgrid.net> | 2017-03-01 23:21:38 +0100 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2017-03-16 11:55:09 +0100 |
commit | 61dc78e6dc25f2a342fe523e50c41c557f3c6aca (patch) | |
tree | 28665afb3835d1cd43df9e827a55de86de377435 /lib/private/legacy | |
parent | a630e4629f2489e9d7678fbe6833cf926e2b968e (diff) | |
download | nextcloud-server-61dc78e6dc25f2a342fe523e50c41c557f3c6aca.tar.gz nextcloud-server-61dc78e6dc25f2a342fe523e50c41c557f3c6aca.zip |
Fix menu issues
Signed-off-by: Julius Haertl <jus@bitgrid.net>
Diffstat (limited to 'lib/private/legacy')
-rw-r--r-- | lib/private/legacy/app.php | 25 |
1 files changed, 19 insertions, 6 deletions
diff --git a/lib/private/legacy/app.php b/lib/private/legacy/app.php index 1cc83888734..3d0ebc9644c 100644 --- a/lib/private/legacy/app.php +++ b/lib/private/legacy/app.php @@ -529,7 +529,7 @@ class OC_App { // This is private as well. It simply works, so don't ask for more details private static function proceedNavigation($list) { - + $headerIconCount = 8; usort($list, function($a, $b) { if (isset($a['order']) && isset($b['order'])) { return ($a['order'] < $b['order']) ? -1 : 1; @@ -540,6 +540,7 @@ class OC_App { } }); + $activeAppIndex = -1; $activeApp = OC::$server->getNavigationManager()->getActiveEntry(); foreach ($list as $index => &$navEntry) { if ($navEntry['id'] == $activeApp) { @@ -551,18 +552,28 @@ class OC_App { } unset($navEntry); + if($activeAppIndex > ($headerIconCount-1)) { + $active = $list[$activeAppIndex]; + $lastInHeader = $list[$headerIconCount-1]; + $list[$headerIconCount-1] = $active; + $list[$activeAppIndex] = $lastInHeader; + } foreach ($list as $index => &$navEntry) { $navEntry['showInHeader'] = false; - if($index < 4) { + if($index < $headerIconCount) { $navEntry['showInHeader'] = true; } } + + return $list; } public static function proceedAppNavigation($entries) { + $headerIconCount = 8; + $activeAppIndex = -1; $list = self::proceedNavigation($entries); $activeApp = OC::$server->getNavigationManager()->getActiveEntry(); @@ -574,13 +585,15 @@ class OC_App { $navEntry['active'] = false; } } - $list = array_slice($list, 0, 4); // move active item to last position - if($activeAppIndex > 2) { + if($activeAppIndex > ($headerIconCount-1)) { $active = $list[$activeAppIndex]; - unset($list[$activeAppIndex]); - array_unshift($list, $active); + $lastInHeader = $list[$headerIconCount-1]; + $list[$headerIconCount-1] = $active; + $list[$activeAppIndex] = $lastInHeader; } + $list = array_slice($list, 0, $headerIconCount); + return $list; } |