From 3c32371899e36949bdfb707ec0d2b20e4f8501e8 Mon Sep 17 00:00:00 2001 From: fredtempez Date: Sat, 30 Mar 2024 21:40:17 +0100 Subject: [PATCH] init geogallery --- module/geogallery/changes.md | 2 + module/geogallery/enum.json | 1 + module/geogallery/geogallery.php | 1101 +++++++++++++++++ module/geogallery/i18n/de.json | 44 + module/geogallery/i18n/en_EN.json | 44 + module/geogallery/i18n/es.json | 44 + module/geogallery/i18n/fr_FR.json | 44 + module/geogallery/i18n/gr_GR.json | 44 + module/geogallery/i18n/it.json | 44 + module/geogallery/i18n/pt_PT.json | 44 + module/geogallery/i18n/tr_TR.json | 44 + module/geogallery/profil/main/add.inc.php | 12 + module/geogallery/profil/main/edit.inc.php | 12 + module/geogallery/profil/view/add.inc.php | 28 + module/geogallery/profil/view/edit.inc.php | 38 + module/geogallery/ressource/defaultdata.php | 25 + module/geogallery/ressource/theme.css | 52 + module/geogallery/ressource/vartheme.css | 27 + .../vendor/tablednd/MIT-LICENSE.txt | 22 + module/geogallery/vendor/tablednd/inc.json | 3 + .../geogallery/vendor/tablednd/lisez-moi.txt | 2 + .../vendor/tablednd/tablednd.min.js | 2 + module/geogallery/view/add/add.css | 19 + module/geogallery/view/add/add.js.php | 88 ++ module/geogallery/view/add/add.php | 66 + module/geogallery/view/config/config.css | 24 + module/geogallery/view/config/config.js.php | 47 + module/geogallery/view/config/config.php | 44 + module/geogallery/view/edit/edit.css | 18 + module/geogallery/view/edit/edit.js.php | 87 ++ module/geogallery/view/edit/edit.php | 34 + module/geogallery/view/gallery/gallery.css | 14 + module/geogallery/view/gallery/gallery.js.php | 31 + module/geogallery/view/gallery/gallery.php | 33 + module/geogallery/view/index/index.php | 17 + module/geogallery/view/option/option.css | 18 + module/geogallery/view/option/option.js.php | 68 + module/geogallery/view/option/option.php | 120 ++ module/geogallery/view/theme/theme.css | 18 + module/geogallery/view/theme/theme.php | 134 ++ 40 files changed, 2559 insertions(+) create mode 100644 module/geogallery/changes.md create mode 100644 module/geogallery/enum.json create mode 100644 module/geogallery/geogallery.php create mode 100644 module/geogallery/i18n/de.json create mode 100644 module/geogallery/i18n/en_EN.json create mode 100644 module/geogallery/i18n/es.json create mode 100644 module/geogallery/i18n/fr_FR.json create mode 100644 module/geogallery/i18n/gr_GR.json create mode 100644 module/geogallery/i18n/it.json create mode 100644 module/geogallery/i18n/pt_PT.json create mode 100644 module/geogallery/i18n/tr_TR.json create mode 100644 module/geogallery/profil/main/add.inc.php create mode 100644 module/geogallery/profil/main/edit.inc.php create mode 100644 module/geogallery/profil/view/add.inc.php create mode 100644 module/geogallery/profil/view/edit.inc.php create mode 100644 module/geogallery/ressource/defaultdata.php create mode 100755 module/geogallery/ressource/theme.css create mode 100755 module/geogallery/ressource/vartheme.css create mode 100644 module/geogallery/vendor/tablednd/MIT-LICENSE.txt create mode 100755 module/geogallery/vendor/tablednd/inc.json create mode 100755 module/geogallery/vendor/tablednd/lisez-moi.txt create mode 100755 module/geogallery/vendor/tablednd/tablednd.min.js create mode 100644 module/geogallery/view/add/add.css create mode 100644 module/geogallery/view/add/add.js.php create mode 100644 module/geogallery/view/add/add.php create mode 100755 module/geogallery/view/config/config.css create mode 100644 module/geogallery/view/config/config.js.php create mode 100644 module/geogallery/view/config/config.php create mode 100755 module/geogallery/view/edit/edit.css create mode 100644 module/geogallery/view/edit/edit.js.php create mode 100644 module/geogallery/view/edit/edit.php create mode 100644 module/geogallery/view/gallery/gallery.css create mode 100644 module/geogallery/view/gallery/gallery.js.php create mode 100644 module/geogallery/view/gallery/gallery.php create mode 100644 module/geogallery/view/index/index.php create mode 100644 module/geogallery/view/option/option.css create mode 100644 module/geogallery/view/option/option.js.php create mode 100644 module/geogallery/view/option/option.php create mode 100755 module/geogallery/view/theme/theme.css create mode 100644 module/geogallery/view/theme/theme.php diff --git a/module/geogallery/changes.md b/module/geogallery/changes.md new file mode 100644 index 00000000..87c37ef1 --- /dev/null +++ b/module/geogallery/changes.md @@ -0,0 +1,2 @@ +# Version 0.1 +- GeoGallery est basé sur le module gallery 4.1 \ No newline at end of file diff --git a/module/geogallery/enum.json b/module/geogallery/enum.json new file mode 100644 index 00000000..b09604b0 --- /dev/null +++ b/module/geogallery/enum.json @@ -0,0 +1 @@ +{"name":"gallery","realName":"Galerie","version":"4.0","update":"0.0","delete":true,"dataDirectory":"site\/data\/gallery\/"} \ No newline at end of file diff --git a/module/geogallery/geogallery.php b/module/geogallery/geogallery.php new file mode 100644 index 00000000..19f34f1a --- /dev/null +++ b/module/geogallery/geogallery.php @@ -0,0 +1,1101 @@ + + * @copyright Copyright (C) 2008-2018, Rémi Jean + * @author Frédéric Tempez + * @copyright Copyright (C) 2018-2024, Frédéric Tempez + * @license CC Attribution-NonCommercial-NoDerivatives 4.0 International + * @link http://zwiicms.fr/ + */ + +class geogallery extends common +{ + + + const VERSION = '0.1'; + const REALNAME = 'Géo galerie'; + const DATADIRECTORY = self::DATA_DIR . 'geogallery/'; + + const SORT_ASC = 'SORT_ASC'; + const SORT_DSC = 'SORT_DSC'; + const SORT_HAND = 'SORT_HAND'; + + + public static $directories = []; + + public static $firstPictures = []; + + public static $galleries = []; + + public static $galleriesId = []; + + public static $pictures = []; + + public static $picturesId = []; + + public static $thumbs = []; + + public static $config = []; + + public static $actions = [ + 'config' => self::GROUP_EDITOR, + 'delete' => self::GROUP_EDITOR, + 'dirs' => self::GROUP_EDITOR, + 'sortGalleries' => self::GROUP_EDITOR, + 'sortPictures' => self::GROUP_EDITOR, + 'edit' => self::GROUP_EDITOR, + 'add' => self::GROUP_EDITOR, + 'theme' => self::GROUP_EDITOR, + 'option' => self::GROUP_EDITOR, + 'index' => self::GROUP_VISITOR + ]; + + public static $sort = [ + self::SORT_ASC => 'Alphabétique ', + self::SORT_DSC => 'Alphabétique inverse', + 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', + 'right' => 'À droite' + ]; + + public static $galleryThemeSizeWidth = [ + '9em' => 'Très petite', + '12em' => 'Petite', + '15em' => 'Moyenne', + '18em' => 'Grande', + '21em' => 'Très grande', + '100%' => 'Proportionnelle' + ]; + + public static $galleryThemeSizeHeight = [ + '9em' => 'Très petite', + '12em' => 'Petite', + '15em' => 'Moyenne', + '18em' => 'Grande', + '21em' => 'Très grande' + ]; + + public static $galleryThemeLegendHeight = [ + '.125em' => 'Très petite', + '.25em' => 'Petite', + '.375em' => 'Moyenne', + '.5em' => 'Grande', + '.625em' => 'Très grande' + ]; + + public static $galleryThemeBorder = [ + '0em' => 'Aucune', + '.1em' => 'Très fine', + '.3em' => 'Fine', + '.5em' => 'Moyenne', + '.7em' => 'Epaisse', + '.9em' => 'Très épaisse' + ]; + + public static $galleryThemeOpacity = [ + '1' => 'Aucun ', + '.9' => 'Très Discrète', + '.8' => 'Discrète', + '.7' => 'Moyenne', + '.6' => 'Forte', + '.5' => 'Très forte' + ]; + + public static $galleryThemeMargin = [ + '0em' => 'Aucune', + '.1em' => 'Très petite', + '.3em' => 'Petite', + '.5em' => 'Moyenne', + '.7em' => 'Grande', + '.9em' => 'Très grande' + ]; + + public static $galleryThemeRadius = [ + '0em' => 'Aucun', + '.3em' => 'Très léger', + '.6em' => 'Léger', + '.9em' => 'Moyen', + '1.2em' => 'Important', + '1.5em' => 'Très important' + ]; + + public static $galleryThemeShadows = [ + '0px' => 'Aucune', + '1px 1px 5px' => 'Très légère', + '1px 1px 10px' => 'Légère', + '1px 1px 15px' => 'Moyenne', + '1px 1px 25px' => 'Importante', + '1px 1px 50px' => 'Très importante' + ]; + + public static $galleryOptionBackPosition = [ + 'none' => 'Masqué', + 'top' => 'Au-dessus', + 'both' => 'Au-dessus et en dessous', + 'bottom' => 'En dessous', + ]; + public static $galleryOptionBackAlign = [ + 'left' => 'A gauche', + 'center' => 'Au centre', + 'right' => 'A droite', + ]; + + public static $formOptionSelect = ''; + + /** + * Mise à jour du module + * Appelée par les fonctions index et config + */ + private function update() + { + + // Initialisation du module, créer les données si elles sont manquantes. + $this->init(); + + $versionData = $this->getData(['module', $this->getUrl(0), 'config', 'versionData']); + // Mise à jour 3.1 + if (version_compare($versionData, '3.1', '<')) { + if (is_dir(self::DATADIRECTORY . 'pages/')) { + // Déplacer les données du dossier Pages + $this->copyDir(self::DATADIRECTORY . 'pages/' . $this->getUrl(0), self::DATADIRECTORY . $this->getUrl(0)); + $this->deleteDir(self::DATADIRECTORY . 'pages/'); + $style = $this->getData(['module', $this->getUrl(0), 'theme', 'style']); + $this->setData(['module', $this->getUrl(0), 'theme', 'style', str_replace('pages/', '', $style)]); + } + // Mettre à jour la version + $this->setData(['module', $this->getUrl(0), 'config', 'versionData', '3.1']); + } + } + + /** + * Initialisation séparée des éléments absents + * Thème + * Config + * Content + */ + private function init() + { + + // Mise à jour d'une version inférieure, la gallery existe mais pas la variable content + if ( + $this->getData(['module', $this->getUrl(0)]) && + $this->getData(['module', $this->getUrl(0), 'content']) === NULL + ) { + + // Changement de l'arborescence dans module.json + $data = $this->getData(['module', $this->getUrl(0)]); + $this->deleteData(['module', $this->getUrl(0)]); + $this->setData(['module', $this->getUrl(0), 'content', $data]); + + // Effacer les fichiers CSS de l'ancienne version + if (file_exists('module/gallery/view/index/index.css')) { + unlink('module/gallery/view/index/index.css'); + } + if (file_exists('module/gallery/view/gallery/gallery.css')) { + unlink('module/gallery/view/gallery/gallery.css'); + } + // Stockage des données du thème de la gallery existant + if (is_array($this->getData(['theme', 'gallery']))) { + $data = $this->getData(['theme', 'gallery']); + $this->deleteData(['theme', 'gallery']); + $this->setData(['module', $this->getUrl(0), 'theme', $data]); + // Nom de la feuille de style + $this->setData(['module', $this->getUrl(0), 'theme', 'style', self::DATADIRECTORY . $this->getUrl(0) . '/theme.css']); + } + } + + // Variable commune + $fileCSS = self::DATADIRECTORY . $this->getUrl(0) . '/theme.css'; + + // Check la présence des données de thème + if ($this->getData(['module', $this->getUrl(0), 'theme']) === null) { + require_once ('module/gallery/ressource/defaultdata.php'); + $this->setData(['module', $this->getUrl(0), 'theme', theme::$defaultTheme]); + // Nom de la feuille de style + $this->setData(['module', $this->getUrl(0), 'theme', 'style', $fileCSS]); + } + + // Check la présence de la feuille de style + if (!file_exists(self::DATADIRECTORY . $this->getUrl(0) . '/theme.css')) { + // Dossier de l'instance + if (!is_dir(self::DATADIRECTORY . $this->getUrl(0))) { + mkdir(self::DATADIRECTORY . $this->getUrl(0), 0755, true); + } + // Générer la feuille de 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->getData(['module', $this->getUrl(0), 'theme', 'thumbAlign']), $content); + $content = str_replace('#thumbWidth#', $this->getData(['module', $this->getUrl(0), 'theme', 'thumbWidth']), $content); + $content = str_replace('#thumbHeight#', $this->getData(['module', $this->getUrl(0), 'theme', 'thumbHeight']), $content); + $content = str_replace('#thumbMargin#', $this->getData(['module', $this->getUrl(0), 'theme', 'thumbMargin']), $content); + $content = str_replace('#thumbBorder#', $this->getData(['module', $this->getUrl(0), 'theme', 'thumbBorder']), $content); + $content = str_replace('#thumbBorderColor#', $this->getData(['module', $this->getUrl(0), 'theme', 'thumbBorderColor']), $content); + $content = str_replace('#thumbOpacity#', $this->getData(['module', $this->getUrl(0), 'theme', 'thumbOpacity']), $content); + $content = str_replace('#thumbShadows#', $this->getData(['module', $this->getUrl(0), 'theme', 'thumbShadows']), $content); + $content = str_replace('#thumbShadowsColor#', $this->getData(['module', $this->getUrl(0), 'theme', 'thumbShadowsColor']), $content); + $content = str_replace('#thumbRadius#', $this->getData(['module', $this->getUrl(0), 'theme', 'thumbRadius']), $content); + $content = str_replace('#legendAlign#', $this->getData(['module', $this->getUrl(0), 'theme', 'legendAlign']), $content); + $content = str_replace('#legendHeight#', $this->getData(['module', $this->getUrl(0), 'theme', 'legendHeight']), $content); + $content = str_replace('#legendTextColor#', $this->getData(['module', $this->getUrl(0), 'theme', 'legendTextColor']), $content); + $content = str_replace('#legendBgColor#', $this->getData(['module', $this->getUrl(0), 'theme', 'legendBgColor']), $content); + + // Ecriture de la feuille de style + file_put_contents(self::DATADIRECTORY . $this->getUrl(0) . '/theme.css', $content . $themeCss); + // Nom de la feuille de style + $this->setData(['module', $this->getUrl(0), 'theme', 'style', $fileCSS]); + } + + // Check la présence de la config + + if ( + is_null($this->getData(['module', $this->getUrl(0), 'config', 'showUniqueGallery'])) + || is_null($this->getData(['module', $this->getUrl(0), 'config', 'backPosition'])) + || is_null($this->getData(['module', $this->getUrl(0), 'config', 'backAlign'])) + || is_null($this->getData(['module', $this->getUrl(0), 'config', 'versionData'])) + ) { + require_once ('module/gallery/ressource/defaultdata.php'); + $this->setData(['module', $this->getUrl(0), 'config', theme::$defaultData]); + } + + // Contenu vide de la galerie + if (!is_array($this->getData(['module', $this->getUrl(0), 'content']))) { + $this->setData(['module', $this->getUrl(0), 'content', array()]); + } + } + + + /** + * Tri de la liste des galeries + * + */ + public function sortGalleries() + { + if (isset($_POST['response'])) { + $data = explode('&', $_POST['response']); + $data = str_replace('galleryTable%5B%5D=', '', $data); + for ($i = 0; $i < count($data); $i++) { + $this->setData([ + 'module', + $this->getUrl(0), + 'content', + $data[$i], + [ + 'config' => [ + 'name' => $this->getData(['module', $this->getUrl(0), 'content', $data[$i], 'config', 'name']), + 'directory' => $this->getData(['module', $this->getUrl(0), 'content', $data[$i], 'config', 'directory']), + 'homePicture' => $this->getData(['module', $this->getUrl(0), 'content', $data[$i], 'config', 'homePicture']), + 'sort' => $this->getData(['module', $this->getUrl(0), 'content', $data[$i], 'config', 'sort']), + 'position' => $i, + 'fullScreen' => $this->getData(['module', $this->getUrl(0), 'content', $data[$i], 'config', 'fullScreen']), + 'showPageContent' => $this->getData(['module', $this->getUrl(0), 'content', $data[$i], 'config', 'showPageContent']) + + ], + 'legend' => $this->getData(['module', $this->getUrl(0), 'content', $data[$i], 'legend']), + 'positions' => $this->getData(['module', $this->getUrl(0), 'content', $data[$i], 'positions']) + ] + ]); + } + } + } + + /** + * Tri de la liste des images + * + */ + public function sortPictures() + { + if (isset($_POST['response'])) { + $galleryName = $_POST['gallery']; + $data = explode('&', $_POST['response']); + $data = str_replace('galleryTable%5B%5D=', '', $data); + // Sauvegarder + $this->setData([ + 'module', + $this->getUrl(0), + 'content', + $galleryName, + [ + 'config' => [ + 'name' => $this->getData(['module', $this->getUrl(0), 'content', $galleryName, 'config', 'name']), + 'directory' => $this->getData(['module', $this->getUrl(0), 'content', $galleryName, 'config', 'directory']), + 'homePicture' => $this->getData(['module', $this->getUrl(0), 'content', $galleryName, 'config', 'homePicture']), + 'sort' => $this->getData(['module', $this->getUrl(0), 'content', $galleryName, 'config', 'sort']), + 'position' => $this->getData(['module', $this->getUrl(0), 'content', $galleryName, 'config', 'position']), + 'fullScreen' => $this->getData(['module', $this->getUrl(0), 'content', $galleryName, 'config', 'fullScreen']) + + ], + 'legend' => $this->getData(['module', $this->getUrl(0), 'content', $galleryName, 'legend']), + 'positions' => array_flip($data) + ] + ]); + } + } + + + /** + * Configuration + */ + public function config() + { + + // Mise à jour des données de module + $this->update(); + + //Affichage de la galerie triée + $g = $this->getData(['module', $this->getUrl(0), 'content']); + $p = helper::arrayColumn(helper::arrayColumn($g, 'config'), 'position'); + asort($p, SORT_NUMERIC); + $galleries = []; + foreach ($p as $positionId => $item) { + $galleries[$positionId] = $g[$positionId]; + } + // Traitement de l'affichage + if ($galleries) { + foreach ($galleries as $galleryId => $gallery) { + // Erreur dossier vide + if (is_dir($gallery['config']['directory'])) { + if (count(scandir($gallery['config']['directory'])) === 2) { + $gallery['config']['directory'] = '' . $gallery['config']['directory'] . ' (dossier vide)'; + } + } + // Erreur dossier supprimé + else { + $gallery['config']['directory'] = '' . $gallery['config']['directory'] . ' (dossier introuvable)'; + } + // Met en forme le tableau + self::$galleries[] = [ + $gallery['config']['position'] + 1, + $gallery['config']['name'], + $gallery['config']['directory'], + template::button('galleryConfigEdit' . $galleryId, [ + 'href' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $galleryId, + 'value' => template::ico('pencil'), + 'help' => 'Configuration de la galerie ' + ]), + template::button('galleryConfigDelete' . $galleryId, [ + 'class' => 'galleryConfigDelete buttonRed', + 'href' => helper::baseUrl() . $this->getUrl(0) . '/delete/' . $galleryId, + 'value' => template::ico('trash'), + 'help' => 'Supprimer cette galerie' + ]) + ]; + // Tableau des id des galleries pour le drag and drop + self::$galleriesId[] = $galleryId; + } + } + + // Valeurs en sortie + $this->addOutput([ + 'title' => helper::translate('Configuration des galeries'), + 'view' => 'config', + 'vendor' => [ + 'tablednd' + ] + ]); + } + + /** + * Ajout d'une galerie + */ + public function add() + { + // Soumission du formulaire d'ajout d'une galerie + if ( + $this->getUser('permission', __CLASS__, __FUNCTION__) === true && + $this->isPost() + ) { + $galleryId = $this->getInput('galleryAddName', null, true); + $success = false; + if ($galleryId) { + $galleryId = helper::increment($this->getInput('galleryAddName', helper::FILTER_ID, true), (array) $this->getData(['module', $this->getUrl(0), 'content'])); + $homePicture = ''; + // définir une vignette par défaut + $directory = $this->getInput('galleryAddDirectory', helper::FILTER_STRING_SHORT, true); + $iterator = new DirectoryIterator($directory); + $i = 0; + foreach ($iterator as $fileInfos) { + if ($fileInfos->isDot() === false and $fileInfos->isFile() and @getimagesize($fileInfos->getPathname())) { + $i += 1; + // Créer la miniature si manquante + if (!file_exists(str_replace('source', 'thumb', $fileInfos->getPath()) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()))) { + $this->makeThumb( + $fileInfos->getPathname(), + str_replace('source', 'thumb', $fileInfos->getPath()) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()), + self::THUMBS_WIDTH + ); + } + // Miniatures + $homePicture = strtolower($fileInfos->getFilename()); + break; + } + } + // Le dossier de la galerie est vide + if ($i > 0) { + $this->setData([ + 'module', + $this->getUrl(0), + 'content', + $galleryId, + [ + 'config' => [ + 'name' => $this->getInput('galleryAddName'), + 'directory' => $this->getInput('galleryAddDirectory', helper::FILTER_STRING_SHORT, true), + 'homePicture' => $homePicture, + 'sort' => $this->getInput('galleryAddSort'), + 'position' => count($this->getData(['module', $this->getUrl(0), 'content'])) + 1, + 'fullScreen' => $this->getInput('galleryAddFullscreen', helper::FILTER_BOOLEAN), + 'showPageContent' => $this->getInput('galleryAddShowPageContent', helper::FILTER_BOOLEAN) + ], + 'legend' => [], + 'positions' => [] + ] + ]); + $success = true; + } else { + self::$inputNotices['galleryAddDirectory'] = "Le dossier sélectionné ne contient aucune image"; + $success = false; + } + } + + if ($success) { + // Valeurs en sortie + $this->addOutput([ + 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config', + 'notification' => helper::translate('Galerie ajoutée'), + 'state' => true + ]); + } else { + // Valeurs en sortie + $this->addOutput([ + 'title' => helper::translate('Création d\'une galerie'), + 'view' => 'add' + ]); + } + + } else { + // Valeurs en sortie + $this->addOutput([ + 'title' => helper::translate('Création d\'une galerie'), + 'view' => 'add' + ]); + } + } + /** + * Suppression + */ + public function delete() + { + // La galerie n'existe pas + if ( + $this->getUser('permission', __CLASS__, __FUNCTION__) !== true || + $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2)]) === null + ) { + // Valeurs en sortie + $this->addOutput([ + 'access' => false + ]); + } + // Suppression + else { + $this->deleteData(['module', $this->getUrl(0), 'content', $this->getUrl(2)]); + // Valeurs en sortie + $this->addOutput([ + 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config', + 'notification' => helper::translate('Galerie effacée'), + 'state' => true + ]); + } + } + + /** + * Liste des dossiers + */ + public function dirs() + { + // Valeurs en sortie + $this->addOutput([ + 'display' => self::DISPLAY_JSON, + 'content' => geogalleriesHelper::scanDir(self::FILE_DIR . 'source') + ]); + } + + /** + * Édition + */ + public function edit() + { + // Soumission du formulaire + if ( + $this->getUser('permission', __CLASS__, __FUNCTION__) === true && + $this->isPost() + ) { + + // légendes + foreach ((array) $this->getInput('legend', null) as $file => $legend) { + // Image de couverture par défaut si non définie + $homePicture = $file; + $file = str_replace('.', '', $file); + $legends[$file] = helper::filter($legend, helper::FILTER_STRING_SHORT); + + } + // Photo de la page de garde de l'album définie dans form + if (is_array($this->getInput('homePicture', null))) { + // Extrait la couverture sélectionnée + $homePicture = array_keys($this->getInput('homePicture', null))[0]; + } + // Sauvegarder + $this->setData([ + 'module', + $this->getUrl(0), + 'content', + $this->getUrl(2), + [ + 'config' => [ + 'homePicture' => $homePicture, + // Données mises à jour par les options + 'name' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'name']), + 'directory' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'directory']), + 'sort' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'sort']), + 'position' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'position']), + 'fullScreen' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'fullScreen']), + 'showPageContent' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'showPageContent']) + + ], + 'legend' => $legends, + 'positions' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'positions']) + ] + ]); + // Valeurs en sortie + $this->addOutput([ + 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $this->getUrl(2), + 'notification' => helper::translate('Modifications enregistrées'), + 'state' => true + ]); + } + // La galerie n'existe pas + if ($this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2)]) === null) { + // Valeurs en sortie + $this->addOutput([ + 'access' => false + ]); + } + // La galerie existe + else { + // Met en forme le tableau + $directory = $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'directory']); + if (is_dir($directory)) { + $iterator = new DirectoryIterator($directory); + foreach ($iterator as $fileInfos) { + if ($fileInfos->isDot() === false and $fileInfos->isFile() and @getimagesize($fileInfos->getPathname())) { + // Créer la miniature RFM si manquante + if (!file_exists(str_replace('source', 'thumb', $fileInfos->getPath()) . '/' . strtolower($fileInfos->getFilename()))) { + $this->makeThumb( + $fileInfos->getPathname(), + str_replace('source', 'thumb', $fileInfos->getPath()) . '/' . strtolower($fileInfos->getFilename()), + 122 + ); + } + // Obtenir les métadonnées EXIF de l'image + $exif = exif_read_data($fileInfos->getPath() . '/' . $fileInfos->getFilename()); + $latitude = null; + $longitude = null; + // Vérifier si les données EXIF contiennent des informations de géolocalisation + if (!empty($exif['GPSLatitude']) && !empty($exif['GPSLongitude'])) { + // Coordonnées de latitude + $latitude = $this->gps_decimal($exif['GPSLatitude'], $exif['GPSLatitudeRef']); + + // Coordonnées de longitude + $longitude = $this->gps_decimal($exif['GPSLongitude'], $exif['GPSLongitudeRef']); + } + + self::$pictures[str_replace('.', '', $fileInfos->getFilename())] = [ + $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'positions', str_replace('.', '', $fileInfos->getFilename())]) + 1, + $fileInfos->getFilename(), + template::checkbox('homePicture[' . $fileInfos->getFilename() . ']', true, '', [ + 'checked' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'homePicture']) === $fileInfos->getFilename() ? true : false, + 'class' => 'homePicture' + ]), + template::text('legend[' . $fileInfos->getFilename() . ']', [ + 'value' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'legend', str_replace('.', '', $fileInfos->getFilename())]) + ]), + $longitude . ' ' . $latitude, + '', + ]; + self::$picturesId[] = str_replace('.', '', $fileInfos->getFilename()); + } + } + // Tri des images + switch ($this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'sort'])) { + case self::SORT_HAND: + $positions = $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'positions']); + if ($positions) { + foreach ($positions as $key => $value) { + if (array_key_exists($key, self::$pictures)) { + $tempPictures[$key] = self::$pictures[$key]; + $tempPicturesId[] = $key; + } + } + // Images ayant été ajoutées dans le dossier mais non triées + foreach (self::$pictures as $key => $value) { + if (!array_key_exists($key, $tempPictures)) { + $tempPictures[$key] = self::$pictures[$key]; + $tempPicturesId[] = $key; + } + } + self::$pictures = $tempPictures; + self::$picturesId = $tempPicturesId; + } + break; + case self::SORT_ASC: + ksort(self::$pictures, SORT_NATURAL); + sort(self::$picturesId, SORT_NATURAL); + break; + case self::SORT_DSC: + krsort(self::$pictures, SORT_NATURAL); + rsort(self::$picturesId, SORT_NATURAL); + break; + } + } + // Valeurs en sortie + $this->addOutput([ + 'title' => sprintf(helper::translate('Configuration de la galerie %s '), $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'name'])), + 'view' => 'edit', + 'vendor' => [ + 'tablednd' + ] + ]); + } + } + + /** + * Accueil (deux affichages en un pour éviter une url à rallonge) + */ + public function index() + { + + // Mise à jour des données de module + $this->update(); + // Une seule galerie, bifurquer sur celle-ci + $gallery = $this->getData(['module', $this->getUrl(0), 'config', 'showUniqueGallery']) === true && + count($this->getData(['module', $this->getUrl(0), 'content'])) === 1 + ? array_key_first($this->getData(['module', $this->getUrl(0), 'content'])) + : $this->getUrl(1); + if ($gallery) { + // La galerie n'existe pas + if ($this->getData(['module', $this->getUrl(0), 'content', $gallery]) === null) { + // Valeurs en sortie + $this->addOutput([ + 'access' => false + ]); + } + // La galerie existe + else { + // Images de la galerie + $directory = $this->getData(['module', $this->getUrl(0), 'content', $gallery, 'config', 'directory']); + // Définir les options + self::$config['homePicture'] = $this->getData(['module', $this->getUrl(0), 'content', $gallery, 'config', 'homePicture']); + self::$config['fullScreen'] = $this->getData(['module', $this->getUrl(0), 'content', $gallery, 'config', 'fullScreen']) === true ? 'fullScreen' : ''; + self::$config['backPositionTop'] = ($this->getData(['module', $this->getUrl(0), 'config', 'backPosition']) === 'top' || + $this->getData(['module', $this->getUrl(0), 'config', 'backPosition']) === 'both') + ? '' + : 'displayNone'; + self::$config['backPositionBottom'] = ($this->getData(['module', $this->getUrl(0), 'config', 'backPosition']) === 'bottom' || + $this->getData(['module', $this->getUrl(0), 'config', 'backPosition']) === 'both') + ? '' + : 'displayNone'; + self::$config['backAlign'] = 'textAlign' . ucfirst($this->getData(['module', $this->getUrl(0), 'config', 'backAlign'])); + + // Annulation de l'apparition des boutons si la galerie est unique + self::$config['backPositionTop'] = ($this->getData(['module', $this->getUrl(0), 'config', 'showUniqueGallery']) === true + && count($this->getData(['module', $this->getUrl(0), 'content'])) === 1) + ? 'displayNone' + : self::$config['backPositionTop']; + self::$config['backPositionBottom'] = ($this->getData(['module', $this->getUrl(0), 'config', 'showUniqueGallery']) === true + && count($this->getData(['module', $this->getUrl(0), 'content'])) === 1) + ? 'displayNone' + : self::$config['backPositionBottom']; + + if (is_dir($directory)) { + $iterator = new DirectoryIterator($directory); + foreach ($iterator as $fileInfos) { + if ($fileInfos->isDot() === false and $fileInfos->isFile() and @getimagesize($fileInfos->getPathname())) { + self::$pictures[$directory . '/' . $fileInfos->getFilename()] = $this->getData(['module', $this->getUrl(0), 'content', $gallery, 'legend', str_replace('.', '', $fileInfos->getFilename())]); + $picturesSort[$directory . '/' . $fileInfos->getFilename()] = $this->getData(['module', $this->getUrl(0), 'content', $gallery, 'positions', str_replace('.', '', $fileInfos->getFilename())]); + // Créer la miniature si manquante + if (!file_exists(str_replace('source', 'thumb', $fileInfos->getPath()) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()))) { + $this->makeThumb( + $fileInfos->getPathname(), + str_replace('source', 'thumb', $fileInfos->getPath()) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()), + self::THUMBS_WIDTH + ); + } + // Définir la Miniature + self::$thumbs[$directory . '/' . $fileInfos->getFilename()] = file_exists(str_replace('source', 'thumb', $directory) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename())) + ? str_replace('source', 'thumb', $directory) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()) + : str_replace('source', 'thumb', $directory) . '/' . strtolower($fileInfos->getFilename()); + + } + } + // Tri des images par ordre alphabétique + switch ($this->getData(['module', $this->getUrl(0), 'content', $gallery, 'config', 'sort'])) { + case self::SORT_HAND: + asort($picturesSort); + if ($picturesSort) { + foreach ($picturesSort as $name => $position) { + $temp[$name] = self::$pictures[$name]; + } + self::$pictures = $temp; + break; + } + case self::SORT_DSC: + krsort(self::$pictures, SORT_NATURAL); + break; + case self::SORT_ASC: + default: + ksort(self::$pictures, SORT_NATURAL); + break; + } + } + // Affichage du template + if (self::$pictures) { + // Valeurs en sortie + $this->addOutput([ + 'showBarEditButton' => true, + 'title' => $this->getData(['module', $this->getUrl(0), 'content', $gallery, 'config', 'name']), + 'view' => 'gallery', + 'style' => file_exists($this->getData(['module', $this->getUrl(0), 'theme', 'style'])) + ? $this->getData(['module', $this->getUrl(0), 'theme', 'style']) + : '', + 'showPageContent' => $this->getData(['module', $this->getUrl(0), 'content', $gallery, 'config', 'showPageContent']), + ]); + } + // Pas d'image dans la galerie + else { + // Valeurs en sortie + $this->addOutput([ + 'access' => false + ]); + } + } + + } + // Liste des galeries + else { + // Tri des galeries suivant l'ordre défini + $g = $this->getData(['module', $this->getUrl(0), 'content']); + $p = helper::arrayColumn(helper::arrayColumn($g, 'config'), 'position'); + asort($p, SORT_NUMERIC); + $galleries = []; + foreach ($p as $positionId => $item) { + $galleries[$positionId] = $g[$positionId]; + } + // Construire le tableau + foreach ((array) $galleries as $galleryId => $gallery) { + if (is_dir($gallery['config']['directory'])) { + $iterator = new DirectoryIterator($gallery['config']['directory']); + foreach ($iterator as $fileInfos) { + if ($fileInfos->isDot() === false and $fileInfos->isFile() and @getimagesize($fileInfos->getPathname())) { + + self::$galleries[$galleryId] = $gallery; + // L'image de couverture est-elle supprimée ? + if (file_exists($gallery['config']['directory'] . '/' . $gallery['config']['homePicture'])) { + // Créer la miniature si manquante + if (!file_exists(str_replace('source', 'thumb', $gallery['config']['directory']) . '/' . self::THUMBS_SEPARATOR . strtolower($gallery['config']['homePicture']))) { + $this->makeThumb( + $gallery['config']['directory'] . '/' . str_replace(self::THUMBS_SEPARATOR, '', $gallery['config']['homePicture']), + str_replace('source', 'thumb', $gallery['config']['directory']) . '/' . self::THUMBS_SEPARATOR . strtolower($gallery['config']['homePicture']), + self::THUMBS_WIDTH + ); + } + // Définir l'image de couverture + self::$firstPictures[$galleryId] = file_exists(str_replace('source', 'thumb', $gallery['config']['directory']) . '/' . self::THUMBS_SEPARATOR . strtolower($gallery['config']['homePicture'])) + ? str_replace('source', 'thumb', $gallery['config']['directory']) . '/' . self::THUMBS_SEPARATOR . strtolower($gallery['config']['homePicture']) + : str_replace('source', 'thumb', $gallery['config']['directory']) . '/' . strtolower($gallery['config']['homePicture']); + } else { + // homePicture contient une image invalide, supprimée ou déplacée + // Définir l'image de couverture, première image disponible + $this->makeThumb( + $fileInfos->getPath() . '/' . $fileInfos->getFilename(), + str_replace('source', 'thumb', $fileInfos->getPath()) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()), + self::THUMBS_WIDTH + ); + self::$firstPictures[$galleryId] = file_exists(str_replace('source', 'thumb', $fileInfos->getPath()) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename())) + ? str_replace('source', 'thumb', $fileInfos->getPath()) . '/' . self::THUMBS_SEPARATOR . strtolower($fileInfos->getFilename()) + : str_replace('source', 'thumb', $fileInfos->getPath()) . '/' . strtolower($fileInfos->getFilename()); + } + } + continue (1); + } + } + } + // Valeurs en sortie + $this->addOutput([ + 'showBarEditButton' => true, + 'showPageContent' => true, + 'view' => 'index', + 'style' => file_exists($this->getData(['module', $this->getUrl(0), 'theme', 'style'])) + ? $this->getData(['module', $this->getUrl(0), 'theme', 'style']) + : '' + ]); + } + } + + /** + * Thème de la galerie + */ + public function theme() + { + // Soumission du formulaire + if ( + $this->getUser('permission', __CLASS__, __FUNCTION__) === true && + $this->isPost() + ) { + // Dossier de l'instance + if (!is_dir(self::DATADIRECTORY . $this->getUrl(0))) { + mkdir(self::DATADIRECTORY . $this->getUrl(0), 0755, true); + } + $this->setData([ + 'module', + $this->getUrl(0), + 'theme', + [ + 'thumbAlign' => $this->getinput('galleryThemeThumbAlign', helper::FILTER_STRING_SHORT), + 'thumbWidth' => $this->getinput('galleryThemeThumbWidth', helper::FILTER_STRING_SHORT), + 'thumbHeight' => $this->getinput('galleryThemeThumbHeight', helper::FILTER_STRING_SHORT), + 'thumbMargin' => $this->getinput('galleryThemeThumbMargin', helper::FILTER_STRING_SHORT), + 'thumbBorder' => $this->getinput('galleryThemeThumbBorder', helper::FILTER_STRING_SHORT), + 'thumbBorderColor' => $this->getinput('galleryThemeThumbBorderColor', helper::FILTER_STRING_SHORT), + 'thumbOpacity' => $this->getinput('galleryThemeThumbOpacity', helper::FILTER_STRING_SHORT), + 'thumbShadows' => $this->getinput('galleryThemeThumbShadows', helper::FILTER_STRING_SHORT), + 'thumbShadowsColor' => $this->getinput('galleryThemeThumbShadowsColor', helper::FILTER_STRING_SHORT), + 'thumbRadius' => $this->getinput('galleryThemeThumbRadius', helper::FILTER_STRING_SHORT), + 'legendHeight' => $this->getinput('galleryThemeLegendHeight', helper::FILTER_STRING_SHORT), + 'legendAlign' => $this->getinput('galleryThemeLegendAlign', helper::FILTER_STRING_SHORT), + 'legendTextColor' => $this->getinput('galleryThemeLegendTextColor', helper::FILTER_STRING_SHORT), + 'legendBgColor' => $this->getinput('galleryThemeLegendBgColor', helper::FILTER_STRING_SHORT), + 'showUniqueGallery' => $this->getinput('galleryThemeShowUniqueGallery', helper::FILTER_BOOLEAN), + 'style' => self::DATADIRECTORY . $this->getUrl(0) . '/theme.css', + ] + ]); + // 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('#thumbShadows#', $this->getinput('galleryThemeThumbShadows'), $content); + $content = str_replace('#thumbShadowsColor#', $this->getinput('galleryThemeThumbShadowsColor'), $content); + $content = str_replace('#thumbRadius#', $this->getinput('galleryThemeThumbRadius'), $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); + $success = is_int(file_put_contents(self::DATADIRECTORY . $this->getUrl(0) . '/theme.css', $content . $themeCss)); + // Valeurs en sortie + $this->addOutput([ + 'redirect' => helper::baseUrl() . $this->getUrl() . '/theme', + 'notification' => $success ? 'Modifications enregistrées' : 'Modifications non enregistrées !', + 'state' => $success + ]); + } + // Valeurs en sortie + $this->addOutput([ + 'title' => helper::translate('Thème'), + 'view' => 'theme', + 'vendor' => [ + 'tinycolorpicker' + ] + ]); + } + + /** + * Option de configuration de la galerie + */ + public function option() + { + /** + * Options applicables à toutes les galeries du module + */ + if ($this->getUrl(2) === 'galleries') { + // Soumission du formulaire + if ( + $this->getUser('permission', __CLASS__, __FUNCTION__) === true && + $this->isPost() + ) { + + // Sauver la configuration de la galerie + $this->setData([ + 'module', + $this->getUrl(0), + 'config', + [ + 'showUniqueGallery' => $this->getinput('galleriesOptionShowUniqueGallery', helper::FILTER_BOOLEAN), + 'backPosition' => $this->getinput('galleryOptionBackPosition'), + 'backAlign' => $this->getinput('galleryOptionBackAlign'), + 'versionData' => $this->getData(['module', $this->getUrl(0), 'config', 'versionData']), + ] + ]); + + // Valeurs en sortie + $this->addOutput([ + 'redirect' => helper::baseUrl() . $this->getUrl() . '/option', + 'notification' => 'Modifications enregistrées', + 'state' => true + ]); + } + // Routage du formulaire + self::$formOptionSelect = 'galleries'; + // Valeurs en sortie + $this->addOutput([ + 'title' => helper::translate('Options de configuration'), + 'view' => 'option' + ]); + /** + * Enregistre les options de configuration de la galerie d'images sélectionnée + */ + } elseif ($this->getUrl(2) === 'gallery') { + // Soumission du formulaire + if ( + $this->getUser('permission', __CLASS__, __FUNCTION__) === true && + $this->isPost() + ) { + + // Le nom de la galerie est vide c'est le nom dans l'url qui est pris en compte + $galleryId = !empty($this->getInput('galleryEditName')) ? $this->getInput('galleryEditName', helper::FILTER_ID, true) : $this->getUrl(3); + + // Sauvegarde des Valeurs non affectées par ce formulaire + $homePicture = $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(3), 'config', 'homePicture']); + $position = $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(3), 'config', 'position']); + $legend = $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(3), 'legend']); + $positions = $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(3), 'positions']); + + // Le nom de la galerie n'est pas celui dans la BDD + if ($galleryId !== $this->getUrl(3)) { + // Incrémente le nouvel id de la galerie + $galleryId = helper::increment($galleryId, $this->getData(['module', $this->getUrl(0), 'content'])); + // Supprime l'ancienne galerie + $this->deleteData(['module', $this->getUrl(0), 'content', $this->getUrl(3)]); + } + // Sauvegarder + if ($this->getInput('galleryEditName')) { + $this->setData([ + 'module', + $this->getUrl(0), + 'content', + $galleryId, + [ + 'config' => [ + 'name' => $this->getInput('galleryEditName', helper::FILTER_STRING_SHORT, true), + 'directory' => $this->getInput('galleryEditDirectory', helper::FILTER_STRING_SHORT, true), + 'sort' => $this->getInput('galleryEditSort'), + 'fullScreen' => $this->getInput('galleryEditFullscreen', helper::FILTER_BOOLEAN), + 'showPageContent' => $this->getInput('galleryEditShowPageContent', helper::FILTER_BOOLEAN), + // Données lues à partir du formulaire edit de la galerie avec la liste des images + 'homePicture' => $homePicture, + 'position' => $position + + ], + 'legend' => $legend, + 'positions' => $positions + ] + ]); + } + // Valeurs en sortie + $this->addOutput([ + 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/edit/' . $galleryId, + 'notification' => helper::translate('Modifications enregistrées'), + 'state' => true + ]); + } + // Routage du formulaire + self::$formOptionSelect = 'gallery'; + // Valeurs en sortie + $this->addOutput([ + 'title' => sprintf(helper::translate('Options de la galerie %s'), ucfirst($this->getUrl(3))), + 'view' => 'option' + ]); + } else { + // Valeurs en sortie par défaut + $this->addOutput([ + 'redirect' => helper::baseUrl() . $this->getUrl(0) . '/config', + 'notification' => helper::translate('Action interdite') + ]); + } + } + + // Fonction pour convertir les coordonnées GPS au format décimal + private function gps_decimal($coordinate, $hemisphere) + { + // Extrait les degrés, minutes et secondes + $degrees = count($coordinate) > 0 ? gps2Num($coordinate[0]) : 0; + $minutes = count($coordinate) > 1 ? gps2Num($coordinate[1]) : 0; + $seconds = count($coordinate) > 2 ? gps2Num($coordinate[2]) : 0; + + // Convertit les degrés, minutes et secondes en décimal + $decimal = $degrees + ($minutes / 60) + ($seconds / 3600); + + // Si l'hémisphère est au Sud ou à l'Ouest, les coordonnées sont négatives + $decimal *= ($hemisphere == 'S' || $hemisphere == 'W') ? -1 : 1; + + return $decimal; + } + + // Fonction pour convertir les coordonnées GPS en nombre + private function gps2Num($coordPart) + { + $parts = explode('/', $coordPart); + if (count($parts) <= 0) + return 0; + if (count($parts) == 1) + return $parts[0]; + return floatval($parts[0]) / floatval($parts[1]); + } + +} + +class geogalleriesHelper extends helper +{ + + /** + * Scan le contenu d'un dossier et de ses sous-dossiers + * @param string $dir Dossier à scanner + * @return array + */ + public static function scanDir($dir) + { + $dirContent = []; + $iterator = new DirectoryIterator($dir); + foreach ($iterator as $fileInfos) { + if ($fileInfos->isDot() === false and $fileInfos->isDir()) { + $dirContent[] = $dir . '/' . $fileInfos->getBasename(); + $dirContent = array_merge($dirContent, self::scanDir($dir . '/' . $fileInfos->getBasename())); + } + } + return $dirContent; + } +} \ No newline at end of file diff --git a/module/geogallery/i18n/de.json b/module/geogallery/i18n/de.json new file mode 100644 index 00000000..9291146f --- /dev/null +++ b/module/geogallery/i18n/de.json @@ -0,0 +1,44 @@ +{ + "Afficher le contenu de la page avec la galerie": "Zeigen Sie den Inhalt der Seite mit der Galerie an", + "Alignement du bouton de retour": "Return -Taste -Ausrichtung", + "Alphabétique ": "Alphabetisch", + "Alphabétique inverse": "Alphabetik umgekehrt", + "Au-dessus": "Über", + "Aucune galerie": "Keine Galerie", + "Bordure": "Bordüre", + "Configuration de la galerie %s ": "Galeriekonfiguration %s", + "Configuration des galeries": "Die Konfiguration der Galer", + "Couleur de la bordure": "Randfarbe", + "Couverture": "Decke", + "Discrète": "Diskret", + "Distribué avec marges": "Verteilt", + "Distribué sans marge": "Ohne Rand verteilt", + "Dossier cible": "Zieldatei", + "En dessous": "Unter", + "Epaisse": "Dick", + "Fine": "Bußgeld", + "Forte": "Stärke", + "Galerie ajoutée": "Galerie hinzugefügt", + "Galerie effacée": "Gelobte Galerie", + "Légende": "Legende", + "Légendes": "Legenden", + "Manuel": "Manuel", + "Marge": "Marge", + "Masqué": "Maske", + "Mode plein écran automatique": "Automatischer Vollmodus", + "Opacité au survol": "Opazität im Überflug", + "Options de configuration": "Optionen de Konfiguration", + "Proportionnelle": "Proportional", + "Supprimer cette galerie ?": "Diese Galerie entfernen?", + "Tri des images": "Bilder sortieren", + "Très Discrète": "Sehr diskret", + "Très fine": "Sehr gut", + "Très forte": "Sehr stark", + "Très épaisse": "Sehr dick", + "Vignettes": "Vignetten", + "Ajouter une galerie": "Eine Galerie hinzufügen", + "Éditer une galerie": "Eine Galerie bearbeiten", + "Effacer une galerie": "Eine Galerie löschen", + "Options des galeries": "Galerieoptionen", + "Thème des galeries": "Galeriethemen" +} \ No newline at end of file diff --git a/module/geogallery/i18n/en_EN.json b/module/geogallery/i18n/en_EN.json new file mode 100644 index 00000000..fe982651 --- /dev/null +++ b/module/geogallery/i18n/en_EN.json @@ -0,0 +1,44 @@ +{ + "Afficher le contenu de la page avec la galerie": "Show the content of the page with the gallery", + "Alignement du bouton de retour": "Return button alignment", + "Alphabétique ": "Alphabetical", + "Alphabétique inverse": "Reverse alphabetics", + "Au-dessus": "Above", + "Aucune galerie": "No gallery", + "Bordure": "Border", + "Configuration de la galerie %s ": "Gallery settings %s ", + "Configuration des galeries": "Galleries's settings", + "Couleur de la bordure": "Border color", + "Couverture": "Cover", + "Discrète": "Discreet", + "Distribué avec marges": "Distributed with margins", + "Distribué sans marge": "Distributed without margin", + "Dossier cible": "Target file", + "En dessous": "Below", + "Epaisse": "Thick", + "Fine": "Fine", + "Forte": "Forte", + "Galerie ajoutée": "Gallery added", + "Galerie effacée": "Erased gallery", + "Légende": "Caption", + "Légendes": "Legends", + "Manuel": "Manuel", + "Marge": "Marge", + "Masqué": "Mask", + "Mode plein écran automatique": "Automatic full mode", + "Opacité au survol": "Opacity in overflight", + "Options de configuration": "Configuration options", + "Proportionnelle": "Proportional", + "Supprimer cette galerie ?": "Remove this gallery?", + "Tri des images": "Sorting images", + "Très Discrète": "Very discreet", + "Très fine": "Very fine", + "Très forte": "Very strong", + "Très épaisse": "Very thick", + "Vignettes": "Vignettes", + "Ajouter une galerie": "Add a gallery", + "Éditer une galerie": "Edit a gallery", + "Effacer une galerie": "Delete a gallery", + "Options des galeries": "Gallery options", + "Thème des galeries": "Gallery themes" +} \ No newline at end of file diff --git a/module/geogallery/i18n/es.json b/module/geogallery/i18n/es.json new file mode 100644 index 00000000..84c7aa42 --- /dev/null +++ b/module/geogallery/i18n/es.json @@ -0,0 +1,44 @@ +{ + "Afficher le contenu de la page avec la galerie": "Mostrar contenido de página con galería", + "Alignement du bouton de retour": "Alineación del botón Atrás", + "Alphabétique ": "Alfabético", + "Alphabétique inverse": "Alfabético inverso", + "Au-dessus": "Encima", + "Aucune galerie": "Sin galería", + "Bordure": "Bordillo", + "Configuration de la galerie %s ": "Configuración de la galería %s ", + "Configuration des galeries": "Configuración de la galería", + "Couleur de la bordure": "Color del bordillo", + "Couverture": "Portada ", + "Discrète": "Discreto", + "Distribué avec marges": "Distribuido con márgenes", + "Distribué sans marge": "Distribuido sin margen", + "Dossier cible": "Carpeta de destino", + "En dessous": "Debajo", + "Epaisse": "grueso", + "Fine": "Fino", + "Forte": "Fuerte", + "Galerie ajoutée": "Galería añadida", + "Galerie effacée": "Galería eliminada", + "Légende": "Pie", + "Légendes": "Leyendas", + "Manuel": "Manual", + "Marge": "Margen", + "Masqué": "Máscara", + "Mode plein écran automatique": "Modo automático de pantalla completa", + "Opacité au survol": "Opacidad de desplazamiento", + "Options de configuration": "Opciones de configuración", + "Proportionnelle": "Proporcional", + "Supprimer cette galerie ?": "¿Borrar esta galería?", + "Tri des images": "Ordenar imágenes", + "Très Discrète": "Muy discreto", + "Très fine": "Muy fino", + "Très forte": "Muy fuerte", + "Très épaisse": "Muy grueso", + "Vignettes": "Viñetas", + "Ajouter une galerie": "Agregar una galería", + "Éditer une galerie": "Editar una galería", + "Effacer une galerie": "Borrar una galería", + "Options des galeries": "Opciones de galerías", + "Thème des galeries": "Temas de galerías" +} \ No newline at end of file diff --git a/module/geogallery/i18n/fr_FR.json b/module/geogallery/i18n/fr_FR.json new file mode 100644 index 00000000..bfc0e0f3 --- /dev/null +++ b/module/geogallery/i18n/fr_FR.json @@ -0,0 +1,44 @@ +{ + "Afficher le contenu de la page avec la galerie": "", + "Alignement du bouton de retour": "", + "Alphabétique ": "", + "Alphabétique inverse": "", + "Au-dessus": "", + "Aucune galerie": "", + "Bordure": "", + "Configuration de la galerie %s ": "", + "Configuration des galeries": "", + "Couleur de la bordure": "", + "Couverture": "", + "Discrète": "", + "Distribué avec marges": "", + "Distribué sans marge": "", + "Dossier cible": "", + "En dessous": "", + "Epaisse": "", + "Fine": "", + "Forte": "", + "Galerie ajoutée": "", + "Galerie effacée": "", + "Légende": "", + "Légendes": "", + "Manuel": "", + "Marge": "", + "Masqué": "", + "Mode plein écran automatique": "", + "Opacité au survol": "", + "Options de configuration": "", + "Proportionnelle": "", + "Supprimer cette galerie ?": "", + "Tri des images": "", + "Très Discrète": "", + "Très fine": "", + "Très forte": "", + "Très épaisse": "", + "Vignettes": "", + "Ajouter une galerie": "", + "Éditer une galerie": "", + "Effacer une galerie": "", + "Options des galeries": "", + "Thème des galeries": "" +} \ No newline at end of file diff --git a/module/geogallery/i18n/gr_GR.json b/module/geogallery/i18n/gr_GR.json new file mode 100644 index 00000000..07691065 --- /dev/null +++ b/module/geogallery/i18n/gr_GR.json @@ -0,0 +1,44 @@ +{ + "Afficher le contenu de la page avec la galerie": "Εμφάνιση περιεχομένου σελίδας με γκαλερί", + "Alignement du bouton de retour": "Ευθυγράμμιση κουμπιού πίσω", + "Alphabétique ": "Αλφαβητική Ταξινόμηση", + "Alphabétique inverse": "Αντίστροφη αλφαβητική", + "Au-dessus": "Πάνω", + "Aucune galerie": "Δεν υπάρχει συλλογή εικόνων", + "Bordure": "κάδρο γύρω", + "Configuration de la galerie %s ": "Διαμόρφωση της γκαλερί %s ", + "Configuration des galeries": "Διαμόρφωση γκαλερί", + "Couleur de la bordure": "Χρώμα γραμμής", + "Couverture": "Κάλυψη ", + "Discrète": "διακριτικό", + "Distribué avec marges": "Διανομή με περιθώρια", + "Distribué sans marge": "Διανομή χωρίς περιθώριο", + "Dossier cible": "Φάκελος στόχος", + "En dessous": "Κάτω", + "Epaisse": "Παχιά γραμμή", + "Fine": "Λεπτή γραμμή ", + "Forte": "Ισχυρή αδιαφάνεια", + "Galerie ajoutée": "Προστέθηκε γκαλερί", + "Galerie effacée": "Γκαλερί διαγράφηκε", + "Légende": "Λεζάντα εικόνας", + "Légendes": "", + "Manuel": "Χειροκίνητη ", + "Marge": "Περιθώριο", + "Masqué": "κρυμμένο", + "Mode plein écran automatique": "Αυτόματη λειτουργία πλήρους οθόνης", + "Opacité au survol": "Αδιαφάνεια στο mouse-over", + "Options de configuration": "Επιλογές διαμόρφωσης", + "Proportionnelle": "Αναλογική", + "Supprimer cette galerie ?": "", + "Tri des images": "Ταξινόμηση εικόνων", + "Très Discrète": "Πολύ διακριτικό", + "Très fine": "Πολύ λεπτή γραμμή ", + "Très forte": "Πολύ Ισχυρή αδιαφάνεια", + "Très épaisse": "πολύ παχιά γραμμή", + "Vignettes": "", + "Ajouter une galerie": "Προσθήκη συλλογής", + "Éditer une galerie": "Επεξεργασία συλλογής", + "Effacer une galerie": "Διαγραφή συλλογής", + "Options des galeries": "Επιλογές συλλογών", + "Thème des galeries": "Θέματα συλλογών" +} \ No newline at end of file diff --git a/module/geogallery/i18n/it.json b/module/geogallery/i18n/it.json new file mode 100644 index 00000000..d3f948f3 --- /dev/null +++ b/module/geogallery/i18n/it.json @@ -0,0 +1,44 @@ +{ + "Afficher le contenu de la page avec la galerie": "Mostra il contenuto della pagina con la galleria", + "Alignement du bouton de retour": "Allineamento del pulsante di ritorno", + "Alphabétique ": "Alfabetico", + "Alphabétique inverse": "Alfabetico inverso", + "Au-dessus": "Al di sopra", + "Aucune galerie": "Nessuna galleria", + "Bordure": "Bordo", + "Configuration de la galerie %s ": "Configurazione della galleria %s ", + "Configuration des galeries": "Configurazione di Galler", + "Couleur de la bordure": "Colore del bordo", + "Couverture": "Copertina", + "Discrète": "Discreto", + "Distribué avec marges": "Distribuito con margini", + "Distribué sans marge": "Distribuito senza margine", + "Dossier cible": "File di destinazione", + "En dessous": "Qui di seguito", + "Epaisse": "Spesso", + "Fine": "Bene", + "Forte": "Forte", + "Galerie ajoutée": "Galleria aggiunta", + "Galerie effacée": "Galleria cancellata", + "Légende": "Didascalia", + "Légendes": "Leggende", + "Manuel": "Manuel", + "Marge": "Marge", + "Masqué": "Maschera", + "Mode plein écran automatique": "Modalità completa automatica", + "Opacité au survol": "Opacità in luce eccessiva", + "Options de configuration": "Opzioni di configurazione", + "Proportionnelle": "Proporzionale", + "Supprimer cette galerie ?": "Rimuovere questa galleria?", + "Tri des images": "Ordinamento delle immagini", + "Très Discrète": "Molto discreto", + "Très fine": "Molto bene", + "Très forte": "Molto forte", + "Très épaisse": "Molto spesso", + "Vignettes": "Vignette", + "Ajouter une galerie": "Aggiungi una galleria", + "Éditer une galerie": "Modifica una galleria", + "Effacer une galerie": "Cancella una galleria", + "Options des galeries": "Opzioni delle gallerie", + "Thème des galeries": "Temi delle gallerie" +} \ No newline at end of file diff --git a/module/geogallery/i18n/pt_PT.json b/module/geogallery/i18n/pt_PT.json new file mode 100644 index 00000000..3c5ead3b --- /dev/null +++ b/module/geogallery/i18n/pt_PT.json @@ -0,0 +1,44 @@ +{ + "Afficher le contenu de la page avec la galerie": "Mostre o conteúdo da página com a galeria", + "Alignement du bouton de retour": "Retornar alinhamento do botão", + "Alphabétique ": "Alfabético", + "Alphabétique inverse": "Alfabético reverso", + "Au-dessus": "Acima de", + "Aucune galerie": "Sem galeria", + "Bordure": "Fronteira", + "Configuration de la galerie %s ": "Configuração da galeria %s ", + "Configuration des galeries": "Configuração de Galler", + "Couleur de la bordure": "Cor da borda", + "Couverture": "Capa", + "Discrète": "Discreto", + "Distribué avec marges": "Distribuído com margens", + "Distribué sans marge": "Distribuído sem margem", + "Dossier cible": "Arquivo de destino", + "En dessous": "Abaixo de", + "Epaisse": "Espesso", + "Fine": "Multar", + "Forte": "Forte", + "Galerie ajoutée": "Galeria adicionada", + "Galerie effacée": "Galeria apagada", + "Légende": "Legenda", + "Légendes": "Legendas", + "Manuel": "Manuel", + "Marge": "Marge", + "Masqué": "mascarar", + "Mode plein écran automatique": "Modo completo automático", + "Opacité au survol": "Opacidade em Overflight", + "Options de configuration": "", + "Proportionnelle": "Proporcional", + "Supprimer cette galerie ?": "Remover esta galeria?", + "Tri des images": "Classificando imagens", + "Très Discrète": "Muito discreto", + "Très fine": "Muito bem", + "Très forte": "Muito forte", + "Très épaisse": "Muito espesso", + "Vignettes": "Vinhetas", + "Ajouter une galerie": "Adicionar uma galeria", + "Éditer une galerie": "Editar uma galeria", + "Effacer une galerie": "Apagar uma galeria", + "Options des galeries": "Opções de galerias", + "Thème des galeries": "Temas de galerias" +} \ No newline at end of file diff --git a/module/geogallery/i18n/tr_TR.json b/module/geogallery/i18n/tr_TR.json new file mode 100644 index 00000000..3af9e057 --- /dev/null +++ b/module/geogallery/i18n/tr_TR.json @@ -0,0 +1,44 @@ +{ + "Afficher le contenu de la page avec la galerie": "Sayfa içeriğini galeri ile görüntüle", + "Alignement du bouton de retour": "Geri düğmesi hizalaması", + "Alphabétique ": "Alfabetik", + "Alphabétique inverse": "Ters alfabetik", + "Au-dessus": "Üstünde", + "Aucune galerie": "Galeri Yok", + "Bordure": "Çerçeve", + "Configuration de la galerie %s ": "%s galeri yapılandırması", + "Configuration des galeries": "Galerilerin yapılandırması", + "Couleur de la bordure": "Çerçeve rengi", + "Couverture": "Kapak", + "Discrète": "Silik", + "Distribué avec marges": "Kenar boşluklarıyla dağıtıldı", + "Distribué sans marge": "Marjsız dağıtıldı", + "Dossier cible": "Hedef klasör", + "En dessous": "Altında", + "Epaisse": "Kalın", + "Fine": "İnce", + "Forte": "Güçlü", + "Galerie ajoutée": "Galeri eklendi", + "Galerie effacée": "Galeri silindi", + "Légende": "Başlık", + "Légendes": "Başlıklar", + "Manuel": "Manuel", + "Marge": "Kenar boşluğu", + "Masqué": "Gizli", + "Mode plein écran automatique": "Otomatik tam ekran modu", + "Opacité au survol": "Hover opaklığı", + "Options de configuration": "Yapılandırma seçenekleri", + "Proportionnelle": "Orantılı", + "Supprimer cette galerie ?": "Bu galeri silinsin mi?", + "Tri des images": "Resimleri sıralama", + "Très Discrète": "Çok silik", + "Très fine": "Çok ince", + "Très forte": "Çok güçlü", + "Très épaisse": "Çok kalın", + "Vignettes": "Küçük resim", + "Ajouter une galerie": "Galeri Ekle", + "Éditer une galerie": "Galeri Düzenle", + "Effacer une galerie": "Galeri Sil", + "Options des galeries": "Galeri Seçenekleri", + "Thème des galeries": "Galeri Temaları" +} \ No newline at end of file diff --git a/module/geogallery/profil/main/add.inc.php b/module/geogallery/profil/main/add.inc.php new file mode 100644 index 00000000..6d865e9e --- /dev/null +++ b/module/geogallery/profil/main/add.inc.php @@ -0,0 +1,12 @@ + $this->getInput('profilAddGalleryAdd', helper::FILTER_BOOLEAN), + 'edit' => $this->getInput('profilAddGalleryEdit', helper::FILTER_BOOLEAN), + 'delete' => $this->getInput('profilAddGalleryDelete', helper::FILTER_BOOLEAN), + 'option' => $this->getInput('profilAddGalleryOption', helper::FILTER_BOOLEAN), + 'theme' => $this->getInput('profilAddGalleryTheme', helper::FILTER_BOOLEAN), + 'config' => $this->getInput('profilAddGalleryAdd', helper::FILTER_BOOLEAN) || + $this->getInput('profilAddGalleryEdit', helper::FILTER_BOOLEAN) || + $this->getInput('profilAddGalleryDelete', helper::FILTER_BOOLEAN) || + $this->getInput('profilAddGalleryOption', helper::FILTER_BOOLEAN) || + $this->getInput('profilAddGalleryTheme', helper::FILTER_BOOLEAN) +]; \ No newline at end of file diff --git a/module/geogallery/profil/main/edit.inc.php b/module/geogallery/profil/main/edit.inc.php new file mode 100644 index 00000000..0a94afe0 --- /dev/null +++ b/module/geogallery/profil/main/edit.inc.php @@ -0,0 +1,12 @@ + $this->getInput('profilEditGalleryAdd', helper::FILTER_BOOLEAN), + 'edit' => $this->getInput('profilEditGalleryEdit', helper::FILTER_BOOLEAN), + 'delete' => $this->getInput('profilEditGalleryDelete', helper::FILTER_BOOLEAN), + 'option' => $this->getInput('profilEditGalleryOption', helper::FILTER_BOOLEAN), + 'theme' => $this->getInput('profilEditGalleryTheme', helper::FILTER_BOOLEAN), + 'config' => $this->getInput('profilEditGalleryAdd', helper::FILTER_BOOLEAN) || + $this->getInput('profilEditGalleryEdit', helper::FILTER_BOOLEAN) || + $this->getInput('profilEditGalleryDelete', helper::FILTER_BOOLEAN) || + $this->getInput('profilEditGalleryOption', helper::FILTER_BOOLEAN) || + $this->getInput('profilEditGalleryTheme', helper::FILTER_BOOLEAN) +]; \ No newline at end of file diff --git a/module/geogallery/profil/view/add.inc.php b/module/geogallery/profil/view/add.inc.php new file mode 100644 index 00000000..7963bfef --- /dev/null +++ b/module/geogallery/profil/view/add.inc.php @@ -0,0 +1,28 @@ +
+
+
+

+ +

+
+
+ +
+
+ +
+
+ +
+
+
+
+ +
+
+ +
+
+
+
+
\ No newline at end of file diff --git a/module/geogallery/profil/view/edit.inc.php b/module/geogallery/profil/view/edit.inc.php new file mode 100644 index 00000000..995c1b4c --- /dev/null +++ b/module/geogallery/profil/view/edit.inc.php @@ -0,0 +1,38 @@ +
+
+
+

+ +

+
+
+ $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'gallery', 'add']) + ]); ?> +
+
+ $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'gallery', 'edit']) + ]); ?> +
+
+ $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'gallery', 'delete']) + ]); ?> +
+
+
+
+ $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'gallery', 'option']) + ]); ?> +
+
+ $this->getData(['profil', $this->getUrl(2), $this->getUrl(3), 'gallery', 'theme']) + ]); ?> +
+
+
+
+
\ No newline at end of file diff --git a/module/geogallery/ressource/defaultdata.php b/module/geogallery/ressource/defaultdata.php new file mode 100644 index 00000000..b0fb1593 --- /dev/null +++ b/module/geogallery/ressource/defaultdata.php @@ -0,0 +1,25 @@ + 'center', + 'thumbWidth' => '18em', + 'thumbHeight' => '15em', + 'thumbMargin' => '.5em', + 'thumbBorder' => '.1em', + 'thumbOpacity' => '.7', + 'thumbBorderColor' => 'rgba(221, 221, 221, 1)', + 'thumbRadius' => '.3em', + 'thumbShadows' => '1px 1px 10px', + 'thumbShadowsColor' => 'rgba(125, 125, 125, 1)', + 'legendHeight' => '.375em', + 'legendAlign' => 'center', + 'legendTextColor' => 'rgba(255, 255, 255, 1)', + 'legendBgColor' => 'rgba(0, 0, 0, .6)' + ]; + public static $defaultData = [ + "showUniqueGallery" => false, + "backPosition" => "top", + "backAlign" => "center", + 'versionData' => '3.0' + ]; +} diff --git a/module/geogallery/ressource/theme.css b/module/geogallery/ressource/theme.css new file mode 100755 index 00000000..c0608f9a --- /dev/null +++ b/module/geogallery/ressource/theme.css @@ -0,0 +1,52 @@ +.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; + border-radius: var(--thumbRadius); + box-shadow: var(--thumbShadows) var(--thumbShadowsColor); + -webkit-box-shadow: var(--thumbShadows) var(--thumbShadowsColor); + -moz-box-shadow: var(--thumbShadows) var(--thumbShadowsColor); +} +.galleryPicture:hover, +.galleryGalleryPicture:hover { + opacity: var(--thumbOpacity); +} +.galleryName, +.galleryGalleryName { + position: absolute; + left: 0; + right: 0; + bottom: 0; + border-radius: 0 0 calc(var(--thumbRadius)/2) calc(var(--thumbRadius)/2); + 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%; + padding: 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/geogallery/ressource/vartheme.css b/module/geogallery/ressource/vartheme.css new file mode 100755 index 00000000..bd665d49 --- /dev/null +++ b/module/geogallery/ressource/vartheme.css @@ -0,0 +1,27 @@ +.galleryRow { + --thumbAlign: #thumbAlign#; +} +.colPicture { + --thumbWidth: #thumbWidth#; + --thumbMargin: #thumbMargin#; +} +.galleryPicture, +.galleryGalleryPicture { + --thumbHeight: #thumbHeight#; + --thumbBorder: #thumbBorder#; + --thumbBorderColor: #thumbBorderColor#; + --thumbRadius: #thumbRadius#; + --thumbShadows: #thumbShadows#; + --thumbShadowsColor: #thumbShadowsColor#; +} +.galleryName, +.galleryGalleryName { + --legendHeight: #legendHeight#; + --legendAlign: #legendAlign#; + --legendTextColor: #legendTextColor#; + --legendBgColor: #legendBgColor#; +} +.galleryPicture:hover, +.galleryGalleryPicture:hover { + --thumbOpacity: #thumbOpacity#; +} diff --git a/module/geogallery/vendor/tablednd/MIT-LICENSE.txt b/module/geogallery/vendor/tablednd/MIT-LICENSE.txt new file mode 100644 index 00000000..fb40abd8 --- /dev/null +++ b/module/geogallery/vendor/tablednd/MIT-LICENSE.txt @@ -0,0 +1,22 @@ +Copyright (c) Denis Howlett +Copyright 2012 Nick Lombard - nickl- and other contributors +https://github.com/isocra/TableDnD + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/module/geogallery/vendor/tablednd/inc.json b/module/geogallery/vendor/tablednd/inc.json new file mode 100755 index 00000000..aea2b720 --- /dev/null +++ b/module/geogallery/vendor/tablednd/inc.json @@ -0,0 +1,3 @@ +[ + "tablednd.min.js" +] \ No newline at end of file diff --git a/module/geogallery/vendor/tablednd/lisez-moi.txt b/module/geogallery/vendor/tablednd/lisez-moi.txt new file mode 100755 index 00000000..695d1a4f --- /dev/null +++ b/module/geogallery/vendor/tablednd/lisez-moi.txt @@ -0,0 +1,2 @@ +https://github.com/isocra/TableDnD +Version 1.0.5 \ No newline at end of file diff --git a/module/geogallery/vendor/tablednd/tablednd.min.js b/module/geogallery/vendor/tablednd/tablednd.min.js new file mode 100755 index 00000000..bb516a6a --- /dev/null +++ b/module/geogallery/vendor/tablednd/tablednd.min.js @@ -0,0 +1,2 @@ +/*! jquery.tablednd.js 20-11-2020 */ +!function(a,b,c,d){var e="touchstart mousedown",f="touchmove mousemove",g="touchend mouseup";a(c).ready(function(){function b(a){for(var b={},c=a.match(/([^;:]+)/g)||[];c.length;)b[c.shift()]=c.shift().trim();return b}a("table").each(function(){"dnd"===a(this).data("table")&&a(this).tableDnD({onDragStyle:a(this).data("ondragstyle")&&b(a(this).data("ondragstyle"))||null,onDropStyle:a(this).data("ondropstyle")&&b(a(this).data("ondropstyle"))||null,onDragClass:a(this).data("ondragclass")===d&&"tDnD_whileDrag"||a(this).data("ondragclass"),onDrop:a(this).data("ondrop")&&new Function("table","row",a(this).data("ondrop")),onDragStart:a(this).data("ondragstart")&&new Function("table","row",a(this).data("ondragstart")),onDragStop:a(this).data("ondragstop")&&new Function("table","row",a(this).data("ondragstop")),scrollAmount:a(this).data("scrollamount")||5,sensitivity:a(this).data("sensitivity")||10,hierarchyLevel:a(this).data("hierarchylevel")||0,indentArtifact:a(this).data("indentartifact")||'
 
',autoWidthAdjust:a(this).data("autowidthadjust")||!0,autoCleanRelations:a(this).data("autocleanrelations")||!0,jsonPretifySeparator:a(this).data("jsonpretifyseparator")||"\t",serializeRegexp:a(this).data("serializeregexp")&&new RegExp(a(this).data("serializeregexp"))||/[^\-]*$/,serializeParamName:a(this).data("serializeparamname")||!1,dragHandle:a(this).data("draghandle")||null})})}),jQuery.tableDnD={currentTable:null,dragObject:null,mouseOffset:null,oldX:0,oldY:0,build:function(b){return this.each(function(){this.tableDnDConfig=a.extend({onDragStyle:null,onDropStyle:null,onDragClass:"tDnD_whileDrag",onDrop:null,onDragStart:null,onDragStop:null,scrollAmount:5,sensitivity:10,hierarchyLevel:0,indentArtifact:'
 
',autoWidthAdjust:!0,autoCleanRelations:!0,jsonPretifySeparator:"\t",serializeRegexp:/[^\-]*$/,serializeParamName:!1,dragHandle:null},b||{}),a.tableDnD.makeDraggable(this),this.tableDnDConfig.hierarchyLevel&&a.tableDnD.makeIndented(this)}),this},makeIndented:function(b){var c,d,e=b.tableDnDConfig,f=b.rows,g=a(f).first().find("td:first")[0],h=0,i=0;if(a(b).hasClass("indtd"))return null;d=a(b).addClass("indtd").attr("style"),a(b).css({whiteSpace:"nowrap"});for(var j=0;ja.vertical&&this.dragObject.parentNode.insertBefore(this.dragObject,b.nextSibling)||00&&a(c).find("td:first").children(":first").remove()&&a(c).data("level",--d),0>b.horizontal&&d=d&&a(c).children(":first").prepend(e.indentArtifact)&&a(c).data("level",++d)},mousemove:function(b){var c,d,e,f,g,h=a(a.tableDnD.dragObject),i=a.tableDnD.currentTable.tableDnDConfig;return b&&b.preventDefault(),!!a.tableDnD.dragObject&&("touchmove"===b.type&&event.preventDefault(),i.onDragClass&&h.addClass(i.onDragClass)||h.css(i.onDragStyle),d=a.tableDnD.mouseCoords(b),f=d.x-a.tableDnD.mouseOffset.x,g=d.y-a.tableDnD.mouseOffset.y,a.tableDnD.autoScroll(d),c=a.tableDnD.findDropTargetRow(h,g),e=a.tableDnD.findDragDirection(f,g),a.tableDnD.moveVerticle(e,c),a.tableDnD.moveHorizontal(e,c),!1)},findDragDirection:function(a,b){var c=this.currentTable.tableDnDConfig.sensitivity,d=this.oldX,e=this.oldY,f=d-c,g=d+c,h=e-c,i=e+c,j={horizontal:a>=f&&a<=g?0:a>d?-1:1,vertical:b>=h&&b<=i?0:b>e?-1:1};return 0!==j.horizontal&&(this.oldX=a),0!==j.vertical&&(this.oldY=b),j},findDropTargetRow:function(b,c){for(var d=0,e=this.currentTable.rows,f=this.currentTable.tableDnDConfig,g=0,h=null,i=0;ig-d&&c1&&a(this.currentTable.rows).each(function(){if((h=a(this).data("level"))>1)for(e=a(this).prev().data("level");h>e+1;)a(this).find("td:first").children(":first").remove(),a(this).data("level",--h)}),b.onDragClass&&a(d).removeClass(b.onDragClass)||a(d).css(b.onDropStyle),this.dragObject=null,b.onDrop&&this.originalOrder!==this.currentOrder()&&a(d).hide().fadeIn("fast")&&b.onDrop(this.currentTable,d),b.onDragStop&&b.onDragStop(this.currentTable,d),this.currentTable=null},mouseup:function(b){return b&&b.preventDefault(),a.tableDnD.processMouseup(),!1},jsonize:function(a){var b=this.currentTable;return a?JSON.stringify(this.tableData(b),null,b.tableDnDConfig.jsonPretifySeparator):JSON.stringify(this.tableData(b))},serialize:function(){return a.param(this.tableData(this.currentTable))},serializeTable:function(a){for(var b="",c=a.tableDnDConfig.serializeParamName||a.id,d=a.rows,e=0;e0&&(b+="&");var f=d[e].id;f&&a.tableDnDConfig&&a.tableDnDConfig.serializeRegexp&&(f=f.match(a.tableDnDConfig.serializeRegexp)[0],b+=c+"[]="+f)}return b},serializeTables:function(){var b=[];return a("table").each(function(){this.id&&b.push(a.param(a.tableDnD.tableData(this)))}),b.join("&")},tableData:function(b){var c,d,e,f,g=b.tableDnDConfig,h=[],i=0,j=0,k=null,l={};if(b||(b=this.currentTable),!b||!b.rows||!b.rows.length)return{error:{code:500,message:"Not a valid table."}};if(!b.id&&!g.serializeParamName)return{error:{code:500,message:"No serializable unique id provided."}};f=g.autoCleanRelations&&b.rows||a.makeArray(b.rows),d=g.serializeParamName||b.id,e=d,c=function(a){return a&&g&&g.serializeRegexp?a.match(g.serializeRegexp)[0]:a},l[e]=[],!g.autoCleanRelations&&a(f[0]).data("level")&&f.unshift({id:"undefined"});for(var m=0;mi)h.push([e,i]),e=c(f[m-1].id);else if(j=i&&(h[n][1]=0);i=j,a.isArray(l[e])||(l[e]=[]),k=c(f[m].id),k&&l[e].push(k)}else(k=c(f[m].id))&&l[e].push(k);return l}},jQuery.fn.extend({tableDnD:a.tableDnD.build,tableDnDUpdate:a.tableDnD.updateTables,tableDnDSerialize:a.proxy(a.tableDnD.serialize,a.tableDnD),tableDnDSerializeAll:a.tableDnD.serializeTables,tableDnDData:a.proxy(a.tableDnD.tableData,a.tableDnD)})}(jQuery,window,window.document); \ No newline at end of file diff --git a/module/geogallery/view/add/add.css b/module/geogallery/view/add/add.css new file mode 100644 index 00000000..921fad91 --- /dev/null +++ b/module/geogallery/view/add/add.css @@ -0,0 +1,19 @@ +/** + * 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 + * @copyright Copyright (C) 2008-2018, Rémi Jean + * @author Frédéric Tempez + * @copyright Copyright (C) 2018-2024, Frédéric Tempez + * @license CC Attribution-NonCommercial-NoDerivatives 4.0 International + * @link http://zwiicms.fr/ + */ + + + +/** NE PAS EFFACER +* admin.css +*/ \ No newline at end of file diff --git a/module/geogallery/view/add/add.js.php b/module/geogallery/view/add/add.js.php new file mode 100644 index 00000000..4d936612 --- /dev/null +++ b/module/geogallery/view/add/add.js.php @@ -0,0 +1,88 @@ +/** + * 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 + * @copyright Copyright (C) 2008-2018, Rémi Jean + * @author Frédéric Tempez + * @copyright Copyright (C) 2018-2024, Frédéric Tempez + * @license CC Attribution-NonCommercial-NoDerivatives 4.0 International + * @link http://zwiicms.fr/ + */ + + $( document ).ready(function() { + + + /** + * Tri de la galerie avec drag and drop + */ + $("#galleryTable").tableDnD({ + onDrop: function(table, row) { + $("#galleryAddFilterResponse").val($.tableDnD.serialize()); + }, + onDragStop : function(table, row) { + // Affiche le bouton de tri après un déplacement + //$(":input[type='submit']").prop('disabled', false); + // Sauvegarde le tri + sortGalleries(); + }, + // Supprime le tiret des séparateurs + serializeRegexp: "" + }); + + + + /** + * Confirmation de suppression + */ + $(".galleryAddDelete").on("click", function() { + var _this = $(this); + var message = ""; + return core.confirm(message, function() { + $(location).attr("href", _this.attr("href")); + }); + }); + +}); + +/** + * Liste des dossiers + */ +var oldResult = []; +var directoryDOM = $("#galleryAddDirectory"); +var directoryOldDOM = $("#galleryAddDirectoryOld"); +function dirs() { + $.ajax({ + type: "POST", + url: "getUrl(0); ?>/dirs", + success: function(result) { + if($(result).not(oldResult).length !== 0 || $(oldResult).not(result).length !== 0) { + directoryDOM.empty(); + for(var i = 0; i < result.length; i++) { + directoryDOM.append(function(i) { + var option = $("