summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoeland Jago Douma <rullzer@users.noreply.github.com>2016-08-26 15:02:21 +0200
committerGitHub <noreply@github.com>2016-08-26 15:02:21 +0200
commit53725d4d15680f7254427dac92e231c3fe669d0b (patch)
tree6dbfe408e39b693a15b96843d486b8080cbf450c
parent00bb9294eddafd362042152ac7ab9ab0ec716ac3 (diff)
parenta7273f1658ecbd51fbc68b35afdf32e9836dac13 (diff)
downloadnextcloud-server-53725d4d15680f7254427dac92e231c3fe669d0b.tar.gz
nextcloud-server-53725d4d15680f7254427dac92e231c3fe669d0b.zip
Merge pull request #771 from nextcloud/theming-fixes
Theming: Fix missing color usage
-rw-r--r--apps/federatedfilesharing/settings-personal.php22
-rw-r--r--apps/federatedfilesharing/templates/settings-personal.php15
-rw-r--r--apps/theming/lib/Controller/ThemingController.php24
-rw-r--r--apps/theming/tests/Controller/ThemingControllerTest.php101
-rw-r--r--lib/private/Server.php1
5 files changed, 146 insertions, 17 deletions
diff --git a/apps/federatedfilesharing/settings-personal.php b/apps/federatedfilesharing/settings-personal.php
index a937106ce0e..92f96d1ba40 100644
--- a/apps/federatedfilesharing/settings-personal.php
+++ b/apps/federatedfilesharing/settings-personal.php
@@ -24,6 +24,7 @@
*/
use OCA\FederatedFileSharing\AppInfo\Application;
+use OCA\Theming\Template;
\OC_Util::checkLoggedIn();
@@ -40,15 +41,32 @@ if (count($matches) > 0 && $matches[1] <= 9) {
$cloudID = \OC::$server->getUserSession()->getUser()->getCloudId();
$url = 'https://nextcloud.com/federation#' . $cloudID;
-$ownCloudLogoPath = \OC::$server->getURLGenerator()->imagePath('core', 'logo-icon.svg');
+$logoPath = \OC::$server->getURLGenerator()->imagePath('core', 'logo-icon.svg');
+$theme = \OC::$server->getThemingDefaults();
+$color = $theme->getMailHeaderColor();
+$textColor = "#ffffff";
+if(\OC::$server->getAppManager()->isEnabledForUser("theming")) {
+ $logoPath = $theme->getLogo();
+ try {
+ $util = \OC::$server->query("\OCA\Theming\Util");
+ if($util->invertTextColor($color)) {
+ $textColor = "#000000";
+ }
+ } catch (OCP\AppFramework\QueryException $e) {
+
+ }
+}
+
$tmpl = new OCP\Template('federatedfilesharing', 'settings-personal');
$tmpl->assign('outgoingServer2serverShareEnabled', $federatedShareProvider->isOutgoingServer2serverShareEnabled());
$tmpl->assign('message_with_URL', $l->t('Share with me through my #Nextcloud Federated Cloud ID, see %s', [$url]));
$tmpl->assign('message_without_URL', $l->t('Share with me through my #Nextcloud Federated Cloud ID', [$cloudID]));
-$tmpl->assign('owncloud_logo_path', $ownCloudLogoPath);
+$tmpl->assign('logoPath', $logoPath);
$tmpl->assign('reference', $url);
$tmpl->assign('cloudId', $cloudID);
$tmpl->assign('showShareIT', !$isIE8);
+$tmpl->assign('color', $color);
+$tmpl->assign('textColor', $textColor);
return $tmpl->fetchPage();
diff --git a/apps/federatedfilesharing/templates/settings-personal.php b/apps/federatedfilesharing/templates/settings-personal.php
index aad1e385982..0f51e6a5c4e 100644
--- a/apps/federatedfilesharing/templates/settings-personal.php
+++ b/apps/federatedfilesharing/templates/settings-personal.php
@@ -55,22 +55,17 @@ if ($_['showShareIT']) {
<div class="hidden" id="oca-files-sharing-add-to-your-website-expanded">
<p style="margin: 10px 0">
<a target="_blank" rel="noreferrer" href="<?php p($_['reference']); ?>"
- style="padding:10px;background-color:#0082c9;color:#fff;border-radius:3px;padding-left:4px;">
- <img src="<?php p($_['owncloud_logo_path']); ?>"
- style="width:50px;position:relative;top:8px;">
+ style="padding:10px;background-color:<?php p($_['color']); ?>;color:<?php p($_['textColor']); ?>;border-radius:3px;padding-left:4px;">
+ <span style="background-image:url(<?php p(\OC::$server->getURLGenerator()->getAbsoluteURL($_['logoPath'])); ?>);width:50px;height:30px;position:relative;top:8px;background-size:contain;display:inline-block;background-repeat:no-repeat; background-position: center center;"></span>
<?php p($l->t('Share with me via Nextcloud')); ?>
</a>
</p>
<p>
<?php p($l->t('HTML Code:')); ?>
- <xmp><a target="_blank" rel="noreferrer" href="<?php p($_['reference']); ?>"
- style="padding:10px;background-color:#0082c9;color:#fff;border-radius:3px;padding-left:4px;">
- <img src="<?php p(\OC::$server->getURLGenerator()->getAbsoluteURL($_['owncloud_logo_path'])); ?>"
- style="width:50px;position:relative;top:8px;">
- <?php p($l->t('Share with me via Nextcloud')); ?>
-
-</a></xmp>
+ <xmp><a target="_blank" rel="noreferrer" href="<?php p($_['reference']); ?>" style="padding:10px;background-color:<?php p($_['color']); ?>;color:<?php p($_['textColor']); ?>;border-radius:3px;padding-left:4px;">
+<span style="background-image:url(<?php p(\OC::$server->getURLGenerator()->getAbsoluteURL($_['logoPath'])); ?>);width:50px;height:30px;position:relative;top:8px;background-size:contain;display:inline-block;background-repeat:no-repeat; background-position: center center;"></span>
+<?php p($l->t('Share with me via Nextcloud')); ?></a></xmp>
</p>
</div>
<?php } ?>
diff --git a/apps/theming/lib/Controller/ThemingController.php b/apps/theming/lib/Controller/ThemingController.php
index 8d3e2a5f2e2..8a7aaec6b5e 100644
--- a/apps/theming/lib/Controller/ThemingController.php
+++ b/apps/theming/lib/Controller/ThemingController.php
@@ -286,6 +286,29 @@ class ThemingController extends Controller {
$responseCss .= 'input[type="radio"].radio:checked:not(.radio--white):not(:disabled) + label:before {' .
'background-image: url(\'data:image/svg+xml;base64,'.$this->util->generateRadioButton($elementColor).'\');' .
"}\n";
+ $responseCss .= '.primary, input[type="submit"].primary, input[type="button"].primary, button.primary, .button.primary,' .
+ '.primary:active, input[type="submit"].primary:active, input[type="button"].primary:active, button.primary:active, .button.primary:active,' .
+ '.primary:disabled, input[type="submit"].primary:disabled, input[type="button"].primary:disabled, button.primary:disabled, .button.primary:disabled,' .
+ '.primary:disabled:hover, input[type="submit"].primary:disabled:hover, input[type="button"].primary:disabled:hover, button.primary:disabled:hover, .button.primary:disabled:hover,' .
+ '.primary:disabled:focus, input[type="submit"].primary:disabled:focus, input[type="button"].primary:disabled:focus, button.primary:disabled:focus, .button.primary:disabled:focus {' .
+ 'border: 1px solid '.$elementColor.';'.
+ 'background-color: '.$elementColor.';'.
+ 'opacity: 0.8' .
+ "}\n" .
+ '.primary:hover, input[type="submit"].primary:hover, input[type="button"].primary:hover, button.primary:hover, .button.primary:hover,' .
+ '.primary:focus, input[type="submit"].primary:focus, input[type="button"].primary:focus, button.primary:focus, .button.primary:focus {' .
+ 'border: 1px solid '.$elementColor.';'.
+ 'background-color: '.$elementColor.';'.
+ 'opacity: 1.0;' .
+ "}\n";
+ $responseCss .= '.ui-widget-header { border: 1px solid ' . $color . '; background: '. $color . '; color: #ffffff;' . "}\n";
+ $responseCss .= '.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active {' .
+ 'border: 1px solid ' . $color . ';' .
+ 'color: ' . $elementColor . ';' .
+ "}\n";
+ $responseCss .= '.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited {' .
+ 'color: ' . $elementColor . ';' .
+ "}\n";
$responseCss .= '
#firstrunwizard .firstrunwizard-header {
background-color: ' . $color . ';
@@ -328,6 +351,7 @@ class ThemingController extends Controller {
$responseCss .= '.searchbox input[type="search"] { background: transparent url(\'' . \OC::$WEBROOT . '/core/img/actions/search.svg\') no-repeat 6px center; color: #000; }' . "\n";
$responseCss .= '.searchbox input[type="search"]:focus,.searchbox input[type="search"]:active,.searchbox input[type="search"]:valid { color: #000; border: 1px solid rgba(0, 0, 0, .5); }' . "\n";
$responseCss .= '.nc-theming-contrast {color: #000000}' . "\n";
+ $responseCss .= '.ui-widget-header { color: #000000; }' . "\n";
} else {
$responseCss .= '.nc-theming-contrast {color: #ffffff}' . "\n";
}
diff --git a/apps/theming/tests/Controller/ThemingControllerTest.php b/apps/theming/tests/Controller/ThemingControllerTest.php
index 688e3d62bff..da2137e9da0 100644
--- a/apps/theming/tests/Controller/ThemingControllerTest.php
+++ b/apps/theming/tests/Controller/ThemingControllerTest.php
@@ -383,7 +383,29 @@ class ThemingControllerTest extends TestCase {
$expectedData .= 'input[type="radio"].radio:checked:not(.radio--white):not(:disabled) + label:before {' .
'background-image: url(\'data:image/svg+xml;base64,'.$this->util->generateRadioButton($color).'\');' .
"}\n";
-
+ $expectedData .= '.primary, input[type="submit"].primary, input[type="button"].primary, button.primary, .button.primary,' .
+ '.primary:active, input[type="submit"].primary:active, input[type="button"].primary:active, button.primary:active, .button.primary:active,' .
+ '.primary:disabled, input[type="submit"].primary:disabled, input[type="button"].primary:disabled, button.primary:disabled, .button.primary:disabled,' .
+ '.primary:disabled:hover, input[type="submit"].primary:disabled:hover, input[type="button"].primary:disabled:hover, button.primary:disabled:hover, .button.primary:disabled:hover,' .
+ '.primary:disabled:focus, input[type="submit"].primary:disabled:focus, input[type="button"].primary:disabled:focus, button.primary:disabled:focus, .button.primary:disabled:focus {' .
+ 'border: 1px solid '.$color .';'.
+ 'background-color: '.$color.';'.
+ 'opacity: 0.8' .
+ "}\n" .
+ '.primary:hover, input[type="submit"].primary:hover, input[type="button"].primary:hover, button.primary:hover, .button.primary:hover,' .
+ '.primary:focus, input[type="submit"].primary:focus, input[type="button"].primary:focus, button.primary:focus, .button.primary:focus {' .
+ 'border: 1px solid '.$color.';'.
+ 'background-color: '.$color.';'.
+ 'opacity: 1.0;' .
+ "}\n";
+ $expectedData .= '.ui-widget-header { border: 1px solid ' . $color . '; background: '. $color . '; color: #ffffff;' . "}\n";
+ $expectedData .= '.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active {' .
+ 'border: 1px solid ' . $color . ';' .
+ 'color: ' . $color . ';' .
+ "}\n";
+ $expectedData .= '.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited {' .
+ 'color: ' . $color . ';' .
+ "}\n";
$expectedData .= '
#firstrunwizard .firstrunwizard-header {
background-color: ' . $color . ';
@@ -406,6 +428,7 @@ class ThemingControllerTest extends TestCase {
public function testGetStylesheetWithOnlyColorInvert() {
$color = '#fff';
+ $elementColor = '#555555';
$this->config
->expects($this->at(0))
@@ -442,7 +465,29 @@ class ThemingControllerTest extends TestCase {
$expectedData .= 'input[type="radio"].radio:checked:not(.radio--white):not(:disabled) + label:before {' .
'background-image: url(\'data:image/svg+xml;base64,'.$this->util->generateRadioButton('#555555').'\');' .
"}\n";
-
+ $expectedData .= '.primary, input[type="submit"].primary, input[type="button"].primary, button.primary, .button.primary,' .
+ '.primary:active, input[type="submit"].primary:active, input[type="button"].primary:active, button.primary:active, .button.primary:active,' .
+ '.primary:disabled, input[type="submit"].primary:disabled, input[type="button"].primary:disabled, button.primary:disabled, .button.primary:disabled,' .
+ '.primary:disabled:hover, input[type="submit"].primary:disabled:hover, input[type="button"].primary:disabled:hover, button.primary:disabled:hover, .button.primary:disabled:hover,' .
+ '.primary:disabled:focus, input[type="submit"].primary:disabled:focus, input[type="button"].primary:disabled:focus, button.primary:disabled:focus, .button.primary:disabled:focus {' .
+ 'border: 1px solid #555555;'.
+ 'background-color: #555555;'.
+ 'opacity: 0.8' .
+ "}\n" .
+ '.primary:hover, input[type="submit"].primary:hover, input[type="button"].primary:hover, button.primary:hover, .button.primary:hover,' .
+ '.primary:focus, input[type="submit"].primary:focus, input[type="button"].primary:focus, button.primary:focus, .button.primary:focus {' .
+ 'border: 1px solid #555555;'.
+ 'background-color: #555555;'.
+ 'opacity: 1.0;' .
+ "}\n";
+ $expectedData .= '.ui-widget-header { border: 1px solid ' . $color . '; background: '. $color . '; color: #ffffff;' . "}\n";
+ $expectedData .= '.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active {' .
+ 'border: 1px solid ' . $color . ';' .
+ 'color: ' . $elementColor . ';' .
+ "}\n";
+ $expectedData .= '.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited {' .
+ 'color: ' . $elementColor . ';' .
+ "}\n";
$expectedData .= '
#firstrunwizard .firstrunwizard-header {
background-color: ' . $color . ';
@@ -458,6 +503,7 @@ class ThemingControllerTest extends TestCase {
$expectedData .= '.searchbox input[type="search"] { background: transparent url(\'' . \OC::$WEBROOT . '/core/img/actions/search.svg\') no-repeat 6px center; color: #000; }' . "\n";
$expectedData .= '.searchbox input[type="search"]:focus,.searchbox input[type="search"]:active,.searchbox input[type="search"]:valid { color: #000; border: 1px solid rgba(0, 0, 0, .5); }' . "\n";
$expectedData .= '.nc-theming-contrast {color: #000000}' . "\n";
+ $expectedData .= '.ui-widget-header { color: #000000; }' . "\n";
$expected = new Http\DataDownloadResponse($expectedData, 'style', 'text/css');
@@ -585,6 +631,29 @@ class ThemingControllerTest extends TestCase {
$expectedData .= 'input[type="radio"].radio:checked:not(.radio--white):not(:disabled) + label:before {' .
'background-image: url(\'data:image/svg+xml;base64,'.$this->util->generateRadioButton($color).'\');' .
"}\n";
+ $expectedData .= '.primary, input[type="submit"].primary, input[type="button"].primary, button.primary, .button.primary,' .
+ '.primary:active, input[type="submit"].primary:active, input[type="button"].primary:active, button.primary:active, .button.primary:active,' .
+ '.primary:disabled, input[type="submit"].primary:disabled, input[type="button"].primary:disabled, button.primary:disabled, .button.primary:disabled,' .
+ '.primary:disabled:hover, input[type="submit"].primary:disabled:hover, input[type="button"].primary:disabled:hover, button.primary:disabled:hover, .button.primary:disabled:hover,' .
+ '.primary:disabled:focus, input[type="submit"].primary:disabled:focus, input[type="button"].primary:disabled:focus, button.primary:disabled:focus, .button.primary:disabled:focus {' .
+ 'border: 1px solid '.$color .';'.
+ 'background-color: '.$color.';'.
+ 'opacity: 0.8' .
+ "}\n" .
+ '.primary:hover, input[type="submit"].primary:hover, input[type="button"].primary:hover, button.primary:hover, .button.primary:hover,' .
+ '.primary:focus, input[type="submit"].primary:focus, input[type="button"].primary:focus, button.primary:focus, .button.primary:focus {' .
+ 'border: 1px solid '.$color.';'.
+ 'background-color: '.$color.';'.
+ 'opacity: 1.0;' .
+ "}\n";
+ $expectedData .= '.ui-widget-header { border: 1px solid ' . $color . '; background: '. $color . '; color: #ffffff;' . "}\n";
+ $expectedData .= '.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active {' .
+ 'border: 1px solid ' . $color . ';' .
+ 'color: ' . $color . ';' .
+ "}\n";
+ $expectedData .= '.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited {' .
+ 'color: ' . $color . ';' .
+ "}\n";
$expectedData .= '
#firstrunwizard .firstrunwizard-header {
background-color: ' . $color . ';
@@ -624,6 +693,7 @@ class ThemingControllerTest extends TestCase {
public function testGetStylesheetWithAllCombinedInverted() {
$color = '#fff';
+ $elementColor = '#555555';
$this->config
->expects($this->at(0))
@@ -646,7 +716,6 @@ class ThemingControllerTest extends TestCase {
->with('theming', 'backgroundMime', '')
->willReturn('image/png');
-
$expectedData = sprintf(
'#body-user #header,#body-settings #header,#body-public #header,#body-login,.searchbox input[type="search"]:focus,.searchbox input[type="search"]:active,.searchbox input[type="search"]:valid {background-color: %s}' . "\n",
$color);
@@ -661,6 +730,29 @@ class ThemingControllerTest extends TestCase {
$expectedData .= 'input[type="radio"].radio:checked:not(.radio--white):not(:disabled) + label:before {' .
'background-image: url(\'data:image/svg+xml;base64,'.$this->util->generateRadioButton('#555555').'\');' .
"}\n";
+ $expectedData .= '.primary, input[type="submit"].primary, input[type="button"].primary, button.primary, .button.primary,' .
+ '.primary:active, input[type="submit"].primary:active, input[type="button"].primary:active, button.primary:active, .button.primary:active,' .
+ '.primary:disabled, input[type="submit"].primary:disabled, input[type="button"].primary:disabled, button.primary:disabled, .button.primary:disabled,' .
+ '.primary:disabled:hover, input[type="submit"].primary:disabled:hover, input[type="button"].primary:disabled:hover, button.primary:disabled:hover, .button.primary:disabled:hover,' .
+ '.primary:disabled:focus, input[type="submit"].primary:disabled:focus, input[type="button"].primary:disabled:focus, button.primary:disabled:focus, .button.primary:disabled:focus {' .
+ 'border: 1px solid #555555;'.
+ 'background-color: #555555;'.
+ 'opacity: 0.8' .
+ "}\n" .
+ '.primary:hover, input[type="submit"].primary:hover, input[type="button"].primary:hover, button.primary:hover, .button.primary:hover,' .
+ '.primary:focus, input[type="submit"].primary:focus, input[type="button"].primary:focus, button.primary:focus, .button.primary:focus {' .
+ 'border: 1px solid #555555;'.
+ 'background-color: #555555;'.
+ 'opacity: 1.0;' .
+ "}\n";
+ $expectedData .= '.ui-widget-header { border: 1px solid ' . $color . '; background: '. $color . '; color: #ffffff;' . "}\n";
+ $expectedData .= '.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active {' .
+ 'border: 1px solid ' . $color . ';' .
+ 'color: ' . $elementColor . ';' .
+ "}\n";
+ $expectedData .= '.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited {' .
+ 'color: ' . $elementColor . ';' .
+ "}\n";
$expectedData .= '
#firstrunwizard .firstrunwizard-header {
background-color: ' . $color . ';
@@ -694,8 +786,9 @@ class ThemingControllerTest extends TestCase {
$expectedData .= '.searchbox input[type="search"] { background: transparent url(\'' . \OC::$WEBROOT . '/core/img/actions/search.svg\') no-repeat 6px center; color: #000; }' . "\n";
$expectedData .= '.searchbox input[type="search"]:focus,.searchbox input[type="search"]:active,.searchbox input[type="search"]:valid { color: #000; border: 1px solid rgba(0, 0, 0, .5); }' . "\n";
$expectedData .= '.nc-theming-contrast {color: #000000}' . "\n";
- $expected = new Http\DataDownloadResponse($expectedData, 'style', 'text/css');
+ $expectedData .= '.ui-widget-header { color: #000000; }' . "\n";
+ $expected = new Http\DataDownloadResponse($expectedData, 'style', 'text/css');
$expected->cacheFor(3600);
$expected->addHeader('Expires', date(\DateTime::RFC2822, 123));
@$this->assertEquals($expected, $this->themingController->getStylesheet());
diff --git a/lib/private/Server.php b/lib/private/Server.php
index 088908b5f96..6f6d403210d 100644
--- a/lib/private/Server.php
+++ b/lib/private/Server.php
@@ -1356,7 +1356,6 @@ class Server extends ServerContainer implements IServerContainer {
}
/**
- * @internal Not public by intention.
* @return \OC_Defaults
*/
public function getThemingDefaults() {