From 52be6d2997ba6d8ddaa7ae87531b3ccaa074cb1f Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Tue, 3 Nov 2020 12:02:59 +0100 Subject: [PATCH 1/4] Bug theme menu --- core/module/install/ressource/defaultdata.php | 2 +- core/module/theme/theme.php | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/core/module/install/ressource/defaultdata.php b/core/module/install/ressource/defaultdata.php index ecfd2c34..6fc1fbf5 100644 --- a/core/module/install/ressource/defaultdata.php +++ b/core/module/install/ressource/defaultdata.php @@ -144,7 +144,6 @@ class init extends common { 'fontWeight' => 'normal', 'height' => '15px 10px', 'loginLink' => false, - 'burgerTitle' => true, 'margin' => false, 'position' => 'site-second', 'textAlign' => 'left', @@ -155,6 +154,7 @@ class init extends common { 'activeColor' => 'rgba(255, 255, 255, 1)', 'activeTextColor' => 'rgba(255, 255, 255, 1)', 'radius' => '0px', + 'burgerTitle' => true, 'memberBar' => true ], 'site' => [ diff --git a/core/module/theme/theme.php b/core/module/theme/theme.php index 5acf70cd..75f9ee2e 100644 --- a/core/module/theme/theme.php +++ b/core/module/theme/theme.php @@ -407,7 +407,6 @@ class theme extends common { // Si une image est positionnée, l'arrière en transparent. $this->setData(['theme', 'header', [ 'backgroundColor' => $this->getInput('themeHeaderBackgroundColor'), - 'textTransform' => $this->getInput('themeHeaderTextTransform'), 'font' => $this->getInput('themeHeaderFont'), 'fontSize' => $this->getInput('themeHeaderFontSize'), 'fontWeight' => $this->getInput('themeHeaderFontWeight'), @@ -420,6 +419,7 @@ class theme extends common { 'textAlign' => $this->getInput('themeHeaderTextAlign'), 'textColor' => $this->getInput('themeHeaderTextColor'), 'textHide' => $this->getInput('themeHeaderTextHide', helper::FILTER_BOOLEAN), + 'textTransform' => $this->getInput('themeHeaderTextTransform'), 'linkHomePage' => $this->getInput('themeHeaderlinkHomePage',helper::FILTER_BOOLEAN), 'imageContainer' => $this->getInput('themeHeaderImageContainer') ]]); @@ -436,8 +436,10 @@ class theme extends common { default: $position = $this->getData(['theme','menu','position']); } + $this->setData(['theme', 'menu', [ 'backgroundColor' => $this->getData(['theme', 'menu', 'backgroundColor']), + 'backgroundColorSub' => $this->getData(['theme', 'menu', 'backgroundColorSub']), 'font' => $this->getData(['theme', 'menu', 'font']), 'fontSize' => $this->getData(['theme', 'menu', 'fontSize']), 'fontWeight' => $this->getData(['theme', 'menu', 'fontWeight']), @@ -451,8 +453,9 @@ class theme extends common { 'fixed' => $this->getData(['theme','menu','fixed']), 'activeColorAuto' => $this->getData(['theme','menu','activeColorAuto']), 'activeColor' => $this->getData(['theme','menu','activeColor']), + 'activeTextColor' => $this->getData(['theme','menu','activeTextColor']), 'radius' => $this->getData(['theme','menu','radius']), - 'burgerTitle' => $this->getData(['theme','menu','burgerTitle']) + 'memberBar' => $this->getData(['theme','menu','memberBar']) ]]); // Valeurs en sortie $this->addOutput([ From 96b0a1a9b925663116052dac38bfe0ab901f0a5c Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Tue, 3 Nov 2020 15:34:42 +0100 Subject: [PATCH 2/4] erreur de commentaire --- core/module/user/view/login/login.css | 1 - 1 file changed, 1 deletion(-) diff --git a/core/module/user/view/login/login.css b/core/module/user/view/login/login.css index 59f4f544..c58b8e23 100755 --- a/core/module/user/view/login/login.css +++ b/core/module/user/view/login/login.css @@ -18,4 +18,3 @@ /** NE PAS EFFACER * admin.css */ -*/ From e7424dc9ddf9acdce3883cb1321b9339a7bdf884 Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Tue, 3 Nov 2020 15:34:57 +0100 Subject: [PATCH 3/4] =?UTF-8?q?check=20la=20validit=C3=A9=20d'une=20th?= =?UTF-8?q?=C3=A8me=20import=C3=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/module/theme/theme.php | 68 +++++++++++++++++++++++--- core/module/theme/view/index/index.php | 16 +++--- 2 files changed, 70 insertions(+), 14 deletions(-) diff --git a/core/module/theme/theme.php b/core/module/theme/theme.php index 75f9ee2e..8d826ab8 100644 --- a/core/module/theme/theme.php +++ b/core/module/theme/theme.php @@ -29,7 +29,8 @@ class theme extends common { 'admin' => self::GROUP_ADMIN, 'manage' => self::GROUP_ADMIN, 'export' => self::GROUP_ADMIN, - 'save' => self::GROUP_ADMIN + 'save' => self::GROUP_ADMIN, + 'checkImport' => self::GROUP_ADMIN ]; public static $aligns = [ 'left' => 'À gauche', @@ -619,20 +620,31 @@ class theme extends common { if ($zip->open(self::FILE_DIR.'source/'.$zipFilename) === TRUE) { mkdir (self::TEMP_DIR . $tempFolder); $zip->extractTo(self::TEMP_DIR . $tempFolder ); + $modele = ''; // Archive de thème ? - if (( file_exists(self::TEMP_DIR . $tempFolder . '/site/data/custom.css') + if ( + file_exists(self::TEMP_DIR . $tempFolder . '/site/data/custom.css') AND file_exists(self::TEMP_DIR . $tempFolder . '/site/data/theme.css') AND file_exists(self::TEMP_DIR . $tempFolder . '/site/data/theme.json') - ) OR ( - file_exists(self::TEMP_DIR . $tempFolder . '/site/data/admin.json') - ) + ) { + $modele = 'theme'; + } + if( + file_exists(self::TEMP_DIR . $tempFolder . '/site/data/admin.json') + AND file_exists(self::TEMP_DIR . $tempFolder . '/site/data/admin.css') + ) { + $mode = 'admin'; + } + if (!empty($modele) ) { // traiter l'archive $success = $zip->extractTo('.'); // traitement de l'erreur - $notification = $success ? 'Le thème a été importé' : 'Erreur lors de l\'extraction, vérifiez les permissions.'; + $notification = $success ? 'Le thème a été importé' : 'Erreur lors de l\'extraction, vérifiez les permissions.'; // Supprimmer le dossier temporaire $this->removeDir(self::TEMP_DIR . $tempFolder); + // Check le thème + $this->checkImport($modele); } else { // pas une archive de thème $success = false; @@ -700,6 +712,50 @@ class theme extends common { ]); } + + /** + * Contrôle du thème + * Vérifie la présence de toutes les clés par rapport au thème par défaut + * les créer si elles n'existent pas. + */ + private function checkImport ($modele = 'theme') { + require_once('core/module/install/ressource/defaultdata.php'); + switch ($modele) { + case 'theme': + $default['theme'] = init::$defaultData['theme']; + // Check le thème + $dataKeys = ['body','footer','header','menu','site','block','text','title','button']; + // Parcourir les clés principales et stocker les contenus + foreach($dataKeys as $key1) { + $itemKeys = $default['theme'][$key1]; + // Parcourir les clés secondaires + foreach ($itemKeys as $key2 => $value) { + // Données nulles ou vides instaurer la donnée par défaut + if ($this->getData(['theme',$key1,$key2]) === NULL + OR empty($this->getData(['theme',$key1,$key2]) ) + ) { + $this->setData(['theme',$key1,$key2,$value]); + } + } + } + break; + case 'admin': + // Check Admin + $default['admin'] = init::$defaultData['admin']; + // Pas de clé secondaire + $itemKeys = $default['admin']; + foreach ($itemKeys as $key1 => $value) { + // Données nulles ou vides instaurer la donnée par défaut + if ($this->getData(['admin',$key1]) === NULL + OR empty($this->getData(['admin',$key1]) ) + ) { + $this->setData(['admin',$key1,$value]); + } + } + break; + } + } + /** * construction du zip * @param string $modele theme ou admin diff --git a/core/module/theme/view/index/index.php b/core/module/theme/view/index/index.php index 8d9316e5..8e7db01d 100644 --- a/core/module/theme/view/index/index.php +++ b/core/module/theme/view/index/index.php @@ -22,20 +22,20 @@
-
- 'code', - 'href' => helper::baseUrl() . $this->getUrl(0) . '/advanced', - 'value' => 'Éditeur CSS' - ]); ?> -
-
+
'upload', 'href' => helper::baseUrl() . $this->getUrl(0) . '/manage', 'value' => 'Gestion' ]); ?>
+
+ 'code', + 'href' => helper::baseUrl() . $this->getUrl(0) . '/advanced', + 'value' => 'Éditeur CSS' + ]); ?> +
From 493b8ff6b28e7d34465b28e9b3e702799450d95f Mon Sep 17 00:00:00 2001 From: Fred Tempez Date: Tue, 3 Nov 2020 17:09:53 +0100 Subject: [PATCH 4/4] Contraste theme black --- core/module/user/view/login/login.css | 7 ------- 1 file changed, 7 deletions(-) diff --git a/core/module/user/view/login/login.css b/core/module/user/view/login/login.css index c58b8e23..75723119 100755 --- a/core/module/user/view/login/login.css +++ b/core/module/user/view/login/login.css @@ -11,10 +11,3 @@ * @license GNU General Public License, version 3 * @link http://zwiicms.fr/ */ - -/* -/** @import url("site/data/admin.css"); */ - -/** NE PAS EFFACER -* admin.css -*/