diff --git a/module/geogallery/geogallery.php b/module/geogallery/geogallery.php
index 3b183187..0bbd7e40 100644
--- a/module/geogallery/geogallery.php
+++ b/module/geogallery/geogallery.php
@@ -167,188 +167,8 @@ class geogallery extends common
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)
- ]
- ]);
- }
}
@@ -410,10 +230,7 @@ class geogallery extends common
// Valeurs en sortie
$this->addOutput([
'title' => helper::translate('Configuration des galeries'),
- 'view' => 'config',
- 'vendor' => [
- 'tablednd'
- ]
+ 'view' => 'config'
]);
}
@@ -431,7 +248,6 @@ class geogallery extends common
$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);
@@ -447,8 +263,6 @@ class geogallery extends common
self::THUMBS_WIDTH
);
}
- // Miniatures
- $homePicture = strtolower($fileInfos->getFilename());
break;
}
}
@@ -463,11 +277,6 @@ class geogallery extends common
'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' => []
@@ -555,18 +364,11 @@ class geogallery extends common
// 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];
+ $legends[str_replace('.', '', $file)] = helper::filter($legend, helper::FILTER_STRING_SHORT);
}
// Données géographiques
foreach ((array) $this->getInput('legend', null) as $file => $data) {
- $geo[$file] = [
+ $geo[str_replace('.', '', $file)] = [
'long' => $this->getInput('gpslong[' . $file . ']'),
'lat' => $this->getInput('gpslat[' . $file . ']')
];
@@ -579,18 +381,16 @@ class geogallery extends common
$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,
//'geo' => $geo,
- 'positions' => $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'positions'])
+ 'positions' => $geo
]
]);
// Valeurs en sortie
@@ -637,19 +437,15 @@ class geogallery extends common
}
self::$pictures[str_replace('.', '', $fileInfos->getFilename())] = [
- $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'positions', str_replace('.', '', $fileInfos->getFilename())]) + 1,
+ //$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())])
]),
template::text('gpslong[' . $fileInfos->getFilename() . ']', [
'value' => $longitude,
'readonly' => true,
- ]) . '
' .
+ ]),
template::text('gpslat[' . $fileInfos->getFilename() . ']', [
'value' => $latitude,
'readonly' => true,
@@ -694,10 +490,7 @@ class geogallery extends common
// 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'
- ]
+ 'view' => 'edit'
]);
}
}
@@ -728,28 +521,6 @@ class geogallery extends common
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);
@@ -809,9 +580,6 @@ class geogallery extends common
'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']),
'vendor' => [
'leaflet'
@@ -829,61 +597,17 @@ class geogallery extends common
}
// 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);
- }
- }
+ // Construction du tableau exploitable par leaflet regroupant les images des galleries.
+ $galleries = $this->getData(['module', $this->getUrl(0)], 'content');
+ // Boucle sur les contenus de galeries
+ foreach ($galleries as $galleryId => $galleriesContent) {
+ // echo "
";var_dump( $galleriesContent ); } // 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']) - : '', 'vendor' => [ 'leaflet' ], @@ -910,43 +634,9 @@ class geogallery extends common $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)); + $success = true; // Valeurs en sortie $this->addOutput([ 'redirect' => helper::baseUrl() . $this->getUrl() . '/theme', @@ -964,121 +654,6 @@ class geogallery extends common ]); } - /** - * 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) { diff --git a/module/geogallery/vendor/tablednd/MIT-LICENSE.txt b/module/geogallery/vendor/tablednd/MIT-LICENSE.txt deleted file mode 100644 index fb40abd8..00000000 --- a/module/geogallery/vendor/tablednd/MIT-LICENSE.txt +++ /dev/null @@ -1,22 +0,0 @@ -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 deleted file mode 100755 index aea2b720..00000000 --- a/module/geogallery/vendor/tablednd/inc.json +++ /dev/null @@ -1,3 +0,0 @@ -[ - "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 deleted file mode 100755 index 695d1a4f..00000000 --- a/module/geogallery/vendor/tablednd/lisez-moi.txt +++ /dev/null @@ -1,2 +0,0 @@ -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 deleted file mode 100755 index bb516a6a..00000000 --- a/module/geogallery/vendor/tablednd/tablednd.min.js +++ /dev/null @@ -1,2 +0,0 @@ -/*! 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)||0 0&&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;i g-d&&c 1&&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;e 0&&(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;m i)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/config/config.php b/module/geogallery/view/config/config.php index a1f4ac25..6cc7be0c 100644 --- a/module/geogallery/view/config/config.php +++ b/module/geogallery/view/config/config.php @@ -7,23 +7,19 @@ 'value' => template::ico('left') ]); ?> - - helper::baseUrl() . $this->getUrl(0) . '/option/galleries/', - 'value' => template::ico('sliders') - ]); ?> --- + helper::baseUrl() . $this->getUrl(0) . '/theme/', 'value' => template::ico('brush') - ]); ?> + + ]); */?>-+ --> +helper::baseUrl() . $this->getUrl(0) . '/add/', 'value' => template::ico('plus'), - 'class' => 'buttonGreen', 'class' => 'buttonGreen' ]); ?>diff --git a/module/geogallery/view/edit/edit.php b/module/geogallery/view/edit/edit.php index a802493f..168599ed 100644 --- a/module/geogallery/view/edit/edit.php +++ b/module/geogallery/view/edit/edit.php @@ -20,7 +20,7 @@-- 'galleryTable'], $module::$picturesId); ?> + 'galleryTable'], $module::$picturesId); ?> $this->getData(['module', $this->getUrl(0), 'content', $this->getUrl(2), 'config', 'sort'])]); ?> $this->getUrl(2)]); ?> diff --git a/module/geogallery/view/index/index.js.php b/module/geogallery/view/index/index.js.php index 98c6e967..7676d755 100644 --- a/module/geogallery/view/index/index.js.php +++ b/module/geogallery/view/index/index.js.php @@ -12,36 +12,54 @@ * @link http://zwiicms.fr/ */ -// Créer une carte Leaflet centrée sur une position par défaut -var map = L.map('map').setView([0, 0], 2); - -// Ajouter une couche de tuiles OpenStreetMap à la carte -L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { - attribution: '© OpenStreetMap contributors' -}).addTo(map); - // Récupérer les données JSON des positions des images -var jsonData = ""; +var jsonData = ""; jsonData = JSON.parse(jsonData); -// Créer un tableau pour stocker les marqueurs des images -var markers = []; +// Initialize the map +var map = L.map('map').setView([51.505, -0.09], 5); -// Parcourir les données JSON et ajouter des marqueurs pour chaque image -jsonData.images.forEach(function(image) { - var marker = L.marker([image.lat, image.lng]).addTo(map); - markers.push(marker); -}); +// Add OpenStreetMap tile layer +L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { + maxZoom: 19, +}).addTo(map); -// Calculer la moyenne des positions des images -var sumLat = 0; -var sumLng = 0; -jsonData.images.forEach(function(image) { - sumLat += image.lat; - sumLng += image.lng; -}); -var avgLat = sumLat / jsonData.images.length; -var avgLng = sumLng / jsonData.images.length; +// Helper function to create a popup content +function createPopupContent(image, legend, directory) { + var imageUrl = directory + '/' + image; + var legendText = legend[image.replace('.jpg', 'jpg')]; + return ` ++ ++ `; +} -// Centrer la carte sur la moyenne des positions des images -map.setView([avgLat, avgLng]); +// Loop through each geotag dataset +for (var key in jsonData) { + if (jsonData.hasOwnProperty(key)) { + var gallery = jsonData[key]; + var directory = gallery.config.directory; + var legend = gallery.legend; + var positions = gallery.positions; + + // Loop through each image position + for (var image in positions) { + if (positions.hasOwnProperty(image)) { + var position = positions[image]; + var lat = parseFloat(position.lat); + var long = parseFloat(position.long); + + // Create a marker + var marker = L.marker([lat, long]).addTo(map); + + // Create popup content + var popupContent = createPopupContent(image, legend, directory); + + // Bind the popup to the marker + marker.bindPopup(popupContent); + } + } + } +} \ No newline at end of file diff --git a/module/geogallery/view/index/index.php b/module/geogallery/view/index/index.php index bfc8cf40..b3a146fc 100644 --- a/module/geogallery/view/index/index.php +++ b/module/geogallery/view/index/index.php @@ -1,5 +1,8 @@ - - "; var_dump($module::$galleries); ?> + +${legendText}
++ +diff --git a/module/geogallery/view/option/option.css b/module/geogallery/view/option/option.css deleted file mode 100644 index b6eeb0e0..00000000 --- a/module/geogallery/view/option/option.css +++ /dev/null @@ -1,18 +0,0 @@ -/** - * 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/option/option.js.php b/module/geogallery/view/option/option.js.php deleted file mode 100644 index 79e8e3e0..00000000 --- a/module/geogallery/view/option/option.js.php +++ /dev/null @@ -1,68 +0,0 @@ -/** - * 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/ - */ - -/** - * Gestion des événements - */ - -// Activation des options pour les galeries non uniques -$("#galleryOptionShowUniqueGallery").click(function() { - if ($(this).prop("checked")) { - $("#galleryOptionBackPosition, #galleryOptionBackAlign").prop( "disabled", true ); - } else { - $("#galleryOptionBackPosition, #galleryOptionBackAlign").prop( "disabled", false ); - } -}); - - -/** - * Liste des dossiers - */ - var oldResult = []; - var directoryDOM = $("#galleryEditDirectory"); - var directoryOldDOM = $("#galleryEditDirectoryOld"); - 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 = $(" ----- ----- 'Largeur', - 'selected' => $this->getData(['module', $this->getUrl(0), 'theme','thumbWidth']) - ]); ?> --- 'Hauteur', - 'selected' => $this->getData(['module', $this->getUrl(0), 'theme','thumbHeight']) - ]); ?> --- 'Alignement', - 'selected' => $this->getData(['module', $this->getUrl(0), 'theme','thumbAlign']) - ]); ?> --- 'Marge', - 'selected' => $this->getData(['module', $this->getUrl(0), 'theme','thumbMargin']) - ]); ?> ----- 'Bordure', - 'selected' => $this->getData(['module', $this->getUrl(0), 'theme','thumbBorder']) - ]); ?> --- 'colorPicker', - 'help' => 'Le curseur horizontal règle le niveau de transparence.', - 'label' => 'Couleur de la bordure', - 'value' => $this->getData(['module', $this->getUrl(0), 'theme','thumbBorderColor']) - ]); ?> --- 'Arrondi des angles', - 'selected' => $this->getData(['module', $this->getUrl(0), 'theme','thumbRadius']) - ]); ?> ----- 'Ombre', - 'selected' => $this->getData(['module', $this->getUrl(0), 'theme','thumbShadows']) - ]); ?> --- 'colorPicker', - 'help' => 'Le curseur horizontal règle le niveau de transparence.', - 'label' => 'Couleur de l\'ombre', - 'value' => $this->getData(['module', $this->getUrl(0), 'theme','thumbShadowsColor']) - ]); ?> --- 'Opacité au survol', - 'selected' => $this->getData(['module', $this->getUrl(0), 'theme','thumbOpacity']) - ]); ?> ----- ----- 'colorPicker', - 'help' => 'Le curseur horizontal règle le niveau de transparence.', - 'label' => 'Texte', - 'value' => $this->getData(['module', $this->getUrl(0), 'theme','legendTextColor']) - ]); ?> --- 'colorPicker', - 'help' => 'Le curseur horizontal règle le niveau de transparence.', - 'label' => 'Arrière plan', - 'value' => $this->getData(['module', $this->getUrl(0), 'theme','legendBgColor']) - ]); ?> --- 'Hauteur', - 'selected' => $this->getData(['module', $this->getUrl(0), 'theme','legendHeight']) - ]); ?> --- 'Alignement', - 'selected' => $this->getData(['module', $this->getUrl(0), 'theme','legendAlign']) - ]); ?> --