mirror of
https://github.com/netzmacht/contao-leaflet-maps.git
synced 2025-11-29 03:24:37 +01:00
Compare commits
18 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
60e285c673 | ||
|
|
49f3b7dbcd | ||
|
|
89d83ab8e0 | ||
|
|
141bb0f7b1 | ||
|
|
457bb612ef | ||
|
|
118bb9a829 | ||
|
|
e49c74c546 | ||
|
|
6054def7aa | ||
|
|
86026a473b | ||
|
|
90c4621918 | ||
|
|
e5263a6315 | ||
|
|
515a191a66 | ||
|
|
f2f7e87fd3 | ||
|
|
4198b2b6cd | ||
|
|
fbd1ef81b0 | ||
|
|
92a376a307 | ||
|
|
bf6a1f9db0 | ||
|
|
c523aed70d |
1
.github/FUNDING.yml
vendored
Normal file
1
.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
github: [dmolineus]
|
||||||
28
CHANGELOG.md
28
CHANGELOG.md
@@ -8,6 +8,29 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
|
|
||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
|
|
||||||
|
### 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
|
## [3.1.6] - 2020-01-03
|
||||||
|
|
||||||
### Fixed
|
### Fixed
|
||||||
@@ -145,7 +168,10 @@ Implemented enhancements
|
|||||||
- Bypass filesystem cache in debug mode
|
- Bypass filesystem cache in debug mode
|
||||||
- Changelog added
|
- Changelog added
|
||||||
|
|
||||||
[Unreleased]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.1.6...hotfix/3.1.7
|
[Unreleased]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.2.1...hotfix/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.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.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.4]: https://github.com/netzmacht/contao-leaflet-maps/compare/3.1.3...3.1.4
|
||||||
|
|||||||
@@ -42,12 +42,16 @@
|
|||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
"contao/manager-plugin": "^2.1",
|
"contao/manager-plugin": "^2.1",
|
||||||
|
"hofff/contao-consent-bridge": "^1.0",
|
||||||
"phpcq/all-tasks": "^1.2"
|
"phpcq/all-tasks": "^1.2"
|
||||||
},
|
},
|
||||||
|
"conflict": {
|
||||||
|
"hofff/contao-consent-bridge": "<1.0 || >= 2.0"
|
||||||
|
},
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-master": "3.1.x-dev",
|
"dev-master": "3.2.x-dev",
|
||||||
"dev-develop": "3.2.x-dev",
|
"dev-develop": "3.3.x-dev",
|
||||||
"dev-support/2.x": "2.0.x-dev"
|
"dev-support/2.x": "2.0.x-dev"
|
||||||
},
|
},
|
||||||
"contao": {
|
"contao": {
|
||||||
|
|||||||
925
package-lock.json
generated
925
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
37
src/Bundle/ConsentBridge/Plugin.php
Normal file
37
src/Bundle/ConsentBridge/Plugin.php
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Leaflet maps for Contao CMS.
|
||||||
|
*
|
||||||
|
* @package contao-leaflet-maps
|
||||||
|
* @author David Molineus <david.molineus@netzmacht.de>
|
||||||
|
* @copyright 2014-2017 netzmacht David Molineus. All rights reserved.
|
||||||
|
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
|
||||||
|
* @filesource
|
||||||
|
*/
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Netzmacht\Contao\Leaflet\Bundle\ConsentBridge;
|
||||||
|
|
||||||
|
use Hofff\Contao\Consent\Bridge\Bridge;
|
||||||
|
use Hofff\Contao\Consent\Bridge\Plugin as ConsentBridgePlugin;
|
||||||
|
use Hofff\Contao\Consent\Bridge\Render\RenderInformation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Consent Bridge plugin for leaflet.
|
||||||
|
*/
|
||||||
|
final class Plugin implements ConsentBridgePlugin
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function load(Bridge $bridge): void
|
||||||
|
{
|
||||||
|
$renderInformation = RenderInformation::autoRenderWithPlaceholder('leaflet_consent_bridge_placeholder');
|
||||||
|
|
||||||
|
$bridge
|
||||||
|
->supportContentElement('leaflet', $renderInformation)
|
||||||
|
->supportFrontendModule('leaflet', $renderInformation);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -77,6 +77,7 @@ services:
|
|||||||
class: Netzmacht\Contao\Leaflet\Mapper\Layer\FileLayerMapper
|
class: Netzmacht\Contao\Leaflet\Mapper\Layer\FileLayerMapper
|
||||||
arguments:
|
arguments:
|
||||||
- '@netzmacht.contao_toolkit.repository_manager'
|
- '@netzmacht.contao_toolkit.repository_manager'
|
||||||
|
- '@netzmacht.contao_toolkit.contao.environment_adapter'
|
||||||
tags:
|
tags:
|
||||||
- { name: netzmacht.contao_leaflet.mapper }
|
- { name: netzmacht.contao_leaflet.mapper }
|
||||||
|
|
||||||
|
|||||||
@@ -138,3 +138,7 @@ services:
|
|||||||
arguments:
|
arguments:
|
||||||
- '@twig'
|
- '@twig'
|
||||||
- '%kernel.project_dir%'
|
- '%kernel.project_dir%'
|
||||||
|
|
||||||
|
Netzmacht\Contao\Leaflet\Bundle\ConsentBridge\Plugin:
|
||||||
|
tags:
|
||||||
|
- { name: hofff_contao_consent_bridge.plugin }
|
||||||
@@ -5,6 +5,7 @@
|
|||||||
*
|
*
|
||||||
* @package contao-leaflet-maps
|
* @package contao-leaflet-maps
|
||||||
* @author David Molineus <david.molineus@netzmacht.de>
|
* @author David Molineus <david.molineus@netzmacht.de>
|
||||||
|
* @author Fritz Michael Gschwantner <fmg@inspiredminds.at>
|
||||||
* @copyright 2014-2017 netzmacht David Molineus. All rights reserved.
|
* @copyright 2014-2017 netzmacht David Molineus. All rights reserved.
|
||||||
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
|
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
|
||||||
* @filesource
|
* @filesource
|
||||||
@@ -13,7 +14,7 @@
|
|||||||
$GLOBALS['TL_DCA']['tl_content']['metapalettes']['leaflet'] = [
|
$GLOBALS['TL_DCA']['tl_content']['metapalettes']['leaflet'] = [
|
||||||
'type' => ['type', 'headline'],
|
'type' => ['type', 'headline'],
|
||||||
'leaflet' => ['leaflet_map', 'leaflet_mapId', 'leaflet_width', 'leaflet_height'],
|
'leaflet' => ['leaflet_map', 'leaflet_mapId', 'leaflet_width', 'leaflet_height'],
|
||||||
'templates' => [':hide', 'customTpl', 'leaflet_template'],
|
'template' => [':hide', 'customTpl', 'leaflet_template'],
|
||||||
'protected' => [':hide', 'protected'],
|
'protected' => [':hide', 'protected'],
|
||||||
'expert' => [':hide', 'guests', 'cssID', 'space'],
|
'expert' => [':hide', 'guests', 'cssID', 'space'],
|
||||||
'invisible' => [':hide', 'invisible', 'start', 'start'],
|
'invisible' => [':hide', 'invisible', 'start', 'start'],
|
||||||
|
|||||||
@@ -28,6 +28,9 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = [
|
|||||||
'onsubmit_callback' => [
|
'onsubmit_callback' => [
|
||||||
['netzmacht.contao_leaflet.listeners.dca.leaflet', 'clearCache'],
|
['netzmacht.contao_leaflet.listeners.dca.leaflet', 'clearCache'],
|
||||||
],
|
],
|
||||||
|
'oncopy_callback' => [
|
||||||
|
['netzmacht.contao_leaflet.listeners.dca.map', 'copyLayerRelations'],
|
||||||
|
],
|
||||||
],
|
],
|
||||||
|
|
||||||
'list' => [
|
'list' => [
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
*
|
*
|
||||||
* @package contao-leaflet-maps
|
* @package contao-leaflet-maps
|
||||||
* @author David Molineus <david.molineus@netzmacht.de>
|
* @author David Molineus <david.molineus@netzmacht.de>
|
||||||
|
* @author Fritz Michael Gschwantner <fmg@inspiredminds.at>
|
||||||
* @copyright 2014-2017 netzmacht David Molineus. All rights reserved.
|
* @copyright 2014-2017 netzmacht David Molineus. All rights reserved.
|
||||||
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
|
* @license LGPL-3.0 https://github.com/netzmacht/contao-leaflet-maps/blob/master/LICENSE
|
||||||
* @filesource
|
* @filesource
|
||||||
@@ -13,7 +14,7 @@
|
|||||||
$GLOBALS['TL_DCA']['tl_module']['metapalettes']['leaflet'] = [
|
$GLOBALS['TL_DCA']['tl_module']['metapalettes']['leaflet'] = [
|
||||||
'type' => ['name', 'type', 'headline'],
|
'type' => ['name', 'type', 'headline'],
|
||||||
'leaflet' => ['leaflet_map', 'leaflet_mapId', 'leaflet_width', 'leaflet_height', 'leaflet_template'],
|
'leaflet' => ['leaflet_map', 'leaflet_mapId', 'leaflet_width', 'leaflet_height', 'leaflet_template'],
|
||||||
'templates' => [':hide', 'customTpl'],
|
'template' => [':hide', 'customTpl'],
|
||||||
'protected' => [':hide', 'protected'],
|
'protected' => [':hide', 'protected'],
|
||||||
'expert' => [':hide', 'guests', 'cssID', 'space'],
|
'expert' => [':hide', 'guests', 'cssID', 'space'],
|
||||||
'invisible' => [':hide', 'invisible', 'start', 'start'],
|
'invisible' => [':hide', 'invisible', 'start', 'start'],
|
||||||
|
|||||||
@@ -9,5 +9,5 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!-- indexer::continue -->
|
<!-- indexer::continue -->
|
||||||
<?php $GLOBALS['TL_BODY'][] = '<script>' . $this->javascript . '</script>'; ?>
|
<script><?= $this->javascript ?></script>
|
||||||
|
|
||||||
|
|||||||
@@ -9,4 +9,4 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
<!-- indexer::continue -->
|
<!-- indexer::continue -->
|
||||||
<?php $GLOBALS['TL_BODY'][] = '<script>' . $this->javascript . '</script>'; ?>
|
<script><?= $this->javascript ?></script>
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -226,4 +226,26 @@ class MapDcaListener extends AbstractListener
|
|||||||
->asTree()
|
->asTree()
|
||||||
->getOptions();
|
->getOptions();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Copy layer relations if a map is duplicated.
|
||||||
|
*
|
||||||
|
* @param string|int $insertId Insert id of the new map.
|
||||||
|
* @param DataContainer $dataContainer Data container driver.
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function copyLayerRelations($insertId, DataContainer $dataContainer): void
|
||||||
|
{
|
||||||
|
$statement = $this->connection->prepare('SELECT * FROM tl_leaflet_map_layer WHERE mid=:mid order BY sorting');
|
||||||
|
$statement->bindValue('mid', $dataContainer->id);
|
||||||
|
$statement->execute();
|
||||||
|
|
||||||
|
while ($row = $statement->fetch(PDO::FETCH_ASSOC)) {
|
||||||
|
unset($row['id']);
|
||||||
|
$row['tstamp'] = time();
|
||||||
|
$row['mid'] = $insertId;
|
||||||
|
$this->connection->insert('tl_leaflet_map_layer', $row);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -385,11 +385,15 @@ class MapProvider
|
|||||||
];
|
];
|
||||||
|
|
||||||
$content = $this->templateEngine->render($templateReference, $parameters);
|
$content = $this->templateEngine->render($templateReference, $parameters);
|
||||||
|
$content = preg_replace(
|
||||||
|
['/^<!-- TEMPLATE (START): .+ -->\n*/', '/\n*<!-- TEMPLATE (END): .+ -->$/'],
|
||||||
|
'',
|
||||||
|
$content
|
||||||
|
);
|
||||||
|
|
||||||
$event = new GetJavascriptEvent($definition, $content);
|
$event = new GetJavascriptEvent($definition, $content);
|
||||||
$this->eventDispatcher->dispatch($event::NAME, $event);
|
$this->eventDispatcher->dispatch($event::NAME, $event);
|
||||||
|
|
||||||
$buffer = $event->getJavascript();
|
return $event->getJavascript();
|
||||||
|
|
||||||
return $buffer;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ declare(strict_types=1);
|
|||||||
|
|
||||||
namespace Netzmacht\Contao\Leaflet\Mapper\Layer;
|
namespace Netzmacht\Contao\Leaflet\Mapper\Layer;
|
||||||
|
|
||||||
|
use Contao\CoreBundle\Framework\Adapter;
|
||||||
|
use Contao\Environment;
|
||||||
use Contao\FilesModel;
|
use Contao\FilesModel;
|
||||||
use Contao\Model;
|
use Contao\Model;
|
||||||
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
|
||||||
@@ -58,16 +60,25 @@ class FileLayerMapper extends AbstractLayerMapper
|
|||||||
*/
|
*/
|
||||||
private $repositoryManager;
|
private $repositoryManager;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Environment.
|
||||||
|
*
|
||||||
|
* @var Adapter<Environment>
|
||||||
|
*/
|
||||||
|
private $environmentAdapter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Construct.
|
* Construct.
|
||||||
*
|
*
|
||||||
* @param RepositoryManager $repositoryManager Repository manager.
|
* @param RepositoryManager $repositoryManager Repository manager.
|
||||||
|
* @param Adapter<Environment> $environmentAdapter Environment adapter.
|
||||||
*/
|
*/
|
||||||
public function __construct(RepositoryManager $repositoryManager)
|
public function __construct(RepositoryManager $repositoryManager, Adapter $environmentAdapter)
|
||||||
{
|
{
|
||||||
$this->repositoryManager = $repositoryManager;
|
|
||||||
|
|
||||||
parent::__construct();
|
parent::__construct();
|
||||||
|
|
||||||
|
$this->repositoryManager = $repositoryManager;
|
||||||
|
$this->environmentAdapter = $environmentAdapter;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -103,25 +114,26 @@ class FileLayerMapper extends AbstractLayerMapper
|
|||||||
$layerId = $this->getElementId($model, $elementId);
|
$layerId = $this->getElementId($model, $elementId);
|
||||||
|
|
||||||
if ($fileModel instanceof FilesModel && $fileModel->type === 'file') {
|
if ($fileModel instanceof FilesModel && $fileModel->type === 'file') {
|
||||||
|
$url = $this->environmentAdapter->get('url') . '/' . $fileModel->path;
|
||||||
switch ($model->fileFormat) {
|
switch ($model->fileFormat) {
|
||||||
case 'gpx':
|
case 'gpx':
|
||||||
$layer = new Gpx($layerId, $fileModel->path);
|
$layer = new Gpx($layerId, $url);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'kml':
|
case 'kml':
|
||||||
$layer = new Kml($layerId, $fileModel->path);
|
$layer = new Kml($layerId, $url);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'wkt':
|
case 'wkt':
|
||||||
$layer = new Wkt($layerId, $fileModel->path);
|
$layer = new Wkt($layerId, $url);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'geojson':
|
case 'geojson':
|
||||||
$layer = new OmnivoreGeoJson($layerId, $fileModel->path);
|
$layer = new OmnivoreGeoJson($layerId, $url);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'topojson':
|
case 'topojson':
|
||||||
$layer = new TopoJson($layerId, $fileModel->path);
|
$layer = new TopoJson($layerId, $url);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user