summaryrefslogtreecommitdiffstats
path: root/settings
diff options
context:
space:
mode:
authorArthur Schiwon <blizzz@arthur-schiwon.de>2017-06-22 18:15:33 +0200
committerArthur Schiwon <blizzz@arthur-schiwon.de>2017-06-23 12:38:06 +0200
commita596251d6b8b27ad5ea626d1939adab6866dfe61 (patch)
tree46bbb6cb972d9ee86e7022417152783e9b9f76b0 /settings
parentb7ce492c59364faacd55fc90eebf4ed0a1c26115 (diff)
downloadnextcloud-server-a596251d6b8b27ad5ea626d1939adab6866dfe61.tar.gz
nextcloud-server-a596251d6b8b27ad5ea626d1939adab6866dfe61.zip
avoid marking two sections as active when they have the same name
… in both personal and admin.
Diffstat (limited to 'settings')
-rw-r--r--settings/Controller/AdminSettingsController.php2
-rw-r--r--settings/Controller/CommonSettingsTrait.php25
-rw-r--r--settings/Controller/PersonalSettingsController.php3
3 files changed, 17 insertions, 13 deletions
diff --git a/settings/Controller/AdminSettingsController.php b/settings/Controller/AdminSettingsController.php
index 834534f95ac..33d9cb2c2a3 100644
--- a/settings/Controller/AdminSettingsController.php
+++ b/settings/Controller/AdminSettingsController.php
@@ -65,7 +65,7 @@ class AdminSettingsController extends Controller {
*/
public function index($section) {
$this->navigationManager->setActiveEntry('admin');
- return $this->getIndexResponse($section);
+ return $this->getIndexResponse('admin', $section);
}
/**
diff --git a/settings/Controller/CommonSettingsTrait.php b/settings/Controller/CommonSettingsTrait.php
index 4854f405861..ac316aa7f48 100644
--- a/settings/Controller/CommonSettingsTrait.php
+++ b/settings/Controller/CommonSettingsTrait.php
@@ -36,14 +36,14 @@ trait CommonSettingsTrait {
* @param string $currentSection
* @return array
*/
- private function getNavigationParameters($currentSection) {
+ private function getNavigationParameters($currentType, $currentSection) {
$templateParameters = [
- 'personal' => $this->formatPersonalSections($currentSection),
+ 'personal' => $this->formatPersonalSections($currentType, $currentSection),
'admin' => []
];
if(\OC_User::isAdminUser(\OC_User::getUser())) {
- $templateParameters['admin'] = $this->formatAdminSections($currentSection);
+ $templateParameters['admin'] = $this->formatAdminSections($currentType, $currentSection);
}
return [
@@ -51,7 +51,7 @@ trait CommonSettingsTrait {
];
}
- protected function formatSections($sections, $currentSection, $type) {
+ protected function formatSections($sections, $currentSection, $type, $currentType) {
$templateParameters = [];
/** @var \OCP\Settings\ISection[] $prioritizedSections */
foreach($sections as $prioritizedSections) {
@@ -70,10 +70,13 @@ trait CommonSettingsTrait {
$icon = $section->getIcon();
}
+ $active = $section->getID() === $currentSection
+ && $type === $currentType;
+
$templateParameters[] = [
'anchor' => $section->getID(),
'section-name' => $section->getName(),
- 'active' => $section->getID() === $currentSection,
+ 'active' => $active,
'icon' => $icon,
];
}
@@ -81,16 +84,16 @@ trait CommonSettingsTrait {
return $templateParameters;
}
- protected function formatPersonalSections($currentSections) {
+ protected function formatPersonalSections($currentType, $currentSections) {
$sections = $this->settingsManager->getPersonalSections();
- $templateParameters = $this->formatSections($sections, $currentSections, 'personal');
+ $templateParameters = $this->formatSections($sections, $currentSections, 'personal', $currentType);
return $templateParameters;
}
- protected function formatAdminSections($currentSections) {
+ protected function formatAdminSections($currentType, $currentSections) {
$sections = $this->settingsManager->getAdminSections();
- $templateParameters = $this->formatSections($sections, $currentSections, 'admin');
+ $templateParameters = $this->formatSections($sections, $currentSections, 'admin', $currentType);
return $templateParameters;
}
@@ -111,9 +114,9 @@ trait CommonSettingsTrait {
return ['content' => $html];
}
- private function getIndexResponse($section) {
+ private function getIndexResponse($type, $section) {
$templateParams = [];
- $templateParams = array_merge($templateParams, $this->getNavigationParameters($section));
+ $templateParams = array_merge($templateParams, $this->getNavigationParameters($type, $section));
$templateParams = array_merge($templateParams, $this->getSettings($section));
return new TemplateResponse('settings', 'settings/frame', $templateParams);
diff --git a/settings/Controller/PersonalSettingsController.php b/settings/Controller/PersonalSettingsController.php
index 3ccef025a72..7e2d62961b7 100644
--- a/settings/Controller/PersonalSettingsController.php
+++ b/settings/Controller/PersonalSettingsController.php
@@ -57,7 +57,8 @@ class PersonalSettingsController extends Controller {
*/
public function index($section) {
$this->navigationManager->setActiveEntry('personal');
- return $this->getIndexResponse($section);
+ return $this->getIndexResponse('personal', $section);
+
}
/**