Galerie 2.16 : règlage du thème WIP

This commit is contained in:
Fred Tempez 2020-04-17 19:02:04 +02:00
parent 52ad23b4f9
commit 77f28be18b
5 changed files with 233 additions and 6 deletions

View File

@ -26,6 +26,7 @@ class gallery extends common {
'dirs' => self::GROUP_MODERATOR, 'dirs' => self::GROUP_MODERATOR,
'sort' => self::GROUP_MODERATOR, 'sort' => self::GROUP_MODERATOR,
'edit' => self::GROUP_MODERATOR, 'edit' => self::GROUP_MODERATOR,
'theme' => self::GROUP_MODERATOR,
'index' => self::GROUP_VISITOR 'index' => self::GROUP_VISITOR
]; ];
@ -35,6 +36,56 @@ class gallery extends common {
self::SORT_HAND => 'Manuel' self::SORT_HAND => 'Manuel'
]; ];
public static $galleryThemeAlign = [
'left' => 'À gauche',
'center' => 'Au centre',
'right' => 'À droite'
];
public static $galleryThemeSize = [
'8em' => 'Très petite (8em)',
'10em' => 'Petite (10em)',
'12em' => '(12em)',
'14em' => 'Moyenne (14em)',
'16em' => '(16em)',
'18em' => 'Grande (18em)',
'20em' => 'Très grande (20em)'
];
public static $galleryThemeLegendHeight = [
'2em' => 'Très petite (2em)',
'4em' => 'Petite (4em)',
'6em' => 'Moyenne (6em)',
'8em' => 'Grande (8em)',
'10em' => 'Très grande (10em)'
];
public static $galleryThemeBorder = [
'0em' => 'Aucune',
'1em' => 'Très petite (1em)',
'2em' => 'Petite (2em)',
'3em' => 'Moyenne (3em)',
'4em' => 'Grande (4em)',
'5em' => 'Très grande (5em)'
];
public static $galleryThemeOpacity = [
'1' => 'Aucun ',
'.9' => 'Faible (.9)',
'.8' => 'Moyen (0.8)',
'.7' => 'Fort(0.7)',
'.6' => 'Très fort (0.6)'
];
public static $galleryThemeMargin = [
'0em' => 'Aucune',
'.2em' => 'Très petite (.2em)',
'.4em' => 'Petite (.4em)',
'.6em' => 'Moyenne (.6em)',
'.8em' => 'Grande (.8em)',
'1em' => 'Très grande (1em)'
];
public static $directories = []; public static $directories = [];
public static $firstPictures = []; public static $firstPictures = [];
@ -49,7 +100,7 @@ class gallery extends common {
public static $thumbs = []; public static $thumbs = [];
const GALLERY_VERSION = '2.15'; const GALLERY_VERSION = '2.16';
/** /**
@ -498,6 +549,47 @@ class gallery extends common {
} }
} }
/**
* Thème de la galerie
*/
public function theme() {
// Jeton incorrect
if ($this->getUrl(2) !== $_SESSION['csrf']) {
// Valeurs en sortie
$this->addOutput([
'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config',
'notification' => 'Action non autorisée'
]);
}
// Soumission du formulaire
if($this->isPost()) {
$this->setData(['module', $this->getUrl(0), $this->getUrl(1), [
'config' => [
'name' => $this->getData(['module',$this->getUrl(0),$this->getUrl(1),'config','name']),
'directory' => $this->getData(['module',$this->getUrl(0),$this->getUrl(1),'config','directory']),
'homePicture' => $this->getData(['module',$this->getUrl(0),$this->getUrl(1),'config','homePicture']),
'sort' => $this->getData(['module',$this->getUrl(0),$this->getUrl(1),'config','sort']),
'position' => $this->getData(['module',$this->getUrl(0),$this->getUrl(1),'config','position']),
'fullScreen' => $this->getData(['module',$this->getUrl(0),$this->getUrl(1),'config','fullScreen'])
],
'legend' => $this->getData(['module',$this->getUrl(0),$this->getUrl(1),'legend']),
'position' => $this->getData(['module',$this->getUrl(0),$this->getUrl(1),'position']),
'theme' => [
]
]]);
}
// Valeurs en sortie
$this->addOutput([
'title' => "Thème du module",
'view' => 'theme',
'vendor' => [
'tinycolorpicker'
]
]);
}
} }
class galleriesHelper extends helper { class galleriesHelper extends helper {

View File

@ -8,6 +8,12 @@
'value' => 'Retour' 'value' => 'Retour'
]); ?> ]); ?>
</div> </div>
<div class="col2 offset8">
<?php echo template::button('galleryConfigBack', [
//'href' => helper::baseUrl() . $this->getUrl(0) . '/theme/' . $_SESSION['csrf'],
'value' => 'Thème'
]); ?>
</div>
</div> </div>
<div class="row"> <div class="row">
<div class="col12"> <div class="col12">

View File

@ -1,7 +1,7 @@
.galleryPicture { .galleryPicture {
display: block; display: block;
border: 1px solid #DDD; border: 1px solid #000;
height: 150px; height: 8em;
background-size: cover; background-size: cover;
background-repeat: no-repeat; background-repeat: no-repeat;
background-position: center; background-position: center;
@ -17,7 +17,7 @@
left: 0; left: 0;
right: 0; right: 0;
bottom: 0; bottom: 0;
padding: 6px; padding: 8px;
background: rgba(0, 0, 0, .6); background: rgba(0, 0, 0, .6);
color: #FFF; color: #FFF;
text-align: center; text-align: center;
@ -29,9 +29,9 @@
} }
.colPicture { .colPicture {
width : 16em; width : 8em;
max-width: 50%; max-width: 50%;
margin: 0.5em; margin: 1.1em;
} }
@media (max-width: 432px) { @media (max-width: 432px) {

View File

@ -0,0 +1,16 @@
/**
* 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/
*/
@import url("core/layout/admin.css");

View File

@ -0,0 +1,113 @@
<?php echo template::formOpen('galleryThemeForm'); ?>
<div class="row">
<div class="col2">
<?php echo template::button('galleryThemeBack', [
'class' => 'buttonGrey',
'href' => helper::baseUrl() . $this->getUrl(0) . '/config',
'ico' => 'left',
'value' => 'Retour'
]); ?>
</div>
<div class="col2 offset8">
<?php echo template::submit('galleryThemeBack'); ?>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block">
<h4>Vignettes</h4>
<div class="row">
<div class="col4">
<?php echo template::select('galleryThemeThumbAlign', $module::$galleryThemeAlign, [
'label' => 'Alignement des vignettes sur la page :',
'selected' => $this->getData(['module', $this->getUrl(0),$this->getUrl(1),'theme','thumbAlign'])
]); ?>
</div>
<div class="col4">
<?php echo template::select('galleryThemeThumbWidth', $module::$galleryThemeSize, [
'label' => 'Largeur des vignettes :',
'selected' => $this->getData(['module', $this->getUrl(0),$this->getUrl(1),'theme','thumbWidth'])
]); ?>
</div>
<div class="col4">
<?php echo template::select('galleryThemeThumbHeight', $module::$galleryThemeSize, [
'label' => 'Hauteur des vignettes :',
'selected' => $this->getData(['module', $this->getUrl(0),$this->getUrl(1),'theme','legendHeight'])
]); ?>
</div>
</div>
<div class="row">
<div class="col4">
<?php echo template::select('galleryThemeThumbMargin', $module::$galleryThemeMargin, [
'label' => 'Marges autour des vignettes :',
'selected' => $this->getData(['module', $this->getUrl(0),$this->getUrl(1),'theme','thumbMargin'])
]); ?>
</div>
<div class="col4">
<?php echo template::select('galleryThemeThumbBorder', $module::$galleryThemeBorder, [
'label' => 'Epaisseur des bordures',
'selected' => $this->getData(['module', $this->getUrl(0),$this->getUrl(1),'theme','thumbBorder'])
]); ?>
</div>
<div class="col4">
<?php echo template::select('galleryThemeThumbOpacity', $module::$galleryThemeOpacity, [
'label' => 'Effet d\'opacité au survol',
'selected' => $this->getData(['module', $this->getUrl(0),$this->getUrl(1),'theme','thumbOpacity'])
]); ?>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col12">
<div class="block">
<h4>Légendes</h4>
<div class="row">
<div class="col6">
<?php echo template::select('galleryThemelegendHeight', $module::$galleryThemeLegendHeight, [
'label' => 'Hauteur des légendes :',
'selected' => $this->getData(['module', $this->getUrl(0),$this->getUrl(1),'theme','legendHeight'])
]); ?>
</div>
<div class="col6">
<?php echo template::select('galleryThemeThumbAlign', $module::$galleryThemeAlign, [
'label' => 'Alignement des légendes dans les vignettes :',
'selected' => $this->getData(['module', $this->getUrl(0),$this->getUrl(1),'theme','legendAlign'])
]); ?>
</div>
</div>
<div class="row">
<div class="col4">
<?php echo template::text('galleryThemelegendTextcolor', [
'class' => 'colorPicker',
'help' => 'Le curseur horizontal règle le niveau de transparence.',
'label' => 'Couleur du texte de légende',
'value' => $this->getData(['module', $this->getUrl(0),$this->getUrl(1),'theme','legendTextColor'])
]); ?>
</div>
<div class="col4">
<?php echo template::text('galleryThemelegendBgcolor', [
'class' => 'colorPicker',
'help' => 'Le curseur horizontal règle le niveau de transparence.',
'label' => 'Couleur du fond de la légende',
'value' => $this->getData(['module', $this->getUrl(0),$this->getUrl(1),'theme','legendBgColor'])
]); ?>
</div>
<div class="col4">
<?php echo template::select('galleryThemelegendOpacity', $module::$galleryThemeOpacity, [
'label' => 'Opacité du fond des légendes :',
'selected' => $this->getData(['module', $this->getUrl(0),$this->getUrl(1),'theme','legendOpacity'])
]); ?>
</div>
</div>
</div>
</div>
<?php echo template::formClose(); ?>
<div class="row">
<div class="col12">
<div class="moduleVersion">Version
<?php echo $module::GALLERY_VERSION; ?>
</div>
</div>
</div>