diff --git a/src/Resources/contao/classes/MapViewer.php b/src/Resources/contao/classes/MapViewer.php index eabce7d..8d1861f 100644 --- a/src/Resources/contao/classes/MapViewer.php +++ b/src/Resources/contao/classes/MapViewer.php @@ -42,6 +42,7 @@ protected function compile() $Map = array( id => $objMap->id, titleURL => $objMap->titleURL, + copyright => $objMap->copyright, title => $objMap->title, description => $objMap->description, height => $objMap->height, @@ -73,11 +74,11 @@ protected function compile() } - $imagefile = \FilesModel::findByPk($value->image); + $imagemodel = \FilesModel::findByPk($value->image); $points[$key] = array( title => $value->title, - image => $imagefile->path, + image => $imagemodel->path, latitude => $position[0], longitude => $position[1], zoom => $position[2], diff --git a/src/Resources/contao/dca/tl_map.php b/src/Resources/contao/dca/tl_map.php index 0fd8735..cf3b238 100644 --- a/src/Resources/contao/dca/tl_map.php +++ b/src/Resources/contao/dca/tl_map.php @@ -87,12 +87,9 @@ // Palettes 'palettes' => array ( - 'default' => '{title_legend},title,height,titleURL;{zoom_legend},autozoom,minzoom,maxzoom,;{description_legend},description,position;' + 'default' => '{title_legend},title,height,titleURL,copyright;{zoom_legend},autozoom,minzoom,maxzoom;{description_legend},description;{position_legend},position;' ), - - - // Fields 'fields' => array ( @@ -117,9 +114,17 @@ 'label' => &$GLOBALS['TL_LANG']['tl_map']['titleURL'], 'default' => 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', 'inputType' => 'text', - 'eval' => array('mandatory'=>true, 'maxlength'=>128, 'tl_class'=>'w50 clr'), + 'eval' => array('mandatory'=>true, 'maxlength'=>128, 'tl_class'=>'w100 clr'), 'sql' => "varchar(128) NOT NULL default 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'" ), + 'copyright' => array + ( + 'label' => &$GLOBALS['TL_LANG']['tl_map']['copyright'], + 'default' => '', + 'inputType' => 'text', + 'eval' => array('mandatory'=>false, 'allowHtml'=>true,'preserveTags'=>true,'maxlength'=>128, 'tl_class'=>'w100 clr'), + 'sql' => "text NOT NULL default ''" + ), 'description' => array ( 'label' => &$GLOBALS['TL_LANG']['tl_map']['description'], diff --git a/src/Resources/contao/languages/de/tl_map.php b/src/Resources/contao/languages/de/tl_map.php index b171bf0..8b83a95 100644 --- a/src/Resources/contao/languages/de/tl_map.php +++ b/src/Resources/contao/languages/de/tl_map.php @@ -4,6 +4,7 @@ * Fields */ $GLOBALS['TL_LANG']['tl_map']['titleURL'] = array('Title URL', 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'); +$GLOBALS['TL_LANG']['tl_map']['copyright'] = array('Copyright', 'Copyright Information.'); $GLOBALS['TL_LANG']['tl_map']['title'] = array('Map Name', 'Geben Sie hier den Mapnamen ein.'); $GLOBALS['TL_LANG']['tl_map']['description'] = array('Map Beschreibung', 'Mapbeschreibung.'); $GLOBALS['TL_LANG']['tl_map']['height'] = array('Map Höhe', 'Höhe'); @@ -19,6 +20,8 @@ $GLOBALS['TL_LANG']['tl_map']['title_legend'] = 'Map Grundeinstellungen'; $GLOBALS['TL_LANG']['tl_map']['description_legend'] = 'Map Beschreibung'; $GLOBALS['TL_LANG']['tl_map']['zoom_legend'] = 'Zoom Settings'; +$GLOBALS['TL_LANG']['tl_map']['position_legend'] = 'Position'; + /** * Buttons diff --git a/src/Resources/contao/languages/en/tl_map.php b/src/Resources/contao/languages/en/tl_map.php index b171bf0..8b83a95 100644 --- a/src/Resources/contao/languages/en/tl_map.php +++ b/src/Resources/contao/languages/en/tl_map.php @@ -4,6 +4,7 @@ * Fields */ $GLOBALS['TL_LANG']['tl_map']['titleURL'] = array('Title URL', 'https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png'); +$GLOBALS['TL_LANG']['tl_map']['copyright'] = array('Copyright', 'Copyright Information.'); $GLOBALS['TL_LANG']['tl_map']['title'] = array('Map Name', 'Geben Sie hier den Mapnamen ein.'); $GLOBALS['TL_LANG']['tl_map']['description'] = array('Map Beschreibung', 'Mapbeschreibung.'); $GLOBALS['TL_LANG']['tl_map']['height'] = array('Map Höhe', 'Höhe'); @@ -19,6 +20,8 @@ $GLOBALS['TL_LANG']['tl_map']['title_legend'] = 'Map Grundeinstellungen'; $GLOBALS['TL_LANG']['tl_map']['description_legend'] = 'Map Beschreibung'; $GLOBALS['TL_LANG']['tl_map']['zoom_legend'] = 'Zoom Settings'; +$GLOBALS['TL_LANG']['tl_map']['position_legend'] = 'Position'; + /** * Buttons diff --git a/src/Resources/contao/templates/ce_mapviewer.html5 b/src/Resources/contao/templates/ce_mapviewer.html5 index 6e47cd6..65c080d 100644 --- a/src/Resources/contao/templates/ce_mapviewer.html5 +++ b/src/Resources/contao/templates/ce_mapviewer.html5 @@ -43,11 +43,13 @@ map = L.map('map_id; ?>').setView(default_pos, default_zoom); - L.tileLayer("Map['titleURL'] ?>", { + L.tileLayer('Map['titleURL'] ?>', { maxZoom: max_zoom, minZoom: min_zoom, }).addTo(map); + map.attributionControl.setPrefix('Map['copyright'] ?>'); + $(points).each(function(index, value) { if( value.info == true){