forked from Snck3rs/contao-leaflet-maps
Ongoing development.
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
* Backend module.
|
||||
*/
|
||||
$GLOBALS['BE_MOD']['content']['leaflet'] = array(
|
||||
'tables' => array('tl_leaflet_map'),
|
||||
'tables' => array('tl_leaflet_map', 'tl_leaflet_layer'),
|
||||
'icon' => 'system/modules/leaflet/assets/img/leaflet.png',
|
||||
);
|
||||
|
||||
@@ -18,6 +18,7 @@ $GLOBALS['TL_CTE']['includes']['leaflet'] = 'Netzmacht\Contao\Leaflet\LeafletMap
|
||||
* Models.
|
||||
*/
|
||||
$GLOBALS['TL_MODELS']['tl_leaflet_map'] = 'Netzmacht\Contao\Leaflet\Model\MapModel';
|
||||
$GLOBALS['TL_MODELS']['tl_leaflet_layer'] = 'Netzmacht\Contao\Leaflet\Model\LayerModel';
|
||||
|
||||
|
||||
/*
|
||||
@@ -27,7 +28,7 @@ $GLOBALS['TL_MODELS']['tl_leaflet_map'] = 'Netzmacht\Contao\Leaflet\Model\MapMod
|
||||
*/
|
||||
$GLOBALS['LEAFLET_MAPPERS'] = array();
|
||||
$GLOBALS['LEAFLET_MAPPERS'][] = 'Netzmacht\Contao\Leaflet\Mapper\MapMapper';
|
||||
|
||||
$GLOBALS['LEAFLET_MAPPERS'][] = 'Netzmacht\Contao\Leaflet\Mapper\Layer\ProviderLayerMapper';
|
||||
|
||||
/*
|
||||
* Leaflet encoders.
|
||||
@@ -48,6 +49,12 @@ $GLOBALS['LEAFLET_ENCODERS'][] = 'Netzmacht\LeafletPHP\Encoder\RasterEncoder';
|
||||
$GLOBALS['LEAFLET_ENCODERS'][] = 'Netzmacht\LeafletPHP\Encoder\VectorEncoder';
|
||||
$GLOBALS['LEAFLET_ENCODERS'][] = 'Netzmacht\Contao\Leaflet\Subscriber\EncoderSubscriber';
|
||||
|
||||
$GLOBALS['LEAFLET_LAYERS'][] = 'provider';
|
||||
|
||||
/*
|
||||
* Leaflet tile layer providers.
|
||||
*/
|
||||
require_once __DIR__ . '/leaflet_providers.php';
|
||||
|
||||
/*
|
||||
* Leaflet assets.
|
||||
@@ -60,17 +67,17 @@ $GLOBALS['LEAFLET_ENCODERS'][] = 'Netzmacht\Contao\Leaflet\Subscriber\EncoderSub
|
||||
* - file: An file path relative to the Contao Root.
|
||||
* - source: Inline css/javascript.
|
||||
*/
|
||||
$GLOBALS['LEAFLET_ASSETS']['contao'] = array(
|
||||
$GLOBALS['LEAFLET_ASSETS']['leaflet'] = array(
|
||||
'css' => array(
|
||||
array('system/modules/leaflet/assets/leaflet/leaflet/leaflet.css', 'file')
|
||||
),
|
||||
'javascript' => array(
|
||||
array()
|
||||
array('system/modules/leaflet/assets/leaflet/leaflet/leaflet.js', 'file')
|
||||
)
|
||||
);
|
||||
|
||||
$GLOBALS['LEAFLET_ASSETS']['leaflet'] = array(
|
||||
'css' => array(
|
||||
array('http://cdn.leafletjs.com/leaflet-0.7.2/leaflet.css', 'url')
|
||||
),
|
||||
$GLOBALS['LEAFLET_ASSETS']['leaflet-providers'] = array(
|
||||
'javascript' => array(
|
||||
array('http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js?3', 'url')
|
||||
array('system/modules/leaflet/assets/leaflet/leaflet-providers/leaflet-providers.js', 'file')
|
||||
)
|
||||
);
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_map']['title_legend'] = 'Title';
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_map']['interaction_legend'] = 'Interaction controls';
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_map']['zoom_legend'] = 'Center and zoom';
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_map']['controls_legend'] = 'Control widgets';
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_map']['expert_legend'] = 'Expert settings';
|
||||
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_map']['title'][0] = 'Title';
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_map']['title'][1] = 'Title of the map.';
|
||||
@@ -40,6 +42,12 @@ $GLOBALS['TL_LANG']['tl_leaflet_map']['maxZoom'][0] = 'Maximum zoom l
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_map']['maxZoom'][1] = 'Maximum zoom level of the map. This overrides any maxZoom set on map layers.';
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_map']['zoomControl'][0] = 'Add default zoom control';
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_map']['zoomControl'][1] = 'Whether the zoom control is added to the map by default.';
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_map']['bounceAtZoomLimits'][0] = 'Bounce at zoom limits';
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_map']['bounceAtZoomLimits'][1] = 'Disable if you don\'t want the map to zoom beyond min/max zoom and then bounce back when pinch-zooming';
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_map']['options'][0] = 'Extra options';
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_map']['options'][1] = 'Add extra map options as valid json. See <a href="http://leafletjs.com/reference.html#map-options">http://leafletjs.com/reference.html#map-options</a>';
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_map']['adjustZoomExtra'][0] = 'Adjust extra zoom settings';
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_map']['adjustZoomExtra'][1] = 'Enable if you want to adjust minimum and maximum zoom as well';
|
||||
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_map']['zoomValues'][''][0] = 'Disable';
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_map']['zoomValues'][''][1] = 'Disable zoom function.';
|
||||
@@ -47,3 +55,6 @@ $GLOBALS['TL_LANG']['tl_leaflet_map']['zoomValues']['1'][0] = 'Enable';
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_map']['zoomValues']['1'][1] = 'Enable zoom function.';
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_map']['zoomValues']['center'][0] = 'Center';
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_map']['zoomValues']['center'][1] = 'If passed \'center\', it will zoom to the center of the view regardless of where the mouse was.';
|
||||
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_map']['searchPosition'] = 'Search';
|
||||
$GLOBALS['TL_LANG']['tl_leaflet_map']['applyPosition'] = 'Apply position';
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
}).addTo(map);
|
||||
var geocoder = L.Control.geocoder({
|
||||
collapsed: false,
|
||||
placeholder: 'Suchen'
|
||||
placeholder: '<?php echo $GLOBALS['TL_LANG']['tl_leaflet_map']['searchPosition']; ?>'
|
||||
}).addTo(map);
|
||||
|
||||
geocoder.markGeocode = function(result) {
|
||||
@@ -21,7 +21,7 @@
|
||||
var element = $('<?php echo $this->field; ?>');
|
||||
|
||||
link.set('style', 'margin-left: 10px;');
|
||||
link.appendText('übernehmen');
|
||||
link.appendText('<?php echo $GLOBALS['TL_LANG']['tl_leaflet_map']['applyPosition']; ?>');
|
||||
link.addEvent('click', function(e) {
|
||||
e.stop();
|
||||
|
||||
|
||||
@@ -1,6 +1,17 @@
|
||||
<!-- indexer::stop -->
|
||||
<div class="<?php echo $this->class; ?> block"<?php echo $this->cssID; ?><?php if ($this->style): ?> style="<?php echo $this->style; ?>"<?php endif; ?>>
|
||||
|
||||
<?php if ($this->headline): ?>
|
||||
<<?php echo $this->hl; ?>><?php echo $this->headline; ?></<?php echo $this->hl; ?>>
|
||||
<?php endif; ?>
|
||||
|
||||
<div id="<?php echo $this->mapId; ?>" style="width: 100%; height: 400px;"></div>
|
||||
<?php if ($this->map): ?>
|
||||
<script>
|
||||
<?php echo $this->map; ?>
|
||||
|
||||
|
||||
</script>
|
||||
<?php endif; ?>
|
||||
|
||||
</div>
|
||||
<!-- indexer::continue -->
|
||||
|
||||
|
||||
@@ -54,7 +54,7 @@ class ContaoAssets implements Assets
|
||||
break;
|
||||
|
||||
case static::TYPE_FILE:
|
||||
$stylesheet .= '||static';
|
||||
$stylesheet .= '|all|static';
|
||||
// no break
|
||||
|
||||
default:
|
||||
|
||||
@@ -14,6 +14,7 @@ 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\LeafletPHP\Definition\Type\LatLng;
|
||||
|
||||
@@ -60,4 +61,17 @@ class Leaflet
|
||||
return $template->parse();
|
||||
}
|
||||
|
||||
public function getLayers()
|
||||
{
|
||||
$options = array();
|
||||
$collection = LayerModel::findBy('pid', '0', array('order' => 'title'));
|
||||
|
||||
if ($collection) {
|
||||
foreach ($collection as $model) {
|
||||
$options[$model->id] = $model->title;
|
||||
}
|
||||
}
|
||||
|
||||
return $options;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,6 +112,6 @@ class BootSubscriber implements EventSubscriberInterface
|
||||
*/
|
||||
public function loadAssets()
|
||||
{
|
||||
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/leaflet/assets/js/contao-leaflet.js';
|
||||
$GLOBALS['TL_JAVASCRIPT'][] = 'system/modules/leaflet/assets/js/contao-leaflet.js|static';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,14 +47,11 @@ class EncoderSubscriber implements EventSubscriberInterface
|
||||
|
||||
if ($object instanceof Map) {
|
||||
$attribution = <<<HTML
|
||||
map.attributionControl.addAttribution(
|
||||
map.map.attributionControl.addAttribution(
|
||||
'<a href="http://www.netzmacht.de/contao-leaflet">netzmacht <em>creative</em></a>'
|
||||
);
|
||||
HTML;
|
||||
$event->getOutput()->addLine($attribution);
|
||||
|
||||
$event->getOutput()->addLine("var tileLayer = new L.TileLayer('http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', { attribution: \"test\"});
|
||||
tileLayer.addTo(map);");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user