Merge pull request #4108 from nextcloud/color-variable-rename
rename confusing getMailHeaderColor to getColorPrimary, ref #3491
This commit is contained in:
commit
6d8e447895
|
@ -6,7 +6,7 @@
|
|||
<tr><td>
|
||||
<table cellspacing="0" cellpadding="0" border="0" width="600px">
|
||||
<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()); ?>"/>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -42,7 +42,7 @@ $cloudID = \OC::$server->getUserSession()->getUser()->getCloudId();
|
|||
$url = 'https://nextcloud.com/federation#' . $cloudID;
|
||||
$logoPath = \OC::$server->getURLGenerator()->imagePath('core', 'logo-icon.svg');
|
||||
$theme = \OC::$server->getThemingDefaults();
|
||||
$color = $theme->getMailHeaderColor();
|
||||
$color = $theme->getColorPrimary();
|
||||
$textColor = "#ffffff";
|
||||
if(\OC::$server->getAppManager()->isEnabledForUser("theming")) {
|
||||
$logoPath = $theme->getLogo();
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
<tr><td>
|
||||
<table cellspacing="0" cellpadding="0" border="0" width="600px">
|
||||
<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()); ?>"/>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -60,7 +60,7 @@ class Capabilities implements ICapability {
|
|||
'name' => $this->theming->getName(),
|
||||
'url' => $this->theming->getBaseUrl(),
|
||||
'slogan' => $this->theming->getSlogan(),
|
||||
'color' => $this->theming->getMailHeaderColor(),
|
||||
'color' => $this->theming->getColorPrimary(),
|
||||
'logo' => $this->url->getAbsoluteURL($this->theming->getLogo()),
|
||||
'background' => $this->url->getAbsoluteURL($this->theming->getBackground()),
|
||||
],
|
||||
|
|
|
@ -451,8 +451,8 @@ class ThemingController extends Controller {
|
|||
name: ' . json_encode($this->template->getName()) . ',
|
||||
url: ' . json_encode($this->template->getBaseUrl()) . ',
|
||||
slogan: ' . json_encode($this->template->getSlogan()) . ',
|
||||
color: ' . json_encode($this->template->getMailHeaderColor()) . ',
|
||||
inverted: ' . json_encode($this->util->invertTextColor($this->template->getMailHeaderColor())) . ',
|
||||
color: ' . json_encode($this->template->getColorPrimary()) . ',
|
||||
inverted: ' . json_encode($this->util->invertTextColor($this->template->getColorPrimary())) . ',
|
||||
cacheBuster: ' . json_encode($cacheBusterValue). '
|
||||
};
|
||||
})();';
|
||||
|
|
|
@ -97,7 +97,7 @@ class IconBuilder {
|
|||
return false;
|
||||
}
|
||||
|
||||
$color = $this->themingDefaults->getMailHeaderColor();
|
||||
$color = $this->themingDefaults->getColorPrimary();
|
||||
$mime = mime_content_type($appIcon);
|
||||
|
||||
// generate background image with rounded corners
|
||||
|
@ -178,7 +178,7 @@ class IconBuilder {
|
|||
}
|
||||
$svg = file_get_contents($imageFile);
|
||||
if ($svg !== false && $svg !== "") {
|
||||
$color = $this->util->elementColor($this->themingDefaults->getMailHeaderColor());
|
||||
$color = $this->util->elementColor($this->themingDefaults->getColorPrimary());
|
||||
$svg = $this->util->colorizeSvg($svg, $color);
|
||||
return $svg;
|
||||
} else {
|
||||
|
|
|
@ -70,7 +70,7 @@ class Admin implements ISettings {
|
|||
'name' => $this->themingDefaults->getEntity(),
|
||||
'url' => $this->themingDefaults->getBaseUrl(),
|
||||
'slogan' => $this->themingDefaults->getSlogan(),
|
||||
'color' => $this->themingDefaults->getMailHeaderColor(),
|
||||
'color' => $this->themingDefaults->getColorPrimary(),
|
||||
'logo' => $this->themingDefaults->getLogo(),
|
||||
'logoMime' => $this->config->getAppValue('theming', 'logoMime', ''),
|
||||
'background' => $this->themingDefaults->getBackground(),
|
||||
|
|
|
@ -78,7 +78,7 @@ class ThemingDefaults extends \OC_Defaults {
|
|||
$this->name = $defaults->getName();
|
||||
$this->url = $defaults->getBaseUrl();
|
||||
$this->slogan = $defaults->getSlogan();
|
||||
$this->color = $defaults->getMailHeaderColor();
|
||||
$this->color = $defaults->getColorPrimary();
|
||||
}
|
||||
|
||||
public function getName() {
|
||||
|
@ -119,7 +119,7 @@ class ThemingDefaults extends \OC_Defaults {
|
|||
*
|
||||
* @return string
|
||||
*/
|
||||
public function getMailHeaderColor() {
|
||||
public function getColorPrimary() {
|
||||
return $this->config->getAppValue('theming', 'color', $this->color);
|
||||
}
|
||||
|
||||
|
@ -214,7 +214,7 @@ class ThemingDefaults extends \OC_Defaults {
|
|||
$returnValue = $this->getSlogan();
|
||||
break;
|
||||
case 'color':
|
||||
$returnValue = $this->getMailHeaderColor();
|
||||
$returnValue = $this->getColorPrimary();
|
||||
break;
|
||||
default:
|
||||
$returnValue = '';
|
||||
|
|
|
@ -106,7 +106,7 @@ class CapabilitiesTest extends TestCase {
|
|||
->method('getSlogan')
|
||||
->willReturn($slogan);
|
||||
$this->theming->expects($this->once())
|
||||
->method('getMailHeaderColor')
|
||||
->method('getColorPrimary')
|
||||
->willReturn($color);
|
||||
$this->theming->expects($this->once())
|
||||
->method('getLogo')
|
||||
|
|
|
@ -983,7 +983,7 @@ class ThemingControllerTest extends TestCase {
|
|||
->willReturn("");
|
||||
$this->template
|
||||
->expects($this->at(3))
|
||||
->method('getMailHeaderColor')
|
||||
->method('getColorPrimary')
|
||||
->willReturn("#000");
|
||||
|
||||
|
||||
|
@ -1018,7 +1018,7 @@ class ThemingControllerTest extends TestCase {
|
|||
->willReturn("awesome");
|
||||
$this->template
|
||||
->expects($this->any())
|
||||
->method('getMailHeaderColor')
|
||||
->method('getColorPrimary')
|
||||
->willReturn("#ffffff");
|
||||
|
||||
$expectedResponse = '(function() {
|
||||
|
|
|
@ -87,7 +87,7 @@ class IconBuilderTest extends TestCase {
|
|||
public function testRenderAppIcon($app, $color, $file) {
|
||||
$this->checkImagick();
|
||||
$this->themingDefaults->expects($this->once())
|
||||
->method('getMailHeaderColor')
|
||||
->method('getColorPrimary')
|
||||
->willReturn($color);
|
||||
|
||||
$expectedIcon = new \Imagick(realpath(dirname(__FILE__)). "/data/" . $file);
|
||||
|
@ -112,7 +112,7 @@ class IconBuilderTest extends TestCase {
|
|||
public function testGetTouchIcon($app, $color, $file) {
|
||||
$this->checkImagick();
|
||||
$this->themingDefaults->expects($this->once())
|
||||
->method('getMailHeaderColor')
|
||||
->method('getColorPrimary')
|
||||
->willReturn($color);
|
||||
|
||||
$expectedIcon = new \Imagick(realpath(dirname(__FILE__)). "/data/" . $file);
|
||||
|
@ -138,7 +138,7 @@ class IconBuilderTest extends TestCase {
|
|||
public function testGetFavicon($app, $color, $file) {
|
||||
$this->checkImagick();
|
||||
$this->themingDefaults->expects($this->once())
|
||||
->method('getMailHeaderColor')
|
||||
->method('getColorPrimary')
|
||||
->willReturn($color);
|
||||
|
||||
$expectedIcon = new \Imagick(realpath(dirname(__FILE__)). "/data/" . $file);
|
||||
|
|
|
@ -78,7 +78,7 @@ class AdminTest extends TestCase {
|
|||
->willReturn('MySlogan');
|
||||
$this->themingDefaults
|
||||
->expects($this->once())
|
||||
->method('getMailHeaderColor')
|
||||
->method('getColorPrimary')
|
||||
->willReturn('#fff');
|
||||
$this->urlGenerator
|
||||
->expects($this->once())
|
||||
|
@ -128,7 +128,7 @@ class AdminTest extends TestCase {
|
|||
->willReturn('MySlogan');
|
||||
$this->themingDefaults
|
||||
->expects($this->once())
|
||||
->method('getMailHeaderColor')
|
||||
->method('getColorPrimary')
|
||||
->willReturn('#fff');
|
||||
$this->urlGenerator
|
||||
->expects($this->once())
|
||||
|
|
|
@ -73,7 +73,7 @@ class ThemingDefaultsTest extends TestCase {
|
|||
->willReturn('Safe Data');
|
||||
$this->defaults
|
||||
->expects($this->at(3))
|
||||
->method('getMailHeaderColor')
|
||||
->method('getColorPrimary')
|
||||
->willReturn('#000');
|
||||
$this->template = new ThemingDefaults(
|
||||
$this->config,
|
||||
|
@ -232,24 +232,24 @@ class ThemingDefaultsTest extends TestCase {
|
|||
$this->assertEquals('<a href="url" target="_blank" rel="noreferrer">Name</a>', $this->template->getShortFooter());
|
||||
}
|
||||
|
||||
public function testGetMailHeaderColorWithDefault() {
|
||||
public function testgetColorPrimaryWithDefault() {
|
||||
$this->config
|
||||
->expects($this->once())
|
||||
->method('getAppValue')
|
||||
->with('theming', 'color', '#000')
|
||||
->willReturn('#000');
|
||||
|
||||
$this->assertEquals('#000', $this->template->getMailHeaderColor());
|
||||
$this->assertEquals('#000', $this->template->getColorPrimary());
|
||||
}
|
||||
|
||||
public function testGetMailHeaderColorWithCustom() {
|
||||
public function testgetColorPrimaryWithCustom() {
|
||||
$this->config
|
||||
->expects($this->once())
|
||||
->method('getAppValue')
|
||||
->with('theming', 'color', '#000')
|
||||
->willReturn('#fff');
|
||||
|
||||
$this->assertEquals('#fff', $this->template->getMailHeaderColor());
|
||||
$this->assertEquals('#fff', $this->template->getColorPrimary());
|
||||
}
|
||||
|
||||
public function testSet() {
|
||||
|
|
|
@ -8,10 +8,10 @@
|
|||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="referrer" content="never">
|
||||
<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="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'])): ?>
|
||||
<script nonce="<?php p(\OC::$server->getContentSecurityPolicyNonceManager()->getNonce()) ?>" type="text/javascript">
|
||||
<?php print_unescaped($_['inline_ocjs']); ?>
|
||||
|
|
|
@ -9,10 +9,10 @@
|
|||
<meta name="referrer" content="never">
|
||||
<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="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="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'])): ?>
|
||||
<script nonce="<?php p(\OC::$server->getContentSecurityPolicyNonceManager()->getNonce()) ?>" type="text/javascript">
|
||||
<?php print_unescaped($_['inline_ocjs']); ?>
|
||||
|
|
|
@ -16,10 +16,10 @@
|
|||
<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="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="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')); ?>">
|
||||
<?php if (isset($_['inline_ocjs'])): ?>
|
||||
<script nonce="<?php p(\OC::$server->getContentSecurityPolicyNonceManager()->getNonce()) ?>" type="text/javascript">
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<tr><td>
|
||||
<table cellspacing="0" cellpadding="0" border="0" width="600px">
|
||||
<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()); ?>"/>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -46,7 +46,7 @@ class OC_Defaults {
|
|||
private $defaultDocVersion;
|
||||
private $defaultSlogan;
|
||||
private $defaultLogoClaim;
|
||||
private $defaultMailHeaderColor;
|
||||
private $defaultColorPrimary;
|
||||
|
||||
function __construct() {
|
||||
$this->l = \OC::$server->getL10N('lib');
|
||||
|
@ -63,7 +63,7 @@ class OC_Defaults {
|
|||
$this->defaultDocVersion = '11'; // used to generate doc links
|
||||
$this->defaultSlogan = $this->l->t('a safe home for all your data');
|
||||
$this->defaultLogoClaim = '';
|
||||
$this->defaultMailHeaderColor = '#0082c9'; /* header color of mail notifications */
|
||||
$this->defaultColorPrimary = '#0082c9';
|
||||
|
||||
$themePath = OC::$SERVERROOT . '/themes/' . OC_Util::getTheme() . '/defaults.php';
|
||||
if (file_exists($themePath)) {
|
||||
|
@ -272,15 +272,18 @@ class OC_Defaults {
|
|||
}
|
||||
|
||||
/**
|
||||
* Returns mail header color
|
||||
* Returns primary color
|
||||
* @return string
|
||||
*/
|
||||
public function getMailHeaderColor() {
|
||||
public function getColorPrimary() {
|
||||
|
||||
if ($this->themeExist('getColorPrimary')) {
|
||||
return $this->theme->getColorPrimary();
|
||||
}
|
||||
if ($this->themeExist('getMailHeaderColor')) {
|
||||
return $this->theme->getMailHeaderColor();
|
||||
} else {
|
||||
return $this->defaultMailHeaderColor;
|
||||
}
|
||||
return $this->defaultColorPrimary;
|
||||
}
|
||||
|
||||
public function shouldReplaceIcons() {
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
<tr><td>
|
||||
<table cellspacing="0" cellpadding="0" border="0" width="600px">
|
||||
<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()); ?>"/>
|
||||
</td>
|
||||
</tr>
|
||||
|
|
|
@ -147,7 +147,7 @@ class OC_Theme {
|
|||
* Returns mail header color
|
||||
* @return string
|
||||
*/
|
||||
public function getMailHeaderColor() {
|
||||
public function getColorPrimary() {
|
||||
return '#745bca';
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue