093 admin.css et admin.json couleurs du thème admin

This commit is contained in:
Fred Tempez 2020-05-15 17:36:55 +02:00
parent 4c1d91195b
commit 8cf09137fb
5 changed files with 65 additions and 118 deletions

View File

@ -56,7 +56,8 @@ class common {
'module',
'page',
'user',
'theme'
'theme',
'admin'
];
private $data = [];
private $hierarchy = [
@ -165,10 +166,6 @@ class common {
common::$coreNotices [] = $stageId ;
}
}
// Copier le thème de l'administration
if (!file_exists(self::DATA_DIR . 'admin.css')) {
copy('core/module/install/ressource/admin.css',self::DATA_DIR .'admin.css');
}
// Utilisateur connecté
if($this->user === []) {
@ -1267,8 +1264,6 @@ class common {
if (file_exists('core/layout/admin.css')) {
copy('core/layout/admin.css',self::DATA_DIR.'admin.css');
unlink('core/layout/admin.css');
} else {
copy('core/module/install/ressource/admin.css',self::DATA_DIR .'admin.css');
}
//Déplacement d'un fichier de ressources
if (file_exists('core/module/config/ressource/.htaccess')) {
@ -1276,6 +1271,8 @@ class common {
rmdir ('core/module/config/ressource');
}
$this->setData(['core', 'dataVersion', 10093]);
// Réorganisation du thème
$this->setData(['theme','text','linkTextColor',$this->getData(['theme','link', 'textColor'])]);
}
}
@ -1345,7 +1342,12 @@ class core extends common {
file_put_contents(self::DATA_DIR.'theme.css', '');
chmod(self::DATA_DIR.'theme.css', 0755);
}
// Check la version
// Crée le fichier de personnalisation de l'administration
if(file_exists(self::DATA_DIR.'admin.css') === false) {
file_put_contents(self::DATA_DIR.'admin.css', '');
chmod(self::DATA_DIR.'admin.css', 0755);
}
// Check la version rafraichissement du theme
$cssVersion = preg_split('/\*+/', file_get_contents(self::DATA_DIR.'theme.css'));
if(empty($cssVersion[1]) OR $cssVersion[1] !== md5(json_encode($this->getData(['theme'])))) {
// Version
@ -1364,7 +1366,7 @@ class core extends common {
// Icône BacktoTop
$css .= '#backToTop {background-color:' .$this->getData(['theme', 'body', 'toTopbackgroundColor']). ';color:'.$this->getData(['theme', 'body', 'toTopColor']).';}';
// Site
$colors = helper::colorVariants($this->getData(['theme', 'link', 'textColor']));
$colors = helper::colorVariants($this->getData(['theme', 'text', 'linkTextColor']));
$css .= 'a{color:' . $colors['normal'] . '}';
$css .= 'a:hover{color:' . $colors['darken'] . '}';
$css .= 'body,.row > div{font-size:' . $this->getData(['theme', 'text', 'fontSize']) . '}';
@ -1468,13 +1470,37 @@ class core extends common {
}
// Enregistre la personnalisation
file_put_contents(self::DATA_DIR.'theme.css', $css);
// Effacer le cache pour afin de tenir compte de la couleur de fond TinyMCE
// Effacer le cache pour tenir compte de la couleur de fond TinyMCE
header("Expires: Tue, 01 Jan 2000 00:00:00 GMT");
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
header("Cache-Control: no-store, no-cache, must-revalidate, max-age=0");
header("Cache-Control: post-check=0, pre-check=0", false);
header("Pragma: no-cache");
}
// Check la version rafraichissement du theme admin
$cssVersion = preg_split('/\*+/', file_get_contents(self::DATA_DIR.'admin.css'));
if(empty($cssVersion[1]) OR $cssVersion[1] !== md5(json_encode($this->getData(['admin'])))) {
// Version
$css = '/*' . md5(json_encode($this->getData(['theme','admin']))) . '*/';
$css .= '#site{background-color:' . $this->getData(['admin','backgroundColor']) . ';}';
$css .= 'body, .row > div {font:' . $this->getData(['admin','fontSize']) . ' "' . $this->getData(['admin','font']) . '", sans-serif;}';
$css .= 'body h1, h2, h3, h4, h5, h6 {font-family:' . $this->getData(['admin','fontTitle' ]) . ', sans-serif;color:' . $this->getData(['admin','colorTitle' ]) . ';}';
$css .= 'body:not(.editorWysiwyg),.block h4,input[type=email],input[type=text],input[type=password],.inputFile,select,textarea:not(.editorWysiwyg),.inputFile,span .zwiico-help,.button.buttonGrey {color:' . $this->getData(['admin','colorText']) . ';}';
$colors = helper::colorVariants($this->getData(['admin','backgroundColorButton']));
$css .= '.button,input[type="checkbox"]:checked + label::before,.speechBubble{ background-color:' . $colors['normal'] . ';color:' . $this->getData(['admin','colorButtonText']) . ';}';
$css .= '.speechBubble::before {border-color:' . $colors['normal'] . ' transparent transparent transparent;}';
$css .= '.button:hover, button[type=submit]:hover { background-color:' . $colors['darken'] . ';}';
$colors = helper::colorVariants($this->getData(['admin','backgroundColorButtonGrey']));
$css .= '.button.buttonGrey {background: ' . $colors['normal'] . ';}.button.buttonGrey:hover {background:' . $colors['darken'] . '}.button.buttonGrey:active {background:' . $colors['veryDarken'] . '}';
$colors = helper::colorVariants($this->getData(['admin','backgroundColorButtonRed']));
$css .= '.button.buttonRed {background: ' . $colors['normal'] . ';}.button.buttonRed:hover {background:' . $colors['darken'] . '}.button.buttonRed:active {background:' . $colors['veryDarken'] . '}';
$colors = helper::colorVariants($this->getData(['admin','backgroundColorButtonRed']));
$css .= '.button.buttonRed {background: ' . $colors['normal'] . ';}.button.buttonRed:hover {background:' . $colors['darken'] . '}.button.buttonRed:active {background:' . $colors['veryDarken'] . '}';
$colors = helper::colorVariants($this->getData(['admin','backgroundColorButtonGreen']));
$css .= 'button[type=submit] {background-color: ' . $colors['normal']. ';color: ' . $this->getData(['admin','colorButtonText']) . '}button[type=submit]:hover {background-color: ' . $colors['darken'] . ';}';
// Enregistre la personnalisation
file_put_contents(self::DATA_DIR.'admin.css', $css);
}
}
/**
* Auto-chargement des classes

View File

@ -1,92 +0,0 @@
/**
* This file is part of Zwii.
*
* For full copyright and license information, please see the LICENSE
* file that was distributed with this source code.
*
* @author Rémi Jean <remi.jean@outlook.com>
* @copyright Copyright (C) 2008-2018, Rémi Jean
* @author Frédéric Tempez <frederic.tempez@outlook.com>
* @copyright Copyright (C) 2018-2020, Frédéric Tempez
* @license GNU General Public License, version 3
* @link http://zwiicms.com/
*/
#site {
background-color: rgba(255, 255, 255, 1);
}
/* Mise en forme des textes */
body, .row > div {
font: 13px "Open+Sans", sans-serif;
}
body h1, h2, h3, h4, h5, h6 {
font-family: "Oswald", sans-serif;
color: rgba(74, 105, 189, 1);
}
/* Couleur du texte */
body:not(.editorWysiwyg),
.block h4,
input[type=email],
input[type=text],
input[type=password],
.inputFile,
select,
textarea:not(.editorWysiwyg),
.inputFile,
span .zwiico-help,
.button.buttonGrey {
color: rgba(33, 34, 35, 1);
}
/* Elements courants et boutons courants*/
.button,
input[type="checkbox"]:checked + label::before,
.speechBubble {
background-color: rgba(44, 79, 110, 1);
color: white;
}
.speechBubble::before {
border-color: rgba(44, 79, 110, 1) transparent transparent transparent;
}
.button:hover,
button[type=submit]:hover {
background-color: rgba(22, 57, 87, 1);
}
/* Bouton de retour */
.button.buttonGrey {
background: #ECEFF1;
}
.button.buttonGrey:hover {
background: #E2E7EA;
}
.button.buttonGrey:active {
background: #D8DFE3;
}
/* Bouton effacement */
.button.buttonRed {
background: #E74C3C;
color: #FFF;
}
.button.buttonRed:hover {
background: #E53E2D;
}
.button.buttonRed:active {
background: #E3301E;
}
/* Bouton de soumission */
button[type=submit] {
background-color: rgba(57, 112, 12, 1);
color: white;
}
button[type=submit]:hover {
background-color: rgba(40, 78, 8, 1);
}

View File

@ -77,9 +77,6 @@ class init extends common {
'toTopbackgroundColor' => 'rgba(33, 34, 35, .8)',
'toTopColor' => 'rgba(255, 255, 255, 1)'
],
'button' => [
'backgroundColor' => 'rgba(32, 59, 82, 1)'
],
'footer' => [
'backgroundColor' => 'rgba(255, 255, 255, 1)',
'font' => 'Open+Sans',
@ -123,9 +120,6 @@ class init extends common {
'linkHomePage' => true,
'imageContainer' => 'auto'
],
'link' => [
'textColor' => 'rgba(74, 105, 189, 1)'
],
'menu' => [
'backgroundColor' => 'rgba(32, 59, 82, 1)',
'font' => 'Open+Sans',
@ -152,7 +146,8 @@ class init extends common {
'text' => [
'font' => 'Open+Sans',
'fontSize' => '13px',
'textColor' => 'rgba(33, 34, 35, 1)'
'textColor' => 'rgba(33, 34, 35, 1)',
'linkTextColor' => 'rgba(74, 105, 189, 1)'
],
'title' => [
'font' => 'Oswald',
@ -160,8 +155,24 @@ class init extends common {
'textColor' => 'rgba(74, 105, 189, 1)',
'textTransform' => 'none'
],
'version' => 0,
]
'button' => [
'backgroundColor' => 'rgba(32, 59, 82, 1)'
],
'version' => 0
],
'admin' => [
'backgroundColor' => 'rgba(255, 255, 255, 1)',
'font' => 'open+Sans',
'fontSize' => '13px',
'fontTitle' => 'Oswald',
'colorText' => 'rgba(33, 34, 35, 1)',
'colorTitle' => 'rgba(74, 105, 189, 1)',
'colorButtonText' => 'rgba(255, 255, 255, 1)',
'backgroundColorButton' => 'rgba(44, 79, 110, 1)',
'backgroundColorButtonGrey' => 'rgba(236, 239, 241, 1)',
'backgroundColorButtonRed' => 'rgba(231, 76, 60, 1)',
'backgroundColorButtonGreen' => 'rgba(57, 112, 12, 1)'
],
];

View File

@ -508,19 +508,21 @@ class theme extends common {
'fontWeight' => $this->getInput('themeTitleFontWeight'),
'textTransform' => $this->getInput('themeTitleTextTransform')
]]);
$this->setData(['theme', 'button', 'backgroundColor', $this->getInput('themeButtonBackgroundColor')]);
$this->setData(['theme', 'link', 'textColor', $this->getInput('themeLinkTextColor')]);
$this->setData(['theme', 'text', [
'font' => $this->getInput('themeTextFont'),
'fontSize' => $this->getInput('themeTextFontSize'),
'textColor' => $this->getInput('themeTextTextColor'),
'linkTextColor'=> $this->getInput('themeTextLinkTextColor')
]]);
$this->setData(['theme', 'site', [
'backgroundColor' => $this->getInput('themeSiteBackgroundColor'),
'radius' => $this->getInput('themeSiteRadius'),
'shadow' => $this->getInput('themeSiteShadow'),
'width' => $this->getInput('themeSiteWidth'),
'margin' => $this->getInput('themeSiteMargin',helper::FILTER_BOOLEAN)
'margin' => $this->getInput('themeSiteMargin',helper::FILTER_BOOLEAN),
]]);
$this->setData(['theme', 'button', [
'backgroundColor' => $this->getInput('themeButtonBackgroundColor'),
]]);
// Valeurs en sortie
$this->addOutput([

View File

@ -46,11 +46,11 @@
]); ?>
</div>
<div class="col6">
<?php echo template::text('themeLinkTextColor', [
<?php echo template::text('themeTextLinkTextColor', [
'class' => 'colorPicker',
'help' => 'Le curseur horizontal règle le niveau de transparence.',
'label' => 'Liens',
'value' => $this->getData(['theme', 'link', 'textColor'])
'value' => $this->getData(['theme', 'text', 'linkTextColor'])
]); ?>
</div>
</div>