Ongoing development.

This commit is contained in:
David Molineus
2014-12-29 16:23:08 +01:00
parent e5d11e8ed6
commit ee9d293d2e
8 changed files with 60 additions and 20 deletions

View File

@@ -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',
);
@@ -17,7 +17,8 @@ $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_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')
)
);

View 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';

View File

@@ -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();

View File

@@ -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 -->