From 955b6bb82ea38fa15a4659238b98bfc76cfc4420 Mon Sep 17 00:00:00 2001 From: szaimen Date: Mon, 7 Mar 2022 11:07:25 +0100 Subject: [PATCH] add a way to open the admin settings overview directly Signed-off-by: szaimen --- .../lib/Controller/CommonSettingsTrait.php | 7 +++- lib/private/NavigationManager.php | 40 ++++++++++++++----- 2 files changed, 36 insertions(+), 11 deletions(-) diff --git a/apps/settings/lib/Controller/CommonSettingsTrait.php b/apps/settings/lib/Controller/CommonSettingsTrait.php index 2eb7b4ccf99..4a15b0c7a32 100644 --- a/apps/settings/lib/Controller/CommonSettingsTrait.php +++ b/apps/settings/lib/Controller/CommonSettingsTrait.php @@ -134,7 +134,12 @@ trait CommonSettingsTrait { } private function getIndexResponse($type, $section) { - $this->navigationManager->setActiveEntry('settings'); + if ($type === 'personal') { + $this->navigationManager->setActiveEntry('settings'); + } elseif ($type === 'admin') { + $this->navigationManager->setActiveEntry('admin_settings'); + } + $templateParams = []; $templateParams = array_merge($templateParams, $this->getNavigationParameters($type, $section)); $templateParams = array_merge($templateParams, $this->getSettings($section)); diff --git a/lib/private/NavigationManager.php b/lib/private/NavigationManager.php index 2ffd25df9b8..b5fa87a9860 100644 --- a/lib/private/NavigationManager.php +++ b/lib/private/NavigationManager.php @@ -211,17 +211,37 @@ class NavigationManager implements INavigationManager { 'icon' => $this->urlGenerator->imagePath('settings', 'apps.svg'), 'name' => $l->t('Apps'), ]); - } - // Personal and (if applicable) admin settings - $this->add([ - 'type' => 'settings', - 'id' => 'settings', - 'order' => 2, - 'href' => $this->urlGenerator->linkToRoute('settings.PersonalSettings.index'), - 'name' => $l->t('Settings'), - 'icon' => $this->urlGenerator->imagePath('settings', 'admin.svg'), - ]); + // Personal settings + $this->add([ + 'type' => 'settings', + 'id' => 'settings', + 'order' => 2, + 'href' => $this->urlGenerator->linkToRoute('settings.PersonalSettings.index'), + 'name' => $l->t('Personal settings'), + 'icon' => $this->urlGenerator->imagePath('settings', 'admin.svg'), + ]); + + // Admin settings + $this->add([ + 'type' => 'settings', + 'id' => 'admin_settings', + 'order' => 3, + 'href' => $this->urlGenerator->linkToRoute('settings.AdminSettings.index', ['section' => 'overview']), + 'name' => $l->t('Admin settings'), + 'icon' => $this->urlGenerator->imagePath('settings', 'admin.svg'), + ]); + } else { + // Personal settings + $this->add([ + 'type' => 'settings', + 'id' => 'settings', + 'order' => 2, + 'href' => $this->urlGenerator->linkToRoute('settings.PersonalSettings.index'), + 'name' => $l->t('Settings'), + 'icon' => $this->urlGenerator->imagePath('settings', 'admin.svg'), + ]); + } $logoutUrl = \OC_User::getLogoutUrl($this->urlGenerator); if ($logoutUrl !== '') { -- 2.39.5