diff --git a/apps/federatedfilesharing/settings-personal.php b/apps/federatedfilesharing/settings-personal.php index a937106ce0..92f96d1ba4 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 aad1e38598..0f51e6a5c4 100644 --- a/apps/federatedfilesharing/templates/settings-personal.php +++ b/apps/federatedfilesharing/templates/settings-personal.php @@ -55,22 +55,17 @@ if ($_['showShareIT']) { diff --git a/apps/theming/lib/Controller/ThemingController.php b/apps/theming/lib/Controller/ThemingController.php index 8d3e2a5f2e..8a7aaec6b5 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 688e3d62bf..da2137e9da 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 088908b5f9..6f6d403210 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() {