summaryrefslogtreecommitdiffstats
path: root/apps/theming/lib
diff options
context:
space:
mode:
authorJulius Härtl <jus@bitgrid.net>2018-01-09 23:11:49 +0100
committerJulius Härtl <jus@bitgrid.net>2018-01-10 13:23:22 +0100
commitd4e106f2b34d4300ec743d3f6f7c8d9847c3e406 (patch)
tree3d8aef6327a538713f66b640a275b1ed70ec6c26 /apps/theming/lib
parent9c017084e50a20591e3b5a5c2842101a540e7fb2 (diff)
downloadnextcloud-server-d4e106f2b34d4300ec743d3f6f7c8d9847c3e406.tar.gz
nextcloud-server-d4e106f2b34d4300ec743d3f6f7c8d9847c3e406.zip
More detailed theming capabilities
This will allow clients to easily check if a custom background is used Signed-off-by: Julius Härtl <jus@bitgrid.net>
Diffstat (limited to 'apps/theming/lib')
-rw-r--r--apps/theming/lib/Capabilities.php2
-rw-r--r--apps/theming/lib/ThemingDefaults.php15
-rw-r--r--apps/theming/lib/Util.php12
3 files changed, 17 insertions, 12 deletions
diff --git a/apps/theming/lib/Capabilities.php b/apps/theming/lib/Capabilities.php
index 1b6bb8927be..a75403a1fd5 100644
--- a/apps/theming/lib/Capabilities.php
+++ b/apps/theming/lib/Capabilities.php
@@ -81,6 +81,8 @@ class Capabilities implements IPublicCapability {
'background' => $backgroundLogo === 'backgroundColor' ?
$this->theming->getColorPrimary() :
$this->url->getAbsoluteURL($this->theming->getBackground()),
+ 'background-plain' => $backgroundLogo === 'backgroundColor',
+ 'background-default' => !$this->util->isBackgroundThemed(),
],
];
}
diff --git a/apps/theming/lib/ThemingDefaults.php b/apps/theming/lib/ThemingDefaults.php
index 05d387e6273..9dcc981817e 100644
--- a/apps/theming/lib/ThemingDefaults.php
+++ b/apps/theming/lib/ThemingDefaults.php
@@ -196,22 +196,13 @@ class ThemingDefaults extends \OC_Defaults {
* @return string
*/
public function getBackground() {
- $backgroundLogo = $this->config->getAppValue('theming', 'backgroundMime',false);
-
- $backgroundExists = true;
- try {
- $this->appData->getFolder('images')->getFile('background');
- } catch (\Exception $e) {
- $backgroundExists = false;
- }
-
$cacheBusterCounter = $this->config->getAppValue('theming', 'cachebuster', '0');
- if(!$backgroundLogo || !$backgroundExists) {
- return $this->urlGenerator->imagePath('core','background.png') . '?v=' . $cacheBusterCounter;
+ if($this->util->isBackgroundThemed()) {
+ return $this->urlGenerator->linkToRoute('theming.Theming.getLoginBackground') . '?v=' . $cacheBusterCounter;
}
- return $this->urlGenerator->linkToRoute('theming.Theming.getLoginBackground') . '?v=' . $cacheBusterCounter;
+ return $this->urlGenerator->imagePath('core','background.png') . '?v=' . $cacheBusterCounter;
}
/**
diff --git a/apps/theming/lib/Util.php b/apps/theming/lib/Util.php
index 6a1aa672108..2f6f4128365 100644
--- a/apps/theming/lib/Util.php
+++ b/apps/theming/lib/Util.php
@@ -235,4 +235,16 @@ class Util {
return false;
}
+ public function isBackgroundThemed() {
+ $backgroundLogo = $this->config->getAppValue('theming', 'backgroundMime',false);
+
+ $backgroundExists = true;
+ try {
+ $this->appData->getFolder('images')->getFile('background');
+ } catch (\Exception $e) {
+ $backgroundExists = false;
+ }
+ return $backgroundLogo && $backgroundLogo !== 'backgroundColor' && $backgroundExists;
+ }
+
}