mirror of
https://github.com/netzmacht/contao-leaflet-maps.git
synced 2025-11-28 19:13:55 +01:00
Compare commits
5 Commits
3.2.4
...
feature/pe
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
bdca0adb56 | ||
|
|
20efff72d9 | ||
|
|
fa1ceb9402 | ||
|
|
f2959b2df0 | ||
|
|
d7fbc361d7 |
@@ -6,10 +6,6 @@
|
||||
"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"
|
||||
"Contao\\ManagerPlugin\\Bundle\\Parser\\ParserInterface"
|
||||
]
|
||||
}
|
||||
|
||||
1
.github/FUNDING.yml
vendored
1
.github/FUNDING.yml
vendored
@@ -1 +0,0 @@
|
||||
github: [dmolineus]
|
||||
82
.github/workflows/diagnostics.yml
vendored
82
.github/workflows/diagnostics.yml
vendored
@@ -1,82 +0,0 @@
|
||||
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/
|
||||
3
.gitignore
vendored
3
.gitignore
vendored
@@ -25,6 +25,3 @@ build.properties
|
||||
|
||||
# NPM
|
||||
node_modules
|
||||
|
||||
.phpcq
|
||||
phpcq.yaml
|
||||
|
||||
File diff suppressed because one or more lines are too long
29
.travis.yml
Normal file
29
.travis.yml
Normal file
@@ -0,0 +1,29 @@
|
||||
language: php
|
||||
|
||||
php:
|
||||
- "7.1"
|
||||
- "7.2"
|
||||
|
||||
env:
|
||||
- CONTAO_VERSION=contao/core-bundle ~4.4.0
|
||||
- CONTAO_VERSION=contao/core-bundle ~4.5.0
|
||||
- CONTAO_VERSION=contao/core-bundle ~4.6.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
|
||||
154
CHANGELOG.md
154
CHANGELOG.md
@@ -6,113 +6,9 @@ All notable changes to this project will be documented in this file.
|
||||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
||||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
||||
|
||||
## [Unreleased]
|
||||
## 3.1.1 - 2018-12-07
|
||||
|
||||
## [3.2.4] - 2023-02-20
|
||||
|
||||
### Fixed
|
||||
|
||||
- Load after `netzmacht-contao-leaflet-libraries` ([#116](https://github.com/netzmacht/contao-leaflet-maps/pull/116, [#120](https://github.com/netzmacht/contao-leaflet-maps/pull/120, [#121](https://github.com/netzmacht/contao-leaflet-maps/issues/121), [#122](https://github.com/netzmacht/contao-leaflet-maps/issues/122))
|
||||
- Do not use `doctrine/cache` anymore ([#118](https://github.com/netzmacht/contao-leaflet-maps/pull/118))
|
||||
- Fix issues of js generation in debug mode ([#114](https://github.com/netzmacht/contao-leaflet-maps/issues/114))
|
||||
|
||||
## [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
|
||||
[Full Changelog](https://github.com/netzmacht/contao-leaflet-maps/compare/3.1.0...3.1.1)
|
||||
|
||||
### Fixed
|
||||
|
||||
@@ -146,31 +42,43 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Fix broken marker cluster layer (#60).
|
||||
|
||||
|
||||
## [3.0.4] - 2018-10-08
|
||||
## 3.0.4 - 2018-10-08
|
||||
|
||||
[Full Changelog](https://github.com/netzmacht/contao-leaflet-maps/compare/3.0.3...3.0.4)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Fix broken content element attributes (Missing class and custom id).
|
||||
|
||||
## [3.0.3] - 2018-09-18
|
||||
## 3.0.3 - 2018-09-18
|
||||
|
||||
[Full Changelog](https://github.com/netzmacht/contao-leaflet-maps/compare/3.0.2...3.0.3)
|
||||
|
||||
### Fixed
|
||||
|
||||
- Make alias generator services public for Contao 4.6/Symfony 4.0 compatibility.
|
||||
|
||||
## [3.0.2] - 2018-08-23
|
||||
## 3.0.2 - 2018-08-23
|
||||
|
||||
[Full Changelog](https://github.com/netzmacht/contao-leaflet-maps/compare/3.0.1...3.0.2)
|
||||
|
||||
- Run composer require checker and solve issues.
|
||||
|
||||
## [3.0.1] - 2018-06-20
|
||||
## 3.0.1 - 2018-06-20
|
||||
|
||||
[Full Changelog](https://github.com/netzmacht/contao-leaflet-maps/compare/3.0.0...3.0.1)
|
||||
|
||||
- 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
|
||||
|
||||
## [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
|
||||
|
||||
@@ -181,7 +89,9 @@ Bugfixes
|
||||
- Broken service definitions
|
||||
- Broken file layer id
|
||||
|
||||
## [3.0.0-alpha2] - 2017-10-19
|
||||
## 3.0.0-alpha1 - 2017-10-19
|
||||
|
||||
[Full Changelog](https://github.com/netzmacht/contao-leaflet-maps/compare/3.0.0-alpha1...3.0.0-alpha2)
|
||||
|
||||
Implemented enhancements
|
||||
|
||||
@@ -190,21 +100,3 @@ Implemented enhancements
|
||||
- New file layer for gpx,kml,wkt,topojson,geojson files added
|
||||
- Bypass filesystem cache in debug mode
|
||||
- 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
|
||||
|
||||
12
README.md
12
README.md
@@ -2,9 +2,9 @@ Leaflet integration into Contao CMS
|
||||
===================================
|
||||
|
||||
[](https://travis-ci.org/netzmacht/contao-leaflet-maps)
|
||||
[](http://packagist.org/packages/netzmacht/contao-leaflet-maps)
|
||||
[](http://packagist.org/packages/netzmacht/contao-leaflet-maps)
|
||||
[](http://packagist.org/packages/netzmacht/contao-leaflet-maps)
|
||||
[](http://packagist.com/packages/netzmacht/contao-leaflet-maps)
|
||||
[](http://packagist.com/packages/netzmacht/contao-leaflet-maps)
|
||||
[](http://packagist.com/packages/netzmacht/contao-leaflet-maps)
|
||||
[](https://github.com/contao-community-alliance/coding-standard)
|
||||
|
||||
This extension provides a backend gui for integrating [Leaflet](http://leafletjs.com/) into the Contao CMS.
|
||||
@@ -38,12 +38,6 @@ Features
|
||||
- Autoloading of required assets.
|
||||
- [Layer for MetaModels](https://github.com/netzmacht/contao-leaflet-metamodels)
|
||||
|
||||
|
||||
Documentation
|
||||
-------------
|
||||
|
||||
A basic [user documentation](http://leaflet-maps-for-contao.readthedocs.org/) written in German is available.
|
||||
|
||||
Changelog
|
||||
---------
|
||||
|
||||
|
||||
4
build.default.properties
Normal file
4
build.default.properties
Normal file
@@ -0,0 +1,4 @@
|
||||
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
|
||||
5
build.xml
Normal file
5
build.xml
Normal file
@@ -0,0 +1,5 @@
|
||||
<?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>
|
||||
@@ -1,13 +1,13 @@
|
||||
{
|
||||
"name": "netzmacht/contao-leaflet-maps",
|
||||
"description": "Contao Leaflet maps integration",
|
||||
"license": "LGPL-3.0-or-later",
|
||||
"type": "contao-bundle",
|
||||
"keywords": [
|
||||
"contao",
|
||||
"maps",
|
||||
"leaflet"
|
||||
],
|
||||
"type": "contao-bundle",
|
||||
"license": "LGPL-3.0-or-later",
|
||||
"authors": [
|
||||
{
|
||||
"name": "David Molineus",
|
||||
@@ -19,73 +19,61 @@
|
||||
"support": {
|
||||
"email": "mail@netzmacht.de",
|
||||
"issues": "https://github.com/netzmacht/contao-leaflet-maps/issues",
|
||||
"source": "https://github.com/netzmacht/contao-leaflet-maps",
|
||||
"docs": "http://leaflet-maps-for-contao.readthedocs.org/"
|
||||
"source": "https://github.com/netzmacht/contao-leaflet-maps"
|
||||
},
|
||||
"require": {
|
||||
"php": "^7.1 || ^8.0",
|
||||
"php": ">=7.1",
|
||||
"ext-json": "*",
|
||||
"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",
|
||||
"contao/core-bundle": "~4.4",
|
||||
"doctrine/dbal": "^2.5",
|
||||
"symfony/config": "~3.3 || ~4.0",
|
||||
"symfony/event-dispatcher": "~3.3 || ~4.0",
|
||||
"symfony/dependency-injection": "~3.3 || ~4.0",
|
||||
"symfony/filesystem": "~3.3 || ~4.0",
|
||||
"symfony/http-kernel": "~3.3 || ~4.0",
|
||||
"symfony/translation": "~3.3 || ~4.0",
|
||||
"symfony/templating": "~3.3 || ~4.0",
|
||||
"netzmacht/contao-leaflet-libraries": "^1.0",
|
||||
"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-leaflet": "^1.1.0",
|
||||
"symfony/cache-contracts": "^1.1 || ^2.0",
|
||||
"symfony/config": "^4.4 || ^5.1",
|
||||
"symfony/dependency-injection": "^4.4 || ^5.1",
|
||||
"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"
|
||||
"netzmacht/php-leaflet": "^1.0.2",
|
||||
"netzmacht/contao-toolkit": "~3.0",
|
||||
"netzmacht/contao-page-context": "~1.0",
|
||||
"contao-community-alliance/meta-palettes": "^2.0 || ^1.5",
|
||||
"menatwork/contao-multicolumnwizard": "^3.2",
|
||||
"doctrine/cache": "^1.0",
|
||||
"codefog/contao-widget_tree_picker": "^2.4"
|
||||
},
|
||||
"require-dev": {
|
||||
"phpcq/all-tasks": "^1.2",
|
||||
"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"
|
||||
"phpstan/phpstan": "^0.10.3"
|
||||
},
|
||||
"autoload": {
|
||||
"psr-4": {
|
||||
"Netzmacht\\Contao\\Leaflet\\": "src/"
|
||||
}
|
||||
},
|
||||
"config": {
|
||||
"allow-plugins": {
|
||||
"contao-components/installer": true,
|
||||
"contao/manager-plugin": true,
|
||||
"contao-community-alliance/composer-plugin": true,
|
||||
"php-http/discovery": true
|
||||
}
|
||||
"autoload-dev": {
|
||||
"files": [
|
||||
"vendor/phpcq/autoload-validation/hacks/contao-hack.php"
|
||||
]
|
||||
},
|
||||
"extra": {
|
||||
"branch-alias": {
|
||||
"dev-develop": "3.3.x-dev",
|
||||
"dev-master": "3.2.x-dev",
|
||||
"dev-master": "3.1.x-dev",
|
||||
"dev-develop": "3.2.x-dev",
|
||||
"dev-support/2.x": "2.0.x-dev"
|
||||
},
|
||||
"contao-manager-plugin": "Netzmacht\\Contao\\Leaflet\\Bundle\\ContaoManager\\Plugin",
|
||||
"contao": {
|
||||
"transifex": {
|
||||
"languages_cto": "src/Bundle/Resources/contao/languages",
|
||||
"languages_tx": ".tx",
|
||||
"project": "contao-leaflet-maps",
|
||||
"prefix": "core-",
|
||||
"project": "contao-leaflet-maps"
|
||||
"languages_cto": "src/Bundle/Resources/contao/languages",
|
||||
"languages_tx": ".tx"
|
||||
}
|
||||
},
|
||||
"contao-manager-plugin": "Netzmacht\\Contao\\Leaflet\\Bundle\\ContaoManager\\Plugin"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
1349
package-lock.json
generated
1349
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -4,10 +4,10 @@
|
||||
"description": "Leaflet maps for Contao",
|
||||
"main": "gulpfile.js",
|
||||
"dependencies": {
|
||||
"gulp": "^4.0.2",
|
||||
"gulp-cli": "^2.2.0",
|
||||
"gulp": "^4.0.0",
|
||||
"gulp-cli": "^2.0.1",
|
||||
"gulp-concat": "^2.6.1",
|
||||
"gulp-uglify": "^3.0.2",
|
||||
"gulp-uglify": "^3.0.1",
|
||||
"promised-del": "^1.0.2"
|
||||
},
|
||||
"devDependencies": {},
|
||||
|
||||
@@ -1,98 +0,0 @@
|
||||
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
|
||||
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<ruleset name="ContaoToolkit">
|
||||
<rule ref="vendor/phpcq/coding-standard/phpcs/PhpCodeQuality/ruleset.xml" />
|
||||
</ruleset>
|
||||
@@ -5,15 +5,15 @@
|
||||
*
|
||||
* @package contao-leaflet-maps
|
||||
* @author David Molineus <david.molineus@netzmacht.de>
|
||||
* @copyright 2014-2019 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
|
||||
* @filesource
|
||||
*/
|
||||
|
||||
namespace Netzmacht\Contao\Leaflet\Backend\Action;
|
||||
|
||||
use Symfony\Bundle\FrameworkBundle\Templating\EngineInterface as Engine;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Twig\Environment;
|
||||
|
||||
/**
|
||||
* Credits backend module.
|
||||
@@ -23,11 +23,11 @@ use Twig\Environment;
|
||||
final class AboutAction
|
||||
{
|
||||
/**
|
||||
* Twig environment.
|
||||
* Templating engine.
|
||||
*
|
||||
* @var Environment
|
||||
* @var Engine
|
||||
*/
|
||||
private $twig;
|
||||
private $engine;
|
||||
|
||||
/**
|
||||
* Project directory.
|
||||
@@ -39,12 +39,12 @@ final class AboutAction
|
||||
/**
|
||||
* AboutAction constructor.
|
||||
*
|
||||
* @param Environment $twig Twig environment.
|
||||
* @param string $projectDir Project directory.
|
||||
* @param Engine $engine Templating engine.
|
||||
* @param string $projectDir Project directory.
|
||||
*/
|
||||
public function __construct(Environment $twig, string $projectDir)
|
||||
public function __construct(Engine $engine, string $projectDir)
|
||||
{
|
||||
$this->twig = $twig;
|
||||
$this->engine = $engine;
|
||||
$this->projectDir = $projectDir;
|
||||
}
|
||||
|
||||
@@ -62,9 +62,7 @@ final class AboutAction
|
||||
|
||||
[$data['version'], $data['dependencies']] = $this->extractFromComposer();
|
||||
|
||||
return new Response(
|
||||
$this->twig->render('@NetzmachtContaoLeaflet/backend/about.html.twig', $data)
|
||||
);
|
||||
return $this->engine->renderResponse('@NetzmachtContaoLeaflet/backend/about.html.twig', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -14,7 +14,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Netzmacht\Contao\Leaflet\Backend\Renderer\Label\Layer;
|
||||
|
||||
use Symfony\Contracts\Translation\TranslatorInterface as Translator;
|
||||
use Symfony\Component\Translation\TranslatorInterface as Translator;
|
||||
|
||||
/**
|
||||
* Class ChainRenderer.
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Netzmacht\Contao\Leaflet\Backend\Renderer\Label\Layer;
|
||||
|
||||
use Contao\FilesModel;
|
||||
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface as Translator;
|
||||
use Symfony\Component\Translation\TranslatorInterface as Translator;
|
||||
|
||||
/**
|
||||
* Class FileLabelRenderer
|
||||
|
||||
@@ -14,7 +14,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Netzmacht\Contao\Leaflet\Backend\Renderer\Label\Layer;
|
||||
|
||||
use Symfony\Contracts\Translation\TranslatorInterface as Translator;
|
||||
use Symfony\Component\Translation\TranslatorInterface as Translator;
|
||||
|
||||
/**
|
||||
* Interface LayerLabelRenderer.
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Netzmacht\Contao\Leaflet\Backend\Renderer\Label\Layer;
|
||||
|
||||
use Netzmacht\Contao\Leaflet\Model\MarkerModel;
|
||||
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface as Translator;
|
||||
use Symfony\Component\Translation\TranslatorInterface as Translator;
|
||||
|
||||
/**
|
||||
* Class MarkersLabelRenderer.
|
||||
|
||||
@@ -15,7 +15,7 @@ declare(strict_types=1);
|
||||
namespace Netzmacht\Contao\Leaflet\Backend\Renderer\Label\Layer;
|
||||
|
||||
use Contao\StringUtil;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface as Translator;
|
||||
use Symfony\Component\Translation\TranslatorInterface as Translator;
|
||||
|
||||
/**
|
||||
* Class OverpassLabelRenderer.
|
||||
|
||||
@@ -14,7 +14,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Netzmacht\Contao\Leaflet\Backend\Renderer\Label\Layer;
|
||||
|
||||
use Symfony\Contracts\Translation\TranslatorInterface as Translator;
|
||||
use Symfony\Component\Translation\TranslatorInterface as Translator;
|
||||
|
||||
/**
|
||||
* Backend label renderer for provider layer.
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Netzmacht\Contao\Leaflet\Backend\Renderer\Label\Layer;
|
||||
|
||||
use Netzmacht\Contao\Leaflet\Model\LayerModel;
|
||||
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface as Translator;
|
||||
use Symfony\Component\Translation\TranslatorInterface as Translator;
|
||||
|
||||
/**
|
||||
* Class ReferenceLabelRenderer.
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace Netzmacht\Contao\Leaflet\Backend\Renderer\Label\Layer;
|
||||
|
||||
use Netzmacht\Contao\Leaflet\Model\VectorModel;
|
||||
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface as Translator;
|
||||
use Symfony\Component\Translation\TranslatorInterface as Translator;
|
||||
|
||||
/**
|
||||
* Class VectorsLabelRenderer.
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
<?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);
|
||||
}
|
||||
}
|
||||
@@ -44,8 +44,7 @@ class Plugin implements BundlePluginInterface, RoutingPluginInterface
|
||||
[
|
||||
ContaoCoreBundle::class,
|
||||
NetzmachtContaoToolkitBundle::class,
|
||||
NetzmachtContaoPageContextBundle::class,
|
||||
'leaflet-libs',
|
||||
NetzmachtContaoPageContextBundle::class
|
||||
]
|
||||
)
|
||||
->setReplace(['leaflet']),
|
||||
|
||||
@@ -18,8 +18,6 @@ use Netzmacht\LeafletPHP\Assets;
|
||||
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface;
|
||||
use Symfony\Component\DependencyInjection\ContainerBuilder;
|
||||
|
||||
use function array_pad;
|
||||
|
||||
/**
|
||||
* Class RegisterLibrariesPass.
|
||||
*
|
||||
@@ -45,12 +43,12 @@ class RegisterLibrariesPass implements CompilerPassInterface
|
||||
|
||||
foreach ($libraries as $name => $assets) {
|
||||
if (!empty($assets['css'])) {
|
||||
[$source, $type] = array_pad((array) $assets['css'], 2, null);
|
||||
list ($source, $type) = (array) $assets['css'];
|
||||
$definition->addMethodCall('registerStylesheet', [$name, $source, $type ?: Assets::TYPE_FILE]);
|
||||
}
|
||||
|
||||
if (!empty($assets['javascript'])) {
|
||||
[$source, $type] = array_pad((array) $assets['javascript'], 2, null);
|
||||
list ($source, $type) = (array) $assets['javascript'];
|
||||
$definition->addMethodCall('registerJavascript', [$name, $source, $type ?: Assets::TYPE_FILE]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ services:
|
||||
public: true
|
||||
arguments:
|
||||
- '@netzmacht.contao_toolkit.repository_manager'
|
||||
- '@netzmacht.contao_toolkit.template_renderer'
|
||||
- '@templating'
|
||||
- '@filesystem'
|
||||
- '@netzmacht.contao_toolkit.contao.system_adapter'
|
||||
- '%netzmacht.contao_leaflet.cache_dir%'
|
||||
@@ -51,6 +51,8 @@ services:
|
||||
- '@netzmacht.contao_toolkit.repository_manager'
|
||||
- '@translator'
|
||||
- '@netzmacht.contao_leaflet.layer_label_renderer'
|
||||
- '@netzmacht.contao_toolkit.contao.backend_user'
|
||||
- '@netzmacht.contao_toolkit.dca.listeners.state_button_callback'
|
||||
- '@netzmacht.contao_toolkit.contao.backend_adapter'
|
||||
- '%netzmacht.contao_leaflet.layers%'
|
||||
- '%netzmacht.contao_leaflet.providers%'
|
||||
@@ -63,6 +65,7 @@ services:
|
||||
arguments:
|
||||
- '@database_connection'
|
||||
- '@netzmacht.contao_toolkit.repository_manager'
|
||||
- '@netzmacht.contao_toolkit.contao.backend_user'
|
||||
|
||||
netzmacht.contao_leaflet.listeners.dca.vector:
|
||||
class: Netzmacht\Contao\Leaflet\Listener\Dca\VectorDcaListener
|
||||
@@ -70,20 +73,52 @@ services:
|
||||
arguments:
|
||||
- '@netzmacht.contao_toolkit.dca.manager'
|
||||
- '@netzmacht.contao_toolkit.repository_manager'
|
||||
- '@netzmacht.contao_toolkit.contao.backend_user'
|
||||
- '%netzmacht.contao_leaflet.vectors%'
|
||||
|
||||
netzmacht.contao_leaflet.listeners.dca.icon:
|
||||
class: Netzmacht\Contao\Leaflet\Listener\Dca\IconDcaListener
|
||||
public: true
|
||||
arguments:
|
||||
- '@netzmacht.contao_toolkit.contao.backend_user'
|
||||
- '%netzmacht.contao_leaflet.icons%'
|
||||
|
||||
netzmacht.contao_leaflet.listeners.dca.style:
|
||||
class: Netzmacht\Contao\Leaflet\Listener\Dca\StyleDcaListener
|
||||
public: true
|
||||
arguments:
|
||||
- '@netzmacht.contao_toolkit.contao.backend_user'
|
||||
- '%netzmacht.contao_leaflet.styles%'
|
||||
|
||||
netzmacht.contao_leaflet.listeners.dca.popup:
|
||||
class: Netzmacht\Contao\Leaflet\Listener\Dca\PopupDcaListener
|
||||
public: true
|
||||
arguments:
|
||||
- '@netzmacht.contao_toolkit.contao.backend_user'
|
||||
|
||||
netzmacht.contao_leaflet.listeners.dca.user:
|
||||
class: Netzmacht\Contao\Leaflet\Listener\Dca\UserDcaListener
|
||||
public: true
|
||||
arguments:
|
||||
- '@netzmacht.contao_toolkit.dca.manager'
|
||||
- '@netzmacht.contao_leaflet.layer_label_renderer'
|
||||
- '@translator'
|
||||
- '%netzmacht.contao_leaflet.layers%'
|
||||
-
|
||||
netzmacht.contao_leaflet.listeners.dca.user_group:
|
||||
class: Netzmacht\Contao\Leaflet\Listener\Dca\UserGroupDcaListener
|
||||
public: true
|
||||
arguments:
|
||||
- '@netzmacht.contao_toolkit.dca.manager'
|
||||
- '@netzmacht.contao_leaflet.layer_label_renderer'
|
||||
- '@translator'
|
||||
- '%netzmacht.contao_leaflet.layers%'
|
||||
|
||||
Netzmacht\Contao\Leaflet\Listener\Dca\OperationsListener:
|
||||
public: true
|
||||
arguments:
|
||||
- '@netzmacht.contao_toolkit.contao.backend_user'
|
||||
|
||||
netzmacht.contao_leaflet.listeners.geo_json_listener:
|
||||
class: Netzmacht\Contao\Leaflet\Listener\GeoJsonListener
|
||||
arguments:
|
||||
|
||||
@@ -77,7 +77,6 @@ services:
|
||||
class: Netzmacht\Contao\Leaflet\Mapper\Layer\FileLayerMapper
|
||||
arguments:
|
||||
- '@netzmacht.contao_toolkit.repository_manager'
|
||||
- '@netzmacht.contao_toolkit.contao.environment_adapter'
|
||||
tags:
|
||||
- { name: netzmacht.contao_leaflet.mapper }
|
||||
|
||||
|
||||
@@ -1,25 +1,13 @@
|
||||
parameters:
|
||||
netzmacht.contao_leaflet.providers:
|
||||
OpenStreetMap:
|
||||
variants: ['Mapnik', 'DE', 'CH', 'France', 'HOT', 'BZH']
|
||||
variants: ['Mapnik', 'BlackAndWhite', 'DE', 'France', 'HOT', 'BZH']
|
||||
|
||||
OpenSeaMap: []
|
||||
|
||||
OPNVKarte: []
|
||||
|
||||
OpenTopoMap: []
|
||||
|
||||
OpenRailwayMap: []
|
||||
|
||||
OpenFireMap: []
|
||||
|
||||
SafeCast: []
|
||||
|
||||
Stadia:
|
||||
variants: ['AlidadeSmooth', 'AlidadeSmoothDark', 'OSMBright', 'Outdoors']
|
||||
|
||||
Thunderforest:
|
||||
class: 'Netzmacht\LeafletPHP\Plugins\LeafletProviders\ThunderforestProvider'
|
||||
variants:
|
||||
- 'OpenCycleMap'
|
||||
- 'Transport'
|
||||
@@ -28,13 +16,9 @@ parameters:
|
||||
- 'Landscape'
|
||||
- 'Outdoors'
|
||||
- 'Pioneer'
|
||||
- 'MobileAtlas'
|
||||
- 'Neighbourhood'
|
||||
options:
|
||||
apiKey: 'tile_provider_key'
|
||||
fields: ['tile_provider_key']
|
||||
|
||||
CyclOSM: []
|
||||
OpenMapSurfer:
|
||||
variants: ['Roads', 'AdminBounds', 'Grayscale']
|
||||
|
||||
Hydda:
|
||||
variants: ['Full', 'Base', 'RoadsAndLabels']
|
||||
@@ -42,10 +26,7 @@ parameters:
|
||||
MapBox:
|
||||
class: 'Netzmacht\LeafletPHP\Plugins\LeafletProviders\MapBoxProvider'
|
||||
options:
|
||||
accessToken: 'tile_provider_key'
|
||||
fields: ['tile_provider_key']
|
||||
|
||||
MapTiler: []
|
||||
key: 'tile_provider_key'
|
||||
|
||||
Stamen:
|
||||
variants:
|
||||
@@ -75,7 +56,6 @@ parameters:
|
||||
- 'WorldGrayCanvas'
|
||||
|
||||
OpenWeatherMap:
|
||||
class: 'Netzmacht\LeafletPHP\Plugins\LeafletProviders\OpenWeatherMapProvider'
|
||||
variants:
|
||||
- 'Clouds'
|
||||
- 'CloudsClassic'
|
||||
@@ -88,9 +68,6 @@ parameters:
|
||||
- 'Wind'
|
||||
- 'Temperature'
|
||||
- 'Snow'
|
||||
options:
|
||||
apiKey: 'tile_provider_key'
|
||||
fields: ['tile_provider_key']
|
||||
|
||||
HERE:
|
||||
class: 'Netzmacht\LeafletPHP\Plugins\LeafletProviders\HereProvider'
|
||||
@@ -106,19 +83,12 @@ parameters:
|
||||
- 'normalNightMobile'
|
||||
- 'normalNightGrey'
|
||||
- 'normalNightGreyMobile'
|
||||
- 'normalNightTransit'
|
||||
- 'normalNightTransitMobile'
|
||||
- 'reducedDay'
|
||||
- 'reducedNight'
|
||||
- 'basicMap'
|
||||
- 'mapLabels'
|
||||
- 'trafficFlow'
|
||||
- 'carnavDayGrey'
|
||||
- 'hybridDay'
|
||||
- 'hybridDayMobile'
|
||||
- 'hybridDayTransit'
|
||||
- 'hybridDayGrey'
|
||||
- 'hybridDayTraffic'
|
||||
- 'pedestrianDay'
|
||||
- 'pedestrianNight'
|
||||
- 'satelliteDay'
|
||||
@@ -153,10 +123,6 @@ parameters:
|
||||
- 'DarkMatter'
|
||||
- 'DarkMatterNoLabels'
|
||||
- 'DarkMatterOnlyLabels'
|
||||
- 'Voyager'
|
||||
- 'VoyagerNoLabels'
|
||||
- 'VoyagerOnlyLabels'
|
||||
- 'VoyagerLabelsUnder'
|
||||
|
||||
HikeBike:
|
||||
variants:
|
||||
@@ -189,20 +155,3 @@ parameters:
|
||||
- 'ModisTerraChlorophyll'
|
||||
|
||||
NLS: []
|
||||
|
||||
Wikimedia: []
|
||||
|
||||
GeoportailFrance:
|
||||
variants:
|
||||
- 'parcels'
|
||||
- 'ignMaps'
|
||||
- 'maps'
|
||||
- 'orthos'
|
||||
|
||||
OneMapSG:
|
||||
variants:
|
||||
- 'Default'
|
||||
- 'Night'
|
||||
- 'Original'
|
||||
- 'Grey'
|
||||
- 'LandLot'
|
||||
|
||||
@@ -16,7 +16,7 @@ services:
|
||||
- '@netzmacht.contao_leaflet.cache'
|
||||
- '@netzmacht.contao_leaflet.frontend.data_controller'
|
||||
- '@netzmacht.contao_toolkit.repository_manager'
|
||||
- '@netzmacht.contao_toolkit.template_renderer'
|
||||
- '@templating'
|
||||
|
||||
netzmacht.contao_leaflet.libraries:
|
||||
class: Netzmacht\Contao\Leaflet\Frontend\Assets\LibrariesConfiguration
|
||||
@@ -29,14 +29,12 @@ services:
|
||||
- '%netzmacht.contao_leaflet.filters%'
|
||||
|
||||
netzmacht.contao_leaflet.cache.default:
|
||||
class: Symfony\Component\Cache\Adapter\FilesystemAdapter
|
||||
class: Doctrine\Common\Cache\FilesystemCache
|
||||
arguments:
|
||||
- 'netzmacht.contao_leaflet'
|
||||
- 0
|
||||
- '%netzmacht.contao_leaflet.cache_dir%'
|
||||
|
||||
netzmacht.contao_leaflet.cache.debug:
|
||||
class: Symfony\Component\Cache\Adapter\ArrayAdapter
|
||||
class: Doctrine\Common\Cache\ArrayCache
|
||||
|
||||
netzmacht.contao_leaflet.frontend.value_filter:
|
||||
class: Netzmacht\Contao\Leaflet\Frontend\ValueFilter
|
||||
@@ -130,17 +128,11 @@ services:
|
||||
- { 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'
|
||||
- '@templating'
|
||||
- '%kernel.project_dir%'
|
||||
|
||||
Netzmacht\Contao\Leaflet\Bundle\ConsentBridge\Plugin:
|
||||
tags:
|
||||
- { name: hofff_contao_consent_bridge.plugin }
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
*/
|
||||
|
||||
/*
|
||||
* Backend module.
|
||||
* Backend modules
|
||||
*/
|
||||
|
||||
array_insert(
|
||||
@@ -44,12 +44,13 @@ array_insert(
|
||||
]
|
||||
);
|
||||
|
||||
if (defined('TL_MODE') && TL_MODE === 'BE') {
|
||||
if (TL_MODE === 'BE') {
|
||||
$GLOBALS['TL_CSS'][] = 'bundles/netzmachtcontaoleaflet/css/backend_global.css';
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Models.
|
||||
* Models
|
||||
*/
|
||||
|
||||
$GLOBALS['TL_MODELS']['tl_leaflet_control'] = \Netzmacht\Contao\Leaflet\Model\ControlModel::class;
|
||||
@@ -60,3 +61,12 @@ $GLOBALS['TL_MODELS']['tl_leaflet_marker'] = \Netzmacht\Contao\Leaflet\Model\Ma
|
||||
$GLOBALS['TL_MODELS']['tl_leaflet_popup'] = \Netzmacht\Contao\Leaflet\Model\PopupModel::class;
|
||||
$GLOBALS['TL_MODELS']['tl_leaflet_style'] = \Netzmacht\Contao\Leaflet\Model\StyleModel::class;
|
||||
$GLOBALS['TL_MODELS']['tl_leaflet_vector'] = \Netzmacht\Contao\Leaflet\Model\VectorModel::class;
|
||||
|
||||
|
||||
/*
|
||||
* Permissions
|
||||
*/
|
||||
|
||||
$GLOBALS['TL_PERMISSIONS'][] = 'leaflet_layers';
|
||||
$GLOBALS['TL_PERMISSIONS'][] = 'leaflet_layer_permissions';
|
||||
$GLOBALS['TL_PERMISSIONS'][] = 'leaflet_tables';
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
*
|
||||
* @package contao-leaflet-maps
|
||||
* @author David Molineus <david.molineus@netzmacht.de>
|
||||
* @author Fritz Michael Gschwantner <fmg@inspiredminds.at>
|
||||
* @copyright 2014-2017 netzmacht David Molineus. All rights reserved.
|
||||
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
|
||||
* @filesource
|
||||
@@ -14,7 +13,7 @@
|
||||
$GLOBALS['TL_DCA']['tl_content']['metapalettes']['leaflet'] = [
|
||||
'type' => ['type', 'headline'],
|
||||
'leaflet' => ['leaflet_map', 'leaflet_mapId', 'leaflet_width', 'leaflet_height'],
|
||||
'template' => [':hide', 'customTpl', 'leaflet_template'],
|
||||
'templates' => [':hide', 'customTpl', 'leaflet_template'],
|
||||
'protected' => [':hide', 'protected'],
|
||||
'expert' => [':hide', 'guests', 'cssID', 'space'],
|
||||
'invisible' => [':hide', 'invisible', 'start', 'start'],
|
||||
|
||||
@@ -5,8 +5,7 @@
|
||||
*
|
||||
* @package contao-leaflet-maps
|
||||
* @author David Molineus <david.molineus@netzmacht.de>
|
||||
* @author Sven Baumann <baumann.sv@gmail.com>
|
||||
* @copyright 2014-2022 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
|
||||
* @filesource
|
||||
*/
|
||||
@@ -68,7 +67,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_control'] = [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['delete'],
|
||||
'href' => 'act=delete',
|
||||
'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()"',
|
||||
],
|
||||
'toggle' => [
|
||||
@@ -165,7 +164,6 @@ $GLOBALS['TL_DCA']['tl_leaflet_control'] = [
|
||||
'maxlength' => 255,
|
||||
'tl_class' => 'w50',
|
||||
'nullIfEmpty' => true,
|
||||
'doNotCopy' => true,
|
||||
],
|
||||
'toolkit' => [
|
||||
'alias_generator' => [
|
||||
|
||||
@@ -5,12 +5,13 @@
|
||||
*
|
||||
* @package contao-leaflet-maps
|
||||
* @author David Molineus <david.molineus@netzmacht.de>
|
||||
* @author Sven Baumann <baumann.sv@gmail.com>
|
||||
* @copyright 2014-2022 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
|
||||
* @filesource
|
||||
*/
|
||||
|
||||
use Netzmacht\Contao\Leaflet\Listener\Dca\OperationsListener;
|
||||
|
||||
$GLOBALS['TL_DCA']['tl_leaflet_icon'] = [
|
||||
'config' => [
|
||||
'dataContainer' => 'Table',
|
||||
@@ -21,6 +22,9 @@ $GLOBALS['TL_DCA']['tl_leaflet_icon'] = [
|
||||
'alias' => 'unique',
|
||||
],
|
||||
],
|
||||
'onload_callback' => [
|
||||
['netzmacht.contao_leaflet.listeners.dca.icon', 'checkPermission'],
|
||||
],
|
||||
'onsubmit_callback' => [
|
||||
['netzmacht.contao_leaflet.listeners.dca.leaflet', 'clearCache'],
|
||||
],
|
||||
@@ -46,16 +50,19 @@ $GLOBALS['TL_DCA']['tl_leaflet_icon'] = [
|
||||
'attributes' => 'onclick="Backend.getScrollOffset();" accesskey="e"',
|
||||
],
|
||||
'styles' => [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_icon']['styles'],
|
||||
'href' => 'table=tl_leaflet_style',
|
||||
'icon' => 'bundles/netzmachtcontaoleaflet/img/style.png',
|
||||
'attributes' => 'onclick="Backend.getScrollOffset();"',
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_icon']['styles'],
|
||||
'href' => 'table=tl_leaflet_style',
|
||||
'icon' => 'bundles/netzmachtcontaoleaflet/img/style.png',
|
||||
'attributes' => 'onclick="Backend.getScrollOffset();"',
|
||||
'button_callback' => [OperationsListener::class, 'styleOperation'],
|
||||
|
||||
],
|
||||
'popups' => [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_icon']['popups'],
|
||||
'href' => 'table=tl_leaflet_popup',
|
||||
'icon' => 'bundles/netzmachtcontaoleaflet/img/popup.png',
|
||||
'attributes' => 'onclick="Backend.getScrollOffset();"',
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_icon']['popups'],
|
||||
'href' => 'table=tl_leaflet_popup',
|
||||
'icon' => 'bundles/netzmachtcontaoleaflet/img/popup.png',
|
||||
'attributes' => 'onclick="Backend.getScrollOffset();"',
|
||||
'button_callback' => [OperationsListener::class, 'popupOperation'],
|
||||
],
|
||||
'all' => [
|
||||
'label' => &$GLOBALS['TL_LANG']['MSC']['all'],
|
||||
@@ -79,7 +86,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_icon'] = [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_icon']['delete'],
|
||||
'href' => 'act=delete',
|
||||
'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()"',
|
||||
],
|
||||
'toggle' => [
|
||||
@@ -180,14 +187,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_icon'] = [
|
||||
['netzmacht.contao_toolkit.dca.listeners.alias_generator', 'handleSaveCallback'],
|
||||
['netzmacht.contao_leaflet.listeners.dca.validator', 'validateAlias'],
|
||||
],
|
||||
'eval' => [
|
||||
'mandatory' => false,
|
||||
'maxlength' => 255,
|
||||
'tl_class' => 'w50',
|
||||
'unique' => true,
|
||||
'doNotCopy' => true,
|
||||
'nullIfEmpty' => true,
|
||||
],
|
||||
'eval' => ['mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true],
|
||||
'toolkit' => [
|
||||
'alias_generator' => [
|
||||
'factory' => 'netzmacht.contao_leaflet.definition.alias_generator.factory_default',
|
||||
|
||||
@@ -5,22 +5,18 @@
|
||||
*
|
||||
* @package contao-leaflet-maps
|
||||
* @author David Molineus <david.molineus@netzmacht.de>
|
||||
* @author Sven Baumann <baumann.sv@gmail.com>
|
||||
* @copyright 2014-2022 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
|
||||
* @filesource
|
||||
*/
|
||||
|
||||
\Contao\Controller::loadLanguageFile('leaflet');
|
||||
use Netzmacht\Contao\Leaflet\Listener\Dca\OperationsListener;
|
||||
|
||||
$GLOBALS['TL_DCA']['tl_leaflet_layer'] = [
|
||||
'config' => [
|
||||
'dataContainer' => 'Table',
|
||||
'enableVersioning' => true,
|
||||
'ctable' => ['tl_leaflet_vector', 'tl_leaflet_marker'],
|
||||
'ondelete_callback' => [
|
||||
['netzmacht.contao_leaflet.listeners.dca.layer', 'deleteRelations'],
|
||||
],
|
||||
'sql' => [
|
||||
'keys' => [
|
||||
'id' => 'primary',
|
||||
@@ -29,8 +25,12 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = [
|
||||
],
|
||||
],
|
||||
'onload_callback' => [
|
||||
['netzmacht.contao_leaflet.listeners.dca.layer', 'checkPermissions'],
|
||||
['netzmacht.contao_leaflet.listeners.dca.leaflet', 'loadLanguageFile'],
|
||||
],
|
||||
'ondelete_callback' => [
|
||||
['netzmacht.contao_leaflet.listeners.dca.layer', 'deleteRelations'],
|
||||
],
|
||||
'onsubmit_callback' => [
|
||||
['netzmacht.contao_leaflet.listeners.dca.leaflet', 'clearCache'],
|
||||
],
|
||||
@@ -51,22 +51,25 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = [
|
||||
],
|
||||
'global_operations' => [
|
||||
'styles' => [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['styles'],
|
||||
'href' => 'table=tl_leaflet_style',
|
||||
'icon' => 'bundles/netzmachtcontaoleaflet/img/style.png',
|
||||
'attributes' => 'onclick="Backend.getScrollOffset();"',
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['styles'],
|
||||
'href' => 'table=tl_leaflet_style',
|
||||
'icon' => 'bundles/netzmachtcontaoleaflet/img/style.png',
|
||||
'attributes' => 'onclick="Backend.getScrollOffset();"',
|
||||
'button_callback' => [OperationsListener::class, 'styleOperation'],
|
||||
],
|
||||
'icons' => [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['icons'],
|
||||
'href' => 'table=tl_leaflet_icon',
|
||||
'icon' => 'bundles/netzmachtcontaoleaflet/img/icons.png',
|
||||
'attributes' => 'onclick="Backend.getScrollOffset();"',
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['icons'],
|
||||
'href' => 'table=tl_leaflet_icon',
|
||||
'icon' => 'bundles/netzmachtcontaoleaflet/img/icons.png',
|
||||
'attributes' => 'onclick="Backend.getScrollOffset();"',
|
||||
'button_callback' => [OperationsListener::class, 'iconOperation'],
|
||||
],
|
||||
'popups' => [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['popups'],
|
||||
'href' => 'table=tl_leaflet_popup',
|
||||
'icon' => 'bundles/netzmachtcontaoleaflet/img/popup.png',
|
||||
'attributes' => 'onclick="Backend.getScrollOffset();"',
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['popups'],
|
||||
'href' => 'table=tl_leaflet_popup',
|
||||
'icon' => 'bundles/netzmachtcontaoleaflet/img/popup.png',
|
||||
'attributes' => 'onclick="Backend.getScrollOffset();"',
|
||||
'button_callback' => [OperationsListener::class, 'popupOperation'],
|
||||
],
|
||||
'all' => [
|
||||
'label' => &$GLOBALS['TL_LANG']['MSC']['all'],
|
||||
@@ -74,11 +77,6 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = [
|
||||
'class' => 'header_edit_all',
|
||||
'attributes' => 'onclick="Backend.getScrollOffset();"',
|
||||
],
|
||||
'toggleNodes' => [
|
||||
'href' => 'ptg=all',
|
||||
'class' => 'header_toggle',
|
||||
'showOnSelect' => true,
|
||||
],
|
||||
],
|
||||
'operations' => [
|
||||
'markers' => [
|
||||
@@ -94,27 +92,31 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = [
|
||||
'button_callback' => ['netzmacht.contao_leaflet.listeners.dca.layer', 'generateVectorsButton'],
|
||||
],
|
||||
'edit' => [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['edit'],
|
||||
'href' => 'act=edit',
|
||||
'icon' => 'header.gif',
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['edit'],
|
||||
'href' => 'act=edit',
|
||||
'icon' => 'header.gif',
|
||||
'button_callback' => ['netzmacht.contao_leaflet.listeners.dca.layer', 'generateEditButton'],
|
||||
],
|
||||
'copy' => [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['copy'],
|
||||
'href' => 'act=copy',
|
||||
'icon' => 'copy.gif',
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['copy'],
|
||||
'href' => 'act=copy',
|
||||
'icon' => 'copy.gif',
|
||||
'button_callback' => ['netzmacht.contao_leaflet.listeners.dca.layer', 'generateCopyButton'],
|
||||
],
|
||||
'cut' => [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['cut'],
|
||||
'href' => 'act=paste&mode=cut',
|
||||
'icon' => 'cut.gif',
|
||||
'attributes' => 'onclick="Backend.getScrollOffset()"',
|
||||
'button_callback' => ['netzmacht.contao_leaflet.listeners.dca.layer', 'generateEditButton'],
|
||||
],
|
||||
'delete' => [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['delete'],
|
||||
'href' => 'act=delete',
|
||||
'icon' => 'delete.gif',
|
||||
'attributes' => 'onclick="if(!confirm(\'' . ($GLOBALS['TL_LANG']['MSC']['deleteConfirm'] ?? '')
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['delete'],
|
||||
'href' => 'act=delete',
|
||||
'icon' => 'delete.gif',
|
||||
'attributes' => 'onclick="if(!confirm(\'' . $GLOBALS['TL_LANG']['MSC']['deleteConfirm']
|
||||
. '\'))return false;Backend.getScrollOffset()"',
|
||||
'button_callback' => ['netzmacht.contao_leaflet.listeners.dca.layer', 'generateDeleteButton'],
|
||||
],
|
||||
'toggle' => [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['toggle'],
|
||||
@@ -122,8 +124,8 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = [
|
||||
'attributes' => 'onclick="Backend.getScrollOffset();
|
||||
return ContaoLeafletAjaxRequest.toggleVisibility(this,%s)"',
|
||||
'button_callback' => [
|
||||
'netzmacht.contao_toolkit.dca.listeners.state_button_callback',
|
||||
'handleButtonCallback',
|
||||
'netzmacht.contao_leaflet.listeners.dca.layer',
|
||||
'generateToggleButton',
|
||||
],
|
||||
'toolkit' => [
|
||||
'state_button' => [
|
||||
@@ -240,10 +242,8 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = [
|
||||
'provider' => ['tile_provider', 'tile_provider_variant'],
|
||||
],
|
||||
'tile_provider' => [
|
||||
'MapBox' => ['tile_provider_key'],
|
||||
'HERE' => ['tile_provider_key', 'tile_provider_code'],
|
||||
'OpenWeatherMap' => ['tile_provider_key'],
|
||||
'Thunderforest' => ['tile_provider_key'],
|
||||
'MapBox' => ['tile_provider_key'],
|
||||
'HERE' => ['tile_provider_key', 'tile_provider_code'],
|
||||
],
|
||||
'fileFormat' => [
|
||||
'!' => ['file'],
|
||||
@@ -286,14 +286,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = [
|
||||
['netzmacht.contao_toolkit.dca.listeners.alias_generator', 'handleSaveCallback'],
|
||||
['netzmacht.contao_leaflet.listeners.dca.validator', 'validateAlias'],
|
||||
],
|
||||
'eval' => [
|
||||
'mandatory' => false,
|
||||
'maxlength' => 255,
|
||||
'tl_class' => 'w50',
|
||||
'unique' => true,
|
||||
'nullIfEmpty' => true,
|
||||
'doNotCopy' => true,
|
||||
],
|
||||
'eval' => ['mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true],
|
||||
'toolkit' => [
|
||||
'alias_generator' => [
|
||||
'factory' => 'netzmacht.contao_leaflet.definition.alias_generator.factory_default',
|
||||
@@ -641,7 +634,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = [
|
||||
'exclude' => true,
|
||||
'inputType' => 'text',
|
||||
'default' => '',
|
||||
'eval' => ['maxlength' => 255, 'tl_class' => 'clr long', 'allowHtml' => true],
|
||||
'eval' => ['maxlength' => 255, 'tl_class' => 'long', 'allowHtml' => true],
|
||||
'sql' => "varchar(255) NOT NULL default ''",
|
||||
],
|
||||
'tms' => [
|
||||
|
||||
@@ -5,9 +5,7 @@
|
||||
*
|
||||
* @package contao-leaflet-maps
|
||||
* @author David Molineus <david.molineus@netzmacht.de>
|
||||
* @author Sven Baumann <baumann.sv@gmail.com>
|
||||
* @author Stefan Heimes <stefan_heimes@hotmail.com>
|
||||
* @copyright 2014-2022 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
|
||||
* @filesource
|
||||
*/
|
||||
@@ -30,9 +28,6 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = [
|
||||
'onsubmit_callback' => [
|
||||
['netzmacht.contao_leaflet.listeners.dca.leaflet', 'clearCache'],
|
||||
],
|
||||
'oncopy_callback' => [
|
||||
['netzmacht.contao_leaflet.listeners.dca.map', 'copyLayerRelations'],
|
||||
],
|
||||
],
|
||||
|
||||
'list' => [
|
||||
@@ -75,7 +70,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_map']['delete'],
|
||||
'href' => 'act=delete',
|
||||
'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()"',
|
||||
],
|
||||
'show' => [
|
||||
@@ -162,14 +157,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = [
|
||||
['netzmacht.contao_toolkit.dca.listeners.alias_generator', 'handleSaveCallback'],
|
||||
['netzmacht.contao_leaflet.listeners.dca.validator', 'validateAlias'],
|
||||
],
|
||||
'eval' => [
|
||||
'mandatory' => false,
|
||||
'maxlength' => 255,
|
||||
'tl_class' => 'w50',
|
||||
'unique' => true,
|
||||
'doNotCopy' => true,
|
||||
'nullIfEmpty' => true,
|
||||
],
|
||||
'eval' => ['mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true],
|
||||
'toolkit' => [
|
||||
'alias_generator' => [
|
||||
'factory' => 'netzmacht.contao_leaflet.definition.alias_generator.factory_default',
|
||||
@@ -428,12 +416,10 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = [
|
||||
'exclude' => true,
|
||||
'inputType' => 'textarea',
|
||||
'eval' => [
|
||||
'tl_class' => 'clr lng',
|
||||
'preserveTags' => true,
|
||||
'decodeEntities' => true,
|
||||
'allowHtml' => true,
|
||||
'style' => 'min-height: 40px;',
|
||||
'rte' => 'ace|json',
|
||||
'tl_class' => 'clr lng',
|
||||
'allowHtml' => true,
|
||||
'style' => 'min-height: 40px;',
|
||||
'rte' => 'ace|json',
|
||||
],
|
||||
'sql' => 'text NULL',
|
||||
],
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
*
|
||||
* @package contao-leaflet-maps
|
||||
* @author David Molineus <david.molineus@netzmacht.de>
|
||||
* @author Sven Baumann <baumann.sv@gmail.com>
|
||||
* @author Stefan Heimes <stefan_heimes@hotmail.com>
|
||||
* @copyright 2014-2022 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
|
||||
* @filesource
|
||||
*/
|
||||
|
||||
use Netzmacht\Contao\Leaflet\Listener\Dca\OperationsListener;
|
||||
|
||||
$GLOBALS['TL_DCA']['tl_leaflet_marker'] = [
|
||||
'config' => [
|
||||
'dataContainer' => 'Table',
|
||||
@@ -25,6 +25,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = [
|
||||
],
|
||||
],
|
||||
'onload_callback' => [
|
||||
['netzmacht.contao_leaflet.listeners.dca.marker', 'checkPermissions'],
|
||||
['netzmacht.contao_leaflet.listeners.dca.leaflet', 'loadLanguageFile'],
|
||||
],
|
||||
'onsubmit_callback' => [
|
||||
@@ -47,16 +48,18 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = [
|
||||
],
|
||||
'global_operations' => [
|
||||
'icons' => [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_marker']['icons'],
|
||||
'href' => 'table=tl_leaflet_icon&id=',
|
||||
'icon' => 'bundles/netzmachtcontaoleaflet/img/icons.png',
|
||||
'attributes' => 'onclick="Backend.getScrollOffset();" accesskey="e"',
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_marker']['icons'],
|
||||
'href' => 'table=tl_leaflet_icon&id=',
|
||||
'icon' => 'bundles/netzmachtcontaoleaflet/img/icons.png',
|
||||
'attributes' => 'onclick="Backend.getScrollOffset();" accesskey="e"',
|
||||
'button_callback' => [OperationsListener::class, 'iconOperation'],
|
||||
],
|
||||
'popups' => [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_marker']['popups'],
|
||||
'href' => 'table=tl_leaflet_popup',
|
||||
'icon' => 'bundles/netzmachtcontaoleaflet/img/popup.png',
|
||||
'attributes' => 'onclick="Backend.getScrollOffset();"',
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_marker']['popups'],
|
||||
'href' => 'table=tl_leaflet_popup',
|
||||
'icon' => 'bundles/netzmachtcontaoleaflet/img/popup.png',
|
||||
'attributes' => 'onclick="Backend.getScrollOffset();"',
|
||||
'button_callback' => [OperationsListener::class, 'popupOperation'],
|
||||
],
|
||||
'all' => [
|
||||
'label' => &$GLOBALS['TL_LANG']['MSC']['all'],
|
||||
@@ -80,7 +83,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_marker']['delete'],
|
||||
'href' => 'act=delete',
|
||||
'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()"',
|
||||
],
|
||||
'toggle' => [
|
||||
@@ -162,14 +165,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = [
|
||||
['netzmacht.contao_toolkit.dca.listeners.alias_generator', 'handleSaveCallback'],
|
||||
['netzmacht.contao_leaflet.listeners.dca.validator', 'validateAlias'],
|
||||
],
|
||||
'eval' => [
|
||||
'mandatory' => false,
|
||||
'maxlength' => 255,
|
||||
'tl_class' => 'w50',
|
||||
'unique' => true,
|
||||
'doNotCopy' => true,
|
||||
'nullIfEmpty' => true,
|
||||
],
|
||||
'eval' => ['mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true],
|
||||
'toolkit' => [
|
||||
'alias_generator' => [
|
||||
'factory' => 'netzmacht.contao_leaflet.definition.alias_generator.factory_default',
|
||||
@@ -341,11 +337,9 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = [
|
||||
'inputType' => 'textarea',
|
||||
'eval' => [
|
||||
'tl_class' => 'clr lng',
|
||||
'preserveTags' => true,
|
||||
'decodeEntities' => true,
|
||||
'allowHtml' => true,
|
||||
'style' => 'min-height: 40px;',
|
||||
'rte' => 'ace|json',
|
||||
'allowHtml' => true,
|
||||
'style' => 'min-height: 40px;',
|
||||
'rte' => 'ace|json',
|
||||
],
|
||||
'sql' => 'text NULL',
|
||||
],
|
||||
|
||||
@@ -5,12 +5,13 @@
|
||||
*
|
||||
* @package contao-leaflet-maps
|
||||
* @author David Molineus <david.molineus@netzmacht.de>
|
||||
* @author Sven Baumann <baumann.sv@gmail.com>
|
||||
* @copyright 2014-2022 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
|
||||
* @filesource
|
||||
*/
|
||||
|
||||
use Netzmacht\Contao\Leaflet\Listener\Dca\OperationsListener;
|
||||
|
||||
$GLOBALS['TL_DCA']['tl_leaflet_popup'] = [
|
||||
'config' => [
|
||||
'dataContainer' => 'Table',
|
||||
@@ -21,6 +22,9 @@ $GLOBALS['TL_DCA']['tl_leaflet_popup'] = [
|
||||
'alias' => 'unique',
|
||||
],
|
||||
],
|
||||
'onload_callback' => [
|
||||
['netzmacht.contao_leaflet.listeners.dca.popup', 'checkPermission'],
|
||||
],
|
||||
'onsubmit_callback' => [
|
||||
['netzmacht.contao_leaflet.listeners.dca.leaflet', 'clearCache'],
|
||||
],
|
||||
@@ -46,16 +50,18 @@ $GLOBALS['TL_DCA']['tl_leaflet_popup'] = [
|
||||
'attributes' => 'onclick="Backend.getScrollOffset();" accesskey="e"',
|
||||
],
|
||||
'styles' => [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_popup']['styles'],
|
||||
'href' => 'table=tl_leaflet_style',
|
||||
'icon' => 'bundles/netzmachtcontaoleaflet/img/style.png',
|
||||
'attributes' => 'onclick="Backend.getScrollOffset();"',
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_popup']['styles'],
|
||||
'href' => 'table=tl_leaflet_style',
|
||||
'icon' => 'bundles/netzmachtcontaoleaflet/img/style.png',
|
||||
'attributes' => 'onclick="Backend.getScrollOffset();"',
|
||||
'button_callback' => [OperationsListener::class, 'styleOperation'],
|
||||
],
|
||||
'icons' => [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_popup']['icons'],
|
||||
'href' => 'table=tl_leaflet_icon',
|
||||
'icon' => 'bundles/netzmachtcontaoleaflet/img/icons.png',
|
||||
'attributes' => 'onclick="Backend.getScrollOffset();"',
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_popup']['icons'],
|
||||
'href' => 'table=tl_leaflet_icon',
|
||||
'icon' => 'bundles/netzmachtcontaoleaflet/img/icons.png',
|
||||
'attributes' => 'onclick="Backend.getScrollOffset();"',
|
||||
'button_callback' => [OperationsListener::class, 'iconOperation'],
|
||||
],
|
||||
'all' => [
|
||||
'label' => &$GLOBALS['TL_LANG']['MSC']['all'],
|
||||
@@ -79,7 +85,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_popup'] = [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_popup']['delete'],
|
||||
'href' => 'act=delete',
|
||||
'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()"',
|
||||
],
|
||||
'toggle' => [
|
||||
@@ -152,14 +158,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_popup'] = [
|
||||
['netzmacht.contao_toolkit.dca.listeners.alias_generator', 'handleSaveCallback'],
|
||||
['netzmacht.contao_leaflet.listeners.dca.validator', 'validateAlias'],
|
||||
],
|
||||
'eval' => [
|
||||
'mandatory' => false,
|
||||
'maxlength' => 255,
|
||||
'tl_class' => 'w50',
|
||||
'unique' => true,
|
||||
'doNotCopy' => true,
|
||||
'nullIfEmpty' => true,
|
||||
],
|
||||
'eval' => ['mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true],
|
||||
'toolkit' => [
|
||||
'alias_generator' => [
|
||||
'factory' => 'netzmacht.contao_leaflet.definition.alias_generator.factory_default',
|
||||
|
||||
@@ -5,12 +5,13 @@
|
||||
*
|
||||
* @package contao-leaflet-maps
|
||||
* @author David Molineus <david.molineus@netzmacht.de>
|
||||
* @author Sven Baumann <baumann.sv@gmail.com>
|
||||
* @copyright 2014-2022 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
|
||||
* @filesource
|
||||
*/
|
||||
|
||||
use Netzmacht\Contao\Leaflet\Listener\Dca\OperationsListener;
|
||||
|
||||
$GLOBALS['TL_DCA']['tl_leaflet_style'] = [
|
||||
'config' => [
|
||||
'dataContainer' => 'Table',
|
||||
@@ -21,6 +22,9 @@ $GLOBALS['TL_DCA']['tl_leaflet_style'] = [
|
||||
'alias' => 'unique',
|
||||
],
|
||||
],
|
||||
'onload_callback' => [
|
||||
['netzmacht.contao_leaflet.listeners.dca.style', 'checkPermission'],
|
||||
],
|
||||
'onsubmit_callback' => [
|
||||
['netzmacht.contao_leaflet.listeners.dca.leaflet', 'clearCache'],
|
||||
],
|
||||
@@ -46,16 +50,18 @@ $GLOBALS['TL_DCA']['tl_leaflet_style'] = [
|
||||
'attributes' => 'onclick="Backend.getScrollOffset();" accesskey="e"',
|
||||
],
|
||||
'icons' => [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_style']['icons'],
|
||||
'href' => 'table=tl_leaflet_icon',
|
||||
'icon' => 'bundles/netzmachtcontaoleaflet/img/icons.png',
|
||||
'attributes' => 'onclick="Backend.getScrollOffset();"',
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_style']['icons'],
|
||||
'href' => 'table=tl_leaflet_icon',
|
||||
'icon' => 'bundles/netzmachtcontaoleaflet/img/icons.png',
|
||||
'attributes' => 'onclick="Backend.getScrollOffset();"',
|
||||
'button_callback' => [OperationsListener::class, 'iconOperation'],
|
||||
],
|
||||
'popups' => [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_style']['popups'],
|
||||
'href' => 'table=tl_leaflet_popup',
|
||||
'icon' => 'bundles/netzmachtcontaoleaflet/img/popup.png',
|
||||
'attributes' => 'onclick="Backend.getScrollOffset();"',
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_style']['popups'],
|
||||
'href' => 'table=tl_leaflet_popup',
|
||||
'icon' => 'bundles/netzmachtcontaoleaflet/img/popup.png',
|
||||
'attributes' => 'onclick="Backend.getScrollOffset();"',
|
||||
'button_callback' => [OperationsListener::class, 'popupOperation'],
|
||||
],
|
||||
'all' => [
|
||||
'label' => &$GLOBALS['TL_LANG']['MSC']['all'],
|
||||
@@ -79,7 +85,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_style'] = [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_style']['delete'],
|
||||
'href' => 'act=delete',
|
||||
'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()"',
|
||||
],
|
||||
'toggle' => [
|
||||
@@ -146,14 +152,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_style'] = [
|
||||
['netzmacht.contao_toolkit.dca.listeners.alias_generator', 'handleSaveCallback'],
|
||||
['netzmacht.contao_leaflet.listeners.dca.validator', 'validateAlias'],
|
||||
],
|
||||
'eval' => [
|
||||
'mandatory' => false,
|
||||
'maxlength' => 255,
|
||||
'tl_class' => 'w50',
|
||||
'unique' => true,
|
||||
'doNotCopy' => true,
|
||||
'nullIfEmpty' => true,
|
||||
],
|
||||
'eval' => ['mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true],
|
||||
'toolkit' => [
|
||||
'alias_generator' => [
|
||||
'factory' => 'netzmacht.contao_leaflet.definition.alias_generator.factory_default',
|
||||
|
||||
@@ -5,13 +5,13 @@
|
||||
*
|
||||
* @package contao-leaflet-maps
|
||||
* @author David Molineus <david.molineus@netzmacht.de>
|
||||
* @author Sven Baumann <baumann.sv@gmail.com>
|
||||
* @author Stefan Heimes <stefan_heimes@hotmail.com>
|
||||
* @copyright 2014-2022 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
|
||||
* @filesource
|
||||
*/
|
||||
|
||||
use Netzmacht\Contao\Leaflet\Listener\Dca\OperationsListener;
|
||||
|
||||
$GLOBALS['TL_DCA']['tl_leaflet_vector'] = [
|
||||
'config' => [
|
||||
'dataContainer' => 'Table',
|
||||
@@ -47,16 +47,18 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = [
|
||||
],
|
||||
'global_operations' => [
|
||||
'styles' => [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_vector']['styles'],
|
||||
'href' => 'table=tl_leaflet_style',
|
||||
'icon' => 'bundles/netzmachtcontaoleaflet/img/style.png',
|
||||
'attributes' => 'onclick="Backend.getScrollOffset();"',
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_vector']['styles'],
|
||||
'href' => 'table=tl_leaflet_style',
|
||||
'icon' => 'bundles/netzmachtcontaoleaflet/img/style.png',
|
||||
'attributes' => 'onclick="Backend.getScrollOffset();"',
|
||||
'button_callback' => [OperationsListener::class, 'styleOperation'],
|
||||
],
|
||||
'popups' => [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_vector']['popups'],
|
||||
'href' => 'table=tl_leaflet_popup',
|
||||
'icon' => 'bundles/netzmachtcontaoleaflet/img/popup.png',
|
||||
'attributes' => 'onclick="Backend.getScrollOffset();"',
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_vector']['popups'],
|
||||
'href' => 'table=tl_leaflet_popup',
|
||||
'icon' => 'bundles/netzmachtcontaoleaflet/img/popup.png',
|
||||
'attributes' => 'onclick="Backend.getScrollOffset();"',
|
||||
'button_callback' => [OperationsListener::class, 'popupOperation'],
|
||||
],
|
||||
'all' => [
|
||||
'label' => &$GLOBALS['TL_LANG']['MSC']['all'],
|
||||
@@ -86,7 +88,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_vector']['delete'],
|
||||
'href' => 'act=delete',
|
||||
'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()"',
|
||||
],
|
||||
'toggle' => [
|
||||
@@ -187,14 +189,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = [
|
||||
['netzmacht.contao_toolkit.dca.listeners.alias_generator', 'handleSaveCallback'],
|
||||
['netzmacht.contao_leaflet.listeners.dca.validator', 'validateAlias'],
|
||||
],
|
||||
'eval' => [
|
||||
'mandatory' => false,
|
||||
'maxlength' => 255,
|
||||
'tl_class' => 'w50',
|
||||
'unique' => true,
|
||||
'doNotCopy' => true,
|
||||
'nullIfEmpty' => true,
|
||||
],
|
||||
'eval' => ['mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true],
|
||||
'toolkit' => [
|
||||
'alias_generator' => [
|
||||
'factory' => 'netzmacht.contao_leaflet.definition.alias_generator.factory_default',
|
||||
@@ -380,12 +375,10 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = [
|
||||
'exclude' => true,
|
||||
'inputType' => 'textarea',
|
||||
'eval' => [
|
||||
'tl_class' => 'clr lng',
|
||||
'preserveTags' => true,
|
||||
'decodeEntities' => true,
|
||||
'allowHtml' => true,
|
||||
'style' => 'min-height: 40px;',
|
||||
'rte' => 'ace|json',
|
||||
'tl_class' => 'clr lng',
|
||||
'allowHtml' => true,
|
||||
'style' => 'min-height: 40px;',
|
||||
'rte' => 'ace|json',
|
||||
],
|
||||
'sql' => 'text NULL',
|
||||
],
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
*
|
||||
* @package contao-leaflet-maps
|
||||
* @author David Molineus <david.molineus@netzmacht.de>
|
||||
* @author Fritz Michael Gschwantner <fmg@inspiredminds.at>
|
||||
* @copyright 2014-2017 netzmacht David Molineus. All rights reserved.
|
||||
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
|
||||
* @filesource
|
||||
@@ -14,7 +13,7 @@
|
||||
$GLOBALS['TL_DCA']['tl_module']['metapalettes']['leaflet'] = [
|
||||
'type' => ['name', 'type', 'headline'],
|
||||
'leaflet' => ['leaflet_map', 'leaflet_mapId', 'leaflet_width', 'leaflet_height', 'leaflet_template'],
|
||||
'template' => [':hide', 'customTpl'],
|
||||
'templates' => [':hide', 'customTpl'],
|
||||
'protected' => [':hide', 'protected'],
|
||||
'expert' => [':hide', 'guests', 'cssID', 'space'],
|
||||
'invisible' => [':hide', 'invisible', 'start', 'start'],
|
||||
|
||||
68
src/Bundle/Resources/contao/dca/tl_user.php
Normal file
68
src/Bundle/Resources/contao/dca/tl_user.php
Normal file
@@ -0,0 +1,68 @@
|
||||
<?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);
|
||||
|
||||
use Contao\CoreBundle\DataContainer\PaletteManipulator;
|
||||
|
||||
PaletteManipulator::create()
|
||||
->addLegend('leaflet_legend', 'amg_legend', PaletteManipulator::POSITION_BEFORE)
|
||||
->addField(
|
||||
['leaflet_layers', 'leaflet_layer_permissions', 'leaflet_tables'],
|
||||
'leaflet_legend',
|
||||
PaletteManipulator::POSITION_APPEND
|
||||
)
|
||||
->applyToPalette('extend', 'tl_user')
|
||||
->applyToPalette('custom', 'tl_user');
|
||||
|
||||
|
||||
$GLOBALS['TL_DCA']['tl_user']['fields']['leaflet_layers'] = [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_user']['leaflet_layers'],
|
||||
'exclude' => true,
|
||||
'inputType' => 'treePicker',
|
||||
'eval' => [
|
||||
'foreignTable' => 'tl_leaflet_layer',
|
||||
'titleField' => 'title',
|
||||
'searchField' => 'title',
|
||||
'managerHref' => 'do=leaflet_layer',
|
||||
'fieldType' => 'checkbox',
|
||||
'selectParents' => true,
|
||||
'multiple' => true,
|
||||
'pickerCallback' => ['netzmacht.contao_leaflet.listeners.dca.user', 'generateLayersRowLabel']
|
||||
],
|
||||
'sql' => 'blob NULL',
|
||||
];
|
||||
|
||||
$GLOBALS['TL_DCA']['tl_user']['fields']['leaflet_tables'] = [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_user']['leaflet_tables'],
|
||||
'exclude' => true,
|
||||
'inputType' => 'checkbox',
|
||||
'options' => ['tl_leaflet_style', 'tl_leaflet_icon', 'tl_leaflet_popup'],
|
||||
'reference' => &$GLOBALS['TL_LANG']['MOD'],
|
||||
'eval' => [
|
||||
'multiple' => true,
|
||||
],
|
||||
'sql' => 'mediumblob NULL',
|
||||
];
|
||||
|
||||
$GLOBALS['TL_DCA']['tl_user']['fields']['leaflet_layer_permissions'] = [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_user']['leaflet_layer_permissions'],
|
||||
'exclude' => true,
|
||||
'inputType' => 'checkbox',
|
||||
'options' => ['create', 'edit', 'delete', 'data'],
|
||||
'reference' => &$GLOBALS['TL_LANG']['tl_user']['leaflet_layer_permissions_options'],
|
||||
'eval' => [
|
||||
'helpwizard' => true,
|
||||
'multiple' => true,
|
||||
],
|
||||
'sql' => 'mediumblob NULL',
|
||||
];
|
||||
67
src/Bundle/Resources/contao/dca/tl_user_group.php
Normal file
67
src/Bundle/Resources/contao/dca/tl_user_group.php
Normal file
@@ -0,0 +1,67 @@
|
||||
<?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);
|
||||
|
||||
use Contao\CoreBundle\DataContainer\PaletteManipulator;
|
||||
|
||||
PaletteManipulator::create()
|
||||
->addLegend('leaflet_legend', 'amg_legend', PaletteManipulator::POSITION_BEFORE)
|
||||
->addField(
|
||||
['leaflet_layers', 'leaflet_layer_permissions', 'leaflet_tables'],
|
||||
'leaflet_legend',
|
||||
PaletteManipulator::POSITION_APPEND
|
||||
)
|
||||
->applyToPalette('default', 'tl_user_group');
|
||||
|
||||
|
||||
$GLOBALS['TL_DCA']['tl_user_group']['fields']['leaflet_layers'] = [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_user_group']['leaflet_layers'],
|
||||
'exclude' => true,
|
||||
'inputType' => 'treePicker',
|
||||
'eval' => [
|
||||
'foreignTable' => 'tl_leaflet_layer',
|
||||
'titleField' => 'title',
|
||||
'searchField' => 'title',
|
||||
'managerHref' => 'do=leaflet_layer',
|
||||
'fieldType' => 'checkbox',
|
||||
'selectParents' => true,
|
||||
'multiple' => true,
|
||||
'pickerCallback' => ['netzmacht.contao_leaflet.listeners.dca.user_group', 'generateLayersRowLabel']
|
||||
],
|
||||
'sql' => 'blob NULL',
|
||||
];
|
||||
|
||||
$GLOBALS['TL_DCA']['tl_user_group']['fields']['leaflet_tables'] = [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_user_group']['leaflet_tables'],
|
||||
'exclude' => true,
|
||||
'inputType' => 'checkbox',
|
||||
'options' => ['tl_leaflet_style', 'tl_leaflet_icon', 'tl_leaflet_popup'],
|
||||
'reference' => &$GLOBALS['TL_LANG']['MOD'],
|
||||
'eval' => [
|
||||
'multiple' => true,
|
||||
],
|
||||
'sql' => 'mediumblob NULL',
|
||||
];
|
||||
|
||||
$GLOBALS['TL_DCA']['tl_user_group']['fields']['leaflet_layer_permissions'] = [
|
||||
'label' => &$GLOBALS['TL_LANG']['tl_user_group']['leaflet_layer_permissions'],
|
||||
'exclude' => true,
|
||||
'inputType' => 'checkbox',
|
||||
'options' => ['create', 'edit', 'delete', 'data'],
|
||||
'reference' => &$GLOBALS['TL_LANG']['tl_user_group']['leaflet_layer_permissions_options'],
|
||||
'eval' => [
|
||||
'helpwizard' => true,
|
||||
'multiple' => true,
|
||||
],
|
||||
'sql' => 'mediumblob NULL',
|
||||
];
|
||||
@@ -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']['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']['1'] = 'Icon-Stile verwalten';
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_layer']['icons']['1'] = 'Stile 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']['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']['polygonOptions']['0'] = 'Polygon-Optionen';
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_layer']['popups']['0'] = 'Popups verwalten';
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_layer']['popups']['1'] = 'Marker Popups verwalten';
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_layer']['popups']['1'] = 'Popup-Icons verwalten';
|
||||
$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']['removeOutsideVisibleBounds']['0'] = 'Entfernen, wenn außerhalb der sichtbaren Begrenzung';
|
||||
|
||||
@@ -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']['edit']['0'] = 'Popup bearbeiten';
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_popup']['edit']['1'] = 'Popup ID %s bearbeiten';
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_popup']['icons']['0'] = 'Icons verwalten';
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_popup']['icons']['1'] = 'Marker-Icons verwalten';
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_popup']['icons']['0'] = 'Popups verwalten';
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_popup']['icons']['1'] = 'Marker-Popups verwalten';
|
||||
$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']['layersBtn']['0'] = 'Layer verwalten';
|
||||
|
||||
@@ -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']['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']['1'] = 'Popup-Stile verwalten';
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_style']['popups']['1'] = 'Popup-Icons verwalten';
|
||||
$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']['stroke']['0'] = 'Linie ziehen';
|
||||
|
||||
@@ -22,6 +22,8 @@ $GLOBALS['TL_LANG']['MOD']['leaflet_about'][1] = 'About the Leaflet integration
|
||||
$GLOBALS['TL_LANG']['MOD']['tl_leaflet_map'] = 'Maps';
|
||||
$GLOBALS['TL_LANG']['MOD']['tl_leaflet_layer'] = 'Layers';
|
||||
$GLOBALS['TL_LANG']['MOD']['tl_leaflet_icon'] = 'Icons';
|
||||
$GLOBALS['TL_LANG']['MOD']['tl_leaflet_style'] = 'Styles';
|
||||
$GLOBALS['TL_LANG']['MOD']['tl_leaflet_popup'] = 'Popup';
|
||||
$GLOBALS['TL_LANG']['MOD']['tl_leaflet_marker'] = 'Markers';
|
||||
$GLOBALS['TL_LANG']['MOD']['tl_leaflet_control'] = 'Controls';
|
||||
|
||||
|
||||
@@ -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'][1] = 'Manage marker icons';
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_layer']['popups'][0] = 'Manage popups';
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_layer']['popups'][1] = 'Manage popups styles';
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_layer']['popups'][1] = 'Manage popups icons';
|
||||
$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']['new'][0] = 'Create layer';
|
||||
@@ -149,10 +149,6 @@ $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']['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']['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'][1] = 'Basic layer group. <br> See <a href="http://leafletjs.com/reference.html#layergroup" target="_blank">http://leafletjs.com/reference.html#layergroup</a>';
|
||||
|
||||
@@ -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']['styles'][0] = 'Manage styles';
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_popup']['styles'][1] = 'Manage vector styles';
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_popup']['icons'][0] = 'Manage icons';
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_popup']['icons'][1] = 'Manage marker icons';
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_popup']['icons'][0] = 'Manage popups';
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_popup']['icons'][1] = 'Manage marker popups';
|
||||
$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']['edit'][0] = 'Edit popup';
|
||||
|
||||
@@ -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'][1] = 'Manage marker icons';
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_style']['popups'][0] = 'Manage popups';
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_style']['popups'][1] = 'Manage popups styles';
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_style']['popups'][1] = 'Manage popups icons';
|
||||
$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']['edit'][0] = 'Edit style';
|
||||
|
||||
31
src/Bundle/Resources/contao/languages/en/tl_user.php
Normal file
31
src/Bundle/Resources/contao/languages/en/tl_user.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?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']['tl_user']['leaflet_legend'] = 'Leaflet Maps Permissions';
|
||||
|
||||
$GLOBALS['TL_LANG']['tl_user']['leaflet_layers'][0] = 'Allowed map layers';
|
||||
$GLOBALS['TL_LANG']['tl_user']['leaflet_layers'][1] = 'Please choose the allowed map layers.';
|
||||
$GLOBALS['TL_LANG']['tl_user']['leaflet_layer_permissions'][0] = 'Layer permissions';
|
||||
$GLOBALS['TL_LANG']['tl_user']['leaflet_layer_permissions'][1] = 'Please choose which permissions are allowed for the map layer.';
|
||||
$GLOBALS['TL_LANG']['tl_user']['leaflet_tables'][0] = 'Allows map tables';
|
||||
$GLOBALS['TL_LANG']['tl_user']['leaflet_tables'][1] = 'Please choose which tables are allowed.';
|
||||
|
||||
$GLOBALS['TL_LANG']['tl_user']['leaflet_layer_permissions_options']['create'][0] = 'Create layers';
|
||||
$GLOBALS['TL_LANG']['tl_user']['leaflet_layer_permissions_options']['create'][1] = 'Grant permission to create new layers.';
|
||||
$GLOBALS['TL_LANG']['tl_user']['leaflet_layer_permissions_options']['edit'][0] = 'Edit layers';
|
||||
$GLOBALS['TL_LANG']['tl_user']['leaflet_layer_permissions_options']['edit'][1] = 'Grant permission to edit layers.';
|
||||
$GLOBALS['TL_LANG']['tl_user']['leaflet_layer_permissions_options']['delete'][0] = 'Delete layers';
|
||||
$GLOBALS['TL_LANG']['tl_user']['leaflet_layer_permissions_options']['delete'][1] = 'Grant permission to delete layers.';
|
||||
$GLOBALS['TL_LANG']['tl_user']['leaflet_layer_permissions_options']['data'][0] = 'Edit data';
|
||||
$GLOBALS['TL_LANG']['tl_user']['leaflet_layer_permissions_options']['data'][1] = 'Grant permission to edit data of a layer.';
|
||||
31
src/Bundle/Resources/contao/languages/en/tl_user_group.php
Normal file
31
src/Bundle/Resources/contao/languages/en/tl_user_group.php
Normal file
@@ -0,0 +1,31 @@
|
||||
<?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']['tl_user_group']['leaflet_legend'] = 'Leaflet Maps Permissions';
|
||||
|
||||
$GLOBALS['TL_LANG']['tl_user_group']['leaflet_layers'][0] = 'Allowed map layers';
|
||||
$GLOBALS['TL_LANG']['tl_user_group']['leaflet_layers'][1] = 'Please choose the allowed map layers.';
|
||||
$GLOBALS['TL_LANG']['tl_user_group']['leaflet_layer_permissions'][0] = 'Layer permissions';
|
||||
$GLOBALS['TL_LANG']['tl_user_group']['leaflet_layer_permissions'][1] = 'Please choose which permissions are allowed for the map layer.';
|
||||
$GLOBALS['TL_LANG']['tl_user_group']['leaflet_tables'][0] = 'Allows map tables';
|
||||
$GLOBALS['TL_LANG']['tl_user_group']['leaflet_tables'][1] = 'Please choose which tables are allowed.';
|
||||
|
||||
$GLOBALS['TL_LANG']['tl_user_group']['leaflet_layer_permissions_options']['create'][0] = 'Create layers';
|
||||
$GLOBALS['TL_LANG']['tl_user_group']['leaflet_layer_permissions_options']['create'][1] = 'Grant permission to create new layers.';
|
||||
$GLOBALS['TL_LANG']['tl_user_group']['leaflet_layer_permissions_options']['edit'][0] = 'Edit layers';
|
||||
$GLOBALS['TL_LANG']['tl_user_group']['leaflet_layer_permissions_options']['edit'][1] = 'Grant permission to edit layers.';
|
||||
$GLOBALS['TL_LANG']['tl_user_group']['leaflet_layer_permissions_options']['delete'][0] = 'Delete layers';
|
||||
$GLOBALS['TL_LANG']['tl_user_group']['leaflet_layer_permissions_options']['delete'][1] = 'Grant permission to delete layers.';
|
||||
$GLOBALS['TL_LANG']['tl_user_group']['leaflet_layer_permissions_options']['data'][0] = 'Edit data';
|
||||
$GLOBALS['TL_LANG']['tl_user_group']['leaflet_layer_permissions_options']['data'][1] = 'Grant permission to edit data of a layer.';
|
||||
7
src/Bundle/Resources/contao/public/.htaccess
Normal file
7
src/Bundle/Resources/contao/public/.htaccess
Normal file
@@ -0,0 +1,7 @@
|
||||
<IfModule !mod_authz_core.c>
|
||||
Order allow,deny
|
||||
Allow from all
|
||||
</IfModule>
|
||||
<IfModule mod_authz_core.c>
|
||||
Require all granted
|
||||
</IfModule>
|
||||
@@ -9,5 +9,5 @@
|
||||
|
||||
</div>
|
||||
<!-- indexer::continue -->
|
||||
<script><?= $this->javascript ?></script>
|
||||
<?php $GLOBALS['TL_BODY'][] = '<script>' . $this->javascript . '</script>'; ?>
|
||||
|
||||
|
||||
@@ -9,4 +9,4 @@
|
||||
|
||||
</div>
|
||||
<!-- indexer::continue -->
|
||||
<script><?= $this->javascript ?></script>
|
||||
<?php $GLOBALS['TL_BODY'][] = '<script>' . $this->javascript . '</script>'; ?>
|
||||
|
||||
@@ -23,10 +23,6 @@
|
||||
padding-left: 20px !important;
|
||||
}
|
||||
|
||||
.tl_listing .tl_left {
|
||||
overflow: unset;
|
||||
}
|
||||
|
||||
.long .tl_text_2 {
|
||||
width: 325px;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
|
||||
#tl_navigation .group-leaflet {
|
||||
background: url(../img/leaflet.svg) 3px 2px no-repeat;
|
||||
#tl_navigation .tl_level_1_group .group-leaflet {
|
||||
background: url(/bundles/netzmachtcontaoleaflet/img/leaflet.svg) 3px 2px no-repeat;
|
||||
}
|
||||
|
||||
.tl_help_table a {
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -2,8 +2,6 @@
|
||||
|
||||
{% block headline %}{{ "MOD.leaflet_about.1"|trans({}, 'contao_modules') }}{% endblock %}
|
||||
|
||||
{% block error %}{% endblock %}
|
||||
|
||||
{% block main %}
|
||||
<div class="netzmacht-leaflet-credits">
|
||||
<div class="header">
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace Netzmacht\Contao\Leaflet\Event;
|
||||
use Contao\Model;
|
||||
use Netzmacht\Contao\Leaflet\Mapper\Request;
|
||||
use Netzmacht\LeafletPHP\Definition;
|
||||
use Symfony\Contracts\EventDispatcher\Event;
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
|
||||
/**
|
||||
* Class BuildDefinitionEvent is emitted when the mapper maps between the model and the definition.
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace Netzmacht\Contao\Leaflet\Event;
|
||||
|
||||
use Netzmacht\LeafletPHP\Definition;
|
||||
use Netzmacht\LeafletPHP\Value\GeoJson\GeoJsonObject;
|
||||
use Symfony\Contracts\EventDispatcher\Event;
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
|
||||
/**
|
||||
* Class ConvertToGeoJsonEvent is emitted when the DefinitionMapper converts a definition to a geo json feature.
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
|
||||
namespace Netzmacht\Contao\Leaflet\Event;
|
||||
|
||||
use Symfony\Contracts\EventDispatcher\Event;
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
|
||||
/**
|
||||
* Class GetHashEvent is emitted then a hash for a data object with an unknown type is required.
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
namespace Netzmacht\Contao\Leaflet\Event;
|
||||
|
||||
use Netzmacht\LeafletPHP\Definition\Map;
|
||||
use Symfony\Contracts\EventDispatcher\Event;
|
||||
use Symfony\Component\EventDispatcher\Event;
|
||||
|
||||
/**
|
||||
* Class GetJavascriptEvent is emitted after the map javascript was created.
|
||||
|
||||
@@ -24,7 +24,7 @@ use Netzmacht\Contao\Leaflet\Model\MapModel;
|
||||
use Netzmacht\Contao\Toolkit\Component\Hybrid\AbstractHybrid;
|
||||
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
|
||||
use Symfony\Component\Templating\EngineInterface as TemplateEngine;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface as Translator;
|
||||
use Symfony\Component\Translation\TranslatorInterface as Translator;
|
||||
|
||||
/**
|
||||
* Class HybridTrait provides method required by the frontend module and content element the same time.
|
||||
|
||||
@@ -5,8 +5,7 @@
|
||||
*
|
||||
* @package contao-leaflet-maps
|
||||
* @author David Molineus <david.molineus@netzmacht.de>
|
||||
* @author Sven Baumnn <baumann.sv@gmail.com>
|
||||
* @copyright 2014-2022 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
|
||||
* @filesource
|
||||
*/
|
||||
@@ -16,7 +15,6 @@ declare(strict_types=1);
|
||||
namespace Netzmacht\Contao\Leaflet\Frontend\Assets;
|
||||
|
||||
use Contao\CoreBundle\Framework\ContaoFrameworkInterface as ContaoFramework;
|
||||
use Traversable;
|
||||
|
||||
/**
|
||||
* Class LibrariesConfiguration.
|
||||
@@ -47,7 +45,7 @@ class LibrariesConfiguration implements \IteratorAggregate, \ArrayAccess
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.Superglobals)
|
||||
*/
|
||||
public function getIterator(): Traversable
|
||||
public function getIterator()
|
||||
{
|
||||
$this->framework->initialize();
|
||||
|
||||
@@ -59,7 +57,7 @@ class LibrariesConfiguration implements \IteratorAggregate, \ArrayAccess
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.Superglobals)
|
||||
*/
|
||||
public function offsetExists($offset): bool
|
||||
public function offsetExists($offset)
|
||||
{
|
||||
$this->framework->initialize();
|
||||
|
||||
@@ -83,7 +81,7 @@ class LibrariesConfiguration implements \IteratorAggregate, \ArrayAccess
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.Superglobals)
|
||||
*/
|
||||
public function offsetSet($offset, $value): void
|
||||
public function offsetSet($offset, $value)
|
||||
{
|
||||
$this->framework->initialize();
|
||||
|
||||
@@ -95,7 +93,7 @@ class LibrariesConfiguration implements \IteratorAggregate, \ArrayAccess
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.Superglobals)
|
||||
*/
|
||||
public function offsetUnset($offset): void
|
||||
public function offsetUnset($offset)
|
||||
{
|
||||
$this->framework->initialize();
|
||||
|
||||
|
||||
@@ -22,7 +22,7 @@ use Netzmacht\Contao\Toolkit\Component\Component;
|
||||
use Netzmacht\Contao\Toolkit\Component\ComponentFactory;
|
||||
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
|
||||
use Symfony\Component\Templating\EngineInterface as TemplateEngine;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface as Translator;
|
||||
use Symfony\Component\Translation\TranslatorInterface as Translator;
|
||||
|
||||
/**
|
||||
* Class MapElementFactory
|
||||
|
||||
@@ -93,7 +93,7 @@ class DataController
|
||||
$filter = null;
|
||||
}
|
||||
|
||||
[$data, $error] = $this->loadData($mapProvider, $input['type'], $input['id'], $filter);
|
||||
list($data, $error) = $this->loadData($mapProvider, $input['type'], $input['id'], $filter);
|
||||
$this->encodeData($input['format'], $data);
|
||||
} catch (\Exception $e) {
|
||||
if ($this->debugMode) {
|
||||
|
||||
@@ -14,6 +14,7 @@ declare(strict_types=1);
|
||||
|
||||
namespace Netzmacht\Contao\Leaflet\Frontend\Module;
|
||||
|
||||
use Contao\Config;
|
||||
use Contao\CoreBundle\Framework\Adapter;
|
||||
use Contao\Input;
|
||||
use Netzmacht\Contao\Leaflet\MapProvider;
|
||||
@@ -21,7 +22,7 @@ use Netzmacht\Contao\Toolkit\Component\Component;
|
||||
use Netzmacht\Contao\Toolkit\Component\ComponentFactory;
|
||||
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
|
||||
use Symfony\Component\Templating\EngineInterface as TemplateEngine;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface as Translator;
|
||||
use Symfony\Component\Translation\TranslatorInterface as Translator;
|
||||
|
||||
/**
|
||||
* Class MapElementFactory
|
||||
|
||||
@@ -18,7 +18,7 @@ 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;
|
||||
use Symfony\Component\Translation\TranslatorInterface as Translator;
|
||||
|
||||
/**
|
||||
* Class BackendMenuListener adds backend entries to the navigation.
|
||||
|
||||
109
src/Listener/Dca/AbstractUserDcaListener.php
Normal file
109
src/Listener/Dca/AbstractUserDcaListener.php
Normal file
@@ -0,0 +1,109 @@
|
||||
<?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\Dca;
|
||||
|
||||
use Contao\Image;
|
||||
use Contao\StringUtil;
|
||||
use Netzmacht\Contao\Leaflet\Backend\Renderer\Label\Layer\LayerLabelRenderer;
|
||||
use Netzmacht\Contao\Leaflet\Model\LayerModel;
|
||||
use Netzmacht\Contao\Toolkit\Dca\Listener\AbstractListener;
|
||||
use Netzmacht\Contao\Toolkit\Dca\Manager;
|
||||
use Symfony\Component\Translation\TranslatorInterface as Translator;
|
||||
|
||||
/**
|
||||
* Class AbstractUserDcaListener
|
||||
*/
|
||||
abstract class AbstractUserDcaListener extends AbstractListener
|
||||
{
|
||||
/**
|
||||
* Layer label renderer.
|
||||
*
|
||||
* @var LayerLabelRenderer
|
||||
*/
|
||||
private $labelRenderer;
|
||||
|
||||
/**
|
||||
* Translator.
|
||||
*
|
||||
* @var Translator
|
||||
*/
|
||||
private $translator;
|
||||
|
||||
/**
|
||||
* Layers definitions.
|
||||
*
|
||||
* @var array
|
||||
*/
|
||||
private $layers;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
*
|
||||
* @param Manager $dcaManager Dca manager.
|
||||
* @param LayerLabelRenderer $labelRenderer Layer label renderer.
|
||||
* @param Translator $translator Translator.
|
||||
* @param array $layers Layers definition.
|
||||
*/
|
||||
public function __construct(
|
||||
Manager $dcaManager,
|
||||
LayerLabelRenderer $labelRenderer,
|
||||
Translator $translator,
|
||||
array $layers
|
||||
) {
|
||||
parent::__construct($dcaManager);
|
||||
|
||||
$this->labelRenderer = $labelRenderer;
|
||||
$this->translator = $translator;
|
||||
$this->layers = $layers;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the layers row label.
|
||||
*
|
||||
* @param array $row Layer data row.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function generateLayersRowLabel(array $row): string
|
||||
{
|
||||
if (!empty($this->layers[$row['type']]['icon'])) {
|
||||
$src = $this->layers[$row['type']]['icon'];
|
||||
} else {
|
||||
$src = 'iconPLAIN.gif';
|
||||
}
|
||||
|
||||
$activeIcon = $src;
|
||||
$disabledIcon = preg_replace('/(\.[^\.]+)$/', '_1$1', $src);
|
||||
|
||||
if (!$row['active']) {
|
||||
$src = $disabledIcon;
|
||||
}
|
||||
|
||||
$alt = $this->getFormatter(LayerModel::getTable())->formatValue('type', $row['type']);
|
||||
$attributes = sprintf(
|
||||
'class="list-icon" title="%s" data-icon="%s" data-icon-disabled="%s"',
|
||||
StringUtil::specialchars(strip_tags($alt)),
|
||||
$activeIcon,
|
||||
$disabledIcon
|
||||
);
|
||||
|
||||
$label = $this->getFormatter(LayerModel::getTable())->formatValue('title', $row['title']);
|
||||
$label .= sprintf(' <span class="tl_gray">[ID %s]</span>', $row['id']);
|
||||
$icon = Image::getHtml($src, $alt, $attributes);
|
||||
$label = $this->labelRenderer->render($row, $label, $this->translator);
|
||||
|
||||
return $icon . ' ' . $label;
|
||||
}
|
||||
}
|
||||
@@ -147,9 +147,9 @@ class ControlDcaListener extends AbstractListener
|
||||
$statement = $this->connection->prepare($query);
|
||||
|
||||
$statement->bindValue('cid', $dataContainer->id);
|
||||
$result = $statement->executeQuery();
|
||||
$statement->execute();
|
||||
|
||||
return $result->fetchAllAssociative();
|
||||
return $statement->fetchAll();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -167,9 +167,9 @@ class ControlDcaListener extends AbstractListener
|
||||
$query = 'SELECT * FROM tl_leaflet_control_layer WHERE cid=:cid order BY sorting';
|
||||
$statement = $this->connection->prepare($query);
|
||||
$statement->bindValue('cid', $dataContainer->id);
|
||||
$result = $statement->executeQuery();
|
||||
$statement->execute();
|
||||
|
||||
while ($row = $result->fetchAssociative()) {
|
||||
while ($row = $statement->fetch()) {
|
||||
$values[$row['lid']] = $row;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ use Contao\StringUtil;
|
||||
use Netzmacht\Contao\Leaflet\Model\MapModel;
|
||||
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
|
||||
use Netzmacht\Contao\Toolkit\Dca\Options\OptionsBuilder;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface as Translator;
|
||||
use Symfony\Component\Translation\TranslatorInterface as Translator;
|
||||
|
||||
/**
|
||||
* Class Module is the helper for the tl_module dca.
|
||||
@@ -103,7 +103,7 @@ final class FrontendIntegrationListener
|
||||
)
|
||||
),
|
||||
Image::getHtml(
|
||||
'alias.svg',
|
||||
'alias.gif',
|
||||
$this->translator->trans('editalias.0', [$dataContainer->value], 'contao_tl_content'),
|
||||
'style="vertical-align:top"'
|
||||
)
|
||||
|
||||
@@ -14,6 +14,10 @@ declare(strict_types=1);
|
||||
|
||||
namespace Netzmacht\Contao\Leaflet\Listener\Dca;
|
||||
|
||||
use Contao\BackendUser;
|
||||
use Contao\CoreBundle\Exception\AccessDeniedException;
|
||||
use Netzmacht\Contao\Leaflet\Model\IconModel;
|
||||
|
||||
/**
|
||||
* Class IconDcaListener.
|
||||
*
|
||||
@@ -21,6 +25,13 @@ namespace Netzmacht\Contao\Leaflet\Listener\Dca;
|
||||
*/
|
||||
class IconDcaListener
|
||||
{
|
||||
/**
|
||||
* Contao backend user.
|
||||
*
|
||||
* @var BackendUser
|
||||
*/
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* Icon type options.
|
||||
*
|
||||
@@ -31,13 +42,33 @@ class IconDcaListener
|
||||
/**
|
||||
* IconDcaListener constructor.
|
||||
*
|
||||
* @param array $icons Icon type options.
|
||||
* @param BackendUser $user Backend user.
|
||||
* @param array $icons Icon type options.
|
||||
*/
|
||||
public function __construct(array $icons)
|
||||
public function __construct(BackendUser $user, array $icons)
|
||||
{
|
||||
$this->user = $user;
|
||||
$this->icons = $icons;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the permission.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws AccessDeniedException If user has not the permission.
|
||||
*/
|
||||
public function checkPermission(): void
|
||||
{
|
||||
if ($this->user->hasAccess(IconModel::getTable(), 'leaflet_tables')) {
|
||||
return;
|
||||
}
|
||||
|
||||
throw new AccessDeniedException(
|
||||
sprintf('Access denied to "%s" for user "%s"', IconModel::getTable(), $this->user->id)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get icon options.
|
||||
*
|
||||
|
||||
@@ -13,9 +13,12 @@
|
||||
namespace Netzmacht\Contao\Leaflet\Listener\Dca;
|
||||
|
||||
use Contao\Backend;
|
||||
use Contao\BackendUser;
|
||||
use Contao\CoreBundle\Exception\AccessDeniedException;
|
||||
use Contao\CoreBundle\Framework\Adapter;
|
||||
use Contao\DataContainer;
|
||||
use Contao\Image;
|
||||
use Contao\Input;
|
||||
use Contao\StringUtil;
|
||||
use Doctrine\DBAL\Connection;
|
||||
use Netzmacht\Contao\Leaflet\Backend\Renderer\Label\Layer\LayerLabelRenderer;
|
||||
@@ -23,14 +26,15 @@ use Netzmacht\Contao\Leaflet\Model\IconModel;
|
||||
use Netzmacht\Contao\Leaflet\Model\LayerModel;
|
||||
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
|
||||
use Netzmacht\Contao\Toolkit\Dca\Listener\AbstractListener;
|
||||
use Netzmacht\Contao\Toolkit\Dca\Listener\Button\StateButtonCallbackListener;
|
||||
use Netzmacht\Contao\Toolkit\Dca\Manager;
|
||||
use Netzmacht\Contao\Toolkit\Dca\Options\OptionsBuilder;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface as Translator;
|
||||
use Symfony\Component\Translation\TranslatorInterface as Translator;
|
||||
|
||||
/**
|
||||
* Class Layer is the helper class for the tl_leaflet_layer dca.
|
||||
*
|
||||
* @package Netzmacht\Contao\Leaflet\Dca
|
||||
* @SuppressWarnings(PHPMD.TooManyPublicMethods)
|
||||
*/
|
||||
class LayerDcaListener extends AbstractListener
|
||||
{
|
||||
@@ -76,6 +80,13 @@ class LayerDcaListener extends AbstractListener
|
||||
*/
|
||||
private $translator;
|
||||
|
||||
/**
|
||||
* Backend user.
|
||||
*
|
||||
* @var BackendUser
|
||||
*/
|
||||
private $backendUser;
|
||||
|
||||
/**
|
||||
* OSM amenities.
|
||||
*
|
||||
@@ -104,19 +115,28 @@ class LayerDcaListener extends AbstractListener
|
||||
*/
|
||||
private $backendAdapter;
|
||||
|
||||
/**
|
||||
* State button callback listener.
|
||||
*
|
||||
* @var StateButtonCallbackListener
|
||||
*/
|
||||
private $stateButtonCallbackListener;
|
||||
|
||||
/**
|
||||
* Construct.
|
||||
*
|
||||
* @param Manager $manager Data container manager.
|
||||
* @param Connection $connection Database connection.
|
||||
* @param RepositoryManager $repositoryManager Repository manager.
|
||||
* @param Translator $translator Translator.
|
||||
* @param LayerLabelRenderer $labelRenderer Layer label renderer.
|
||||
* @param Adapter|Backend $backendAdapter Backend adapter.
|
||||
* @param array $layers Leaflet layer configuration.
|
||||
* @param array $tileProviders Tile providers.
|
||||
* @param array $amenities OSM amenities.
|
||||
* @param array $fileFormats File formats.
|
||||
* @param Manager $manager Data container manager.
|
||||
* @param Connection $connection Database connection.
|
||||
* @param RepositoryManager $repositoryManager Repository manager.
|
||||
* @param Translator $translator Translator.
|
||||
* @param LayerLabelRenderer $labelRenderer Layer label renderer.
|
||||
* @param BackendUser $backendUser Backend user.
|
||||
* @param StateButtonCallbackListener $stateButtonCallbackListener State button callback listener.
|
||||
* @param Adapter|Backend $backendAdapter Backend adapter.
|
||||
* @param array $layers Leaflet layer configuration.
|
||||
* @param array $tileProviders Tile providers.
|
||||
* @param array $amenities OSM amenities.
|
||||
* @param array $fileFormats File formats.
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
|
||||
*/
|
||||
@@ -126,6 +146,8 @@ class LayerDcaListener extends AbstractListener
|
||||
RepositoryManager $repositoryManager,
|
||||
Translator $translator,
|
||||
LayerLabelRenderer $labelRenderer,
|
||||
BackendUser $backendUser,
|
||||
StateButtonCallbackListener $stateButtonCallbackListener,
|
||||
$backendAdapter,
|
||||
array $layers,
|
||||
array $tileProviders,
|
||||
@@ -134,15 +156,55 @@ class LayerDcaListener extends AbstractListener
|
||||
) {
|
||||
parent::__construct($manager);
|
||||
|
||||
$this->connection = $connection;
|
||||
$this->layers = $layers;
|
||||
$this->tileProviders = $tileProviders;
|
||||
$this->translator = $translator;
|
||||
$this->amenities = $amenities;
|
||||
$this->labelRenderer = $labelRenderer;
|
||||
$this->fileFormats = $fileFormats;
|
||||
$this->repositoryManager = $repositoryManager;
|
||||
$this->backendAdapter = $backendAdapter;
|
||||
$this->connection = $connection;
|
||||
$this->layers = $layers;
|
||||
$this->tileProviders = $tileProviders;
|
||||
$this->translator = $translator;
|
||||
$this->amenities = $amenities;
|
||||
$this->labelRenderer = $labelRenderer;
|
||||
$this->fileFormats = $fileFormats;
|
||||
$this->repositoryManager = $repositoryManager;
|
||||
$this->backendAdapter = $backendAdapter;
|
||||
$this->backendUser = $backendUser;
|
||||
$this->stateButtonCallbackListener = $stateButtonCallbackListener;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the permissions.
|
||||
*
|
||||
* @param DataContainer $dataContainer Data container.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws AccessDeniedException If permissions are not granted.
|
||||
*/
|
||||
public function checkPermissions(DataContainer $dataContainer): void
|
||||
{
|
||||
if ($this->backendUser->isAdmin) {
|
||||
return;
|
||||
}
|
||||
|
||||
$action = Input::get('act');
|
||||
$permission = $this->determinePermission($action);
|
||||
|
||||
if ($permission && !$this->backendUser->hasAccess($permission, 'leaflet_layer_permissions')) {
|
||||
throw new AccessDeniedException(
|
||||
sprintf('Permission "%s" not granted to access layer "%s"', $permission, $dataContainer->id)
|
||||
);
|
||||
}
|
||||
|
||||
$this->getDefinition()->set(['list', 'sorting', 'root'], $this->backendUser->leaflet_layers);
|
||||
|
||||
$layerId = $this->determineLayerId();
|
||||
if ($layerId && !$this->backendUser->hasAccess($layerId, 'leaflet_layers')) {
|
||||
throw new AccessDeniedException(
|
||||
sprintf('User "%s" not allowed to access layer "%s"', $this->backendUser->id, $layerId)
|
||||
);
|
||||
}
|
||||
|
||||
if (!$this->backendUser->hasAccess(LayerModel::PERMISSION_CREATE, 'leaflet_layer_permissions')) {
|
||||
$this->getDefinition()->set(['config', 'closed'], true);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -197,7 +259,7 @@ class LayerDcaListener extends AbstractListener
|
||||
if (!empty($this->layers[$row['type']]['icon'])) {
|
||||
$src = $this->layers[$row['type']]['icon'];
|
||||
} else {
|
||||
$src = 'iconPLAIN.svg';
|
||||
$src = 'iconPLAIN.gif';
|
||||
}
|
||||
|
||||
$activeIcon = $src;
|
||||
@@ -275,12 +337,12 @@ class LayerDcaListener extends AbstractListener
|
||||
$pasteAfterUrl,
|
||||
StringUtil::specialchars($this->translator->trans('pasteafter.1', [$row['id']], 'contao_' . $table)),
|
||||
Image::getHtml(
|
||||
'pasteafter.svg',
|
||||
'pasteafter.gif',
|
||||
$this->translator->trans('pasteafter.1', [$row['id']], 'contao_' . $table)
|
||||
)
|
||||
);
|
||||
|
||||
if (isset($row['type']) && !empty($this->layers[$row['type']]['children'])) {
|
||||
if (!empty($this->layers[$row['type']]['children'])) {
|
||||
$pasteIntoUrl = $this->backendAdapter->addToUrl(
|
||||
sprintf(
|
||||
'act=%s&mode=2&pid=%s%s',
|
||||
@@ -295,17 +357,159 @@ class LayerDcaListener extends AbstractListener
|
||||
$pasteIntoUrl,
|
||||
StringUtil::specialchars($this->translator->trans('pasteinto.1', [$row['id']], 'contao_' . $table)),
|
||||
Image::getHtml(
|
||||
'pasteinto.svg',
|
||||
'pasteinto.gif',
|
||||
$this->translator->trans('pasteinto.1', [$row['id']], 'contao_' . $table)
|
||||
)
|
||||
);
|
||||
} elseif ($row['id'] > 0) {
|
||||
$buffer .= Image::getHtml('pasteinto_.svg');
|
||||
$buffer .= Image::getHtml('pasteinto_.gif');
|
||||
}
|
||||
|
||||
return $buffer;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the edit button.
|
||||
*
|
||||
* @param array $row Current row.
|
||||
* @param string $href The button href.
|
||||
* @param string $label The button label.
|
||||
* @param string $title The button title.
|
||||
* @param string $icon The button icon.
|
||||
* @param string $attributes Optional attributes.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function generateEditButton($row, $href, $label, $title, $icon, $attributes): string
|
||||
{
|
||||
if ($this->backendUser->hasAccess('edit', 'leaflet_layer_permissions')) {
|
||||
return $this->generateButton($row, $href, $label, $title, $icon, $attributes);
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the cut button.
|
||||
*
|
||||
* @param array $row Current row.
|
||||
* @param string $href The button href.
|
||||
* @param string $label The button label.
|
||||
* @param string $title The button title.
|
||||
* @param string $icon The button icon.
|
||||
* @param string $attributes Optional attributes.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function generateCutButton($row, $href, $label, $title, $icon, $attributes): string
|
||||
{
|
||||
if ($this->backendUser->hasAccess('edit', 'leaflet_layer_permissions')) {
|
||||
return $this->generateButton($row, $href, $label, $title, $icon, $attributes);
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the copy button.
|
||||
*
|
||||
* @param array $row Current row.
|
||||
* @param string $href The button href.
|
||||
* @param string $label The button label.
|
||||
* @param string $title The button title.
|
||||
* @param string $icon The button icon.
|
||||
* @param string $attributes Optional attributes.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function generateCopyButton($row, $href, $label, $title, $icon, $attributes): string
|
||||
{
|
||||
if ($this->backendUser->hasAccess('create', 'leaflet_layer_permissions')) {
|
||||
return $this->generateButton($row, $href, $label, $title, $icon, $attributes);
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the toggle button.
|
||||
*
|
||||
* @param array $row Current data row.
|
||||
* @param string|null $href Button link.
|
||||
* @param string|null $label Button label.
|
||||
* @param string|null $title Button title.
|
||||
* @param string|null $icon Enabled button icon.
|
||||
* @param string|null $attributes Html attributes as string.
|
||||
* @param string $tableName Table name.
|
||||
* @param array|null $rootIds Root ids.
|
||||
* @param array|null $childRecordIds Child record ids.
|
||||
* @param bool $circularReference Circular reference flag.
|
||||
* @param string|null $previous Previous button name.
|
||||
* @param string|null $next Next button name.
|
||||
* @param DataContainer $dataContainer Data container driver.
|
||||
*
|
||||
* @return string
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
|
||||
* @SuppressWarnings(PHPMD.ExcessiveParameterList)
|
||||
*/
|
||||
public function generateToggleButton(
|
||||
array $row,
|
||||
$href,
|
||||
$label,
|
||||
$title,
|
||||
$icon,
|
||||
$attributes,
|
||||
string $tableName,
|
||||
$rootIds,
|
||||
$childRecordIds,
|
||||
bool $circularReference,
|
||||
$previous,
|
||||
$next,
|
||||
$dataContainer
|
||||
): string {
|
||||
if ($this->backendUser->hasAccess('edit', 'leaflet_layer_permissions')) {
|
||||
return $this->stateButtonCallbackListener->handleButtonCallback(
|
||||
$row,
|
||||
$href,
|
||||
$label,
|
||||
$title,
|
||||
$icon,
|
||||
$attributes,
|
||||
$tableName,
|
||||
$rootIds,
|
||||
$childRecordIds,
|
||||
$circularReference,
|
||||
$previous,
|
||||
$next,
|
||||
$dataContainer
|
||||
);
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the edit button.
|
||||
*
|
||||
* @param array $row Current row.
|
||||
* @param string $href The button href.
|
||||
* @param string $label The button label.
|
||||
* @param string $title The button title.
|
||||
* @param string $icon The button icon.
|
||||
* @param string $attributes Optional attributes.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function generateDeleteButton($row, $href, $label, $title, $icon, $attributes): string
|
||||
{
|
||||
if ($this->backendUser->hasAccess('delete', 'leaflet_layer_permissions')) {
|
||||
return $this->generateButton($row, $href, $label, $title, $icon, $attributes);
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the markers button.
|
||||
*
|
||||
@@ -324,6 +528,10 @@ class LayerDcaListener extends AbstractListener
|
||||
return '';
|
||||
}
|
||||
|
||||
if (!$this->backendUser->hasAccess('data', 'leaflet_layer_permissions')) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $this->generateButton($row, $href, $label, $title, $icon, $attributes);
|
||||
}
|
||||
|
||||
@@ -345,6 +553,10 @@ class LayerDcaListener extends AbstractListener
|
||||
return '';
|
||||
}
|
||||
|
||||
if (!$this->backendUser->hasAccess('data', 'leaflet_layer_permissions')) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return $this->generateButton($row, $href, $label, $title, $icon, $attributes);
|
||||
}
|
||||
|
||||
@@ -361,25 +573,25 @@ class LayerDcaListener extends AbstractListener
|
||||
if ($undoId) {
|
||||
$statement = $this->connection->prepare('SELECT * FROM tl_undo WHERE id=:id LIMIT 0,1');
|
||||
$statement->bindValue('id', $undoId);
|
||||
$result = $statement->executeQuery();
|
||||
$statement->execute();
|
||||
|
||||
$undo = $result->fetchAssociative();
|
||||
$undo = $statement->fetch();
|
||||
|
||||
$statement = $this->connection->prepare('SELECT * FROM tl_leaflet_map_layer WHERE lid=:lid');
|
||||
$statement->bindValue('lid', $dataContainer->id);
|
||||
$result = $statement->executeQuery();
|
||||
$statement->execute();
|
||||
|
||||
$undo['data'] = StringUtil::deserialize($undo['data'], true);
|
||||
|
||||
while ($row = $result->fetchAssociative()) {
|
||||
while ($row = $statement->fetch()) {
|
||||
$undo['data']['tl_leaflet_map_layer'][] = $row;
|
||||
}
|
||||
|
||||
$statement = $this->connection->prepare('SELECT * FROM tl_leaflet_control_layer WHERE lid=:lid');
|
||||
$statement->bindValue('lid', $dataContainer->id);
|
||||
$result = $statement->executeQuery();
|
||||
$statement->execute();
|
||||
|
||||
$undo['data']['tl_leaflet_control_layer'] = $result->fetchAllAssociative();
|
||||
$undo['data']['tl_leaflet_control_layer'] = $statement->fetchAll();
|
||||
|
||||
$this->connection->update('tl_undo', ['data' => $undo['data']], ['id' => $undo['id']]);
|
||||
}
|
||||
@@ -522,4 +734,82 @@ class LayerDcaListener extends AbstractListener
|
||||
Image::getHtml($icon, $label, $attributes)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine permission for current action.
|
||||
*
|
||||
* @param string|null $action Given action.
|
||||
*
|
||||
* @return string|null
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||
*/
|
||||
private function determinePermission(?string $action): ?string
|
||||
{
|
||||
$permission = null;
|
||||
|
||||
switch ($action) {
|
||||
case 'edit':
|
||||
case 'toggle':
|
||||
case 'editAll':
|
||||
case 'overrideAll':
|
||||
case 'cutAll':
|
||||
return LayerModel::PERMISSION_EDIT;
|
||||
|
||||
case 'delete':
|
||||
case 'deleteAll':
|
||||
return LayerModel::PERMISSION_DELETE;
|
||||
|
||||
case 'copyAll':
|
||||
return LayerModel::PERMISSION_CREATE;
|
||||
|
||||
case 'paste':
|
||||
$mode = Input::get('mode');
|
||||
|
||||
switch ($mode) {
|
||||
case 'create':
|
||||
return LayerModel::PERMISSION_CREATE;
|
||||
|
||||
case 'cut':
|
||||
return LayerModel::PERMISSION_EDIT;
|
||||
|
||||
default:
|
||||
return $permission;
|
||||
}
|
||||
|
||||
// Comment just to please phpcs
|
||||
default:
|
||||
return $permission;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Determine the layer id.
|
||||
*
|
||||
* @return int|null
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||
*/
|
||||
private function determineLayerId(): ?int
|
||||
{
|
||||
// Check the current action
|
||||
switch (Input::get('act')) {
|
||||
case 'edit':
|
||||
case 'delete':
|
||||
case 'paste':
|
||||
case 'show':
|
||||
return (int) Input::get('id');
|
||||
|
||||
case 'editAll':
|
||||
case 'deleteAll':
|
||||
case 'overrideAll':
|
||||
case 'cutAll':
|
||||
case 'copyAll':
|
||||
return (int) CURRENT_ID;
|
||||
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,9 +17,9 @@ use Contao\DataContainer;
|
||||
use Contao\System;
|
||||
use Netzmacht\Contao\Leaflet\Model\LayerModel;
|
||||
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
|
||||
use Netzmacht\Contao\Toolkit\View\Template\TemplateRenderer;
|
||||
use Netzmacht\LeafletPHP\Value\LatLng;
|
||||
use Symfony\Component\Filesystem\Filesystem;
|
||||
use Symfony\Component\Templating\EngineInterface as TemplateEngine;
|
||||
|
||||
/**
|
||||
* Class Leaflet is the base helper providing different methods.
|
||||
@@ -50,11 +50,11 @@ class LeafletDcaListener
|
||||
private $repositoryManager;
|
||||
|
||||
/**
|
||||
* Template renderer.
|
||||
* Template engine.
|
||||
*
|
||||
* @var TemplateRenderer
|
||||
* @var TemplateEngine
|
||||
*/
|
||||
private $templateRenderer;
|
||||
private $templateEngine;
|
||||
|
||||
/**
|
||||
* System adapter.
|
||||
@@ -67,20 +67,20 @@ class LeafletDcaListener
|
||||
* LeafletCallbacks constructor.
|
||||
*
|
||||
* @param RepositoryManager $repositoryManager Repository manager.
|
||||
* @param TemplateRenderer $templateRenderer Template renderer.
|
||||
* @param TemplateEngine $templateEngine Template engine.
|
||||
* @param Filesystem $fileSystem File system.
|
||||
* @param Adapter|System $systemAdapter Contao system adapter.
|
||||
* @param string $cacheDir Cache dir.
|
||||
*/
|
||||
public function __construct(
|
||||
RepositoryManager $repositoryManager,
|
||||
TemplateRenderer $templateRenderer,
|
||||
TemplateEngine $templateEngine,
|
||||
Filesystem $fileSystem,
|
||||
$systemAdapter,
|
||||
string $cacheDir
|
||||
) {
|
||||
$this->repositoryManager = $repositoryManager;
|
||||
$this->templateRenderer = $templateRenderer;
|
||||
$this->templateEngine = $templateEngine;
|
||||
$this->fileSystem = $fileSystem;
|
||||
$this->systemAdapter = $systemAdapter;
|
||||
$this->cacheDir = $cacheDir;
|
||||
@@ -125,7 +125,7 @@ class LeafletDcaListener
|
||||
$data['marker'] = null;
|
||||
}
|
||||
|
||||
return $this->templateRenderer->render('be:be_leaflet_geocode', $data);
|
||||
return $this->templateEngine->render('toolkit:be:be_leaflet_geocode.html5', $data);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -24,8 +24,11 @@ use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
|
||||
use Netzmacht\Contao\Toolkit\Dca\Listener\AbstractListener;
|
||||
use Netzmacht\Contao\Toolkit\Dca\Manager;
|
||||
use Netzmacht\Contao\Toolkit\Dca\Options\OptionsBuilder;
|
||||
use PDO;
|
||||
use function strlen;
|
||||
use Symfony\Component\HttpFoundation\Session\Session;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface as Translator;
|
||||
use Symfony\Component\Translation\TranslatorInterface as Translator;
|
||||
use function var_dump;
|
||||
|
||||
/**
|
||||
* Class Map is the helper class for the tl_leaflet_map dca.
|
||||
@@ -135,9 +138,12 @@ class MapDcaListener extends AbstractListener
|
||||
{
|
||||
$statement = $this->connection->prepare('SELECT lid FROM tl_leaflet_map_layer WHERE mid=:mid ORDER BY sorting');
|
||||
$statement->bindValue('mid', $dataContainer->id);
|
||||
$result = $statement->executeQuery();
|
||||
|
||||
return $result->fetchFirstColumn();
|
||||
if ($statement->execute()) {
|
||||
return $statement->fetchAll(PDO::FETCH_COLUMN, 0);
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -155,9 +161,9 @@ class MapDcaListener extends AbstractListener
|
||||
$statement = $this->connection->prepare('SELECT * FROM tl_leaflet_map_layer WHERE mid=:mid order BY sorting');
|
||||
|
||||
$statement->bindValue('mid', $dataContainer->id);
|
||||
$result = $statement->executeQuery();
|
||||
$statement->execute();
|
||||
|
||||
while ($row = $result->fetchAssociative()) {
|
||||
while ($row = $statement->fetch()) {
|
||||
$values[$row['lid']] = $row;
|
||||
}
|
||||
|
||||
@@ -222,26 +228,4 @@ class MapDcaListener extends AbstractListener
|
||||
->asTree()
|
||||
->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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,10 +12,13 @@
|
||||
|
||||
namespace Netzmacht\Contao\Leaflet\Listener\Dca;
|
||||
|
||||
use Contao\Controller;
|
||||
use Contao\BackendUser;
|
||||
use Contao\CoreBundle\Exception\AccessDeniedException;
|
||||
use Contao\Input;
|
||||
use Contao\StringUtil;
|
||||
use Doctrine\DBAL\Connection;
|
||||
use Netzmacht\Contao\Leaflet\Model\IconModel;
|
||||
use Netzmacht\Contao\Leaflet\Model\LayerModel;
|
||||
use Netzmacht\Contao\Leaflet\Model\PopupModel;
|
||||
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
|
||||
use Netzmacht\Contao\Toolkit\Dca\Options\OptionsBuilder;
|
||||
@@ -41,16 +44,48 @@ class MarkerDcaListener
|
||||
*/
|
||||
private $repositoryManager;
|
||||
|
||||
/**
|
||||
* Backend user.
|
||||
*
|
||||
* @var BackendUser
|
||||
*/
|
||||
private $backendUser;
|
||||
|
||||
/**
|
||||
* MarkerDcaListener constructor.
|
||||
*
|
||||
* @param Connection $connection Database connection.
|
||||
* @param RepositoryManager $repositoryManager Repository manager.
|
||||
* @param BackendUser $backendUser Backend user.
|
||||
*/
|
||||
public function __construct(Connection $connection, RepositoryManager $repositoryManager)
|
||||
public function __construct(Connection $connection, RepositoryManager $repositoryManager, BackendUser $backendUser)
|
||||
{
|
||||
$this->connection = $connection;
|
||||
$this->repositoryManager = $repositoryManager;
|
||||
$this->backendUser = $backendUser;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check permissions.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws AccessDeniedException When permission is not granted.
|
||||
*/
|
||||
public function checkPermissions(): void
|
||||
{
|
||||
if (!$this->backendUser->hasAccess(LayerModel::PERMISSION_DATA, 'leaflet_layer_permissions')) {
|
||||
throw new AccessDeniedException(
|
||||
sprintf('User "%s" not allowed to access layer data.', $this->backendUser->id)
|
||||
);
|
||||
}
|
||||
|
||||
$layerId = $this->determineLayerId();
|
||||
if ($layerId && !$this->backendUser->hasAccess($layerId, 'leaflet_layers')) {
|
||||
throw new AccessDeniedException(
|
||||
sprintf('User "%s" not allowed to access layer "%s"', $this->backendUser->id, $layerId)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -145,9 +180,9 @@ class MarkerDcaListener
|
||||
$statement = $this->connection->prepare($query);
|
||||
$statement->bindValue('id', $dataContainer->id);
|
||||
|
||||
$result = $statement->executeQuery();
|
||||
$statement->execute();
|
||||
|
||||
if ($row = $result->fetchAssociative()) {
|
||||
if ($row = $statement->fetch()) {
|
||||
$buffer = $row['latitude'];
|
||||
|
||||
if ($buffer && $row['longitude']) {
|
||||
@@ -165,4 +200,25 @@ class MarkerDcaListener
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine the layer id.
|
||||
*
|
||||
* @return int|null
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||
*/
|
||||
private function determineLayerId(): ?int
|
||||
{
|
||||
// Check the current action
|
||||
switch (Input::get('act')) {
|
||||
case '':
|
||||
case 'create':
|
||||
case 'select':
|
||||
return (int) Input::get('id');
|
||||
|
||||
default:
|
||||
return (int) CURRENT_ID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
169
src/Listener/Dca/OperationsListener.php
Normal file
169
src/Listener/Dca/OperationsListener.php
Normal file
@@ -0,0 +1,169 @@
|
||||
<?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\Dca;
|
||||
|
||||
use Contao\Backend;
|
||||
use Contao\BackendUser;
|
||||
use Netzmacht\Contao\Leaflet\Model\IconModel;
|
||||
use Netzmacht\Contao\Leaflet\Model\PopupModel;
|
||||
use Netzmacht\Contao\Leaflet\Model\StyleModel;
|
||||
|
||||
/**
|
||||
* Class OperationsListener
|
||||
*/
|
||||
final class OperationsListener
|
||||
{
|
||||
/**
|
||||
* Backend user.
|
||||
*
|
||||
* @var BackendUser
|
||||
*/
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* OperationsListener constructor.
|
||||
*
|
||||
* @param BackendUser $user Backend user.
|
||||
*/
|
||||
public function __construct(BackendUser $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the style operation.
|
||||
*
|
||||
* @param string $href Button link.
|
||||
* @param string $label Button label.
|
||||
* @param string $title Button title.
|
||||
* @param string $class Button icon class.
|
||||
* @param string $attributes Html attributes.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function styleOperation(
|
||||
string $href,
|
||||
string $label,
|
||||
string $title,
|
||||
string $class,
|
||||
string $attributes
|
||||
): string {
|
||||
return $this->renderIfPermissionIsGranted(StyleModel::getTable(), $href, $label, $title, $class, $attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the icon operation.
|
||||
*
|
||||
* @param string $href Button link.
|
||||
* @param string $label Button label.
|
||||
* @param string $title Button title.
|
||||
* @param string $class Button icon class.
|
||||
* @param string $attributes Html attributes.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function iconOperation(
|
||||
string $href,
|
||||
string $label,
|
||||
string $title,
|
||||
string $class,
|
||||
string $attributes
|
||||
): string {
|
||||
return $this->renderIfPermissionIsGranted(IconModel::getTable(), $href, $label, $title, $class, $attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the popup operation.
|
||||
*
|
||||
* @param string $href Button link.
|
||||
* @param string $label Button label.
|
||||
* @param string $title Button title.
|
||||
* @param string $class Button icon class.
|
||||
* @param string $attributes Html attributes.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
public function popupOperation(
|
||||
string $href,
|
||||
string $label,
|
||||
string $title,
|
||||
string $class,
|
||||
string $attributes
|
||||
): string {
|
||||
return $this->renderIfPermissionIsGranted(PopupModel::getTable(), $href, $label, $title, $class, $attributes);
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if user has permission to access the leaflet table.
|
||||
*
|
||||
* @param string $permission The table permission.
|
||||
*
|
||||
* @return bool
|
||||
*/
|
||||
private function hasPermission(string $permission): bool
|
||||
{
|
||||
return (bool) $this->user->hasAccess($permission, 'leaflet_tables');
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate the style operation.
|
||||
*
|
||||
* @param string $permission Table permission to check.
|
||||
* @param string $href Button link.
|
||||
* @param string $label Button label.
|
||||
* @param string $title Button title.
|
||||
* @param string $class Button icon class.
|
||||
* @param string $attributes Html attributes.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function renderIfPermissionIsGranted(
|
||||
string $permission,
|
||||
string $href,
|
||||
string $label,
|
||||
string $title,
|
||||
string $class,
|
||||
string $attributes
|
||||
): string {
|
||||
if ($this->hasPermission($permission)) {
|
||||
return $this->render($href, $label, $title, $class, $attributes);
|
||||
}
|
||||
|
||||
return '';
|
||||
}
|
||||
|
||||
/**
|
||||
* Render a button.
|
||||
*
|
||||
* @param string $href Button link.
|
||||
* @param string $label Button label.
|
||||
* @param string $title Button title.
|
||||
* @param string $class Button icon class.
|
||||
* @param string $attributes Html attributes.
|
||||
*
|
||||
* @return string
|
||||
*/
|
||||
private function render(string $href, string $label, string $title, string $class, string $attributes): string
|
||||
{
|
||||
return sprintf(
|
||||
' <a href="%s" title="%s" class="%s" %s>%s</a>',
|
||||
Backend::addToUrl($href),
|
||||
$title,
|
||||
$class,
|
||||
$attributes,
|
||||
$label
|
||||
);
|
||||
}
|
||||
}
|
||||
60
src/Listener/Dca/PopupDcaListener.php
Normal file
60
src/Listener/Dca/PopupDcaListener.php
Normal file
@@ -0,0 +1,60 @@
|
||||
<?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\Dca;
|
||||
|
||||
use Contao\BackendUser;
|
||||
use Contao\CoreBundle\Exception\AccessDeniedException;
|
||||
use Netzmacht\Contao\Leaflet\Model\PopupModel;
|
||||
|
||||
/**
|
||||
* Class PopupDcaListener
|
||||
*/
|
||||
final class PopupDcaListener
|
||||
{
|
||||
/**
|
||||
* Backend user.
|
||||
*
|
||||
* @var BackendUser
|
||||
*/
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* PopupDcaListener constructor.
|
||||
*
|
||||
* @param BackendUser $user Backend user.
|
||||
*/
|
||||
public function __construct(BackendUser $user)
|
||||
{
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the permission.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws AccessDeniedException If user has not the permission.
|
||||
*/
|
||||
public function checkPermission(): void
|
||||
{
|
||||
if ($this->user->hasAccess(PopupModel::getTable(), 'leaflet_tables')) {
|
||||
return;
|
||||
}
|
||||
|
||||
throw new AccessDeniedException(
|
||||
sprintf('Access denied to "%s" for user "%s"', PopupModel::getTable(), $this->user->id)
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -14,6 +14,10 @@ declare(strict_types=1);
|
||||
|
||||
namespace Netzmacht\Contao\Leaflet\Listener\Dca;
|
||||
|
||||
use Contao\BackendUser;
|
||||
use Contao\CoreBundle\Exception\AccessDeniedException;
|
||||
use Netzmacht\Contao\Leaflet\Model\StyleModel;
|
||||
|
||||
/**
|
||||
* Class StyleDcaListener.
|
||||
*
|
||||
@@ -21,6 +25,13 @@ namespace Netzmacht\Contao\Leaflet\Listener\Dca;
|
||||
*/
|
||||
class StyleDcaListener
|
||||
{
|
||||
/**
|
||||
* Backend user.
|
||||
*
|
||||
* @var BackendUser
|
||||
*/
|
||||
private $user;
|
||||
|
||||
/**
|
||||
* Style type options.
|
||||
*
|
||||
@@ -31,11 +42,31 @@ class StyleDcaListener
|
||||
/**
|
||||
* StyleDcaListener constructor.
|
||||
*
|
||||
* @param array $styles Styles options.
|
||||
* @param BackendUser $user Backend user.
|
||||
* @param array $styles Styles options.
|
||||
*/
|
||||
public function __construct(array $styles)
|
||||
public function __construct(BackendUser $user, array $styles)
|
||||
{
|
||||
$this->icons = $styles;
|
||||
$this->user = $user;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check the permission.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws AccessDeniedException If user has not the permission.
|
||||
*/
|
||||
public function checkPermission(): void
|
||||
{
|
||||
if ($this->user->hasAccess(StyleModel::getTable(), 'leaflet_tables')) {
|
||||
return;
|
||||
}
|
||||
|
||||
throw new AccessDeniedException(
|
||||
sprintf('Access denied to "%s" for user "%s"', StyleModel::getTable(), $this->user->id)
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
28
src/Listener/Dca/UserDcaListener.php
Normal file
28
src/Listener/Dca/UserDcaListener.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?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\Dca;
|
||||
|
||||
/**
|
||||
* Class UserDcaListener
|
||||
*/
|
||||
final class UserDcaListener extends AbstractUserDcaListener
|
||||
{
|
||||
/**
|
||||
* Data container name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $name = 'tl_user';
|
||||
}
|
||||
28
src/Listener/Dca/UserGroupDcaListener.php
Normal file
28
src/Listener/Dca/UserGroupDcaListener.php
Normal file
@@ -0,0 +1,28 @@
|
||||
<?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\Dca;
|
||||
|
||||
/**
|
||||
* Class UserGroupDcaListener
|
||||
*/
|
||||
final class UserGroupDcaListener extends AbstractUserDcaListener
|
||||
{
|
||||
/**
|
||||
* Data container name.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected static $name = 'tl_user_group';
|
||||
}
|
||||
@@ -16,7 +16,7 @@ use Contao\DataContainer;
|
||||
use Contao\StringUtil;
|
||||
use Netzmacht\Contao\Toolkit\Dca\Manager;
|
||||
use Netzmacht\LeafletPHP\Value\LatLng;
|
||||
use Symfony\Contracts\Translation\TranslatorInterface as Translator;
|
||||
use Symfony\Component\Translation\TranslatorInterface as Translator;
|
||||
|
||||
/**
|
||||
* Class Validator.
|
||||
|
||||
@@ -12,6 +12,10 @@
|
||||
|
||||
namespace Netzmacht\Contao\Leaflet\Listener\Dca;
|
||||
|
||||
use Contao\BackendUser;
|
||||
use Contao\CoreBundle\Exception\AccessDeniedException;
|
||||
use Contao\Input;
|
||||
use Netzmacht\Contao\Leaflet\Model\LayerModel;
|
||||
use Netzmacht\Contao\Leaflet\Model\PopupModel;
|
||||
use Netzmacht\Contao\Leaflet\Model\StyleModel;
|
||||
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
|
||||
@@ -47,19 +51,55 @@ class VectorDcaListener extends AbstractListener
|
||||
*/
|
||||
private $repositoryManager;
|
||||
|
||||
/**
|
||||
* Backend user.
|
||||
*
|
||||
* @var BackendUser
|
||||
*/
|
||||
private $backendUser;
|
||||
|
||||
/**
|
||||
* Construct.
|
||||
*
|
||||
* @param Manager $dcaManager Data container manager.
|
||||
* @param RepositoryManager $repositoryManager Repository manager.
|
||||
* @param BackendUser $backendUser Backend user.
|
||||
* @param array $vectors Vectors.
|
||||
*/
|
||||
public function __construct(Manager $dcaManager, RepositoryManager $repositoryManager, array $vectors)
|
||||
{
|
||||
public function __construct(
|
||||
Manager $dcaManager,
|
||||
RepositoryManager $repositoryManager,
|
||||
BackendUser $backendUser,
|
||||
array $vectors
|
||||
) {
|
||||
parent::__construct($dcaManager);
|
||||
|
||||
$this->vectors = $vectors;
|
||||
$this->repositoryManager = $repositoryManager;
|
||||
$this->backendUser = $backendUser;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check permissions.
|
||||
*
|
||||
* @return void
|
||||
*
|
||||
* @throws AccessDeniedException When permission is not granted.
|
||||
*/
|
||||
public function checkPermissions(): void
|
||||
{
|
||||
if (!$this->backendUser->hasAccess(LayerModel::PERMISSION_DATA, 'leaflet_layer_permissions')) {
|
||||
throw new AccessDeniedException(
|
||||
sprintf('User "%s" not allowed to access layer data.', $this->backendUser->id)
|
||||
);
|
||||
}
|
||||
|
||||
$layerId = $this->determineLayerId();
|
||||
if ($layerId && !$this->backendUser->hasAccess($layerId, 'leaflet_layers')) {
|
||||
throw new AccessDeniedException(
|
||||
sprintf('User "%s" not allowed to access layer "%s"', $this->backendUser->id, $layerId)
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -114,4 +154,25 @@ class VectorDcaListener extends AbstractListener
|
||||
|
||||
return $builder->getOptions();
|
||||
}
|
||||
|
||||
/**
|
||||
* Determine the layer id.
|
||||
*
|
||||
* @return int|null
|
||||
*
|
||||
* @SuppressWarnings(PHPMD.CyclomaticComplexity)
|
||||
*/
|
||||
private function determineLayerId(): ?int
|
||||
{
|
||||
// Check the current action
|
||||
switch (Input::get('act')) {
|
||||
case '':
|
||||
case 'create':
|
||||
case 'select':
|
||||
return (int) Input::get('id');
|
||||
|
||||
default:
|
||||
return (int) CURRENT_ID;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,8 +178,8 @@ final class GeoJsonListener
|
||||
private function parseModelValue(Model $model, &$property)
|
||||
{
|
||||
if (is_array($property)) {
|
||||
[$property, $type] = $property;
|
||||
$value = $model->$property;
|
||||
list($property, $type) = $property;
|
||||
$value = $model->$property;
|
||||
|
||||
switch ($type) {
|
||||
case 'array':
|
||||
|
||||
@@ -143,12 +143,12 @@ class LoadAssetsListener
|
||||
$assets = $this->libraries[$library];
|
||||
|
||||
if (!empty($assets['css'])) {
|
||||
[$source, $type] = array_pad((array) $assets['css'], 2, null);
|
||||
list ($source, $type) = (array) $assets['css'];
|
||||
$this->assets->addStylesheet($source, $type ?: Assets::TYPE_FILE);
|
||||
}
|
||||
|
||||
if (!empty($assets['javascript'])) {
|
||||
[$source, $type] = array_pad((array) $assets['javascript'], 2, null);
|
||||
list ($source, $type) = (array) $assets['javascript'];
|
||||
$this->assets->addJavascript($source, $type ?: Assets::TYPE_FILE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,11 +60,11 @@ final class RegisterLibrariesListener
|
||||
{
|
||||
foreach ($this->libraries as $name => $assets) {
|
||||
if (!empty($assets['css'])) {
|
||||
[$source, $type] = array_pad((array) $assets['css'], 2, null);
|
||||
list ($source, $type) = (array) $assets['css'];
|
||||
$this->leaflet->registerStylesheet($name, $source, $type ?: Assets::TYPE_FILE);
|
||||
}
|
||||
if (!empty($assets['javascript'])) {
|
||||
[$source, $type] = array_pad((array) $assets['javascript'], 2, null);
|
||||
list ($source, $type) = (array) $assets['javascript'];
|
||||
$this->leaflet->registerJavascript($name, $source, $type ?: Assets::TYPE_FILE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
*
|
||||
* @package contao-leaflet-maps
|
||||
* @author David Molineus <david.molineus@netzmacht.de>
|
||||
* @author Stefan Heimes <stefan_heimes@hotmail.com>
|
||||
* @copyright 2014-2017 netzmacht David Molineus. All rights reserved.
|
||||
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
|
||||
* @filesource
|
||||
@@ -14,6 +13,7 @@
|
||||
namespace Netzmacht\Contao\Leaflet;
|
||||
|
||||
use Contao\Input;
|
||||
use Doctrine\Common\Cache\Cache;
|
||||
use Netzmacht\Contao\Leaflet\Encoder\ContaoAssets;
|
||||
use Netzmacht\Contao\Leaflet\Event\GetJavascriptEvent;
|
||||
use Netzmacht\Contao\Leaflet\Filter\Filter;
|
||||
@@ -24,14 +24,11 @@ use Netzmacht\Contao\Leaflet\Model\LayerModel;
|
||||
use Netzmacht\Contao\Leaflet\Model\MapModel;
|
||||
use Netzmacht\Contao\Toolkit\Data\Model\RepositoryManager;
|
||||
use Netzmacht\Contao\Toolkit\View\Template\TemplateReference;
|
||||
use Netzmacht\Contao\Toolkit\View\Template\TemplateRenderer;
|
||||
use Netzmacht\LeafletPHP\Definition\Map;
|
||||
use Netzmacht\LeafletPHP\Leaflet;
|
||||
use Netzmacht\LeafletPHP\Value\GeoJson\FeatureCollection;
|
||||
use Symfony\Component\Cache\CacheItem;
|
||||
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface as EventDispatcher;
|
||||
use Symfony\Contracts\Cache\CacheInterface as Cache;
|
||||
use function dd;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface as EventDispatcher;
|
||||
use Symfony\Component\Templating\EngineInterface as TemplateEngine;
|
||||
|
||||
/**
|
||||
* Class MapProvider.
|
||||
@@ -97,11 +94,11 @@ class MapProvider
|
||||
private $repositoryManager;
|
||||
|
||||
/**
|
||||
* Template renderer.
|
||||
* Template engine.
|
||||
*
|
||||
* @var TemplateRenderer
|
||||
* @var TemplateEngine
|
||||
*/
|
||||
private $templateRenderer;
|
||||
private $templateEngine;
|
||||
|
||||
/**
|
||||
* Construct.
|
||||
@@ -114,7 +111,7 @@ class MapProvider
|
||||
* @param Cache $cache Cache.
|
||||
* @param DataController $dataController Data controller.
|
||||
* @param RepositoryManager $repositoryManager Repository manager.
|
||||
* @param TemplateRenderer $templateRenderer Template rednerer.
|
||||
* @param TemplateEngine $templateEngine Template engine.
|
||||
*/
|
||||
public function __construct(
|
||||
DefinitionMapper $mapper,
|
||||
@@ -125,7 +122,7 @@ class MapProvider
|
||||
Cache $cache,
|
||||
DataController $dataController,
|
||||
RepositoryManager $repositoryManager,
|
||||
TemplateRenderer $templateRenderer
|
||||
TemplateEngine $templateEngine
|
||||
) {
|
||||
$this->mapper = $mapper;
|
||||
$this->leaflet = $leaflet;
|
||||
@@ -135,7 +132,7 @@ class MapProvider
|
||||
$this->cache = $cache;
|
||||
$this->dataController = $dataController;
|
||||
$this->repositoryManager = $repositoryManager;
|
||||
$this->templateRenderer = $templateRenderer;
|
||||
$this->templateEngine = $templateEngine;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -215,29 +212,25 @@ class MapProvider
|
||||
if ($doCache) {
|
||||
$cacheKey = $this->getCacheKey($mapId, $filter, $elementId, $template, $style);
|
||||
|
||||
if ($this->cache->hasItem($cacheKey)) {
|
||||
$cached = $this->cache->getItem($cacheKey);
|
||||
$cachedData = $cached->get();
|
||||
$this->assets->fromArray($cachedData['assets']);
|
||||
if ($this->cache->contains($cacheKey)) {
|
||||
$cached = $this->cache->fetch($cacheKey);
|
||||
$this->assets->fromArray($cached['assets']);
|
||||
|
||||
return $cachedData['javascript'];
|
||||
} else {
|
||||
$cached = $this->cache->getItem($cacheKey);
|
||||
return $cached['javascript'];
|
||||
}
|
||||
}
|
||||
|
||||
$buffer = $this->doGenerate($model, $filter, $elementId, $template, $style);
|
||||
|
||||
if ($doCache) {
|
||||
$cached
|
||||
->expiresAfter((int) $model->cacheLifeTime)
|
||||
->set(
|
||||
[
|
||||
'assets' => $this->assets->toArray(),
|
||||
'javascript' => $buffer,
|
||||
]
|
||||
);
|
||||
$this->cache->save($cached);
|
||||
$this->cache->save(
|
||||
$cacheKey,
|
||||
[
|
||||
'assets' => $this->assets->toArray(),
|
||||
'javascript' => $buffer,
|
||||
],
|
||||
(int) $model->cacheLifeTime
|
||||
);
|
||||
}
|
||||
|
||||
return $buffer;
|
||||
@@ -277,19 +270,12 @@ class MapProvider
|
||||
$cacheKey .= '.filter_' . md5($filter->toRequest());
|
||||
}
|
||||
|
||||
if ($this->cache->hasItem($cacheKey)) {
|
||||
$cachedItem = $this->cache->getItem($cacheKey);
|
||||
|
||||
return $cachedItem->get();
|
||||
} else {
|
||||
$cachedItem = $this->cache->getItem($cacheKey);
|
||||
if ($this->cache->contains($cacheKey)) {
|
||||
return $this->cache->fetch($cacheKey);
|
||||
}
|
||||
|
||||
$collection = $this->mapper->handleGeoJson($model, $request);
|
||||
$cachedItem
|
||||
->expiresAfter($model->cacheLifeTime)
|
||||
->set($collection);
|
||||
$this->cache->save($cachedItem);
|
||||
$this->cache->save($cacheKey, $collection, $model->cacheLifeTime);
|
||||
|
||||
return $collection;
|
||||
}
|
||||
@@ -388,7 +374,7 @@ class MapProvider
|
||||
$javascript = $this->leaflet->build($definition, $this->assets);
|
||||
$mapId = $definition->getId();
|
||||
|
||||
$templateReference = 'fe:' . $template;
|
||||
$templateReference = new TemplateReference($template, 'html5', TemplateReference::SCOPE_FRONTEND);
|
||||
$parameters = [
|
||||
'definition' => $definition,
|
||||
'model' => $model,
|
||||
@@ -398,16 +384,12 @@ class MapProvider
|
||||
'mapId' => $mapId,
|
||||
];
|
||||
|
||||
$content = $this->templateRenderer->render($templateReference, $parameters);
|
||||
$content = preg_replace(
|
||||
['/^(\s*)<!-- TEMPLATE \(?START\)?: .+ -->\n*/', '/\n*<!-- TEMPLATE \(?END\)?: .+ -->$/'],
|
||||
['$1', ''],
|
||||
$content
|
||||
);
|
||||
$content = $this->templateEngine->render($templateReference, $parameters);
|
||||
$event = new GetJavascriptEvent($definition, $content);
|
||||
$this->eventDispatcher->dispatch($event::NAME, $event);
|
||||
|
||||
$event = new GetJavascriptEvent($definition, $content);
|
||||
$this->eventDispatcher->dispatch($event, $event::NAME);
|
||||
$buffer = $event->getJavascript();
|
||||
|
||||
return $event->getJavascript();
|
||||
return $buffer;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,7 +20,7 @@ use Netzmacht\LeafletPHP\Value\GeoJson\ConvertsToGeoJsonFeature;
|
||||
use Netzmacht\LeafletPHP\Value\GeoJson\Feature;
|
||||
use Netzmacht\LeafletPHP\Value\GeoJson\FeatureCollection;
|
||||
use Netzmacht\LeafletPHP\Value\GeoJson\GeoJsonFeature;
|
||||
use Symfony\Contracts\EventDispatcher\EventDispatcherInterface as EventDispatcher;
|
||||
use Symfony\Component\EventDispatcher\EventDispatcherInterface as EventDispatcher;
|
||||
|
||||
/**
|
||||
* Class DefinitionMapper is the main mapper instance which contains all other mappers as children.
|
||||
@@ -111,7 +111,7 @@ class DefinitionMapper
|
||||
|
||||
if ($definition) {
|
||||
$event = new BuildDefinitionEvent($definition, $model, $request);
|
||||
$this->eventDispatcher->dispatch($event, $event::NAME);
|
||||
$this->eventDispatcher->dispatch($event::NAME, $event);
|
||||
}
|
||||
|
||||
$this->mapped[$hash] = $definition;
|
||||
@@ -172,7 +172,7 @@ class DefinitionMapper
|
||||
}
|
||||
|
||||
$event = new ConvertToGeoJsonEvent($definition, $feature, $model);
|
||||
$this->eventDispatcher->dispatch($event, $event::NAME);
|
||||
$this->eventDispatcher->dispatch($event::NAME, $event);
|
||||
|
||||
return $feature;
|
||||
}
|
||||
@@ -190,7 +190,7 @@ class DefinitionMapper
|
||||
private function hash($model, $elementId = null)
|
||||
{
|
||||
$event = new GetHashEvent($model);
|
||||
$this->eventDispatcher->dispatch($event, $event::NAME);
|
||||
$this->eventDispatcher->dispatch($event::NAME, $event);
|
||||
$hash = $event->getHash();
|
||||
|
||||
if (!$hash) {
|
||||
|
||||
@@ -14,8 +14,6 @@ declare(strict_types=1);
|
||||
|
||||
namespace Netzmacht\Contao\Leaflet\Mapper\Layer;
|
||||
|
||||
use Contao\CoreBundle\Framework\Adapter;
|
||||
use Contao\Environment;
|
||||
use Contao\FilesModel;
|
||||
use Contao\Model;
|
||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
||||
@@ -60,25 +58,16 @@ class FileLayerMapper extends AbstractLayerMapper
|
||||
*/
|
||||
private $repositoryManager;
|
||||
|
||||
/**
|
||||
* Environment.
|
||||
*
|
||||
* @var Adapter<Environment>
|
||||
*/
|
||||
private $environmentAdapter;
|
||||
|
||||
/**
|
||||
* Construct.
|
||||
*
|
||||
* @param RepositoryManager $repositoryManager Repository manager.
|
||||
* @param Adapter<Environment> $environmentAdapter Environment adapter.
|
||||
* @param RepositoryManager $repositoryManager Repository manager.
|
||||
*/
|
||||
public function __construct(RepositoryManager $repositoryManager, Adapter $environmentAdapter)
|
||||
public function __construct(RepositoryManager $repositoryManager)
|
||||
{
|
||||
parent::__construct();
|
||||
$this->repositoryManager = $repositoryManager;
|
||||
|
||||
$this->repositoryManager = $repositoryManager;
|
||||
$this->environmentAdapter = $environmentAdapter;
|
||||
parent::__construct();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -114,26 +103,25 @@ class FileLayerMapper extends AbstractLayerMapper
|
||||
$layerId = $this->getElementId($model, $elementId);
|
||||
|
||||
if ($fileModel instanceof FilesModel && $fileModel->type === 'file') {
|
||||
$url = $this->environmentAdapter->get('url') . '/' . $fileModel->path;
|
||||
switch ($model->fileFormat) {
|
||||
case 'gpx':
|
||||
$layer = new Gpx($layerId, $url);
|
||||
$layer = new Gpx($layerId, $fileModel->path);
|
||||
break;
|
||||
|
||||
case 'kml':
|
||||
$layer = new Kml($layerId, $url);
|
||||
$layer = new Kml($layerId, $fileModel->path);
|
||||
break;
|
||||
|
||||
case 'wkt':
|
||||
$layer = new Wkt($layerId, $url);
|
||||
$layer = new Wkt($layerId, $fileModel->path);
|
||||
break;
|
||||
|
||||
case 'geojson':
|
||||
$layer = new OmnivoreGeoJson($layerId, $url);
|
||||
$layer = new OmnivoreGeoJson($layerId, $fileModel->path);
|
||||
break;
|
||||
|
||||
case 'topojson':
|
||||
$layer = new TopoJson($layerId, $url);
|
||||
$layer = new TopoJson($layerId, $fileModel->path);
|
||||
break;
|
||||
|
||||
default:
|
||||
|
||||
@@ -93,7 +93,7 @@ class TileLayerMapper extends AbstractLayerMapper
|
||||
/** @var TileLayer $definition */
|
||||
$bounds = StringUtil::deserialize($model->bounds);
|
||||
|
||||
if ($bounds[0] && $bounds[1]) {
|
||||
if ($request[0] && $request[1]) {
|
||||
$bounds = array_map(
|
||||
function ($value) {
|
||||
return explode(',', $value, 3);
|
||||
|
||||
@@ -210,10 +210,6 @@ class OptionsBuilder
|
||||
foreach ($options as $option => $mapping) {
|
||||
$default = static::getDefaultOption($option, $definition);
|
||||
|
||||
if ($model->$mapping === null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if ($model->$mapping === '1' || $model->$mapping === '') {
|
||||
if (((bool) $model->$mapping) !== $default) {
|
||||
static::applyOption($option, $model->$mapping, $definition);
|
||||
|
||||
@@ -71,10 +71,16 @@ class ImageIconMapper extends AbstractIconMapper
|
||||
Request $request = null,
|
||||
$elementId = null
|
||||
) {
|
||||
$arguments = parent::buildConstructArguments($model, $mapper, $request, $elementId);
|
||||
$repository = $this->repositoryManager->getRepository(FilesModel::class);
|
||||
$file = $repository->findByUuid($model->iconImage);
|
||||
$arguments[] = $file ? $file->path : '';
|
||||
$arguments = parent::buildConstructArguments($model, $mapper, $request, $elementId);
|
||||
|
||||
if ($model->iconImage) {
|
||||
$repository = $this->repositoryManager->getRepository(FilesModel::class);
|
||||
$file = $repository->findByUuid($model->iconImage);
|
||||
|
||||
if ($file) {
|
||||
$arguments[] = $file->path;
|
||||
}
|
||||
}
|
||||
|
||||
return $arguments;
|
||||
}
|
||||
@@ -111,6 +117,8 @@ class ImageIconMapper extends AbstractIconMapper
|
||||
$file = $repository->findByUuid($model->iconImage);
|
||||
|
||||
if ($file) {
|
||||
$definition->setIconUrl($file->path);
|
||||
|
||||
$file = new File($file->path);
|
||||
$definition->setIconSize([$file->width, $file->height]);
|
||||
|
||||
|
||||
@@ -41,7 +41,6 @@ SELECT l.*, c.mode as controlMode
|
||||
FROM tl_leaflet_layer l
|
||||
LEFT JOIN tl_leaflet_control_layer c ON l.id = c.lid
|
||||
WHERE c.cid=?
|
||||
ORDER BY c.sorting
|
||||
SQL;
|
||||
|
||||
$result = Database::getInstance()
|
||||
@@ -68,7 +67,6 @@ FROM tl_leaflet_layer l
|
||||
LEFT JOIN tl_leaflet_control_layer
|
||||
c ON l.id = c.lid
|
||||
WHERE c.cid=? AND l.active=1
|
||||
ORDER BY c.sorting
|
||||
SQL;
|
||||
|
||||
$result = Database::getInstance()
|
||||
|
||||
@@ -27,6 +27,14 @@ use Contao\Model\Collection;
|
||||
*/
|
||||
class LayerModel extends AbstractActiveModel
|
||||
{
|
||||
public const PERMISSION_EDIT = 'edit';
|
||||
|
||||
public const PERMISSION_CREATE = 'create';
|
||||
|
||||
public const PERMISSION_DELETE = 'delete';
|
||||
|
||||
public const PERMISSION_DATA = 'data';
|
||||
|
||||
/**
|
||||
* Model table.
|
||||
*
|
||||
|
||||
@@ -17,6 +17,7 @@ use Netzmacht\Contao\Leaflet\Filter\BboxFilter;
|
||||
use Netzmacht\Contao\Leaflet\Filter\DistanceFilter;
|
||||
use Netzmacht\Contao\Leaflet\Filter\Filter;
|
||||
use Netzmacht\LeafletPHP\Value\LatLngBounds;
|
||||
use function var_dump;
|
||||
|
||||
/**
|
||||
* Class MarkerModel for the tl_leaflet_marker table.
|
||||
@@ -49,8 +50,8 @@ class MarkerModel extends AbstractActiveModel
|
||||
[
|
||||
$table . '.active=1',
|
||||
$table . '.pid=?',
|
||||
$table . '.latitude IS NOT NULL',
|
||||
$table . '.longitude IS NOT NULL',
|
||||
$table . '.latitude>0',
|
||||
$table . '.longitude>0',
|
||||
],
|
||||
[$pid],
|
||||
['order' => 'sorting']
|
||||
|
||||
Reference in New Issue
Block a user