Merge branch 'leaflet-v1'

This commit is contained in:
David Molineus
2016-10-06 15:53:55 +02:00
68 changed files with 1890 additions and 805 deletions

View File

@@ -1,21 +1,14 @@
language: php
php:
- 5.4
- 5.5
- 5.6
- "5.4"
- "5.5"
- "5.6"
- "7.0"
- "nightly"
env:
- CONTAO_VERSION=~3.2.0
- CONTAO_VERSION=~3.3.0
- CONTAO_VERSION=~3.4.0
- CONTAO_VERSION=~3.5.0
# Exclude impossible Contao Version combinations.
matrix:
exclude:
- php: 5.3
env: CONTAO_VERSION=~3.5.0
- CONTAO_VERSION=~3.5.1
sudo: false
@@ -26,6 +19,11 @@ install:
script: ant -keep-going
matrix:
allow_failures:
- php: "7.0"
- php: "nightly"
# Hack to make things work again - we can not use a shallow repository.
git:
depth: 2147483647

View File

@@ -1 +1 @@
L.Contao=L.Class.extend({includes:L.Mixin.Events,statics:{ATTRIBUTION:' | <a href="http://contao-leaflet.netzmacht.de/" title="Leaflet extension for Contao CMS">netzmacht <em>creative</em></a>'},maps:{},icons:{},initialize:function(){L.Icon.Default.imagePath="assets/leaflet/libs/leaflet/images",this.setGeoJsonListeners(L.GeoJSON)},addMap:function(t,e){return this.maps[t]=e,this.fire("map:added",{id:t,map:e}),this},getMap:function(t){return"undefined"==typeof this.maps[t]?null:this.maps[t]},addIcon:function(t,e){return this.icons[t]=e,this.fire("icon:added",{id:t,icon:e}),this},loadIcons:function(t){for(var e=0;e<t.length;e++){var o=L[t[e].type](t[e].options);this.addIcon(t[e].id,o)}},getIcon:function(t){return"undefined"==typeof this.icons[t]?null:this.icons[t]},load:function(t,e,o,n,i){var s=this.createRequestUrl(t,i),r=omnivore[e](s,o,n);return i&&(L.stamp(r),i.options.dynamicLoad&&"fit"==r.options.boundsMode&&(r.options.requestHash=t,i.on("moveend",r.refreshData,r),i.on("layerremove",function(t){t.layer===r&&i.off("moveend",r.updateBounds,r)})),i.fire("dataloading",{layer:r}),r.on("ready",function(){i.calculateFeatureBounds(r),i.fire("dataload",{layer:r})}),r.on("error",function(){i.fire("dataload",{layer:r})})),r},pointToLayer:function(t,e){var o="marker",n=null;if(t.properties&&(t.properties.bounds=!0,t.properties.type&&(o=t.properties.type),t.properties.arguments&&(n=L[o].apply(L[o],t.properties.arguments),L.Util.setOptions(n,t.properties.options))),null===n&&(n=L[o](e,t.properties.options)),t.properties){if(t.properties.radius&&n.setRadius(t.properties.radius),t.properties.icon){var i=this.getIcon(t.properties.icon);i&&n.setIcon(i)}this.bindPopupFromFeature(n,t)}return this.fire("point:added",{marker:n,feature:t,latlng:e,type:o}),n},onEachFeature:function(t,e){t.properties&&(L.Util.setOptions(e,t.properties.options),this.bindPopupFromFeature(e,t),this.fire("feature:added",{feature:t,layer:e}))},bindPopupFromFeature:function(t,e){e.properties&&(e.properties.popup?t.bindPopup(e.properties.popup,e.properties.popupOptions):e.properties.popupContent&&t.bindPopup(e.properties.popupContent,e.properties.popupOptions))},setGeoJsonListeners:function(t){t&&t.prototype&&(t.prototype.options={pointToLayer:this.pointToLayer.bind(this),onEachFeature:this.onEachFeature.bind(this)})},createRequestUrl:function(t,e){var o,n="leaflet",i=document.location.search.substr(1).split("&");if(t=encodeURIComponent(t),""==i)t=document.location.pathname+"?"+[n,t].join("=");else{for(var s,r=i.length;r--;)if(s=i[r].split("="),s[0]==n){s[1]=t,i[r]=s.join("=");break}0>r&&(i[i.length]=[n,t].join("=")),t=document.location.pathname+"?"+i.join("&")}return e&&e.options.dynamicLoad&&(o=e.getBounds(),t+="&f=bbox&v=",t+=o.getSouth()+","+o.getWest(),t+=","+o.getNorth()+","+o.getEast()),t}}),L.contao=new L.Contao,L.Control.Attribution.addInitHook(function(){this.options.prefix+=L.Contao.ATTRIBUTION}),L.Control.Attribution.include({setPrefix:function(t){return-1===t.indexOf(L.Contao.ATTRIBUTION)&&(t+=L.Contao.ATTRIBUTION),this.options.prefix=t,this._update(),this}}),L.GeoJSON.include({refreshData:function(t){var e=L.geoJson(),o=this;e.on("ready",function(){var t,e=o.getLayers();for(t=0;t<e.length;t++)o.removeLayer(e[t]);for(e=this.getLayers(),t=0;t<e.length;t++)this.removeLayer(e[t]),o.addLayer(e[t])}),omnivore.geojson(L.contao.createRequestUrl(this.options.requestHash,t.target),null,e)}}),L.Map.include({_dynamicBounds:null,calculateFeatureBounds:function(t,e){if(t){if(!this.options.adjustBounds&&!e)return;this._scanForBounds(t)}else this.eachLayer(this._scanForBounds,this);this._dynamicBounds&&this.fitBounds(this._dynamicBounds)},_scanForBounds:function(t){var e;!t.feature||t.feature.properties&&t.feature.properties.ignoreForBounds?L.MarkerClusterGroup&&t instanceof L.MarkerClusterGroup&&t.options.boundsMode&&"extend"==t.options.boundsMode?(e=t.getBounds(),e.isValid()&&(this._dynamicBounds?this._dynamicBounds.extend(e):this._dynamicBounds=L.latLngBounds(e.getSouthWest(),e.getNorthEast()))):(!t.options||t.options&&t.options.boundsMode&&!t.options.ignoreForBounds)&&t.eachLayer&&t.eachLayer(this._scanForBounds,this):t.getBounds?(e=t.getBounds(),e.isValid()&&(this._dynamicBounds?this._dynamicBounds.extend(e):this._dynamicBounds=L.latLngBounds(e.getSouthWest(),e.getNorthEast()))):t.getLatLng&&(e=t.getLatLng(),this._dynamicBounds?this._dynamicBounds.extend(e):this._dynamicBounds=L.latLngBounds(e,e))}});
L.Contao=L.Class.extend({includes:L.Mixin.Events,statics:{ATTRIBUTION:' | <a href="https://netzmacht.de/contao-leaflet" title="Powered by Leaflet extension for Contao CMS developed by netzmacht David Molineus">netzmacht</a>'},maps:{},icons:{},initialize:function(){L.Icon.Default.imagePath="assets/leaflet/libs/leaflet/images/",this.setGeoJsonListeners(L.GeoJSON)},addMap:function(t,e){return this.maps[t]=e,this.fire("map:added",{id:t,map:e}),this},getMap:function(t){return"undefined"==typeof this.maps[t]?null:this.maps[t]},addIcon:function(t,e){return this.icons[t]=e,this.fire("icon:added",{id:t,icon:e}),this},loadIcons:function(t){for(var e=0;e<t.length;e++){var o=L[t[e].type](t[e].options);this.addIcon(t[e].id,o)}},getIcon:function(t){return"undefined"==typeof this.icons[t]?null:this.icons[t]},load:function(t,e,o,n,i){var s=this.createRequestUrl(t,i),r=omnivore[e](s,o,n);return i&&(L.stamp(r),i.options.dynamicLoad&&"fit"==r.options.boundsMode&&(r.options.requestHash=t,i.on("moveend",r.refreshData,r),i.on("layerremove",function(t){t.layer===r&&i.off("moveend",r.updateBounds,r)})),i.fire("dataloading",{layer:r}),r.on("ready",function(){i.calculateFeatureBounds(r),i.fire("dataload",{layer:r})}),r.on("error",function(){i.fire("dataload",{layer:r})})),r},pointToLayer:function(t,e){var o="marker",n=null;if(t.properties&&(t.properties.bounds=!0,t.properties.type&&(o=t.properties.type),t.properties.arguments&&(n=L[o].apply(L[o],t.properties.arguments),L.Util.setOptions(n,t.properties.options))),null===n&&(n=L[o](e,t.properties.options)),t.properties){if(t.properties.radius&&n.setRadius(t.properties.radius),t.properties.icon){var i=this.getIcon(t.properties.icon);i&&n.setIcon(i)}this.bindPopupFromFeature(n,t)}return this.fire("point:added",{marker:n,feature:t,latlng:e,type:o}),n},onEachFeature:function(t,e){t.properties&&(L.Util.setOptions(e,t.properties.options),this.bindPopupFromFeature(e,t),this.fire("feature:added",{feature:t,layer:e}))},bindPopupFromFeature:function(t,e){e.properties&&(e.properties.popup?t.bindPopup(e.properties.popup,e.properties.popupOptions):e.properties.popupContent&&t.bindPopup(e.properties.popupContent,e.properties.popupOptions))},setGeoJsonListeners:function(t){t&&t.prototype&&(t.prototype.options={pointToLayer:this.pointToLayer.bind(this),onEachFeature:this.onEachFeature.bind(this)})},createRequestUrl:function(t,e){var o,n="leaflet",i=document.location.search.substr(1).split("&");if(t=encodeURIComponent(t),""==i)t=document.location.pathname+"?"+[n,t].join("=");else{for(var s,r=i.length;r--;)if(s=i[r].split("="),s[0]==n){s[1]=t,i[r]=s.join("=");break}r<0&&(i[i.length]=[n,t].join("=")),t=document.location.pathname+"?"+i.join("&")}return e&&e.options.dynamicLoad&&(o=e.getBounds(),t+="&f=bbox&v=",t+=o.getSouth()+","+o.getWest(),t+=","+o.getNorth()+","+o.getEast()),t}}),L.contao=new L.Contao,L.Control.Attribution.addInitHook(function(){this.options.prefix+=L.Contao.ATTRIBUTION}),L.Control.Attribution.include({setPrefix:function(t){return t.indexOf(L.Contao.ATTRIBUTION)===-1&&(t+=L.Contao.ATTRIBUTION),this.options.prefix=t,this._update(),this}}),L.GeoJSON.include({refreshData:function(t){var e=L.geoJson(),o=this;e.on("ready",function(){var t,e=o.getLayers();for(t=0;t<e.length;t++)o.removeLayer(e[t]);for(e=this.getLayers(),t=0;t<e.length;t++)this.removeLayer(e[t]),o.addLayer(e[t])}),omnivore.geojson(L.contao.createRequestUrl(this.options.requestHash,t.target),null,e)}}),L.Map.include({_dynamicBounds:null,calculateFeatureBounds:function(t,e){if(t){if(!this.options.adjustBounds&&!e)return;this._scanForBounds(t)}else this.eachLayer(this._scanForBounds,this);this._dynamicBounds&&this.fitBounds(this._dynamicBounds)},_scanForBounds:function(t){var e;!t.feature||t.feature.properties&&t.feature.properties.ignoreForBounds?L.MarkerClusterGroup&&t instanceof L.MarkerClusterGroup&&t.options.boundsMode&&"extend"==t.options.boundsMode?(e=t.getBounds(),e.isValid()&&(this._dynamicBounds?this._dynamicBounds.extend(e):this._dynamicBounds=L.latLngBounds(e.getSouthWest(),e.getNorthEast()))):(!t.options||t.options&&t.options.boundsMode&&!t.options.ignoreForBounds)&&t.eachLayer&&t.eachLayer(this._scanForBounds,this):t.getBounds?(e=t.getBounds(),e.isValid()&&(this._dynamicBounds?this._dynamicBounds.extend(e):this._dynamicBounds=L.latLngBounds(e.getSouthWest(),e.getNorthEast()))):t.getLatLng&&(e=t.getLatLng(),this._dynamicBounds?this._dynamicBounds.extend(e):this._dynamicBounds=L.latLngBounds(e,e))}});

View File

@@ -12,7 +12,7 @@ L.Contao = L.Class.extend({
*
* You are not allowed to remove or change it. Contact me if you want to buy an removal license.
*/
ATTRIBUTION: ' | <a href="http://contao-leaflet.netzmacht.de/" title="Leaflet extension for Contao CMS">netzmacht <em>creative</em></a>'
ATTRIBUTION: ' | <a href="https://netzmacht.de/contao-leaflet" title="Powered by Leaflet extension for Contao CMS developed by netzmacht David Molineus">netzmacht</a>'
},
/**
@@ -29,7 +29,7 @@ L.Contao = L.Class.extend({
* Initialize Contao leaflet integration.
*/
initialize: function () {
L.Icon.Default.imagePath = 'assets/leaflet/libs/leaflet/images';
L.Icon.Default.imagePath = 'assets/leaflet/libs/leaflet/images/';
this.setGeoJsonListeners(L.GeoJSON);
},

View File

@@ -19,23 +19,23 @@
},
"require":{
"php":">=5.4",
"contao/core":">=3.2,<3.6-dev",
"contao-community-alliance/dependency-container":"~1.0",
"contao-community-alliance/event-dispatcher":"~1.0",
"netzmacht/contao-leaflet-libraries": "~0.7",
"netzmacht/php-javascript-builder": "~1.0",
"netzmacht/php-leaflet": "~0.7",
"netzmacht/contao-toolkit":"~1.0",
"contao-community-alliance/meta-palettes": "~1.5",
"menatwork/contao-multicolumnwizard": "~3.2",
"doctrine/cache": "~1.0"
"contao/core":"^3.5",
"contao-community-alliance/dependency-container":"^1.0",
"contao-community-alliance/event-dispatcher":"^1.0",
"netzmacht/contao-leaflet-libraries": "^1.0",
"netzmacht/php-javascript-builder": "^1.0",
"netzmacht/php-leaflet": "^1.0",
"netzmacht/contao-toolkit":"^2.0",
"contao-community-alliance/meta-palettes": "^1.5",
"menatwork/contao-multicolumnwizard": "^3.2",
"doctrine/cache": "^1.0"
},
"require-dev":{
"netzmacht/contao-build-tools": "~1.1"
"netzmacht/contao-build-tools": "^1.1"
},
"autoload": {
"psr-0": {
"Netzmacht\\Contao\\Leaflet": "src/"
"Netzmacht\\Contao\\Leaflet\\": "src/"
}
},
"config": {

View File

@@ -9,8 +9,8 @@ var paths = {
dest: 'assets/maps'
};
gulp.task('clear', function(cb) {
del([paths.dest + '/' + paths.minified], cb);
gulp.task('clear', function() {
del([paths.dest + '/' + paths.minified]);
});
gulp.task('scripts', ['clear'], function() {

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.5 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

View File

@@ -0,0 +1 @@
requires[] = 'toolkit'

View File

@@ -56,13 +56,13 @@ array_insert(
/*
* Content elements.
*/
$GLOBALS['TL_CTE']['includes']['leaflet'] = 'Netzmacht\Contao\Leaflet\Frontend\MapElement';
$GLOBALS['TL_CTE']['includes']['leaflet'] = 'Netzmacht\Contao\Toolkit\Component\ContentElement\ContentElementDecorator';
/*
* Frontend modules
*/
$GLOBALS['FE_MOD']['includes']['leaflet'] = 'Netzmacht\Contao\Leaflet\Frontend\MapModule';
$GLOBALS['FE_MOD']['includes']['leaflet'] = 'Netzmacht\Contao\Toolkit\Component\Module\ModuleDecorator';
/*
@@ -88,12 +88,21 @@ $GLOBALS['LEAFLET_MAPPERS'][] = 'Netzmacht\Contao\Leaflet\Mapper\MapMapper';
// Layer mappers.
$GLOBALS['LEAFLET_MAPPERS'][] = 'Netzmacht\Contao\Leaflet\Mapper\Layer\TileLayerMapper';
$GLOBALS['LEAFLET_MAPPERS'][] = 'Netzmacht\Contao\Leaflet\Mapper\Layer\ProviderLayerMapper';
$GLOBALS['LEAFLET_MAPPERS'][] = function () {
return new \Netzmacht\Contao\Leaflet\Mapper\Layer\ProviderLayerMapper(
$GLOBALS['LEAFLET_TILE_PROVIDERS']
);
};
$GLOBALS['LEAFLET_MAPPERS'][] = 'Netzmacht\Contao\Leaflet\Mapper\Layer\MarkersLayerMapper';
$GLOBALS['LEAFLET_MAPPERS'][] = 'Netzmacht\Contao\Leaflet\Mapper\Layer\GroupLayerMapper';
$GLOBALS['LEAFLET_MAPPERS'][] = 'Netzmacht\Contao\Leaflet\Mapper\Layer\VectorsLayerMapper';
$GLOBALS['LEAFLET_MAPPERS'][] = 'Netzmacht\Contao\Leaflet\Mapper\Layer\ReferenceLayerMapper';
$GLOBALS['LEAFLET_MAPPERS'][] = 'Netzmacht\Contao\Leaflet\Mapper\Layer\MarkerClusterLayerMapper';
$GLOBALS['LEAFLET_MAPPERS'][] = function () {
return new \Netzmacht\Contao\Leaflet\Mapper\Layer\MarkerClusterLayerMapper(
$GLOBALS['container'][\Netzmacht\Contao\Leaflet\DependencyInjection\LeafletServices::MAP_ASSETS]
);
};
// Control mappers.
$GLOBALS['LEAFLET_MAPPERS'][] = 'Netzmacht\Contao\Leaflet\Mapper\Control\ZoomControlMapper';
@@ -104,26 +113,40 @@ $GLOBALS['LEAFLET_MAPPERS'][] = 'Netzmacht\Contao\Leaflet\Mapper\Control\Loading
$GLOBALS['LEAFLET_MAPPERS'][] = 'Netzmacht\Contao\Leaflet\Mapper\Control\FullscreenControlMapper';
// Vector mappers.
$GLOBALS['LEAFLET_MAPPERS'][] = function (\Netzmacht\Contao\Leaflet\ServiceContainer $container) {
return new Netzmacht\Contao\Leaflet\Mapper\Vector\PolylineMapper($container->getFrontendValueFilter());
$GLOBALS['LEAFLET_MAPPERS'][] = function () {
return new Netzmacht\Contao\Leaflet\Mapper\Vector\PolylineMapper(
$GLOBALS['container'][\Netzmacht\Contao\Leaflet\DependencyInjection\LeafletServices::FRONTEND_VALUE_FILTER]
);
};
$GLOBALS['LEAFLET_MAPPERS'][] = function (\Netzmacht\Contao\Leaflet\ServiceContainer $container) {
return new Netzmacht\Contao\Leaflet\Mapper\Vector\MultiPolylineMapper($container->getFrontendValueFilter());
$GLOBALS['LEAFLET_MAPPERS'][] = function () {
return new Netzmacht\Contao\Leaflet\Mapper\Vector\MultiPolylineMapper(
$GLOBALS['container'][\Netzmacht\Contao\Leaflet\DependencyInjection\LeafletServices::FRONTEND_VALUE_FILTER]
);
};
$GLOBALS['LEAFLET_MAPPERS'][] = function (\Netzmacht\Contao\Leaflet\ServiceContainer $container) {
return new Netzmacht\Contao\Leaflet\Mapper\Vector\PolygonMapper($container->getFrontendValueFilter());
$GLOBALS['LEAFLET_MAPPERS'][] = function () {
return new Netzmacht\Contao\Leaflet\Mapper\Vector\PolygonMapper(
$GLOBALS['container'][\Netzmacht\Contao\Leaflet\DependencyInjection\LeafletServices::FRONTEND_VALUE_FILTER]
);
};
$GLOBALS['LEAFLET_MAPPERS'][] = function (\Netzmacht\Contao\Leaflet\ServiceContainer $container) {
return new Netzmacht\Contao\Leaflet\Mapper\Vector\MultiPolygonMapper($container->getFrontendValueFilter());
$GLOBALS['LEAFLET_MAPPERS'][] = function () {
return new Netzmacht\Contao\Leaflet\Mapper\Vector\MultiPolygonMapper(
$GLOBALS['container'][\Netzmacht\Contao\Leaflet\DependencyInjection\LeafletServices::FRONTEND_VALUE_FILTER]
);
};
$GLOBALS['LEAFLET_MAPPERS'][] = function (\Netzmacht\Contao\Leaflet\ServiceContainer $container) {
return new Netzmacht\Contao\Leaflet\Mapper\Vector\CircleMapper($container->getFrontendValueFilter());
$GLOBALS['LEAFLET_MAPPERS'][] = function () {
return new Netzmacht\Contao\Leaflet\Mapper\Vector\CircleMapper(
$GLOBALS['container'][\Netzmacht\Contao\Leaflet\DependencyInjection\LeafletServices::FRONTEND_VALUE_FILTER]
);
};
$GLOBALS['LEAFLET_MAPPERS'][] = function (\Netzmacht\Contao\Leaflet\ServiceContainer $container) {
return new Netzmacht\Contao\Leaflet\Mapper\Vector\CircleMarkerMapper($container->getFrontendValueFilter());
$GLOBALS['LEAFLET_MAPPERS'][] = function () {
return new Netzmacht\Contao\Leaflet\Mapper\Vector\CircleMarkerMapper(
$GLOBALS['container'][\Netzmacht\Contao\Leaflet\DependencyInjection\LeafletServices::FRONTEND_VALUE_FILTER]
);
};
$GLOBALS['LEAFLET_MAPPERS'][] = function (\Netzmacht\Contao\Leaflet\ServiceContainer $container) {
return new Netzmacht\Contao\Leaflet\Mapper\Vector\RectangleMapper($container->getFrontendValueFilter());
$GLOBALS['LEAFLET_MAPPERS'][] = function () {
return new Netzmacht\Contao\Leaflet\Mapper\Vector\RectangleMapper(
$GLOBALS['container'][\Netzmacht\Contao\Leaflet\DependencyInjection\LeafletServices::FRONTEND_VALUE_FILTER]
);
};
// Miscellaneous mappers.
@@ -131,8 +154,10 @@ $GLOBALS['LEAFLET_MAPPERS'][] = 'Netzmacht\Contao\Leaflet\Mapper\UI\PopupMapper'
$GLOBALS['LEAFLET_MAPPERS'][] = 'Netzmacht\Contao\Leaflet\Mapper\Type\ImageIconMapper';
$GLOBALS['LEAFLET_MAPPERS'][] = 'Netzmacht\Contao\Leaflet\Mapper\Type\DivIconMapper';
$GLOBALS['LEAFLET_MAPPERS'][] = 'Netzmacht\Contao\Leaflet\Mapper\Style\FixedStyleMapper';
$GLOBALS['LEAFLET_MAPPERS'][] = function (\Netzmacht\Contao\Leaflet\ServiceContainer $container) {
return new \Netzmacht\Contao\Leaflet\Mapper\UI\MarkerMapper($container->getFrontendValueFilter());
$GLOBALS['LEAFLET_MAPPERS'][] = function () {
return new \Netzmacht\Contao\Leaflet\Mapper\UI\MarkerMapper(
$GLOBALS['container'][\Netzmacht\Contao\Leaflet\DependencyInjection\LeafletServices::FRONTEND_VALUE_FILTER]
);
};
/*

View File

@@ -9,7 +9,7 @@
*
*/
return array(
'Netzmacht\Contao\Leaflet\Subscriber\BootSubscriber',
$GLOBALS['container']['leaflet.boot.subscriber'],
'Netzmacht\Contao\Leaflet\Subscriber\HashSubscriber',
'Netzmacht\Contao\Leaflet\Subscriber\GeoJsonSubscriber',
$GLOBALS['container']['leaflet.subscriber.geo-json'],
);

View File

@@ -9,15 +9,34 @@
*
*/
use Doctrine\Common\Cache\ArrayCache;
use Doctrine\Common\Cache\FilesystemCache;
use Interop\Container\ContainerInterface;
use Netzmacht\Contao\Leaflet\Alias\DefaultAliasFilter;
use Netzmacht\Contao\Leaflet\Boot;
use Netzmacht\Contao\Leaflet\ContaoAssets;
use Netzmacht\Contao\Leaflet\Frontend\Helper\InsertTagReplacer;
use Netzmacht\Contao\Leaflet\Dca\ControlCallbacks;
use Netzmacht\Contao\Leaflet\Dca\FrontendIntegration;
use Netzmacht\Contao\Leaflet\Dca\LayerCallbacks;
use Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks;
use Netzmacht\Contao\Leaflet\Dca\MapCallbacks;
use Netzmacht\Contao\Leaflet\Dca\Validator;
use Netzmacht\Contao\Leaflet\Dca\VectorCallbacks;
use Netzmacht\Contao\Leaflet\DependencyInjection\LeafletServices;
use Netzmacht\Contao\Leaflet\Frontend\MapElement;
use Netzmacht\Contao\Leaflet\Frontend\MapModule;
use Netzmacht\Contao\Leaflet\Frontend\ValueFilter;
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
use Netzmacht\Contao\Leaflet\MapService;
use Netzmacht\Contao\Leaflet\ServiceContainer;
use Netzmacht\Contao\Leaflet\MapProvider;
use Netzmacht\Contao\Leaflet\Subscriber\BootSubscriber;
use Netzmacht\Contao\Leaflet\Subscriber\GeoJsonSubscriber;
use Netzmacht\Contao\Toolkit\Data\Alias\Filter\ExistingAliasFilter;
use Netzmacht\Contao\Toolkit\Data\Alias\Filter\SlugifyFilter;
use Netzmacht\Contao\Toolkit\Data\Alias\Filter\SuffixFilter;
use Netzmacht\Contao\Toolkit\Data\Alias\FilterBasedAliasGenerator;
use Netzmacht\Contao\Toolkit\Data\Alias\Validator\UniqueDatabaseValueValidator;
use Netzmacht\Contao\Toolkit\DependencyInjection\Services;
use Netzmacht\JavascriptBuilder\Builder;
use Netzmacht\JavascriptBuilder\Encoder;
use Netzmacht\JavascriptBuilder\Encoder\ChainEncoder;
use Netzmacht\JavascriptBuilder\Encoder\JavascriptEncoder;
use Netzmacht\JavascriptBuilder\Encoder\MultipleObjectsEncoder;
@@ -31,40 +50,52 @@ use Symfony\Component\EventDispatcher\EventDispatcher;
global $container;
/*
* Leaflet map service is a simply api entry to to get the leaflet map from the database.
* Leaflet map provider is a simply api entry to to get the leaflet map from the database.
*/
$container['leaflet.map.service'] = $container->share(function ($container) {
return new MapService(
$container['leaflet.definition.mapper'],
$container['leaflet.definition.builder'],
$container['event-dispatcher'],
$container['input'],
$container['leaflet.map.assets']
$container[LeafletServices::MAP_PROVIDER] = $container->share(function ($container) {
return new MapProvider(
$container[LeafletServices::DEFINITION_MAPPER],
$container[LeafletServices::DEFINITION_BUILDER],
$container[Services::EVENT_DISPATCHER],
$container[Services::INPUT],
$container[LeafletServices::MAP_ASSETS],
$container[LeafletServices::CACHE],
$GLOBALS['LEAFLET_FILTERS'],
\Config::get('debugMode') || \Config::get('displayErrors')
);
});
/*
* Contao assets handler. Loads Leaflet assets as contao (static) assets.
*/
$container['leaflet.map.assets'] = $container->share(function () {
return new ContaoAssets();
$container[LeafletServices::MAP_ASSETS] = $container->share(function ($container) {
return new ContaoAssets($container[Services::ASSETS_MANAGER]);
});
/*
* The leaflet boot.
*/
$container['leaflet.boot'] = $container->share(function ($container) {
return new Boot($container['event-dispatcher']);
$container[LeafletServices::BOOT] = $container->share(function ($container) {
return new Boot($container[Services::EVENT_DISPATCHER]);
});
$container['leaflet.boot.subscriber'] = $container->share(function ($container) {
return new BootSubscriber(
$container[LeafletServices::MAP_ASSETS],
$GLOBALS['LEAFLET_MAPPERS'],
$GLOBALS['LEAFLET_ENCODERS'],
$GLOBALS['LEAFLET_LIBRARIES']
);
});
/*
* The definition mapper.
*/
$container['leaflet.definition.mapper'] = $container->share(function ($container) {
$container[LeafletServices::DEFINITION_MAPPER] = $container->share(function ($container) {
/** @var Boot $boot */
$boot = $container['leaflet.boot'];
$mapper = new DefinitionMapper($container['event-dispatcher']);
$boot = $container[LeafletServices::BOOT];
$mapper = new DefinitionMapper($container[Services::EVENT_DISPATCHER]);
return $boot->initializeDefinitionMapper($mapper);
});
@@ -73,9 +104,9 @@ $container['leaflet.definition.mapper'] = $container->share(function ($container
/*
* The local event dispatcher is used for the leaflet javascript encoding system.
*/
$container['leaflet.definition.builder.event-dispatcher'] = $container->share(function ($container) {
$container[LeafletServices::DEFINITION_BUILDER_EVENT_DISPATCHER] = $container->share(function ($container) {
/** @var Boot $boot */
$boot = $container['leaflet.boot'];
$boot = $container[LeafletServices::BOOT];
$dispatcher = new EventDispatcher();
return $boot->initializeEventDispatcher($dispatcher);
@@ -84,8 +115,8 @@ $container['leaflet.definition.builder.event-dispatcher'] = $container->share(fu
/*
* The javascript encoder factory being used for building the map javascript.
*/
$container['leaflet.definition.builder.encoder-factory'] = function ($container) {
$dispatcher = $container['leaflet.definition.builder.event-dispatcher'];
$container[LeafletServices::DEFINITION_ENCODER_FACTORY] = function ($container) {
$dispatcher = $container[LeafletServices::DEFINITION_BUILDER_EVENT_DISPATCHER];
return function (Output $output) use ($dispatcher) {
$encoder = new ChainEncoder();
@@ -101,11 +132,11 @@ $container['leaflet.definition.builder.encoder-factory'] = function ($container)
/*
* The leaflet builder transforms the definition to javascript.
*/
$container['leaflet.definition.builder'] = $container->share(function($container) {
$container[LeafletServices::DEFINITION_BUILDER] = $container->share(function($container) {
/** @var Boot $boot */
$boot = $container['leaflet.boot'];
$dispatcher = $container['leaflet.definition.builder.event-dispatcher'];
$factory = $container['leaflet.definition.builder.encoder-factory'];
$boot = $container[LeafletServices::BOOT];
$dispatcher = $container[LeafletServices::DEFINITION_BUILDER_EVENT_DISPATCHER];
$factory = $container[LeafletServices::DEFINITION_ENCODER_FACTORY];
$builder = new Builder($factory);
$leaflet = new Leaflet($builder, $dispatcher, array(), JSON_UNESCAPED_SLASHES ^ Flags::BUILD_STACK);
@@ -113,10 +144,217 @@ $container['leaflet.definition.builder'] = $container->share(function($container
return $boot->initializeLeafletBuilder($leaflet);
});
$container['leaflet.frontend.value-filter'] = $container->share(function($container) {
return new ValueFilter($container['toolkit.insert-tag-replacer']);
$container[LeafletServices::FRONTEND_VALUE_FILTER] = $container->share(function($container) {
return new ValueFilter($container[Services::INSERT_TAG_REPLACER]);
});
$container['leaflet.service-container'] = $container->share(function($container) {
return new ServiceContainer($container);
/**
* Internal used leaflet cache.
*
* @var Cache
*/
$container[LeafletServices::CACHE] = $container->share(
function ($container) {
if ($container[Services::PRODUCTION_MODE]) {
return new FilesystemCache(TL_ROOT . '/system/cache/leaflet');
} else {
return new ArrayCache();
}
}
);
/**
* Leaflet alias generator.
*
* @return \Netzmacht\Contao\Toolkit\Data\Alias\AliasGenerator
*/
$container[LeafletServices::ALIAS_GENERATOR] = $container->share(
function ($container) {
return function ($dataContainerName, $aliasField, $fields) use ($container) {
$filters = [
new ExistingAliasFilter(),
new SlugifyFilter($fields),
new DefaultAliasFilter($dataContainerName),
new SuffixFilter(),
];
$validator = new UniqueDatabaseValueValidator(
$container[Services::DATABASE_CONNECTION],
$dataContainerName,
$aliasField
);
return new FilterBasedAliasGenerator($filters, $validator, $dataContainerName, $aliasField, '_');
};
}
);
/**
* Leaflet alias generator.
*
* @return \Netzmacht\Contao\Toolkit\Data\Alias\AliasGenerator
*/
$container[LeafletServices::PARENT_ALIAS_GENERATOR] = $container->share(
function ($container) {
return function ($dataContainerName, $aliasField, $fields) use ($container) {
$filters = [
new ExistingAliasFilter(),
new SlugifyFilter($fields),
new DefaultAliasFilter($dataContainerName),
new SuffixFilter(),
];
$validator = new UniqueDatabaseValueValidator(
$container[Services::DATABASE_CONNECTION],
$dataContainerName,
$aliasField,
['pid']
);
return new FilterBasedAliasGenerator($filters, $validator, $dataContainerName, $aliasField, '_');
};
}
);
/**
* Callback helper class for tl_leaflet_map.
*
* @return MapCallbacks
*/
$container['leaflet.dca.map-callbacks'] = $container->share(
function ($container) {
return new MapCallbacks(
$container[Services::DCA_MANAGER],
$container[Services::DATABASE_CONNECTION]
);
}
);
/**
* Callback helper class for tl_leaflet_layer.
*
* @return LayerCallbacks
*/
$container['leaflet.dca.layer-callbacks'] = $container->share(
function ($container) {
return new LayerCallbacks(
$container[Services::DCA_MANAGER],
$container[Services::DATABASE_CONNECTION],
$container[Services::TRANSLATOR],
$GLOBALS['LEAFLET_LAYERS'],
$GLOBALS['LEAFLET_TILE_PROVIDERS']
);
}
);
/**
* Callback helper class for tl_leaflet_control.
*
* @return ControlCallbacks
*/
$container['leaflet.dca.control-callbacks'] = $container->share(
function ($container) {
return new ControlCallbacks(
$container[Services::DCA_MANAGER],
$container[Services::DATABASE_CONNECTION]
);
}
);
/**
* Callback helper class for tl_leaflet_control.
*
* @return ControlCallbacks
*/
$container['leaflet.dca.vector-callbacks'] = $container->share(
function ($container) {
return new VectorCallbacks($container[Services::DCA_MANAGER]);
}
);
/**
* Callback helper class for frontend integration.
*
* @return FrontendIntegration
*/
$container['leaflet.dca.frontend-integration'] = $container->share(
function ($container) {
return new FrontendIntegration(
$container[Services::TRANSLATOR]
);
}
);
/**
* Common callback helpers.
*
* @return LeafletCallbacks
*/
$container['leaflet.dca.common'] = $container->share(
function ($container) {
return new LeafletCallbacks(
$container[Services::FILE_SYSTEM]
);
}
);
/**
* Validator helper class.
*
* @return Validator
*/
$container['leaflet.dca.validator'] = $container->share(
function ($container) {
return new Validator(
$container[Services::TRANSLATOR]
);
}
);
/**
* Component factory for content element.
*
* @param ContentModel $model Content model.
* @param string $column Template section.
* @param ContainerInterface $container Container.
*
* @return MapElement
*/
$container[Services::CONTENT_ELEMENTS_MAP]['leaflet'] = function ($model, $column, ContainerInterface $container) {
return new MapElement(
$model,
$container->get(Services::TEMPLATE_FACTORY),
$container->get(Services::TRANSLATOR),
$container->get(LeafletServices::MAP_PROVIDER),
$container->get(Services::INPUT),
$container->get(Services::CONFIG),
$column
);
};
/**
* Component factory for frontend module.
*
* @param ModuleModel $model Module model.
* @param string $column Template section.
* @param ContainerInterface $container Container.
*
* @return MapModule
*/
$container[Services::MODULES_MAP]['leaflet'] = function ($model, $column, ContainerInterface $container) {
return new MapModule(
$model,
$container->get(Services::TEMPLATE_FACTORY),
$container->get(Services::TRANSLATOR),
$container->get(LeafletServices::MAP_PROVIDER),
$container->get(Services::INPUT),
$container->get(Services::CONFIG),
$column
);
};
$container['leaflet.subscriber.geo-json'] = $container->share(function () {
return new GeoJsonSubscriber(
$GLOBALS['LEAFLET_FEATURE_MODEL_PROPERTIES']
);
});

View File

@@ -22,9 +22,9 @@ $GLOBALS['TL_DCA']['tl_content']['fields']['leaflet_map'] = array(
'label' => &$GLOBALS['TL_LANG']['tl_content']['leaflet_map'],
'inputType' => 'select',
'exclude' => true,
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\FrontendIntegration', 'getMaps'),
'options_callback' => \Netzmacht\Contao\Leaflet\Dca\FrontendIntegration::callback('getMaps'),
'wizard' => array(
array('Netzmacht\Contao\Leaflet\Dca\FrontendIntegration', 'getEditMapLink'),
\Netzmacht\Contao\Leaflet\Dca\FrontendIntegration::callback('getEditMapLink'),
),
'eval' => array(
'tl_class' => 'w50 wizard',
@@ -70,7 +70,7 @@ $GLOBALS['TL_DCA']['tl_content']['fields']['leaflet_template'] = array(
'label' => &$GLOBALS['TL_LANG']['tl_content']['leaflet_template'],
'inputType' => 'select',
'exclude' => true,
'options_callback' => \Netzmacht\Contao\Toolkit\Dca::createGetTemplatesCallback('leaflet_map_js'),
'options_callback' => \Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::getTemplates('leaflet_map_js'),
'eval' => array(
'tl_class' => 'w50',
'chosen' => true,

View File

@@ -22,9 +22,11 @@ $GLOBALS['TL_DCA']['tl_leaflet_control'] = array
(
'id' => 'primary',
'pid' => 'index',
'alias' => 'unique',
)
)
),
'onsubmit_callback' => [
\Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks::callback('clearCache'),
],
),
// List
@@ -38,7 +40,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_control'] = array
'flag' => 1,
'sorting' => 2,
'panelLayout' => 'filter,sort;search,limit',
'child_record_callback' => array('Netzmacht\Contao\Leaflet\Dca\Control', 'generateRow'),
'child_record_callback' => \Netzmacht\Contao\Leaflet\Dca\ControlCallbacks::callback('generateRow'),
),
'label' => array
(
@@ -81,10 +83,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_control'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['toggle'],
'icon' => 'visible.gif',
'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"',
'button_callback' => \Netzmacht\Contao\Toolkit\Dca::createToggleIconCallback(
'tl_leaflet_control',
'active'
)
'button_callback' => \Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::stateButton('tl_leaflet_control', 'active')
),
'show' => array
(
@@ -166,10 +165,16 @@ $GLOBALS['TL_DCA']['tl_leaflet_control'] = array
'inputType' => 'text',
'search' => true,
'save_callback' => array(
\Netzmacht\Contao\Leaflet\Dca\Helper::createGenerateAliasCallback('tl_leaflet_control', 'title'),
\Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::aliasGenerator(
'tl_leaflet_control',
'alias',
['title'],
\Netzmacht\Contao\Leaflet\DependencyInjection\LeafletServices::PARENT_ALIAS_GENERATOR
),
\Netzmacht\Contao\Leaflet\Dca\Validator::callback('validateAlias'),
),
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true),
'sql' => "varchar(255) NOT NULL default ''"
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'nullIfEmpty' => true),
'sql' => "varchar(255) NULL"
),
'type' => array
(
@@ -209,7 +214,10 @@ $GLOBALS['TL_DCA']['tl_leaflet_control'] = array
'inputType' => 'checkbox',
'filter' => true,
'eval' => array('tl_class' => 'w50'),
'sql' => "char(1) NOT NULL default ''"
'sql' => "char(1) NOT NULL default ''",
'save_callback' => [
\Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks::callback('clearCache'),
],
),
'zoomInText' => array
(
@@ -267,10 +275,10 @@ $GLOBALS['TL_DCA']['tl_leaflet_control'] = array
'exclude' => true,
'inputType' => 'multiColumnWizard',
'load_callback' => array(
array('Netzmacht\Contao\Leaflet\Dca\Control', 'loadLayerRelations'),
\Netzmacht\Contao\Leaflet\Dca\ControlCallbacks::callback('loadLayerRelations'),
),
'save_callback' => array(
array('Netzmacht\Contao\Leaflet\Dca\Control', 'saveLayerRelations'),
\Netzmacht\Contao\Leaflet\Dca\ControlCallbacks::callback('saveLayerRelations'),
),
'eval' => array
(
@@ -282,7 +290,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_control'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['layer'],
'exclude' => true,
'inputType' => 'select',
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Layer', 'getLayers'),
'options_callback' => \Netzmacht\Contao\Leaflet\Dca\ControlCallbacks::callback('getLayers'),
'eval' => array(
'style' => 'width: 300px',
'chosen' => true,
@@ -369,7 +377,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_control'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_control']['zoomControl'],
'exclude' => true,
'inputType' => 'select',
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Control', 'getZoomControls'),
'options_callback' => \Netzmacht\Contao\Leaflet\Dca\ControlCallbacks::callback('getZoomControls'),
'reference' => &$GLOBALS['TL_LANG']['tl_leaflet_control'],
'eval' => array(
'mandatory' => false,

View File

@@ -21,7 +21,10 @@ $GLOBALS['TL_DCA']['tl_leaflet_icon'] = array
'id' => 'primary',
'alias' => 'unique',
)
)
),
'onsubmit_callback' => [
\Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks::callback('clearCache'),
],
),
'list' => array
@@ -96,7 +99,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_icon'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_icon']['toggle'],
'icon' => 'visible.gif',
'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"',
'button_callback' => \Netzmacht\Contao\Toolkit\Dca::createToggleIconCallback(
'button_callback' => \Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::stateButton(
'tl_leaflet_icon',
'active'
)
@@ -174,10 +177,16 @@ $GLOBALS['TL_DCA']['tl_leaflet_icon'] = array
'exclude' => true,
'inputType' => 'text',
'save_callback' => array(
\Netzmacht\Contao\Leaflet\Dca\Helper::createGenerateAliasCallback('tl_leaflet_icon', 'title'),
\Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::aliasGenerator(
'tl_leaflet_icon',
'alias',
['title'],
\Netzmacht\Contao\Leaflet\DependencyInjection\LeafletServices::ALIAS_GENERATOR
),
\Netzmacht\Contao\Leaflet\Dca\Validator::callback('validateAlias'),
),
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true),
'sql' => "varchar(255) NOT NULL default ''"
'sql' => "varchar(255) NULL"
),
'type' => array
(
@@ -201,7 +210,10 @@ $GLOBALS['TL_DCA']['tl_leaflet_icon'] = array
'exclude' => true,
'inputType' => 'checkbox',
'eval' => array('tl_class' => 'w50'),
'sql' => "char(1) NOT NULL default ''"
'sql' => "char(1) NOT NULL default ''",
'save_callback' => [
\Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks::callback('clearCache'),
],
),
'iconImage' => array
(
@@ -265,7 +277,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_icon'] = array
'exclude' => true,
'inputType' => 'text',
'save_callback' => array(
array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'validateCoordinate')
\Netzmacht\Contao\Leaflet\Dca\Validator::callback('validateCoordinates')
),
'eval' => array(
'maxlength' => 255,
@@ -280,7 +292,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_icon'] = array
'exclude' => true,
'inputType' => 'text',
'save_callback' => array(
array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'validateCoordinate')
\Netzmacht\Contao\Leaflet\Dca\Validator::callback('validateCoordinates')
),
'eval' => array(
'maxlength' => 255,
@@ -295,7 +307,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_icon'] = array
'exclude' => true,
'inputType' => 'text',
'save_callback' => array(
array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'validateCoordinate')
\Netzmacht\Contao\Leaflet\Dca\Validator::callback('validateCoordinates')
),
'eval' => array(
'maxlength' => 255,

View File

@@ -16,7 +16,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
'enableVersioning' => true,
'ctable' => array('tl_leaflet_vector', 'tl_leaflet_marker'),
'ondelete_callback' => array(
array('Netzmacht\Contao\Leaflet\Dca\Layer', 'deleteRelations'),
\Netzmacht\Contao\Leaflet\Dca\LayerCallbacks::callback('deleteRelations'),
),
'sql' => array
(
@@ -31,7 +31,10 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
function() {
\Controller::loadLanguageFile('leaflet');
}
)
),
'onsubmit_callback' => [
\Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks::callback('clearCache'),
],
),
'list' => array
(
@@ -42,13 +45,13 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
'flag' => 1,
'icon' => 'system/modules/leaflet/assets/img/layers.png',
'panelLayout' => 'filter;search,limit',
'paste_button_callback' => array('Netzmacht\Contao\Leaflet\Dca\Layer', 'getPasteButtons'),
'paste_button_callback' => \Netzmacht\Contao\Leaflet\Dca\LayerCallbacks::callback('getPasteButtons'),
),
'label' => array
(
'fields' => array('title'),
'format' => '%s',
'label_callback' => array('Netzmacht\Contao\Leaflet\Dca\Layer', 'generateRow')
'label_callback' => \Netzmacht\Contao\Leaflet\Dca\LayerCallbacks::callback('generateRow')
),
'global_operations' => array
(
@@ -88,14 +91,14 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['markers'],
'href' => 'table=tl_leaflet_marker',
'icon' => 'edit.gif',
'button_callback' => array('Netzmacht\Contao\Leaflet\Dca\Layer', 'generateMarkersButton'),
'button_callback' => \Netzmacht\Contao\Leaflet\Dca\LayerCallbacks::callback('generateMarkersButton')
),
'vectors' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['vectors'],
'href' => 'table=tl_leaflet_vector',
'icon' => 'edit.gif',
'button_callback' => array('Netzmacht\Contao\Leaflet\Dca\Layer', 'generateVectorsButton'),
'button_callback' => \Netzmacht\Contao\Leaflet\Dca\LayerCallbacks::callback('generateVectorsButton'),
),
'edit' => array
(
@@ -128,10 +131,10 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['toggle'],
'icon' => 'visible.gif',
'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"',
'button_callback' => \Netzmacht\Contao\Toolkit\Dca::createToggleIconCallback(
'button_callback' => \Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::stateButton(
'tl_leaflet_layer',
'active'
)
),
),
'show' => array
(
@@ -150,7 +153,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
'default' => array(
'title' => array('title', 'alias', 'type'),
'config' => array(),
'expert' => array(':hide'),
'expert' => array(':hide', 'cache'),
'active' => array('active'),
),
'markers extends default' => array(
@@ -224,7 +227,8 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
),
'metasubpalettes' => array(
'spiderfyOnMaxZoom' => array('spiderfyDistanceMultiplier')
'spiderfyOnMaxZoom' => array('spiderfyDistanceMultiplier'),
'cache' => array('cacheLifeTime')
),
'fields' => array
@@ -261,10 +265,16 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
'inputType' => 'text',
'search' => true,
'save_callback' => array(
\Netzmacht\Contao\Leaflet\Dca\Helper::createGenerateAliasCallback('tl_leaflet_layer', 'title'),
\Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::aliasGenerator(
'tl_leaflet_layer',
'alias',
['title'],
\Netzmacht\Contao\Leaflet\DependencyInjection\LeafletServices::ALIAS_GENERATOR
),
\Netzmacht\Contao\Leaflet\Dca\Validator::callback('validateAlias'),
),
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true),
'sql' => "varchar(255) NOT NULL default ''"
'sql' => "varchar(255) NULL"
),
'type' => array
(
@@ -291,7 +301,10 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
'inputType' => 'checkbox',
'filter' => true,
'eval' => array('tl_class' => 'w50'),
'sql' => "char(1) NOT NULL default ''"
'sql' => "char(1) NOT NULL default ''",
'save_callback' => [
\Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks::callback('clearCache'),
],
),
'tile_provider' => array(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['tile_provider'],
@@ -317,7 +330,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
'submitOnChange' => true,
'chosen' => false,
),
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Layer', 'getVariants'),
'options_callback' => \Netzmacht\Contao\Leaflet\Dca\LayerCallbacks::callback('getVariants'),
'sql' => "varchar(32) NOT NULL default ''"
),
'tile_provider_key' => array
@@ -366,7 +379,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['reference'],
'exclude' => true,
'inputType' => 'select',
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Layer', 'getLayers'),
'options_callback' => \Netzmacht\Contao\Leaflet\Dca\LayerCallbacks::callback('getLayers'),
'eval' => array(
'mandatory' => true,
'tl_class' => 'w50',
@@ -462,7 +475,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['disableClusteringAtZoom'],
'exclude' => true,
'inputType' => 'select',
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'getZoomLevels'),
'options_callback' => Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks::callback('getZoomLevels'),
'default' => '',
'eval' => array(
'maxlength' => 4,
@@ -542,7 +555,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['boundsMode'],
'exclude' => true,
'inputType' => 'select',
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Layer', 'getBoundsModes'),
'options_callback' => \Netzmacht\Contao\Leaflet\Dca\LayerCallbacks::callback('getBoundsModes'),
'eval' => array('tl_class' => 'w50', 'includeBlankOption' => true),
'sql' => "varchar(6) NOT NULL default ''"
),
@@ -560,7 +573,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['minZoom'],
'exclude' => true,
'inputType' => 'select',
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'getZoomLevels'),
'options_callback' => Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks::callback('getZoomLevels'),
'eval' => array(
'maxlength' => 4,
'rgxp' => 'digit',
@@ -575,7 +588,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['maxZoom'],
'exclude' => true,
'inputType' => 'select',
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'getZoomLevels'),
'options_callback' => Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks::callback('getZoomLevels'),
'eval' => array(
'maxlength' => 4,
'rgxp' => 'digit',
@@ -590,7 +603,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['maxNativeZoom'],
'exclude' => true,
'inputType' => 'select',
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'getZoomLevels'),
'options_callback' => Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks::callback('getZoomLevels'),
'eval' => array(
'maxlength' => 4,
'rgxp' => 'digit',
@@ -751,5 +764,23 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
),
'sql' => "mediumblob NULL"
),
'cache' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['cache'],
'exclude' => true,
'inputType' => 'checkbox',
'default' => false,
'eval' => array('tl_class' => 'w50 m12', 'submitOnChange' => true),
'sql' => "char(1) NOT NULL default ''"
),
'cacheLifeTime' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['cacheLifeTime'],
'exclude' => true,
'inputType' => 'text',
'default' => null,
'eval' => array('maxlength' => 5, 'rgxp' => 'digit', 'tl_class' => 'w50', 'nullIfEmpty' => true),
'sql' => "int(9) NOT NULL default '0'"
),
)
);

View File

@@ -27,7 +27,10 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = array
function() {
\Controller::loadLanguageFile('leaflet');
}
)
),
'onsubmit_callback' => [
\Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks::callback('clearCache'),
],
),
'list' => array
@@ -114,6 +117,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = array
),
'expert' => array(
'options',
'cache',
)
),
),
@@ -135,6 +139,9 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = array
'locateMaximumAge',
'enableHighAccuracy'
),
'cache' => array(
'cacheLifeTime'
)
),
'fields' => array
@@ -163,10 +170,16 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = array
'inputType' => 'text',
'search' => true,
'save_callback' => array(
\Netzmacht\Contao\Leaflet\Dca\Helper::createGenerateAliasCallback('tl_leaflet_map', 'title'),
\Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::aliasGenerator(
'tl_leaflet_map',
'alias',
['title'],
\Netzmacht\Contao\Leaflet\DependencyInjection\LeafletServices::ALIAS_GENERATOR
),
\Netzmacht\Contao\Leaflet\Dca\Validator::callback('validateAlias')
),
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true),
'sql' => "varchar(255) NOT NULL default ''"
'sql' => "varchar(255) NULL"
),
'center' => array
(
@@ -174,10 +187,10 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = array
'exclude' => true,
'inputType' => 'text',
'save_callback' => array(
array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'validateCoordinate')
\Netzmacht\Contao\Leaflet\Dca\Validator::callback('validateCoordinates'),
),
'wizard' => array(
array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'getGeocoder')
Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks::callback('getGeocoder')
),
'eval' => array(
'maxlength' => 255,
@@ -192,10 +205,10 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = array
'exclude' => true,
'inputType' => 'multiColumnWizard',
'load_callback' => array(
array('Netzmacht\Contao\Leaflet\Dca\Map', 'loadLayerRelations'),
\Netzmacht\Contao\Leaflet\Dca\MapCallbacks::callback('loadLayerRelations'),
),
'save_callback' => array(
array('Netzmacht\Contao\Leaflet\Dca\Map', 'saveLayerRelations'),
\Netzmacht\Contao\Leaflet\Dca\MapCallbacks::callback('saveLayerRelations'),
),
'eval' => array(
'multiple' => true,
@@ -206,7 +219,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_map']['reference'],
'exclude' => true,
'inputType' => 'select',
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Layer', 'getLayers'),
'options_callback' => \Netzmacht\Contao\Leaflet\Dca\MapCallbacks::callback('getLayers'),
'eval' => array(
'mandatory' => true,
'tl_class' => 'w50',
@@ -226,7 +239,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_map']['zoom'],
'exclude' => true,
'inputType' => 'select',
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'getZoomLevels'),
'options_callback' => Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks::callback('getZoomLevels'),
'default' => '',
'eval' => array(
'maxlength' => 4,
@@ -251,7 +264,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_map']['minZoom'],
'exclude' => true,
'inputType' => 'select',
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'getZoomLevels'),
'options_callback' => Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks::callback('getZoomLevels'),
'eval' => array(
'maxlength' => 4,
'rgxp' => 'digit',
@@ -266,7 +279,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_map']['maxZoom'],
'exclude' => true,
'inputType' => 'select',
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'getZoomLevels'),
'options_callback' => Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks::callback('getZoomLevels'),
'eval' => array(
'maxlength' => 4,
'rgxp' => 'digit',
@@ -497,7 +510,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_map']['locateMaxZoom'],
'exclude' => true,
'inputType' => 'select',
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'getZoomLevels'),
'options_callback' => Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks::callback('getZoomLevels'),
'eval' => array(
'maxlength' => 4,
'rgxp' => 'digit',
@@ -507,5 +520,23 @@ $GLOBALS['TL_DCA']['tl_leaflet_map'] = array
),
'sql' => "int(4) NULL"
),
'cache' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_map']['cache'],
'exclude' => true,
'inputType' => 'checkbox',
'default' => false,
'eval' => array('tl_class' => 'w50 m12', 'submitOnChange' => true),
'sql' => "char(1) NOT NULL default ''"
),
'cacheLifeTime' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_map']['cacheLifeTime'],
'exclude' => true,
'inputType' => 'text',
'default' => null,
'eval' => array('maxlength' => 5, 'rgxp' => 'digit', 'tl_class' => 'w50', 'nullIfEmpty' => true),
'sql' => "int(9) NOT NULL default '0'"
),
),
);

View File

@@ -28,7 +28,10 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = array
function() {
\Controller::loadLanguageFile('leaflet');
}
)
),
'onsubmit_callback' => [
\Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks::callback('clearCache'),
],
),
'list' => array
@@ -40,7 +43,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = array
'flag' => 1,
'panelLayout' => 'sort,filter;search,limit',
'headerFields' => array('title', 'type'),
'child_record_callback' => array('Netzmacht\Contao\Leaflet\Dca\Marker', 'generateRow'),
'child_record_callback' => array('Netzmacht\Contao\Leaflet\Dca\MarkerCallbacks', 'generateRow'),
),
'label' => array
(
@@ -97,7 +100,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_marker']['toggle'],
'icon' => 'visible.gif',
'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"',
'button_callback' => \Netzmacht\Contao\Toolkit\Dca::createToggleIconCallback(
'button_callback' => \Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::stateButton(
'tl_leaflet_marker',
'active'
)
@@ -172,10 +175,16 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = array
'inputType' => 'text',
'search' => true,
'save_callback' => array(
\Netzmacht\Contao\Leaflet\Dca\Helper::createGenerateAliasCallback('tl_leaflet_marker', 'title'),
\Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::aliasGenerator(
'tl_leaflet_marker',
'alias',
['title'],
\Netzmacht\Contao\Leaflet\DependencyInjection\LeafletServices::ALIAS_GENERATOR
),
\Netzmacht\Contao\Leaflet\Dca\Validator::callback('validateAlias'),
),
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true),
'sql' => "varchar(255) NOT NULL default ''"
'sql' => "varchar(255) NULL"
),
'coordinates' => array
(
@@ -183,14 +192,14 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = array
'exclude' => true,
'inputType' => 'text',
'save_callback' => array(
array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'validateCoordinate'),
array('Netzmacht\Contao\Leaflet\Dca\Marker', 'saveCoordinates')
\Netzmacht\Contao\Leaflet\Dca\Validator::callback('validateCoordinates'),
array('Netzmacht\Contao\Leaflet\Dca\MarkerCallbacks', 'saveCoordinates')
),
'load_callback' => array(
array('Netzmacht\Contao\Leaflet\Dca\Marker', 'loadCoordinates')
array('Netzmacht\Contao\Leaflet\Dca\MarkerCallbacks', 'loadCoordinates')
),
'wizard' => array(
array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'getGeocoder')
Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks::callback('getGeocoder')
),
'eval' => array(
'maxlength' => 255,
@@ -232,7 +241,10 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = array
'flag' => 12,
'inputType' => 'checkbox',
'eval' => array('tl_class' => 'w50'),
'sql' => "char(1) NOT NULL default ''"
'sql' => "char(1) NOT NULL default ''",
'save_callback' => [
\Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks::callback('clearCache'),
],
),
'tooltip' => array
(
@@ -264,7 +276,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_marker']['popup'],
'exclude' => true,
'inputType' => 'select',
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Marker', 'getPopups'),
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\MarkerCallbacks', 'getPopups'),
'eval' => array(
'mandatory' => false,
'tl_class' => 'w50',
@@ -295,7 +307,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_marker'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_marker']['icon'],
'exclude' => true,
'inputType' => 'select',
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Marker', 'getIcons'),
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\MarkerCallbacks', 'getIcons'),
'eval' => array(
'mandatory' => true,
'tl_class' => 'w50',

View File

@@ -21,7 +21,10 @@ $GLOBALS['TL_DCA']['tl_leaflet_popup'] = array
'id' => 'primary',
'alias' => 'unique',
)
)
),
'onsubmit_callback' => [
\Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks::callback('clearCache'),
],
),
'list' => array
@@ -96,7 +99,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_popup'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_popup']['toggle'],
'icon' => 'visible.gif',
'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"',
'button_callback' => \Netzmacht\Contao\Toolkit\Dca::createToggleIconCallback(
'button_callback' => \Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::stateButton(
'tl_leaflet_popup',
'active'
)
@@ -160,10 +163,16 @@ $GLOBALS['TL_DCA']['tl_leaflet_popup'] = array
'exclude' => true,
'inputType' => 'text',
'save_callback' => array(
\Netzmacht\Contao\Leaflet\Dca\Helper::createGenerateAliasCallback('tl_leaflet_popup', 'title'),
\Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::aliasGenerator(
'tl_leaflet_popup',
'alias',
['title'],
\Netzmacht\Contao\Leaflet\DependencyInjection\LeafletServices::ALIAS_GENERATOR
),
\Netzmacht\Contao\Leaflet\Dca\Validator::callback('validateAlias'),
),
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true),
'sql' => "varchar(255) NOT NULL default ''"
'sql' => "varchar(255) NULL"
),
'maxWidth' => array
(
@@ -225,7 +234,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_popup'] = array
'exclude' => true,
'inputType' => 'text',
'save_callback' => array(
array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'validateCoordinate')
\Netzmacht\Contao\Leaflet\Dca\Validator::callback('validateCoordinates')
),
'eval' => array(
'maxlength' => 255,
@@ -284,7 +293,10 @@ $GLOBALS['TL_DCA']['tl_leaflet_popup'] = array
'search' => false,
'flag' => 12,
'eval' => array('tl_class' => 'w50'),
'sql' => "char(1) NOT NULL default ''"
'sql' => "char(1) NOT NULL default ''",
'save_callback' => [
\Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks::callback('clearCache'),
],
),
),
);

View File

@@ -20,7 +20,10 @@ $GLOBALS['TL_DCA']['tl_leaflet_style'] = array
'id' => 'primary',
'alias' => 'unique',
)
)
),
'onsubmit_callback' => [
\Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks::callback('clearCache'),
],
),
'list' => array
@@ -95,7 +98,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_style'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_style']['toggle'],
'icon' => 'visible.gif',
'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"',
'button_callback' => \Netzmacht\Contao\Toolkit\Dca::createToggleIconCallback(
'button_callback' => \Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::stateButton(
'tl_leaflet_style',
'active'
)
@@ -153,10 +156,16 @@ $GLOBALS['TL_DCA']['tl_leaflet_style'] = array
'exclude' => true,
'inputType' => 'text',
'save_callback' => array(
\Netzmacht\Contao\Leaflet\Dca\Helper::createGenerateAliasCallback('tl_leaflet_style', 'title'),
\Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::aliasGenerator(
'tl_leaflet_style',
'alias',
['title'],
\Netzmacht\Contao\Leaflet\DependencyInjection\LeafletServices::ALIAS_GENERATOR
),
\Netzmacht\Contao\Leaflet\Dca\Validator::callback('validateAlias'),
),
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true),
'sql' => "varchar(255) NOT NULL default ''"
'sql' => "varchar(255) NULL"
),
'type' => array
(
@@ -189,7 +198,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_style'] = array
'exclude' => true,
'inputType' => 'text',
'wizard' => array(
\Netzmacht\Contao\Toolkit\Dca::createColorPickerCallback(),
\Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::colorPicker()
),
'eval' => array(
'tl_class' => 'w50 wizard clr',
@@ -230,7 +239,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_style'] = array
'exclude' => true,
'inputType' => 'text',
'wizard' => array(
\Netzmacht\Contao\Toolkit\Dca::createColorPickerCallback(),
\Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::colorPicker()
),
'eval' => array(
'tl_class' => 'clr w50 wizard',
@@ -286,7 +295,10 @@ $GLOBALS['TL_DCA']['tl_leaflet_style'] = array
'search' => false,
'flag' => 12,
'eval' => array('tl_class' => 'w50'),
'sql' => "char(1) NOT NULL default ''"
'sql' => "char(1) NOT NULL default ''",
'save_callback' => [
\Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks::callback('clearCache'),
],
),
),
);

View File

@@ -28,7 +28,10 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = array
function() {
\Controller::loadLanguageFile('leaflet');
}
)
),
'onsubmit_callback' => [
\Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks::callback('clearCache'),
],
),
'list' => array
@@ -40,7 +43,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = array
'flag' => 1,
'panelLayout' => 'sort,filter;search,limit',
'headerFields' => array('title', 'type'),
'child_record_callback' => array('Netzmacht\Contao\Leaflet\Dca\Vector', 'generateRow'),
'child_record_callback' => Netzmacht\Contao\Leaflet\Dca\VectorCallbacks::callback('generateRow'),
),
'label' => array
(
@@ -104,7 +107,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_vector']['toggle'],
'icon' => 'visible.gif',
'attributes' => 'onclick="Backend.getScrollOffset();return AjaxRequest.toggleVisibility(this,%s)"',
'button_callback' => \Netzmacht\Contao\Toolkit\Dca::createToggleIconCallback(
'button_callback' => \Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::stateButton(
'tl_leaflet_vector',
'active'
)
@@ -198,10 +201,16 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = array
'inputType' => 'text',
'search' => true,
'save_callback' => array(
\Netzmacht\Contao\Leaflet\Dca\Helper::createGenerateAliasCallback('tl_leaflet_vector', 'title'),
\Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::aliasGenerator(
'tl_leaflet_vector',
'alias',
['title'],
\Netzmacht\Contao\Leaflet\DependencyInjection\LeafletServices::ALIAS_GENERATOR
),
\Netzmacht\Contao\Leaflet\Dca\Validator::callback('validateAlias'),
),
'eval' => array('mandatory' => false, 'maxlength' => 255, 'tl_class' => 'w50', 'unique' => true),
'sql' => "varchar(255) NOT NULL default ''"
'sql' => "varchar(255) NULL"
),
'type' => array
(
@@ -234,7 +243,10 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = array
'search' => false,
'flag' => 12,
'eval' => array('tl_class' => 'w50'),
'sql' => "char(1) NOT NULL default ''"
'sql' => "char(1) NOT NULL default ''",
'save_callback' => [
\Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks::callback('clearCache'),
],
),
'addPopup' => array
(
@@ -250,7 +262,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_vector']['popup'],
'exclude' => true,
'inputType' => 'select',
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Marker', 'getPopups'),
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\MarkerCallbacks', 'getPopups'),
'eval' => array(
'mandatory' => false,
'tl_class' => 'w50',
@@ -273,7 +285,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_vector']['style'],
'exclude' => true,
'inputType' => 'select',
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Vector', 'getStyles'),
'options_callback' => Netzmacht\Contao\Leaflet\Dca\VectorCallbacks::callback('getStyles'),
'eval' => array(
'mandatory' => false,
'tl_class' => 'w50',
@@ -305,15 +317,16 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = array
'exclude' => true,
'inputType' => 'text',
'save_callback' => array(
array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'validateCoordinate')
\Netzmacht\Contao\Leaflet\Dca\Validator::callback('validateCoordinates')
),
'wizard' => array(
array('Netzmacht\Contao\Leaflet\Dca\Leaflet', 'getGeocoder')
Netzmacht\Contao\Leaflet\Dca\LeafletCallbacks::callback('getGeocoder')
),
'eval' => array(
'maxlength' => 255,
'tl_class' => 'long clr',
'nullIfEmpty' => true,
'mandatory' => true,
),
'sql' => "varchar(255) NULL"
),
@@ -332,6 +345,9 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = array
'inputType' => 'textarea',
'search' => false,
'eval' => array('mandatory' => true, 'alwaysSave' => true),
'save_callback' => array(
\Netzmacht\Contao\Leaflet\Dca\Validator::callback('validateMultipleCoordinates')
),
'sql' => "longblob NULL"
),
'multiData' => array
@@ -354,6 +370,9 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = array
)
)
),
'save_callback' => array(
\Netzmacht\Contao\Leaflet\Dca\Validator::callback('validateMultipleCoordinateSets')
),
'sql' => "longblob NULL"
),
'bounds' => array
@@ -361,8 +380,7 @@ $GLOBALS['TL_DCA']['tl_leaflet_vector'] = array
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_vector']['bounds'],
'exclude' => true,
'inputType' => 'text',
'save_callback' => array(
),
'save_callback' => array(),
'eval' => array(
'maxlength' => 255,
'multiple'=>true,

View File

@@ -22,9 +22,9 @@ $GLOBALS['TL_DCA']['tl_module']['fields']['leaflet_map'] = array(
'label' => &$GLOBALS['TL_LANG']['tl_module']['leaflet_map'],
'inputType' => 'select',
'exclude' => true,
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\FrontendIntegration', 'getMaps'),
'options_callback' => \Netzmacht\Contao\Leaflet\Dca\FrontendIntegration::callback('getMaps'),
'wizard' => array(
array('Netzmacht\Contao\Leaflet\Dca\FrontendIntegration', 'getEditMapLink'),
\Netzmacht\Contao\Leaflet\Dca\FrontendIntegration::callback('getEditMapLink'),
),
'eval' => array(
'tl_class' => 'w50 wizard',
@@ -70,7 +70,7 @@ $GLOBALS['TL_DCA']['tl_module']['fields']['leaflet_template'] = array(
'label' => &$GLOBALS['TL_LANG']['tl_module']['leaflet_template'],
'inputType' => 'select',
'exclude' => true,
'options_callback' => \Netzmacht\Contao\Toolkit\Dca::createGetTemplatesCallback('leaflet_map_js'),
'options_callback' => \Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory::getTemplates('leaflet_map_js'),
'eval' => array(
'tl_class' => 'w50',
'chosen' => true,

View File

@@ -8,10 +8,9 @@
*
* @license http://www.gnu.org/licenses/lgpl-3.0.html LGPL
*
* last-updated: 2015-02-11T08:57:52+01:00
* last-updated: 2016-10-04T13:07:35+02:00
*/
$GLOBALS['TL_LANG']['leaflet']['applyPosition'] = 'Position anwenden';
$GLOBALS['TL_LANG']['leaflet_control']['attribution']['0'] = 'Copyright-Leiste';
$GLOBALS['TL_LANG']['leaflet_control']['fullscreen']['0'] = 'Fullscreen-Kontrollelement';
@@ -21,15 +20,21 @@ $GLOBALS['TL_LANG']['leaflet_control']['layers']['1'] = 'Das Layer-Kontrol
$GLOBALS['TL_LANG']['leaflet_control']['loading']['0'] = 'Lade-Indikator';
$GLOBALS['TL_LANG']['leaflet_control']['loading']['1'] = 'Leaflet.loading ist ein einfacher Ladeindikator als Kontrollelement. Für weitere Details lesen Sie den Artikel in der <a href="https://github.com/ebrelsford/Leaflet.loading" target="_blank">Plugin-Dokumentation</a>.';
$GLOBALS['TL_LANG']['leaflet_control']['scale']['0'] = 'Maßstabs-Kontrollelement';
$GLOBALS['TL_LANG']['leaflet_control']['scale']['1'] = 'Einfaches Maßstabs-Kontrollelement, das den aktuellen Maßstab der Kartenmitte anzeigt. Lesen Sie für mehr Details die <a href="http://leafletjs.com/reference.html#control-scale" target="_blank">Leaflet-Dokumentation</a>.';
$GLOBALS['TL_LANG']['leaflet_control']['zoom']['0'] = 'Zoom-Kontrollelement';
$GLOBALS['TL_LANG']['leaflet_control']['zoom']['1'] = 'Diese Komponente ermöglicht eine Kontrolle des Zoomverhaltens. Für weitere Details lesen Sie die <a href="http://leafletjs.com/reference.html#control-zoom" target="_blank">Leaflet-Documentation</a>.';
$GLOBALS['TL_LANG']['leaflet_layer']['group']['0'] = 'Layer-Gruppe';
$GLOBALS['TL_LANG']['leaflet_layer']['group']['1'] = 'Layergruppen, die aus mehreren unterschiedlichen Layern zusammengesetzt sind. Lesen Sie für die Details die <a href="http://leafletjs.com/reference.html#layergroup" target="_blank">Leaflet-Dokumentation</a>. ';
$GLOBALS['TL_LANG']['leaflet_layer']['markercluster']['0'] = 'Marker-Cluster';
$GLOBALS['TL_LANG']['leaflet_layer']['markercluster']['1'] = 'Markercluster-Layer, der auf einem based on <a href="https://github.com/Leaflet/Leaflet.markercluster" target="_blank">Leaflet.markercluster</a.';
$GLOBALS['TL_LANG']['leaflet_layer']['markers']['0'] = 'Marker';
$GLOBALS['TL_LANG']['leaflet_layer']['markers']['1'] = 'Geben Sie den Layer an der die Marker enthält.';
$GLOBALS['TL_LANG']['leaflet_layer']['provider']['0'] = 'Vorkonfigurierte Karte';
$GLOBALS['TL_LANG']['leaflet_layer']['provider']['1'] = 'Leaflet-Kachelanbieter. Lesen Sie für weitere Details die <a href="https://github.com/leaflet-extras/leaflet-providers" target="_blank">Plugin-Dokumentation</a>.';
$GLOBALS['TL_LANG']['leaflet_layer']['reference']['0'] = 'Referenz';
$GLOBALS['TL_LANG']['leaflet_layer']['reference']['1'] = 'Ein Referenzlayer ist ein Link zu einem anderen Layer.';
$GLOBALS['TL_LANG']['leaflet_layer']['tile']['0'] = 'Kachel-Layer';
$GLOBALS['TL_LANG']['leaflet_layer']['tile']['1'] = 'Kachel-Layer mit vollständigen Konfigurationsoptionen.';
$GLOBALS['TL_LANG']['leaflet_layer']['vectors']['0'] = 'Vektoren';
$GLOBALS['TL_LANG']['leaflet_layer']['vectors']['1'] = 'Vektorlayer beinhalten Vektoren wie Polygone, Polylines, etc.';
$GLOBALS['TL_LANG']['leaflet_vector']['circle']['0'] = 'Kreis';

View File

@@ -8,15 +8,16 @@
*
* @license http://www.gnu.org/licenses/lgpl-3.0.html LGPL
*
* last-updated: 2015-02-11T08:57:54+01:00
* last-updated: 2016-10-04T13:07:35+02:00
*/
$GLOBALS['TL_LANG']['tl_leaflet_control']['active']['0'] = 'Kontrollelement aktivieren';
$GLOBALS['TL_LANG']['tl_leaflet_control']['active']['1'] = 'Kontrollelement auf der Karte aktivieren.';
$GLOBALS['TL_LANG']['tl_leaflet_control']['active_legend'] = 'Aktivierung';
$GLOBALS['TL_LANG']['tl_leaflet_control']['alias']['0'] = 'Alias';
$GLOBALS['TL_LANG']['tl_leaflet_control']['alias']['1'] = 'Alias des Kontrollelementes.';
$GLOBALS['TL_LANG']['tl_leaflet_control']['attributions']['0'] = 'Namensnennung';
$GLOBALS['TL_LANG']['tl_leaflet_control']['attributions']['1'] = 'Hier können Sie Texte zur Namensnennung hinzufügen. In diesem Feld ist HTML erlaubt.';
$GLOBALS['TL_LANG']['tl_leaflet_control']['autoZIndex']['0'] = 'Automatischer Z-Index';
$GLOBALS['TL_LANG']['tl_leaflet_control']['autoZIndex']['1'] = 'Falls aktiviert wird das Kontrollelement zu allen Layern in aufsteigender Reihenfolge einen z-index hinzufügen, damit die Reihenfolge auch beim an- und abschalten von Layern erhalten bleibt.';
$GLOBALS['TL_LANG']['tl_leaflet_control']['base']['0'] = 'Basislayer';
@@ -58,6 +59,8 @@ $GLOBALS['TL_LANG']['tl_leaflet_control']['pastenew']['0'] = 'Kontroll
$GLOBALS['TL_LANG']['tl_leaflet_control']['pastenew']['1'] = 'Neue Kopie des Kontrollelements ID %s erzeugen';
$GLOBALS['TL_LANG']['tl_leaflet_control']['position']['0'] = 'Position';
$GLOBALS['TL_LANG']['tl_leaflet_control']['position']['1'] = 'Position des Kontrollelementes.';
$GLOBALS['TL_LANG']['tl_leaflet_control']['prefix']['0'] = 'Namensnennungs-Prefix';
$GLOBALS['TL_LANG']['tl_leaflet_control']['prefix']['1'] = 'Passen Sie den Prefix für die Namensnennung an. In der Voreinstellung wird der Leaflet-Link benutzt. HTML ist erlaubt.';
$GLOBALS['TL_LANG']['tl_leaflet_control']['separate']['0'] = 'Separat';
$GLOBALS['TL_LANG']['tl_leaflet_control']['separate']['1'] = 'Kontrollelemente getrennt von der Zoomkontrolle anzeigen.';
$GLOBALS['TL_LANG']['tl_leaflet_control']['show']['0'] = 'Details anzeigen';
@@ -81,8 +84,13 @@ $GLOBALS['TL_LANG']['tl_leaflet_control']['type']['1'] = 'Wählen
$GLOBALS['TL_LANG']['tl_leaflet_control']['updateWhenIdle']['0'] = 'Bei ';
$GLOBALS['TL_LANG']['tl_leaflet_control']['updateWhenIdle']['1'] = 'Falls aktiviert wird das Kontrollelement erst nach Abschluss einer Bewegung der Karte neu gezeichnet. Andernfalls wird es bereits während der Bewegung aktualisiert.';
$GLOBALS['TL_LANG']['tl_leaflet_control']['zoomControl']['0'] = 'Zoom-Kontrollelement';
$GLOBALS['TL_LANG']['tl_leaflet_control']['zoomControl']['1'] = 'Weisen Sie das Lade-Kontrollelement einem bestimmten Zoom-Kontrollelement zu. Falls dieses nicht benutzt wird oder deaktiviert ist wird das Standard-Kontrollelement verwendet.';
$GLOBALS['TL_LANG']['tl_leaflet_control']['zoomInText']['0'] = 'ZoomIn-Text';
$GLOBALS['TL_LANG']['tl_leaflet_control']['zoomInText']['1'] = 'Dieser Text wird im ZoomIn-Button ausgegegeben. Der voreingestellte Wert ist "+". Wenn Sie den voreingestellten Wert verwenden möchten lassen Sie das Feld leer.';
$GLOBALS['TL_LANG']['tl_leaflet_control']['zoomInTitle']['0'] = 'ZoomIn-Titel';
$GLOBALS['TL_LANG']['tl_leaflet_control']['zoomInTitle']['1'] = 'Geben Sie den Titel des Buttons zum Hineinzoomen an.';
$GLOBALS['TL_LANG']['tl_leaflet_control']['zoomOutText']['0'] = 'ZoomOut-Text';
$GLOBALS['TL_LANG']['tl_leaflet_control']['zoomOutText']['1'] = 'Dieser Text wird im ZoomOut-Button ausgegegeben. Der voreingestellte Wert ist "-". Wenn Sie den voreingestellten Wert verwenden möchten lassen Sie das Feld leer.';
$GLOBALS['TL_LANG']['tl_leaflet_control']['zoomOutTitle']['0'] = 'ZoomOut-Titel';
$GLOBALS['TL_LANG']['tl_leaflet_control']['zoomOutTitle']['1'] = 'Geben Sie den Titel des Buttons zum Herauszoomen an.';

View File

@@ -8,10 +8,9 @@
*
* @license http://www.gnu.org/licenses/lgpl-3.0.html LGPL
*
* last-updated: 2015-02-11T08:57:55+01:00
* last-updated: 2016-10-04T13:07:35+02:00
*/
$GLOBALS['TL_LANG']['tl_leaflet_layer']['active']['0'] = 'Layer aktivieren';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['active']['1'] = 'Layer auf der Karte aktivieren';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['active_legend'] = 'Aktivierung';
@@ -78,12 +77,16 @@ $GLOBALS['TL_LANG']['tl_leaflet_layer']['removeOutsideVisibleBounds']['0'] = 'En
$GLOBALS['TL_LANG']['tl_leaflet_layer']['reuseTiles']['0'] = 'Kacheln wiederverwenden';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['show']['0'] = 'Details anzeigen';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['show']['1'] = 'Details des Layers ID %s anzeigen';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['showCoverageOnHover']['0'] = 'Abdeckung bei hover zeigen';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['singleMarkerMode']['0'] = 'Cluster anstelle von Markern anzeigen';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['standalone']['0'] = 'Eigenständiges Layer';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['standalone']['1'] = 'Kopie anstelle eines Links des Layers erstellen.';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['styles']['0'] = 'Stile verwalten';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['styles']['1'] = 'Vektorstile verwalten';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['subdomains']['0'] = 'Subdomain';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['tileSize']['0'] = 'Kachelgröße';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['tileSize']['1'] = 'Kachelgröße (Breite und Höhe in Pixeln, auf quadratische Kacheln bezogen).';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['tile_provider']['0'] = 'Kachelanbieter';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['tile_provider']['1'] = 'Wählen Sie den Typ des Layers aus.';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['tile_provider_variant']['0'] = 'Kachelvariante';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['tile_provider_variant']['1'] = 'Kachelvarianten-Stil';

View File

@@ -8,16 +8,19 @@
*
* @license http://www.gnu.org/licenses/lgpl-3.0.html LGPL
*
* last-updated: 2015-02-11T08:57:56+01:00
* last-updated: 2016-10-04T13:07:35+02:00
*/
$GLOBALS['TL_LANG']['tl_leaflet_map']['adjustBounds']['0'] = 'Grenzen festlegen';
$GLOBALS['TL_LANG']['tl_leaflet_map']['adjustBoundsOptions']['load']['0'] = 'bei Karteninitialisierung';
$GLOBALS['TL_LANG']['tl_leaflet_map']['adjustBoundsOptions']['load']['1'] = 'Grenzen berechnen, wenn die Karte initialisiert wird. Alle statischen und bereits geladenen Features werden mit einbezogen.';
$GLOBALS['TL_LANG']['tl_leaflet_map']['adjustZoomExtra']['0'] = 'Erweiterte Zoom-Einstellungen';
$GLOBALS['TL_LANG']['tl_leaflet_map']['adjustZoomExtra']['1'] = 'Aktivieren Sie diese Einstellung, wenn Sie den minimalen und den maximalen Zoomfaktor ebenfalls einstellen möchten.';
$GLOBALS['TL_LANG']['tl_leaflet_map']['alias']['0'] = 'Alias';
$GLOBALS['TL_LANG']['tl_leaflet_map']['alias']['1'] = 'Legen Sie den Alias der Karte fest.';
$GLOBALS['TL_LANG']['tl_leaflet_map']['behaviour_legend'] = 'Verhalten';
$GLOBALS['TL_LANG']['tl_leaflet_map']['bounceAtZoomLimits']['0'] = 'Zurückfedern bei Erreichen des Zoom-Limits';
$GLOBALS['TL_LANG']['tl_leaflet_map']['bounceAtZoomLimits']['1'] = 'Deaktivieren Sie diese Einstellung, falls Sie verhindern möchten, dass außerhalb liegende Elemente der Karte beim Zoomen über die festgelegten minimalen / maximalen Zoomstufen hinaus angezeigt werden wenn mit zwei Fingern gezoomt wird.';
$GLOBALS['TL_LANG']['tl_leaflet_map']['boxZoom']['0'] = 'Zoomen durch Markierung';
$GLOBALS['TL_LANG']['tl_leaflet_map']['boxZoom']['1'] = 'legen Sie fest ob der Kartenausschnitt vergrößert werden kann indem Benutzer die Maus mit gedrückter Umschalttaste über die Karte ziehen.';
$GLOBALS['TL_LANG']['tl_leaflet_map']['center']['0'] = 'Zentrieren';
@@ -34,12 +37,19 @@ $GLOBALS['TL_LANG']['tl_leaflet_map']['doubleClickZoom']['0'] = 'Zoo
$GLOBALS['TL_LANG']['tl_leaflet_map']['doubleClickZoom']['1'] = 'Legen Sie fest ob in der Karte mit einem Doppelklick hineingezoomt und mit Umstelltaste-Doppelklick gerausgezoomt werden kann.';
$GLOBALS['TL_LANG']['tl_leaflet_map']['dragging']['0'] = 'Verschieben';
$GLOBALS['TL_LANG']['tl_leaflet_map']['dragging']['1'] = 'Legen Sie fest ob die Karte mit Maus oder Touchgesten verschiebbar ist.';
$GLOBALS['TL_LANG']['tl_leaflet_map']['dynamicLoad']['0'] = 'Daten innerhalb der Grenzen dynamisch laden';
$GLOBALS['TL_LANG']['tl_leaflet_map']['dynamicLoad']['1'] = 'Falls ausgewählt werden Layerdaten nur innerhalb des dargestellten Ausschnitts geladen und bei Veränderung des Ausschnitts nachgeladen.';
$GLOBALS['TL_LANG']['tl_leaflet_map']['edit']['0'] = 'Karte bearbeiten';
$GLOBALS['TL_LANG']['tl_leaflet_map']['edit']['1'] = 'Karte ID %s bearbeiten';
$GLOBALS['TL_LANG']['tl_leaflet_map']['enableHighAccuracy']['0'] = 'Hohe Genauigkeit';
$GLOBALS['TL_LANG']['tl_leaflet_map']['enableHighAccuracy']['1'] = 'Aktiviert hohe Genauigkeit. Lesen die die Details in der <a href="http://dev.w3.org/geo/api/spec-source.html#high-accuracy" target="_blank">Beschreibung innerhalb der Spezifikation des W3C</a> nach.';
$GLOBALS['TL_LANG']['tl_leaflet_map']['expert_legend'] = 'Experteneinstellungen';
$GLOBALS['TL_LANG']['tl_leaflet_map']['interaction_legend'] = 'Bedienelemente';
$GLOBALS['TL_LANG']['tl_leaflet_map']['keyboard']['0'] = 'Tatstaturnavigation';
$GLOBALS['TL_LANG']['tl_leaflet_map']['keyboard']['1'] = 'Diese Einstellung macht die Karte fokussierbar und erlaubt Nutzern, mit Hilfe der +/- und Pfeiltasten-Tasten in der Karte zu navigieren.';
$GLOBALS['TL_LANG']['tl_leaflet_map']['keyboardPanOffset']['0'] = 'Keyboard-Verschiebeoffset';
$GLOBALS['TL_LANG']['tl_leaflet_map']['keyboardPanOffset']['1'] = 'Diese Einstellung bestimmt die Anzahl der Pixel, um die eine Kartenansicht mit jedem Druck einer Pfeiltaste verschoben wird.';
$GLOBALS['TL_LANG']['tl_leaflet_map']['keyboardZoomOffset']['0'] = 'Keyboard-Zoomoffset';
$GLOBALS['TL_LANG']['tl_leaflet_map']['keyboardZoomOffset']['1'] = 'Legen Sie die Anzahl der Zoom-Levels fest die mit den + / - -Tasten angesteuert werden können.';
$GLOBALS['TL_LANG']['tl_leaflet_map']['layers']['0'] = 'Standardlayer';
$GLOBALS['TL_LANG']['tl_leaflet_map']['layers']['1'] = 'beim Laden sichtbare layer der Karte. Für optionale Layer nutzen Sie das Layer-Kontrollelement.';
@@ -47,6 +57,7 @@ $GLOBALS['TL_LANG']['tl_leaflet_map']['layers_legend'] = 'Sta
$GLOBALS['TL_LANG']['tl_leaflet_map']['locate']['0'] = 'Nutzerposition ermitteln';
$GLOBALS['TL_LANG']['tl_leaflet_map']['locate']['1'] = 'Initialer Kartenzoom. Diese Funktion versucht, den Benutzer mittels Geolocation-API zu orten.';
$GLOBALS['TL_LANG']['tl_leaflet_map']['locateMaximumAge']['0'] = 'Maximale Gültigkeit der Benutzerposition';
$GLOBALS['TL_LANG']['tl_leaflet_map']['locateMaximumAge']['1'] = 'Maximales Alter der Daten zum Aufenthaltsort in Millisekunden. Ansonsten wird der zwischengespeicherte Wert benutzt.';
$GLOBALS['TL_LANG']['tl_leaflet_map']['locateSetView']['0'] = 'Kartenmitte aktualisieren';
$GLOBALS['TL_LANG']['tl_leaflet_map']['locateSetView']['1'] = 'Falls angewählt wird die Kartenansicht an der Position des Benutzers ausgerichtet. Andernfalls wird nur der <em>locationfound</em>-Event getriggert.';
$GLOBALS['TL_LANG']['tl_leaflet_map']['locateTimeout']['0'] = 'Timeout Standorterkennung';
@@ -66,6 +77,8 @@ $GLOBALS['TL_LANG']['tl_leaflet_map']['scrollWheelZoom']['0'] = 'Zoo
$GLOBALS['TL_LANG']['tl_leaflet_map']['scrollWheelZoom']['1'] = 'Legen Sie fest ob die Karte mit dem Mausrad gezoomt werden kann.';
$GLOBALS['TL_LANG']['tl_leaflet_map']['show']['0'] = 'Details anzeigen';
$GLOBALS['TL_LANG']['tl_leaflet_map']['show']['1'] = 'Details der Karte %s anzeigen';
$GLOBALS['TL_LANG']['tl_leaflet_map']['tap']['0'] = 'Einmaliges Tippen';
$GLOBALS['TL_LANG']['tl_leaflet_map']['tap']['1'] = 'Diese Einstellung aktiviert Hacks, mit der einmaliges Tippen unterstützt wird.';
$GLOBALS['TL_LANG']['tl_leaflet_map']['title']['0'] = 'Titel';
$GLOBALS['TL_LANG']['tl_leaflet_map']['title']['1'] = 'Legen Sie den Titel der Karte fest.';
$GLOBALS['TL_LANG']['tl_leaflet_map']['title_legend'] = 'Titel';
@@ -82,5 +95,6 @@ $GLOBALS['TL_LANG']['tl_leaflet_map']['zoomValues']['']['1'] = 'Zoo
$GLOBALS['TL_LANG']['tl_leaflet_map']['zoomValues']['1']['0'] = 'Aktivieren';
$GLOBALS['TL_LANG']['tl_leaflet_map']['zoomValues']['1']['1'] = 'Zoom aktivieren';
$GLOBALS['TL_LANG']['tl_leaflet_map']['zoomValues']['center']['0'] = 'Zentrieren';
$GLOBALS['TL_LANG']['tl_leaflet_map']['zoomValues']['center']['1'] = 'Falls der Wert \'center\' übergeben wird, zoomt die Kartenansicht zur Mitte des Auschnitts, unabhängig davon an welchem Punkt sich die Maus befindet.';
$GLOBALS['TL_LANG']['tl_leaflet_map']['zoom_legend'] = 'Zentrieren und zoomen';

View File

@@ -8,10 +8,9 @@
*
* @license http://www.gnu.org/licenses/lgpl-3.0.html LGPL
*
* last-updated: 2015-02-11T08:57:57+01:00
* last-updated: 2016-10-04T13:07:35+02:00
*/
$GLOBALS['TL_LANG']['tl_leaflet_marker']['active']['0'] = 'Marker aktivieren';
$GLOBALS['TL_LANG']['tl_leaflet_marker']['active']['1'] = 'Nur aktivierte Marker werden auf der Karte dargestellt.';
$GLOBALS['TL_LANG']['tl_leaflet_marker']['active_legend'] = 'Aktivierung';
@@ -50,6 +49,7 @@ $GLOBALS['TL_LANG']['tl_leaflet_marker']['popup']['1'] = 'Wählen Sie ein
$GLOBALS['TL_LANG']['tl_leaflet_marker']['popupContent']['0'] = 'Popup-Inhalt';
$GLOBALS['TL_LANG']['tl_leaflet_marker']['popupContent']['1'] = 'Geben Sie den Inhalt des Popups an. Insert-Tags werden ersetzt.';
$GLOBALS['TL_LANG']['tl_leaflet_marker']['popups']['0'] = 'Popups verwalten';
$GLOBALS['TL_LANG']['tl_leaflet_marker']['popups']['1'] = 'Popup Einstellungen verwalten.';
$GLOBALS['TL_LANG']['tl_leaflet_marker']['show']['0'] = 'Details anzeigen';
$GLOBALS['TL_LANG']['tl_leaflet_marker']['show']['1'] = 'Details des Markers ID %s anzeigen';
$GLOBALS['TL_LANG']['tl_leaflet_marker']['title']['0'] = 'Titel';

View File

@@ -8,56 +8,61 @@
*
* @license http://www.gnu.org/licenses/lgpl-3.0.html LGPL
*
* last-updated: 2015-02-11T08:57:58+01:00
* last-updated: 2016-10-05T14:56:05+02:00
*/
$GLOBALS['TL_LANG']['tl_leaflet_popup']['active']['0'] = 'Popup aktivieren';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['active']['1'] = 'Nur aktivierte Popups werden auf den Objekten zugewiesen..';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['active_legend'] = 'Aktivierung';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['alias']['0'] = 'Alias';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['alias']['1'] = 'Alias des Icons.';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['className']['0'] = 'CSS-Klasse';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['className']['1'] = 'Legen Sie eine individuelle Klasse für das Popup fest.';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['closeButton']['0'] = 'Schließ-Button';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['closeOnClick']['0'] = 'Beim Klick auf die Karte schließen';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['closeOnClick']['1'] = 'Deaktivieren Sie diese Einstellung, wenn Sie verhindern wollen dass, das Popup bei einem Klick auf die Karte geschlossen wird.';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['config_legend'] = 'Konfiguration';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['controls']['0'] = 'Kontrollelemente verwalten';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['controls']['1'] = 'Kontrollelemente des Popups ID %s verwalten';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['copy']['0'] = 'Popup kopieren';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['copy']['1'] = 'Popup ID %s kopieren';
$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'] = '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';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['layersBtn']['1'] = 'Leaflet-Layer verwalten';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['map']['0'] = 'Karten verwalten';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['map']['1'] = 'Leaflet-Karten verwalten.';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['maxHeight']['0'] = 'Minimale Breite';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['maxHeight']['1'] = 'Minimale Breite des Popups';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['maxWidth']['0'] = 'Maximale Breite';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['maxWidth']['1'] = 'Maximale Breite des Popups';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['minWidth']['0'] = 'Minimale Breite';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['minWidth']['1'] = 'Minimale Breite des Popups';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['new']['0'] = 'Popup erstellen';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['new']['1'] = 'Neues Popup erstellen';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['offset']['0'] = 'Offset';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['offset']['1'] = 'Geben Sie den Offset der Popup-Position als kommagetrennte Werte ein (beispielsweise 5,2).';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['show']['0'] = 'Details anzeigen';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['show']['1'] = 'Details des Popups %s anzeigen';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['size_legend'] = 'Popup-Größe';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['styles']['0'] = 'Stile verwalten';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['styles']['1'] = 'Vektorstile verwalten';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['title']['0'] = 'Titel';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['title']['1'] = 'Titel des Icons.';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['title_legend'] = 'Titel';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['toggle']['0'] = 'Aktivierung umschalten';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['toggle']['1'] = 'Aktivierung von Popups ID %s umschalten';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['zoomAnimation']['0'] = 'Beim Zoomen animieren';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['active']['0'] = 'Popup aktivieren';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['active']['1'] = 'Nur aktivierte Popups werden auf den Objekten zugewiesen..';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['active_legend'] = 'Aktivierung';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['alias']['0'] = 'Alias';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['alias']['1'] = 'Alias des Icons.';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['autoPan']['0'] = 'Karte verschieben';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['autoPan']['1'] = 'Die Karte wird automatisch verschoben um das Popup anzuzeigen.';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['autoPanPadding']['0'] = 'Auto-Padding';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['autoPanPadding']['1'] = 'Geben Sie die Entfernung zwischen dem Popup und dem Kartenrand an. Erste Eingabe: Links oben. Zweite Eingabe: Rechts unten. Die Werte werden kommagetrennt erwartet (z.B. 5,5).';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['className']['0'] = 'CSS-Klasse';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['className']['1'] = 'Legen Sie eine individuelle Klasse für das Popup fest.';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['closeButton']['0'] = 'Schließ-Button';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['closeButton']['1'] = 'Diese Einstellung legt fest ob das Popup über einen Schließknopf verfügt.';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['closeOnClick']['0'] = 'Beim Klick auf die Karte schließen';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['closeOnClick']['1'] = 'Deaktivieren Sie diese Einstellung, wenn Sie verhindern wollen dass, das Popup bei einem Klick auf die Karte geschlossen wird.';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['config_legend'] = 'Konfiguration';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['controls']['0'] = 'Kontrollelemente verwalten';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['controls']['1'] = 'Kontrollelemente des Popups ID %s verwalten';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['copy']['0'] = 'Popup kopieren';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['copy']['1'] = 'Popup ID %s kopieren';
$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'] = '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';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['layersBtn']['1'] = 'Leaflet-Layer verwalten';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['map']['0'] = 'Karten verwalten';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['map']['1'] = 'Leaflet-Karten verwalten.';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['maxHeight']['0'] = 'Maximale Höhe';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['maxHeight']['1'] = 'Maximale Höhe des Popups';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['maxWidth']['0'] = 'Maximale Breite';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['maxWidth']['1'] = 'Maximale Breite des Popups';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['minWidth']['0'] = 'Minimale Breite';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['minWidth']['1'] = 'Minimale Breite des Popups';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['new']['0'] = 'Popup erstellen';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['new']['1'] = 'Neues Popup erstellen';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['offset']['0'] = 'Offset';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['offset']['1'] = 'Geben Sie den Offset der Popup-Position als kommagetrennte Werte ein (beispielsweise 5,2).';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['show']['0'] = 'Details anzeigen';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['show']['1'] = 'Details des Popups %s anzeigen';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['size_legend'] = 'Popup-Größe';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['styles']['0'] = 'Stile verwalten';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['styles']['1'] = 'Vektorstile verwalten';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['title']['0'] = 'Titel';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['title']['1'] = 'Titel des Icons.';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['title_legend'] = 'Titel';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['toggle']['0'] = 'Aktivierung umschalten';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['toggle']['1'] = 'Aktivierung von Popups ID %s umschalten';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['zoomAnimation']['0'] = 'Beim Zoomen animieren';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['zoomAnimation']['1'] = 'Diese Einstellung bestimmt ob das Popup beim Zoom animiert dargestellt wird. Deaktivieren Sie diese Einstellung, wenn Sie Probleme mit flackernden Inhalten innerhalb des Popups haben.';

View File

@@ -8,10 +8,9 @@
*
* @license http://www.gnu.org/licenses/lgpl-3.0.html LGPL
*
* last-updated: 2015-02-11T08:57:58+01:00
* last-updated: 2016-10-04T13:07:35+02:00
*/
$GLOBALS['TL_LANG']['tl_leaflet_style']['active_legend'] = 'Aktivierung';
$GLOBALS['TL_LANG']['tl_leaflet_style']['alias']['0'] = 'Alias';
$GLOBALS['TL_LANG']['tl_leaflet_style']['alias']['1'] = 'Alias des Stils.';
@@ -35,6 +34,7 @@ $GLOBALS['TL_LANG']['tl_leaflet_style']['layersBtn']['0'] = 'Layer verwalten';
$GLOBALS['TL_LANG']['tl_leaflet_style']['layersBtn']['1'] = 'Leaflet-Layer verwalten';
$GLOBALS['TL_LANG']['tl_leaflet_style']['lineCap']['0'] = 'Linienenden';
$GLOBALS['TL_LANG']['tl_leaflet_style']['lineCap']['1'] = 'Geben Sie einen Wert ein, der für die <a href="https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-linecap" target="_blank">Enden der Linie</a> benutzt werden soll,';
$GLOBALS['TL_LANG']['tl_leaflet_style']['lineJoin']['0'] = 'Linienverbindung';
$GLOBALS['TL_LANG']['tl_leaflet_style']['new']['0'] = 'Stil erstellen';
$GLOBALS['TL_LANG']['tl_leaflet_style']['new']['1'] = 'Neuen Stil erstellen';
$GLOBALS['TL_LANG']['tl_leaflet_style']['opacity']['0'] = 'Linientransparenz';

View File

@@ -8,10 +8,9 @@
*
* @license http://www.gnu.org/licenses/lgpl-3.0.html LGPL
*
* last-updated: 2015-02-11T08:57:59+01:00
* last-updated: 2016-10-04T13:07:35+02:00
*/
$GLOBALS['TL_LANG']['tl_leaflet_vector']['active']['0'] = 'Vektor aktivieren';
$GLOBALS['TL_LANG']['tl_leaflet_vector']['active']['1'] = 'Nur aktivierte Vektoren werden auf der Karte ausgegeben.';
$GLOBALS['TL_LANG']['tl_leaflet_vector']['active_legend'] = 'Aktivierung';
@@ -37,6 +36,7 @@ $GLOBALS['TL_LANG']['tl_leaflet_vector']['delete']['1'] = 'Vektor ID %s
$GLOBALS['TL_LANG']['tl_leaflet_vector']['edit']['0'] = 'Vektor bearbeiten';
$GLOBALS['TL_LANG']['tl_leaflet_vector']['edit']['1'] = 'Vektor ID %s bearbeiten';
$GLOBALS['TL_LANG']['tl_leaflet_vector']['expert_legend'] = 'Experteneinstellungen';
$GLOBALS['TL_LANG']['tl_leaflet_vector']['featureData']['0'] = 'Feature-Daten';
$GLOBALS['TL_LANG']['tl_leaflet_vector']['featureData']['1'] = 'Der Marker wird als GeoJSON-Eigenschaft übertragen. Daten werden als <em>feature.properties.data</em> übergeben.';
$GLOBALS['TL_LANG']['tl_leaflet_vector']['ignoreForBounds']['1'] = 'Diesen Datensatz nicht ausgeben, wenn er außerhalb des festgelegten Anzeigebereiches liegt.';
$GLOBALS['TL_LANG']['tl_leaflet_vector']['multiData']['0'] = 'Multi-Daten';

View File

@@ -28,20 +28,23 @@ $GLOBALS['TL_LANG']['leaflet_layer']['markercluster'][1] = 'Marker cluster layer
$GLOBALS['TL_LANG']['leaflet_layer']['tile'][0] = 'Tile layer';
$GLOBALS['TL_LANG']['leaflet_layer']['tile'][1] = 'Tile layer with full config options.';
$GLOBALS['TL_LANG']['leaflet_vector']['polyline'][0] = 'Polyline';
$GLOBALS['TL_LANG']['leaflet_vector']['polyline'][1] = 'Polyline overlay. For more details read the <a href="http://leafletjs.com/reference.html#polyline" target="_blank">Leaflet documentation</a>.';
$GLOBALS['TL_LANG']['leaflet_vector']['multiPolyline'][0] = 'Multi polylines';
$GLOBALS['TL_LANG']['leaflet_vector']['multiPolyline'][1] = 'Multi polylines with shared styling. For more details read the <a href="http://leafletjs.com/reference.html#multipolyline" target="_blank">Leaflet documentation</a>.';
$GLOBALS['TL_LANG']['leaflet_vector']['polygon'][0] = 'Polygon';
$GLOBALS['TL_LANG']['leaflet_vector']['polygon'][1] = 'Polygon overlay. For more details read the <a href="http://leafletjs.com/reference.html#polygon" target="_blank">Leaflet documentation</a>.';
$GLOBALS['TL_LANG']['leaflet_vector']['polyline'][0] = 'Polyline';
$GLOBALS['TL_LANG']['leaflet_vector']['polyline'][1] = 'Polyline overlay. For more details read the <a href="http://leafletjs.com/reference.html#polyline" target="_blank">Leaflet documentation</a>.';
$GLOBALS['TL_LANG']['leaflet_vector']['multiPolyline'][0] = 'Multi polylines';
$GLOBALS['TL_LANG']['leaflet_vector']['multiPolyline'][1] = 'Multi polylines with shared styling. For more details read the <a href="http://leafletjs.com/reference.html#multipolyline" target="_blank">Leaflet documentation</a>.';
$GLOBALS['TL_LANG']['leaflet_vector']['polygon'][0] = 'Polygon';
$GLOBALS['TL_LANG']['leaflet_vector']['polygon'][1] = 'Polygon overlay. For more details read the <a href="http://leafletjs.com/reference.html#polygon" target="_blank">Leaflet documentation</a>.';
$GLOBALS['TL_LANG']['leaflet_vector']['multiPolygon'][0] = 'Multi polygons';
$GLOBALS['TL_LANG']['leaflet_vector']['multiPolygon'][1] = 'Multi polygons with shared styling. For more details read the <a href="http://leafletjs.com/reference.html#multipolygon" target="_blank">Leaflet documentation</a>.';
$GLOBALS['TL_LANG']['leaflet_vector']['circle'][0] = 'Circle';
$GLOBALS['TL_LANG']['leaflet_vector']['circle'][1] = 'Circle overlay. For more details read the <a href="http://leafletjs.com/reference.html#circle" target="_blank">Leaflet documentation</a>.';
$GLOBALS['TL_LANG']['leaflet_vector']['circle'][0] = 'Circle';
$GLOBALS['TL_LANG']['leaflet_vector']['circle'][1] = 'Circle overlay. For more details read the <a href="http://leafletjs.com/reference.html#circle" target="_blank">Leaflet documentation</a>.';
$GLOBALS['TL_LANG']['leaflet_vector']['circleMarker'][0] = 'Circle marker';
$GLOBALS['TL_LANG']['leaflet_vector']['circleMarker'][1] = 'Circle marker with fixed pixel width. For more details read the <a href="http://leafletjs.com/reference.html#circlemarker" target="_blank">Leaflet documentation</a>.';
$GLOBALS['TL_LANG']['leaflet_vector']['rectangle'][0] = 'Rectangle';
$GLOBALS['TL_LANG']['leaflet_vector']['rectangle'][1] = 'Rectangle overlay. For more details read the <a href="http://leafletjs.com/reference.html#rectangle" target="_blank">Leaflet documentation</a>.';
$GLOBALS['TL_LANG']['leaflet_vector']['rectangle'][0] = 'Rectangle';
$GLOBALS['TL_LANG']['leaflet_vector']['rectangle'][1] = 'Rectangle overlay. For more details read the <a href="http://leafletjs.com/reference.html#rectangle" target="_blank">Leaflet documentation</a>.';
$GLOBALS['TL_LANG']['leaflet']['searchPosition'] = 'Search location';
$GLOBALS['TL_LANG']['leaflet']['applyPosition'] = 'Apply position';
$GLOBALS['TL_LANG']['leaflet']['invalidAlias'] = 'Invalid alias given. Alias may not be empty, begin with a numeric value nor contain any special chars (underscore allowed).';
$GLOBALS['TL_LANG']['leaflet']['invalidCoordinates'] = 'Invalid coordinate values given.';

View File

@@ -124,4 +124,7 @@ $GLOBALS['TL_LANG']['tl_leaflet_layer']['groupTypes']['layer'][1] = 'Basic lay
$GLOBALS['TL_LANG']['tl_leaflet_layer']['groupTypes']['feature'][0] = 'Feature group';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['groupTypes']['feature'][1] = 'Extended layer group with events and popup support. <br>See <a href="http://leafletjs.com/reference.html#featuregroup" target="_blank">http://leafletjs.com/reference.html#featuregroup</a>';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['pasteinto'][1] = 'Paste into layer %s';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['pasteafter'][1] = 'Paste after layer %s';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['countEntries'] = 'Entries';

View File

@@ -9,8 +9,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 popups';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['icons'][1] = 'Manage marker popups';
$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';
@@ -28,31 +28,31 @@ $GLOBALS['TL_LANG']['tl_leaflet_popup']['show'][1] = 'Show popup ID %s deta
$GLOBALS['TL_LANG']['tl_leaflet_popup']['toggle'][0] = 'Toggle activation';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['toggle'][1] = 'Toggle popup ID %s activation';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['title'][0] = 'Title';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['title'][1] = 'Title of the icon.';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['alias'][0] = 'Alias';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['alias'][1] = 'Alias of the icon.';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['maxWidth'][0] = 'Max width';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['maxWidth'][1] = 'Max width of the popup.';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['minWidth'][0] = 'Min width';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['minWidth'][1] = 'Min width of the popup.';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['maxHeight'][0] = 'Min width';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['maxHeight'][1] = 'Min width of the popup.';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['closeButton'][0] = 'Close button';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['closeButton'][1] = 'Controls the presense of a close button in the popup.';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['closeOnClick'][0] = 'Close on map click';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['closeOnClick'][1] = 'Disable it if you want to override the default behavior of the popup closing when user clicks the map ';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['offset'][0] = 'Offset';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['offset'][1] = 'The offset of the popup position as comma separated point (e.g. 5,2)';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['keepInView'][0] = 'Keep in view';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['keepInView'][1] = 'Set it to true if you want to prevent users from panning the popup off of the screen while it is open.';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['zoomAnimation'][0] = 'Animate on zoom';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['zoomAnimation'][1] = 'Whether to animate the popup on zoom. Disable it if you have problems with Flash content inside popups.';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['className'][0] = 'Class name';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['className'][1] = 'A custom class name to assign to the popup.';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['autoPanPadding'][0] = 'Auto pan padding';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['autoPanPadding'][1] = 'The margin between the popup and the top left (first input) and the bottom right (second input) of the map view. Each value as comma separated point (e.g. 5,5)';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['autoPan'][0] = 'Pan map';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['autoPan'][1] = 'Automatically pan the map to display the popup.';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['active'][0] = 'Activate popup';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['active'][1] = 'Only activated popups are assigned to the map object.';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['title'][0] = 'Title';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['title'][1] = 'Title of the icon.';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['alias'][0] = 'Alias';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['alias'][1] = 'Alias of the icon.';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['maxWidth'][0] = 'Max width';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['maxWidth'][1] = 'Max width of the popup.';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['minWidth'][0] = 'Min width';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['minWidth'][1] = 'Min width of the popup.';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['maxHeight'][0] = 'Max height';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['maxHeight'][1] = 'Max height of the popup.';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['closeButton'][0] = 'Close button';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['closeButton'][1] = 'Controls the presense of a close button in the popup.';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['closeOnClick'][0] = 'Close on map click';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['closeOnClick'][1] = 'Disable it if you want to override the default behavior of the popup closing when user clicks the map ';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['offset'][0] = 'Offset';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['offset'][1] = 'The offset of the popup position as comma separated point (e.g. 5,2)';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['keepInView'][0] = 'Keep in view';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['keepInView'][1] = 'Set it to true if you want to prevent users from panning the popup off of the screen while it is open.';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['zoomAnimation'][0] = 'Animate on zoom';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['zoomAnimation'][1] = 'Whether to animate the popup on zoom. Disable it if you have problems with Flash content inside popups.';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['className'][0] = 'Class name';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['className'][1] = 'A custom class name to assign to the popup.';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['autoPanPadding'][0] = 'Auto pan padding';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['autoPanPadding'][1] = 'The margin between the popup and the top left (first input) and the bottom right (second input) of the map view. Each value as comma separated point (e.g. 5,5)';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['autoPan'][0] = 'Pan map';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['autoPan'][1] = 'Automatically pan the map to display the popup.';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['active'][0] = 'Activate popup';
$GLOBALS['TL_LANG']['tl_leaflet_popup']['active'][1] = 'Only activated popups are assigned to the map object.';

View File

@@ -13,14 +13,14 @@
<p>
This software ships with an visible attribution to <em>netzmacht creative</em> in the map attribution control.
If you want to remove this attribution, you have to purchase a commercial license.
For more details visit the <a href="http://contao-leaflet.netzmacht.de" target="_blank">project website</a>.
For more details visit the <a href="https://netzmacht.de/contao-leaflet" target="_blank">project website</a>.
</p>
</div>
<div class="right">
<a href="http://www.netzmacht.de" <?php echo LINK_NEW_WINDOW; ?>>
<img src="system/modules/leaflet/assets/img/logo.png"></a>
<p>
<strong class="company">netzmacht <em>creative</em></strong><br>
<strong class="company">netzmacht </strong><br>
David Molineus<br>
</p>
<p>
@@ -51,12 +51,12 @@
<p>There are many ways you can con&shy;tribute. Translations,
docu&shy;mentation or code contributions are welcome.
</p>
<p><a href="http://contao-leaflet.netzmacht.de/contribute.html" class="btn" target="_blank">Contribute</a> </p>
<p><a href="https://netzmacht/contao-leaflet/contribute.html" class="btn" target="_blank">Contribute</a> </p>
</div>
<div class="col">
<h3>Fund a feature</h3>
<p>Contao Leaflet is not feature complete. Have a look at the list of planned feature and support them.</p>
<p><a href="http://contao-leaflet.netzmacht.de/planned-features.html" class="btn" target="_blank">Planned features</a> </p>
<p><a href="https://netzmacht/contao-leaflet/planned-features.html" class="btn" target="_blank">Planned features</a> </p>
</div>
</div>
<div class="row">
@@ -64,12 +64,12 @@
<div class="col">
<h3>Individual development</h3>
<p>If you have special requirements you can hire me for an individual development.</p>
<p><a href="http://contao-leaflet.netzmacht.de/contact.html" class="btn" target="_blank">Contact</a> </p>
<p><a href="https://netzmacht/contao-leaflet/contact.html" class="btn" target="_blank">Contact</a> </p>
</div>
<div class="col">
<h3>Commercial license</h3>
<p>If you want to remove the attribution in the attribution control, you can purchase a commercial license.</p>
<p><a href="http://contao-leaflet.netzmacht.de/commercial-license.html" class="btn" target="_blank">Purchase license</a> </p>
<p><a href="https://netzmacht/contao-leaflet/commercial-license.html" class="btn" target="_blank">Purchase license</a> </p>
</div>
</div>
</div>

View File

@@ -4,7 +4,7 @@
<?php $GLOBALS['TL_JAVASCRIPT'][] = 'assets/leaflet/libs/leaflet/leaflet.js'; ?>
<?php $GLOBALS['TL_JAVASCRIPT'][] = 'assets/leaflet/libs/control-geocoder/Control.Geocoder.js'; ?>
<div id="map_<?php echo $this->field; ?>" style="margin-top: 5px; width: 670px; height: 300px"></div>
<div id="map_<?php echo $this->field; ?>" style="margin-top: 5px; width: calc(100% - 28px); height: 300px"></div>
<script>
var map = L.map('map_<?php echo $this->field; ?>').setView([0, 0], 2);
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {

View File

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

View File

@@ -6,12 +6,7 @@
<?php endif; ?>
<div id="<?php echo $this->mapId; ?>" style="<?php echo $this->mapStyle; ?>"></div>
<?php if ($this->map): ?>
<script>
<?php echo $this->map; ?>
</script>
<?php endif; ?>
</div>
<!-- indexer::continue -->
<?php $GLOBALS['TL_BODY'][] = '<script>' . $this->javascript .'</script>'; ?>

31
package.json Normal file
View File

@@ -0,0 +1,31 @@
{
"name": "contao-leaflet-maps",
"version": "1.0.0",
"description": "Leaflet maps for Contao",
"main": "gulpfile.js",
"dependencies": {
"del": "^2.2.2",
"gulp": "^3.9.1",
"gulp-concat": "^2.6.0",
"gulp-uglify": "^2.0.0"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://github.com/netzmacht/contao-leaflet-maps.git"
},
"keywords": [
"Contao",
"Leaflet",
"Maps"
],
"author": "netzmacht David Molineus",
"license": "LGPL-3.0",
"bugs": {
"url": "https://github.com/netzmacht/contao-leaflet-maps/issues"
},
"homepage": "https://github.com/netzmacht/contao-leaflet-maps#readme"
}

View File

@@ -0,0 +1,61 @@
<?php
/**
* @package netzmacht
* @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2016 netzmacht David Molineus. All rights reserved.
* @filesource
*
*/
namespace Netzmacht\Contao\Leaflet\Alias;
use Netzmacht\Contao\Toolkit\Data\Alias\Filter\AbstractFilter;
/**
* Class DefaultAliasFilter creates an prefix of the alias.
*
* @package Netzmacht\Contao\Leaflet\Alias
*/
class DefaultAliasFilter extends AbstractFilter
{
/**
* Alias prefix.
*
* @var string
*/
private $prefix;
/**
* DefaultAliasFilter constructor.
*
* @param string $dataContainerName Data container name.
* @param int $combine Combine strategy.
*/
public function __construct($dataContainerName, $combine = self::COMBINE_REPLACE)
{
parent::__construct(true, $combine);
$this->prefix = str_replace('tl_leaflet_', '', $dataContainerName);
}
/**
* {@inheritdoc}
*/
public function repeatUntilValid()
{
return false;
}
/**
* {@inheritdoc}
*/
public function apply($model, $value, $separator)
{
if (!$value) {
return $this->prefix . $separator . $model->id;
}
return $value;
}
}

View File

@@ -11,6 +11,7 @@
namespace Netzmacht\Contao\Leaflet;
use Netzmacht\Contao\Toolkit\View\Assets\AssetsManager;
use Netzmacht\LeafletPHP\Assets;
/**
@@ -27,6 +28,34 @@ class ContaoAssets implements Assets
*/
private $map;
/**
* Assets manager.
*
* @var AssetsManager
*/
private $assetsManager;
/**
* Cached assets.
*
* @var array
*/
private $cache = [
'stylesheets' => [],
'javascripts' => [],
'map' => []
];
/**
* ContaoAssets constructor.
*
* @param AssetsManager $assetsManager Contao assets manager.
*/
public function __construct(AssetsManager $assetsManager)
{
$this->assetsManager = $assetsManager;
}
/**
* {@inheritdoc}
*
@@ -34,20 +63,16 @@ class ContaoAssets implements Assets
*/
public function addJavascript($script, $type = self::TYPE_SOURCE)
{
$this->cache['javascripts'][] = [$script, $type];
switch ($type) {
case static::TYPE_SOURCE:
$GLOBALS['TL_HEAD'][] = sprintf('<script>%s</script>', $script);
break;
case static::TYPE_FILE:
if (!\Config::get('debugMode') && TL_MODE === 'FE') {
$script .= '|static';
}
// no break
default:
$GLOBALS['TL_JAVASCRIPT'][] = $script;
$this->assetsManager->addJavascript($script);
}
}
@@ -58,19 +83,16 @@ class ContaoAssets implements Assets
*/
public function addStylesheet($stylesheet, $type = self::TYPE_FILE)
{
$this->cache['stylesheets'][] = [$stylesheet, $type];
switch ($type) {
case static::TYPE_SOURCE:
$GLOBALS['TL_HEAD'][] = sprintf('<style>%s</style>', $stylesheet);
break;
case static::TYPE_FILE:
if (!\Config::get('debugMode')) {
$stylesheet .= '|all|static';
}
// no break
default:
$GLOBALS['TL_CSS'][] = $stylesheet;
$this->assetsManager->addStylesheet($stylesheet);
}
}
@@ -87,8 +109,39 @@ class ContaoAssets implements Assets
*/
public function setMap($map)
{
$this->map = $map;
$this->cache['map'] = $map;
$this->map = $map;
return $this;
}
/**
* Export to array.
*
* @return array
*/
public function toArray()
{
return $this->cache;
}
/**
* From array.
*
* @param array $cache Cache.
*
* @return void
*/
public function fromArray(array $cache)
{
foreach ($cache['javascripts'] as $javascript) {
$this->addJavascript($javascript[0], $javascript[1]);
}
foreach ($cache['stylesheets'] as $stylesheet) {
$this->addStylesheet($stylesheet[0], $stylesheet[1]);
}
$this->map = $cache['map'];
}
}

View File

@@ -11,8 +11,9 @@
namespace Netzmacht\Contao\Leaflet\Dca;
use Netzmacht\Contao\Toolkit\Dca\Callback\Callbacks;
use Netzmacht\Contao\Toolkit\Dca\Manager;
use Netzmacht\Contao\Toolkit\Dca\Options\OptionsBuilder;
use Netzmacht\Contao\Toolkit\ServiceContainerTrait;
use Netzmacht\Contao\Leaflet\Model\ControlModel;
use Netzmacht\Contao\Leaflet\Model\LayerModel;
@@ -21,9 +22,21 @@ use Netzmacht\Contao\Leaflet\Model\LayerModel;
*
* @package Netzmacht\Contao\Leaflet\Dca
*/
class Control
class ControlCallbacks extends Callbacks
{
use ServiceContainerTrait;
/**
* Name of the data container.
*
* @var string
*/
protected static $name = 'tl_leaflet_control';
/**
* Helper service name.
*
* @var string
*/
protected static $serviceName = 'leaflet.dca.control-callbacks';
/**
* The database connection.
@@ -34,10 +47,15 @@ class Control
/**
* Construct.
*
* @param Manager $manager Data container manager.
* @param \Database $database Database connection.
*/
public function __construct()
public function __construct(Manager $manager, \Database $database)
{
$this->database = static::getServiceContainer()->getDatabaseConnection();
parent::__construct($manager);
$this->database = $database;
}
/**
@@ -63,16 +81,11 @@ class Control
*/
public function getLayers()
{
$options = array();
$collection = LayerModel::findBy('pid', '0', array('order' => 'title'));
$collection = LayerModel::findAll();
if ($collection) {
foreach ($collection as $model) {
$options[$model->id] = $model->title;
}
}
return $options;
return OptionsBuilder::fromCollection($collection, 'title')
->asTree()
->getOptions();
}
/**
@@ -84,7 +97,7 @@ class Control
{
$collection = ControlModel::findBy('type', 'zoom', array('order' => 'title'));
return OptionsBuilder::fromCollection($collection, 'id', 'title')->getOptions();
return OptionsBuilder::fromCollection($collection, 'title')->getOptions();
}
/**

View File

@@ -11,6 +11,8 @@
namespace Netzmacht\Contao\Leaflet\Dca;
use ContaoCommunityAlliance\Translator\TranslatorInterface as Translator;
use Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory;
use Netzmacht\Contao\Toolkit\Dca\Options\OptionsBuilder;
use Netzmacht\Contao\Leaflet\Model\MapModel;
@@ -21,6 +23,35 @@ use Netzmacht\Contao\Leaflet\Model\MapModel;
*/
class FrontendIntegration
{
/**
* Translator.
*
* @var Translator
*/
private $translator;
/**
* FrontendIntegration constructor.
*
* @param Translator $translator Translator.
*/
public function __construct(Translator $translator)
{
$this->translator = $translator;
}
/**
* Generate the callback definition.
*
* @param string $methodName Callback method name.
*
* @return callable
*/
public static function callback($methodName)
{
return CallbackFactory::service('leaflet.dca.frontend-integration', $methodName);
}
/**
* Get all leaflet maps.
*
@@ -30,7 +61,7 @@ class FrontendIntegration
{
$collection = MapModel::findAll();
return OptionsBuilder::fromCollection($collection, 'id', 'title')->getOptions();
return OptionsBuilder::fromCollection($collection, 'title')->getOptions();
}
/**
@@ -39,8 +70,6 @@ class FrontendIntegration
* @param \DataContainer $dataContainer The dataContainer driver.
*
* @return string
*
* @SuppressWarnings(PHPMD.Superglobals)
*/
public function getEditMapLink($dataContainer)
{
@@ -53,23 +82,23 @@ class FrontendIntegration
return sprintf(
'<a href="%s%s&amp;popup=1&amp;rt=%s" %s>%s</a>',
'contao/main.php?do=leaflet&amp;table=tl_leaflet_map&amp;act=edit&amp;id=',
'contao/main.php?do=leaflet_map&amp;table=tl_leaflet_map&amp;act=edit&amp;id=',
$dataContainer->value,
\RequestToken::get(),
sprintf(
$pattern,
specialchars(sprintf($GLOBALS['TL_LANG']['tl_content']['editalias'][1], $dataContainer->value)),
specialchars($this->translator->translate('editalias.1', 'tl_content', [$dataContainer->value])),
specialchars(
str_replace(
"'",
"\\'",
sprintf($GLOBALS['TL_LANG']['tl_content']['editalias'][1], $dataContainer->value)
sprintf($this->translator->translate('editalias.1', 'tl_content', [$dataContainer->value]))
)
)
),
\Image::getHtml(
'alias.gif',
$GLOBALS['TL_LANG']['tl_content']['editalias'][0],
$this->translator->translate('editalias.0', 'tl_content', [$dataContainer->value]),
'style="vertical-align:top"'
)
);

View File

@@ -1,43 +0,0 @@
<?php
/**
* @package dev
* @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2015 netzmacht creative David Molineus
* @license LGPL 3.0
* @filesource
*
*/
namespace Netzmacht\Contao\Leaflet\Dca;
use Netzmacht\Contao\Toolkit\Dca;
use Netzmacht\Contao\Toolkit\Dca\Callback\GenerateAliasCallback;
/**
* Helper class for dca functions.
*
* @package Netzmacht\Contao\Leaflet\Dca
*/
class Helper
{
/**
* Generate an alias callback which creates a valid javascript var name.
*
* @param string $table The table.
* @param string $column The value column.
*
* @return GenerateAliasCallback
*/
public static function createGenerateAliasCallback($table, $column)
{
$callback = Dca::createGenerateAliasCallback($table, $column);
$callback->getGenerator()->addFilter(
function ($value) {
return str_replace('-', '_', $value);
}
);
return $callback;
}
}

View File

@@ -11,8 +11,10 @@
namespace Netzmacht\Contao\Leaflet\Dca;
use ContaoCommunityAlliance\Translator\TranslatorInterface as Translator;
use Netzmacht\Contao\Toolkit\Dca\Callback\Callbacks;
use Netzmacht\Contao\Toolkit\Dca\Manager;
use Netzmacht\Contao\Toolkit\Dca\Options\OptionsBuilder;
use Netzmacht\Contao\Toolkit\ServiceContainerTrait;
use Netzmacht\Contao\Leaflet\Model\LayerModel;
/**
@@ -20,9 +22,21 @@ use Netzmacht\Contao\Leaflet\Model\LayerModel;
*
* @package Netzmacht\Contao\Leaflet\Dca
*/
class Layer
class LayerCallbacks extends Callbacks
{
use ServiceContainerTrait;
/**
* Name of the data container.
*
* @var string
*/
protected static $name = 'tl_leaflet_layer';
/**
* Helper service name.
*
* @var string
*/
protected static $serviceName = 'leaflet.dca.layer-callbacks';
/**
* Layers definition.
@@ -37,19 +51,46 @@ class Layer
* @var \Database
*/
private $database;
/**
* Tile providers configuration.
*
* @var array
*/
private $tileProviders;
/**
* Translator.
*
* @var Translator
*/
private $translator;
/**
* Construct.
*
* @SuppressWarnings(PHPMD.Superglobals)
* @param Manager $manager Data container manager.
* @param \Database $database Database connection.
* @param Translator $translator Translator.
* @param array $layers Leaflet layer configuration.
* @param array $tileProviders Tile providers.
*/
public function __construct()
{
$this->layers = &$GLOBALS['LEAFLET_LAYERS'];
$this->database = static::getServiceContainer()->getDatabaseConnection();
public function __construct(
Manager $manager,
\Database $database,
Translator $translator,
array $layers,
array $tileProviders
) {
parent::__construct($manager);
$this->database = $database;
$this->layers = $layers;
$this->tileProviders = $tileProviders;
\Controller::loadLanguageFile('leaflet_layer');
$this->translator = $translator;
}
/**
@@ -58,16 +99,14 @@ class Layer
* @param \DataContainer $dataContainer The dataContainer driver.
*
* @return array
*
* @SuppressWarnings(PHPMD.Superglobals)
*/
public function getVariants($dataContainer)
{
if ($dataContainer->activeRecord
&& $dataContainer->activeRecord->tile_provider
&& !empty($GLOBALS['LEAFLET_TILE_PROVIDERS'][$dataContainer->activeRecord->tile_provider]['variants'])
&& !empty($this->tileProviders[$dataContainer->activeRecord->tile_provider]['variants'])
) {
return $GLOBALS['LEAFLET_TILE_PROVIDERS'][$dataContainer->activeRecord->tile_provider]['variants'];
return $this->tileProviders[$dataContainer->activeRecord->tile_provider]['variants'];
}
return array();
@@ -80,15 +119,9 @@ class Layer
* @param string $label Current row label.
*
* @return string
*
* @SuppressWarnings(PHPMD.Superglobals)
*/
public function generateRow($row, $label)
{
$alt = empty($GLOBALS['TL_LANG']['leaflet_layer'][$row['type']][0])
? $row['type']
: $GLOBALS['TL_LANG']['leaflet_layer'][$row['type']][0];
if (!empty($this->layers[$row['type']]['icon'])) {
$src = $this->layers[$row['type']]['icon'];
@@ -100,6 +133,7 @@ class Layer
$src = preg_replace('/(\.[^\.]+)$/', '_1$1', $src);
}
$alt = $this->getFormatter()->formatValue('type', $row['type']);
$icon = \Image::getHtml($src, $alt, sprintf('title="%s"', strip_tags($alt)));
if (!empty($this->layers[$row['type']]['label'])) {
@@ -148,7 +182,6 @@ class Layer
*
* @return string
*
* @SuppressWarnings(PHPMD.Superglobals)
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
*/
public function getPasteButtons($dataContainer, $row, $table, $whatever, $children)
@@ -161,10 +194,10 @@ class Layer
$buffer = sprintf(
'<a href="%s" title="%s" onclick="Backend.getScrollOffset()">%s</a> ',
$pasteAfterUrl,
specialchars(sprintf($GLOBALS['TL_LANG'][$table]['pasteafter'][1], $row['id'])),
specialchars($this->translator->translate('pasteafter.1', $table, [$row['id']])),
\Image::getHtml(
'pasteafter.gif',
sprintf($GLOBALS['TL_LANG'][$table]['pasteafter'][1], $row['id'])
$this->translator->translate('pasteafter.1', $table, [$row['id']])
)
);
@@ -181,10 +214,10 @@ class Layer
$buffer .= sprintf(
'<a href="%s" title="%s" onclick="Backend.getScrollOffset()">%s</a> ',
$pasteIntoUrl,
specialchars(sprintf($GLOBALS['TL_LANG'][$table]['pasteinto'][1], $row['id'])),
specialchars($this->translator->translate('pasteinto.1', $table, [$row['id']])),
\Image::getHtml(
'pasteinto.gif',
sprintf($GLOBALS['TL_LANG'][$table]['pasteinto'][1], $row['id'])
$this->translator->translate('pasteinto.1', $table, [$row['id']])
)
);
@@ -237,22 +270,6 @@ class Layer
return $this->generateButton($row, $href, $label, $title, $icon, $attributes);
}
/**
* Get all layers except of the current layer.
*
* @param \DataContainer $dataContainer The dataContainer driver.
*
* @return array
*/
public function getLayers($dataContainer)
{
$collection = LayerModel::findBy('id !', $dataContainer->id);
return OptionsBuilder::fromCollection($collection, 'id', 'title')
->asTree()
->getOptions();
}
/**
* Delete the relations when the layer is deleted.
*
@@ -326,6 +343,22 @@ class Layer
return $options;
}
/**
* Get all layers except of the current layer.
*
* @param \DataContainer $dataContainer The dataContainer driver.
*
* @return array
*/
public function getLayers($dataContainer)
{
$collection = LayerModel::findBy('id !', $dataContainer->id);
return OptionsBuilder::fromCollection($collection, 'title')
->asTree()
->getOptions();
}
/**
* Generate a button.
*

View File

@@ -11,10 +11,8 @@
namespace Netzmacht\Contao\Leaflet\Dca;
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
use Netzmacht\Contao\Leaflet\Mapper\MapMapper;
use Netzmacht\Contao\Leaflet\Model\LayerModel;
use Netzmacht\Contao\Leaflet\Model\MapModel;
use Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory;
use Netzmacht\LeafletPHP\Value\LatLng;
/**
@@ -22,24 +20,35 @@ use Netzmacht\LeafletPHP\Value\LatLng;
*
* @package Netzmacht\Contao\Leaflet\Dca
*/
class Leaflet
class LeafletCallbacks
{
/**
* Validate a coordinate.
* File system.
*
* @param mixed $value The given value.
*
* @return mixed
* @var \Files
*/
public function validateCoordinate($value)
private $fileSystem;
/**
* LeafletCallbacks constructor.
*
* @param \Files $fileSystem File system.
*/
public function __construct(\Files $fileSystem)
{
if (!empty($value)) {
// Validate by creating latlng object. Throws an exception.
$this->fileSystem = $fileSystem;
}
LatLng::fromString($value);
}
return $value;
/**
* Generate the callback definition.
*
* @param string $methodName Callback method name.
*
* @return callable
*/
public static function callback($methodName)
{
return CallbackFactory::service('leaflet.dca.common', $methodName);
}
/**
@@ -93,4 +102,18 @@ class Leaflet
return $options;
}
/**
* Clear the leaflet cache.
*
* @param mixed $value Value when used as save_callback.
*
* @return mixed
*/
public function clearCache($value = null)
{
$this->fileSystem->rrdir('system/cache/leaflet', true);
return $value;
}
}

View File

@@ -11,16 +11,31 @@
namespace Netzmacht\Contao\Leaflet\Dca;
use Netzmacht\Contao\Toolkit\ServiceContainerTrait;
use Netzmacht\Contao\Leaflet\Model\LayerModel;
use Netzmacht\Contao\Toolkit\Dca\Callback\Callbacks;
use Netzmacht\Contao\Toolkit\Dca\Manager;
use Netzmacht\Contao\Toolkit\Dca\Options\OptionsBuilder;
/**
* Class Map is the helper class for the tl_leaflet_map dca.
*
* @package Netzmacht\Contao\Leaflet\Dca
*/
class Map
class MapCallbacks extends Callbacks
{
use ServiceContainerTrait;
/**
* Name of the data container.
*
* @var string
*/
protected static $name = 'tl_leaflet_map';
/**
* Helper service name.
*
* @var string
*/
protected static $serviceName = 'leaflet.dca.map-callbacks';
/**
* The database connection.
@@ -31,10 +46,15 @@ class Map
/**
* Construct.
*
* @param Manager $manager Data container manager.
* @param \Database $database Database connection.
*/
public function __construct()
public function __construct(Manager $manager, \Database $database)
{
$this->database = static::getServiceContainer()->getDatabaseConnection();
parent::__construct($manager);
$this->database = $database;
}
/**
@@ -120,4 +140,20 @@ class Map
return null;
}
/**
* Get all layers except of the current layer.
*
* @param \DataContainer $dataContainer The dataContainer driver.
*
* @return array
*/
public function getLayers($dataContainer)
{
$collection = LayerModel::findBy('id !', $dataContainer->id);
return OptionsBuilder::fromCollection($collection, 'title')
->asTree()
->getOptions();
}
}

View File

@@ -20,7 +20,7 @@ use Netzmacht\Contao\Leaflet\Model\PopupModel;
*
* @package Netzmacht\Contao\Leaflet\Dca
*/
class Marker
class MarkerCallbacks
{
/**
* Generate the row label.
@@ -44,7 +44,6 @@ class Marker
$collection = IconModel::findAll(array('order' => 'title'));
$builder = OptionsBuilder::fromCollection(
$collection,
'id',
function ($model) {
return sprintf('%s [%s]', $model['title'], $model['type']);
}
@@ -61,7 +60,7 @@ class Marker
public function getPopups()
{
$collection = PopupModel::findAll(array('order' => 'title'));
$builder = OptionsBuilder::fromCollection($collection, 'id', 'title');
$builder = OptionsBuilder::fromCollection($collection, 'title');
return $builder->getOptions();
}

View File

@@ -0,0 +1,133 @@
<?php
/**
* @package netzmacht
* @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2016 netzmacht David Molineus. All rights reserved.
* @filesource
*
*/
namespace Netzmacht\Contao\Leaflet\Dca;
use ContaoCommunityAlliance\Translator\TranslatorInterface as Translator;
use Netzmacht\Contao\Toolkit\Dca\Callback\CallbackFactory;
use Netzmacht\LeafletPHP\Value\LatLng;
/**
* Class Validator.
*
* @package Netzmacht\Contao\Leaflet\Dca
*/
class Validator
{
/**
* Translator.
*
* @var Translator;
*/
private $translator;
/**
* Validator constructor.
*
* @param Translator $translator Translator.
*/
public function __construct(Translator $translator)
{
$this->translator = $translator;
}
/**
* Generate the callback definition.
*
* @param string $methodName Callback method name.
*
* @return callable
*/
public static function callback($methodName)
{
return CallbackFactory::service('leaflet.dca.validator', $methodName);
}
/**
* Validate coordinates.
*
* @param mixed $value Given value.
*
* @return mixed
* @throws \InvalidArgumentException When invalid coordinates give.
*/
public function validateCoordinates($value)
{
try {
LatLng::fromString($value);
} catch (\Exception $e) {
throw new \InvalidArgumentException(
$this->translator->translate('invalidCoordinates', 'leaflet', [$value]),
0,
$e
);
}
return $value;
}
/**
* Validate multiple coordinates.
*
* @param mixed $values Given value.
*
* @return mixed
*/
public function validateMultipleCoordinates($values)
{
if (!is_array($values)) {
$lines = explode("\n", $values);
} else {
$lines = $values;
}
foreach ($lines as $coordinate) {
$this->validateCoordinates($coordinate);
}
return $values;
}
/**
* Validate multiple coordinate sets.
*
* @param mixed $values Given value.
*
* @return mixed
*/
public function validateMultipleCoordinateSets($values)
{
$sets = deserialize($values, true);
foreach ($sets as $lines) {
$this->validateMultipleCoordinates($lines);
}
return $values;
}
/**
* Validate an alias.
*
* @param string $value Given value.
*
* @return string
* @throws \InvalidArgumentException When invalid value given.
*/
public function validateAlias($value)
{
if (preg_match('/^[A-Za-z_]+[A-Za-z0-9_]+$/', $value) !== 1) {
throw new \InvalidArgumentException(
$this->translator->translate('invalidAlias', 'leaflet')
);
}
return $value;
}
}

View File

@@ -11,6 +11,7 @@
namespace Netzmacht\Contao\Leaflet\Dca;
use Netzmacht\Contao\Toolkit\Dca\Callback\Callbacks;
use Netzmacht\Contao\Toolkit\Dca\Options\OptionsBuilder;
use Netzmacht\Contao\Leaflet\Model\StyleModel;
@@ -19,8 +20,22 @@ use Netzmacht\Contao\Leaflet\Model\StyleModel;
*
* @package Netzmacht\Contao\Leaflet\Dca
*/
class Vector
class VectorCallbacks extends Callbacks
{
/**
* Name of the data container.
*
* @var string
*/
protected static $name = 'tl_leaflet_vector';
/**
* Helper service name.
*
* @var string
*/
protected static $serviceName = 'leaflet.dca.vector-callbacks';
/**
* Generate the row label.
*
@@ -30,7 +45,11 @@ class Vector
*/
public function generateRow($row)
{
return sprintf('%s <span class="tl_gray">[%s]</span>', $row['title'], $row['type']);
return sprintf(
'%s <span class="tl_gray">(%s)</span>',
$row['title'],
$this->getFormatter()->formatValue('type', $row['type'])
);
}
/**
@@ -42,6 +61,6 @@ class Vector
{
$collection = StyleModel::findAll(array('order' => 'title'));
return OptionsBuilder::fromCollection($collection, 'id', 'title')->getOptions();
return OptionsBuilder::fromCollection($collection, 'title')->getOptions();
}
}

View File

@@ -0,0 +1,106 @@
<?php
/**
* @package netzmacht
* @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2016 netzmacht David Molineus. All rights reserved.
* @filesource
*
*/
namespace Netzmacht\Contao\Leaflet\DependencyInjection;
use Doctrine\Common\Cache\Cache;
use Netzmacht\Contao\Leaflet\Boot;
use Netzmacht\Contao\Leaflet\Frontend\ValueFilter;
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
use Netzmacht\Contao\Leaflet\MapProvider;
use Netzmacht\Contao\Toolkit\Data\Alias\AliasGenerator;
use Netzmacht\LeafletPHP\Assets;
use Netzmacht\LeafletPHP\Leaflet;
use Symfony\Component\EventDispatcher\EventDispatcherInterface;
/**
* Class LeafletServices describes services provided by the leaflet package.
*
* @package Netzmacht\Contao\Leaflet\DependencyInjection
*/
class LeafletServices
{
/**
* Service name for the alias generator which creates valid js aliases.
*
* @return AliasGenerator
*/
const ALIAS_GENERATOR = 'leaflet.alias-generator.default';
/**
* Service name of the boot handler.
*
* @return Boot
*/
const BOOT = 'leaflet.boot';
/**
* Leaflet cache
*
* @return Cache
*/
const CACHE = 'leaflet.cache';
/**
* Service name of the definition builder.
*
* @return Leaflet
*/
const DEFINITION_BUILDER = 'leaflet.definition.builder';
/**
* Service name of the encoder factory used inside of the definition builder.
*
* @return \callable
*/
const DEFINITION_ENCODER_FACTORY = 'leaflet.definition.builder.encoder-factory';
/**
* Service name of the internal used event dispatcher of the definition builder.
*
* @return EventDispatcherInterface
*/
const DEFINITION_BUILDER_EVENT_DISPATCHER = 'leaflet.definition.builder.event-dispatcher';
/**
* Service name of the definition mapper.
*
* @return DefinitionMapper
*/
const DEFINITION_MAPPER = 'leaflet.definition.mapper';
/**
* Service name of the leaflet map provider.
*
* @return MapProvider
*/
const MAP_PROVIDER = 'leaflet.map.provider';
/**
* Service name of the map assets handler.
*
* @return Assets
*/
const MAP_ASSETS = 'leaflet.map.assets';
/**
* Service name of the frontend value filter.
*
* @return ValueFilter
*/
const FRONTEND_VALUE_FILTER = 'leaflet.frontend.value-filter';
/**
* Service name for the alias generator uses for rows being unique in the pid.
*
* @return AliasGenerator
*/
const PARENT_ALIAS_GENERATOR = 'leaflet.alias-generator.parent';
}

View File

@@ -0,0 +1,150 @@
<?php
/**
* @package dev
* @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2015 netzmacht creative David Molineus
* @license LGPL 3.0
* @filesource
*
*/
namespace Netzmacht\Contao\Leaflet\Frontend;
use ContaoCommunityAlliance\Translator\TranslatorInterface as Translator;
use Database\Result;
use Model\Collection;
use Netzmacht\Contao\Leaflet\MapProvider;
use Netzmacht\Contao\Leaflet\Model\MapModel;
use Netzmacht\Contao\Toolkit\Component\Hybrid\AbstractHybrid;
use Netzmacht\Contao\Toolkit\View\Template\TemplateFactory;
/**
* Class HybridTrait provides method required by the frontend module and content element the same time.
*
* @package Netzmacht\Contao\Leaflet\Frontend
*/
abstract class AbstractMapHybrid extends AbstractHybrid
{
/**
* The map provider.
*
* @var MapProvider
*/
private $mapProvider;
/**
* The user input.
*
* @var \Input
*/
private $input;
/**
* The Contao config.
*
* @var \Config
*/
private $config;
/**
* HybridTrait constructor.
*
* @param Result|\Model|Collection $model Component model.
* @param TemplateFactory $templateFactory Template factory.
* @param Translator $translator Translator.
* @param MapProvider $mapProvider Map provider.
* @param \Input $input Request Input.
* @param \Config $config Config.
* @param string $column Column in which the element appears.
*/
public function __construct(
$model,
TemplateFactory $templateFactory,
Translator $translator,
MapProvider $mapProvider,
\Input $input,
\Config $config,
$column = null
) {
parent::__construct($model, $templateFactory, $translator, $column);
$this->mapProvider = $mapProvider;
$this->input = $input;
$this->config = $config;
}
/**
* Do the frontend integration generation.
*
* @return string
*/
public function generate()
{
$this->mapProvider->handleAjaxRequest($this->getIdentifier());
if (TL_MODE === 'BE') {
$model = MapModel::findByPk($this->get('leaflet_map'));
$template = $this->getTemplateFactory()->createBackendTemplate('be_wildcard');
if ($model) {
$href = 'contao/main.php?do=leaflet&amp;table=tl_leaflet_map&amp;act=edit&amp;id=' . $model->id;
$template->set('wildcard', '### LEAFLET MAP ' . $model->title . ' ###');
$template->set('title', $this->get('headline'));
$template->set('id', $model->id);
$template->set('link', $model->title);
$template->set('href', $href);
}
return $template->parse();
}
return parent::generate();
}
/**
* Do the frontend integration compiling.
*
* @return void
*
* @throws \Exception If the map could not be created.
*
* @SuppressWarnings(PHPMD.Superglobals)
*/
protected function compile()
{
try {
$template = $this->get('leaflet_template') ?: 'leaflet_map_js';
$mapId = $this->getIdentifier();
$map = $this->mapProvider->generate($this->get('leaflet_map'), null, $mapId, $template);
$this->template->set('javascript', $map);
$this->template->set('mapId', $mapId);
$style = '';
$height = deserialize($this->get('leaflet_height'), true);
$width = deserialize($this->get('leaflet_width'), true);
if (!empty($width['value'])) {
$style .= 'width:' . $width['value'] . $width['unit'] . ';';
}
if (!empty($height['value'])) {
$style .= 'height:' . $height['value'] . $height['unit'] . ';';
}
$this->template->set('mapStyle', $style);
} catch (\Exception $e) {
throw $e;
}
}
/**
* Get the component identifier which is used as unique name.
*
* @return string
*/
abstract protected function getIdentifier();
}

View File

@@ -12,7 +12,7 @@
namespace Netzmacht\Contao\Leaflet\Frontend;
use Netzmacht\Contao\Leaflet\Filter\Filter;
use Netzmacht\Contao\Leaflet\MapService;
use Netzmacht\Contao\Leaflet\MapProvider;
/**
* The data controller handles ajax request for sub data.
@@ -22,11 +22,11 @@ use Netzmacht\Contao\Leaflet\MapService;
class DataController
{
/**
* The map service.
* The map provider.
*
* @var MapService
* @var MapProvider
*/
private $mapService;
private $mapProvider;
/**
* The user input data.
@@ -40,39 +40,59 @@ class DataController
'filter' => null,
'values' => null
);
/**
* Filters configuration.
*
* @var array
*/
private $filters;
/**
* Display errors.
*
* @var bool
*/
private $displayErrors;
/**
* Construct.
*
* @param MapService $mapService The map service.
* @param array $input The user input as array.
* @param MapProvider $mapProvider The map provider.
* @param array $filters Filters configuration.
* @param bool $displayErrors Display errors.
*/
public function __construct(MapService $mapService, $input)
public function __construct(MapProvider $mapProvider, array $filters, $displayErrors)
{
$this->mapService = $mapService;
$this->input = array_merge($this->input, $input);
$this->mapProvider = $mapProvider;
$this->filters = $filters;
$this->displayErrors = $displayErrors;
}
/**
* Execute the controller and create the data response.
*
* @param array $input The user input as array.
*
* @return void
*
* @throws \Exception If anything went wrong.
*/
public function execute()
public function execute(array $input)
{
$input = array_merge($this->input, $input);
try {
if ($this->input['filter']) {
$filter = $this->createFilter();
if ($input['filter']) {
$filter = $this->createFilter($input);
} else {
$filter = null;
}
list($data, $error) = $this->loadData($this->input['type'], $this->input['id'], $filter);
$this->encodeData($this->input['format'], $data);
list($data, $error) = $this->loadData($input['type'], $input['id'], $filter);
$this->encodeData($input['format'], $data);
} catch (\Exception $e) {
if (\Config::get('debugMode') || \Config::get('displayErrors')) {
if ($this->displayErrors) {
throw $e;
}
$error = true;
@@ -120,7 +140,7 @@ class DataController
switch ($type) {
case 'layer':
$data = $this->mapService->getFeatureCollection($dataId, $filter);
$data = $this->mapProvider->getFeatureCollection($dataId, $filter);
break;
default:
@@ -135,20 +155,22 @@ class DataController
/**
* Create a filter.
*
* @param array $input The user input as array.
*
* @return Filter
* @throws \RuntimeException If the filter is not defined.
*
* @SuppressWarnings(PHPMD.Superglobals)
*/
private function createFilter()
private function createFilter($input)
{
if (!isset($GLOBALS['LEAFLET_FILTERS'][$this->input['filter']])) {
throw new \RuntimeException(sprintf('Undefined filter "%s".', $this->input['filter']));
if (!isset($this->filters[$input['filter']])) {
throw new \RuntimeException(sprintf('Undefined filter "%s".', $input['filter']));
}
/** @var Filter $filter */
$filter = $GLOBALS['LEAFLET_FILTERS'][$this->input['filter']];
$filter = $this->filters[$input['filter']];
return $filter::fromRequest($this->input['values']);
return $filter::fromRequest($input['values']);
}
}

View File

@@ -1,129 +0,0 @@
<?php
/**
* @package dev
* @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2015 netzmacht creative David Molineus
* @license LGPL 3.0
* @filesource
*
*/
namespace Netzmacht\Contao\Leaflet\Frontend;
use Netzmacht\Contao\Leaflet\MapService;
use Netzmacht\Contao\Leaflet\Model\MapModel;
/**
* Class HybridTrait provides method required by the frontend module and content element the same time.
*
* @package Netzmacht\Contao\Leaflet\Frontend
*/
trait HybridTrait
{
/**
* The map service.
*
* @var MapService
*/
private $mapService;
/**
* The user input.
*
* @var \Input
*/
private $input;
/**
* The Contao config.
*
* @var \Config
*/
private $config;
/**
* Construct.
*
* @param \ContentModel $objElement Content element model.
* @param string $strColumn Layout column.
*
* @return void
*/
protected function construct($objElement, $strColumn = 'main')
{
parent::__construct($objElement, $strColumn);
$this->mapService = static::getService('leaflet.map.service');
$this->input = static::getService('input');
$this->config = static::getService('config');
}
/**
* Do the frontend integration generation.
*
* @return string
*/
public function generate()
{
$this->mapService->handleAjaxRequest($this->getIdentifier());
if (TL_MODE === 'BE') {
$model = MapModel::findByPK($this->leaflet_map);
$template = new \BackendTemplate('be_wildcard');
if ($model) {
$href = 'contao/main.php?do=leaflet&amp;table=tl_leaflet_map&amp;act=edit&amp;id=' . $model->id;
$template->wildcard = '### LEAFLET MAP ' . $model->title . ' ###';
$template->title = $this->headline;
$template->id = $model->id;
$template->link = $model->title;
$template->href = $href;
}
return $template->parse();
}
return parent::generate();
}
/**
* Do the frontend integration compiling.
*
* @return void
*
* @throws \Exception If the map could not be created.
*
* @SuppressWarnings(PHPMD.Superglobals)
*/
protected function compile()
{
try {
$template = $this->leaflet_template ?: 'leaflet_map_js';
$mapId = $this->getIdentifier();
$map = $this->mapService->generate($this->leaflet_map, null, $mapId, $template);
$GLOBALS['TL_BODY'][] = '<script>' . $map .'</script>';
$this->Template->mapId = $mapId;
$style = '';
$height = deserialize($this->leaflet_height, true);
$width = deserialize($this->leaflet_width, true);
if (!empty($width['value'])) {
$style .= 'width:' . $width['value'] . $width['unit'] . ';';
}
if (!empty($height['value'])) {
$style .= 'height:' . $height['value'] . $height['unit'] . ';';
}
$this->Template->mapStyle = $style;
} catch (\Exception $e) {
throw $e;
}
}
}

View File

@@ -11,7 +11,7 @@
namespace Netzmacht\Contao\Leaflet\Frontend\InsertTag;
use Netzmacht\Contao\Leaflet\MapService;
use Netzmacht\Contao\Leaflet\MapProvider;
use Netzmacht\Contao\Toolkit\InsertTag\Parser;
/**
@@ -31,9 +31,9 @@ class LeafletInsertTagParser implements Parser
/**
* The map service.
*
* @var MapService
* @var MapProvider
*/
private $mapService;
private $mapProvider;
/**
* Debug mode.
@@ -45,13 +45,13 @@ class LeafletInsertTagParser implements Parser
/**
* LeafletInsertTagParser constructor.
*
* @param MapService $mapService Map service.
* @param bool $debugMode Debug mode.
* @param MapProvider $mapProvider Map provider.
* @param bool $debugMode Debug mode.
*/
public function __construct(MapService $mapService, $debugMode)
public function __construct(MapProvider $mapProvider, $debugMode)
{
$this->mapService = $mapService;
$this->debugMode = $debugMode;
$this->mapProvider = $mapProvider;
$this->debugMode = $debugMode;
}
/**
@@ -101,7 +101,7 @@ class LeafletInsertTagParser implements Parser
private function generateMap($mapId, $template, $style)
{
try {
return $this->mapService->generate($mapId, null, $mapId, $template, $style);
return $this->mapProvider->generate($mapId, null, $mapId, $template, $style);
} catch (\Exception $e) {
if ($this->debugMode) {
throw $e;

View File

@@ -11,34 +11,19 @@
namespace Netzmacht\Contao\Leaflet\Frontend;
use ContentElement;
use Netzmacht\Contao\Toolkit\ServiceContainerTrait;
use Netzmacht\Contao\Leaflet\MapService;
/**
* The content element for the leaflet map.
*
* @property int leaflet_map
*/
class MapElement extends \ContentElement
class MapElement extends AbstractMapHybrid
{
use ServiceContainerTrait;
use HybridTrait;
/**
* Template name.
*
* @var string
*/
protected $strTemplate = 'ce_leaflet_map';
/**
* {@inheritdoc}
*/
public function __construct($objElement, $strColumn = 'main')
{
$this->construct($objElement, $strColumn);
}
protected $templateName = 'ce_leaflet_map';
/**
* Get the identifier.
@@ -47,14 +32,14 @@ class MapElement extends \ContentElement
*/
protected function getIdentifier()
{
if ($this->leaflet_mapId) {
return $this->leaflet_mapId;
if ($this->get('leaflet_mapId')) {
return $this->get('leaflet_mapId');
}
if ($this->cssID[0]) {
return 'map_' . $this->cssID[0];
if ($this->get('cssID')[0]) {
return 'map_' . $this->get('cssID')[0];
}
return 'map_ce_' . $this->id;
return 'map_ce_' . $this->get('id');
}
}

View File

@@ -11,33 +11,19 @@
namespace Netzmacht\Contao\Leaflet\Frontend;
use Netzmacht\Contao\Toolkit\ServiceContainerTrait;
use Netzmacht\Contao\Leaflet\MapService;
/**
* The frontend module for the Leaflet map.
*
* @package Netzmacht\Contao\Leaflet\Frontend
*/
class MapModule extends \Module
class MapModule extends AbstractMapHybrid
{
use ServiceContainerTrait;
use HybridTrait;
/**
* Template name.
*
* @var string
*/
protected $strTemplate = 'mod_leaflet_map';
/**
* {@inheritdoc}
*/
public function __construct($objElement, $strColumn = 'main')
{
$this->construct($objElement, $strColumn);
}
protected $templateName = 'mod_leaflet_map';
/**
* Get the identifier.
@@ -46,14 +32,14 @@ class MapModule extends \Module
*/
protected function getIdentifier()
{
if ($this->leaflet_mapId) {
return $this->leaflet_mapId;
if ($this->get('leaflet_mapId')) {
return $this->get('leaflet_mapId');
}
if ($this->cssID[0]) {
return 'map_' . $this->cssID[0];
if ($this->get('cssID')[0]) {
return 'map_' . $this->get('cssID')[0];
}
return 'map_mod_' . $this->id;
return 'map_mod_' . $this->get('id');
}
}

View File

@@ -11,6 +11,7 @@
namespace Netzmacht\Contao\Leaflet;
use Doctrine\Common\Cache\Cache;
use Netzmacht\Contao\Leaflet\Event\GetJavascriptEvent;
use Netzmacht\Contao\Leaflet\Filter\Filter;
use Netzmacht\Contao\Leaflet\Frontend\DataController;
@@ -18,18 +19,17 @@ use Netzmacht\Contao\Leaflet\Frontend\RequestUrl;
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
use Netzmacht\Contao\Leaflet\Model\LayerModel;
use Netzmacht\Contao\Leaflet\Model\MapModel;
use Netzmacht\LeafletPHP\Assets;
use Netzmacht\LeafletPHP\Value\GeoJson\FeatureCollection;
use Netzmacht\LeafletPHP\Definition\Map;
use Netzmacht\LeafletPHP\Leaflet;
use Symfony\Component\EventDispatcher\EventDispatcherInterface as EventDispatcher;
/**
* Class MapService.
* Class MapProvider.
*
* @package Netzmacht\Contao\Leaflet
*/
class MapService
class MapProvider
{
/**
* The definition mapper.
@@ -62,10 +62,31 @@ class MapService
/**
* Map assets collector.
*
* @var Assets
* @var ContaoAssets
*/
private $assets;
/**
* Request filters configuration.
*
* @var array
*/
private $filters;
/**
* Display errors setting.
*
* @var bool
*/
private $displayErrors;
/**
* Cache.
*
* @var Cache
*/
private $cache;
/**
* Construct.
*
@@ -73,20 +94,29 @@ class MapService
* @param Leaflet $leaflet The Leaflet instance.
* @param EventDispatcher $eventDispatcher The Contao event dispatcher.
* @param \Input $input Thw request input.
* @param Assets $assets Assets handler.
* @param ContaoAssets $assets Assets handler.
* @param Cache $cache Cache.
* @param array $filters Request filters configuration.
* @param bool $displayErrors Display errors setting.
*/
public function __construct(
DefinitionMapper $mapper,
Leaflet $leaflet,
EventDispatcher $eventDispatcher,
\Input $input,
Assets $assets
ContaoAssets $assets,
Cache $cache,
array $filters,
$displayErrors
) {
$this->mapper = $mapper;
$this->leaflet = $leaflet;
$this->eventDispatcher = $eventDispatcher;
$this->input = $input;
$this->assets = $assets;
$this->filters = $filters;
$this->displayErrors = $displayErrors;
$this->cache = $cache;
}
/**
@@ -145,9 +175,6 @@ class MapService
*
* @return string
* @throws \Exception If generating went wrong.
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
*/
public function generate(
$mapId,
@@ -156,23 +183,38 @@ class MapService
$template = 'leaflet_map_js',
$style = ''
) {
$definition = $this->getDefinition($mapId, $filter, $elementId);
$template = \Controller::getTemplate($template);
if ($mapId instanceof MapModel) {
$model = $mapId;
$mapId = $mapId->id;
} else {
$model = $this->getModel($mapId);
}
// @codingStandardsIgnoreStart - Set for the template.
$javascript = $this->leaflet->build($definition, $this->assets);
$mapId = $definition->getId();
// @codingStandardsIgnoreEnd
if ($model->cache) {
$cacheKey = $this->getCacheKey($mapId, $filter, $elementId, $template, $style);
ob_start();
include $template;
$content = ob_get_contents();
ob_end_clean();
if ($this->cache->contains($cacheKey)) {
$cached = $this->cache->fetch($cacheKey);
$this->assets->fromArray($cached['assets']);
$event = new GetJavascriptEvent($definition, $content);
$this->eventDispatcher->dispatch($event::NAME, $event);
return $cached['javascript'];
}
}
return $event->getJavascript();
$buffer = $this->doGenerate($mapId, $filter, $elementId, $template, $model, $style);
if ($model->cache) {
$this->cache->save(
$cacheKey,
[
'assets' => $this->assets->toArray(),
'javascript' => $buffer
],
(int) $model->cacheLifeTime
);
}
return $buffer;
}
/**
@@ -197,7 +239,23 @@ class MapService
throw new \InvalidArgumentException(sprintf('Could not find layer "%s"', $layerId));
}
return $this->mapper->handleGeoJson($model, $filter);
if (!$model->cache) {
return $this->mapper->handleGeoJson($model, $filter);
}
$cacheKey = 'feature_layer_' . $model->id;
if ($filter) {
$cacheKey .= '.filter_' . md5($filter->toRequest());
}
if ($this->cache->contains($cacheKey)) {
return $this->cache->fetch($cacheKey);
}
$collection = $this->mapper->handleGeoJson($model, $filter);
$this->cache->save($cacheKey, $collection, $model->cacheLifeTime);
return $collection;
}
/**
@@ -232,12 +290,83 @@ class MapService
return;
}
$controller = new DataController($this, $data);
$controller->execute();
$controller = new DataController($this, $this->filters, $this->displayErrors);
$controller->execute($data);
if ($exit) {
exit;
}
}
}
/**
* Get the cache key.
*
* @param int $mapId The map database id.
* @param Filter|null $filter Optional request filter.
* @param string $elementId Optional element id. If none given the mapId or alias is used.
* @param string $template The template being used for generating.
* @param string $style Optional style attributes.
*
* @return string
*/
protected function getCacheKey($mapId, $filter, $elementId, $template, $style)
{
$cacheKey = 'map_' . $mapId;
if ($filter) {
$cacheKey .= '.filter_' . md5($filter->toRequest());
}
if ($elementId) {
$cacheKey .= '.element_' . $elementId;
}
$cacheKey .= '.template_' . $template;
if ($style) {
$cacheKey .= '.style_' . md5($style);
return $cacheKey;
}
return $cacheKey;
}
/**
* Do the generating of the map.
*
* @param MapModel $model Map model.
* @param Filter|null $filter Optional request filter.
* @param string $elementId Optional element id. If none given the mapId or alias is used.
* @param string $template The template being used for generating.
* @param string $style Optional style attributes.
*
* @return string
*
* @SuppressWarnings(PHPMD.UnusedFormalParameter)
* @SuppressWarnings(PHPMD.UnusedLocalVariable)
*/
protected function doGenerate($model, $filter, $elementId, $template, $style)
{
$definition = $this->getDefinition($model, $filter, $elementId);
$template = \Controller::getTemplate($template);
// @codingStandardsIgnoreStart - Set for the template.
$javascript = $this->leaflet->build($definition, $this->assets);
$mapId = $definition->getId();
// @codingStandardsIgnoreEnd
ob_start();
include $template;
$content = ob_get_contents();
ob_end_clean();
$event = new GetJavascriptEvent($definition, $content);
$this->eventDispatcher->dispatch($event::NAME, $event);
$buffer = $event->getJavascript();
return $buffer;
}
}

View File

@@ -11,9 +11,11 @@
namespace Netzmacht\Contao\Leaflet\Mapper\Layer;
use Netzmacht\Contao\Leaflet\ContaoAssets;
use Netzmacht\Contao\Leaflet\Filter\Filter;
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
use Netzmacht\Contao\Leaflet\Model\LayerModel;
use Netzmacht\Contao\Toolkit\View\Assets\AssetsManager;
use Netzmacht\JavascriptBuilder\Type\AnonymousFunction;
use Netzmacht\JavascriptBuilder\Type\Expression;
use Netzmacht\LeafletPHP\Definition;
@@ -42,6 +44,25 @@ class MarkerClusterLayerMapper extends AbstractLayerMapper
*/
protected static $type = 'markercluster';
/**
* Assets manager.
*
* @var ContaoAssets
*/
private $assets;
/**
* MarkerClusterLayerMapper constructor.
*
* @param ContaoAssets $assets Assets manager.
*/
public function __construct(ContaoAssets $assets)
{
parent::__construct();
$this->assets = $assets;
}
/**
* {@inheritdoc}
*/
@@ -61,7 +82,6 @@ class MarkerClusterLayerMapper extends AbstractLayerMapper
/**
* {@inheritdoc}
* @SuppressWarnings(PHPMD.Superglobals)
*/
protected function build(
Definition $definition,
@@ -83,7 +103,7 @@ class MarkerClusterLayerMapper extends AbstractLayerMapper
}
if (!$model->disableDefaultStyle) {
$GLOBALS['TL_CSS'][] = 'assets/leaflet/libs/leaflet-markercluster/MarkerCluster.Default.css||static';
$this->assets->addStylesheet('assets/leaflet/libs/leaflet-markercluster/MarkerCluster.Default.css');
}
$collection = LayerModel::findBy(

View File

@@ -40,11 +40,11 @@ class ProviderLayerMapper extends AbstractLayerMapper
/**
* Construct.
*
* @SuppressWarnings(PHPMD.Superglobals)
* @param array $providers Registered providers.
*/
public function __construct()
public function __construct(array $providers)
{
$this->providers = &$GLOBALS['LEAFLET_TILE_PROVIDERS'];
$this->providers = $providers;
parent::__construct();
}

View File

@@ -14,6 +14,7 @@ namespace Netzmacht\Contao\Leaflet\Mapper;
use Netzmacht\Contao\Leaflet\Filter\Filter;
use Netzmacht\Contao\Leaflet\Model\ControlModel;
use Netzmacht\Contao\Leaflet\Model\MapModel;
use Netzmacht\JavascriptBuilder\Type\Expression;
use Netzmacht\LeafletPHP\Definition;
use Netzmacht\LeafletPHP\Definition\Control;
use Netzmacht\LeafletPHP\Definition\Layer;
@@ -98,7 +99,11 @@ class MapMapper extends AbstractMapper
protected function buildCustomOptions(Map $map, MapModel $model)
{
if ($model->options) {
$map->setOptions(json_decode($model->options, true));
$options = json_decode($model->options, true);
if (is_array($options)) {
$map->setOptions($options);
}
}
$map->setOption('dynamicLoad', (bool) $model->dynamicLoad);

View File

@@ -12,6 +12,7 @@
namespace Netzmacht\Contao\Leaflet\Mapper;
use Netzmacht\LeafletPHP\Definition;
use Netzmacht\LeafletPHP\Definition\HasOptions;
/**
* Class OptionsBuilder handles the option mapping between the database model and the definition.
@@ -236,7 +237,7 @@ class OptionsBuilder
if (method_exists($definition, $setter)) {
$definition->$setter($value);
} else {
} elseif ($definition instanceof HasOptions) {
$definition->setOption($option, $value);
}
}

View File

@@ -69,7 +69,7 @@ class AbstractVectorMapper extends AbstractTypeMapper
parent::build($definition, $model, $mapper, $filter);
if ($definition instanceof Path && $model->style) {
$styleModel = StyleModel::findActiveByPk($model->style);
$styleModel = StyleModel::findActiveByPK($model->style);
if ($styleModel) {
$style = $mapper->handle($styleModel);

View File

@@ -14,6 +14,7 @@ namespace Netzmacht\Contao\Leaflet\Mapper\Vector;
use Netzmacht\Contao\Leaflet\Filter\Filter;
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
use Netzmacht\LeafletPHP\Definition;
use Netzmacht\LeafletPHP\Definition\Vector\CircleMarker;
use Netzmacht\LeafletPHP\Value\LatLng;
use Netzmacht\LeafletPHP\Definition\Vector\Circle;
@@ -60,7 +61,7 @@ class CircleMapper extends AbstractVectorMapper
) {
parent::build($definition, $model, $mapper, $filter);
if ($definition instanceof Circle) {
if ($definition instanceof CircleMarker) {
$definition->setLatLng(LatLng::fromString($model->coordinates));
}
}

View File

@@ -11,8 +11,6 @@
namespace Netzmacht\Contao\Leaflet\Mapper\Vector;
use Netzmacht\LeafletPHP\Definition;
/**
* Class CircleMarkerMapper maps the database model to the circle marker definition.
*

View File

@@ -14,7 +14,7 @@ namespace Netzmacht\Contao\Leaflet\Mapper\Vector;
use Netzmacht\Contao\Leaflet\Filter\Filter;
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
use Netzmacht\LeafletPHP\Definition;
use Netzmacht\LeafletPHP\Definition\Vector\MultiPolygon;
use Netzmacht\LeafletPHP\Definition\Vector\Polygon;
/**
* Class MultiPolygonMapper maps the multi polygon database model to its definition.
@@ -28,7 +28,7 @@ class MultiPolygonMapper extends MultiPolylineMapper
*
* @var string
*/
protected static $definitionClass = 'Netzmacht\LeafletPHP\Definition\Vector\MultiPolygon';
protected static $definitionClass = 'Netzmacht\LeafletPHP\Definition\Vector\Polygon';
/**
* Layer type.
@@ -49,7 +49,7 @@ class MultiPolygonMapper extends MultiPolylineMapper
) {
parent::build($definition, $model, $mapper, $filter);
if ($definition instanceof MultiPolygon) {
if ($definition instanceof Polygon) {
$this->createLatLngs($definition, $model);
}
}

View File

@@ -14,8 +14,8 @@ namespace Netzmacht\Contao\Leaflet\Mapper\Vector;
use Netzmacht\Contao\Leaflet\Filter\Filter;
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
use Netzmacht\LeafletPHP\Definition;
use Netzmacht\LeafletPHP\Definition\Vector\Polyline;
use Netzmacht\LeafletPHP\Value\LatLng;
use Netzmacht\LeafletPHP\Definition\Vector\MultiPolyline;
/**
* Class MultiPolylineMapper maps the databse model it the multi polyline definition.
@@ -29,7 +29,7 @@ class MultiPolylineMapper extends AbstractVectorMapper
*
* @var string
*/
protected static $definitionClass = 'Netzmacht\LeafletPHP\Definition\Vector\MultiPolyline';
protected static $definitionClass = 'Netzmacht\LeafletPHP\Definition\Vector\Polyline';
/**
* Layer type.
@@ -50,7 +50,7 @@ class MultiPolylineMapper extends AbstractVectorMapper
) {
parent::build($definition, $model, $mapper, $filter);
if ($definition instanceof MultiPolyline) {
if ($definition instanceof Polyline) {
$this->createLatLngs($definition, $model);
}
}
@@ -58,24 +58,22 @@ class MultiPolylineMapper extends AbstractVectorMapper
/**
* Create lat lngs for the definition.
*
* @param MultiPolyline $definition The multi polyline.
* @param \Model $model The definition model.
* @param Polyline $definition The multi polyline.
* @param \Model $model The definition model.
*
* @return void
*/
protected function createLatLngs(MultiPolyline $definition, \Model $model)
protected function createLatLngs(Polyline $definition, \Model $model)
{
$latLngs = array();
foreach (deserialize($model->multiData, true) as $data) {
$latLngs[] = array_map(
foreach (deserialize($model->multiData, true) as $ring => $data) {
$latLngs = array_map(
function ($row) {
return LatLng::fromString($row);
},
explode("\n", $data)
);
}
$definition->setLatLngs($latLngs);
$definition->addLatLngs($latLngs, $ring);
}
}
}

View File

@@ -17,6 +17,8 @@ use Model\Collection;
* Class MapModel for the tl_leaflet_map table.
*
* @property mixed|null locate
* @property mixed|null title
*
* @package Netzmacht\Contao\Leaflet\Model
*/
class MapModel extends \Model

View File

@@ -1,61 +0,0 @@
<?php
/**
* @package dev
* @author David Molineus <david.molineus@netzmacht.de>
* @copyright 2015 netzmacht creative David Molineus
* @license LGPL 3.0
* @filesource
*
*/
namespace Netzmacht\Contao\Leaflet;
use Netzmacht\Contao\Leaflet\Frontend\ValueFilter;
/**
* Class ServiceContainer provides the services which are available for Contao leaflet.
*
* @package Netzmacht\Contao\Leaflet
*/
class ServiceContainer
{
/**
* The global service container.
*
* @var \Pimple
*/
private $container;
/**
* Construct.
*
* @param \Pimple $container The global service container.
*/
public function __construct(\Pimple $container)
{
$this->container = $container;
}
/**
* Get the value filter service.
*
* @return ValueFilter
*/
public function getFrontendValueFilter()
{
return $this->getService('leaflet.frontend.value-filter');
}
/**
* Get a service from the container.
*
* @param string $name The service name.
*
* @return mixed
*/
public function getService($name)
{
return $this->container[$name];
}
}

View File

@@ -12,6 +12,8 @@
namespace Netzmacht\Contao\Leaflet\Subscriber;
use ContaoCommunityAlliance\Contao\EventDispatcher\EventDispatcherInitializer;
use Netzmacht\Contao\Leaflet\ContaoAssets;
use Netzmacht\Contao\Leaflet\DependencyInjection\LeafletServices;
use Netzmacht\Contao\Leaflet\Event\GetJavascriptEvent;
use Netzmacht\Contao\Leaflet\Event\InitializeDefinitionMapperEvent;
use Netzmacht\Contao\Leaflet\Event\InitializeEventDispatcherEvent;
@@ -20,7 +22,9 @@ use Netzmacht\Contao\Leaflet\Frontend\InsertTag\LeafletInsertTagParser;
use Netzmacht\Contao\Leaflet\Mapper\DefinitionMapper;
use Netzmacht\Contao\Leaflet\Mapper\Mapper;
use Netzmacht\Contao\Leaflet\Model\IconModel;
use Netzmacht\Contao\Toolkit\Event\InitializeSystemEvent;
use Netzmacht\Contao\Toolkit\Boot\Event\InitializeSystemEvent;
use Netzmacht\Contao\Toolkit\DependencyInjection\Services;
use Netzmacht\Contao\Toolkit\View\Assets\AssetsManager;
use Netzmacht\LeafletPHP\Assets;
use Netzmacht\LeafletPHP\Definition\Type\ImageIcon;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
@@ -32,6 +36,61 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
*/
class BootSubscriber implements EventSubscriberInterface
{
/**
* Leaflet mapper configuration.
*
* @var array
*/
private $mappers;
/**
* Leaflet encoder configuration.
*
* @var array
*/
private $encoders;
/**
* Leaflet libraries configuration.
*
* @var array
*/
private $libraries;
/**
* Assets manager.
*
* @var ContaoAssets
*/
private $assets;
/**
* Definition mapper.
*
* @var DefinitionMapper
*/
private $definitionMapper;
/**
* BootSubscriber constructor.
*
* @param ContaoAssets $assets Leaflet assets manager.
* @param array $mappers Leaflet mapper configuration.
* @param array $encoders Leaflet encoder configuration.
* @param array $libraries Leaflet libraries configuration.
*/
public function __construct(
ContaoAssets $assets,
array $mappers,
array $encoders,
array $libraries
) {
$this->assets = $assets;
$this->mappers = $mappers;
$this->encoders = $encoders;
$this->libraries = $libraries;
}
/**
* {@inheritdoc}
*/
@@ -55,12 +114,12 @@ class BootSubscriber implements EventSubscriberInterface
*/
public function initializeInsertTagParser(InitializeSystemEvent $event)
{
$container = $event->getServiceContainer();
$debugMode = $container->getConfig()->get('debugMode');
$mapService = $container->getService('leaflet.map.service');
$parser = new LeafletInsertTagParser($mapService, $debugMode);
$container = $event->getContainer();
$debugMode = $container->get(Services::CONFIG)->get('debugMode');
$mapProvider = $container->get(LeafletServices::MAP_PROVIDER);
$parser = new LeafletInsertTagParser($mapProvider, $debugMode);
$container->getInsertTagReplacer()->registerParser($parser);
$container->get(Services::INSERT_TAG_REPLACER)->registerParser($parser);
}
/**
@@ -69,14 +128,13 @@ class BootSubscriber implements EventSubscriberInterface
* @param InitializeDefinitionMapperEvent $event The subscribed event.
*
* @return void
*
* @SuppressWarnings(PHPMD.Superglobals)
*/
public function initializeDefinitionMapper(InitializeDefinitionMapperEvent $event)
{
$mapper = $event->getDefinitionMapper();
$mapper = $event->getDefinitionMapper();
$this->definitionMapper = $mapper;
foreach ($GLOBALS['LEAFLET_MAPPERS'] as $className) {
foreach ($this->mappers as $className) {
if (is_array($className)) {
$mapper->register($this->createMapper($className[0]), $className[1]);
} else {
@@ -91,15 +149,13 @@ class BootSubscriber implements EventSubscriberInterface
* @param InitializeEventDispatcherEvent $event The subscribed event.
*
* @return void
*
* @SuppressWarnings(PHPMD.Superglobals)
*/
public function initializeEventDispatcher(InitializeEventDispatcherEvent $event)
{
$dispatcher = $event->getEventDispatcher();
$initializer = new EventDispatcherInitializer();
$initializer->addSubscribers($dispatcher, $GLOBALS['LEAFLET_ENCODERS']);
$initializer->addSubscribers($dispatcher, $this->encoders);
}
/**
@@ -108,14 +164,12 @@ class BootSubscriber implements EventSubscriberInterface
* @param InitializeLeafletBuilderEvent $event The subscribed event.
*
* @return void
*
* @SuppressWarnings(PHPMD.Superglobals)
*/
public function initializeLeafletBuilder(InitializeLeafletBuilderEvent $event)
{
$builder = $event->getBuilder();
foreach ($GLOBALS['LEAFLET_LIBRARIES'] as $name => $assets) {
foreach ($this->libraries as $name => $assets) {
if (!empty($assets['css'])) {
list ($source, $type) = (array) $assets['css'];
$builder->registerStylesheet($name, $source, $type ?: Assets::TYPE_FILE);
@@ -132,34 +186,32 @@ class BootSubscriber implements EventSubscriberInterface
* Load Contao leaflet assets.
*
* @return void
*
* @SuppressWarnings(PHPMD.Superglobals)
*/
public function loadAssets()
{
$GLOBALS['TL_JAVASCRIPT'][] = 'assets/leaflet/maps/contao-leaflet.js' . $this->staticFlag();
$this->assets->addJavascript('assets/leaflet/maps/contao-leaflet.js', ContaoAssets::TYPE_FILE);
}
/**
* Load icons.
*
* @return void
*
* @SuppressWarnings(PHPMD.Superglobals)
*/
public function loadIcons()
{
if (!$this->definitionMapper) {
return;
}
$collection = IconModel::findBy('active', true);
if ($collection) {
/** @var DefinitionMapper $mapper */
$mapper = $GLOBALS['container']['leaflet.definition.mapper'];
$buffer = '';
$icons = array();
foreach ($collection as $model) {
/** @var ImageIcon $icon */
$icon = $mapper->handle($model);
$icon = $this->definitionMapper->handle($model);
$icons[] = array(
'id' => $icon->getId(),
'type' => lcfirst($icon->getType()),
@@ -178,39 +230,21 @@ class BootSubscriber implements EventSubscriberInterface
// @codingStandardsIgnoreStart
// TODO: Cache it.
// codingStandardsIgnoreEnd
$GLOBALS['TL_JAVASCRIPT'][] = 'assets/leaflet/js/icons.js' . $this->staticFlag();
$this->assets->addJavascript('assets/leaflet/js/icons.js', ContaoAssets::TYPE_FILE);
}
}
/**
* Set the static flag.
*
* @return string
*/
private function staticFlag()
{
if (\Config::get('debugMode') || TL_MODE !== 'FE') {
return '';
}
return '|static';
}
/**
* Create a new mapper.
*
* @param mixed $mapper The mapper class or callable factory.
*
* @return Mapper
*
* @SuppressWarnings(PHPMD.Superglobals)
*/
private function createMapper($mapper)
{
if (is_callable($mapper)) {
$container = $GLOBALS['container']['leaflet.service-container'];
return $mapper($container);
return $mapper();
}
return new $mapper;

View File

@@ -11,7 +11,7 @@
namespace Netzmacht\Contao\Leaflet\Subscriber;
use Netzmacht\Contao\Leaflet\Dca\Vector;
use Netzmacht\Contao\Leaflet\Dca\VectorCallbacks;
use Netzmacht\Contao\Leaflet\Event\ConvertToGeoJsonEvent;
use Netzmacht\Contao\Leaflet\Model\LayerModel;
use Netzmacht\LeafletPHP\Value\GeoJson\Feature;
@@ -28,6 +28,23 @@ use Symfony\Component\EventDispatcher\EventSubscriberInterface;
*/
class GeoJsonSubscriber implements EventSubscriberInterface
{
/**
* Property mapping between models and features.
*
* @var array
*/
private $featureModelProperties;
/**
* GeoJsonSubscriber constructor.
*
* @param array $featureModelProperties Property mapping between models and features.
*/
public function __construct(array $featureModelProperties)
{
$this->featureModelProperties = $featureModelProperties;
}
/**
* {@inheritdoc}
*/
@@ -83,7 +100,7 @@ class GeoJsonSubscriber implements EventSubscriberInterface
$definition = $event->getDefinition();
$model = $event->getModel();
if (($definition instanceof Marker || $definition instanceof Vector)
if (($definition instanceof Marker || $definition instanceof VectorCallbacks)
&& $model instanceof \Model && $feature instanceof Feature) {
$this->setDataProperty($model, $feature);
$this->setBoundsInformation($model, $feature);
@@ -113,7 +130,6 @@ class GeoJsonSubscriber implements EventSubscriberInterface
* @param ConvertToGeoJsonEvent $event The subscribed events.
*
* @return void
* @SuppressWarnings(PHPMD.Superglobals)
*/
public function setModelData(ConvertToGeoJsonEvent $event)
{
@@ -121,11 +137,11 @@ class GeoJsonSubscriber implements EventSubscriberInterface
$model = $event->getModel();
if (!$model instanceof \Model || !$feature instanceof Feature
|| empty($GLOBALS['LEAFLET_FEATURE_MODEL_PROPERTIES'][$model->getTable()])) {
|| empty($this->featureModelProperties[$model->getTable()])) {
return;
}
$mapping = $GLOBALS['LEAFLET_FEATURE_MODEL_PROPERTIES'][$model->getTable()];
$mapping = $this->featureModelProperties[$model->getTable()];
$data = (array) $feature->getProperty('model');
foreach ((array) $mapping as $property) {