diff options
author | Julius Härtl <jus@bitgrid.net> | 2022-08-26 23:44:48 +0300 |
---|---|---|
committer | Julius Härtl <jus@bitgrid.net> | 2022-09-01 15:15:40 +0300 |
commit | ac134f5f47f9c5ef09194e674b990f0ec491541b (patch) | |
tree | f44bc9a5e7e6bf0d6f4788519b1e4cceae371631 /apps/theming | |
parent | 702b0cccd6f0d7c44a8199154d738beeb3a34086 (diff) |
Restore dashboard layout
Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps/theming')
-rw-r--r-- | apps/theming/lib/Themes/DefaultTheme.php | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/apps/theming/lib/Themes/DefaultTheme.php b/apps/theming/lib/Themes/DefaultTheme.php index 56348069ff4..18a6e209f6f 100644 --- a/apps/theming/lib/Themes/DefaultTheme.php +++ b/apps/theming/lib/Themes/DefaultTheme.php @@ -28,9 +28,12 @@ use OCA\Theming\ImageManager; use OCA\Theming\ThemingDefaults; use OCA\Theming\Util; use OCA\Theming\ITheme; +use OCP\App\IAppManager; use OCP\IConfig; use OCP\IL10N; use OCP\IURLGenerator; +use OCP\IUserSession; +use OCP\Server; class DefaultTheme implements ITheme { public Util $util; @@ -93,7 +96,7 @@ class DefaultTheme implements ITheme { $colorPrimaryElement = $this->util->elementColor($this->primaryColor); $colorPrimaryElementLight = $this->util->mix($colorPrimaryElement, $colorMainBackground, -80); - $hasCustomLogoHeader = $this->imageManager->hasImage('logo') || $this->imageManager->hasImage('logoheader'); + $hasCustomLogoHeader = $this->imageManager->hasImage('logo') || $this->imageManager->hasImage('logoheader'); $hasCustomPrimaryColour = !empty($this->config->getAppValue('theming', 'color')); $variables = [ @@ -212,7 +215,7 @@ class DefaultTheme implements ITheme { } // Register image variables only if custom-defined - foreach(['logo', 'logoheader', 'favicon', 'background'] as $image) { + foreach (['logo', 'logoheader', 'favicon', 'background'] as $image) { if ($this->imageManager->hasImage($image)) { $imageUrl = $this->imageManager->getImageUrl($image); if ($image === 'background') { @@ -231,6 +234,19 @@ class DefaultTheme implements ITheme { $variables["--image-logoheader-custom"] = 'true'; } + $appManager = Server::get(IAppManager::class); + $userSession = Server::get(IUserSession::class); + $user = $userSession->getUser(); + if ($appManager->isEnabledForUser('dashboard') && $user !== null) { + $dashboardBackground = $this->config->getUserValue($user->getUID(), 'dashboard', 'background', 'default'); + + if ($dashboardBackground === 'custom') { + $variables['--image-main-background'] = "url('" . $this->urlGenerator->linkToRouteAbsolute('dashboard.dashboard.getBackground') . "')"; + } elseif ($dashboardBackground !== 'default' && substr($dashboardBackground, 0, 1) !== '#') { + $variables['--image-main-background'] = "url('/apps/dashboard/img/" . $dashboardBackground . "')"; + } + } + return $variables; } |