rename confusing getMailHeaderColor to getColorPrimary, ref #3491

Signed-off-by: Jan-Christoph Borchardt <hey@jancborchardt.net>
This commit is contained in:
Jan-Christoph Borchardt 2017-03-28 01:37:47 +02:00 committed by Roeland Jago Douma
parent 626d03e3d4
commit 9a75714c22
No known key found for this signature in database
GPG Key ID: F941078878347C0C
20 changed files with 37 additions and 37 deletions

View File

@ -6,7 +6,7 @@
<tr><td> <tr><td>
<table cellspacing="0" cellpadding="0" border="0" width="600px"> <table cellspacing="0" cellpadding="0" border="0" width="600px">
<tr> <tr>
<td colspan="2" bgcolor="<?php p($theme->getMailHeaderColor());?>"> <td colspan="2" bgcolor="<?php p($theme->getColorPrimary());?>">
<img src="<?php p(\OC::$server->getURLGenerator()->getAbsoluteURL(image_path('', 'logo-mail.png'))); ?>" alt="<?php p($theme->getName()); ?>"/> <img src="<?php p(\OC::$server->getURLGenerator()->getAbsoluteURL(image_path('', 'logo-mail.png'))); ?>" alt="<?php p($theme->getName()); ?>"/>
</td> </td>
</tr> </tr>

View File

@ -42,7 +42,7 @@ $cloudID = \OC::$server->getUserSession()->getUser()->getCloudId();
$url = 'https://nextcloud.com/federation#' . $cloudID; $url = 'https://nextcloud.com/federation#' . $cloudID;
$logoPath = \OC::$server->getURLGenerator()->imagePath('core', 'logo-icon.svg'); $logoPath = \OC::$server->getURLGenerator()->imagePath('core', 'logo-icon.svg');
$theme = \OC::$server->getThemingDefaults(); $theme = \OC::$server->getThemingDefaults();
$color = $theme->getMailHeaderColor(); $color = $theme->getColorPrimary();
$textColor = "#ffffff"; $textColor = "#ffffff";
if(\OC::$server->getAppManager()->isEnabledForUser("theming")) { if(\OC::$server->getAppManager()->isEnabledForUser("theming")) {
$logoPath = $theme->getLogo(); $logoPath = $theme->getLogo();

View File

@ -27,7 +27,7 @@
<tr><td> <tr><td>
<table cellspacing="0" cellpadding="0" border="0" width="600px"> <table cellspacing="0" cellpadding="0" border="0" width="600px">
<tr> <tr>
<td colspan="2" bgcolor="<?php p($theme->getMailHeaderColor());?>"> <td colspan="2" bgcolor="<?php p($theme->getColorPrimary());?>">
<img src="<?php p(\OC::$server->getURLGenerator()->getAbsoluteURL(image_path('', 'logo-mail.png'))); ?>" alt="<?php p($theme->getName()); ?>"/> <img src="<?php p(\OC::$server->getURLGenerator()->getAbsoluteURL(image_path('', 'logo-mail.png'))); ?>" alt="<?php p($theme->getName()); ?>"/>
</td> </td>
</tr> </tr>

View File

@ -60,7 +60,7 @@ class Capabilities implements ICapability {
'name' => $this->theming->getName(), 'name' => $this->theming->getName(),
'url' => $this->theming->getBaseUrl(), 'url' => $this->theming->getBaseUrl(),
'slogan' => $this->theming->getSlogan(), 'slogan' => $this->theming->getSlogan(),
'color' => $this->theming->getMailHeaderColor(), 'color' => $this->theming->getColorPrimary(),
'logo' => $this->url->getAbsoluteURL($this->theming->getLogo()), 'logo' => $this->url->getAbsoluteURL($this->theming->getLogo()),
'background' => $this->url->getAbsoluteURL($this->theming->getBackground()), 'background' => $this->url->getAbsoluteURL($this->theming->getBackground()),
], ],

View File

@ -451,8 +451,8 @@ class ThemingController extends Controller {
name: ' . json_encode($this->template->getName()) . ', name: ' . json_encode($this->template->getName()) . ',
url: ' . json_encode($this->template->getBaseUrl()) . ', url: ' . json_encode($this->template->getBaseUrl()) . ',
slogan: ' . json_encode($this->template->getSlogan()) . ', slogan: ' . json_encode($this->template->getSlogan()) . ',
color: ' . json_encode($this->template->getMailHeaderColor()) . ', color: ' . json_encode($this->template->getColorPrimary()) . ',
inverted: ' . json_encode($this->util->invertTextColor($this->template->getMailHeaderColor())) . ', inverted: ' . json_encode($this->util->invertTextColor($this->template->getColorPrimary())) . ',
cacheBuster: ' . json_encode($cacheBusterValue). ' cacheBuster: ' . json_encode($cacheBusterValue). '
}; };
})();'; })();';

View File

@ -97,7 +97,7 @@ class IconBuilder {
return false; return false;
} }
$color = $this->themingDefaults->getMailHeaderColor(); $color = $this->themingDefaults->getColorPrimary();
$mime = mime_content_type($appIcon); $mime = mime_content_type($appIcon);
// generate background image with rounded corners // generate background image with rounded corners
@ -178,7 +178,7 @@ class IconBuilder {
} }
$svg = file_get_contents($imageFile); $svg = file_get_contents($imageFile);
if ($svg !== false && $svg !== "") { if ($svg !== false && $svg !== "") {
$color = $this->util->elementColor($this->themingDefaults->getMailHeaderColor()); $color = $this->util->elementColor($this->themingDefaults->getColorPrimary());
$svg = $this->util->colorizeSvg($svg, $color); $svg = $this->util->colorizeSvg($svg, $color);
return $svg; return $svg;
} else { } else {

View File

@ -70,7 +70,7 @@ class Admin implements ISettings {
'name' => $this->themingDefaults->getEntity(), 'name' => $this->themingDefaults->getEntity(),
'url' => $this->themingDefaults->getBaseUrl(), 'url' => $this->themingDefaults->getBaseUrl(),
'slogan' => $this->themingDefaults->getSlogan(), 'slogan' => $this->themingDefaults->getSlogan(),
'color' => $this->themingDefaults->getMailHeaderColor(), 'color' => $this->themingDefaults->getColorPrimary(),
'logo' => $this->themingDefaults->getLogo(), 'logo' => $this->themingDefaults->getLogo(),
'logoMime' => $this->config->getAppValue('theming', 'logoMime', ''), 'logoMime' => $this->config->getAppValue('theming', 'logoMime', ''),
'background' => $this->themingDefaults->getBackground(), 'background' => $this->themingDefaults->getBackground(),

View File

@ -78,7 +78,7 @@ class ThemingDefaults extends \OC_Defaults {
$this->name = $defaults->getName(); $this->name = $defaults->getName();
$this->url = $defaults->getBaseUrl(); $this->url = $defaults->getBaseUrl();
$this->slogan = $defaults->getSlogan(); $this->slogan = $defaults->getSlogan();
$this->color = $defaults->getMailHeaderColor(); $this->color = $defaults->getColorPrimary();
} }
public function getName() { public function getName() {
@ -119,7 +119,7 @@ class ThemingDefaults extends \OC_Defaults {
* *
* @return string * @return string
*/ */
public function getMailHeaderColor() { public function getColorPrimary() {
return $this->config->getAppValue('theming', 'color', $this->color); return $this->config->getAppValue('theming', 'color', $this->color);
} }
@ -214,7 +214,7 @@ class ThemingDefaults extends \OC_Defaults {
$returnValue = $this->getSlogan(); $returnValue = $this->getSlogan();
break; break;
case 'color': case 'color':
$returnValue = $this->getMailHeaderColor(); $returnValue = $this->getColorPrimary();
break; break;
default: default:
$returnValue = ''; $returnValue = '';

View File

@ -106,7 +106,7 @@ class CapabilitiesTest extends TestCase {
->method('getSlogan') ->method('getSlogan')
->willReturn($slogan); ->willReturn($slogan);
$this->theming->expects($this->once()) $this->theming->expects($this->once())
->method('getMailHeaderColor') ->method('getColorPrimary')
->willReturn($color); ->willReturn($color);
$this->theming->expects($this->once()) $this->theming->expects($this->once())
->method('getLogo') ->method('getLogo')

View File

@ -983,7 +983,7 @@ class ThemingControllerTest extends TestCase {
->willReturn(""); ->willReturn("");
$this->template $this->template
->expects($this->at(3)) ->expects($this->at(3))
->method('getMailHeaderColor') ->method('getColorPrimary')
->willReturn("#000"); ->willReturn("#000");
@ -1018,7 +1018,7 @@ class ThemingControllerTest extends TestCase {
->willReturn("awesome"); ->willReturn("awesome");
$this->template $this->template
->expects($this->any()) ->expects($this->any())
->method('getMailHeaderColor') ->method('getColorPrimary')
->willReturn("#ffffff"); ->willReturn("#ffffff");
$expectedResponse = '(function() { $expectedResponse = '(function() {

View File

@ -87,7 +87,7 @@ class IconBuilderTest extends TestCase {
public function testRenderAppIcon($app, $color, $file) { public function testRenderAppIcon($app, $color, $file) {
$this->checkImagick(); $this->checkImagick();
$this->themingDefaults->expects($this->once()) $this->themingDefaults->expects($this->once())
->method('getMailHeaderColor') ->method('getColorPrimary')
->willReturn($color); ->willReturn($color);
$expectedIcon = new \Imagick(realpath(dirname(__FILE__)). "/data/" . $file); $expectedIcon = new \Imagick(realpath(dirname(__FILE__)). "/data/" . $file);
@ -112,7 +112,7 @@ class IconBuilderTest extends TestCase {
public function testGetTouchIcon($app, $color, $file) { public function testGetTouchIcon($app, $color, $file) {
$this->checkImagick(); $this->checkImagick();
$this->themingDefaults->expects($this->once()) $this->themingDefaults->expects($this->once())
->method('getMailHeaderColor') ->method('getColorPrimary')
->willReturn($color); ->willReturn($color);
$expectedIcon = new \Imagick(realpath(dirname(__FILE__)). "/data/" . $file); $expectedIcon = new \Imagick(realpath(dirname(__FILE__)). "/data/" . $file);
@ -138,7 +138,7 @@ class IconBuilderTest extends TestCase {
public function testGetFavicon($app, $color, $file) { public function testGetFavicon($app, $color, $file) {
$this->checkImagick(); $this->checkImagick();
$this->themingDefaults->expects($this->once()) $this->themingDefaults->expects($this->once())
->method('getMailHeaderColor') ->method('getColorPrimary')
->willReturn($color); ->willReturn($color);
$expectedIcon = new \Imagick(realpath(dirname(__FILE__)). "/data/" . $file); $expectedIcon = new \Imagick(realpath(dirname(__FILE__)). "/data/" . $file);

View File

@ -78,7 +78,7 @@ class AdminTest extends TestCase {
->willReturn('MySlogan'); ->willReturn('MySlogan');
$this->themingDefaults $this->themingDefaults
->expects($this->once()) ->expects($this->once())
->method('getMailHeaderColor') ->method('getColorPrimary')
->willReturn('#fff'); ->willReturn('#fff');
$this->urlGenerator $this->urlGenerator
->expects($this->once()) ->expects($this->once())
@ -128,7 +128,7 @@ class AdminTest extends TestCase {
->willReturn('MySlogan'); ->willReturn('MySlogan');
$this->themingDefaults $this->themingDefaults
->expects($this->once()) ->expects($this->once())
->method('getMailHeaderColor') ->method('getColorPrimary')
->willReturn('#fff'); ->willReturn('#fff');
$this->urlGenerator $this->urlGenerator
->expects($this->once()) ->expects($this->once())

View File

@ -73,7 +73,7 @@ class ThemingDefaultsTest extends TestCase {
->willReturn('Safe Data'); ->willReturn('Safe Data');
$this->defaults $this->defaults
->expects($this->at(3)) ->expects($this->at(3))
->method('getMailHeaderColor') ->method('getColorPrimary')
->willReturn('#000'); ->willReturn('#000');
$this->template = new ThemingDefaults( $this->template = new ThemingDefaults(
$this->config, $this->config,
@ -232,24 +232,24 @@ class ThemingDefaultsTest extends TestCase {
$this->assertEquals('<a href="url" target="_blank" rel="noreferrer">Name</a>', $this->template->getShortFooter()); $this->assertEquals('<a href="url" target="_blank" rel="noreferrer">Name</a>', $this->template->getShortFooter());
} }
public function testGetMailHeaderColorWithDefault() { public function testgetColorPrimaryWithDefault() {
$this->config $this->config
->expects($this->once()) ->expects($this->once())
->method('getAppValue') ->method('getAppValue')
->with('theming', 'color', '#000') ->with('theming', 'color', '#000')
->willReturn('#000'); ->willReturn('#000');
$this->assertEquals('#000', $this->template->getMailHeaderColor()); $this->assertEquals('#000', $this->template->getColorPrimary());
} }
public function testGetMailHeaderColorWithCustom() { public function testgetColorPrimaryWithCustom() {
$this->config $this->config
->expects($this->once()) ->expects($this->once())
->method('getAppValue') ->method('getAppValue')
->with('theming', 'color', '#000') ->with('theming', 'color', '#000')
->willReturn('#fff'); ->willReturn('#fff');
$this->assertEquals('#fff', $this->template->getMailHeaderColor()); $this->assertEquals('#fff', $this->template->getColorPrimary());
} }
public function testSet() { public function testSet() {

View File

@ -8,10 +8,10 @@
<meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="referrer" content="never"> <meta name="referrer" content="never">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0"> <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0">
<meta name="theme-color" content="<?php p($theme->getMailHeaderColor()); ?>"> <meta name="theme-color" content="<?php p($theme->getColorPrimary()); ?>">
<link rel="icon" href="<?php print_unescaped(image_path('', 'favicon.ico')); /* IE11+ supports png */ ?>"> <link rel="icon" href="<?php print_unescaped(image_path('', 'favicon.ico')); /* IE11+ supports png */ ?>">
<link rel="apple-touch-icon-precomposed" href="<?php print_unescaped(image_path('', 'favicon-touch.png')); ?>"> <link rel="apple-touch-icon-precomposed" href="<?php print_unescaped(image_path('', 'favicon-touch.png')); ?>">
<link rel="mask-icon" sizes="any" href="<?php print_unescaped(image_path('', 'favicon-mask.svg')); ?>" color="<?php p($theme->getMailHeaderColor()); ?>"> <link rel="mask-icon" sizes="any" href="<?php print_unescaped(image_path('', 'favicon-mask.svg')); ?>" color="<?php p($theme->getColorPrimary()); ?>">
<?php if (isset($_['inline_ocjs'])): ?> <?php if (isset($_['inline_ocjs'])): ?>
<script nonce="<?php p(\OC::$server->getContentSecurityPolicyNonceManager()->getNonce()) ?>" type="text/javascript"> <script nonce="<?php p(\OC::$server->getContentSecurityPolicyNonceManager()->getNonce()) ?>" type="text/javascript">
<?php print_unescaped($_['inline_ocjs']); ?> <?php print_unescaped($_['inline_ocjs']); ?>

View File

@ -9,10 +9,10 @@
<meta name="referrer" content="never"> <meta name="referrer" content="never">
<meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0"> <meta name="viewport" content="width=device-width, minimum-scale=1.0, maximum-scale=1.0">
<meta name="apple-itunes-app" content="app-id=<?php p($theme->getiTunesAppId()); ?>"> <meta name="apple-itunes-app" content="app-id=<?php p($theme->getiTunesAppId()); ?>">
<meta name="theme-color" content="<?php p($theme->getMailHeaderColor()); ?>"> <meta name="theme-color" content="<?php p($theme->getColorPrimary()); ?>">
<link rel="icon" href="<?php print_unescaped(image_path('', 'favicon.ico')); /* IE11+ supports png */ ?>"> <link rel="icon" href="<?php print_unescaped(image_path('', 'favicon.ico')); /* IE11+ supports png */ ?>">
<link rel="apple-touch-icon-precomposed" href="<?php print_unescaped(image_path('', 'favicon-touch.png')); ?>"> <link rel="apple-touch-icon-precomposed" href="<?php print_unescaped(image_path('', 'favicon-touch.png')); ?>">
<link rel="mask-icon" sizes="any" href="<?php print_unescaped(image_path('', 'favicon-mask.svg')); ?>" color="<?php p($theme->getMailHeaderColor()); ?>"> <link rel="mask-icon" sizes="any" href="<?php print_unescaped(image_path('', 'favicon-mask.svg')); ?>" color="<?php p($theme->getColorPrimary()); ?>">
<?php if (isset($_['inline_ocjs'])): ?> <?php if (isset($_['inline_ocjs'])): ?>
<script nonce="<?php p(\OC::$server->getContentSecurityPolicyNonceManager()->getNonce()) ?>" type="text/javascript"> <script nonce="<?php p(\OC::$server->getContentSecurityPolicyNonceManager()->getNonce()) ?>" type="text/javascript">
<?php print_unescaped($_['inline_ocjs']); ?> <?php print_unescaped($_['inline_ocjs']); ?>

View File

@ -16,10 +16,10 @@
<meta name="apple-mobile-web-app-status-bar-style" content="black"> <meta name="apple-mobile-web-app-status-bar-style" content="black">
<meta name="apple-mobile-web-app-title" content="<?php p((!empty($_['application']) && $_['appid']!='files')? $_['application']:$theme->getTitle()); ?>"> <meta name="apple-mobile-web-app-title" content="<?php p((!empty($_['application']) && $_['appid']!='files')? $_['application']:$theme->getTitle()); ?>">
<meta name="mobile-web-app-capable" content="yes"> <meta name="mobile-web-app-capable" content="yes">
<meta name="theme-color" content="<?php p($theme->getMailHeaderColor()); ?>"> <meta name="theme-color" content="<?php p($theme->getColorPrimary()); ?>">
<link rel="icon" href="<?php print_unescaped(image_path($_['appid'], 'favicon.ico')); /* IE11+ supports png */ ?>"> <link rel="icon" href="<?php print_unescaped(image_path($_['appid'], 'favicon.ico')); /* IE11+ supports png */ ?>">
<link rel="apple-touch-icon-precomposed" href="<?php print_unescaped(image_path($_['appid'], 'favicon-touch.png')); ?>"> <link rel="apple-touch-icon-precomposed" href="<?php print_unescaped(image_path($_['appid'], 'favicon-touch.png')); ?>">
<link rel="mask-icon" sizes="any" href="<?php print_unescaped(image_path($_['appid'], 'favicon-mask.svg')); ?>" color="<?php p($theme->getMailHeaderColor()); ?>"> <link rel="mask-icon" sizes="any" href="<?php print_unescaped(image_path($_['appid'], 'favicon-mask.svg')); ?>" color="<?php p($theme->getColorPrimary()); ?>">
<link rel="manifest" href="<?php print_unescaped(image_path($_['appid'], 'manifest.json')); ?>"> <link rel="manifest" href="<?php print_unescaped(image_path($_['appid'], 'manifest.json')); ?>">
<?php if (isset($_['inline_ocjs'])): ?> <?php if (isset($_['inline_ocjs'])): ?>
<script nonce="<?php p(\OC::$server->getContentSecurityPolicyNonceManager()->getNonce()) ?>" type="text/javascript"> <script nonce="<?php p(\OC::$server->getContentSecurityPolicyNonceManager()->getNonce()) ?>" type="text/javascript">

View File

@ -2,7 +2,7 @@
<tr><td> <tr><td>
<table cellspacing="0" cellpadding="0" border="0" width="600px"> <table cellspacing="0" cellpadding="0" border="0" width="600px">
<tr> <tr>
<td colspan="2" bgcolor="<?php p($theme->getMailHeaderColor());?>"> <td colspan="2" bgcolor="<?php p($theme->getColorPrimary());?>">
<img src="<?php p(\OC::$server->getURLGenerator()->getAbsoluteURL(image_path('', 'logo-mail.png'))); ?>" alt="<?php p($theme->getName()); ?>"/> <img src="<?php p(\OC::$server->getURLGenerator()->getAbsoluteURL(image_path('', 'logo-mail.png'))); ?>" alt="<?php p($theme->getName()); ?>"/>
</td> </td>
</tr> </tr>

View File

@ -275,9 +275,9 @@ class OC_Defaults {
* Returns mail header color * Returns mail header color
* @return string * @return string
*/ */
public function getMailHeaderColor() { public function getColorPrimary() {
if ($this->themeExist('getMailHeaderColor')) { if ($this->themeExist('getColorPrimary')) {
return $this->theme->getMailHeaderColor(); return $this->theme->getColorPrimary();
} else { } else {
return $this->defaultMailHeaderColor; return $this->defaultMailHeaderColor;
} }

View File

@ -2,7 +2,7 @@
<tr><td> <tr><td>
<table cellspacing="0" cellpadding="0" border="0" width="600px"> <table cellspacing="0" cellpadding="0" border="0" width="600px">
<tr> <tr>
<td colspan="2" bgcolor="<?php p($theme->getMailHeaderColor());?>" bordercolor="<?php p($theme->getMailHeaderColor());?>" border> <td colspan="2" bgcolor="<?php p($theme->getColorPrimary());?>" bordercolor="<?php p($theme->getColorPrimary());?>" border>
<img src="<?php p(\OC::$server->getURLGenerator()->getAbsoluteURL(image_path('', 'logo-mail.png'))); ?>" alt="<?php p($theme->getName()); ?>"/> <img src="<?php p(\OC::$server->getURLGenerator()->getAbsoluteURL(image_path('', 'logo-mail.png'))); ?>" alt="<?php p($theme->getName()); ?>"/>
</td> </td>
</tr> </tr>

View File

@ -147,7 +147,7 @@ class OC_Theme {
* Returns mail header color * Returns mail header color
* @return string * @return string
*/ */
public function getMailHeaderColor() { public function getColorPrimary() {
return '#745bca'; return '#745bca';
} }