diff --git a/.travis.yml b/.travis.yml index 58d570a..cfb576e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,6 +11,8 @@ php: - "7.3" - "7.2" - "7.1" + - "7.4snapshot" + - "nightly" env: - CONTAO_VERSION=contao/core-bundle ~4.4.0 @@ -19,10 +21,12 @@ env: matrix: exclude: + allow_failures: + - php: "nightly" + - php: "7.4snapshot" -sudo: false - -install: +before_script: + - echo "memory_limit=-1" >> ~/.phpenv/versions/$(phpenv version-name)/etc/conf.d/travis.ini - travis_retry composer self-update && composer --version - travis_retry composer require $CONTAO_VERSION --no-update - travis_retry composer update --prefer-dist --no-interaction diff --git a/CHANGELOG.md b/CHANGELOG.md index 3d1bcc2..c5b2d0e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,9 +6,16 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## 3.1.3 - 2019-01-10 +## [3.1.4] - 2019-02-13 -[Full Changelog](https://github.com/netzmacht/contao-leaflet-maps/compare/3.1.2...3.1.3) +### Fixed + + - Fix ordering changes in layer control element aren't recognized ([#72](https://github.com/netzmacht/contao-leaflet-maps/issues/72)) + - Fix markers with negative coordinates aren't displayed ([#74](https://github.com/netzmacht/contao-leaflet-maps/issues/74)) + - Fix image icon with non existing image throws exception ([#75](https://github.com/netzmacht/contao-leaflet-maps/issues/75)) + - Fix invalid alias then using multiple edit. Aliases aren't copied anymore. ([#71](https://github.com/netzmacht/contao-leaflet-maps/issues/71)) + +## [3.1.3] - 2019-01-10 ### Fixed @@ -38,9 +45,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Add missing GeoportailFrance of leaflet-providers - Add missing OneMapSG of leaflet-providers -## 3.1.1 - 2018-12-07 - -[Full Changelog](https://github.com/netzmacht/contao-leaflet-maps/compare/3.1.0...3.1.1) +## [3.1.1] - 2018-12-07 ### Fixed @@ -74,43 +79,31 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Fix broken marker cluster layer (#60). -## 3.0.4 - 2018-10-08 - -[Full Changelog](https://github.com/netzmacht/contao-leaflet-maps/compare/3.0.3...3.0.4) +## [3.0.4] - 2018-10-08 ### Fixed - Fix broken content element attributes (Missing class and custom id). -## 3.0.3 - 2018-09-18 - -[Full Changelog](https://github.com/netzmacht/contao-leaflet-maps/compare/3.0.2...3.0.3) +## [3.0.3] - 2018-09-18 ### Fixed - Make alias generator services public for Contao 4.6/Symfony 4.0 compatibility. -## 3.0.2 - 2018-08-23 - -[Full Changelog](https://github.com/netzmacht/contao-leaflet-maps/compare/3.0.1...3.0.2) +## [3.0.2] - 2018-08-23 - Run composer require checker and solve issues. -## 3.0.1 - 2018-06-20 - -[Full Changelog](https://github.com/netzmacht/contao-leaflet-maps/compare/3.0.0...3.0.1) +## [3.0.1] - 2018-06-20 - Fix broken dynamic bbox related data loading (#57) -## 3.0.0 - 2018-01-05 - -[Full Changelog](https://github.com/netzmacht/contao-leaflet-maps/compare/3.0.0-beta1...3.0.0) +## [3.0.0] - 2018-01-05 - Make hook/dca listener services public -## 3.0.0-beta1 - 2017-11-15 - -[Full Changelog](https://github.com/netzmacht/contao-leaflet-maps/compare/3.0.0-alpha2...3.0.0-beta1) +## [3.0.0-beta1] - 2017-11-15 Enhancements @@ -121,9 +114,7 @@ Bugfixes - Broken service definitions - Broken file layer id -## 3.0.0-alpha1 - 2017-10-19 - -[Full Changelog](https://github.com/netzmacht/contao-leaflet-maps/compare/3.0.0-alpha1...3.0.0-alpha2) +## [3.0.0-alpha2] - 2017-10-19 Implemented enhancements @@ -132,3 +123,14 @@ Implemented enhancements - New file layer for gpx,kml,wkt,topojson,geojson files added - Bypass filesystem cache in debug mode - Changelog added + +[3.1.4]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.1.2...3.1.4 +[3.1.3]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.1.2...3.1.3 +[3.1.1]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.1.0...3.1.1 +[3.0.4]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.0.3...3.0.4 +[3.0.3]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.0.2...3.0.3 +[3.0.2]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.0.1...3.0.2 +[3.0.1]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.0.0...3.0.1 +[3.0.0]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.0.0-beta1...3.0.0 +[3.0.0-beta1]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.0.0-alpha2...3.0.0-beta1 +[3.0-0-alpha2]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.0.0-alpha1...3.0.0-alpha2 diff --git a/README.md b/README.md index 0e4d64a..d81f1e5 100644 --- a/README.md +++ b/README.md @@ -2,9 +2,9 @@ Leaflet integration into Contao CMS =================================== [![Build Status](http://img.shields.io/travis/netzmacht/contao-leaflet-maps/master.svg?style=flat-square)](https://travis-ci.org/netzmacht/contao-leaflet-maps) -[![Version](http://img.shields.io/packagist/v/netzmacht/contao-leaflet-maps.svg?style=flat-square)](http://packagist.com/packages/netzmacht/contao-leaflet-maps) -[![License](http://img.shields.io/packagist/l/netzmacht/contao-leaflet-maps.svg?style=flat-square)](http://packagist.com/packages/netzmacht/contao-leaflet-maps) -[![Downloads](http://img.shields.io/packagist/dt/netzmacht/contao-leaflet-maps.svg?style=flat-square)](http://packagist.com/packages/netzmacht/contao-leaflet-maps) +[![Version](http://img.shields.io/packagist/v/netzmacht/contao-leaflet-maps.svg?style=flat-square)](http://packagist.org/packages/netzmacht/contao-leaflet-maps) +[![License](http://img.shields.io/packagist/l/netzmacht/contao-leaflet-maps.svg?style=flat-square)](http://packagist.org/packages/netzmacht/contao-leaflet-maps) +[![Downloads](http://img.shields.io/packagist/dt/netzmacht/contao-leaflet-maps.svg?style=flat-square)](http://packagist.org/packages/netzmacht/contao-leaflet-maps) [![Contao Community Alliance coding standard](http://img.shields.io/badge/cca-coding_standard-red.svg?style=flat-square)](https://github.com/contao-community-alliance/coding-standard) This extension provides a backend gui for integrating [Leaflet](http://leafletjs.com/) into the Contao CMS. @@ -38,6 +38,12 @@ Features - Autoloading of required assets. - [Layer for MetaModels](https://github.com/netzmacht/contao-leaflet-metamodels) + +Documentation +------------- + +A basic [user documentation](http://leaflet-maps-for-contao.readthedocs.org/) written in German is available. + Changelog --------- diff --git a/composer.json b/composer.json index d1c1611..e21def3 100644 --- a/composer.json +++ b/composer.json @@ -1,12 +1,12 @@ { "name": "netzmacht/contao-leaflet-maps", + "type": "contao-bundle", "description": "Contao Leaflet maps integration", "keywords": [ "contao", "maps", "leaflet" ], - "type": "contao-bundle", "license": "LGPL-3.0-or-later", "authors": [ { @@ -16,38 +16,48 @@ "role": "Developer" } ], - "support": { - "email": "mail@netzmacht.de", - "issues": "https://github.com/netzmacht/contao-leaflet-maps/issues", - "source": "https://github.com/netzmacht/contao-leaflet-maps" - }, "require": { "php": ">=7.1", "ext-json": "*", "ext-pdo": "*", + "contao-community-alliance/meta-palettes": "^2.0 || ^1.11", "contao/core-bundle": "~4.4", + "doctrine/cache": "^1.0", "doctrine/dbal": "^2.5", - "symfony/config": "~3.3 || ~4.0", - "symfony/event-dispatcher": "~3.3 || ~4.0", - "symfony/dependency-injection": "~3.3 || ~4.0", - "symfony/filesystem": "~3.3 || ~4.0", - "symfony/http-kernel": "~3.3 || ~4.0", - "symfony/translation": "~3.3 || ~4.0", - "symfony/templating": "~3.3 || ~4.0", - "netzmacht/contao-leaflet-libraries": "^1.3.4", + "menatwork/contao-multicolumnwizard": "^3.3", "netzmacht/contao-leaflet-geocode-widget": "^1.2", + "netzmacht/contao-leaflet-libraries": "^1.3.4", + "netzmacht/contao-page-context": "~1.0", + "netzmacht/contao-toolkit": "~3.0", "netzmacht/php-javascript-builder": "^1.0", "netzmacht/php-leaflet": "^1.1.0", - "netzmacht/contao-toolkit": "~3.0", - "netzmacht/contao-page-context": "~1.0", - "contao-community-alliance/meta-palettes": "^2.0 || ^1.5", - "menatwork/contao-multicolumnwizard": "^3.2", - "doctrine/cache": "^1.0" + "symfony/config": "~3.3 || ~4.0", + "symfony/dependency-injection": "~3.3 || ~4.0", + "symfony/event-dispatcher": "~3.3 || ~4.0", + "symfony/filesystem": "~3.3 || ~4.0", + "symfony/http-kernel": "~3.3 || ~4.0", + "symfony/templating": "~3.3 || ~4.0", + "symfony/translation": "~3.3 || ~4.0" }, "require-dev": { - "phpcq/all-tasks": "^1.2", "contao/manager-plugin": "^2.1", - "phpstan/phpstan": "^0.10.3" + "phpcq/all-tasks": "^1.2" + }, + "extra": { + "branch-alias": { + "dev-master": "3.1.x-dev", + "dev-develop": "3.2.x-dev", + "dev-support/2.x": "2.0.x-dev" + }, + "contao": { + "transifex": { + "project": "contao-leaflet-maps", + "prefix": "core-", + "languages_cto": "src/Bundle/Resources/contao/languages", + "languages_tx": ".tx" + } + }, + "contao-manager-plugin": "Netzmacht\\Contao\\Leaflet\\Bundle\\ContaoManager\\Plugin" }, "autoload": { "psr-4": { @@ -59,20 +69,10 @@ "vendor/phpcq/autoload-validation/hacks/contao-hack.php" ] }, - "extra": { - "branch-alias": { - "dev-master": "3.1.x-dev", - "dev-develop": "3.2.x-dev", - "dev-support/2.x": "2.0.x-dev" - }, - "contao-manager-plugin": "Netzmacht\\Contao\\Leaflet\\Bundle\\ContaoManager\\Plugin", - "contao": { - "transifex": { - "project": "contao-leaflet-maps", - "prefix": "core-", - "languages_cto": "src/Bundle/Resources/contao/languages", - "languages_tx": ".tx" - } - } + "support": { + "email": "mail@netzmacht.de", + "issues": "https://github.com/netzmacht/contao-leaflet-maps/issues", + "source": "https://github.com/netzmacht/contao-leaflet-maps", + "docs": "http://leaflet-maps-for-contao.readthedocs.org/" } } diff --git a/src/Bundle/Resources/contao/dca/tl_leaflet_control.php b/src/Bundle/Resources/contao/dca/tl_leaflet_control.php index b5403f1..39488af 100644 --- a/src/Bundle/Resources/contao/dca/tl_leaflet_control.php +++ b/src/Bundle/Resources/contao/dca/tl_leaflet_control.php @@ -164,6 +164,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_control'] = [ 'maxlength' => 255, 'tl_class' => 'w50', 'nullIfEmpty' => true, + 'doNotCopy' => true, ], 'toolkit' => [ 'alias_generator' => [ diff --git a/src/Bundle/Resources/contao/dca/tl_leaflet_icon.php b/src/Bundle/Resources/contao/dca/tl_leaflet_icon.php index 3e99465..bcd2de8 100644 --- a/src/Bundle/Resources/contao/dca/tl_leaflet_icon.php +++ b/src/Bundle/Resources/contao/dca/tl_leaflet_icon.php @@ -179,7 +179,14 @@ $GLOBALS['TL_DCA']['tl_leaflet_icon'] = [ ['netzmacht.contao_toolkit.dca.listeners.alias_generator', 'handleSaveCallback'], ['netzmacht.contao_leaflet.listeners.dca.validator', 'validateAlias'], ], - 'eval' => ['mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true], + 'eval' => [ + 'mandatory' => false, + 'maxlength' => 255, + 'tl_class' => 'w50', + 'unique' => true, + 'doNotCopy' => true, + 'nullIfEmpty' => true, + ], 'toolkit' => [ 'alias_generator' => [ 'factory' => 'netzmacht.contao_leaflet.definition.alias_generator.factory_default', diff --git a/src/Bundle/Resources/contao/dca/tl_leaflet_layer.php b/src/Bundle/Resources/contao/dca/tl_leaflet_layer.php index 2f07840..20e37ce 100644 --- a/src/Bundle/Resources/contao/dca/tl_leaflet_layer.php +++ b/src/Bundle/Resources/contao/dca/tl_leaflet_layer.php @@ -278,7 +278,14 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = [ ['netzmacht.contao_toolkit.dca.listeners.alias_generator', 'handleSaveCallback'], ['netzmacht.contao_leaflet.listeners.dca.validator', 'validateAlias'], ], - 'eval' => ['mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true], + 'eval' => [ + 'mandatory' => false, + 'maxlength' => 255, + 'tl_class' => 'w50', + 'unique' => true, + 'nullIfEmpty' => true, + 'doNotCopy' => true, + ], 'toolkit' => [ 'alias_generator' => [ 'factory' => 'netzmacht.contao_leaflet.definition.alias_generator.factory_default', diff --git a/src/Bundle/Resources/contao/dca/tl_leaflet_map.php b/src/Bundle/Resources/contao/dca/tl_leaflet_map.php index c293b32..2a6c615 100644 --- a/src/Bundle/Resources/contao/dca/tl_leaflet_map.php +++ b/src/Bundle/Resources/contao/dca/tl_leaflet_map.php @@ -157,7 +157,14 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = [ ['netzmacht.contao_toolkit.dca.listeners.alias_generator', 'handleSaveCallback'], ['netzmacht.contao_leaflet.listeners.dca.validator', 'validateAlias'], ], - 'eval' => ['mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true], + 'eval' => [ + 'mandatory' => false, + 'maxlength' => 255, + 'tl_class' => 'w50', + 'unique' => true, + 'doNotCopy' => true, + 'nullIfEmpty' => true, + ], 'toolkit' => [ 'alias_generator' => [ 'factory' => 'netzmacht.contao_leaflet.definition.alias_generator.factory_default', diff --git a/src/Bundle/Resources/contao/dca/tl_leaflet_marker.php b/src/Bundle/Resources/contao/dca/tl_leaflet_marker.php index 0b24991..d8a6556 100644 --- a/src/Bundle/Resources/contao/dca/tl_leaflet_marker.php +++ b/src/Bundle/Resources/contao/dca/tl_leaflet_marker.php @@ -160,7 +160,14 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = [ ['netzmacht.contao_toolkit.dca.listeners.alias_generator', 'handleSaveCallback'], ['netzmacht.contao_leaflet.listeners.dca.validator', 'validateAlias'], ], - 'eval' => ['mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true], + 'eval' => [ + 'mandatory' => false, + 'maxlength' => 255, + 'tl_class' => 'w50', + 'unique' => true, + 'doNotCopy' => true, + 'nullIfEmpty' => true, + ], 'toolkit' => [ 'alias_generator' => [ 'factory' => 'netzmacht.contao_leaflet.definition.alias_generator.factory_default', diff --git a/src/Bundle/Resources/contao/dca/tl_leaflet_popup.php b/src/Bundle/Resources/contao/dca/tl_leaflet_popup.php index b40f21d..2aca701 100644 --- a/src/Bundle/Resources/contao/dca/tl_leaflet_popup.php +++ b/src/Bundle/Resources/contao/dca/tl_leaflet_popup.php @@ -151,7 +151,14 @@ $GLOBALS['TL_DCA']['tl_leaflet_popup'] = [ ['netzmacht.contao_toolkit.dca.listeners.alias_generator', 'handleSaveCallback'], ['netzmacht.contao_leaflet.listeners.dca.validator', 'validateAlias'], ], - 'eval' => ['mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true], + 'eval' => [ + 'mandatory' => false, + 'maxlength' => 255, + 'tl_class' => 'w50', + 'unique' => true, + 'doNotCopy' => true, + 'nullIfEmpty' => true, + ], 'toolkit' => [ 'alias_generator' => [ 'factory' => 'netzmacht.contao_leaflet.definition.alias_generator.factory_default', diff --git a/src/Bundle/Resources/contao/dca/tl_leaflet_style.php b/src/Bundle/Resources/contao/dca/tl_leaflet_style.php index 8a10177..12033c8 100644 --- a/src/Bundle/Resources/contao/dca/tl_leaflet_style.php +++ b/src/Bundle/Resources/contao/dca/tl_leaflet_style.php @@ -145,7 +145,14 @@ $GLOBALS['TL_DCA']['tl_leaflet_style'] = [ ['netzmacht.contao_toolkit.dca.listeners.alias_generator', 'handleSaveCallback'], ['netzmacht.contao_leaflet.listeners.dca.validator', 'validateAlias'], ], - 'eval' => ['mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true], + 'eval' => [ + 'mandatory' => false, + 'maxlength' => 255, + 'tl_class' => 'w50', + 'unique' => true, + 'doNotCopy' => true, + 'nullIfEmpty' => true, + ], 'toolkit' => [ 'alias_generator' => [ 'factory' => 'netzmacht.contao_leaflet.definition.alias_generator.factory_default', diff --git a/src/Bundle/Resources/contao/dca/tl_leaflet_vector.php b/src/Bundle/Resources/contao/dca/tl_leaflet_vector.php index 4e2fe66..543b26f 100644 --- a/src/Bundle/Resources/contao/dca/tl_leaflet_vector.php +++ b/src/Bundle/Resources/contao/dca/tl_leaflet_vector.php @@ -185,7 +185,14 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = [ ['netzmacht.contao_toolkit.dca.listeners.alias_generator', 'handleSaveCallback'], ['netzmacht.contao_leaflet.listeners.dca.validator', 'validateAlias'], ], - 'eval' => ['mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true], + 'eval' => [ + 'mandatory' => false, + 'maxlength' => 255, + 'tl_class' => 'w50', + 'unique' => true, + 'doNotCopy' => true, + 'nullIfEmpty' => true, + ], 'toolkit' => [ 'alias_generator' => [ 'factory' => 'netzmacht.contao_leaflet.definition.alias_generator.factory_default', diff --git a/src/Listener/Dca/MapDcaListener.php b/src/Listener/Dca/MapDcaListener.php index fa74ef4..5aa45c7 100644 --- a/src/Listener/Dca/MapDcaListener.php +++ b/src/Listener/Dca/MapDcaListener.php @@ -25,10 +25,8 @@ use Netzmacht\Contao\Toolkit\Dca\Listener\AbstractListener; use Netzmacht\Contao\Toolkit\Dca\Manager; use Netzmacht\Contao\Toolkit\Dca\Options\OptionsBuilder; use PDO; -use function strlen; use Symfony\Component\HttpFoundation\Session\Session; use Symfony\Component\Translation\TranslatorInterface as Translator; -use function var_dump; /** * Class Map is the helper class for the tl_leaflet_map dca. diff --git a/src/Mapper/Type/ImageIconMapper.php b/src/Mapper/Type/ImageIconMapper.php index b92e8df..11701e1 100644 --- a/src/Mapper/Type/ImageIconMapper.php +++ b/src/Mapper/Type/ImageIconMapper.php @@ -71,16 +71,10 @@ class ImageIconMapper extends AbstractIconMapper Request $request = null, $elementId = null ) { - $arguments = parent::buildConstructArguments($model, $mapper, $request, $elementId); - - if ($model->iconImage) { - $repository = $this->repositoryManager->getRepository(FilesModel::class); - $file = $repository->findByUuid($model->iconImage); - - if ($file) { - $arguments[] = $file->path; - } - } + $arguments = parent::buildConstructArguments($model, $mapper, $request, $elementId); + $repository = $this->repositoryManager->getRepository(FilesModel::class); + $file = $repository->findByUuid($model->iconImage); + $arguments[] = $file ? $file->path : ''; return $arguments; } @@ -117,8 +111,6 @@ class ImageIconMapper extends AbstractIconMapper $file = $repository->findByUuid($model->iconImage); if ($file) { - $definition->setIconUrl($file->path); - $file = new File($file->path); $definition->setIconSize([$file->width, $file->height]); diff --git a/src/Model/ControlModel.php b/src/Model/ControlModel.php index 367c0eb..da50902 100644 --- a/src/Model/ControlModel.php +++ b/src/Model/ControlModel.php @@ -41,6 +41,7 @@ SELECT l.*, c.mode as controlMode FROM tl_leaflet_layer l LEFT JOIN tl_leaflet_control_layer c ON l.id = c.lid WHERE c.cid=? +ORDER BY c.sorting SQL; $result = Database::getInstance() @@ -67,6 +68,7 @@ FROM tl_leaflet_layer l LEFT JOIN tl_leaflet_control_layer c ON l.id = c.lid WHERE c.cid=? AND l.active=1 +ORDER BY c.sorting SQL; $result = Database::getInstance() diff --git a/src/Model/MarkerModel.php b/src/Model/MarkerModel.php index 8064a1d..a7e2972 100644 --- a/src/Model/MarkerModel.php +++ b/src/Model/MarkerModel.php @@ -17,7 +17,6 @@ use Netzmacht\Contao\Leaflet\Filter\BboxFilter; use Netzmacht\Contao\Leaflet\Filter\DistanceFilter; use Netzmacht\Contao\Leaflet\Filter\Filter; use Netzmacht\LeafletPHP\Value\LatLngBounds; -use function var_dump; /** * Class MarkerModel for the tl_leaflet_marker table. @@ -50,8 +49,8 @@ class MarkerModel extends AbstractActiveModel [ $table . '.active=1', $table . '.pid=?', - $table . '.latitude>0', - $table . '.longitude>0', + $table . '.latitude IS NOT NULL', + $table . '.longitude IS NOT NULL', ], [$pid], ['order' => 'sorting']