diff options
author | Björn Schießle <bjoern@schiessle.org> | 2016-07-18 15:59:47 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-07-18 15:59:47 +0200 |
commit | ea470f877760c72b1e8b865ba600d5bd483027c0 (patch) | |
tree | 3b4c4fa327d8e6521c782e6e45f1d73eb95d70ec /apps | |
parent | 68735c188c0f9777f932f55b1c290039c9d6e433 (diff) | |
parent | ec6f6969789ca2f455c0d2fd04557337c782176b (diff) | |
download | nextcloud-server-ea470f877760c72b1e8b865ba600d5bd483027c0.tar.gz nextcloud-server-ea470f877760c72b1e8b865ba600d5bd483027c0.zip |
Merge pull request #405 from nextcloud/theming-fixes
Theming fixes
Diffstat (limited to 'apps')
-rw-r--r-- | apps/dav/lib/Connector/PublicAuth.php | 2 | ||||
-rw-r--r-- | apps/dav/lib/Connector/Sabre/Auth.php | 2 | ||||
-rw-r--r-- | apps/federation/lib/DAV/FedAuth.php | 2 | ||||
-rw-r--r-- | apps/theming/appinfo/info.xml | 8 | ||||
-rw-r--r-- | apps/theming/lib/template.php | 13 | ||||
-rw-r--r-- | apps/theming/tests/lib/TemplateTest.php | 46 |
6 files changed, 69 insertions, 4 deletions
diff --git a/apps/dav/lib/Connector/PublicAuth.php b/apps/dav/lib/Connector/PublicAuth.php index 4e63ca1d29e..9b386c7609d 100644 --- a/apps/dav/lib/Connector/PublicAuth.php +++ b/apps/dav/lib/Connector/PublicAuth.php @@ -65,7 +65,7 @@ class PublicAuth extends AbstractBasic { $this->session = $session; // setup realm - $defaults = new \OC_Defaults(); + $defaults = new \OCP\Defaults(); $this->realm = $defaults->getName(); } diff --git a/apps/dav/lib/Connector/Sabre/Auth.php b/apps/dav/lib/Connector/Sabre/Auth.php index 82c2711b560..28e4ae2bcde 100644 --- a/apps/dav/lib/Connector/Sabre/Auth.php +++ b/apps/dav/lib/Connector/Sabre/Auth.php @@ -78,7 +78,7 @@ class Auth extends AbstractBasic { $this->principalPrefix = $principalPrefix; // setup realm - $defaults = new \OC_Defaults(); + $defaults = new \OCP\Defaults(); $this->realm = $defaults->getName(); } diff --git a/apps/federation/lib/DAV/FedAuth.php b/apps/federation/lib/DAV/FedAuth.php index 21c0d61487c..ff83932283c 100644 --- a/apps/federation/lib/DAV/FedAuth.php +++ b/apps/federation/lib/DAV/FedAuth.php @@ -38,7 +38,7 @@ class FedAuth extends AbstractBasic { $this->principalPrefix = 'principals/system/'; // setup realm - $defaults = new \OC_Defaults(); + $defaults = new \OCP\Defaults(); $this->realm = $defaults->getName(); } diff --git a/apps/theming/appinfo/info.xml b/apps/theming/appinfo/info.xml index 58c839f2758..6db66632a45 100644 --- a/apps/theming/appinfo/info.xml +++ b/apps/theming/appinfo/info.xml @@ -5,11 +5,17 @@ <description>Adjust the Nextcloud theme</description> <licence>AGPL</licence> <author>Nextcloud</author> - <version>0.1.0</version> + <version>0.2.0</version> <namespace>Theming</namespace> <category>other</category> + <dependencies> <owncloud min-version="9.0" max-version="9.1" /> </dependencies> + + <types> + <logging/> + </types> + <default_enable/> </info> diff --git a/apps/theming/lib/template.php b/apps/theming/lib/template.php index a09a854ca69..436dfe86a03 100644 --- a/apps/theming/lib/template.php +++ b/apps/theming/lib/template.php @@ -77,6 +77,10 @@ class Template extends \OC_Defaults { return $this->config->getAppValue('theming', 'name', $this->name); } + public function getHTMLName() { + return $this->config->getAppValue('theming', 'name', $this->name); + } + public function getTitle() { return $this->config->getAppValue('theming', 'name', $this->name); } @@ -93,6 +97,15 @@ class Template extends \OC_Defaults { return $this->config->getAppValue('theming', 'slogan', $this->slogan); } + public function getShortFooter() { + $slogan = $this->getSlogan(); + $footer = '<a href="'. $this->getBaseUrl() . '" target="_blank"' . + ' rel="noreferrer">' .$this->getEntity() . '</a>'. + ($slogan !== '' ? ' – ' . $slogan : ''); + + return $footer; + } + /** * Color that is used for the header as well as for mail headers * diff --git a/apps/theming/tests/lib/TemplateTest.php b/apps/theming/tests/lib/TemplateTest.php index 1ee860f93c4..cd7115d2086 100644 --- a/apps/theming/tests/lib/TemplateTest.php +++ b/apps/theming/tests/lib/TemplateTest.php @@ -91,6 +91,26 @@ class TemplateTest extends TestCase { $this->assertEquals('MyCustomCloud', $this->template->getName()); } + public function testGetHTMLNameWithDefault() { + $this->config + ->expects($this->once()) + ->method('getAppValue') + ->with('theming', 'name', 'Nextcloud') + ->willReturn('Nextcloud'); + + $this->assertEquals('Nextcloud', $this->template->getHTMLName()); + } + + public function testGetHTMLNameWithCustom() { + $this->config + ->expects($this->once()) + ->method('getAppValue') + ->with('theming', 'name', 'Nextcloud') + ->willReturn('MyCustomCloud'); + + $this->assertEquals('MyCustomCloud', $this->template->getHTMLName()); + } + public function testGetTitleWithDefault() { $this->config ->expects($this->once()) @@ -172,6 +192,32 @@ class TemplateTest extends TestCase { $this->assertEquals('My custom Slogan', $this->template->getSlogan()); } + public function testGetShortFooter() { + $this->config + ->expects($this->exactly(3)) + ->method('getAppValue') + ->willReturnMap([ + ['theming', 'url', 'https://nextcloud.com/', 'url'], + ['theming', 'name', 'Nextcloud', 'Name'], + ['theming', 'slogan', 'Safe Data', 'Slogan'], + ]); + + $this->assertEquals('<a href="url" target="_blank" rel="noreferrer">Name</a> – Slogan', $this->template->getShortFooter()); + } + + public function testGetShortFooterEmptySlogan() { + $this->config + ->expects($this->exactly(3)) + ->method('getAppValue') + ->willReturnMap([ + ['theming', 'url', 'https://nextcloud.com/', 'url'], + ['theming', 'name', 'Nextcloud', 'Name'], + ['theming', 'slogan', 'Safe Data', ''], + ]); + + $this->assertEquals('<a href="url" target="_blank" rel="noreferrer">Name</a>', $this->template->getShortFooter()); + } + public function testGetMailHeaderColorWithDefault() { $this->config ->expects($this->once()) |