Compare commits

...

130 Commits

Author SHA1 Message Date
dependabot[bot]
d5c7a44c07 Bump minimatch from 3.0.4 to 3.1.2
Bumps [minimatch](https://github.com/isaacs/minimatch) from 3.0.4 to 3.1.2.
- [Release notes](https://github.com/isaacs/minimatch/releases)
- [Changelog](https://github.com/isaacs/minimatch/blob/main/changelog.md)
- [Commits](https://github.com/isaacs/minimatch/compare/v3.0.4...v3.1.2)

---
updated-dependencies:
- dependency-name: minimatch
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2023-02-20 09:45:36 +00:00
David Molineus
06400f9d1a Merge branch 'support-mm-2-3' 2023-02-20 10:37:20 +01:00
David Molineus
b346efeb0a Update phpcq tools 2023-02-20 10:36:01 +01:00
David Molineus
dd23a1594e Fix coding standard violations 2023-02-20 10:35:00 +01:00
David Molineus
ae800257d8 Do not silence warnings with @ 2023-02-20 10:28:21 +01:00
David Molineus
35e86ec1b9 Remove dependency of doctrine/cache 2023-02-20 09:58:43 +01:00
David Molineus
a2d1ae683d Load after leaflet-libs (See #120) 2023-02-20 09:11:07 +01:00
Stefan Heimes
91ba3ebf04 Correct a misspelled variable name 2023-01-11 12:15:30 +01:00
Stefan Heimes
8ab3cf286c Change the required minimum version of "doctrine/cache"
Remove the version 1.0 'cause of API changes.
2023-01-11 12:10:57 +01:00
Stefan Heimes
ec30f4b4b9 Correct PHP doc and add missing author 2023-01-11 12:10:18 +01:00
Stefan Heimes
fd54d739d7 Code styling 2023-01-11 12:09:58 +01:00
Sven Baumann
44546e4952 Added missing evaluation flags, for save not encoded json in the database 2022-12-10 11:18:57 +01:00
Sven Baumann
9814ed31ad Suppress warnings for undefined array key 2022-12-08 20:02:46 +01:00
Sven Baumann
bfa70d9f21 Fixed issue for deprecated missing return type 2022-12-08 19:40:02 +01:00
Sven Baumann
ff6aae3a6e Allow symfony/templating ^6.2 2022-12-08 19:26:54 +01:00
Stefan Heimes
c4980c481d Update for PHP 8.1 and MetaModels 2.3 2022-11-25 17:53:28 +01:00
Stefan Heimes
d0b9e7cf10 Update for metamodels
- MetaModels need doctrine/cache in the version ^2.1
2022-11-16 16:56:46 +01:00
David Molineus
097cd5c31f Merge pull request #113 from netzmacht/dependabot/npm_and_yarn/copy-props-2.0.5
Bump copy-props from 2.0.4 to 2.0.5
2022-02-22 10:52:33 +01:00
dependabot[bot]
c01610271c Bump copy-props from 2.0.4 to 2.0.5
Bumps [copy-props](https://github.com/gulpjs/copy-props) from 2.0.4 to 2.0.5.
- [Release notes](https://github.com/gulpjs/copy-props/releases)
- [Changelog](https://github.com/gulpjs/copy-props/blob/master/CHANGELOG.md)
- [Commits](https://github.com/gulpjs/copy-props/compare/2.0.4...2.0.5)

---
updated-dependencies:
- dependency-name: copy-props
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2022-02-22 09:49:57 +00:00
David Molineus
bcb68af234 Merge tag '3.2.3' 2022-02-22 10:49:14 +01:00
David Molineus
0e491fcc6a Prepare release 3.2.3 2022-02-22 10:47:32 +01:00
David Molineus
ea293e327f Fix access of sub layers (#97) 2022-02-22 10:30:08 +01:00
David Molineus
18f1cb5756 Load language file for the help wizard (#99) 2022-02-22 10:11:41 +01:00
David Molineus
e38e926891 Avoid array index warning 2022-02-22 10:10:57 +01:00
David Molineus
700a87bd1f Drop leftover phpcq v1 files 2022-02-22 09:53:52 +01:00
David Molineus
94ecdf9d42 Show group icon (#101) 2022-02-22 09:53:41 +01:00
David Molineus
9434302a16 Use symfony translation contracts 2022-02-22 09:52:12 +01:00
David Molineus
b79a75ac21 Update supported providers 2022-02-22 08:42:54 +01:00
David Molineus
d498903645 Fix overlapping of fields (#107) 2022-02-22 08:33:50 +01:00
David Molineus
c544202ca8 Fix applying bounds to a tile layer (Closes #109) 2022-02-22 08:30:32 +01:00
David Molineus
93f176a738 Silence info of contao/components-installer 2022-02-21 20:15:45 +01:00
David Molineus
852b926252 Support doctrine/dbal 3 2022-02-21 20:11:56 +01:00
David Molineus
87bd720d6e Switch to phpcq dev-2.0 2022-02-21 17:13:53 +01:00
David Molineus
3f2020b0d1 Do not test against PHP 8.0. The toolchain is not ready for it :-( 2022-02-21 16:51:49 +01:00
David Molineus
e9b0d6156f Merge pull request #100 from netzmacht/dependabot/npm_and_yarn/y18n-3.2.2
Bump y18n from 3.2.1 to 3.2.2
2022-02-21 16:43:42 +01:00
David Molineus
e8f1fa2485 Merge pull request #103 from netzmacht/dependabot/npm_and_yarn/hosted-git-info-2.8.9
Bump hosted-git-info from 2.8.8 to 2.8.9
2022-02-21 16:43:15 +01:00
David Molineus
791eebaddb Merge pull request #106 from netzmacht/dependabot/npm_and_yarn/path-parse-1.0.7
Bump path-parse from 1.0.6 to 1.0.7
2022-02-21 16:42:55 +01:00
David Molineus
2ed1000d4d Drop .travis.yml 2022-02-21 16:41:24 +01:00
David Molineus
4e52e31937 Add diagnostics 2022-02-21 16:40:33 +01:00
David Molineus
ef8b6d294d Require latest version of contao-toolkit 2022-02-21 16:37:54 +01:00
David Molineus
445729acfe Do not use templating engine where not required 2022-02-21 16:36:43 +01:00
David Molineus
d6a7e14a05 Bump requirements and fix symfony/event-dispatcher usage 2022-02-21 16:31:52 +01:00
dependabot[bot]
bd0eb5a416 Bump path-parse from 1.0.6 to 1.0.7
Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)

---
updated-dependencies:
- dependency-name: path-parse
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>
2021-08-10 20:25:42 +00:00
dependabot[bot]
664ce11831 Bump hosted-git-info from 2.8.8 to 2.8.9
Bumps [hosted-git-info](https://github.com/npm/hosted-git-info) from 2.8.8 to 2.8.9.
- [Release notes](https://github.com/npm/hosted-git-info/releases)
- [Changelog](https://github.com/npm/hosted-git-info/blob/v2.8.9/CHANGELOG.md)
- [Commits](https://github.com/npm/hosted-git-info/compare/v2.8.8...v2.8.9)

Signed-off-by: dependabot[bot] <support@github.com>
2021-05-09 18:49:21 +00:00
dependabot[bot]
8a752b1955 Bump y18n from 3.2.1 to 3.2.2
Bumps [y18n](https://github.com/yargs/y18n) from 3.2.1 to 3.2.2.
- [Release notes](https://github.com/yargs/y18n/releases)
- [Changelog](https://github.com/yargs/y18n/blob/master/CHANGELOG.md)
- [Commits](https://github.com/yargs/y18n/commits)

Signed-off-by: dependabot[bot] <support@github.com>
2021-03-30 15:31:51 +00:00
David Molineus
f2584d400c Update changelog 2020-12-18 09:48:41 +01:00
David Molineus
60e285c673 Generate absolute urls for file layers
https://github.com/netzmacht/contao-leaflet-maps/issues/92
2020-12-18 09:13:29 +01:00
David Molineus
49f3b7dbcd Remove template debug placeholders (#93) 2020-12-18 08:55:28 +01:00
David Molineus
89d83ab8e0 Merge pull request #95 from netzmacht/dependabot/npm_and_yarn/ini-1.3.7
Bump ini from 1.3.5 to 1.3.7
2020-12-18 08:55:15 +01:00
dependabot[bot]
141bb0f7b1 Bump ini from 1.3.5 to 1.3.7
Bumps [ini](https://github.com/isaacs/ini) from 1.3.5 to 1.3.7.
- [Release notes](https://github.com/isaacs/ini/releases)
- [Commits](https://github.com/isaacs/ini/compare/v1.3.5...v1.3.7)

Signed-off-by: dependabot[bot] <support@github.com>
2020-12-10 23:52:13 +00:00
David Molineus
457bb612ef Update changelog 2020-09-02 07:42:33 +02:00
David Molineus
118bb9a829 Do not append javascript at the body but inject them in the element/module
Consent tools might interrupt the rendering
2020-09-02 07:40:44 +02:00
David Molineus
e49c74c546 Merge tag '3.2.0' into master 2020-08-28 17:19:23 +02:00
David Molineus
6054def7aa Prepare release 2020-08-28 17:19:04 +02:00
David Molineus
86026a473b Add support for hofff/contao-consent-bridge #81 2020-08-28 17:14:33 +02:00
David Molineus
90c4621918 Prepare release 2020-08-28 16:57:52 +02:00
David Molineus
e5263a6315 Copy map layer relations (Fix #89) 2020-08-28 16:56:11 +02:00
David Molineus
515a191a66 Bump npm dependencies and recompile js 2020-08-28 16:46:58 +02:00
David Molineus
f2f7e87fd3 Merge pull request #88 from fritzmg/patch-1
Use template_legend instead of templates_legend
2020-08-10 16:56:58 +02:00
Fritz Michael Gschwantner
4198b2b6cd add author 2020-05-04 09:12:00 +01:00
Fritz Michael Gschwantner
fbd1ef81b0 use template_legend instead of templates_legend 2020-05-03 16:19:16 +01:00
Fritz Michael Gschwantner
92a376a307 use template_legend instead of template_legend 2020-05-03 16:18:33 +01:00
David Molineus
bf6a1f9db0 Add funding information 2020-01-03 09:21:09 +01:00
David Molineus
c523aed70d Merge tag '3.1.6' 2020-01-03 09:09:21 +01:00
David Molineus
4795767a8b Prepare the release 2020-01-03 09:08:59 +01:00
David Molineus
c0efdb058e Fix potential security issue 2020-01-03 09:08:52 +01:00
David Molineus
a4547ffb17 Use relative icon path for the backend group icon (#83) 2020-01-03 08:53:47 +01:00
David Molineus
a63c836535 Fix labels (See #83) 2020-01-03 08:49:07 +01:00
David Molineus
711b06c6d3 Do not apply options which value is null 2020-01-03 08:43:21 +01:00
David Molineus
70b7d0ab9c Fix release date 2019-08-26 09:04:19 +02:00
David Molineus
ea59841d6e Merge tag '3.1.5' 2019-08-26 09:03:57 +02:00
David Molineus
64c332bc25 Update node packages and recompile 2019-08-26 09:03:32 +02:00
David Molineus
3db5aad6d3 Fix composer.json 2019-08-21 13:29:08 +02:00
David Molineus
cef9d7ff44 Use twig instead of templating engine to render about page
This restores compatibility with Contao 4.8 without changing default
configuration of the symfony framework bundle.
2019-08-21 13:27:11 +02:00
David Molineus
06dd3655c0 Merge tag '3.1.4' 2019-02-13 12:56:00 +01:00
David Molineus
3b066dfeb7 Prepare release. 2019-02-13 12:53:50 +01:00
David Molineus
697e8d2f5e Drop unused function use statements. 2019-02-13 12:50:59 +01:00
David Molineus
a6c08ae8e5 Fix #71: Using multiple edit to copy entities leads to invalid aliases. Do not copy aliases at all. 2019-02-13 12:46:19 +01:00
David Molineus
bb8f9e42dc Fix #76: Urls to packagist used packagist.com instead of packagist.org. 2019-02-13 12:35:00 +01:00
David Molineus
3be5da9176 Fix #75: A non existing image of an image icon throws an exception. 2019-02-13 12:33:44 +01:00
David Molineus
55e4ed0702 Fix #74: Markers with negative coordinates aren't displayed on the map. 2019-02-13 12:09:40 +01:00
David Molineus
d42e0e122f Fix order changes in layer control element aren't applied (#72). 2019-02-13 12:06:30 +01:00
David Molineus
ac05d103f1 Normalize composer.json, add user documentation link to support section and to the readme (See #9). 2019-02-13 12:01:42 +01:00
David Molineus
cc9990cf4d Test against PHP 7.4snapshot. 2019-02-13 11:54:33 +01:00
David Molineus
9643b2c196 Link version number to the github compare link. 2019-02-13 11:27:32 +01:00
David Molineus
4d55b012fd Merge branch 'master' of github.com:netzmacht/contao-leaflet-maps 2019-01-10 16:42:31 +01:00
David Molineus
39a7207e23 Merge tag '3.1.3' 2019-01-10 16:41:33 +01:00
David Molineus
c4feeb1b38 Add missing error block. 2019-01-10 16:41:03 +01:00
David Molineus
cb3e9bc8b4 Make controller public as it's required by Symfony 4. 2019-01-10 16:39:43 +01:00
David Molineus
6a88ed380b Update travis configuration for compatibility issues with phpcq v1.2.0. Test against PHP 7.3 as well. 2018-12-18 10:56:29 +01:00
David Molineus
59e671f8ea Update CHANGELOG.md 2018-12-18 09:55:36 +01:00
David Molineus
b0df34b86e Update CHANGELOG.md 2018-12-18 09:55:18 +01:00
David Molineus
4ea2adbb85 Merge tag '3.1.2' 2018-12-18 09:26:49 +01:00
David Molineus
dc5a0a081e Complete implementation of tile providers. 2018-12-18 09:23:47 +01:00
David Molineus
79f6efd9f3 Update leaflet providers. 2018-12-17 17:01:08 +01:00
David Molineus
e7bede78b1 Drop not required .htaccess folder. 2018-12-17 15:21:05 +01:00
David Molineus
997e16891b Add defined check. 2018-12-17 15:20:51 +01:00
David Molineus
d5407357d8 Merge tag '3.1.1' 2018-12-07 11:22:41 +01:00
David Molineus
1ba19f63b1 Prepare release. 2018-12-07 11:22:23 +01:00
David Molineus
878492c0b1 Fix Code style. 2018-12-07 11:22:16 +01:00
David Molineus
57ba63556a Ignore markers without defined coordinates. 2018-12-06 10:37:39 +01:00
David Molineus
0e2b8dd3cd Fix missing marker cluster icon. 2018-11-01 16:01:16 +01:00
David Molineus
91d3786187 Merge tag '3.1.0' 2018-11-01 15:37:04 +01:00
David Molineus
5e20b83503 Prepare release. 2018-11-01 15:36:35 +01:00
David Molineus
ca103521aa add url-polyfill to about page. 2018-11-01 15:34:58 +01:00
David Molineus
f422459be2 Gulp task improvement. 2018-11-01 11:37:32 +01:00
David Molineus
c661abb626 Fix dynamic data loading for new request url. 2018-11-01 10:26:38 +01:00
David Molineus
83226cdd80 Fix gulp watch task. 2018-11-01 10:25:54 +01:00
David Molineus
ed10175072 Add hint that zoom level is probably required (Close #56). 2018-10-30 13:00:52 +01:00
David Molineus
d2338332b4 Rewrite about page using own route (Close #48). 2018-10-30 12:38:46 +01:00
David Molineus
7aa4f38902 Update readme. 2018-10-30 10:53:44 +01:00
David Molineus
cb03dcfa41 Fix broken marker cluster (#60). 2018-10-30 10:52:47 +01:00
David Molineus
2108de32d9 Add support for distance filter for the marker layer. 2018-10-30 10:48:38 +01:00
David Molineus
314e2d21ee Update readme. 2018-10-30 09:53:12 +01:00
David Molineus
6faaa866ad Use minified scripts. 2018-10-30 09:38:38 +01:00
David Molineus
b22563b38c Prevent form submit on enter when using control geocoder and close popup when value is chosen. 2018-10-30 09:36:06 +01:00
David Molineus
a10e55a126 Fix: Do not cache insert tags as it would create esi tags. 2018-10-30 08:45:47 +01:00
David Molineus
e27ac21902 Also replace non cachable inserttags. 2018-10-29 16:24:07 +01:00
David Molineus
0ba725ed38 Implement custom route for data request to prevent partial rendering of the page and it's possible issues (f.e. form captcha changes) (Close #49). 2018-10-29 16:02:50 +01:00
David Molineus
7ec2ee0d96 Upgrade to gulp 4.0. 2018-10-29 15:46:38 +01:00
David Molineus
9e54f12555 Use TL_CSS_UNITS for with and height option (#59). 2018-10-19 16:37:49 +02:00
David Molineus
b323049f9d Merge tag '3.0.4' 2018-10-08 16:26:20 +02:00
David Molineus
873de89d7c Fix broken content element attributes (Missing class and custom id). 2018-10-08 16:26:04 +02:00
David Molineus
88927a3de8 Change format of changelog and add semver note. 2018-09-18 10:33:32 +02:00
David Molineus
8fdc7dab29 Make alias generator services public for Contao 4.6/Symfony 4.0 compatibility. 2018-09-18 10:26:38 +02:00
David Molineus
9a1b6dee01 Merge tag '3.0.2' 2018-08-23 14:50:34 +02:00
David Molineus
9e0f11ec18 Prevent cacheKey is not set. 2018-08-23 14:48:58 +02:00
David Molineus
f60ed1b7be Fix changelog versions. 2018-08-23 14:36:46 +02:00
David Molineus
3d45f6b2eb Run composer require checker and solve issues. 2018-08-23 14:35:25 +02:00
David Molineus
e73a4d4bdf Merge tag '3.0.1' 2018-06-20 08:30:50 +02:00
110 changed files with 4652 additions and 561 deletions

View File

@@ -0,0 +1,15 @@
{
"symbol-whitelist": [
"null", "true", "false",
"static", "self", "parent",
"array", "string", "int", "float", "bool", "iterable", "callable", "void", "object",
"array_insert",
"Contao\\ManagerPlugin\\Bundle\\BundlePluginInterface",
"Contao\\ManagerPlugin\\Bundle\\Config\\BundleConfig",
"Contao\\ManagerPlugin\\Bundle\\Parser\\ParserInterface",
"Contao\\ManagerPlugin\\Routing\\RoutingPluginInterface",
"Hofff\\Contao\\Consent\\Bridge\\Bridge",
"Hofff\\Contao\\Consent\\Bridge\\Plugin",
"Hofff\\Contao\\Consent\\Bridge\\Render\\RenderInformation"
]
}

1
.github/FUNDING.yml vendored Normal file
View File

@@ -0,0 +1 @@
github: [dmolineus]

82
.github/workflows/diagnostics.yml vendored Normal file
View File

@@ -0,0 +1,82 @@
name: Code Quality Diagnostics
on:
pull_request:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
name: PHP ${{ matrix.php }}
strategy:
fail-fast: false
matrix:
include:
- php: 7.4
output: '-o github-action -o default'
phpcq_install: 'install'
- php: 8.0
output: '-o default'
phpcq_install: 'update'
- php: 8.1
output: '-o default'
phpcq_install: 'update'
- php: 8.2
output: '-o default'
phpcq_install: 'update'
steps:
- name: Pull source
uses: actions/checkout@v2
- name: Setup PHP with PECL extension
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php }}
- name: Cache composer cache directory
uses: actions/cache@v1
env:
cache-name: composer-cache-dir
with:
path: ~/.cache/composer
key: ${{ runner.os }}-${{ matrix.php }}-build-${{ env.cache-name }}
- name: Cache vendor directory
uses: actions/cache@v1
env:
cache-name: vendor
with:
path: vendor
key: ${{ runner.os }}-${{ matrix.php }}-build-${{ env.cache-name }}-${{ hashFiles('**/composer.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.php }}-build-${{ env.cache-name }}-
- name: Cache phpcq directory
uses: actions/cache@v1
env:
cache-name: phpcq
with:
path: .phpcq
key: ${{ runner.os }}-${{ matrix.php }}-build-${{ env.cache-name }}-${{ hashFiles('**/.phpcq.lock') }}
restore-keys: |
${{ runner.os }}-${{ matrix.php }}-build-${{ env.cache-name }}-
- name: Install composer dependencies
run: composer install
- name: Install phpcq toolchain
run: ./vendor/bin/phpcq ${{ matrix.phpcq_install }} -v
- name: Run tests
run: ./vendor/bin/phpcq run -v ${{ matrix.output }}
- name: Upload build directory to artifact
uses: actions/upload-artifact@v2
if: ${{ success() }} || ${{ failure() }}
with:
name: phpcq-builds-php-${{ matrix.php }}
path: .phpcq/build/

4
.gitignore vendored
View File

@@ -25,4 +25,6 @@ build.properties
# NPM # NPM
node_modules node_modules
package-lock.json
.phpcq
phpcq.yaml

1
.phpcq.lock Normal file

File diff suppressed because one or more lines are too long

View File

@@ -1,28 +0,0 @@
language: php
php:
- "7.0"
- "7.1"
- "7.2"
env:
- CONTAO_VERSION=contao/core-bundle ~4.4.0
matrix:
exclude:
sudo: false
install:
- travis_retry composer self-update && composer --version
- travis_retry composer require $CONTAO_VERSION --no-update
- travis_retry composer update --prefer-dist --no-interaction
script: ant -keep-going
git:
depth: 2147483647
cache:
directories:
- vendor

View File

@@ -1,25 +1,168 @@
Changelog # Changelog
=========
3.0.1 (2018-xx-xx) All notable changes to this project will be documented in this file.
------------------
[Full Changelog](https://github.com/netzmacht/contao-leaflet-maps/compare/3.0.0...3.0.1) 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).
## [Unreleased]
## [3.2.3] - 2022-02-22
### Changed
- Support symfony 5 (Contao 4.13 support) ([#110](https://github.com/netzmacht/contao-leaflet-maps/issues/110))
- Support doctrine/dbal 3 (Contao 4.13 support) ([#110](https://github.com/netzmacht/contao-leaflet-maps/issues/110))
- Fix missing icon in backend navigation ([#101](https://github.com/netzmacht/contao-leaflet-maps/issues/101))
- Fix empty help wizard ([#99](https://github.com/netzmacht/contao-leaflet-maps/issues/99))
- Update leaflet providers ([111](https://github.com/netzmacht/contao-leaflet-maps/issues/111), [102](https://github.com/netzmacht/contao-leaflet-maps/issues/102))
- Fix tile layer implementation ([#108](https://github.com/netzmacht/contao-leaflet-maps/issues/108))
- Fix access to tile layer fields ([#107](https://github.com/netzmacht/contao-leaflet-maps/issues/107))
- Fix nexted folder structure ([#97](https://github.com/netzmacht/contao-leaflet-maps/issues/97))
## [3.2.2] - 2020-12-18
### Fixed
- Remove template debug placeholders, it breaks generated javascript ([#93](https://github.com/netzmacht/contao-leaflet-maps/issues/93))
- Generate absolute urls for file layers ([#92](https://github.com/netzmacht/contao-leaflet-maps/issues/92))
## [3.2.1] - 2020-09-02
### Fixed
- Do not append javascript to the body anymore as consent tools might interrupt rendering
## [3.2.0] - 2020-08-28
### Added
- Add support for consent tools based on `hofff/contao-consent-bridge`
## [3.1.7] - 2020-08-28
### Fixed
- Duplicate map layer relations ([#89](https://github.com/netzmacht/contao-leaflet-maps/issues/89))
## [3.1.6] - 2020-01-03
### Fixed
- Do not add options which value is `NULL`
- Fix button labels ([#83](https://github.com/netzmacht/contao-leaflet-maps/issues/83))
- Fix potential security issue of symfony/dependency-injection (https://github.com/advisories/GHSA-pgwj-prpq-jpc2)
### Changed
- Use relative path for backend icon ([#82](https://github.com/netzmacht/contao-leaflet-maps/issues/82))
## [3.1.5] - 2019-08-26
### Fixed
- Use twig directly instead of templating component to restore Contao 4.8
## [3.1.4] - 2019-02-13
### 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
- Fix broken api routes in Contao 4.6/Symfony 4 (#69)
- Fix broken about.html.twig template. Error block was missing
## 3.1.2 - 2018-12-18
[Full Changelog](https://github.com/netzmacht/contao-leaflet-maps/compare/3.1.1...3.1.2)
### Fixed
- Fix broken MapBox integration: Access token is now required
- Fix broken OpenWeatherMap integration: Api key is now required
- Fix broken Thunderforest integration: Api key is now required
### Added
- Add missing OpenPtMap of leaflet-providers
- Add missing OpenRailwayMap of leaflet-providers
- Add missing OpenFireMap of leaflet-providers
- Add missing SafeCast of leaflet-providers
- Add missing map types `normalNightTransit`, `normalNightTransitMobile`, `reducedDay`, `reducedNight`,
`hybridDayTransit` and `hybridDayGrey` of HERE provider
- Add missing map types `Voyager`, `VoyagerNoLabels`, `VoyagerOnlyLabels` and `VoyagerLabelsUnder` of CartoDB provider
- Add missing Wikimedia of leaflet-providers
- Add missing GeoportailFrance of leaflet-providers
- Add missing OneMapSG of leaflet-providers
## [3.1.1] - 2018-12-07
### Fixed
- Fix missing marker cluster icon.
- Ignore markers without coordinates to prevent uncaught exception caused by invalid coordinates.
## 3.1.0 - 2018-11-01
[Full Changelog](https://github.com/netzmacht/contao-leaflet-maps/compare/3.0.4...3.1.0)
### Added
- Custom route to load map data.
- Add distance filter support for the marker layer (Bounds Mode "fit" has to be enabled).
- Add support for relative css units for map size definition (#59).
- Add hint that zoom level is probably required (#56).
### Deprecated
- Deprecate `Netzmacht\Contao\Leaflet\Frontend\RequestUrl`. Use router to generate request url for layer data.
- Deprecate `Netzmacht\Contao\Leaflet\Frontend\DataController`. Use introduced endpoint to get map data.
### Changed
- Require PHP 7.1.
- Rewritten about page using own route (#48).
### Fixed
- Pressing enter on backend geocode control doesn't submit form anymore.
- Fix broken marker cluster layer (#60).
## [3.0.4] - 2018-10-08
### Fixed
- Fix broken content element attributes (Missing class and custom id).
## [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
- Run composer require checker and solve issues.
## [3.0.1] - 2018-06-20
- Fix broken dynamic bbox related data loading (#57) - Fix broken dynamic bbox related data loading (#57)
3.0.0 (2018-01-05) ## [3.0.0] - 2018-01-05
------------------
[Full Changelog](https://github.com/netzmacht/contao-leaflet-maps/compare/3.0.0-beta1...3.0.0)
- Make hook/dca listener services public - Make hook/dca listener services public
3.0.0-beta1 (2017-11-15) ## [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)
Enhancements Enhancements
@@ -30,15 +173,7 @@ Bugfixes
- Broken service definitions - Broken service definitions
- Broken file layer id - Broken file layer id
3.0.0-alpha2 ## [3.0.0-alpha2] - 2017-10-19
------------
[Full Changelog](https://github.com/netzmacht/contao-leaflet-maps/compare/3.0.0-alpha2...2.0.0-alpha3)
3.0.0-alpha1 (2017-10-19)
------------------------
[Full Changelog](https://github.com/netzmacht/contao-leaflet-maps/compare/3.0.0-alpha1...2.0.0-alpha2)
Implemented enhancements Implemented enhancements
@@ -47,3 +182,21 @@ Implemented enhancements
- New file layer for gpx,kml,wkt,topojson,geojson files added - New file layer for gpx,kml,wkt,topojson,geojson files added
- Bypass filesystem cache in debug mode - Bypass filesystem cache in debug mode
- Changelog added - Changelog added
[Unreleased]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.2.2...hotfix/3.2.3
[3.2.2]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.2.1...3.2.2
[3.2.1]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.2.0...3.2.1
[3.2.0]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.1.7...3.2.0
[3.1.7]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.1.6...3.1.7
[3.1.6]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.1.5...3.1.6
[3.1.5]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.1.4...3.1.5
[3.1.4]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.1.3...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

View File

@@ -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) [![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) [![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.com/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.com/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) [![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. 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. - Autoloading of required assets.
- [Layer for MetaModels](https://github.com/netzmacht/contao-leaflet-metamodels) - [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 Changelog
--------- ---------

View File

@@ -1,4 +0,0 @@
phpcs.standard = ${basedir}/vendor/phpcq/coding-standard/phpcs/PhpCodeQuality/ruleset.xml
phpmd.ruleset = ${basedir}/vendor/phpcq/coding-standard/phpmd/ruleset.xml
phpcs.excluded = src/Bundle/Resources/contao/languages,src/Bundle/Resources/public/js
phpcpd.excluded = contao

View File

@@ -1,5 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="netzmacht/contao-leaflet-maps" default="build">
<!-- import the main build system -->
<import file="vendor/phpcq/phpcq/phpcq.main.xml" />
</project>

View File

@@ -1,13 +1,13 @@
{ {
"name": "netzmacht/contao-leaflet-maps", "name": "netzmacht/contao-leaflet-maps",
"description": "Contao Leaflet maps integration", "description": "Contao Leaflet maps integration",
"license": "LGPL-3.0-or-later",
"type": "contao-bundle",
"keywords": [ "keywords": [
"contao", "contao",
"maps", "maps",
"leaflet" "leaflet"
], ],
"type": "contao-bundle",
"license": "LGPL-3.0-or-later",
"authors": [ "authors": [
{ {
"name": "David Molineus", "name": "David Molineus",
@@ -19,48 +19,73 @@
"support": { "support": {
"email": "mail@netzmacht.de", "email": "mail@netzmacht.de",
"issues": "https://github.com/netzmacht/contao-leaflet-maps/issues", "issues": "https://github.com/netzmacht/contao-leaflet-maps/issues",
"source": "https://github.com/netzmacht/contao-leaflet-maps" "source": "https://github.com/netzmacht/contao-leaflet-maps",
"docs": "http://leaflet-maps-for-contao.readthedocs.org/"
}, },
"require": { "require": {
"php": ">=7.0", "php": "^7.1 || ^8.0",
"contao/core-bundle": "~4.4", "ext-json": "*",
"netzmacht/contao-leaflet-libraries": "^1.0", "ext-pdo": "*",
"contao-community-alliance/meta-palettes": "^2.0",
"contao/core-bundle": "^4.9",
"doctrine/dbal": "^2.11 || ^3.0",
"menatwork/contao-multicolumnwizard-bundle": "^3.4",
"netzmacht/contao-leaflet-geocode-widget": "^1.2", "netzmacht/contao-leaflet-geocode-widget": "^1.2",
"netzmacht/contao-leaflet-libraries": "^1.7.1.1",
"netzmacht/contao-page-context": "~1.0",
"netzmacht/contao-toolkit": "^3.7",
"netzmacht/php-javascript-builder": "^1.0", "netzmacht/php-javascript-builder": "^1.0",
"netzmacht/php-leaflet": "^1.0.2", "netzmacht/php-leaflet": "^1.1.0",
"netzmacht/contao-toolkit": "~3.0", "symfony/cache-contracts": "^1.1 || ^2.0",
"contao-community-alliance/meta-palettes": "^2.0 || ^1.5", "symfony/config": "^4.4 || ^5.1",
"menatwork/contao-multicolumnwizard": "^3.2", "symfony/dependency-injection": "^4.4 || ^5.1",
"doctrine/cache": "^1.0" "symfony/event-dispatcher": "^4.4 || ^5.1",
"symfony/event-dispatcher-contracts": "^1.1 || ^2.0",
"symfony/filesystem": "^4.4 || ^5.1",
"symfony/http-foundation": "^4.4 || ^5.1",
"symfony/http-kernel": "^4.4 || ^5.1",
"symfony/routing": "^4.4 || ^5.1",
"symfony/templating": "^4.4 || ^5.1 || ^6.2",
"symfony/translation-contracts": "^1.1 || ^2.0",
"symfony/twig-bundle": "^4.4 || ^5.1",
"twig/twig": "^2.0 || ^3.0"
}, },
"require-dev": { "require-dev": {
"phpcq/all-tasks": "^1.2", "contao/manager-plugin": "^2.1",
"contao/manager-plugin": "^2.1" "hofff/contao-consent-bridge": "^1.0",
"phpcq/coding-standard": "^2.1",
"phpcq/runner-bootstrap": "^1.0@dev"
},
"conflict": {
"hofff/contao-consent-bridge": "<1.0 || >= 2.0"
}, },
"autoload": { "autoload": {
"psr-4": { "psr-4": {
"Netzmacht\\Contao\\Leaflet\\": "src/" "Netzmacht\\Contao\\Leaflet\\": "src/"
} }
}, },
"autoload-dev": { "config": {
"files": [ "allow-plugins": {
"vendor/phpcq/autoload-validation/hacks/contao-hack.php" "contao-components/installer": true,
] "contao/manager-plugin": true,
"contao-community-alliance/composer-plugin": true,
"php-http/discovery": true
}
}, },
"extra": { "extra": {
"branch-alias": { "branch-alias": {
"dev-master": "3.0.x-dev", "dev-develop": "3.3.x-dev",
"dev-develop": "3.1.x-dev", "dev-master": "3.2.x-dev",
"dev-support/2.x": "2.0.x-dev" "dev-support/2.x": "2.0.x-dev"
}, },
"contao-manager-plugin": "Netzmacht\\Contao\\Leaflet\\Bundle\\ContaoManager\\Plugin",
"contao": { "contao": {
"transifex": { "transifex": {
"project": "contao-leaflet-maps",
"prefix": "core-",
"languages_cto": "src/Bundle/Resources/contao/languages", "languages_cto": "src/Bundle/Resources/contao/languages",
"languages_tx": ".tx" "languages_tx": ".tx",
"prefix": "core-",
"project": "contao-leaflet-maps"
} }
} },
"contao-manager-plugin": "Netzmacht\\Contao\\Leaflet\\Bundle\\ContaoManager\\Plugin"
} }
} }

View File

@@ -1,28 +1,35 @@
var gulp = require('gulp'); const { series, src, watch, dest, parallel, task} = require('gulp');
var del = require('del'); const del = require('promised-del');
var uglify = require('gulp-uglify'); const uglify = require('gulp-uglify');
var concat = require('gulp-concat'); const concat = require('gulp-concat');
var paths = { var paths = {
minified: 'contao-leaflet.js', minified: 'contao-leaflet.js',
scripts: ['js/*.js'], scripts: ['js/vendor/*.js', 'js/*.js'],
dest: 'src/Bundle/Resources/public/js' dest: 'src/Bundle/Resources/public/js'
}; };
gulp.task('clear', function() { function clean () {
del([paths.dest + '/' + paths.minified]); return del([paths.dest + '/' + paths.minified]);
}); }
gulp.task('scripts', ['clear'], function() { function build () {
return gulp.src(paths.scripts) return src(paths.scripts)
.pipe(concat(paths.minified)) .pipe(concat(paths.minified))
.pipe(uglify()) .pipe(uglify())
.pipe(gulp.dest(paths.dest)); .pipe(dest(paths.dest));
}); }
const buildTasks = series(clean, build);
gulp.task('default', ['scripts']); function watchTask () {
watch(
paths.scripts,
buildTasks
)
}
gulp.task('watch', function() { exports.clean = clean;
gulp.watch(paths.scripts, ['scripts']); exports.watch = watchTask;
}); exports.build = buildTasks;
exports.default = buildTasks;

View File

@@ -138,7 +138,8 @@ L.Contao = L.Evented.extend({
* @param customLayer optional custom layer. * @param customLayer optional custom layer.
* @param map Pass a map object so that the data loading events are passed to the map. * @param map Pass a map object so that the data loading events are passed to the map.
*/ */
loadFile: function (url, type, options, customLayer, map) { loadUrl: function (url, type, options, customLayer, map) {
url = this.applyFilterToUrl(url, map);
var layer = omnivore[type](url, options, customLayer); var layer = omnivore[type](url, options, customLayer);
if (map) { if (map) {
@@ -147,7 +148,7 @@ L.Contao = L.Evented.extend({
// Add listener for map bounds changes. // Add listener for map bounds changes.
if (map.options.dynamicLoad && layer.options.boundsMode == 'fit') { if (map.options.dynamicLoad && layer.options.boundsMode == 'fit') {
layer.options.requestHash = hash; layer.options.requestUrl = url;
map.on('moveend', layer.refreshData, layer); map.on('moveend', layer.refreshData, layer);
map.on('layerremove', function(e) { map.on('layerremove', function(e) {
@@ -172,6 +173,19 @@ L.Contao = L.Evented.extend({
return layer; return layer;
}, },
/**
* Load data from an url into a layer using omnivore.
*
* @param url A file url.
* @param type The response content format.
* @param options Parser options
* @param customLayer optional custom layer.
* @param map Pass a map object so that the data loading events are passed to the map.
*/
loadFile: function (url, type, options, customLayer, map) {
return this.loadUrl(url, type, options, customLayer, map);
},
/** /**
* Point to layer callback. Adds a geo json point to the layer. * Point to layer callback. Adds a geo json point to the layer.
* *
@@ -313,6 +327,36 @@ L.Contao = L.Evented.extend({
} }
return value; return value;
},
/**
* Apply the filter to a request url.
*
* @param {string} url The request url.
* @param {L.Map} map The map.
*
* @returns {string}
*/
applyFilterToUrl: function (url, map) {
var value, query, bounds;
if (!map || !map.options.dynamicLoad) {
return url;
}
url = new URL(url);
query = new URLSearchParams(url.search);
bounds = map.getBounds();
value = bounds.getSouth() + ',' + bounds.getWest();
value += ',' + bounds.getNorth() + ',' + bounds.getEast();
query.set('filter', 'bbox');
query.set('values', value);
url.search = query.toString();
return url.toString();
} }
}); });

View File

@@ -29,6 +29,6 @@ L.GeoJSON.include({
}); });
// TODO: Allow other data formats. // TODO: Allow other data formats.
omnivore.geojson(L.contao.createRequestUrl(this.options.requestHash, e.target), null, dataLayer); omnivore.geojson(L.contao.applyFilterToUrl(this.options.requestUrl, e.target), null, dataLayer);
} }
}); });

2848
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@@ -4,10 +4,11 @@
"description": "Leaflet maps for Contao", "description": "Leaflet maps for Contao",
"main": "gulpfile.js", "main": "gulpfile.js",
"dependencies": { "dependencies": {
"del": "^3.0.0", "gulp": "^4.0.2",
"gulp": "^3.9.1", "gulp-cli": "^2.2.0",
"gulp-concat": "^2.6.0", "gulp-concat": "^2.6.1",
"gulp-uglify": "^3.0.0" "gulp-uglify": "^3.0.2",
"promised-del": "^1.0.2"
}, },
"devDependencies": {}, "devDependencies": {},
"scripts": { "scripts": {
@@ -23,7 +24,7 @@
"Maps" "Maps"
], ],
"author": "netzmacht David Molineus", "author": "netzmacht David Molineus",
"license": "LGPL-3.0", "license": "LGPL-3.0-or-later",
"bugs": { "bugs": {
"url": "https://github.com/netzmacht/contao-leaflet-maps/issues" "url": "https://github.com/netzmacht/contao-leaflet-maps/issues"
}, },

98
phpcq.yaml.dist Normal file
View File

@@ -0,0 +1,98 @@
phpcq:
repositories:
- https://phpcq.github.io/repository/repository.json
directories:
- src
plugins:
composer-require-checker:
version: ^1.0
signed: false
phpmd:
version: ^1.0
signed: false
requirements:
phpmd:
signed: false
phpcpd:
version: ^1.1
signed: false
phploc:
version: ^1.0
signed: false
phpcs:
version: ^1.0
signed: false
composer-normalize:
version: ^1.0
signed: false
trusted-keys:
# composer require checker
- 033E5F8D801A2F8D
# sb@sebastian-bergmann.de
- 4AA394086372C20A
# magl@magll.net
- D2CCAC42F6295E7D
# PHP_CodeSniffer
- 31C7E470E2138192
# Composer normalize
- C00543248C87FB13
# phpmd
- A4E55EA12C7C085C
tasks:
fix:
- composer-normalize-fix
- phpcbf
verify:
- composer-require-checker
- composer-normalize
analyze:
- phploc
- phpcpd
- phpmd
- phpcs
default:
- verify
- analyze
phpcpd:
plugin: phpcpd
phpmd:
config:
ruleset:
- vendor/phpcq/coding-standard/phpmd/ruleset.xml
composer-normalize:
config:
ignore_output:
- '#Root package is not of type "project", we will not installing Contao extensions\.#'
composer-require-checker:
plugin: composer-require-checker
config:
config_file: '.composer-require-checker.json'
phpcs:
plugin: phpcs
config: &phpcs-config
standard: ~
excluded:
- src/Bundle/Resources/contao/languages
- src/Bundle/Resources/public/js
phpcbf:
plugin: phpcs
config:
<<: *phpcs-config
fix: true
composer-normalize-fix:
plugin: composer-normalize
config:
dry_run: false

4
phpcs.xml.dist Normal file
View File

@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<ruleset name="ContaoToolkit">
<rule ref="vendor/phpcq/coding-standard/phpcs/PhpCodeQuality/ruleset.xml" />
</ruleset>

View File

@@ -5,35 +5,66 @@
* *
* @package contao-leaflet-maps * @package contao-leaflet-maps
* @author David Molineus <david.molineus@netzmacht.de> * @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2014-2017 netzmacht David Molineus. All rights reserved. * @copyright 2014-2019 netzmacht David Molineus. All rights reserved.
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE * @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
* @filesource * @filesource
*/ */
namespace Netzmacht\Contao\Leaflet\Backend; namespace Netzmacht\Contao\Leaflet\Backend\Action;
use Symfony\Component\HttpFoundation\Response;
use Twig\Environment;
/** /**
* Credits backend module. * Credits backend module.
* *
* @package Netzmacht\Contao\Leaflet\Backend * @package Netzmacht\Contao\Leaflet\Backend
*/ */
class About final class AboutAction
{ {
/**
* Twig environment.
*
* @var Environment
*/
private $twig;
/**
* Project directory.
*
* @var string
*/
private $projectDir;
/**
* AboutAction constructor.
*
* @param Environment $twig Twig environment.
* @param string $projectDir Project directory.
*/
public function __construct(Environment $twig, string $projectDir)
{
$this->twig = $twig;
$this->projectDir = $projectDir;
}
/** /**
* Generate the backend view. * Generate the backend view.
* *
* @return string * @return string
*/ */
public function generate() public function __invoke(): Response
{ {
$template = new \BackendTemplate('be_leaflet_about'); $data = [
'headline' => 'Leaftlet maps integration for Contao CMS',
'libraries' => $this->getLibraries(),
];
$template->headline = 'Leaftlet maps integration for Contao CMS'; [$data['version'], $data['dependencies']] = $this->extractFromComposer();
$template->libraries = $this->getLibraries();
list($template->version, $template->dependencies) = $this->extractFromComposer(); return new Response(
$this->twig->render('@NetzmachtContaoLeaflet/backend/about.html.twig', $data)
return $template->parse(); );
} }
/** /**
@@ -43,7 +74,7 @@ class About
* *
* @SuppressWarnings(PHPMD.Superglobals) * @SuppressWarnings(PHPMD.Superglobals)
*/ */
private function getLibraries() private function getLibraries(): array
{ {
return array_map( return array_map(
function ($library) { function ($library) {
@@ -57,9 +88,8 @@ class About
if ($library['homepage']) { if ($library['homepage']) {
$library['homepage'] = sprintf( $library['homepage'] = sprintf(
'<a href="%s" %s>%s</a>', '<a href="%s" target="_blank">%s</a>',
$library['homepage'], $library['homepage'],
LINK_NEW_WINDOW,
preg_replace('#^(https?://(www)?)#i', '', $library['homepage']) preg_replace('#^(https?://(www)?)#i', '', $library['homepage'])
); );
} }
@@ -69,7 +99,7 @@ class About
array_filter( array_filter(
$GLOBALS['LEAFLET_LIBRARIES'], $GLOBALS['LEAFLET_LIBRARIES'],
function ($library) { function ($library) {
return isset($library['name']) && isset($library['license']); return isset($library['name'], $library['license']);
} }
) )
); );
@@ -80,10 +110,10 @@ class About
* *
* @return array * @return array
*/ */
private function extractFromComposer() private function extractFromComposer(): array
{ {
$extFile = TL_ROOT . '/vendor/netzmacht/contao-leaflet-maps/composer.json'; $extFile = $this->projectDir . '/vendor/netzmacht/contao-leaflet-maps/composer.json';
$lockFile = TL_ROOT . '/composer.lock'; $lockFile = $this->projectDir . '/composer.lock';
if (!file_exists($extFile) || !file_exists($lockFile)) { if (!file_exists($extFile) || !file_exists($lockFile)) {
return []; return [];

View File

@@ -14,7 +14,7 @@ declare(strict_types=1);
namespace Netzmacht\Contao\Leaflet\Backend\Renderer\Label\Layer; namespace Netzmacht\Contao\Leaflet\Backend\Renderer\Label\Layer;
use Symfony\Component\Translation\TranslatorInterface as Translator; use Symfony\Contracts\Translation\TranslatorInterface as Translator;
/** /**
* Class ChainRenderer. * Class ChainRenderer.

View File

@@ -16,7 +16,7 @@ namespace Netzmacht\Contao\Leaflet\Backend\Renderer\Label\Layer;
use Contao\FilesModel; use Contao\FilesModel;
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager; use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
use Symfony\Component\Translation\TranslatorInterface as Translator; use Symfony\Contracts\Translation\TranslatorInterface as Translator;
/** /**
* Class FileLabelRenderer * Class FileLabelRenderer

View File

@@ -14,7 +14,7 @@ declare(strict_types=1);
namespace Netzmacht\Contao\Leaflet\Backend\Renderer\Label\Layer; namespace Netzmacht\Contao\Leaflet\Backend\Renderer\Label\Layer;
use Symfony\Component\Translation\TranslatorInterface as Translator; use Symfony\Contracts\Translation\TranslatorInterface as Translator;
/** /**
* Interface LayerLabelRenderer. * Interface LayerLabelRenderer.

View File

@@ -16,7 +16,7 @@ namespace Netzmacht\Contao\Leaflet\Backend\Renderer\Label\Layer;
use Netzmacht\Contao\Leaflet\Model\MarkerModel; use Netzmacht\Contao\Leaflet\Model\MarkerModel;
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager; use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
use Symfony\Component\Translation\TranslatorInterface as Translator; use Symfony\Contracts\Translation\TranslatorInterface as Translator;
/** /**
* Class MarkersLabelRenderer. * Class MarkersLabelRenderer.

View File

@@ -15,7 +15,7 @@ declare(strict_types=1);
namespace Netzmacht\Contao\Leaflet\Backend\Renderer\Label\Layer; namespace Netzmacht\Contao\Leaflet\Backend\Renderer\Label\Layer;
use Contao\StringUtil; use Contao\StringUtil;
use Symfony\Component\Translation\TranslatorInterface as Translator; use Symfony\Contracts\Translation\TranslatorInterface as Translator;
/** /**
* Class OverpassLabelRenderer. * Class OverpassLabelRenderer.

View File

@@ -14,7 +14,7 @@ declare(strict_types=1);
namespace Netzmacht\Contao\Leaflet\Backend\Renderer\Label\Layer; namespace Netzmacht\Contao\Leaflet\Backend\Renderer\Label\Layer;
use Symfony\Component\Translation\TranslatorInterface as Translator; use Symfony\Contracts\Translation\TranslatorInterface as Translator;
/** /**
* Backend label renderer for provider layer. * Backend label renderer for provider layer.

View File

@@ -16,7 +16,7 @@ namespace Netzmacht\Contao\Leaflet\Backend\Renderer\Label\Layer;
use Netzmacht\Contao\Leaflet\Model\LayerModel; use Netzmacht\Contao\Leaflet\Model\LayerModel;
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager; use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
use Symfony\Component\Translation\TranslatorInterface as Translator; use Symfony\Contracts\Translation\TranslatorInterface as Translator;
/** /**
* Class ReferenceLabelRenderer. * Class ReferenceLabelRenderer.

View File

@@ -16,7 +16,7 @@ namespace Netzmacht\Contao\Leaflet\Backend\Renderer\Label\Layer;
use Netzmacht\Contao\Leaflet\Model\VectorModel; use Netzmacht\Contao\Leaflet\Model\VectorModel;
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager; use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
use Symfony\Component\Translation\TranslatorInterface as Translator; use Symfony\Contracts\Translation\TranslatorInterface as Translator;
/** /**
* Class VectorsLabelRenderer. * Class VectorsLabelRenderer.

View File

@@ -0,0 +1,37 @@
<?php
/**
* Leaflet maps for Contao CMS.
*
* @package contao-leaflet-maps
* @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2014-2017 netzmacht David Molineus. All rights reserved.
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
* @filesource
*/
declare(strict_types=1);
namespace Netzmacht\Contao\Leaflet\Bundle\ConsentBridge;
use Hofff\Contao\Consent\Bridge\Bridge;
use Hofff\Contao\Consent\Bridge\Plugin as ConsentBridgePlugin;
use Hofff\Contao\Consent\Bridge\Render\RenderInformation;
/**
* Consent Bridge plugin for leaflet.
*/
final class Plugin implements ConsentBridgePlugin
{
/**
* {@inheritDoc}
*/
public function load(Bridge $bridge): void
{
$renderInformation = RenderInformation::autoRenderWithPlaceholder('leaflet_consent_bridge_placeholder');
$bridge
->supportContentElement('leaflet', $renderInformation)
->supportFrontendModule('leaflet', $renderInformation);
}
}

View File

@@ -18,15 +18,20 @@ use Contao\CoreBundle\ContaoCoreBundle;
use Contao\ManagerPlugin\Bundle\BundlePluginInterface; use Contao\ManagerPlugin\Bundle\BundlePluginInterface;
use Contao\ManagerPlugin\Bundle\Config\BundleConfig; use Contao\ManagerPlugin\Bundle\Config\BundleConfig;
use Contao\ManagerPlugin\Bundle\Parser\ParserInterface; use Contao\ManagerPlugin\Bundle\Parser\ParserInterface;
use Contao\ManagerPlugin\Routing\RoutingPluginInterface;
use Netzmacht\Contao\Leaflet\Bundle\NetzmachtContaoLeafletBundle; use Netzmacht\Contao\Leaflet\Bundle\NetzmachtContaoLeafletBundle;
use Netzmacht\Contao\PageContext\NetzmachtContaoPageContextBundle;
use Netzmacht\Contao\Toolkit\Bundle\NetzmachtContaoToolkitBundle; use Netzmacht\Contao\Toolkit\Bundle\NetzmachtContaoToolkitBundle;
use Symfony\Component\Config\Loader\LoaderResolverInterface;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\Routing\RouteCollection;
/** /**
* Contao manager plugin. * Contao manager plugin.
* *
* @package Netzmacht\Contao\Leaflet\ContaoManager * @package Netzmacht\Contao\Leaflet\ContaoManager
*/ */
class Plugin implements BundlePluginInterface class Plugin implements BundlePluginInterface, RoutingPluginInterface
{ {
/** /**
* {@inheritdoc} * {@inheritdoc}
@@ -35,8 +40,28 @@ class Plugin implements BundlePluginInterface
{ {
return [ return [
BundleConfig::create(NetzmachtContaoLeafletBundle::class) BundleConfig::create(NetzmachtContaoLeafletBundle::class)
->setLoadAfter([ContaoCoreBundle::class, NetzmachtContaoToolkitBundle::class]) ->setLoadAfter(
[
ContaoCoreBundle::class,
NetzmachtContaoToolkitBundle::class,
NetzmachtContaoPageContextBundle::class,
'leaflet-libs',
]
)
->setReplace(['leaflet']), ->setReplace(['leaflet']),
]; ];
} }
/**
* {@inheritdoc}
*/
public function getRouteCollection(LoaderResolverInterface $resolver, KernelInterface $kernel): ?RouteCollection
{
$loader = $resolver->resolve(__DIR__ . '/../Resources/config/routing.yml');
if (!$loader) {
return null;
}
return $loader->load(__DIR__ . '/../Resources/config/routing.yml');
}
} }

View File

@@ -18,6 +18,8 @@ use Netzmacht\LeafletPHP\Assets;
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\ContainerBuilder;
use function array_pad;
/** /**
* Class RegisterLibrariesPass. * Class RegisterLibrariesPass.
* *
@@ -43,12 +45,12 @@ class RegisterLibrariesPass implements CompilerPassInterface
foreach ($libraries as $name => $assets) { foreach ($libraries as $name => $assets) {
if (!empty($assets['css'])) { if (!empty($assets['css'])) {
list ($source, $type) = (array) $assets['css']; [$source, $type] = array_pad((array) $assets['css'], 2, null);
$definition->addMethodCall('registerStylesheet', [$name, $source, $type ?: Assets::TYPE_FILE]); $definition->addMethodCall('registerStylesheet', [$name, $source, $type ?: Assets::TYPE_FILE]);
} }
if (!empty($assets['javascript'])) { if (!empty($assets['javascript'])) {
list ($source, $type) = (array) $assets['javascript']; [$source, $type] = array_pad((array) $assets['javascript'], 2, null);
$definition->addMethodCall('registerJavascript', [$name, $source, $type ?: Assets::TYPE_FILE]); $definition->addMethodCall('registerJavascript', [$name, $source, $type ?: Assets::TYPE_FILE]);
} }
} }

View File

@@ -32,7 +32,7 @@ parameters:
markercluster: markercluster:
children: true children: true
icon: 'bundles/netzmachtcontaoleaflet/img/markercluster.png' icon: 'bundles/netzmachtcontaoleaflet/img/cluster.png'
tile: tile:
children: false children: false

View File

@@ -4,7 +4,7 @@ services:
public: true public: true
arguments: arguments:
- '@netzmacht.contao_toolkit.repository_manager' - '@netzmacht.contao_toolkit.repository_manager'
- '@templating' - '@netzmacht.contao_toolkit.template_renderer'
- '@filesystem' - '@filesystem'
- '@netzmacht.contao_toolkit.contao.system_adapter' - '@netzmacht.contao_toolkit.contao.system_adapter'
- '%netzmacht.contao_leaflet.cache_dir%' - '%netzmacht.contao_leaflet.cache_dir%'
@@ -30,6 +30,8 @@ services:
- '@netzmacht.contao_toolkit.dca.manager' - '@netzmacht.contao_toolkit.dca.manager'
- '@database_connection' - '@database_connection'
- '@netzmacht.contao_toolkit.repository_manager' - '@netzmacht.contao_toolkit.repository_manager'
- '@translator'
- '@session'
netzmacht.contao_leaflet.listeners.dca.control: netzmacht.contao_leaflet.listeners.dca.control:
class: Netzmacht\Contao\Leaflet\Listener\Dca\ControlDcaListener class: Netzmacht\Contao\Leaflet\Listener\Dca\ControlDcaListener
@@ -113,3 +115,13 @@ services:
- '@netzmacht.contao_leaflet.definition.builder' - '@netzmacht.contao_leaflet.definition.builder'
tags: tags:
- { name: 'contao.hook', hook: 'initializeSystem', method: 'onInitializeSystem' } - { name: 'contao.hook', hook: 'initializeSystem', method: 'onInitializeSystem' }
netzmacht.contao_leaflet.listeners.backend_menu:
class: Netzmacht\Contao\Leaflet\Listener\Backend\UserNavigationListener
arguments:
- '@request_stack'
- '@router'
- '@translator'
- '@netzmacht.contao_toolkit.assets_manager'
tags:
- { name: 'contao.hook', hook: 'getUserNavigation', method: '__invoke'}

View File

@@ -32,6 +32,7 @@ services:
class: Netzmacht\Contao\Leaflet\Mapper\Layer\MarkersLayerMapper class: Netzmacht\Contao\Leaflet\Mapper\Layer\MarkersLayerMapper
arguments: arguments:
- '@netzmacht.contao_toolkit.repository_manager' - '@netzmacht.contao_toolkit.repository_manager'
- '@router'
tags: tags:
- { name: netzmacht.contao_leaflet.mapper } - { name: netzmacht.contao_leaflet.mapper }
@@ -46,6 +47,7 @@ services:
class: Netzmacht\Contao\Leaflet\Mapper\Layer\VectorsLayerMapper class: Netzmacht\Contao\Leaflet\Mapper\Layer\VectorsLayerMapper
arguments: arguments:
- '@netzmacht.contao_toolkit.repository_manager' - '@netzmacht.contao_toolkit.repository_manager'
- '@router'
tags: tags:
- { name: netzmacht.contao_leaflet.mapper } - { name: netzmacht.contao_leaflet.mapper }
@@ -69,12 +71,13 @@ services:
- '@netzmacht.contao_leaflet.map.assets' - '@netzmacht.contao_leaflet.map.assets'
- '@netzmacht.contao_toolkit.repository_manager' - '@netzmacht.contao_toolkit.repository_manager'
tags: tags:
- { name: netzmacht.contao_leflet_maps.mapper } - { name: netzmacht.contao_leaflet.mapper }
netzmacht.contao_leaflet.mapper.file_layer: netzmacht.contao_leaflet.mapper.file_layer:
class: Netzmacht\Contao\Leaflet\Mapper\Layer\FileLayerMapper class: Netzmacht\Contao\Leaflet\Mapper\Layer\FileLayerMapper
arguments: arguments:
- '@netzmacht.contao_toolkit.repository_manager' - '@netzmacht.contao_toolkit.repository_manager'
- '@netzmacht.contao_toolkit.contao.environment_adapter'
tags: tags:
- { name: netzmacht.contao_leaflet.mapper } - { name: netzmacht.contao_leaflet.mapper }

View File

@@ -1,13 +1,25 @@
parameters: parameters:
netzmacht.contao_leaflet.providers: netzmacht.contao_leaflet.providers:
OpenStreetMap: OpenStreetMap:
variants: ['Mapnik', 'BlackAndWhite', 'DE', 'France', 'HOT', 'BZH'] variants: ['Mapnik', 'DE', 'CH', 'France', 'HOT', 'BZH']
OpenSeaMap: [] OpenSeaMap: []
OPNVKarte: []
OpenTopoMap: [] OpenTopoMap: []
OpenRailwayMap: []
OpenFireMap: []
SafeCast: []
Stadia:
variants: ['AlidadeSmooth', 'AlidadeSmoothDark', 'OSMBright', 'Outdoors']
Thunderforest: Thunderforest:
class: 'Netzmacht\LeafletPHP\Plugins\LeafletProviders\ThunderforestProvider'
variants: variants:
- 'OpenCycleMap' - 'OpenCycleMap'
- 'Transport' - 'Transport'
@@ -16,9 +28,13 @@ parameters:
- 'Landscape' - 'Landscape'
- 'Outdoors' - 'Outdoors'
- 'Pioneer' - 'Pioneer'
- 'MobileAtlas'
- 'Neighbourhood'
options:
apiKey: 'tile_provider_key'
fields: ['tile_provider_key']
OpenMapSurfer: CyclOSM: []
variants: ['Roads', 'AdminBounds', 'Grayscale']
Hydda: Hydda:
variants: ['Full', 'Base', 'RoadsAndLabels'] variants: ['Full', 'Base', 'RoadsAndLabels']
@@ -26,7 +42,10 @@ parameters:
MapBox: MapBox:
class: 'Netzmacht\LeafletPHP\Plugins\LeafletProviders\MapBoxProvider' class: 'Netzmacht\LeafletPHP\Plugins\LeafletProviders\MapBoxProvider'
options: options:
key: 'tile_provider_key' accessToken: 'tile_provider_key'
fields: ['tile_provider_key']
MapTiler: []
Stamen: Stamen:
variants: variants:
@@ -56,6 +75,7 @@ parameters:
- 'WorldGrayCanvas' - 'WorldGrayCanvas'
OpenWeatherMap: OpenWeatherMap:
class: 'Netzmacht\LeafletPHP\Plugins\LeafletProviders\OpenWeatherMapProvider'
variants: variants:
- 'Clouds' - 'Clouds'
- 'CloudsClassic' - 'CloudsClassic'
@@ -68,6 +88,9 @@ parameters:
- 'Wind' - 'Wind'
- 'Temperature' - 'Temperature'
- 'Snow' - 'Snow'
options:
apiKey: 'tile_provider_key'
fields: ['tile_provider_key']
HERE: HERE:
class: 'Netzmacht\LeafletPHP\Plugins\LeafletProviders\HereProvider' class: 'Netzmacht\LeafletPHP\Plugins\LeafletProviders\HereProvider'
@@ -83,12 +106,19 @@ parameters:
- 'normalNightMobile' - 'normalNightMobile'
- 'normalNightGrey' - 'normalNightGrey'
- 'normalNightGreyMobile' - 'normalNightGreyMobile'
- 'normalNightTransit'
- 'normalNightTransitMobile'
- 'reducedDay'
- 'reducedNight'
- 'basicMap' - 'basicMap'
- 'mapLabels' - 'mapLabels'
- 'trafficFlow' - 'trafficFlow'
- 'carnavDayGrey' - 'carnavDayGrey'
- 'hybridDay' - 'hybridDay'
- 'hybridDayMobile' - 'hybridDayMobile'
- 'hybridDayTransit'
- 'hybridDayGrey'
- 'hybridDayTraffic'
- 'pedestrianDay' - 'pedestrianDay'
- 'pedestrianNight' - 'pedestrianNight'
- 'satelliteDay' - 'satelliteDay'
@@ -123,6 +153,10 @@ parameters:
- 'DarkMatter' - 'DarkMatter'
- 'DarkMatterNoLabels' - 'DarkMatterNoLabels'
- 'DarkMatterOnlyLabels' - 'DarkMatterOnlyLabels'
- 'Voyager'
- 'VoyagerNoLabels'
- 'VoyagerOnlyLabels'
- 'VoyagerLabelsUnder'
HikeBike: HikeBike:
variants: variants:
@@ -155,3 +189,20 @@ parameters:
- 'ModisTerraChlorophyll' - 'ModisTerraChlorophyll'
NLS: [] NLS: []
Wikimedia: []
GeoportailFrance:
variants:
- 'parcels'
- 'ignMaps'
- 'maps'
- 'orthos'
OneMapSG:
variants:
- 'Default'
- 'Night'
- 'Original'
- 'Grey'
- 'LandLot'

View File

@@ -0,0 +1,18 @@
leaflet_layer:
path: /leaflet/api/layer/{layerId}
controller: Netzmacht\Contao\Leaflet\Frontend\Action\LayerDataAction
defaults:
_leaflet_scope: page
_format: geojson
_scope: frontend
requirements:
_format: geojson
context: \w+
contextId: \d+
leaflet_backend_about:
path: /contao/leaflet/about
controller: Netzmacht\Contao\Leaflet\Backend\Action\AboutAction
defaults:
_scope: backend
_backend_module: leaflet_about

View File

@@ -16,7 +16,7 @@ services:
- '@netzmacht.contao_leaflet.cache' - '@netzmacht.contao_leaflet.cache'
- '@netzmacht.contao_leaflet.frontend.data_controller' - '@netzmacht.contao_leaflet.frontend.data_controller'
- '@netzmacht.contao_toolkit.repository_manager' - '@netzmacht.contao_toolkit.repository_manager'
- '@templating' - '@netzmacht.contao_toolkit.template_renderer'
netzmacht.contao_leaflet.libraries: netzmacht.contao_leaflet.libraries:
class: Netzmacht\Contao\Leaflet\Frontend\Assets\LibrariesConfiguration class: Netzmacht\Contao\Leaflet\Frontend\Assets\LibrariesConfiguration
@@ -29,12 +29,14 @@ services:
- '%netzmacht.contao_leaflet.filters%' - '%netzmacht.contao_leaflet.filters%'
netzmacht.contao_leaflet.cache.default: netzmacht.contao_leaflet.cache.default:
class: Doctrine\Common\Cache\FilesystemCache class: Symfony\Component\Cache\Adapter\FilesystemAdapter
arguments: arguments:
- 'netzmacht.contao_leaflet'
- 0
- '%netzmacht.contao_leaflet.cache_dir%' - '%netzmacht.contao_leaflet.cache_dir%'
netzmacht.contao_leaflet.cache.debug: netzmacht.contao_leaflet.cache.debug:
class: Doctrine\Common\Cache\ArrayCache class: Symfony\Component\Cache\Adapter\ArrayAdapter
netzmacht.contao_leaflet.frontend.value_filter: netzmacht.contao_leaflet.frontend.value_filter:
class: Netzmacht\Contao\Leaflet\Frontend\ValueFilter class: Netzmacht\Contao\Leaflet\Frontend\ValueFilter
@@ -74,11 +76,13 @@ services:
netzmacht.contao_leaflet.definition.alias_generator.factory_default: netzmacht.contao_leaflet.definition.alias_generator.factory_default:
class: Netzmacht\Contao\Leaflet\Alias\DefaultAliasGeneratorFactory class: Netzmacht\Contao\Leaflet\Alias\DefaultAliasGeneratorFactory
public: true
arguments: arguments:
- '@database_connection' - '@database_connection'
netzmacht.contao_leaflet.definition.alias_generator.factory_parent: netzmacht.contao_leaflet.definition.alias_generator.factory_parent:
class: Netzmacht\Contao\Leaflet\Alias\ParentAliasGeneratorFactory class: Netzmacht\Contao\Leaflet\Alias\ParentAliasGeneratorFactory
public: true
arguments: arguments:
- '@database_connection' - '@database_connection'
@@ -120,3 +124,23 @@ services:
arguments: arguments:
- '@netzmacht.contao_leaflet.filter_factory' - '@netzmacht.contao_leaflet.filter_factory'
- '%kernel.debug%' - '%kernel.debug%'
Netzmacht\Contao\Leaflet\Frontend\PageIdDeterminator:
tags:
- { name: Netzmacht\Contao\PageContext\Request\PageIdDeterminator }
Netzmacht\Contao\Leaflet\Frontend\Action\LayerDataAction:
public: true
arguments:
- '@netzmacht.contao_leaflet.map.provider'
- '@netzmacht.contao_leaflet.filter_factory'
Netzmacht\Contao\Leaflet\Backend\Action\AboutAction:
public: true
arguments:
- '@twig'
- '%kernel.project_dir%'
Netzmacht\Contao\Leaflet\Bundle\ConsentBridge\Plugin:
tags:
- { name: hofff_contao_consent_bridge.plugin }

View File

@@ -40,16 +40,11 @@ array_insert(
'stylesheet' => 'bundles/netzmachtcontaoleaflet/css/backend.css', 'stylesheet' => 'bundles/netzmachtcontaoleaflet/css/backend.css',
'javascript' => 'bundles/netzmachtcontaoleaflet/js/backend.js', 'javascript' => 'bundles/netzmachtcontaoleaflet/js/backend.js',
], ],
'leaflet_about' => [
'callback' => Netzmacht\Contao\Leaflet\Backend\About::class,
'icon' => 'bundles/netzmachtcontaoleaflet/img/about.png',
'stylesheet' => 'bundles/netzmachtcontaoleaflet/css/about.css',
],
], ],
] ]
); );
if (TL_MODE === 'BE') { if (defined('TL_MODE') && TL_MODE === 'BE') {
$GLOBALS['TL_CSS'][] = 'bundles/netzmachtcontaoleaflet/css/backend_global.css'; $GLOBALS['TL_CSS'][] = 'bundles/netzmachtcontaoleaflet/css/backend_global.css';
} }

View File

@@ -5,6 +5,7 @@
* *
* @package contao-leaflet-maps * @package contao-leaflet-maps
* @author David Molineus <david.molineus@netzmacht.de> * @author David Molineus <david.molineus@netzmacht.de>
* @author Fritz Michael Gschwantner <fmg@inspiredminds.at>
* @copyright 2014-2017 netzmacht David Molineus. All rights reserved. * @copyright 2014-2017 netzmacht David Molineus. All rights reserved.
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE * @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
* @filesource * @filesource
@@ -13,7 +14,7 @@
$GLOBALS['TL_DCA']['tl_content']['metapalettes']['leaflet'] = [ $GLOBALS['TL_DCA']['tl_content']['metapalettes']['leaflet'] = [
'type' => ['type', 'headline'], 'type' => ['type', 'headline'],
'leaflet' => ['leaflet_map', 'leaflet_mapId', 'leaflet_width', 'leaflet_height'], 'leaflet' => ['leaflet_map', 'leaflet_mapId', 'leaflet_width', 'leaflet_height'],
'templates' => [':hide', 'customTpl', 'leaflet_template'], 'template' => [':hide', 'customTpl', 'leaflet_template'],
'protected' => [':hide', 'protected'], 'protected' => [':hide', 'protected'],
'expert' => [':hide', 'guests', 'cssID', 'space'], 'expert' => [':hide', 'guests', 'cssID', 'space'],
'invisible' => [':hide', 'invisible', 'start', 'start'], 'invisible' => [':hide', 'invisible', 'start', 'start'],
@@ -49,7 +50,7 @@ $GLOBALS['TL_DCA']['tl_content']['fields']['leaflet_mapId'] = [
$GLOBALS['TL_DCA']['tl_content']['fields']['leaflet_width'] = [ $GLOBALS['TL_DCA']['tl_content']['fields']['leaflet_width'] = [
'label' => &$GLOBALS['TL_LANG']['tl_content']['leaflet_width'], 'label' => &$GLOBALS['TL_LANG']['tl_content']['leaflet_width'],
'inputType' => 'inputUnit', 'inputType' => 'inputUnit',
'options' => ['px', '%', 'em', 'pt', 'pc', 'in', 'cm', 'mm'], 'options' => $GLOBALS['TL_CSS_UNITS'],
'search' => false, 'search' => false,
'exclude' => true, 'exclude' => true,
'eval' => ['rgxp' => 'digit', 'tl_class' => 'clr w50'], 'eval' => ['rgxp' => 'digit', 'tl_class' => 'clr w50'],
@@ -60,7 +61,7 @@ $GLOBALS['TL_DCA']['tl_content']['fields']['leaflet_width'] = [
$GLOBALS['TL_DCA']['tl_content']['fields']['leaflet_height'] = [ $GLOBALS['TL_DCA']['tl_content']['fields']['leaflet_height'] = [
'label' => &$GLOBALS['TL_LANG']['tl_content']['leaflet_height'], 'label' => &$GLOBALS['TL_LANG']['tl_content']['leaflet_height'],
'inputType' => 'inputUnit', 'inputType' => 'inputUnit',
'options' => ['px', '%', 'em', 'pt', 'pc', 'in', 'cm', 'mm'], 'options' => $GLOBALS['TL_CSS_UNITS'],
'search' => false, 'search' => false,
'exclude' => true, 'exclude' => true,
'eval' => ['rgxp' => 'digit', 'tl_class' => 'w50'], 'eval' => ['rgxp' => 'digit', 'tl_class' => 'w50'],

View File

@@ -5,7 +5,8 @@
* *
* @package contao-leaflet-maps * @package contao-leaflet-maps
* @author David Molineus <david.molineus@netzmacht.de> * @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2014-2017 netzmacht David Molineus. All rights reserved. * @author Sven Baumann <baumann.sv@gmail.com>
* @copyright 2014-2022 netzmacht David Molineus. All rights reserved.
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE * @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
* @filesource * @filesource
*/ */
@@ -67,7 +68,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_control'] = [
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['delete'], 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['delete'],
'href' => 'act=delete', 'href' => 'act=delete',
'icon' => 'delete.gif', 'icon' => 'delete.gif',
'attributes' => 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] 'attributes' => 'onclick="if(!confirm(\'' . ($GLOBALS['TL_LANG']['MSC']['deleteConfirm'] ?? '')
. '\'))return false;Backend.getScrollOffset()"', . '\'))return false;Backend.getScrollOffset()"',
], ],
'toggle' => [ 'toggle' => [
@@ -164,6 +165,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_control'] = [
'maxlength' => 255, 'maxlength' => 255,
'tl_class' => 'w50', 'tl_class' => 'w50',
'nullIfEmpty' => true, 'nullIfEmpty' => true,
'doNotCopy' => true,
], ],
'toolkit' => [ 'toolkit' => [
'alias_generator' => [ 'alias_generator' => [

View File

@@ -5,7 +5,8 @@
* *
* @package contao-leaflet-maps * @package contao-leaflet-maps
* @author David Molineus <david.molineus@netzmacht.de> * @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2014-2017 netzmacht David Molineus. All rights reserved. * @author Sven Baumann <baumann.sv@gmail.com>
* @copyright 2014-2022 netzmacht David Molineus. All rights reserved.
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE * @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
* @filesource * @filesource
*/ */
@@ -78,7 +79,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_icon'] = [
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_icon']['delete'], 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_icon']['delete'],
'href' => 'act=delete', 'href' => 'act=delete',
'icon' => 'delete.gif', 'icon' => 'delete.gif',
'attributes' => 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] 'attributes' => 'onclick="if(!confirm(\'' . ($GLOBALS['TL_LANG']['MSC']['deleteConfirm'] ?? '')
. '\'))return false;Backend.getScrollOffset()"', . '\'))return false;Backend.getScrollOffset()"',
], ],
'toggle' => [ 'toggle' => [
@@ -179,7 +180,14 @@ $GLOBALS['TL_DCA']['tl_leaflet_icon'] = [
['netzmacht.contao_toolkit.dca.listeners.alias_generator', 'handleSaveCallback'], ['netzmacht.contao_toolkit.dca.listeners.alias_generator', 'handleSaveCallback'],
['netzmacht.contao_leaflet.listeners.dca.validator', 'validateAlias'], ['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' => [ 'toolkit' => [
'alias_generator' => [ 'alias_generator' => [
'factory' => 'netzmacht.contao_leaflet.definition.alias_generator.factory_default', 'factory' => 'netzmacht.contao_leaflet.definition.alias_generator.factory_default',

View File

@@ -5,11 +5,14 @@
* *
* @package contao-leaflet-maps * @package contao-leaflet-maps
* @author David Molineus <david.molineus@netzmacht.de> * @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2014-2017 netzmacht David Molineus. All rights reserved. * @author Sven Baumann <baumann.sv@gmail.com>
* @copyright 2014-2022 netzmacht David Molineus. All rights reserved.
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE * @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
* @filesource * @filesource
*/ */
\Contao\Controller::loadLanguageFile('leaflet');
$GLOBALS['TL_DCA']['tl_leaflet_layer'] = [ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = [
'config' => [ 'config' => [
'dataContainer' => 'Table', 'dataContainer' => 'Table',
@@ -71,6 +74,11 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = [
'class' => 'header_edit_all', 'class' => 'header_edit_all',
'attributes' => 'onclick="Backend.getScrollOffset();"', 'attributes' => 'onclick="Backend.getScrollOffset();"',
], ],
'toggleNodes' => [
'href' => 'ptg=all',
'class' => 'header_toggle',
'showOnSelect' => true,
],
], ],
'operations' => [ 'operations' => [
'markers' => [ 'markers' => [
@@ -105,7 +113,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = [
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['delete'], 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['delete'],
'href' => 'act=delete', 'href' => 'act=delete',
'icon' => 'delete.gif', 'icon' => 'delete.gif',
'attributes' => 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] 'attributes' => 'onclick="if(!confirm(\'' . ($GLOBALS['TL_LANG']['MSC']['deleteConfirm'] ?? '')
. '\'))return false;Backend.getScrollOffset()"', . '\'))return false;Backend.getScrollOffset()"',
], ],
'toggle' => [ 'toggle' => [
@@ -232,12 +240,14 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = [
'provider' => ['tile_provider', 'tile_provider_variant'], 'provider' => ['tile_provider', 'tile_provider_variant'],
], ],
'tile_provider' => [ 'tile_provider' => [
'MapBox' => ['tile_provider_key'], 'MapBox' => ['tile_provider_key'],
'HERE' => ['tile_provider_key', 'tile_provider_code'], 'HERE' => ['tile_provider_key', 'tile_provider_code'],
'OpenWeatherMap' => ['tile_provider_key'],
'Thunderforest' => ['tile_provider_key'],
],
'fileFormat' => [
'!' => ['file'],
], ],
'fileFormat' => [
'!' => ['file']
]
], ],
'metasubpalettes' => [ 'metasubpalettes' => [
@@ -276,7 +286,14 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = [
['netzmacht.contao_toolkit.dca.listeners.alias_generator', 'handleSaveCallback'], ['netzmacht.contao_toolkit.dca.listeners.alias_generator', 'handleSaveCallback'],
['netzmacht.contao_leaflet.listeners.dca.validator', 'validateAlias'], ['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' => [ 'toolkit' => [
'alias_generator' => [ 'alias_generator' => [
'factory' => 'netzmacht.contao_leaflet.definition.alias_generator.factory_default', 'factory' => 'netzmacht.contao_leaflet.definition.alias_generator.factory_default',
@@ -624,7 +641,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = [
'exclude' => true, 'exclude' => true,
'inputType' => 'text', 'inputType' => 'text',
'default' => '', 'default' => '',
'eval' => ['maxlength' => 255, 'tl_class' => 'long', 'allowHtml' => true], 'eval' => ['maxlength' => 255, 'tl_class' => 'clr long', 'allowHtml' => true],
'sql' => "varchar(255) NOT NULL default ''", 'sql' => "varchar(255) NOT NULL default ''",
], ],
'tms' => [ 'tms' => [
@@ -864,7 +881,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = [
], ],
'sql' => 'mediumtext NULL', 'sql' => 'mediumtext NULL',
], ],
'fileFormat' => [ 'fileFormat' => [
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['fileFormat'], 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['fileFormat'],
'exclude' => true, 'exclude' => true,
'inputType' => 'select', 'inputType' => 'select',
@@ -882,19 +899,19 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = [
'sql' => "varchar(32) NOT NULL default ''", 'sql' => "varchar(32) NOT NULL default ''",
], ],
'file' => [ 'file' => [
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['file'], 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['file'],
'exclude' => true, 'exclude' => true,
'inputType' => 'fileTree', 'inputType' => 'fileTree',
'load_callback' => [ 'load_callback' => [
['netzmacht.contao_leaflet.listeners.dca.layer', 'prepareFileWidget'], ['netzmacht.contao_leaflet.listeners.dca.layer', 'prepareFileWidget'],
], ],
'eval' => [ 'eval' => [
'filesOnly' => true, 'filesOnly' => true,
'fieldType' => 'radio', 'fieldType' => 'radio',
'mandatory' => true, 'mandatory' => true,
'tl_class' => 'clr', 'tl_class' => 'clr',
], ],
'sql' => 'binary(16) NULL', 'sql' => 'binary(16) NULL',
], ],
], ],
]; ];

View File

@@ -5,7 +5,9 @@
* *
* @package contao-leaflet-maps * @package contao-leaflet-maps
* @author David Molineus <david.molineus@netzmacht.de> * @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2014-2017 netzmacht David Molineus. All rights reserved. * @author Sven Baumann <baumann.sv@gmail.com>
* @author Stefan Heimes <stefan_heimes@hotmail.com>
* @copyright 2014-2022 netzmacht David Molineus. All rights reserved.
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE * @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
* @filesource * @filesource
*/ */
@@ -23,10 +25,14 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = [
], ],
'onload_callback' => [ 'onload_callback' => [
['netzmacht.contao_leaflet.listeners.dca.leaflet', 'loadLanguageFile'], ['netzmacht.contao_leaflet.listeners.dca.leaflet', 'loadLanguageFile'],
['netzmacht.contao_leaflet.listeners.dca.map', 'addIncompleteConfigurationWarning'],
], ],
'onsubmit_callback' => [ 'onsubmit_callback' => [
['netzmacht.contao_leaflet.listeners.dca.leaflet', 'clearCache'], ['netzmacht.contao_leaflet.listeners.dca.leaflet', 'clearCache'],
], ],
'oncopy_callback' => [
['netzmacht.contao_leaflet.listeners.dca.map', 'copyLayerRelations'],
],
], ],
'list' => [ 'list' => [
@@ -69,7 +75,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = [
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_map']['delete'], 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_map']['delete'],
'href' => 'act=delete', 'href' => 'act=delete',
'icon' => 'delete.gif', 'icon' => 'delete.gif',
'attributes' => 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] 'attributes' => 'onclick="if(!confirm(\'' . ($GLOBALS['TL_LANG']['MSC']['deleteConfirm'] ?? '')
. '\'))return false;Backend.getScrollOffset()"', . '\'))return false;Backend.getScrollOffset()"',
], ],
'show' => [ 'show' => [
@@ -156,7 +162,14 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = [
['netzmacht.contao_toolkit.dca.listeners.alias_generator', 'handleSaveCallback'], ['netzmacht.contao_toolkit.dca.listeners.alias_generator', 'handleSaveCallback'],
['netzmacht.contao_leaflet.listeners.dca.validator', 'validateAlias'], ['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' => [ 'toolkit' => [
'alias_generator' => [ 'alias_generator' => [
'factory' => 'netzmacht.contao_leaflet.definition.alias_generator.factory_default', 'factory' => 'netzmacht.contao_leaflet.definition.alias_generator.factory_default',
@@ -415,10 +428,12 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = [
'exclude' => true, 'exclude' => true,
'inputType' => 'textarea', 'inputType' => 'textarea',
'eval' => [ 'eval' => [
'tl_class' => 'clr lng', 'tl_class' => 'clr lng',
'allowHtml' => true, 'preserveTags' => true,
'style' => 'min-height: 40px;', 'decodeEntities' => true,
'rte' => 'ace|json', 'allowHtml' => true,
'style' => 'min-height: 40px;',
'rte' => 'ace|json',
], ],
'sql' => 'text NULL', 'sql' => 'text NULL',
], ],

View File

@@ -5,7 +5,9 @@
* *
* @package contao-leaflet-maps * @package contao-leaflet-maps
* @author David Molineus <david.molineus@netzmacht.de> * @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2014-2017 netzmacht David Molineus. All rights reserved. * @author Sven Baumann <baumann.sv@gmail.com>
* @author Stefan Heimes <stefan_heimes@hotmail.com>
* @copyright 2014-2022 netzmacht David Molineus. All rights reserved.
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE * @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
* @filesource * @filesource
*/ */
@@ -78,7 +80,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = [
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_marker']['delete'], 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_marker']['delete'],
'href' => 'act=delete', 'href' => 'act=delete',
'icon' => 'delete.gif', 'icon' => 'delete.gif',
'attributes' => 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] 'attributes' => 'onclick="if(!confirm(\'' . ($GLOBALS['TL_LANG']['MSC']['deleteConfirm'] ?? '')
. '\'))return false;Backend.getScrollOffset()"', . '\'))return false;Backend.getScrollOffset()"',
], ],
'toggle' => [ 'toggle' => [
@@ -160,7 +162,14 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = [
['netzmacht.contao_toolkit.dca.listeners.alias_generator', 'handleSaveCallback'], ['netzmacht.contao_toolkit.dca.listeners.alias_generator', 'handleSaveCallback'],
['netzmacht.contao_leaflet.listeners.dca.validator', 'validateAlias'], ['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' => [ 'toolkit' => [
'alias_generator' => [ 'alias_generator' => [
'factory' => 'netzmacht.contao_leaflet.definition.alias_generator.factory_default', 'factory' => 'netzmacht.contao_leaflet.definition.alias_generator.factory_default',
@@ -332,9 +341,11 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = [
'inputType' => 'textarea', 'inputType' => 'textarea',
'eval' => [ 'eval' => [
'tl_class' => 'clr lng', 'tl_class' => 'clr lng',
'allowHtml' => true, 'preserveTags' => true,
'style' => 'min-height: 40px;', 'decodeEntities' => true,
'rte' => 'ace|json', 'allowHtml' => true,
'style' => 'min-height: 40px;',
'rte' => 'ace|json',
], ],
'sql' => 'text NULL', 'sql' => 'text NULL',
], ],

View File

@@ -5,7 +5,8 @@
* *
* @package contao-leaflet-maps * @package contao-leaflet-maps
* @author David Molineus <david.molineus@netzmacht.de> * @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2014-2017 netzmacht David Molineus. All rights reserved. * @author Sven Baumann <baumann.sv@gmail.com>
* @copyright 2014-2022 netzmacht David Molineus. All rights reserved.
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE * @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
* @filesource * @filesource
*/ */
@@ -78,7 +79,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_popup'] = [
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_popup']['delete'], 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_popup']['delete'],
'href' => 'act=delete', 'href' => 'act=delete',
'icon' => 'delete.gif', 'icon' => 'delete.gif',
'attributes' => 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] 'attributes' => 'onclick="if(!confirm(\'' . ($GLOBALS['TL_LANG']['MSC']['deleteConfirm'] ?? '')
. '\'))return false;Backend.getScrollOffset()"', . '\'))return false;Backend.getScrollOffset()"',
], ],
'toggle' => [ 'toggle' => [
@@ -151,7 +152,14 @@ $GLOBALS['TL_DCA']['tl_leaflet_popup'] = [
['netzmacht.contao_toolkit.dca.listeners.alias_generator', 'handleSaveCallback'], ['netzmacht.contao_toolkit.dca.listeners.alias_generator', 'handleSaveCallback'],
['netzmacht.contao_leaflet.listeners.dca.validator', 'validateAlias'], ['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' => [ 'toolkit' => [
'alias_generator' => [ 'alias_generator' => [
'factory' => 'netzmacht.contao_leaflet.definition.alias_generator.factory_default', 'factory' => 'netzmacht.contao_leaflet.definition.alias_generator.factory_default',

View File

@@ -5,7 +5,8 @@
* *
* @package contao-leaflet-maps * @package contao-leaflet-maps
* @author David Molineus <david.molineus@netzmacht.de> * @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2014-2017 netzmacht David Molineus. All rights reserved. * @author Sven Baumann <baumann.sv@gmail.com>
* @copyright 2014-2022 netzmacht David Molineus. All rights reserved.
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE * @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
* @filesource * @filesource
*/ */
@@ -78,7 +79,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_style'] = [
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_style']['delete'], 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_style']['delete'],
'href' => 'act=delete', 'href' => 'act=delete',
'icon' => 'delete.gif', 'icon' => 'delete.gif',
'attributes' => 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] 'attributes' => 'onclick="if(!confirm(\'' . ($GLOBALS['TL_LANG']['MSC']['deleteConfirm'] ?? '')
. '\'))return false;Backend.getScrollOffset()"', . '\'))return false;Backend.getScrollOffset()"',
], ],
'toggle' => [ 'toggle' => [
@@ -145,7 +146,14 @@ $GLOBALS['TL_DCA']['tl_leaflet_style'] = [
['netzmacht.contao_toolkit.dca.listeners.alias_generator', 'handleSaveCallback'], ['netzmacht.contao_toolkit.dca.listeners.alias_generator', 'handleSaveCallback'],
['netzmacht.contao_leaflet.listeners.dca.validator', 'validateAlias'], ['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' => [ 'toolkit' => [
'alias_generator' => [ 'alias_generator' => [
'factory' => 'netzmacht.contao_leaflet.definition.alias_generator.factory_default', 'factory' => 'netzmacht.contao_leaflet.definition.alias_generator.factory_default',

View File

@@ -5,7 +5,9 @@
* *
* @package contao-leaflet-maps * @package contao-leaflet-maps
* @author David Molineus <david.molineus@netzmacht.de> * @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2014-2017 netzmacht David Molineus. All rights reserved. * @author Sven Baumann <baumann.sv@gmail.com>
* @author Stefan Heimes <stefan_heimes@hotmail.com>
* @copyright 2014-2022 netzmacht David Molineus. All rights reserved.
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE * @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
* @filesource * @filesource
*/ */
@@ -84,7 +86,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = [
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_vector']['delete'], 'label' => &$GLOBALS['TL_LANG']['tl_leaflet_vector']['delete'],
'href' => 'act=delete', 'href' => 'act=delete',
'icon' => 'delete.gif', 'icon' => 'delete.gif',
'attributes' => 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm'] 'attributes' => 'onclick="if(!confirm(\'' . ($GLOBALS['TL_LANG']['MSC']['deleteConfirm'] ?? '')
. '\'))return false;Backend.getScrollOffset()"', . '\'))return false;Backend.getScrollOffset()"',
], ],
'toggle' => [ 'toggle' => [
@@ -185,7 +187,14 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = [
['netzmacht.contao_toolkit.dca.listeners.alias_generator', 'handleSaveCallback'], ['netzmacht.contao_toolkit.dca.listeners.alias_generator', 'handleSaveCallback'],
['netzmacht.contao_leaflet.listeners.dca.validator', 'validateAlias'], ['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' => [ 'toolkit' => [
'alias_generator' => [ 'alias_generator' => [
'factory' => 'netzmacht.contao_leaflet.definition.alias_generator.factory_default', 'factory' => 'netzmacht.contao_leaflet.definition.alias_generator.factory_default',
@@ -371,10 +380,12 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = [
'exclude' => true, 'exclude' => true,
'inputType' => 'textarea', 'inputType' => 'textarea',
'eval' => [ 'eval' => [
'tl_class' => 'clr lng', 'tl_class' => 'clr lng',
'allowHtml' => true, 'preserveTags' => true,
'style' => 'min-height: 40px;', 'decodeEntities' => true,
'rte' => 'ace|json', 'allowHtml' => true,
'style' => 'min-height: 40px;',
'rte' => 'ace|json',
], ],
'sql' => 'text NULL', 'sql' => 'text NULL',
], ],

View File

@@ -5,6 +5,7 @@
* *
* @package contao-leaflet-maps * @package contao-leaflet-maps
* @author David Molineus <david.molineus@netzmacht.de> * @author David Molineus <david.molineus@netzmacht.de>
* @author Fritz Michael Gschwantner <fmg@inspiredminds.at>
* @copyright 2014-2017 netzmacht David Molineus. All rights reserved. * @copyright 2014-2017 netzmacht David Molineus. All rights reserved.
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE * @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
* @filesource * @filesource
@@ -13,7 +14,7 @@
$GLOBALS['TL_DCA']['tl_module']['metapalettes']['leaflet'] = [ $GLOBALS['TL_DCA']['tl_module']['metapalettes']['leaflet'] = [
'type' => ['name', 'type', 'headline'], 'type' => ['name', 'type', 'headline'],
'leaflet' => ['leaflet_map', 'leaflet_mapId', 'leaflet_width', 'leaflet_height', 'leaflet_template'], 'leaflet' => ['leaflet_map', 'leaflet_mapId', 'leaflet_width', 'leaflet_height', 'leaflet_template'],
'templates' => [':hide', 'customTpl'], 'template' => [':hide', 'customTpl'],
'protected' => [':hide', 'protected'], 'protected' => [':hide', 'protected'],
'expert' => [':hide', 'guests', 'cssID', 'space'], 'expert' => [':hide', 'guests', 'cssID', 'space'],
'invisible' => [':hide', 'invisible', 'start', 'start'], 'invisible' => [':hide', 'invisible', 'start', 'start'],
@@ -49,7 +50,7 @@ $GLOBALS['TL_DCA']['tl_module']['fields']['leaflet_mapId'] = [
$GLOBALS['TL_DCA']['tl_module']['fields']['leaflet_width'] = [ $GLOBALS['TL_DCA']['tl_module']['fields']['leaflet_width'] = [
'label' => &$GLOBALS['TL_LANG']['tl_module']['leaflet_width'], 'label' => &$GLOBALS['TL_LANG']['tl_module']['leaflet_width'],
'inputType' => 'inputUnit', 'inputType' => 'inputUnit',
'options' => ['px', '%', 'em', 'pt', 'pc', 'in', 'cm', 'mm'], 'options' => $GLOBALS['TL_CSS_UNITS'],
'search' => false, 'search' => false,
'exclude' => true, 'exclude' => true,
'eval' => ['rgxp' => 'digit', 'tl_class' => 'clr w50'], 'eval' => ['rgxp' => 'digit', 'tl_class' => 'clr w50'],
@@ -60,7 +61,7 @@ $GLOBALS['TL_DCA']['tl_module']['fields']['leaflet_width'] = [
$GLOBALS['TL_DCA']['tl_module']['fields']['leaflet_height'] = [ $GLOBALS['TL_DCA']['tl_module']['fields']['leaflet_height'] = [
'label' => &$GLOBALS['TL_LANG']['tl_module']['leaflet_height'], 'label' => &$GLOBALS['TL_LANG']['tl_module']['leaflet_height'],
'inputType' => 'inputUnit', 'inputType' => 'inputUnit',
'options' => ['px', '%', 'em', 'pt', 'pc', 'in', 'cm', 'mm'], 'options' => $GLOBALS['TL_CSS_UNITS'],
'search' => false, 'search' => false,
'exclude' => true, 'exclude' => true,
'eval' => ['rgxp' => 'digit', 'tl_class' => 'w50'], 'eval' => ['rgxp' => 'digit', 'tl_class' => 'w50'],

View File

@@ -58,7 +58,7 @@ $GLOBALS['TL_LANG']['tl_leaflet_layer']['groupTypes']['layer']['1'] = 'Ba
$GLOBALS['TL_LANG']['tl_leaflet_layer']['iconCreateFunction']['0'] = 'Cluster-Icon-Funktion erstellen'; $GLOBALS['TL_LANG']['tl_leaflet_layer']['iconCreateFunction']['0'] = 'Cluster-Icon-Funktion erstellen';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['iconCreateFunction']['1'] = 'Diese Funktion wird zum Erstellen des Cluster-Icons benutzt.'; $GLOBALS['TL_LANG']['tl_leaflet_layer']['iconCreateFunction']['1'] = 'Diese Funktion wird zum Erstellen des Cluster-Icons benutzt.';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['icons']['0'] = 'Icons verwalten'; $GLOBALS['TL_LANG']['tl_leaflet_layer']['icons']['0'] = 'Icons verwalten';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['icons']['1'] = 'Stile verwalten'; $GLOBALS['TL_LANG']['tl_leaflet_layer']['icons']['1'] = 'Icon-Stile verwalten';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['map']['0'] = 'Karten verwalten'; $GLOBALS['TL_LANG']['tl_leaflet_layer']['map']['0'] = 'Karten verwalten';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['map']['1'] = 'Leaflet-Karten verwalten.'; $GLOBALS['TL_LANG']['tl_leaflet_layer']['map']['1'] = 'Leaflet-Karten verwalten.';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['markerCluster']['0'] = 'Marker-Cluster'; $GLOBALS['TL_LANG']['tl_leaflet_layer']['markerCluster']['0'] = 'Marker-Cluster';
@@ -83,7 +83,7 @@ $GLOBALS['TL_LANG']['tl_leaflet_layer']['pasteafter']['1'] = 'Na
$GLOBALS['TL_LANG']['tl_leaflet_layer']['pasteinto']['1'] = 'In Layer %s einfügen'; $GLOBALS['TL_LANG']['tl_leaflet_layer']['pasteinto']['1'] = 'In Layer %s einfügen';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['polygonOptions']['0'] = 'Polygon-Optionen'; $GLOBALS['TL_LANG']['tl_leaflet_layer']['polygonOptions']['0'] = 'Polygon-Optionen';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['popups']['0'] = 'Popups verwalten'; $GLOBALS['TL_LANG']['tl_leaflet_layer']['popups']['0'] = 'Popups verwalten';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['popups']['1'] = 'Popup-Icons verwalten'; $GLOBALS['TL_LANG']['tl_leaflet_layer']['popups']['1'] = 'Marker Popups verwalten';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['reference']['0'] = 'Referenz'; $GLOBALS['TL_LANG']['tl_leaflet_layer']['reference']['0'] = 'Referenz';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['reference']['1'] = 'Wählen Sie den Referenzlayer aus. Ansonsten wird dasselbe JavaScript-Objekt benutzt.'; $GLOBALS['TL_LANG']['tl_leaflet_layer']['reference']['1'] = 'Wählen Sie den Referenzlayer aus. Ansonsten wird dasselbe JavaScript-Objekt benutzt.';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['removeOutsideVisibleBounds']['0'] = 'Entfernen, wenn außerhalb der sichtbaren Begrenzung'; $GLOBALS['TL_LANG']['tl_leaflet_layer']['removeOutsideVisibleBounds']['0'] = 'Entfernen, wenn außerhalb der sichtbaren Begrenzung';

View File

@@ -35,8 +35,8 @@ $GLOBALS['TL_LANG']['tl_leaflet_popup']['delete']['0'] = 'Popup löschen
$GLOBALS['TL_LANG']['tl_leaflet_popup']['delete']['1'] = 'Popup ID %s löschen'; $GLOBALS['TL_LANG']['tl_leaflet_popup']['delete']['1'] = 'Popup ID %s löschen';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['edit']['0'] = 'Popup bearbeiten'; $GLOBALS['TL_LANG']['tl_leaflet_popup']['edit']['0'] = 'Popup bearbeiten';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['edit']['1'] = 'Popup ID %s bearbeiten'; $GLOBALS['TL_LANG']['tl_leaflet_popup']['edit']['1'] = 'Popup ID %s bearbeiten';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['icons']['0'] = 'Popups verwalten'; $GLOBALS['TL_LANG']['tl_leaflet_popup']['icons']['0'] = 'Icons verwalten';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['icons']['1'] = 'Marker-Popups verwalten'; $GLOBALS['TL_LANG']['tl_leaflet_popup']['icons']['1'] = 'Marker-Icons verwalten';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['keepInView']['0'] = 'Im Sichtfeld behalten'; $GLOBALS['TL_LANG']['tl_leaflet_popup']['keepInView']['0'] = 'Im Sichtfeld behalten';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['keepInView']['1'] = 'Aktivieren Sie diese Einstellung um ein herausschieben des Popups aus dem sichbaren Bereich zu verhindern.'; $GLOBALS['TL_LANG']['tl_leaflet_popup']['keepInView']['1'] = 'Aktivieren Sie diese Einstellung um ein herausschieben des Popups aus dem sichbaren Bereich zu verhindern.';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['layersBtn']['0'] = 'Layer verwalten'; $GLOBALS['TL_LANG']['tl_leaflet_popup']['layersBtn']['0'] = 'Layer verwalten';

View File

@@ -44,7 +44,7 @@ $GLOBALS['TL_LANG']['tl_leaflet_style']['new']['1'] = 'Neuen Stil erstel
$GLOBALS['TL_LANG']['tl_leaflet_style']['opacity']['0'] = 'Linientransparenz'; $GLOBALS['TL_LANG']['tl_leaflet_style']['opacity']['0'] = 'Linientransparenz';
$GLOBALS['TL_LANG']['tl_leaflet_style']['opacity']['1'] = 'Die Transparenz des Striches kann einen Wert zwischen 0 und 1 annehmen.'; $GLOBALS['TL_LANG']['tl_leaflet_style']['opacity']['1'] = 'Die Transparenz des Striches kann einen Wert zwischen 0 und 1 annehmen.';
$GLOBALS['TL_LANG']['tl_leaflet_style']['popups']['0'] = 'Popups verwalten'; $GLOBALS['TL_LANG']['tl_leaflet_style']['popups']['0'] = 'Popups verwalten';
$GLOBALS['TL_LANG']['tl_leaflet_style']['popups']['1'] = 'Popup-Icons verwalten'; $GLOBALS['TL_LANG']['tl_leaflet_style']['popups']['1'] = 'Popup-Stile verwalten';
$GLOBALS['TL_LANG']['tl_leaflet_style']['show']['0'] = 'Details anzeigen'; $GLOBALS['TL_LANG']['tl_leaflet_style']['show']['0'] = 'Details anzeigen';
$GLOBALS['TL_LANG']['tl_leaflet_style']['show']['1'] = 'Details des Stils ID %s anzeigen'; $GLOBALS['TL_LANG']['tl_leaflet_style']['show']['1'] = 'Details des Stils ID %s anzeigen';
$GLOBALS['TL_LANG']['tl_leaflet_style']['stroke']['0'] = 'Linie ziehen'; $GLOBALS['TL_LANG']['tl_leaflet_style']['stroke']['0'] = 'Linie ziehen';

View File

@@ -0,0 +1,15 @@
<?php
/**
* Leaflet maps for Contao CMS.
*
* @package contao-leaflet-maps
* @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2014-2018 netzmacht David Molineus. All rights reserved.
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
* @filesource
*/
declare(strict_types=1);
$GLOBALS['TL_LANG']['ERR']['leafletMissingZoomLevel'] = 'No zoom level defined. Only leave it empty on purpose (Zoom level might by initialized by bounds adjustments). Otherwise no map will be shown.';

View File

@@ -21,7 +21,7 @@ $GLOBALS['TL_LANG']['tl_leaflet_layer']['map'][1] = 'Manage leaflet maps';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['icons'][0] = 'Manage icons'; $GLOBALS['TL_LANG']['tl_leaflet_layer']['icons'][0] = 'Manage icons';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['icons'][1] = 'Manage marker icons'; $GLOBALS['TL_LANG']['tl_leaflet_layer']['icons'][1] = 'Manage marker icons';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['popups'][0] = 'Manage popups'; $GLOBALS['TL_LANG']['tl_leaflet_layer']['popups'][0] = 'Manage popups';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['popups'][1] = 'Manage popups icons'; $GLOBALS['TL_LANG']['tl_leaflet_layer']['popups'][1] = 'Manage popups styles';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['styles'][0] = 'Manage styles'; $GLOBALS['TL_LANG']['tl_leaflet_layer']['styles'][0] = 'Manage styles';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['styles'][1] = 'Manage vector styles'; $GLOBALS['TL_LANG']['tl_leaflet_layer']['styles'][1] = 'Manage vector styles';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['new'][0] = 'Create layer'; $GLOBALS['TL_LANG']['tl_leaflet_layer']['new'][0] = 'Create layer';
@@ -149,6 +149,10 @@ $GLOBALS['TL_LANG']['tl_leaflet_layer']['fileFormat'][0] = 'File
$GLOBALS['TL_LANG']['tl_leaflet_layer']['fileFormat'][1] = 'Choose which file format is used.'; $GLOBALS['TL_LANG']['tl_leaflet_layer']['fileFormat'][1] = 'Choose which file format is used.';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['file'][0] = 'File'; $GLOBALS['TL_LANG']['tl_leaflet_layer']['file'][0] = 'File';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['file'][1] = 'Choose a file containing geodata. Supported formats are: %s.'; $GLOBALS['TL_LANG']['tl_leaflet_layer']['file'][1] = 'Choose a file containing geodata. Supported formats are: %s.';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['tile_provider_key'][0] = 'API key / Access token';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['tile_provider_key'][1] = 'Please define the API key / access token which is required for this tile provider.';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['tile_provider_code'][0] = 'App code';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['tile_provider_code'][1] = 'Please define the required app code for this tile provider.';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['groupTypes']['layer'][0] = 'Layer group'; $GLOBALS['TL_LANG']['tl_leaflet_layer']['groupTypes']['layer'][0] = 'Layer group';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['groupTypes']['layer'][1] = 'Basic layer group. <br> See <a href="http://leafletjs.com/reference.html#layergroup" target="_blank">http://leafletjs.com/reference.html#layergroup</a>'; $GLOBALS['TL_LANG']['tl_leaflet_layer']['groupTypes']['layer'][1] = 'Basic layer group. <br> See <a href="http://leafletjs.com/reference.html#layergroup" target="_blank">http://leafletjs.com/reference.html#layergroup</a>';

View File

@@ -19,8 +19,8 @@ $GLOBALS['TL_LANG']['tl_leaflet_popup']['layersBtn'][0] = 'Manage layers';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['layersBtn'][1] = 'Manage leaflet layers'; $GLOBALS['TL_LANG']['tl_leaflet_popup']['layersBtn'][1] = 'Manage leaflet layers';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['styles'][0] = 'Manage styles'; $GLOBALS['TL_LANG']['tl_leaflet_popup']['styles'][0] = 'Manage styles';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['styles'][1] = 'Manage vector styles'; $GLOBALS['TL_LANG']['tl_leaflet_popup']['styles'][1] = 'Manage vector styles';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['icons'][0] = 'Manage popups'; $GLOBALS['TL_LANG']['tl_leaflet_popup']['icons'][0] = 'Manage icons';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['icons'][1] = 'Manage marker popups'; $GLOBALS['TL_LANG']['tl_leaflet_popup']['icons'][1] = 'Manage marker icons';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['new'][0] = 'Create popup'; $GLOBALS['TL_LANG']['tl_leaflet_popup']['new'][0] = 'Create popup';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['new'][1] = 'Create new popup'; $GLOBALS['TL_LANG']['tl_leaflet_popup']['new'][1] = 'Create new popup';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['edit'][0] = 'Edit popup'; $GLOBALS['TL_LANG']['tl_leaflet_popup']['edit'][0] = 'Edit popup';

View File

@@ -19,7 +19,7 @@ $GLOBALS['TL_LANG']['tl_leaflet_style']['layersBtn'][1] = 'Manage leaflet layers
$GLOBALS['TL_LANG']['tl_leaflet_style']['icons'][0] = 'Manage icons'; $GLOBALS['TL_LANG']['tl_leaflet_style']['icons'][0] = 'Manage icons';
$GLOBALS['TL_LANG']['tl_leaflet_style']['icons'][1] = 'Manage marker icons'; $GLOBALS['TL_LANG']['tl_leaflet_style']['icons'][1] = 'Manage marker icons';
$GLOBALS['TL_LANG']['tl_leaflet_style']['popups'][0] = 'Manage popups'; $GLOBALS['TL_LANG']['tl_leaflet_style']['popups'][0] = 'Manage popups';
$GLOBALS['TL_LANG']['tl_leaflet_style']['popups'][1] = 'Manage popups icons'; $GLOBALS['TL_LANG']['tl_leaflet_style']['popups'][1] = 'Manage popups styles';
$GLOBALS['TL_LANG']['tl_leaflet_style']['new'][0] = 'Create style'; $GLOBALS['TL_LANG']['tl_leaflet_style']['new'][0] = 'Create style';
$GLOBALS['TL_LANG']['tl_leaflet_style']['new'][1] = 'Create new style'; $GLOBALS['TL_LANG']['tl_leaflet_style']['new'][1] = 'Create new style';
$GLOBALS['TL_LANG']['tl_leaflet_style']['edit'][0] = 'Edit style'; $GLOBALS['TL_LANG']['tl_leaflet_style']['edit'][0] = 'Edit style';

View File

@@ -1,7 +0,0 @@
<IfModule !mod_authz_core.c>
Order allow,deny
Allow from all
</IfModule>
<IfModule mod_authz_core.c>
Require all granted
</IfModule>

View File

@@ -1,140 +0,0 @@
<div class="netzmacht-leaflet-credits">
<div class="header">
<h1 class="sub_headline"><?php echo $this->headline; ?>
<small><?php echo $this->version; ?></small>
</h1>
</div>
<div class="tl_box block row">
<h2>About</h2>
<div class="left">
<p>
The Leaflet maps integration for Contao CMS is an Open Source Software license under the LGPL 3.0.
This extension is only exists because of great other Open Source Software which it heavenly depends on.
</p>
<p>
This software ships with an visible attribution to <em>netzmacht creative</em> in the map attribution
control.
If you want to remove this attribution, you have to purchase a commercial license.
For more details visit the <a href="https://netzmacht.de/contao-leaflet" target="_blank">project
website</a>.
</p>
</div>
<div class="right">
<a href="http://www.netzmacht.de" <?php echo LINK_NEW_WINDOW; ?>>
<img src="bundles/netzmachtcontaoleaflet/img/logo.png"></a>
<p>
<strong class="company">netzmacht </strong><br>
David Molineus<br>
</p>
<p>
DAB Bank München<br>
IBAN: DE52701204008354237003<br>
BIC: DABBDEMMXXX
</p>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" target="_top">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="YWMA95YS3FT6U">
<input type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_donate_SM.gif" border="0"
name="submit" alt="PayPal The safer, easier way to pay online.">
<img alt="" border="0" src="https://www.paypalobjects.com/de_DE/i/scr/pixel.gif" width="1" height="1">
</form>
</div>
</div>
<div class="tl_box">
<h2>Support Contao Leaflet</h2>
<div class="row">
<div class="col">
<h3>Report issues</h3>
<p>If you found a bug, got some troubles or have a feature request - feel free to open an issue.</p>
<p><a href="http://github.com/netzmacht/contao-leaflet-maps/issues" class="btn" target="_blank">Issue
tracker</a></p>
</div>
<div class="col">
<h3>Contribute</h3>
<p>There are many ways you can con&shy;tribute. Translations,
docu&shy;mentation or code contributions are welcome.
</p>
<p><a href="https://netzmacht/contao-leaflet/contribute.html" class="btn" target="_blank">Contribute</a>
</p>
</div>
<div class="col">
<h3>Fund a feature</h3>
<p>Contao Leaflet is not feature complete. Have a look at the list of planned feature and support
them.</p>
<p><a href="https://netzmacht/contao-leaflet/planned-features.html" class="btn" target="_blank">Planned
features</a></p>
</div>
</div>
<div class="row">
<div class="col">
<h3>Individual development</h3>
<p>If you have special requirements you can hire me for an individual development.</p>
<p><a href="https://netzmacht/contao-leaflet/contact.html" class="btn" target="_blank">Contact</a></p>
</div>
<div class="col">
<h3>Commercial license</h3>
<p>If you want to remove the attribution in the attribution control, you can purchase a commercial
license.</p>
<p><a href="https://netzmacht/contao-leaflet/commercial-license.html" class="btn" target="_blank">Purchase
license</a></p>
</div>
</div>
</div>
<div class="tl_box">
<h2>Credits</h2>
<table class="tl_listing">
<tr>
<th>Name</th>
<th>Version</th>
<th>License</th>
<th>Homepage</th>
</tr>
<?php if ($this->libraries): ?>
<tr>
<th colspan="4" class="subtitle">Libraries</th>
</tr>
<?php endif; ?>
<?php foreach ($this->libraries as $library): ?>
<tr>
<td><?php echo $library['name']; ?></td>
<td><?php echo $library['version']; ?></td>
<td><?php echo $library['license']; ?></td>
<td><?php echo $library['homepage']; ?></td>
</tr>
<?php endforeach; ?>
<tr>
<th class="subtitle" colspan="4">Graphics</th>
</tr>
<tr>
<td>Farm Fresh-Web Icons</td>
<td>3.9.2</td>
<td><a href="http://creativecommons.org/licenses/by/3.0/us/" target="_blank">CC BY 3.0 US</a></td>
<td><a href="http://www.fatcow.com/free-icons" target="_blank">fatcow.com/free-icons</a></td>
</tr>
<tr>
<td>Web Blog Icons by SEM Labs</td>
<td>3.9.2</td>
<td><a href="http://creativecommons.org/licenses/by/4.0/" target="_blank">CC BY 4.0</a></td>
<td><a href="http://semlabs.co.uk/" target="_blank">semlabs.co.uk</a></td>
</tr>
<?php if ($this->dependencies): ?>
<tr>
<th colspan="4" class="subtitle">Dependencies</th>
</tr>
<?php endif; ?>
<?php foreach ($this->dependencies as $dep): ?>
<tr>
<td><?php echo $dep['name']; ?></td>
<td><?php echo $dep['version']; ?></td>
<td><?php echo $dep['license']; ?></td>
<td><?php echo $dep['homepage']; ?></td>
</tr>
<?php endforeach; ?>
</table>
</div>
</div>

View File

@@ -1,8 +1,8 @@
<?php $GLOBALS['TL_CSS'][] = 'assets/leaflet/libs/leaflet/leaflet.css'; ?> <?php $GLOBALS['TL_CSS'][] = 'assets/leaflet/libs/leaflet/leaflet.min.css'; ?>
<?php $GLOBALS['TL_CSS'][] = 'assets/leaflet/libs/control-geocoder/Control.Geocoder.css'; ?> <?php $GLOBALS['TL_CSS'][] = 'assets/leaflet/libs/control-geocoder/Control.Geocoder.min.css'; ?>
<?php $GLOBALS['TL_JAVASCRIPT'][] = 'assets/leaflet/libs/leaflet/leaflet.js'; ?> <?php $GLOBALS['TL_JAVASCRIPT'][] = 'assets/leaflet/libs/leaflet/leaflet.js'; ?>
<?php $GLOBALS['TL_JAVASCRIPT'][] = 'assets/leaflet/libs/control-geocoder/Control.Geocoder.js'; ?> <?php $GLOBALS['TL_JAVASCRIPT'][] = 'assets/leaflet/libs/control-geocoder/Control.Geocoder.min.js'; ?>
<div id="map_<?php echo $this->field; ?>" style="margin-top: 5px; width: calc(100% - 28px); height: 300px"></div> <div id="map_<?php echo $this->field; ?>" style="margin-top: 5px; width: calc(100% - 28px); height: 300px"></div>
<script> <script>
@@ -17,6 +17,12 @@
placeholder: '<?php echo $GLOBALS['TL_LANG']['leaflet']['searchPosition']; ?>' placeholder: '<?php echo $GLOBALS['TL_LANG']['leaflet']['searchPosition']; ?>'
}).addTo(map); }).addTo(map);
document.querySelector('.leaflet-control-geocoder input').addEventListener('keydown', function (event) {
if (event.keyCode === 13) {
event.preventDefault();
}
});
geocoder.on('markgeocode', function (event) { geocoder.on('markgeocode', function (event) {
var container = document.createElement('div'); var container = document.createElement('div');
var link = document.createElement('button'); var link = document.createElement('button');
@@ -28,7 +34,8 @@
e.stop(); e.stop();
element.set('value', result.center.lat + ',' + result.center.lng); element.set('value', result.center.lat + ',' + result.center.lng);
}); this._geocodeMarker.closePopup();
}.bind(this));
container.appendHTML(result.html || result.name); container.appendHTML(result.html || result.name);
container.appendChild(link); container.appendChild(link);

View File

@@ -9,5 +9,5 @@
</div> </div>
<!-- indexer::continue --> <!-- indexer::continue -->
<?php $GLOBALS['TL_BODY'][] = '<script>' . $this->javascript . '</script>'; ?> <script><?= $this->javascript ?></script>

View File

@@ -9,4 +9,4 @@
</div> </div>
<!-- indexer::continue --> <!-- indexer::continue -->
<?php $GLOBALS['TL_BODY'][] = '<script>' . $this->javascript . '</script>'; ?> <script><?= $this->javascript ?></script>

View File

@@ -23,6 +23,10 @@
padding-left: 20px !important; padding-left: 20px !important;
} }
.tl_listing .tl_left {
overflow: unset;
}
.long .tl_text_2 { .long .tl_text_2 {
width: 325px; width: 325px;
} }

View File

@@ -1,6 +1,6 @@
#tl_navigation .tl_level_1_group .group-leaflet { #tl_navigation .group-leaflet {
background: url(/bundles/netzmachtcontaoleaflet/img/leaflet.svg) 3px 2px no-repeat; background: url(../img/leaflet.svg) 3px 2px no-repeat;
} }
.tl_help_table a { .tl_help_table a {

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,132 @@
{% extends "@ContaoCore/Backend/be_page.html.twig" %}
{% block headline %}{{ "MOD.leaflet_about.1"|trans({}, 'contao_modules') }}{% endblock %}
{% block error %}{% endblock %}
{% block main %}
<div class="netzmacht-leaflet-credits">
<div class="header">
<h1 class="sub_headline">{{ headline }}
<small>{{ version }}</small>
</h1>
</div>
<div class="tl_box block row">
<h2>About</h2>
<p>
The Leaflet maps integration for Contao CMS is an Open Source Software license under the LGPL 3.0.
This extension is only exists because of great other Open Source Software which it heavenly depends on.
</p>
<p>
This software ships with an visible attribution to <em>netzmacht creative</em> in the map attribution
control.
If you want to remove this attribution, you have to purchase a commercial license.
For more details visit the <a href="https://netzmacht.de/contao-leaflet" target="_blank">project
website</a>.
</p>
</div>
<div class="tl_box">
<h2>Support Contao Leaflet</h2>
<div class="row">
<div class="col">
<h3>Report issues</h3>
<p>If you found a bug, got some troubles or have a feature request - feel free to open an issue.</p>
<p><a href="https://github.com/netzmacht/contao-leaflet-maps/issues" class="btn" target="_blank">Issue
tracker</a></p>
</div>
<div class="col">
<h3>Contribute</h3>
<p>There are many ways you can con&shy;tribute. Translations,
docu&shy;mentation or code contributions are welcome.
</p>
<p><a href="https://netzmacht.de/contao-leaflet/contribute.html" class="btn" target="_blank">Contribute</a>
</p>
</div>
<div class="col">
<h3>Fund a feature</h3>
<p>Contao Leaflet is not feature complete. Have a look at the list of planned feature and support
them.</p>
<p><a href="https://github.com/netzmacht/contao-leaflet-maps/issues?q=is%3Aissue+is%3Aopen+label%3Aenhancement" class="btn" target="_blank">Planned
features</a></p>
</div>
</div>
<div class="row">
<div class="col">
<h3>Individual development</h3>
<p>If you have special requirements you can hire me for an individual development.</p>
<p><a href="https://netzmacht.de/contao-leaflet/contact.html" class="btn" target="_blank">Contact</a></p>
</div>
<div class="col">
<h3>Commercial license</h3>
<p>If you want to remove the attribution in the attribution control, you can purchase a commercial
license.</p>
<p><a href="https://netzmacht.de/contao-leaflet/commercial-license.html" class="btn" target="_blank">Purchase
license</a></p>
</div>
</div>
</div>
<div class="tl_box">
<h2>Credits</h2>
<table class="tl_listing">
<tr>
<th>Name</th>
<th>Version</th>
<th>License</th>
<th>Homepage</th>
</tr>
{% if libraries %}
<tr>
<th colspan="4" class="subtitle">Libraries</th>
</tr>
{% endif %}
{% for library in libraries %}
<tr>
<td>{{ library.name }}</td>
<td>{{ library.version }}</td>
<td>{{ library.license|raw }}</td>
<td>{{ library.homepage|raw }}</td>
</tr>
{% endfor %}
<tr>
<td>url-polyfill</td>
<td>v1.1.0</td>
<td><a href="https://github.com/lifaon74/url-polyfill/blob/master/LICENSE" target="_blank">MIT</a></td>
<td><a href="https://github.com/lifaon74/url-polyfill" target="_blank">github.com/lifaon74/url-polyfill</a></td>
</tr>
<tr>
<th class="subtitle" colspan="4">Graphics</th>
</tr>
<tr>
<td>Farm Fresh-Web Icons</td>
<td>3.9.2</td>
<td><a href="http://creativecommons.org/licenses/by/3.0/us/" target="_blank">CC BY 3.0 US</a></td>
<td><a href="http://www.fatcow.com/free-icons" target="_blank">fatcow.com/free-icons</a></td>
</tr>
<tr>
<td>Web Blog Icons by SEM Labs</td>
<td>3.9.2</td>
<td><a href="http://creativecommons.org/licenses/by/4.0/" target="_blank">CC BY 4.0</a></td>
<td><a href="http://semlabs.co.uk/" target="_blank">semlabs.co.uk</a></td>
</tr>
{% if dependencies %}
<tr>
<th colspan="4" class="subtitle">Dependencies</th>
</tr>
{% endif %}
{% for dep in dependencies %}
<tr>
<td>{{ dep.name }}</td>
<td>{{ dep.version }}</td>
<td>{{ dep.license|raw }}</td>
<td>{{ dep.homepage|raw }}</td>
</tr>
{% endfor %}
</table>
</div>
</div>
{% endblock %}

View File

@@ -90,7 +90,7 @@ class EncoderSubscriber implements EventSubscriberInterface
$value = $event->getValue(); $value = $event->getValue();
$encoder = $event->getEncoder(); $encoder = $event->getEncoder();
$template = 'L.contao.%s(%s, %s, %s, %s, map);'; $template = 'L.contao.%s(%s, %s, %s, %s, map);';
$method = 'loadFile'; $method = 'loadUrl';
if ($value instanceof OmnivoreLayer) { if ($value instanceof OmnivoreLayer) {
$url = $value->getUrl(); $url = $value->getUrl();

View File

@@ -15,7 +15,7 @@ namespace Netzmacht\Contao\Leaflet\Event;
use Contao\Model; use Contao\Model;
use Netzmacht\Contao\Leaflet\Mapper\Request; use Netzmacht\Contao\Leaflet\Mapper\Request;
use Netzmacht\LeafletPHP\Definition; use Netzmacht\LeafletPHP\Definition;
use Symfony\Component\EventDispatcher\Event; use Symfony\Contracts\EventDispatcher\Event;
/** /**
* Class BuildDefinitionEvent is emitted when the mapper maps between the model and the definition. * Class BuildDefinitionEvent is emitted when the mapper maps between the model and the definition.
@@ -36,7 +36,7 @@ class BuildDefinitionEvent extends Event
/** /**
* The model. * The model.
* *
* @var \Model * @var Model
*/ */
private $model; private $model;
@@ -74,7 +74,7 @@ class BuildDefinitionEvent extends Event
/** /**
* Get the model. * Get the model.
* *
* @return \Model * @return Model
*/ */
public function getModel() public function getModel()
{ {

View File

@@ -14,7 +14,7 @@ namespace Netzmacht\Contao\Leaflet\Event;
use Netzmacht\LeafletPHP\Definition; use Netzmacht\LeafletPHP\Definition;
use Netzmacht\LeafletPHP\Value\GeoJson\GeoJsonObject; use Netzmacht\LeafletPHP\Value\GeoJson\GeoJsonObject;
use Symfony\Component\EventDispatcher\Event; use Symfony\Contracts\EventDispatcher\Event;
/** /**
* Class ConvertToGeoJsonEvent is emitted when the DefinitionMapper converts a definition to a geo json feature. * Class ConvertToGeoJsonEvent is emitted when the DefinitionMapper converts a definition to a geo json feature.

View File

@@ -12,7 +12,7 @@
namespace Netzmacht\Contao\Leaflet\Event; namespace Netzmacht\Contao\Leaflet\Event;
use Symfony\Component\EventDispatcher\Event; use Symfony\Contracts\EventDispatcher\Event;
/** /**
* Class GetHashEvent is emitted then a hash for a data object with an unknown type is required. * Class GetHashEvent is emitted then a hash for a data object with an unknown type is required.

View File

@@ -13,7 +13,7 @@
namespace Netzmacht\Contao\Leaflet\Event; namespace Netzmacht\Contao\Leaflet\Event;
use Netzmacht\LeafletPHP\Definition\Map; use Netzmacht\LeafletPHP\Definition\Map;
use Symfony\Component\EventDispatcher\Event; use Symfony\Contracts\EventDispatcher\Event;
/** /**
* Class GetJavascriptEvent is emitted after the map javascript was created. * Class GetJavascriptEvent is emitted after the map javascript was created.

View File

@@ -93,4 +93,24 @@ class DistanceFilter implements Filter
'center' => $this->center, 'center' => $this->center,
]; ];
} }
/**
* Get the center coordinate.
*
* @return LatLng
*/
public function getCenter(): LatLng
{
return $this->center;
}
/**
* Get the distance radius.
*
* @return int
*/
public function getRadius(): int
{
return $this->radius;
}
} }

View File

@@ -18,12 +18,13 @@ use Contao\Database\Result;
use Contao\Input; use Contao\Input;
use Contao\Model; use Contao\Model;
use Contao\Model\Collection; use Contao\Model\Collection;
use Contao\StringUtil;
use Netzmacht\Contao\Leaflet\MapProvider; use Netzmacht\Contao\Leaflet\MapProvider;
use Netzmacht\Contao\Leaflet\Model\MapModel; use Netzmacht\Contao\Leaflet\Model\MapModel;
use Netzmacht\Contao\Toolkit\Component\Hybrid\AbstractHybrid; use Netzmacht\Contao\Toolkit\Component\Hybrid\AbstractHybrid;
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager; use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
use Symfony\Component\Templating\EngineInterface as TemplateEngine; use Symfony\Component\Templating\EngineInterface as TemplateEngine;
use Symfony\Component\Translation\TranslatorInterface as Translator; use Symfony\Contracts\Translation\TranslatorInterface as Translator;
/** /**
* Class HybridTrait provides method required by the frontend module and content element the same time. * Class HybridTrait provides method required by the frontend module and content element the same time.
@@ -118,6 +119,8 @@ abstract class AbstractMapHybrid extends AbstractHybrid
*/ */
protected function prepareTemplateData(array $data): array protected function prepareTemplateData(array $data): array
{ {
$data = parent::prepareTemplateData($data);
try { try {
$template = $this->get('leaflet_template') ?: 'leaflet_map_js'; $template = $this->get('leaflet_template') ?: 'leaflet_map_js';
$mapId = $this->getIdentifier(); $mapId = $this->getIdentifier();
@@ -127,8 +130,8 @@ abstract class AbstractMapHybrid extends AbstractHybrid
$data['mapId'] = $mapId; $data['mapId'] = $mapId;
$style = ''; $style = '';
$height = deserialize($this->get('leaflet_height'), true); $height = StringUtil::deserialize($this->get('leaflet_height'), true);
$width = deserialize($this->get('leaflet_width'), true); $width = StringUtil::deserialize($this->get('leaflet_width'), true);
if (!empty($width['value'])) { if (!empty($width['value'])) {
$style .= 'width:' . $width['value'] . $width['unit'] . ';'; $style .= 'width:' . $width['value'] . $width['unit'] . ';';

View File

@@ -0,0 +1,103 @@
<?php
/**
* Leaflet maps for Contao CMS.
*
* @package contao-leaflet-maps
* @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2014-2018 netzmacht David Molineus. All rights reserved.
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
* @filesource
*/
declare(strict_types=1);
namespace Netzmacht\Contao\Leaflet\Frontend\Action;
use Netzmacht\Contao\Leaflet\Filter\Filter;
use Netzmacht\Contao\Leaflet\Filter\FilterFactory;
use Netzmacht\Contao\Leaflet\MapProvider;
use Symfony\Component\HttpFoundation\JsonResponse;
use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response;
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException;
/**
* Request action which handles request for layer data
*/
final class LayerDataAction
{
/**
* Map provider.
*
* @var MapProvider
*/
private $mapProvider;
/**
* Filter factory.
*
* @var FilterFactory
*/
private $filterFactory;
/**
* LayerDataAction constructor.
*
* @param MapProvider $mapProvider Map provider.
* @param FilterFactory $filterFactory Filter factory.
*/
public function __construct(MapProvider $mapProvider, FilterFactory $filterFactory)
{
$this->mapProvider = $mapProvider;
$this->filterFactory = $filterFactory;
}
/**
* Handle the request.
*
* @param int $layerId The layer id.
* @param string $_format The requested output format.
* @param Request $request The request.
*
* @return Response
*
* @throws BadRequestHttpException When unsupported format is given.
*
* @SuppressWarnings(PHPMD.CamelCaseParameterName)
* @SuppressWarnings(PHPMD.CamelCaseVariableName)
*/
public function __invoke(int $layerId, string $_format, Request $request): Response
{
$filter = $this->createFilter($request);
$data = $this->mapProvider->getFeatureCollection($layerId, $filter);
if ($_format === 'geojson') {
$response = new JsonResponse($data);
$response->setEncodingOptions(JSON_UNESCAPED_SLASHES);
return $response;
}
throw new BadRequestHttpException(sprintf('Unsupported format "%s"', $_format));
}
/**
* Create the filter if defined in the request.
*
* @param Request $request The request.
*
* @return Filter|null
*/
private function createFilter(Request $request): ?Filter
{
if (!$request->query->has('filter')) {
return null;
}
$filter = (string) $request->query->get('filter');
$values = (string) $request->query->get('values');
return $this->filterFactory->create($filter, $values);
}
}

View File

@@ -5,7 +5,8 @@
* *
* @package contao-leaflet-maps * @package contao-leaflet-maps
* @author David Molineus <david.molineus@netzmacht.de> * @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2014-2017 netzmacht David Molineus. All rights reserved. * @author Sven Baumnn <baumann.sv@gmail.com>
* @copyright 2014-2022 netzmacht David Molineus. All rights reserved.
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE * @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
* @filesource * @filesource
*/ */
@@ -15,6 +16,7 @@ declare(strict_types=1);
namespace Netzmacht\Contao\Leaflet\Frontend\Assets; namespace Netzmacht\Contao\Leaflet\Frontend\Assets;
use Contao\CoreBundle\Framework\ContaoFrameworkInterface as ContaoFramework; use Contao\CoreBundle\Framework\ContaoFrameworkInterface as ContaoFramework;
use Traversable;
/** /**
* Class LibrariesConfiguration. * Class LibrariesConfiguration.
@@ -45,7 +47,7 @@ class LibrariesConfiguration implements \IteratorAggregate, \ArrayAccess
* *
* @SuppressWarnings(PHPMD.Superglobals) * @SuppressWarnings(PHPMD.Superglobals)
*/ */
public function getIterator() public function getIterator(): Traversable
{ {
$this->framework->initialize(); $this->framework->initialize();
@@ -57,7 +59,7 @@ class LibrariesConfiguration implements \IteratorAggregate, \ArrayAccess
* *
* @SuppressWarnings(PHPMD.Superglobals) * @SuppressWarnings(PHPMD.Superglobals)
*/ */
public function offsetExists($offset) public function offsetExists($offset): bool
{ {
$this->framework->initialize(); $this->framework->initialize();
@@ -81,7 +83,7 @@ class LibrariesConfiguration implements \IteratorAggregate, \ArrayAccess
* *
* @SuppressWarnings(PHPMD.Superglobals) * @SuppressWarnings(PHPMD.Superglobals)
*/ */
public function offsetSet($offset, $value) public function offsetSet($offset, $value): void
{ {
$this->framework->initialize(); $this->framework->initialize();
@@ -93,7 +95,7 @@ class LibrariesConfiguration implements \IteratorAggregate, \ArrayAccess
* *
* @SuppressWarnings(PHPMD.Superglobals) * @SuppressWarnings(PHPMD.Superglobals)
*/ */
public function offsetUnset($offset) public function offsetUnset($offset): void
{ {
$this->framework->initialize(); $this->framework->initialize();

View File

@@ -22,7 +22,7 @@ use Netzmacht\Contao\Toolkit\Component\Component;
use Netzmacht\Contao\Toolkit\Component\ComponentFactory; use Netzmacht\Contao\Toolkit\Component\ComponentFactory;
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager; use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
use Symfony\Component\Templating\EngineInterface as TemplateEngine; use Symfony\Component\Templating\EngineInterface as TemplateEngine;
use Symfony\Component\Translation\TranslatorInterface as Translator; use Symfony\Contracts\Translation\TranslatorInterface as Translator;
/** /**
* Class MapElementFactory * Class MapElementFactory

View File

@@ -12,14 +12,18 @@
namespace Netzmacht\Contao\Leaflet\Frontend; namespace Netzmacht\Contao\Leaflet\Frontend;
use const E_USER_DEPRECATED;
use Netzmacht\Contao\Leaflet\Filter\Filter; use Netzmacht\Contao\Leaflet\Filter\Filter;
use Netzmacht\Contao\Leaflet\Filter\FilterFactory; use Netzmacht\Contao\Leaflet\Filter\FilterFactory;
use Netzmacht\Contao\Leaflet\MapProvider; use Netzmacht\Contao\Leaflet\MapProvider;
use function trigger_error;
/** /**
* The data controller handles ajax request for sub data. * The data controller handles ajax request for sub data.
* *
* @package Netzmacht\Contao\Leaflet\Frontend * @package Netzmacht\Contao\Leaflet\Frontend
*
* @deprecated
*/ */
class DataController class DataController
{ {
@@ -60,6 +64,13 @@ class DataController
{ {
$this->debugMode = $debugMode; $this->debugMode = $debugMode;
$this->filterFactory = $filterFactory; $this->filterFactory = $filterFactory;
// @codingStandardsIgnoreStart
@trigger_error(
'Deprecated since 3.1.0 and will be removed in 4.0.0 - Use properly route instead.',
E_USER_DEPRECATED
);
// @codingStandardsIgnoreEnd
} }
/** /**
@@ -82,7 +93,7 @@ class DataController
$filter = null; $filter = null;
} }
list($data, $error) = $this->loadData($mapProvider, $input['type'], $input['id'], $filter); [$data, $error] = $this->loadData($mapProvider, $input['type'], $input['id'], $filter);
$this->encodeData($input['format'], $data); $this->encodeData($input['format'], $data);
} catch (\Exception $e) { } catch (\Exception $e) {
if ($this->debugMode) { if ($this->debugMode) {

View File

@@ -14,7 +14,6 @@ declare(strict_types=1);
namespace Netzmacht\Contao\Leaflet\Frontend\Module; namespace Netzmacht\Contao\Leaflet\Frontend\Module;
use Contao\Config;
use Contao\CoreBundle\Framework\Adapter; use Contao\CoreBundle\Framework\Adapter;
use Contao\Input; use Contao\Input;
use Netzmacht\Contao\Leaflet\MapProvider; use Netzmacht\Contao\Leaflet\MapProvider;
@@ -22,7 +21,7 @@ use Netzmacht\Contao\Toolkit\Component\Component;
use Netzmacht\Contao\Toolkit\Component\ComponentFactory; use Netzmacht\Contao\Toolkit\Component\ComponentFactory;
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager; use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
use Symfony\Component\Templating\EngineInterface as TemplateEngine; use Symfony\Component\Templating\EngineInterface as TemplateEngine;
use Symfony\Component\Translation\TranslatorInterface as Translator; use Symfony\Contracts\Translation\TranslatorInterface as Translator;
/** /**
* Class MapElementFactory * Class MapElementFactory

View File

@@ -0,0 +1,47 @@
<?php
/**
* Leaflet maps for Contao CMS.
*
* @package contao-leaflet-maps
* @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2014-2018 netzmacht David Molineus. All rights reserved.
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
* @filesource
*/
declare(strict_types=1);
namespace Netzmacht\Contao\Leaflet\Frontend;
use Netzmacht\Contao\PageContext\Exception\DeterminePageIdFailed;
use Netzmacht\Contao\PageContext\Request\PageIdDeterminator as PageContextPageIdDeterminator;
use Symfony\Component\HttpFoundation\Request;
/**
* Class ApiPageIdDeterminator
*/
final class PageIdDeterminator implements PageContextPageIdDeterminator
{
/**
* {@inheritDoc}
*/
public function match(Request $request): bool
{
return ($request->attributes->get('_leaflet_scope') === 'page' && $request->query->get('context') === 'page');
}
/**
* {@inheritDoc}
*
* @throws DeterminePageIdFailed When no context id is given.
*/
public function determinate(Request $request): int
{
if (!$request->query->has('contextId')) {
throw new DeterminePageIdFailed('Could not determine page id for from request.');
}
return $request->query->getInt('contextId');
}
}

View File

@@ -12,6 +12,8 @@
namespace Netzmacht\Contao\Leaflet\Frontend; namespace Netzmacht\Contao\Leaflet\Frontend;
use Contao\Config;
use Contao\Frontend;
use Netzmacht\Contao\Leaflet\Filter\Filter; use Netzmacht\Contao\Leaflet\Filter\Filter;
use Netzmacht\Contao\Leaflet\Mapper\Request; use Netzmacht\Contao\Leaflet\Mapper\Request;
@@ -19,6 +21,8 @@ use Netzmacht\Contao\Leaflet\Mapper\Request;
* Class RequestUrl creates the request url. * Class RequestUrl creates the request url.
* *
* @package Netzmacht\Contao\Leaflet\Request * @package Netzmacht\Contao\Leaflet\Request
*
* @deprecated
*/ */
class RequestUrl implements \JsonSerializable class RequestUrl implements \JsonSerializable
{ {
@@ -72,7 +76,7 @@ class RequestUrl implements \JsonSerializable
$query .= '&amp;f=' . $filter->getName() . '&amp;v=' . $filter->toRequest(); $query .= '&amp;f=' . $filter->getName() . '&amp;v=' . $filter->toRequest();
} }
$url = \Config::get('websitePath') . '/' . \Frontend::addToUrl($query, false); $url = Config::get('websitePath') . '/' . Frontend::addToUrl($query, false);
return new static($url, $hash, $request); return new static($url, $hash, $request);
} }
@@ -87,6 +91,13 @@ class RequestUrl implements \JsonSerializable
{ {
$this->url = $url; $this->url = $url;
$this->hash = $hash; $this->hash = $hash;
// @codingStandardsIgnoreStart
@trigger_error(
'Deprecated since 3.1.0 and will be removed in 4.0.0. Use The router instead.',
E_USER_DEPRECATED
);
// @codingStandardsIgnoreEnd
} }
/** /**

View File

@@ -73,6 +73,8 @@ class ValueFilter
*/ */
public function filter($value) public function filter($value)
{ {
return $this->getReplacer()->replace($value); $value = $this->getReplacer()->replace($value, false);
return $value;
} }
} }

View File

@@ -0,0 +1,107 @@
<?php
/**
* Leaflet maps for Contao CMS.
*
* @package contao-leaflet-maps
* @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2014-2018 netzmacht David Molineus. All rights reserved.
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
* @filesource
*/
declare(strict_types=1);
namespace Netzmacht\Contao\Leaflet\Listener\Backend;
use Contao\CoreBundle\Event\MenuEvent;
use Netzmacht\Contao\Toolkit\View\Assets\AssetsManager;
use Symfony\Component\HttpFoundation\RequestStack;
use Symfony\Component\Routing\RouterInterface as Router;
use Symfony\Contracts\Translation\TranslatorInterface as Translator;
/**
* Class BackendMenuListener adds backend entries to the navigation.
*/
final class UserNavigationListener
{
/**
* Request stack.
*
* @var RequestStack
*/
private $requestStack;
/**
* Router.
*
* @var Router
*/
private $router;
/**
* Translator.
*
* @var Translator
*/
private $translator;
/**
* Assets manager.
*
* @var AssetsManager
*/
private $assets;
/**
* BackendUserNavigationListener constructor.
*
* @param RequestStack $requestStack Request stack.
* @param Router $router Router.
* @param Translator $translator Translator.
* @param AssetsManager $assets Assets manager.
*/
public function __construct(
RequestStack $requestStack,
Router $router,
Translator $translator,
AssetsManager $assets
) {
$this->requestStack = $requestStack;
$this->router = $router;
$this->translator = $translator;
$this->assets = $assets;
}
/**
* Handle the event.
*
* @param array $modules Backend navigation modules.
*
* @return array
*/
public function __invoke(array $modules): array
{
if (!isset($modules['leaflet'])) {
return $modules;
}
$request = $this->requestStack->getCurrentRequest();
$isActive = $request && $request->attributes->get('_backend_module') === 'leaflet_about';
$modules['leaflet']['modules']['leaflet_about'] = [
'label' => $this->translator->trans('MOD.leaflet_about.0', [], 'contao_modules'),
'title' => $this->translator->trans('MOD.leaflet_about.1', [], 'contao_modules'),
'href' => $this->router->generate('leaflet_backend_about'),
'icon' => 'bundles/netzmachtcontaoleaflet/img/about.png',
'class' => 'navigation leaflet_about',
'isActive' => $isActive,
];
if ($isActive) {
$this->assets->addStylesheet('bundles/netzmachtcontaoleaflet/css/about.css');
}
return $modules;
}
}

View File

@@ -147,9 +147,9 @@ class ControlDcaListener extends AbstractListener
$statement = $this->connection->prepare($query); $statement = $this->connection->prepare($query);
$statement->bindValue('cid', $dataContainer->id); $statement->bindValue('cid', $dataContainer->id);
$statement->execute(); $result = $statement->executeQuery();
return $statement->fetchAll(); return $result->fetchAllAssociative();
} }
/** /**
@@ -167,9 +167,9 @@ class ControlDcaListener extends AbstractListener
$query = 'SELECT * FROM tl_leaflet_control_layer WHERE cid=:cid order BY sorting'; $query = 'SELECT * FROM tl_leaflet_control_layer WHERE cid=:cid order BY sorting';
$statement = $this->connection->prepare($query); $statement = $this->connection->prepare($query);
$statement->bindValue('cid', $dataContainer->id); $statement->bindValue('cid', $dataContainer->id);
$statement->execute(); $result = $statement->executeQuery();
while ($row = $statement->fetch()) { while ($row = $result->fetchAssociative()) {
$values[$row['lid']] = $row; $values[$row['lid']] = $row;
} }

View File

@@ -20,7 +20,7 @@ use Contao\StringUtil;
use Netzmacht\Contao\Leaflet\Model\MapModel; use Netzmacht\Contao\Leaflet\Model\MapModel;
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager; use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
use Netzmacht\Contao\Toolkit\Dca\Options\OptionsBuilder; use Netzmacht\Contao\Toolkit\Dca\Options\OptionsBuilder;
use Symfony\Component\Translation\TranslatorInterface as Translator; use Symfony\Contracts\Translation\TranslatorInterface as Translator;
/** /**
* Class Module is the helper for the tl_module dca. * Class Module is the helper for the tl_module dca.
@@ -103,7 +103,7 @@ final class FrontendIntegrationListener
) )
), ),
Image::getHtml( Image::getHtml(
'alias.gif', 'alias.svg',
$this->translator->trans('editalias.0', [$dataContainer->value], 'contao_tl_content'), $this->translator->trans('editalias.0', [$dataContainer->value], 'contao_tl_content'),
'style="vertical-align:top"' 'style="vertical-align:top"'
) )

View File

@@ -25,7 +25,7 @@ use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
use Netzmacht\Contao\Toolkit\Dca\Listener\AbstractListener; use Netzmacht\Contao\Toolkit\Dca\Listener\AbstractListener;
use Netzmacht\Contao\Toolkit\Dca\Manager; use Netzmacht\Contao\Toolkit\Dca\Manager;
use Netzmacht\Contao\Toolkit\Dca\Options\OptionsBuilder; use Netzmacht\Contao\Toolkit\Dca\Options\OptionsBuilder;
use Symfony\Component\Translation\TranslatorInterface as Translator; use Symfony\Contracts\Translation\TranslatorInterface as Translator;
/** /**
* Class Layer is the helper class for the tl_leaflet_layer dca. * Class Layer is the helper class for the tl_leaflet_layer dca.
@@ -197,7 +197,7 @@ class LayerDcaListener extends AbstractListener
if (!empty($this->layers[$row['type']]['icon'])) { if (!empty($this->layers[$row['type']]['icon'])) {
$src = $this->layers[$row['type']]['icon']; $src = $this->layers[$row['type']]['icon'];
} else { } else {
$src = 'iconPLAIN.gif'; $src = 'iconPLAIN.svg';
} }
$activeIcon = $src; $activeIcon = $src;
@@ -275,12 +275,12 @@ class LayerDcaListener extends AbstractListener
$pasteAfterUrl, $pasteAfterUrl,
StringUtil::specialchars($this->translator->trans('pasteafter.1', [$row['id']], 'contao_' . $table)), StringUtil::specialchars($this->translator->trans('pasteafter.1', [$row['id']], 'contao_' . $table)),
Image::getHtml( Image::getHtml(
'pasteafter.gif', 'pasteafter.svg',
$this->translator->trans('pasteafter.1', [$row['id']], 'contao_' . $table) $this->translator->trans('pasteafter.1', [$row['id']], 'contao_' . $table)
) )
); );
if (!empty($this->layers[$row['type']]['children'])) { if (isset($row['type']) && !empty($this->layers[$row['type']]['children'])) {
$pasteIntoUrl = $this->backendAdapter->addToUrl( $pasteIntoUrl = $this->backendAdapter->addToUrl(
sprintf( sprintf(
'act=%s&amp;mode=2&amp;pid=%s%s', 'act=%s&amp;mode=2&amp;pid=%s%s',
@@ -295,12 +295,12 @@ class LayerDcaListener extends AbstractListener
$pasteIntoUrl, $pasteIntoUrl,
StringUtil::specialchars($this->translator->trans('pasteinto.1', [$row['id']], 'contao_' . $table)), StringUtil::specialchars($this->translator->trans('pasteinto.1', [$row['id']], 'contao_' . $table)),
Image::getHtml( Image::getHtml(
'pasteinto.gif', 'pasteinto.svg',
$this->translator->trans('pasteinto.1', [$row['id']], 'contao_' . $table) $this->translator->trans('pasteinto.1', [$row['id']], 'contao_' . $table)
) )
); );
} elseif ($row['id'] > 0) { } elseif ($row['id'] > 0) {
$buffer .= Image::getHtml('pasteinto_.gif'); $buffer .= Image::getHtml('pasteinto_.svg');
} }
return $buffer; return $buffer;
@@ -361,25 +361,25 @@ class LayerDcaListener extends AbstractListener
if ($undoId) { if ($undoId) {
$statement = $this->connection->prepare('SELECT * FROM tl_undo WHERE id=:id LIMIT 0,1'); $statement = $this->connection->prepare('SELECT * FROM tl_undo WHERE id=:id LIMIT 0,1');
$statement->bindValue('id', $undoId); $statement->bindValue('id', $undoId);
$statement->execute(); $result = $statement->executeQuery();
$undo = $statement->fetch(); $undo = $result->fetchAssociative();
$statement = $this->connection->prepare('SELECT * FROM tl_leaflet_map_layer WHERE lid=:lid'); $statement = $this->connection->prepare('SELECT * FROM tl_leaflet_map_layer WHERE lid=:lid');
$statement->bindValue('lid', $dataContainer->id); $statement->bindValue('lid', $dataContainer->id);
$statement->execute(); $result = $statement->executeQuery();
$undo['data'] = StringUtil::deserialize($undo['data'], true); $undo['data'] = StringUtil::deserialize($undo['data'], true);
while ($row = $statement->fetch()) { while ($row = $result->fetchAssociative()) {
$undo['data']['tl_leaflet_map_layer'][] = $row; $undo['data']['tl_leaflet_map_layer'][] = $row;
} }
$statement = $this->connection->prepare('SELECT * FROM tl_leaflet_control_layer WHERE lid=:lid'); $statement = $this->connection->prepare('SELECT * FROM tl_leaflet_control_layer WHERE lid=:lid');
$statement->bindValue('lid', $dataContainer->id); $statement->bindValue('lid', $dataContainer->id);
$statement->execute(); $result = $statement->executeQuery();
$undo['data']['tl_leaflet_control_layer'] = $statement->fetchAll(); $undo['data']['tl_leaflet_control_layer'] = $result->fetchAllAssociative();
$this->connection->update('tl_undo', ['data' => $undo['data']], ['id' => $undo['id']]); $this->connection->update('tl_undo', ['data' => $undo['data']], ['id' => $undo['id']]);
} }
@@ -517,9 +517,9 @@ class LayerDcaListener extends AbstractListener
{ {
return sprintf( return sprintf(
'<a href="%s" title="%s">%s</a> ', '<a href="%s" title="%s">%s</a> ',
\Backend::addToUrl($href . '&amp;id=' . $row['id']), Backend::addToUrl($href . '&amp;id=' . $row['id']),
$title, $title,
\Image::getHtml($icon, $label, $attributes) Image::getHtml($icon, $label, $attributes)
); );
} }
} }

View File

@@ -17,9 +17,9 @@ use Contao\DataContainer;
use Contao\System; use Contao\System;
use Netzmacht\Contao\Leaflet\Model\LayerModel; use Netzmacht\Contao\Leaflet\Model\LayerModel;
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager; use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
use Netzmacht\Contao\Toolkit\View\Template\TemplateRenderer;
use Netzmacht\LeafletPHP\Value\LatLng; use Netzmacht\LeafletPHP\Value\LatLng;
use Symfony\Component\Filesystem\Filesystem; use Symfony\Component\Filesystem\Filesystem;
use Symfony\Component\Templating\EngineInterface as TemplateEngine;
/** /**
* Class Leaflet is the base helper providing different methods. * Class Leaflet is the base helper providing different methods.
@@ -50,11 +50,11 @@ class LeafletDcaListener
private $repositoryManager; private $repositoryManager;
/** /**
* Template engine. * Template renderer.
* *
* @var TemplateEngine * @var TemplateRenderer
*/ */
private $templateEngine; private $templateRenderer;
/** /**
* System adapter. * System adapter.
@@ -67,20 +67,20 @@ class LeafletDcaListener
* LeafletCallbacks constructor. * LeafletCallbacks constructor.
* *
* @param RepositoryManager $repositoryManager Repository manager. * @param RepositoryManager $repositoryManager Repository manager.
* @param TemplateEngine $templateEngine Template engine. * @param TemplateRenderer $templateRenderer Template renderer.
* @param Filesystem $fileSystem File system. * @param Filesystem $fileSystem File system.
* @param Adapter|System $systemAdapter Contao system adapter. * @param Adapter|System $systemAdapter Contao system adapter.
* @param string $cacheDir Cache dir. * @param string $cacheDir Cache dir.
*/ */
public function __construct( public function __construct(
RepositoryManager $repositoryManager, RepositoryManager $repositoryManager,
TemplateEngine $templateEngine, TemplateRenderer $templateRenderer,
Filesystem $fileSystem, Filesystem $fileSystem,
$systemAdapter, $systemAdapter,
string $cacheDir string $cacheDir
) { ) {
$this->repositoryManager = $repositoryManager; $this->repositoryManager = $repositoryManager;
$this->templateEngine = $templateEngine; $this->templateRenderer = $templateRenderer;
$this->fileSystem = $fileSystem; $this->fileSystem = $fileSystem;
$this->systemAdapter = $systemAdapter; $this->systemAdapter = $systemAdapter;
$this->cacheDir = $cacheDir; $this->cacheDir = $cacheDir;
@@ -122,9 +122,10 @@ class LeafletDcaListener
$data['marker'] = json_encode($latLng); $data['marker'] = json_encode($latLng);
} catch (\Exception $e) { } catch (\Exception $e) {
// LatLng throws an exception of value could not be created. Just let the value empty when. // LatLng throws an exception of value could not be created. Just let the value empty when.
$data['marker'] = null;
} }
return $this->templateEngine->render('toolkit:be:be_leaflet_geocode.html5', $data); return $this->templateRenderer->render('be:be_leaflet_geocode', $data);
} }
/** /**

View File

@@ -15,14 +15,17 @@ declare(strict_types=1);
namespace Netzmacht\Contao\Leaflet\Listener\Dca; namespace Netzmacht\Contao\Leaflet\Listener\Dca;
use Contao\DataContainer; use Contao\DataContainer;
use Contao\Input;
use Contao\StringUtil; use Contao\StringUtil;
use Doctrine\DBAL\Connection; use Doctrine\DBAL\Connection;
use Netzmacht\Contao\Leaflet\Model\LayerModel; use Netzmacht\Contao\Leaflet\Model\LayerModel;
use Netzmacht\Contao\Leaflet\Model\MapModel;
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager; use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
use Netzmacht\Contao\Toolkit\Dca\Listener\AbstractListener; use Netzmacht\Contao\Toolkit\Dca\Listener\AbstractListener;
use Netzmacht\Contao\Toolkit\Dca\Manager; use Netzmacht\Contao\Toolkit\Dca\Manager;
use Netzmacht\Contao\Toolkit\Dca\Options\OptionsBuilder; use Netzmacht\Contao\Toolkit\Dca\Options\OptionsBuilder;
use PDO; use Symfony\Component\HttpFoundation\Session\Session;
use Symfony\Contracts\Translation\TranslatorInterface as Translator;
/** /**
* Class Map is the helper class for the tl_leaflet_map dca. * Class Map is the helper class for the tl_leaflet_map dca.
@@ -52,19 +55,70 @@ class MapDcaListener extends AbstractListener
*/ */
private $repositoryManager; private $repositoryManager;
/**
* Translator.
*
* @var Translator
*/
private $translator;
/**
* Session.
*
* @var Session
*/
private $session;
/** /**
* Construct. * Construct.
* *
* @param Manager $manager Data container manager. * @param Manager $manager Data container manager.
* @param Connection $connection Database connection. * @param Connection $connection Database connection.
* @param RepositoryManager $repositoryManager Repository manager. * @param RepositoryManager $repositoryManager Repository manager.
* @param Translator $translator Translator.
* @param Session $session Session.
*/ */
public function __construct(Manager $manager, Connection $connection, RepositoryManager $repositoryManager) public function __construct(
{ Manager $manager,
Connection $connection,
RepositoryManager $repositoryManager,
Translator $translator,
Session $session
) {
parent::__construct($manager); parent::__construct($manager);
$this->connection = $connection; $this->connection = $connection;
$this->repositoryManager = $repositoryManager; $this->repositoryManager = $repositoryManager;
$this->translator = $translator;
$this->session = $session;
}
/**
* Add warnings for incomplete configurations.
*
* @param DataContainer $dataContainer The data container driver.
*
* @return void
*/
public function addIncompleteConfigurationWarning($dataContainer): void
{
if (Input::get('act') !== 'edit') {
return;
}
$repository = $this->repositoryManager->getRepository(MapModel::class);
$map = $repository->find((int) $dataContainer->id);
if (!$map) {
return;
}
if ($map->zoom === null || $map->zoom === '') {
$this->session->getFlashBag()->add(
'contao.BE.info',
$this->translator->trans('ERR.leafletMissingZoomLevel', [], 'contao_default')
);
}
} }
/** /**
@@ -81,12 +135,9 @@ class MapDcaListener extends AbstractListener
{ {
$statement = $this->connection->prepare('SELECT lid FROM tl_leaflet_map_layer WHERE mid=:mid ORDER BY sorting'); $statement = $this->connection->prepare('SELECT lid FROM tl_leaflet_map_layer WHERE mid=:mid ORDER BY sorting');
$statement->bindValue('mid', $dataContainer->id); $statement->bindValue('mid', $dataContainer->id);
$result = $statement->executeQuery();
if ($statement->execute()) { return $result->fetchFirstColumn();
return $statement->fetchAll(PDO::FETCH_COLUMN, 0);
}
return [];
} }
/** /**
@@ -104,9 +155,9 @@ class MapDcaListener extends AbstractListener
$statement = $this->connection->prepare('SELECT * FROM tl_leaflet_map_layer WHERE mid=:mid order BY sorting'); $statement = $this->connection->prepare('SELECT * FROM tl_leaflet_map_layer WHERE mid=:mid order BY sorting');
$statement->bindValue('mid', $dataContainer->id); $statement->bindValue('mid', $dataContainer->id);
$statement->execute(); $result = $statement->executeQuery();
while ($row = $statement->fetch()) { while ($row = $result->fetchAssociative()) {
$values[$row['lid']] = $row; $values[$row['lid']] = $row;
} }
@@ -171,4 +222,26 @@ class MapDcaListener extends AbstractListener
->asTree() ->asTree()
->getOptions(); ->getOptions();
} }
/**
* Copy layer relations if a map is duplicated.
*
* @param string|int $insertId Insert id of the new map.
* @param DataContainer $dataContainer Data container driver.
*
* @return void
*/
public function copyLayerRelations($insertId, DataContainer $dataContainer): void
{
$statement = $this->connection->prepare('SELECT * FROM tl_leaflet_map_layer WHERE mid=:mid order BY sorting');
$statement->bindValue('mid', $dataContainer->id);
$result = $statement->executeQuery();
while ($row = $result->fetchAssociative()) {
unset($row['id']);
$row['tstamp'] = time();
$row['mid'] = $insertId;
$this->connection->insert('tl_leaflet_map_layer', $row);
}
}
} }

View File

@@ -13,6 +13,7 @@
namespace Netzmacht\Contao\Leaflet\Listener\Dca; namespace Netzmacht\Contao\Leaflet\Listener\Dca;
use Contao\Controller; use Contao\Controller;
use Contao\StringUtil;
use Doctrine\DBAL\Connection; use Doctrine\DBAL\Connection;
use Netzmacht\Contao\Leaflet\Model\IconModel; use Netzmacht\Contao\Leaflet\Model\IconModel;
use Netzmacht\Contao\Leaflet\Model\PopupModel; use Netzmacht\Contao\Leaflet\Model\PopupModel;
@@ -113,7 +114,7 @@ class MarkerDcaListener
'altitude' => null, 'altitude' => null,
]; ];
$values = trimsplit(',', $value); $values = StringUtil::trimsplit(',', $value);
$keys = array_keys($combined); $keys = array_keys($combined);
$count = count($values); $count = count($values);
@@ -144,9 +145,9 @@ class MarkerDcaListener
$statement = $this->connection->prepare($query); $statement = $this->connection->prepare($query);
$statement->bindValue('id', $dataContainer->id); $statement->bindValue('id', $dataContainer->id);
$statement->execute(); $result = $statement->executeQuery();
if ($row = $statement->fetch()) { if ($row = $result->fetchAssociative()) {
$buffer = $row['latitude']; $buffer = $row['latitude'];
if ($buffer && $row['longitude']) { if ($buffer && $row['longitude']) {

View File

@@ -13,9 +13,10 @@
namespace Netzmacht\Contao\Leaflet\Listener\Dca; namespace Netzmacht\Contao\Leaflet\Listener\Dca;
use Contao\DataContainer; use Contao\DataContainer;
use Contao\StringUtil;
use Netzmacht\Contao\Toolkit\Dca\Manager; use Netzmacht\Contao\Toolkit\Dca\Manager;
use Netzmacht\LeafletPHP\Value\LatLng; use Netzmacht\LeafletPHP\Value\LatLng;
use Symfony\Component\Translation\TranslatorInterface as Translator; use Symfony\Contracts\Translation\TranslatorInterface as Translator;
/** /**
* Class Validator. * Class Validator.
@@ -116,7 +117,7 @@ class Validator
*/ */
public function validateMultipleCoordinateSets($values, $dataContainer) public function validateMultipleCoordinateSets($values, $dataContainer)
{ {
$sets = deserialize($values, true); $sets = StringUtil::deserialize($values, true);
foreach ($sets as $lines) { foreach ($sets as $lines) {
$this->validateMultipleCoordinates($lines, $dataContainer); $this->validateMultipleCoordinates($lines, $dataContainer);
} }

View File

@@ -16,6 +16,7 @@ namespace Netzmacht\Contao\Leaflet\Listener;
use Contao\FilesModel; use Contao\FilesModel;
use Contao\Model; use Contao\Model;
use Contao\StringUtil;
use Netzmacht\Contao\Leaflet\Event\ConvertToGeoJsonEvent; use Netzmacht\Contao\Leaflet\Event\ConvertToGeoJsonEvent;
use Netzmacht\Contao\Leaflet\Model\LayerModel; use Netzmacht\Contao\Leaflet\Model\LayerModel;
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager; use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
@@ -117,7 +118,7 @@ final class GeoJsonListener
public function enrichObjects(GeoJsonObject $feature, LeafletDefinition $definition, $model) public function enrichObjects(GeoJsonObject $feature, LeafletDefinition $definition, $model)
{ {
if (($definition instanceof Marker || $definition instanceof Vector) if (($definition instanceof Marker || $definition instanceof Vector)
&& $model instanceof \Model && $feature instanceof Feature) { && $model instanceof Model && $feature instanceof Feature) {
$this->setDataProperty($model, $feature); $this->setDataProperty($model, $feature);
$this->setBoundsInformation($model, $feature); $this->setBoundsInformation($model, $feature);
} }
@@ -148,7 +149,7 @@ final class GeoJsonListener
*/ */
public function setModelData(GeoJsonObject $feature, $model) public function setModelData(GeoJsonObject $feature, $model)
{ {
if (!$model instanceof \Model || !$feature instanceof Feature if (!$model instanceof Model || !$feature instanceof Feature
|| empty($this->featureModelProperties[$model->getTable()])) { || empty($this->featureModelProperties[$model->getTable()])) {
return; return;
} }
@@ -169,21 +170,21 @@ final class GeoJsonListener
/** /**
* Parse the model value based on the config. * Parse the model value based on the config.
* *
* @param \Model $model The model. * @param Model $model The model.
* @param mixed $property The property config. * @param mixed $property The property config.
* *
* @return array|mixed|null * @return array|mixed|null
*/ */
private function parseModelValue(\Model $model, &$property) private function parseModelValue(Model $model, &$property)
{ {
if (is_array($property)) { if (is_array($property)) {
list($property, $type) = $property; [$property, $type] = $property;
$value = $model->$property; $value = $model->$property;
switch ($type) { switch ($type) {
case 'array': case 'array':
case 'object': case 'object':
$value = deserialize($value, true); $value = StringUtil::deserialize($value, true);
break; break;
case 'file': case 'file':
@@ -194,7 +195,7 @@ final class GeoJsonListener
case 'files': case 'files':
$repository = $this->repositoryManager->getRepository(FilesModel::class); $repository = $this->repositoryManager->getRepository(FilesModel::class);
$collection = $repository->findMultipleByUuids(deserialize($value, true)); $collection = $repository->findMultipleByUuids(StringUtil::deserialize($value, true));
if ($collection) { if ($collection) {
$value = $collection->fetchEach('path'); $value = $collection->fetchEach('path');

View File

@@ -12,6 +12,7 @@
namespace Netzmacht\Contao\Leaflet\Listener; namespace Netzmacht\Contao\Leaflet\Listener;
use Contao\Model;
use Netzmacht\Contao\Leaflet\Event\GetHashEvent; use Netzmacht\Contao\Leaflet\Event\GetHashEvent;
use Symfony\Component\EventDispatcher\EventSubscriberInterface; use Symfony\Component\EventDispatcher\EventSubscriberInterface;
@@ -46,7 +47,7 @@ class HashSubscriber implements EventSubscriberInterface
{ {
$data = $event->getData(); $data = $event->getData();
if ($data instanceof \Model) { if ($data instanceof Model) {
$event->setHash($data->getTable() . '::' . $data->{$data->getPk()}); $event->setHash($data->getTable() . '::' . $data->{$data->getPk()});
} }
} }

View File

@@ -14,6 +14,7 @@ declare(strict_types=1);
namespace Netzmacht\Contao\Leaflet\Listener; namespace Netzmacht\Contao\Leaflet\Listener;
use Contao\File;
use Netzmacht\Contao\Leaflet\Encoder\ContaoAssets; use Netzmacht\Contao\Leaflet\Encoder\ContaoAssets;
use Netzmacht\Contao\Leaflet\Frontend\Assets\LibrariesConfiguration; use Netzmacht\Contao\Leaflet\Frontend\Assets\LibrariesConfiguration;
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper; use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
@@ -117,7 +118,7 @@ class LoadAssetsListener
// TODO: Cache it. // TODO: Cache it.
// codingStandardsIgnoreEnd // codingStandardsIgnoreEnd
$file = new \File('assets/leaflet/js/icons.js'); $file = new File('assets/leaflet/js/icons.js');
$file->write($buffer); $file->write($buffer);
$file->close(); $file->close();
@@ -142,12 +143,12 @@ class LoadAssetsListener
$assets = $this->libraries[$library]; $assets = $this->libraries[$library];
if (!empty($assets['css'])) { if (!empty($assets['css'])) {
list ($source, $type) = (array) $assets['css']; [$source, $type] = array_pad((array) $assets['css'], 2, null);
$this->assets->addStylesheet($source, $type ?: Assets::TYPE_FILE); $this->assets->addStylesheet($source, $type ?: Assets::TYPE_FILE);
} }
if (!empty($assets['javascript'])) { if (!empty($assets['javascript'])) {
list ($source, $type) = (array) $assets['javascript']; [$source, $type] = array_pad((array) $assets['javascript'], 2, null);
$this->assets->addJavascript($source, $type ?: Assets::TYPE_FILE); $this->assets->addJavascript($source, $type ?: Assets::TYPE_FILE);
} }
} }

View File

@@ -60,11 +60,11 @@ final class RegisterLibrariesListener
{ {
foreach ($this->libraries as $name => $assets) { foreach ($this->libraries as $name => $assets) {
if (!empty($assets['css'])) { if (!empty($assets['css'])) {
list ($source, $type) = (array) $assets['css']; [$source, $type] = array_pad((array) $assets['css'], 2, null);
$this->leaflet->registerStylesheet($name, $source, $type ?: Assets::TYPE_FILE); $this->leaflet->registerStylesheet($name, $source, $type ?: Assets::TYPE_FILE);
} }
if (!empty($assets['javascript'])) { if (!empty($assets['javascript'])) {
list ($source, $type) = (array) $assets['javascript']; [$source, $type] = array_pad((array) $assets['javascript'], 2, null);
$this->leaflet->registerJavascript($name, $source, $type ?: Assets::TYPE_FILE); $this->leaflet->registerJavascript($name, $source, $type ?: Assets::TYPE_FILE);
} }
} }

View File

@@ -5,6 +5,7 @@
* *
* @package contao-leaflet-maps * @package contao-leaflet-maps
* @author David Molineus <david.molineus@netzmacht.de> * @author David Molineus <david.molineus@netzmacht.de>
* @author Stefan Heimes <stefan_heimes@hotmail.com>
* @copyright 2014-2017 netzmacht David Molineus. All rights reserved. * @copyright 2014-2017 netzmacht David Molineus. All rights reserved.
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE * @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
* @filesource * @filesource
@@ -13,7 +14,6 @@
namespace Netzmacht\Contao\Leaflet; namespace Netzmacht\Contao\Leaflet;
use Contao\Input; use Contao\Input;
use Doctrine\Common\Cache\Cache;
use Netzmacht\Contao\Leaflet\Encoder\ContaoAssets; use Netzmacht\Contao\Leaflet\Encoder\ContaoAssets;
use Netzmacht\Contao\Leaflet\Event\GetJavascriptEvent; use Netzmacht\Contao\Leaflet\Event\GetJavascriptEvent;
use Netzmacht\Contao\Leaflet\Filter\Filter; use Netzmacht\Contao\Leaflet\Filter\Filter;
@@ -24,11 +24,13 @@ use Netzmacht\Contao\Leaflet\Model\LayerModel;
use Netzmacht\Contao\Leaflet\Model\MapModel; use Netzmacht\Contao\Leaflet\Model\MapModel;
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager; use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
use Netzmacht\Contao\Toolkit\View\Template\TemplateReference; use Netzmacht\Contao\Toolkit\View\Template\TemplateReference;
use Netzmacht\Contao\Toolkit\View\Template\TemplateRenderer;
use Netzmacht\LeafletPHP\Definition\Map; use Netzmacht\LeafletPHP\Definition\Map;
use Netzmacht\LeafletPHP\Leaflet; use Netzmacht\LeafletPHP\Leaflet;
use Netzmacht\LeafletPHP\Value\GeoJson\FeatureCollection; use Netzmacht\LeafletPHP\Value\GeoJson\FeatureCollection;
use Symfony\Component\EventDispatcher\EventDispatcherInterface as EventDispatcher; use Symfony\Component\Cache\CacheItem;
use Symfony\Component\Templating\EngineInterface as TemplateEngine; use Symfony\Contracts\EventDispatcher\EventDispatcherInterface as EventDispatcher;
use Symfony\Contracts\Cache\CacheInterface as Cache;
/** /**
* Class MapProvider. * Class MapProvider.
@@ -94,11 +96,11 @@ class MapProvider
private $repositoryManager; private $repositoryManager;
/** /**
* Template engine. * Template renderer.
* *
* @var TemplateEngine * @var TemplateRenderer
*/ */
private $templateEngine; private $templateRenderer;
/** /**
* Construct. * Construct.
@@ -111,7 +113,7 @@ class MapProvider
* @param Cache $cache Cache. * @param Cache $cache Cache.
* @param DataController $dataController Data controller. * @param DataController $dataController Data controller.
* @param RepositoryManager $repositoryManager Repository manager. * @param RepositoryManager $repositoryManager Repository manager.
* @param TemplateEngine $templateEngine Template engine. * @param TemplateRenderer $templateRenderer Template rednerer.
*/ */
public function __construct( public function __construct(
DefinitionMapper $mapper, DefinitionMapper $mapper,
@@ -122,7 +124,7 @@ class MapProvider
Cache $cache, Cache $cache,
DataController $dataController, DataController $dataController,
RepositoryManager $repositoryManager, RepositoryManager $repositoryManager,
TemplateEngine $templateEngine TemplateRenderer $templateRenderer
) { ) {
$this->mapper = $mapper; $this->mapper = $mapper;
$this->leaflet = $leaflet; $this->leaflet = $leaflet;
@@ -132,7 +134,7 @@ class MapProvider
$this->cache = $cache; $this->cache = $cache;
$this->dataController = $dataController; $this->dataController = $dataController;
$this->repositoryManager = $repositoryManager; $this->repositoryManager = $repositoryManager;
$this->templateEngine = $templateEngine; $this->templateRenderer = $templateRenderer;
} }
/** /**
@@ -206,28 +208,35 @@ class MapProvider
$model = $this->getModel($mapId); $model = $this->getModel($mapId);
} }
if ($model->cache) { $cacheKey = null;
$doCache = $model->cache;
if ($doCache) {
$cacheKey = $this->getCacheKey($mapId, $filter, $elementId, $template, $style); $cacheKey = $this->getCacheKey($mapId, $filter, $elementId, $template, $style);
if ($this->cache->contains($cacheKey)) { if ($this->cache->hasItem($cacheKey)) {
$cached = $this->cache->fetch($cacheKey); $cached = $this->cache->getItem($cacheKey);
$this->assets->fromArray($cached['assets']); $cachedData = $cached->get();
$this->assets->fromArray($cachedData['assets']);
return $cached['javascript']; return $cachedData['javascript'];
} else {
$cached = $this->cache->getItem($cacheKey);
} }
} }
$buffer = $this->doGenerate($model, $filter, $elementId, $template, $style); $buffer = $this->doGenerate($model, $filter, $elementId, $template, $style);
if ($model->cache) { if ($doCache) {
$this->cache->save( $cached
$cacheKey, ->expiresAfter((int) $model->cacheLifeTime)
[ ->set(
'assets' => $this->assets->toArray(), [
'javascript' => $buffer, 'assets' => $this->assets->toArray(),
], 'javascript' => $buffer,
(int) $model->cacheLifeTime ]
); );
$this->cache->save($cached);
} }
return $buffer; return $buffer;
@@ -267,12 +276,19 @@ class MapProvider
$cacheKey .= '.filter_' . md5($filter->toRequest()); $cacheKey .= '.filter_' . md5($filter->toRequest());
} }
if ($this->cache->contains($cacheKey)) { if ($this->cache->hasItem($cacheKey)) {
return $this->cache->fetch($cacheKey); $cachedItem = $this->cache->getItem($cacheKey);
return $cachedItem->get();
} else {
$cachedItem = $this->cache->getItem($cacheKey);
} }
$collection = $this->mapper->handleGeoJson($model, $request); $collection = $this->mapper->handleGeoJson($model, $request);
$this->cache->save($cacheKey, $collection, $model->cacheLifeTime); $cachedItem
->expiresAfter($model->cacheLifeTime)
->set($collection);
$this->cache->save($cachedItem);
return $collection; return $collection;
} }
@@ -371,7 +387,7 @@ class MapProvider
$javascript = $this->leaflet->build($definition, $this->assets); $javascript = $this->leaflet->build($definition, $this->assets);
$mapId = $definition->getId(); $mapId = $definition->getId();
$templateReference = new TemplateReference($template, 'html5', TemplateReference::SCOPE_FRONTEND); $templateReference = 'fe:' . $template;
$parameters = [ $parameters = [
'definition' => $definition, 'definition' => $definition,
'model' => $model, 'model' => $model,
@@ -381,12 +397,16 @@ class MapProvider
'mapId' => $mapId, 'mapId' => $mapId,
]; ];
$content = $this->templateEngine->render($templateReference, $parameters); $content = $this->templateRenderer->render($templateReference, $parameters);
$event = new GetJavascriptEvent($definition, $content); $content = preg_replace(
$this->eventDispatcher->dispatch($event::NAME, $event); ['/^<!-- TEMPLATE (START): .+ -->\n*/', '/\n*<!-- TEMPLATE (END): .+ -->$/'],
'',
$content
);
$buffer = $event->getJavascript(); $event = new GetJavascriptEvent($definition, $content);
$this->eventDispatcher->dispatch($event, $event::NAME);
return $buffer; return $event->getJavascript();
} }
} }

View File

@@ -13,6 +13,7 @@
namespace Netzmacht\Contao\Leaflet\Mapper\Control; namespace Netzmacht\Contao\Leaflet\Mapper\Control;
use Contao\Model; use Contao\Model;
use Contao\StringUtil;
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper; use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
use Netzmacht\Contao\Leaflet\Mapper\Request; use Netzmacht\Contao\Leaflet\Mapper\Request;
use Netzmacht\LeafletPHP\Definition; use Netzmacht\LeafletPHP\Definition;
@@ -68,7 +69,7 @@ class AttributionControlMapper extends AbstractControlMapper
$parent->setAttributionControl(false); $parent->setAttributionControl(false);
} }
$attributions = deserialize($model->attributions, true); $attributions = StringUtil::deserialize($model->attributions, true);
foreach ($attributions as $attribution) { foreach ($attributions as $attribution) {
$definition->addAttribution($attribution); $definition->addAttribution($attribution);

View File

@@ -20,7 +20,7 @@ use Netzmacht\LeafletPHP\Value\GeoJson\ConvertsToGeoJsonFeature;
use Netzmacht\LeafletPHP\Value\GeoJson\Feature; use Netzmacht\LeafletPHP\Value\GeoJson\Feature;
use Netzmacht\LeafletPHP\Value\GeoJson\FeatureCollection; use Netzmacht\LeafletPHP\Value\GeoJson\FeatureCollection;
use Netzmacht\LeafletPHP\Value\GeoJson\GeoJsonFeature; use Netzmacht\LeafletPHP\Value\GeoJson\GeoJsonFeature;
use Symfony\Component\EventDispatcher\EventDispatcherInterface as EventDispatcher; use Symfony\Contracts\EventDispatcher\EventDispatcherInterface as EventDispatcher;
/** /**
* Class DefinitionMapper is the main mapper instance which contains all other mappers as children. * Class DefinitionMapper is the main mapper instance which contains all other mappers as children.
@@ -111,7 +111,7 @@ class DefinitionMapper
if ($definition) { if ($definition) {
$event = new BuildDefinitionEvent($definition, $model, $request); $event = new BuildDefinitionEvent($definition, $model, $request);
$this->eventDispatcher->dispatch($event::NAME, $event); $this->eventDispatcher->dispatch($event, $event::NAME);
} }
$this->mapped[$hash] = $definition; $this->mapped[$hash] = $definition;
@@ -172,7 +172,7 @@ class DefinitionMapper
} }
$event = new ConvertToGeoJsonEvent($definition, $feature, $model); $event = new ConvertToGeoJsonEvent($definition, $feature, $model);
$this->eventDispatcher->dispatch($event::NAME, $event); $this->eventDispatcher->dispatch($event, $event::NAME);
return $feature; return $feature;
} }
@@ -190,7 +190,7 @@ class DefinitionMapper
private function hash($model, $elementId = null) private function hash($model, $elementId = null)
{ {
$event = new GetHashEvent($model); $event = new GetHashEvent($model);
$this->eventDispatcher->dispatch($event::NAME, $event); $this->eventDispatcher->dispatch($event, $event::NAME);
$hash = $event->getHash(); $hash = $event->getHash();
if (!$hash) { if (!$hash) {

View File

@@ -14,6 +14,8 @@ declare(strict_types=1);
namespace Netzmacht\Contao\Leaflet\Mapper\Layer; namespace Netzmacht\Contao\Leaflet\Mapper\Layer;
use Contao\CoreBundle\Framework\Adapter;
use Contao\Environment;
use Contao\FilesModel; use Contao\FilesModel;
use Contao\Model; use Contao\Model;
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper; use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
@@ -58,16 +60,25 @@ class FileLayerMapper extends AbstractLayerMapper
*/ */
private $repositoryManager; private $repositoryManager;
/**
* Environment.
*
* @var Adapter<Environment>
*/
private $environmentAdapter;
/** /**
* Construct. * Construct.
* *
* @param RepositoryManager $repositoryManager Repository manager. * @param RepositoryManager $repositoryManager Repository manager.
* @param Adapter<Environment> $environmentAdapter Environment adapter.
*/ */
public function __construct(RepositoryManager $repositoryManager) public function __construct(RepositoryManager $repositoryManager, Adapter $environmentAdapter)
{ {
$this->repositoryManager = $repositoryManager;
parent::__construct(); parent::__construct();
$this->repositoryManager = $repositoryManager;
$this->environmentAdapter = $environmentAdapter;
} }
/** /**
@@ -103,25 +114,26 @@ class FileLayerMapper extends AbstractLayerMapper
$layerId = $this->getElementId($model, $elementId); $layerId = $this->getElementId($model, $elementId);
if ($fileModel instanceof FilesModel && $fileModel->type === 'file') { if ($fileModel instanceof FilesModel && $fileModel->type === 'file') {
$url = $this->environmentAdapter->get('url') . '/' . $fileModel->path;
switch ($model->fileFormat) { switch ($model->fileFormat) {
case 'gpx': case 'gpx':
$layer = new Gpx($layerId, $fileModel->path); $layer = new Gpx($layerId, $url);
break; break;
case 'kml': case 'kml':
$layer = new Kml($layerId, $fileModel->path); $layer = new Kml($layerId, $url);
break; break;
case 'wkt': case 'wkt':
$layer = new Wkt($layerId, $fileModel->path); $layer = new Wkt($layerId, $url);
break; break;
case 'geojson': case 'geojson':
$layer = new OmnivoreGeoJson($layerId, $fileModel->path); $layer = new OmnivoreGeoJson($layerId, $url);
break; break;
case 'topojson': case 'topojson':
$layer = new TopoJson($layerId, $fileModel->path); $layer = new TopoJson($layerId, $url);
break; break;
default: default:

View File

@@ -13,7 +13,6 @@
namespace Netzmacht\Contao\Leaflet\Mapper\Layer; namespace Netzmacht\Contao\Leaflet\Mapper\Layer;
use Contao\Model; use Contao\Model;
use Netzmacht\Contao\Leaflet\Frontend\RequestUrl;
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper; use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
use Netzmacht\Contao\Leaflet\Mapper\GeoJsonMapper; use Netzmacht\Contao\Leaflet\Mapper\GeoJsonMapper;
use Netzmacht\Contao\Leaflet\Mapper\Request; use Netzmacht\Contao\Leaflet\Mapper\Request;
@@ -24,6 +23,7 @@ use Netzmacht\LeafletPHP\Definition;
use Netzmacht\LeafletPHP\Definition\Group\GeoJson; use Netzmacht\LeafletPHP\Definition\Group\GeoJson;
use Netzmacht\LeafletPHP\Plugins\Omnivore\GeoJson as OmnivoreGeoJson; use Netzmacht\LeafletPHP\Plugins\Omnivore\GeoJson as OmnivoreGeoJson;
use Netzmacht\LeafletPHP\Value\GeoJson\FeatureCollection; use Netzmacht\LeafletPHP\Value\GeoJson\FeatureCollection;
use Symfony\Component\Routing\RouterInterface;
/** /**
* Class MarkersLayerMapper maps the layer model to the markers definition. * Class MarkersLayerMapper maps the layer model to the markers definition.
@@ -46,14 +46,23 @@ class MarkersLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
*/ */
private $repositoryManager; private $repositoryManager;
/**
* Router.
*
* @var RouterInterface
*/
private $router;
/** /**
* Construct. * Construct.
* *
* @param RepositoryManager $repositoryManager Repository manager. * @param RepositoryManager $repositoryManager Repository manager.
* @param RouterInterface $router Router.
*/ */
public function __construct(RepositoryManager $repositoryManager) public function __construct(RepositoryManager $repositoryManager, RouterInterface $router)
{ {
$this->repositoryManager = $repositoryManager; $this->repositoryManager = $repositoryManager;
$this->router = $router;
parent::__construct(); parent::__construct();
} }
@@ -93,7 +102,7 @@ class MarkersLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
return [ return [
$this->getElementId($model, $elementId), $this->getElementId($model, $elementId),
RequestUrl::create($model->id, null, null, $request), $this->generateUrl((int) $model->id, $request),
[], [],
$layer, $layer,
]; ];
@@ -101,7 +110,7 @@ class MarkersLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
return [ return [
$this->getElementId($model, $elementId), $this->getElementId($model, $elementId),
RequestUrl::create($model->id, null, null, $request), $this->generateUrl((int) $model->id, $request),
]; ];
} }
@@ -170,16 +179,43 @@ class MarkersLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
* @param Model $model The layer model. * @param Model $model The layer model.
* @param Request $request Optional building request. * @param Request $request Optional building request.
* *
* @return \Model\Collection|null * @return \Contao\Model\Collection|null
*/ */
protected function loadMarkerModels(Model $model, Request $request = null) protected function loadMarkerModels(Model $model, Request $request = null)
{ {
$repository = $this->repositoryManager->getRepository(MarkerModel::class); $repository = $this->repositoryManager->getRepository(MarkerModel::class);
if ($model->boundsMode == 'fit') { if ($model->boundsMode === 'fit') {
return $repository->findByFilter($model->id, $request->getFilter()); return $repository->findByFilter($model->id, $request->getFilter());
} }
return $repository->findByFilter($model->id); return $repository->findByFilter($model->id);
} }
/**
* Generate the data url for a layer.
*
* @param int $layerId The layer id.
* @param Request|null $request The request.
*
* @return string
*
* @SuppressWarnings(PHPMD.Superglobals)
*/
private function generateUrl(int $layerId, ?Request $request = null): string
{
$params = ['layerId' => $layerId];
if ($request && ($filter = $request->getFilter())) {
$params['filter'] = $filter::getName();
$params['values'] = $filter->toRequest();
}
if (isset($GLOBALS['objPage'])) {
$params['context'] = 'page';
$params['contextId'] = $GLOBALS['objPage']->id;
}
return $this->router->generate('leaflet_layer', $params, RouterInterface::ABSOLUTE_URL);
}
} }

View File

@@ -13,6 +13,7 @@
namespace Netzmacht\Contao\Leaflet\Mapper\Layer; namespace Netzmacht\Contao\Leaflet\Mapper\Layer;
use Contao\Model; use Contao\Model;
use Contao\StringUtil;
use Netzmacht\Contao\Leaflet\Definition\Layer\OverpassLayer; use Netzmacht\Contao\Leaflet\Definition\Layer\OverpassLayer;
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper; use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
use Netzmacht\Contao\Leaflet\Mapper\Request; use Netzmacht\Contao\Leaflet\Mapper\Request;
@@ -146,7 +147,7 @@ class OverpassLayerMapper extends AbstractLayerMapper
*/ */
private function filterAmenityIconsConfig($amenityIconsConfig) private function filterAmenityIconsConfig($amenityIconsConfig)
{ {
$amenityIconsConfig = deserialize($amenityIconsConfig, true); $amenityIconsConfig = StringUtil::deserialize($amenityIconsConfig, true);
$amenityIconsMap = []; $amenityIconsMap = [];
foreach ($amenityIconsConfig as $config) { foreach ($amenityIconsConfig as $config) {

View File

@@ -93,7 +93,7 @@ class TileLayerMapper extends AbstractLayerMapper
/** @var TileLayer $definition */ /** @var TileLayer $definition */
$bounds = StringUtil::deserialize($model->bounds); $bounds = StringUtil::deserialize($model->bounds);
if ($request[0] && $request[1]) { if ($bounds[0] && $bounds[1]) {
$bounds = array_map( $bounds = array_map(
function ($value) { function ($value) {
return explode(',', $value, 3); return explode(',', $value, 3);

View File

@@ -14,7 +14,6 @@ namespace Netzmacht\Contao\Leaflet\Mapper\Layer;
use Contao\Model; use Contao\Model;
use Contao\Model\Collection; use Contao\Model\Collection;
use Netzmacht\Contao\Leaflet\Frontend\RequestUrl;
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper; use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
use Netzmacht\Contao\Leaflet\Mapper\GeoJsonMapper; use Netzmacht\Contao\Leaflet\Mapper\GeoJsonMapper;
use Netzmacht\Contao\Leaflet\Mapper\Request; use Netzmacht\Contao\Leaflet\Mapper\Request;
@@ -25,6 +24,7 @@ use Netzmacht\LeafletPHP\Definition;
use Netzmacht\LeafletPHP\Definition\Group\GeoJson; use Netzmacht\LeafletPHP\Definition\Group\GeoJson;
use Netzmacht\LeafletPHP\Plugins\Omnivore\GeoJson as OmnivoreGeoJson; use Netzmacht\LeafletPHP\Plugins\Omnivore\GeoJson as OmnivoreGeoJson;
use Netzmacht\LeafletPHP\Value\GeoJson\FeatureCollection; use Netzmacht\LeafletPHP\Value\GeoJson\FeatureCollection;
use Symfony\Component\Routing\RouterInterface;
/** /**
* Class VectorsLayerMapper maps the layer model for the Vectors layer definition. * Class VectorsLayerMapper maps the layer model for the Vectors layer definition.
@@ -47,14 +47,23 @@ class VectorsLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
*/ */
private $repositoryManager; private $repositoryManager;
/**
* Router.
*
* @var RouterInterface
*/
private $router;
/** /**
* Construct. * Construct.
* *
* @param RepositoryManager $repositoryManager Repository manager. * @param RepositoryManager $repositoryManager Repository manager.
* @param RouterInterface $router Router
*/ */
public function __construct(RepositoryManager $repositoryManager) public function __construct(RepositoryManager $repositoryManager, RouterInterface $router)
{ {
$this->repositoryManager = $repositoryManager; $this->repositoryManager = $repositoryManager;
$this->router = $router;
parent::__construct(); parent::__construct();
} }
@@ -101,7 +110,7 @@ class VectorsLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
return [ return [
$this->getElementId($model, $elementId), $this->getElementId($model, $elementId),
RequestUrl::create($model->id, null, null, $request), $this->generateUrl((int) $model->id, $request),
[], [],
$layer, $layer,
]; ];
@@ -109,7 +118,7 @@ class VectorsLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
return [ return [
$this->getElementId($model, $elementId), $this->getElementId($model, $elementId),
RequestUrl::create($model->id, null, null, $request), $this->generateUrl((int) $model->id, $request),
]; ];
} }
@@ -188,11 +197,11 @@ class VectorsLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
* Add javascript callbacks. * Add javascript callbacks.
* *
* @param GeoJson $definition The definition. * @param GeoJson $definition The definition.
* @param \Model $model The database model. * @param Model $model The database model.
* *
* @return void * @return void
*/ */
protected function addCallbacks(GeoJson $definition, \Model $model) protected function addCallbacks(GeoJson $definition, Model $model)
{ {
if ($model->pointToLayer) { if ($model->pointToLayer) {
$definition->setPointToLayer(new Expression($model->pointToLayer)); $definition->setPointToLayer(new Expression($model->pointToLayer));
@@ -202,4 +211,31 @@ class VectorsLayerMapper extends AbstractLayerMapper implements GeoJsonMapper
$definition->setOnEachFeature(new Expression($model->onEachFeature)); $definition->setOnEachFeature(new Expression($model->onEachFeature));
} }
} }
/**
* Generate the data url for a layer.
*
* @param int $layerId The layer id.
* @param Request|null $request The request.
*
* @return string
*
* @SuppressWarnings(PHPMD.Superglobals)
*/
private function generateUrl(int $layerId, ?Request $request = null): string
{
$params = ['layerId' => $layerId];
if ($request && ($filter = $request->getFilter())) {
$params['filter'] = $filter::getName();
$params['values'] = $filter->toRequest();
}
if (isset($GLOBALS['objPage'])) {
$params['context'] = 'page';
$params['contextId'] = $GLOBALS['objPage']->id;
}
return $this->router->generate('leaflet_layer', $params, RouterInterface::ABSOLUTE_URL);
}
} }

View File

@@ -13,6 +13,7 @@
namespace Netzmacht\Contao\Leaflet\Mapper; namespace Netzmacht\Contao\Leaflet\Mapper;
use Contao\Model; use Contao\Model;
use Contao\StringUtil;
use Netzmacht\Contao\Leaflet\Model\ControlModel; use Netzmacht\Contao\Leaflet\Model\ControlModel;
use Netzmacht\Contao\Leaflet\Model\MapModel; use Netzmacht\Contao\Leaflet\Model\MapModel;
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager; use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
@@ -195,7 +196,7 @@ class MapMapper extends AbstractMapper
*/ */
private function buildBoundsCalculation(Map $map, MapModel $model) private function buildBoundsCalculation(Map $map, MapModel $model)
{ {
$adjustBounds = deserialize($model->adjustBounds, true); $adjustBounds = StringUtil::deserialize($model->adjustBounds, true);
if (in_array('deferred', $adjustBounds)) { if (in_array('deferred', $adjustBounds)) {
$map->setOption('adjustBounds', true); $map->setOption('adjustBounds', true);

Some files were not shown because too many files have changed in this diff Show More