Skip to content

Commit

Permalink
add copyright info field
Browse files Browse the repository at this point in the history
  • Loading branch information
jonnysp committed Oct 28, 2020
1 parent f7a1dbd commit 55598f4
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 8 deletions.
5 changes: 3 additions & 2 deletions src/Resources/contao/classes/MapViewer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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],
Expand Down
15 changes: 10 additions & 5 deletions src/Resources/contao/dca/tl_map.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
(
Expand All @@ -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'],
Expand Down
3 changes: 3 additions & 0 deletions src/Resources/contao/languages/de/tl_map.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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
Expand Down
3 changes: 3 additions & 0 deletions src/Resources/contao/languages/en/tl_map.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand All @@ -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
Expand Down
4 changes: 3 additions & 1 deletion src/Resources/contao/templates/ce_mapviewer.html5
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,13 @@

map = L.map('map_<?= $this->id; ?>').setView(default_pos, default_zoom);

L.tileLayer("<?= $this->Map['titleURL'] ?>", {
L.tileLayer('<?= $this->Map['titleURL'] ?>', {
maxZoom: max_zoom,
minZoom: min_zoom,
}).addTo(map);

map.attributionControl.setPrefix('<?= $this->Map['copyright'] ?>');

$(points).each(function(index, value) {

if( value.info == true){
Expand Down

0 comments on commit 55598f4

Please sign in to comment.