From af899484b7009198f12255c53b921a6bfeb8bf44 Mon Sep 17 00:00:00 2001 From: Deltacms Date: Sat, 18 Feb 2023 08:16:35 +0100 Subject: [PATCH] =?UTF-8?q?=20banni=C3=A8re=20anim=C3=A9e=20et=20theme=20m?= =?UTF-8?q?enu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- CHANGES.md | 7 +- core/core.php | 88 ++++++++++++++++++++- core/layout/main.php | 100 +++++++----------------- core/module/theme/lang/en/lex_theme.php | 3 +- core/module/theme/lang/fr/lex_theme.php | 3 +- core/module/theme/theme.php | 43 ++++++++-- core/module/theme/view/menu/menu.js.php | 8 +- core/module/theme/view/menu/menu.php | 3 +- core/module/theme/view/site/site.php | 13 +-- 9 files changed, 171 insertions(+), 97 deletions(-) diff --git a/CHANGES.md b/CHANGES.md index 5ebbd3a..3ba18d9 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -2,8 +2,13 @@ ## Version 4.4.05 de Deltacms - Modifications : - + - Chargement ordonné des scripts javascript et des styles, l'affichage des pages est plus rapide, + - Le fichier pdf pour les informations de debug est remplacé par un copier / coller assisté, + - Thème / menu : modification de la largeur du menu si la bannière est au dessus du site et limitée au site, améliorations, + - Thème / bannière : amélioration de l'affichage de la bannière animée. - Corrections : + - Initialisation d'une variable utilisée dans la capture d'écran, + - Encodage de certaines pages de configuration de module. ## Version 4.4.04 de Deltacms - Modifications : diff --git a/core/core.php b/core/core.php index 538463c..3397d09 100644 --- a/core/core.php +++ b/core/core.php @@ -110,7 +110,7 @@ class common { // chargement des scripts et des styles dans head 'vendor' => [ 'jquery', - //'normalize', chargé dans main.php avant common.css + //'normalize', chargé par main.php avant common.css 'lity', 'filemanager', 'tippy', @@ -2109,6 +2109,80 @@ class common { echo '
    ' . $leftItems . '
    ' . $rightItems . '
'; } } + + /** + * Affiche la bannière + */ + public function showHeader( $homePageOnly, $headerClass){ + ?>
> + getData(['theme','header','feature']) === 'wallpaper' ) { + echo ($this->getData(['theme','header','linkHomePage']) ) ? '' : ''; + if( + $this->getData(['theme', 'header', 'textHide']) === false + // Affiche toujours le titre de la bannière pour l'édition du thème + OR ($this->getUrl(0) === 'theme' AND $this->getUrl(1) === 'header') + ): ?> + getData(['locale', 'title']); ?> + +   + getData(['theme','header','linkHomePage']) ) ? '' : ''; + } elseif( $this->getData(['theme','header','feature']) === 'feature') { ?> +
+ getData(['theme','header','featureContent']);?> +
+ getData(['theme','header','feature'])=== 'swiper' && $this->getData(['theme','header','swiperEffects']) === 'vertical'){ + $iterator = new DirectoryIterator('./'.$this->getData(['theme', 'header', 'swiperImagesDir' ])); + $imageFile = []; + foreach($iterator as $key=>$fileInfos) { + if($fileInfos->isDot() === false AND $fileInfos->isFile() AND @getimagesize($fileInfos->getPathname())) { + $imageFile[$key] = $fileInfos->getPathname(); + } + } + sort($imageFile); + $size = getimagesize($imageFile[0]); + $heightMod = 0; + if( isset( $_COOKIE["DELTA_COOKIE_INNERWIDTH"] ) ){ + $wclient = $_COOKIE["DELTA_COOKIE_INNERWIDTH"]; + } else { + $wclient = 1500; + } + $widthMod = $wclient; + if( $this->getData(['theme', 'site', 'width' ]) !== '100%' && ( ( $this->getData(['theme', 'header', 'wide' ]) === 'container' && $this->getData(['theme', 'header', 'position' ]) === 'body') + || $this->getData(['theme', 'header', 'position' ]) === 'site' ) ){ + switch ( $this->getData(['theme', 'site', 'width' ]) ) + { + case "75vw": + $widthMod = 0.75 * $wclient; + break; + case "85vw": + $widthMod = 0.85 * $wclient; + break; + case "95vw": + $widthMod = 0.95 * $wclient; + break; + default: + $widthMod = $wclient; + } + $heightMod = $size[1] * ( $widthMod / $size[0]); + $replace = '
'; + } else { + $heightMod = $size[1] * ( $wclient / $size[0]); + $replace = '
'; + } + $string = $this->getData(['theme','header','swiperContent']); + $start = strpos( $string, '
'; } showFavicon(); $this->showVendor('jshead'); - ?> - - getData(['page', $this->getUrl(0), 'moduleId']) === 'blog' + // Détection RSS + if ( ( $this->getData(['page', $this->getUrl(0), 'moduleId']) === 'blog' OR $this->getData(['page', $this->getUrl(0), 'moduleId']) === 'news' ) AND $this->getData(['module', $this->getUrl(0), 'config', 'feeds']) === TRUE ): ?> @@ -114,39 +113,16 @@ else { echo ''; } getUrl(0) !== 'theme' ){ if( $this->getUrl(0) !== $this->getData(['locale', 'homePageId' ]) && $this->getData(['theme','header','homePageOnly']) === true) $homePageOnly = true; - }?> - getData(['theme', 'header', 'position']) === 'body'): ?> - getData(['theme', 'header', 'position']) === 'body'){ $headerClass = ($this->getData(['theme', 'header', 'position']) === 'hide' || $homePageOnly === true) ? 'displayNone' : ''; $headerClass .= $this->getData(['theme', 'header', 'tinyHidden']) ? ' bannerDisplay ' : ''; $headerClass .= $this->getData(['theme', 'header', 'wide']) === 'none' ? '' : 'container'; - ?> -
> - getData(['theme','header','feature']) === 'wallpaper' ) { ?> - getData(['theme','header','linkHomePage']) ) ? '' : ''; ?> - getData(['theme', 'header', 'textHide']) === false - // Affiche toujours le titre de la bannière pour l'édition du thème - OR ($this->getUrl(0) === 'theme' AND $this->getUrl(1) === 'header') - ): ?> - getData(['locale', 'title']); ?> - -   - - getData(['theme','header','linkHomePage']) ) ? '' : ''; ?> - getData(['theme','header','feature']) === 'feature') { ?> -
- getData(['theme','header','featureContent']);?> -
- - - getData(['theme','header','swiperContent']);?> - -
- + $this->showHeader($homePageOnly, $headerClass); + }?> - getData(['theme', 'menu', 'position']) === 'body-second' ): + getData(['theme', 'menu', 'position']) === 'body-second'): // Menu dans le fond du site après la bannière et bannière limitée au site $navStyle = ''; if( $this->getData(['theme', 'header', 'position'])==='body' && $this->getData(['theme', 'header', 'wide'])==='container' ){ @@ -160,9 +136,11 @@ else { echo ''; } getData(['theme','menu','burgerContent']) === 'logo' ? '' : '' ;?>
- getData(['theme', 'menu', 'wide']) === 'none' ? 'class="container-large"' : 'class="container"'; - ?> + getData(['theme', 'menu', 'wide']) === 'none' ? 'class="container-large"' : 'class="container"'; + ?> + @@ -177,44 +155,22 @@ else { echo ''; }
- - getData(['theme', 'header', 'position']) === 'site' - // Affiche toujours la bannière pour l'édition du thème - OR ( - $this->getData(['theme', 'header', 'position']) === 'hide' - AND $this->getUrl(0) === 'theme' - ) - ): ?> - - getData(['theme', 'header', 'position']) === 'hide' || $homePageOnly === true) ? 'displayNone' : ''; - $headerClass .= $this->getData(['theme', 'header', 'tinyHidden']) ? ' bannerDisplay ' : ''; - ?> -
> - getData(['theme','header','feature']) === 'wallpaper' ){ ?> - getData(['theme','header','linkHomePage']) ) ? '' : ''; ?> - getData(['theme', 'header', 'textHide']) === false - // Affiche toujours le titre de la bannière pour l'édition du thème - OR ($this->getUrl(0) === 'theme' AND $this->getUrl(1) === 'header') - ): ?> - getData(['locale', 'title']); ?> - -   - - getData(['theme','header','linkHomePage']) ) ? '' : ''; ?> - getData(['theme','header','feature']) === 'feature' ){?> -
- getData(['theme','header','featureContent']);?> -
- - - getData(['theme','header','swiperContent']); ?> - -
- - getData(['theme', 'header', 'position']) === 'site' + // Affiche toujours la bannière pour l'édition du thème + OR ( + $this->getData(['theme', 'header', 'position']) === 'hide' + AND $this->getUrl(0) === 'theme' + ) + ): ?> + + getData(['theme', 'header', 'position']) === 'hide' || $homePageOnly === true) ? 'displayNone' : ''; + $headerClass .= $this->getData(['theme', 'header', 'tinyHidden']) ? ' bannerDisplay ' : ''; + $this->showHeader($homePageOnly, $headerClass); + endif; + if( $this->getData(['theme', 'menu', 'position']) === 'site-second' || $this->getData(['theme', 'menu', 'position']) === 'site' // Affiche toujours le menu pour l'édition du thème diff --git a/core/module/theme/lang/en/lex_theme.php b/core/module/theme/lang/en/lex_theme.php index a6ab379..1cdb459 100644 --- a/core/module/theme/lang/en/lex_theme.php +++ b/core/module/theme/lang/en/lex_theme.php @@ -205,7 +205,7 @@ $text['core_theme_view']['menu'][1] = 'Help'; $text['core_theme_view']['menu'][2] = 'Save'; $text['core_theme_view']['menu'][3] = 'Settings'; $text['core_theme_view']['menu'][4] = 'Position'; -$text['core_theme_view']['menu'][5] = 'Width'; +$text['core_theme_view']['menu'][5] = 'Layout'; $text['core_theme_view']['menu'][6] = 'Rounded edges'; $text['core_theme_view']['menu'][7] = 'Around the selected page'; $text['core_theme_view']['menu'][8] = 'Height'; @@ -240,6 +240,7 @@ $text['core_theme_view']['menu'][36] = 'Automatic background color'; $text['core_theme_view']['menu'][37] = 'Minimum width of a tab'; $text['core_theme_view']['menu'][38] = 'Minimum width of menu tabs. The submenu has a width imposed by that of the parent tab.'; $text['core_theme_view']['menu'][39] = 'On: all / Off: with submenu only'; +$text['core_theme_view']['menu'][40] = 'Layout of menu items. The width of the menu banner is automatically adjusted.'; $text['core_theme_view']['site'][0] = 'Back'; $text['core_theme_view']['site'][1] = 'Help'; $text['core_theme_view']['site'][2] = 'Save'; diff --git a/core/module/theme/lang/fr/lex_theme.php b/core/module/theme/lang/fr/lex_theme.php index b437f43..d767cf1 100644 --- a/core/module/theme/lang/fr/lex_theme.php +++ b/core/module/theme/lang/fr/lex_theme.php @@ -205,7 +205,7 @@ $text['core_theme_view']['menu'][1] = 'Aide'; $text['core_theme_view']['menu'][2] = 'Enregistrer'; $text['core_theme_view']['menu'][3] = 'Paramètres'; $text['core_theme_view']['menu'][4] = 'Position'; -$text['core_theme_view']['menu'][5] = 'Largeur'; +$text['core_theme_view']['menu'][5] = 'Disposition'; $text['core_theme_view']['menu'][6] = 'Bords arrondis'; $text['core_theme_view']['menu'][7] = 'Autour de la page sélectionnée'; $text['core_theme_view']['menu'][8] = 'Hauteur'; @@ -240,6 +240,7 @@ $text['core_theme_view']['menu'][36] = 'Couleur de fond automatique'; $text['core_theme_view']['menu'][37] = 'Largeur minimale d\'un onglet'; $text['core_theme_view']['menu'][38] = 'Largeur minimum des onglets du menu.Le sous-menu a une largeur imposée par celle de l\'onglet parent.'; $text['core_theme_view']['menu'][39] = 'On : tous / Off : avec sous-menu uniquement'; +$text['core_theme_view']['menu'][40] = 'Disposition des élèemnts de menu. La largeur du bandeau du menu, elle, s\'adapte automatiquement.'; $text['core_theme_view']['site'][0] = 'Retour'; $text['core_theme_view']['site'][1] = 'Aide'; $text['core_theme_view']['site'][2] = 'Enregistrer'; diff --git a/core/module/theme/theme.php b/core/module/theme/theme.php index a1a402b..6ed7408 100644 --- a/core/module/theme/theme.php +++ b/core/module/theme/theme.php @@ -504,7 +504,10 @@ class theme extends common { // Si pas d'image ou bannière personnalisée $this->setData(['theme', 'header', 'height', $this->getData(['theme', 'header', 'heightSelect']) ]); } - + // Bannière animée avec swiper mettre le background de la bannière à la couleur du background body + if( $this->getData(['theme', 'header', 'feature']) ==='swiper'){ + $this->setData(['theme', 'header', 'backgroundColor', $this->getData(['theme', 'body', 'backgroundColor']) ]); + } // Valeurs en sortie if (isset($_POST['themeHeaderSubmit'])){ $this->addOutput([ @@ -979,10 +982,40 @@ class theme extends common { // Adaptation du css au client pour l'option de défilement vertical if( $effect === 'vertical'){ $size = getimagesize($imageFile[0]); - $swiperContent .= ''; - $swiperContent .= ''; - } - $swiperContent .= '
'; + $heightMod = 0; + if( isset( $_COOKIE["DELTA_COOKIE_INNERWIDTH"] ) ){ + $wclient = $_COOKIE["DELTA_COOKIE_INNERWIDTH"]; + } else { + $wclient = 1500; + } + $widthMod = $wclient; + if( $this->getData(['theme', 'site', 'width' ]) !== '100%' && ( ( $this->getData(['theme', 'header', 'wide' ]) === 'container' && $this->getData(['theme', 'header', 'position' ]) === 'body') + || $this->getData(['theme', 'header', 'position' ]) === 'site' ) ){ + switch ( $this->getData(['theme', 'site', 'width' ]) ) + { + case "75vw": + $widthMod = 0.75 * $wclient; + break; + case "85vw": + $widthMod = 0.85 * $wclient; + break; + case "95vw": + $widthMod = 0.95 * $wclient; + break; + default: + $widthMod = $wclient; + } + $heightMod = $size[1] * ( $widthMod / $size[0]); + if( $widthMod < 10 || $heightMod <10 ){ $widthMod=10; $heightMod=10;} + $swiperContent .= '
'; + } else { + $heightMod = $size[1] * ( $wclient / $size[0]); + if( $heightMod <10 ){ $heightMod=10;} + $swiperContent .= '
'; + } + } else { + $swiperContent .= '
'; + } foreach($imageFile as $value ) { $swiperContent .= '
'; } diff --git a/core/module/theme/view/menu/menu.js.php b/core/module/theme/view/menu/menu.js.php index 6b23042..67ef0bd 100644 --- a/core/module/theme/view/menu/menu.js.php +++ b/core/module/theme/view/menu/menu.js.php @@ -34,7 +34,6 @@ $(document).ready(function(){ $("#themeMenuMargin").prop("checked", false).trigger("change"); }); } - }); @@ -137,7 +136,12 @@ $("input, select").on("change", function() { .attr("id", "themePreview") .text(css) .appendTo("head"); - + + if($("#themeMenuPosition").val() === 'site' || $("#themeMenuPosition").val() === 'hide' ) { + $(".themeMenuWideWrapper").hide(); + } else { + $(".themeMenuWideWrapper").show(); + } }); diff --git a/core/module/theme/view/menu/menu.php b/core/module/theme/view/menu/menu.php index 868cfce..77349e8 100644 --- a/core/module/theme/view/menu/menu.php +++ b/core/module/theme/view/menu/menu.php @@ -46,9 +46,10 @@ echo template::formOpen('themeMenuForm'); ?> ]); } ?>
-
+
$text['core_theme_view']['menu'][5], + 'help' => $text['core_theme_view']['menu'][40], 'selected' => $this->getData(['theme', 'menu', 'wide']) ]); ?>
diff --git a/core/module/theme/view/site/site.php b/core/module/theme/view/site/site.php index 5509fa0..33f4add 100644 --- a/core/module/theme/view/site/site.php +++ b/core/module/theme/view/site/site.php @@ -1,18 +1,7 @@ getData(['config', 'i18n', 'langAdmin']) . '/lex_theme.php'); -// Passage de la langue d'administration à Tinymce -/* -?> - -'; -echo ''; -echo ''; -*/ + echo template::formOpen('themeFooterForm'); echo template::formOpen('themeSiteForm'); ?>