bannière animée et theme menu

This commit is contained in:
Deltacms 2023-02-18 08:16:35 +01:00
parent 8e4c88d1e0
commit af899484b7
9 changed files with 171 additions and 97 deletions

View File

@ -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 :

View File

@ -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',
@ -2110,6 +2110,80 @@ class common {
}
}
/**
* Affiche la bannière
*/
public function showHeader( $homePageOnly, $headerClass){
?><header <?php echo empty($headerClass) ? '' : 'class="' . $headerClass . '"'; ?> >
<?php if ($this->getData(['theme','header','feature']) === 'wallpaper' ) {
echo ($this->getData(['theme','header','linkHomePage']) ) ? '<a class="headertitle" href="' . helper::baseUrl(false) . '">' : '';
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')
): ?>
<span class="notranslate" id="themeHeaderTitle"><?php echo $this->getData(['locale', 'title']); ?></span>
<?php else: ?>
<span id="themeHeaderTitle">&nbsp;</span>
<?php endif;
echo ( $this->getData(['theme','header','linkHomePage']) ) ? '</a>' : '';
} elseif( $this->getData(['theme','header','feature']) === 'feature') { ?>
<div id="featureContent">
<?php echo $this->getData(['theme','header','featureContent']);?>
</div>
<?php } else {
// Swiper avec défilement vertical ? Pour adaptation à la largeur de l'écran client
if( $this->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 = '<div class="swiper mySwiper" style="width: '. (int)$widthMod . 'px; height:'.(int)$heightMod.'px">';
} else {
$heightMod = $size[1] * ( $wclient / $size[0]);
$replace = '<div class="swiper mySwiper" style="width: 100%; height:'.(int)$heightMod.'px">';
}
$string = $this->getData(['theme','header','swiperContent']);
$start = strpos( $string, '<div class="swiper mySwiper" style="');
$end = strpos($string,'>', $start);
$search = substr( $string, $start, $end - $start + 1 );
$string = str_replace( $search, $replace, $string );
$this->setData(['theme','header','swiperContent', $string]);
}
if( ! $homePageOnly ) echo $this->getData(['theme','header','swiperContent']);
} ?>
</header> <?php
}
/**
* Affiche le script
*/
@ -2171,6 +2245,16 @@ class common {
* Affiche les scripts et les styles dans le head ou le body
*/
public function showVendor($type) {
// Pour bannière animée verticale
if( $type === 'jshead' && $this->getData(['theme','header','feature'])=== 'swiper' && $this->getData(['theme','header','swiperEffects']) === 'vertical' ){
?> <script>var wclient = window.innerWidth; document.cookie = "DELTA_COOKIE_INNERWIDTH =" + wclient + "; samesite=lax;" ; </script> <?php
if( !isset( $_COOKIE["DELTA_COOKIE_INNERWIDTH"]) && !isset( $_SESSION["innerWidth"] ) ){
$protocol = helper::isHttps() === true ? 'https://' : 'http://';
$url = $protocol . $_SERVER[ 'HTTP_HOST' ];
?> <script>window.location.replace(" <?php echo $url ?>");</script> <?php
$_SESSION["innerWidth"] = 'done';
}
}
switch ($type) {
case 'css' :
$vendorPath = self::$cssVendorPath;

View File

@ -26,9 +26,8 @@ else { echo '<html lang="'.$lang.'">'; }
<?php
$this->showFavicon();
$this->showVendor('jshead');
?>
<!-- Détection RSS -->
<?php if ( ( $this->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 ): ?>
<link rel="alternate" type="application/rss+xml" href="'<?php echo helper::baseUrl(). $this->getUrl(0) . '/rss';?>" title="fLUX rss">
@ -114,39 +113,16 @@ else { echo '<html lang="'.$lang.'">'; }
<?php $homePageOnly = false;
if( $this->getUrl(0) !== 'theme' ){
if( $this->getUrl(0) !== $this->getData(['locale', 'homePageId' ]) && $this->getData(['theme','header','homePageOnly']) === true) $homePageOnly = true;
}?>
<?php if($this->getData(['theme', 'header', 'position']) === 'body'): ?>
<?php
}
if($this->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';
?>
<header <?php echo empty($headerClass) ? '' : 'class="' . $headerClass . '"'; ?> >
<?php if ($this->getData(['theme','header','feature']) === 'wallpaper' ) { ?>
<?php echo ($this->getData(['theme','header','linkHomePage']) ) ? '<a class="headertitle" href="' . helper::baseUrl(false) . '">' : ''; ?>
<?php 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')
): ?>
<span class="notranslate" id="themeHeaderTitle"><?php echo $this->getData(['locale', 'title']); ?></span>
<?php else: ?>
<span id="themeHeaderTitle">&nbsp;</span>
<?php endif; ?>
<?php echo ( $this->getData(['theme','header','linkHomePage']) ) ? '</a>' : ''; ?>
<?php } elseif( $this->getData(['theme','header','feature']) === 'feature') { ?>
<div id="featureContent">
<?php echo $this->getData(['theme','header','featureContent']);?>
</div>
<?php } else { ?>
<!-- Swiper -->
<?php if( ! $homePageOnly) echo $this->getData(['theme','header','swiperContent']);?>
<?php } ?>
</header>
<?php endif; ?>
$this->showHeader($homePageOnly, $headerClass);
}?>
<!-- Menu dans le fond du site après la bannière -->
<?php if( $this->getData(['theme', 'menu', 'position']) === 'body-second' ):
<?php if($this->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' ){
@ -161,8 +137,10 @@ else { echo '<html lang="'.$lang.'">'; }
<?php echo template::ico('menu',null,null,'2em'); ?></div>
<!-- fin du menu burger -->
<?php
$menuClass = $this->getData(['theme', 'menu', 'wide']) === 'none' ? 'class="container-large"' : 'class="container"';
?> <div id="menu" <?php echo $menuClass; ?> > <?php $this->showMenu(); ?> </div>
$menuClass = $this->getData(['theme', 'menu', 'wide']) === 'none' ? 'class="container-large"' : 'class="container"';
?>
<div id="menu" <?php echo $menuClass; ?> >
<?php $this->showMenu(); ?></div>
</nav>
<?php endif; ?>
@ -177,44 +155,22 @@ else { echo '<html lang="'.$lang.'">'; }
<?php echo template::ico('menu',null,null,'2em'); ?></div>
<div id="menu" class="container"><?php $this->showMenu(); ?></div>
</nav>
<?php endif; ?>
<?php if(
$this->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'
)
): ?>
<!-- Bannière dans le site -->
<?php
$headerClass = ($this->getData(['theme', 'header', 'position']) === 'hide' || $homePageOnly === true) ? 'displayNone' : '';
$headerClass .= $this->getData(['theme', 'header', 'tinyHidden']) ? ' bannerDisplay ' : '';
?>
<header <?php echo empty($headerClass) ? '' : 'class="' . $headerClass . '"';?>>
<?php if ($this->getData(['theme','header','feature']) === 'wallpaper' ){ ?>
<?php echo ( $this->getData(['theme','header','linkHomePage']) ) ? '<a class="headertitle" href="' . helper::baseUrl(false) . '">' : ''; ?>
<?php 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')
): ?>
<span class="notranslate" id="themeHeaderTitle"><?php echo $this->getData(['locale', 'title']); ?></span>
<?php else: ?>
<span id="themeHeaderTitle">&nbsp;</span>
<?php endif; ?>
<?php echo ( $this->getData(['theme','header','linkHomePage']) ) ? '</a>' : ''; ?>
<?php } elseif($this->getData(['theme','header','feature']) === 'feature' ){?>
<div id="featureContent">
<?php echo $this->getData(['theme','header','featureContent']);?>
</div>
<?php } else { ?>
<!-- Swiper -->
<?php if( ! $homePageOnly) echo $this->getData(['theme','header','swiperContent']); ?>
<?php } ?>
</header>
<?php endif; ?>
<?php if(
<?php endif;
if(
$this->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'
)
): ?>
<!-- Bannière dans le site -->
<?php
$headerClass = ($this->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

View File

@ -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';

View File

@ -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';

View File

@ -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 .= '<script>var verticalBannerHeightImg = '. $size[1]. '; var verticalBannerWidthImg = '.$size[0]. '; var verticalBannerWidthSite = "'. $this->getData(['theme', 'site', 'width' ]).'"; </script>';
$swiperContent .= '<script src="'.helper::baseUrl(false).'core/vendor/swiper/swiperEffectVertical.js"></script>';
$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 .= '<div id="headerSwiper"><div class="swiper mySwiper" style="width: '. (int)$widthMod . 'px; height:'.(int)$heightMod.'px"><div class="swiper-wrapper">';
} else {
$heightMod = $size[1] * ( $wclient / $size[0]);
if( $heightMod <10 ){ $heightMod=10;}
$swiperContent .= '<div id="headerSwiper"><div class="swiper mySwiper" style="width: 100%; height:'.(int)$heightMod.'px"><div class="swiper-wrapper">';
}
} else {
$swiperContent .= '<div id="headerSwiper"><div class="swiper mySwiper"><div class="swiper-wrapper">';
}
$swiperContent .= '<div id="headerSwiper"><div class="swiper mySwiper"><div class="swiper-wrapper">';
foreach($imageFile as $value ) {
$swiperContent .= '<div class="swiper-slide"><img src="'.$value.'" /></div>';
}

View File

@ -34,7 +34,6 @@ $(document).ready(function(){
$("#themeMenuMargin").prop("checked", false).trigger("change");
});
}
});
@ -138,6 +137,11 @@ $("input, select").on("change", function() {
.text(css)
.appendTo("head");
if($("#themeMenuPosition").val() === 'site' || $("#themeMenuPosition").val() === 'hide' ) {
$(".themeMenuWideWrapper").hide();
} else {
$(".themeMenuWideWrapper").show();
}
});

View File

@ -46,9 +46,10 @@ echo template::formOpen('themeMenuForm'); ?>
]); }
?>
</div>
<div class="col6">
<div class="col6 themeMenuWideWrapper">
<?php echo template::select('themeMenuWide', $containerWides, [
'label' => $text['core_theme_view']['menu'][5],
'help' => $text['core_theme_view']['menu'][40],
'selected' => $this->getData(['theme', 'menu', 'wide'])
]); ?>
</div>

View File

@ -1,18 +1,7 @@
<?php
// Lexique
include('./core/module/theme/lang/'. $this->getData(['config', 'i18n', 'langAdmin']) . '/lex_theme.php');
// Passage de la langue d'administration à Tinymce
/*
?>
<script>
var lang_admin = "<?php echo $lang_admin ?>";
</script>
<?php
// Inclusion de tinymce
echo '<script src="' . helper::baseUrl(false) . 'core/vendor/tinymce/tinymce.min.js' . '"></script>';
echo '<script src="' . helper::baseUrl(false) . 'core/vendor/tinymce/init.js' . '"></script>';
echo '<link rel="stylesheet" href="' . helper::baseUrl(false) . 'core/vendor/tinymce/init.css' . '">';
*/
echo template::formOpen('themeFooterForm');
echo template::formOpen('themeSiteForm'); ?>
<div class="row">