diff --git a/module/gallery/gallery.php b/module/gallery/gallery.php index 89c06d29..05350935 100755 --- a/module/gallery/gallery.php +++ b/module/gallery/gallery.php @@ -36,6 +36,14 @@ class gallery extends common { self::SORT_HAND => 'Manuel' ]; + public static $galleryThemeFlexAlign = [ + 'flex-start' => 'À gauche', + 'center' => 'Au centre', + 'flex-end' => 'À droite', + 'space-around' => 'Distribué avec marges', + 'space-between' => 'Distribué sans marge', + ]; + public static $galleryThemeAlign = [ 'left' => 'À gauche', 'center' => 'Au centre', @@ -43,47 +51,46 @@ class gallery extends common { ]; public static $galleryThemeSize = [ - '8em' => 'Très petite (8em)', - '10em' => 'Petite (10em)', - '12em' => '(12em)', - '14em' => 'Moyenne (14em)', - '16em' => '(16em)', + '9em' => 'Très petite (9em)', + '12em' => 'Petite (12em)', + '15em' => 'Moyenne (15em)', '18em' => 'Grande (18em)', - '20em' => 'Très grande (20em)' + '21em' => 'Très grande (21em)' ]; public static $galleryThemeLegendHeight = [ - '2em' => 'Très petite (2em)', - '4em' => 'Petite (4em)', - '6em' => 'Moyenne (6em)', - '8em' => 'Grande (8em)', - '10em' => 'Très grande (10em)' + '.125em' => 'Très petite (.125 em)', + '.25em' => 'Petite (.25em)', + '.375em' => 'Moyenne (.375em)', + '.5em' => 'Grande (.5em)', + '.625em' => 'Très grande (.625em)' ]; public static $galleryThemeBorder = [ '0em' => 'Aucune', - '1em' => 'Très petite (1em)', - '2em' => 'Petite (2em)', - '3em' => 'Moyenne (3em)', - '4em' => 'Grande (4em)', - '5em' => 'Très grande (5em)' + '.1em' => 'Très petite (.1em)', + '.4em' => 'Petite (.2em)', + '.5em' => 'Moyenne (.5em)', + '.8em' => 'Grande (.8em)', + '1.2em' => 'Très grande (1.2em)' ]; public static $galleryThemeOpacity = [ '1' => 'Aucun ', - '.9' => 'Faible (.9)', - '.8' => 'Moyen (0.8)', - '.7' => 'Fort(0.7)', - '.6' => 'Très fort (0.6)' + '.9' => 'Très Discrète (.9)', + '.8' => 'Discrète (0.8)', + '.7' => 'Moyenne (0.7)', + '.6' => 'Forte (0.6)', + '.5' => 'Très forte (0.5)' ]; public static $galleryThemeMargin = [ '0em' => 'Aucune', - '.2em' => 'Très petite (.2em)', - '.4em' => 'Petite (.4em)', + '.1em' => 'Très petite (.1em)', + '.3em' => 'Petite (.3em)', '.6em' => 'Moyenne (.6em)', - '.8em' => 'Grande (.8em)', - '1em' => 'Très grande (1em)' + '.9em' => 'Grande (.9em)', + '1.2em' => 'Très grande (1.2em)' ]; public static $directories = []; @@ -100,7 +107,7 @@ class gallery extends common { public static $thumbs = []; - const GALLERY_VERSION = '2.16'; + const GALLERY_VERSION = '2.17'; /** @@ -560,25 +567,47 @@ class gallery extends common { 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config', 'notification' => 'Action non autorisée' ]); - } + } + // Initialisation des données de thème de la galerie dasn theme.json + // Création des valeur par défaut absentes + if ( $this->getData(['theme', $this->getUrl(0)]) === null ) { + require_once('module/gallery/ressource/defaultdata.php'); + $this->setData(['theme', $this->getUrl(0), theme::$defaultData]); + } // 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' => [ - + $this->setData(['theme', $this->getUrl(0), [ + 'thumbAlign' => $this->getinput('galleryThemeThumbAlign'), + 'thumbWidth' => $this->getinput('galleryThemeThumbWidth'), + 'thumbHeight' => $this->getinput('galleryThemeThumbHeight'), + 'thumbMargin' => $this->getinput('galleryThemeThumbMargin'), + 'thumbBorder' => $this->getinput('galleryThemeThumbBorder'), + 'ThumbBorderColor' => $this->getinput('galleryThemeThumbBorderColor'), + 'thumbOpacity' => $this->getinput('galleryThemeThumbOpacity'), + 'legendHeight' => $this->getinput('galleryThemeLegendHeight'), + 'legendAlign' => $this->getinput('galleryThemeLegendAlign'), + 'legendTextColor'=> $this->getinput('galleryThemeLegendTextColor'), + 'legendBgColor' => $this->getinput('galleryThemeLegendBgColor') ] - ]]); + ]); + // Création des fichiers CSS + $content = file_get_contents('module/gallery/ressource/vartheme.css'); + $themeCss = file_get_contents('module/gallery/ressource/theme.css'); + // Injection des variables + $content = str_replace('#thumbAlign#',$this->getinput('galleryThemeThumbAlign'),$content ); + $content = str_replace('#thumbWidth#',$this->getinput('galleryThemeThumbWidth'),$content ); + $content = str_replace('#thumbHeight#',$this->getinput('galleryThemeThumbHeight'),$content ); + $content = str_replace('#thumbMargin#',$this->getinput('galleryThemeThumbMargin'),$content ); + $content = str_replace('#thumbBorder#',$this->getinput('galleryThemeThumbBorder'),$content ); + $content = str_replace('#thumbBorderColor#',$this->getinput('galleryThemeThumbBorderColor'),$content ); + $content = str_replace('#thumbOpacity#',$this->getinput('galleryThemeThumbOpacity'),$content ); + $content = str_replace('#legendAlign#',$this->getinput('galleryThemeLegendAlign'),$content ); + $content = str_replace('#legendHeight#',$this->getinput('galleryThemeLegendHeight'),$content ); + $content = str_replace('#legendTextColor#',$this->getinput('galleryThemeLegendTextColor'),$content ); + $content = str_replace('#legendBgColor#',$this->getinput('galleryThemeLegendBgColor'),$content ); + file_put_contents('module/gallery/view/index/index.css',$content . $themeCss); + file_put_contents('module/gallery/view/gallery/gallery.css',$content . $themeCss); } // Valeurs en sortie $this->addOutput([ diff --git a/module/gallery/ressource/defaultdata.php b/module/gallery/ressource/defaultdata.php new file mode 100644 index 00000000..207ce317 --- /dev/null +++ b/module/gallery/ressource/defaultdata.php @@ -0,0 +1,16 @@ + 'center', + 'thumbWidth' => '18em', + 'thumbHeight' => '15em', + 'thumbMargin' => '.6em', + 'thumbBorder' => '.1em', + 'thumbOpacity' => '.7', + 'ThumbBorderColor' => 'rgba(221, 221, 221, 1)', + 'legendHeight' => '.375em', + 'legendAlign' => 'center', + 'legendTextColor'=> 'rgba(255, 255, 255, 1)', + 'legendBgColor' => 'rgba(0, 0, 0, .6)' + ]; +} diff --git a/module/gallery/ressource/theme.css b/module/gallery/ressource/theme.css new file mode 100644 index 00000000..7f6170fc --- /dev/null +++ b/module/gallery/ressource/theme.css @@ -0,0 +1,47 @@ +.galleryPicture, +.galleryGalleryPicture { + display: block; + border: var(--thumbBorder) solid var(--thumbBorderColor); + height: var(--thumbHeight); + background-size: cover; + background-repeat: no-repeat; + background-position: center; + position: relative; + -webkit-transition: opacity .3s ease-out; + transition: opacity .3s ease-out; +} +.galleryPicture:hover, +.galleryGalleryPicture:hover { + opacity: var(--thumbOpacity); +} +.galleryName, +.galleryGalleryName { + position: absolute; + left: 0; + right: 0; + bottom: 0; + padding: var(--legendHeight); + background: var(--legendBgColor); + color: var(--legendTextColor); + text-align: var(--legendAlign); +} + +.galleryRow { + display: flex; + flex-wrap: wrap; + justify-content: var(--thumbAlign); +} + +.colPicture { + width : var(--thumbWidth); + max-width: 50%; + margin: var(--thumbMargin); + } + + @media (max-width: 432px) { + .colPicture { + width: 90%; + max-width: 90%; + margin: 0.5em; + } + } \ No newline at end of file diff --git a/module/gallery/ressource/vartheme.css b/module/gallery/ressource/vartheme.css new file mode 100644 index 00000000..e483de6e --- /dev/null +++ b/module/gallery/ressource/vartheme.css @@ -0,0 +1,24 @@ +.galleryRow { + --thumbAlign: #thumbAlign#; +} +.colPicture { + --thumbWidth: #thumbWidth#; + --thumbMargin: #thumbMargin#; +} +.galleryPicture, +.galleryGalleryPicture { + --thumbHeight: #thumbHeight#; + --thumbBorder: #thumbBorder#; + --thumbBorderColor: #thumbBorderColor#; +} +.galleryName, +.galleryGalleryName { + --legendHeight: #legendHeight#; + --legendAlign: #legendAlign#; + --legendTextColor: #legendTextColor#; + --legendBgColor: #legendBgColor#; +} +.galleryPicture:hover, +.galleryGalleryPicture:hover { + --thumbOpacity: #thumbOpacity#; +} diff --git a/module/gallery/view/config/config.php b/module/gallery/view/config/config.php index b59bc2f1..290dd3c5 100755 --- a/module/gallery/view/config/config.php +++ b/module/gallery/view/config/config.php @@ -10,7 +10,7 @@
helper::baseUrl() . $this->getUrl(0) . '/theme/' . $_SESSION['csrf'], + 'href' => helper::baseUrl() . $this->getUrl(0) . '/theme/' . $_SESSION['csrf'], 'value' => 'Thème' ]); ?>
diff --git a/module/gallery/view/gallery/gallery.css b/module/gallery/view/gallery/gallery.css old mode 100755 new mode 100644 index 479e5087..f5bfb291 --- a/module/gallery/view/gallery/gallery.css +++ b/module/gallery/view/gallery/gallery.css @@ -1,7 +1,32 @@ +.galleryRow { + --thumbAlign: center; +} +.colPicture { + --thumbWidth: 18em; + --thumbMargin: .6em; +} +.galleryPicture, +.galleryGalleryPicture { + --thumbHeight: 15em; + --thumbBorder: .1em; + --thumbBorderColor: rgba(221, 221, 221, 1); +} +.galleryName, +.galleryGalleryName { + --legendHeight: .375em; + --legendAlign: center; + --legendTextColor: rgba(255, 255, 255, 1); + --legendBgColor: rgba(0, 0, 0, .6); +} +.galleryPicture:hover, +.galleryGalleryPicture:hover { + --thumbOpacity: .7; +} +.galleryPicture, .galleryGalleryPicture { display: block; - border: 1px solid #DDD; - height: 150px; + border: var(--thumbBorder) solid var(--thumbBorderColor); + height: var(--thumbHeight); background-size: cover; background-repeat: no-repeat; background-position: center; @@ -9,29 +34,32 @@ -webkit-transition: opacity .3s ease-out; transition: opacity .3s ease-out; } +.galleryPicture:hover, .galleryGalleryPicture:hover { - opacity: .7; + opacity: var(--thumbOpacity); } +.galleryName, .galleryGalleryName { position: absolute; left: 0; right: 0; bottom: 0; - padding: 6px; - background: rgba(0, 0, 0, .6); - color: #FFF; - text-align: center; + padding: var(--legendHeight); + background: var(--legendBgColor); + color: var(--legendTextColor); + text-align: var(--legendAlign); } + .galleryRow { display: flex; flex-wrap: wrap; - justify-content: center; + justify-content: var(--thumbAlign); } .colPicture { - width : 16em; + width : var(--thumbWidth); max-width: 50%; - margin: 0.5em; + margin: var(--thumbMargin); } @media (max-width: 432px) { diff --git a/module/gallery/view/index/index.css b/module/gallery/view/index/index.css old mode 100755 new mode 100644 index 818b7829..f5bfb291 --- a/module/gallery/view/index/index.css +++ b/module/gallery/view/index/index.css @@ -1,7 +1,32 @@ -.galleryPicture { +.galleryRow { + --thumbAlign: center; +} +.colPicture { + --thumbWidth: 18em; + --thumbMargin: .6em; +} +.galleryPicture, +.galleryGalleryPicture { + --thumbHeight: 15em; + --thumbBorder: .1em; + --thumbBorderColor: rgba(221, 221, 221, 1); +} +.galleryName, +.galleryGalleryName { + --legendHeight: .375em; + --legendAlign: center; + --legendTextColor: rgba(255, 255, 255, 1); + --legendBgColor: rgba(0, 0, 0, .6); +} +.galleryPicture:hover, +.galleryGalleryPicture:hover { + --thumbOpacity: .7; +} +.galleryPicture, +.galleryGalleryPicture { display: block; - border: 1px solid #DDD; - height: 14em; + border: var(--thumbBorder) solid var(--thumbBorderColor); + height: var(--thumbHeight); background-size: cover; background-repeat: no-repeat; background-position: center; @@ -9,29 +34,32 @@ -webkit-transition: opacity .3s ease-out; transition: opacity .3s ease-out; } -.galleryPicture:hover { - opacity: .7; +.galleryPicture:hover, +.galleryGalleryPicture:hover { + opacity: var(--thumbOpacity); } -.galleryName { +.galleryName, +.galleryGalleryName { position: absolute; left: 0; right: 0; bottom: 0; - padding: 8px; - background: rgba(0, 0, 0, .6); - color: #FFF; - text-align: center; + padding: var(--legendHeight); + background: var(--legendBgColor); + color: var(--legendTextColor); + text-align: var(--legendAlign); } + .galleryRow { display: flex; flex-wrap: wrap; - justify-content: center; + justify-content: var(--thumbAlign); } .colPicture { - width : 16em; + width : var(--thumbWidth); max-width: 50%; - margin: 0.5em; + margin: var(--thumbMargin); } @media (max-width: 432px) { diff --git a/module/gallery/view/theme/theme.php b/module/gallery/view/theme/theme.php index 803e1667..0533707e 100755 --- a/module/gallery/view/theme/theme.php +++ b/module/gallery/view/theme/theme.php @@ -15,44 +15,52 @@
-

Vignettes

+

Configuration des vignettes

- 'Alignement des vignettes sur la page :', - 'selected' => $this->getData(['module', $this->getUrl(0),$this->getUrl(1),'theme','thumbAlign']) + 'selected' => $this->getData(['theme', $this->getUrl(0),'thumbAlign']) ]); ?>
'Largeur des vignettes :', - 'selected' => $this->getData(['module', $this->getUrl(0),$this->getUrl(1),'theme','thumbWidth']) + 'selected' => $this->getData(['theme', $this->getUrl(0),'thumbWidth']) ]); ?>
'Hauteur des vignettes :', - 'selected' => $this->getData(['module', $this->getUrl(0),$this->getUrl(1),'theme','legendHeight']) + 'selected' => $this->getData(['theme', $this->getUrl(0),'thumbHeight']) ]); ?>
-
+
'Marges autour des vignettes :', - 'selected' => $this->getData(['module', $this->getUrl(0),$this->getUrl(1),'theme','thumbMargin']) + 'selected' => $this->getData(['theme', $this->getUrl(0),'thumbMargin']) ]); ?>
-
+
'Epaisseur des bordures', - 'selected' => $this->getData(['module', $this->getUrl(0),$this->getUrl(1),'theme','thumbBorder']) + 'selected' => $this->getData(['theme', $this->getUrl(0),'thumbBorder']) ]); ?>
-
+
+ 'colorPicker', + 'help' => 'Le curseur horizontal règle le niveau de transparence.', + 'label' => 'Couleur de la bordure', + 'value' => $this->getData(['theme', $this->getUrl(0),'ThumbBorderColor']) + ]); ?> +
+
'Effet d\'opacité au survol', - 'selected' => $this->getData(['module', $this->getUrl(0),$this->getUrl(1),'theme','thumbOpacity']) + 'label' => 'Opacité au survol', + 'selected' => $this->getData(['theme', $this->getUrl(0),'thumbOpacity']) ]); ?>
@@ -62,44 +70,38 @@
-

Légendes

+

Configuration des légendes

- 'Hauteur des légendes :', - 'selected' => $this->getData(['module', $this->getUrl(0),$this->getUrl(1),'theme','legendHeight']) + 'selected' => $this->getData(['theme', $this->getUrl(0),'legendHeight']) ]); ?>
- 'Alignement des légendes dans les vignettes :', - 'selected' => $this->getData(['module', $this->getUrl(0),$this->getUrl(1),'theme','legendAlign']) + 'selected' => $this->getData(['theme', $this->getUrl(0),'legendAlign']) ]); ?>
-
- + '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']) + 'value' => $this->getData(['theme', $this->getUrl(0),'legendTextColor']) ]); ?>
-
- + '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']) + 'value' => $this->getData(['theme', $this->getUrl(0),'legendBgColor']) ]); ?>
-
- 'Opacité du fond des légendes :', - 'selected' => $this->getData(['module', $this->getUrl(0),$this->getUrl(1),'theme','legendOpacity']) - ]); ?> -