Add reference layer.

This commit is contained in:
David Molineus
2015-01-09 15:24:34 +01:00
parent efb36256c7
commit 8e35dc1fef
15 changed files with 149 additions and 24 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 730 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 634 B

View File

@@ -16,7 +16,7 @@ array_insert(
'tl_leaflet_map',
'tl_leaflet_control',
),
'icon' => 'system/modules/leaflet/assets/img/leaflet.png',
'icon' => 'system/modules/leaflet/assets/img/map.png',
'stylesheet' => 'system/modules/leaflet/assets/css/backend.css',
),
'leaflet_layer' => array
@@ -67,6 +67,7 @@ $GLOBALS['LEAFLET_MAPPERS'][] = 'Netzmacht\Contao\Leaflet\Mapper\Layer\ProviderL
$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';
// Control mappers.
$GLOBALS['LEAFLET_MAPPERS'][] = 'Netzmacht\Contao\Leaflet\Mapper\Control\ZoomControlMapper';
@@ -122,6 +123,17 @@ $GLOBALS['LEAFLET_LAYERS'] = array
(
'children' => false,
'icon' => 'system/modules/leaflet/assets/img/tile.png',
'label' => function ($row, $label) {
if (!empty($GLOBALS['TL_LANG']['leaflet_provider'][$row['tile_provider']][0])) {
$provider = $GLOBALS['TL_LANG']['leaflet_provider'][$row['tile_provider']][0];
} else {
$provider = $row['tile_provider'];
}
$label .= sprintf('<span class="tl_gray"> (%s)</span>', $provider);
return $label;
}
),
'group' => array
(
@@ -133,13 +145,47 @@ $GLOBALS['LEAFLET_LAYERS'] = array
'children' => false,
'icon' => 'system/modules/leaflet/assets/img/markers.png',
'markers' => true,
'label' => function ($row, $label) {
$count = \Netzmacht\Contao\Leaflet\Model\MarkerModel::countBy('pid', $row['id']);
$label .= sprintf(
'<span class="tl_gray"> (%s %s)</span>',
$count,
$GLOBALS['TL_LANG']['tl_leaflet_layer']['countEntries']
);
return $label;
}
),
'vectors' => array
(
'children' => false,
'icon' => 'system/modules/leaflet/assets/img/vectors.png',
'vectors' => true,
'label' => function ($row, $label) {
$count = \Netzmacht\Contao\Leaflet\Model\VectorModel::countBy('pid', $row['id']);
$label .= sprintf(
'<span class="tl_gray"> (%s %s)</span>',
$count,
$GLOBALS['TL_LANG']['tl_leaflet_layer']['countEntries']
);
return $label;
}
),
'reference' => array
(
'children' => false,
'icon' => 'system/modules/leaflet/assets/img/reference.png',
'label' => function ($row, $label) {
$reference = \Netzmacht\Contao\Leaflet\Model\LayerModel::findByPk($row['reference']);
if ($reference) {
$label .= '<span class="tl_gray"> (' . $reference->title . ')</span>';
}
return $label;
}
)
);
/*

View File

@@ -136,6 +136,9 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
'vectors extends default' => array(
'+active' => array('deferred'),
),
'reference extends default' => array(
'+title' => array('reference')
)
),
'metasubselectpalettes' => array(
@@ -294,5 +297,19 @@ $GLOBALS['TL_DCA']['tl_leaflet_layer'] = array
'reference' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['groupTypes'],
'sql' => "varchar(32) NOT NULL default ''"
),
'reference' => array
(
'label' => &$GLOBALS['TL_LANG']['tl_leaflet_layer']['reference'],
'exclude' => true,
'inputType' => 'select',
'options_callback' => array('Netzmacht\Contao\Leaflet\Dca\Layer', 'getLayers'),
'eval' => array(
'mandatory' => true,
'tl_class' => 'w50',
'chosen' => true,
'includeBlankOption' => true,
),
'sql' => "int(10) unsigned NOT NULL default '0'",
),
)
);

View File

@@ -11,14 +11,16 @@ $GLOBALS['TL_LANG']['leaflet_control']['scale'][1] = 'A simple scale contr
$GLOBALS['TL_LANG']['leaflet_control']['loading'][0] = 'Loading indicator';
$GLOBALS['TL_LANG']['leaflet_control']['loading'][1] = 'Leaflet.loading is a simple loading indicator implemented as control. For more details read the <a href="https://github.com/ebrelsford/Leaflet.loading" target="_blank">Plugin documentation</a>.';
$GLOBALS['TL_LANG']['leaflet_layer']['provider'][0] = 'Leaflet provider';
$GLOBALS['TL_LANG']['leaflet_layer']['provider'][1] = 'Leaflet tile provider. For more details read the <a href="https://github.com/leaflet-extras/leaflet-providers" target="_blank">plugin documentation</a>.';
$GLOBALS['TL_LANG']['leaflet_layer']['group'][0] = 'Layer group';
$GLOBALS['TL_LANG']['leaflet_layer']['group'][1] = 'Layer groups combines different layers. For more details read the <a href="http://leafletjs.com/reference.html#layergroup" target="_blank">Leaflet documentation</a>. ';
$GLOBALS['TL_LANG']['leaflet_layer']['markers'][0] = 'Markers';
$GLOBALS['TL_LANG']['leaflet_layer']['markers'][1] = 'Layer containing Markers.';
$GLOBALS['TL_LANG']['leaflet_layer']['vectors'][0] = 'Vectors';
$GLOBALS['TL_LANG']['leaflet_layer']['vectors'][1] = 'Vectors layer containing vectors like polygons, polylines, etc.';
$GLOBALS['TL_LANG']['leaflet_layer']['provider'][0] = 'Leaflet provider';
$GLOBALS['TL_LANG']['leaflet_layer']['provider'][1] = 'Leaflet tile provider. For more details read the <a href="https://github.com/leaflet-extras/leaflet-providers" target="_blank">plugin documentation</a>.';
$GLOBALS['TL_LANG']['leaflet_layer']['group'][0] = 'Layer group';
$GLOBALS['TL_LANG']['leaflet_layer']['group'][1] = 'Layer groups combines different layers. For more details read the <a href="http://leafletjs.com/reference.html#layergroup" target="_blank">Leaflet documentation</a>. ';
$GLOBALS['TL_LANG']['leaflet_layer']['markers'][0] = 'Markers';
$GLOBALS['TL_LANG']['leaflet_layer']['markers'][1] = 'Layer containing Markers.';
$GLOBALS['TL_LANG']['leaflet_layer']['vectors'][0] = 'Vectors';
$GLOBALS['TL_LANG']['leaflet_layer']['vectors'][1] = 'Vectors layer containing vectors like polygons, polylines, etc.';
$GLOBALS['TL_LANG']['leaflet_layer']['reference'][0] = 'Reference';
$GLOBALS['TL_LANG']['leaflet_layer']['reference'][1] = 'The reference layer is a link to another layer.';
$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>.';

View File

@@ -36,6 +36,8 @@ $GLOBALS['TL_LANG']['tl_leaflet_layer']['tile_provider_variant'][0] = 'Tile vari
$GLOBALS['TL_LANG']['tl_leaflet_layer']['tile_provider_variant'][1] = 'Tile variant style.';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['active'][0] = 'Activate layer';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['active'][1] = 'Activate layer on the map.';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['reference'][0] = 'Reference';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['reference'][1] = 'Choose the reference layer.';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['markerCluster'][0] = 'Marker cluster';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['markerCluster'][1] = 'Choose a marker cluster layer so that markers get clustered.';
$GLOBALS['TL_LANG']['tl_leaflet_layer']['deferred'][0] = 'Deferred loading';
@@ -47,3 +49,5 @@ $GLOBALS['TL_LANG']['tl_leaflet_layer']['groupTypes']['layer'][0] = 'Layer gro
$GLOBALS['TL_LANG']['tl_leaflet_layer']['groupTypes']['layer'][1] = 'Basic layer group. <br> See <a href="http://leafletjs.com/reference.html#layergroup" target="_blank">http://leafletjs.com/reference.html#layergroup</a>';
$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']['countEntries'] = 'Entries';