diff --git a/README.MD b/README.MD index 11c0991..1aae58f 100644 --- a/README.MD +++ b/README.MD @@ -56,9 +56,13 @@ Phoca Maps Plugin is a Joomla! plugin. With Phoca Maps Plugin you can display on + + + + ## Version -3.0.10 +3.0.12 diff --git a/content-phocamaps-release.png b/content-phocamaps-release.png index 585cfed..4eebeae 100644 Binary files a/content-phocamaps-release.png and b/content-phocamaps-release.png differ diff --git a/manifest.xml b/manifest.xml index c7fed25..3e6b780 100644 --- a/manifest.xml +++ b/manifest.xml @@ -5,10 +5,10 @@ phocamaps content plugin - 3.0.10 - https://www.phoca.cz/ + 3.0.12 + https://www.phoca.cz/ - https://github.com/PhocaCz/PhocaMapsPlugin/releases/download/3.0.10/plg_content_phocamaps_v3.0.10.zip + https://github.com/PhocaCz/PhocaMapsPlugin/releases/download/3.0.12/plg_content_phocamaps_v3.0.12.zip stable diff --git a/phocamaps.php b/phocamaps.php index b2fea06..f4b61b4 100644 --- a/phocamaps.php +++ b/phocamaps.php @@ -159,6 +159,7 @@ public function onContentPrepare($context, &$article, &$params, $page = 0) { $db->setQuery($query); $mapp = $db->loadObject(); + if (empty($mapp)) { echo '
'. JText::_('PLG_CONTENT_PHOCAMAPS_PLUGIN_ERROR') . ' - '. JText::_('PLG_CONTENT_PHOCAMAPS_MAP_NOT_EXISTS') . ' (ID = '.$idMap.')
'; return false; @@ -428,7 +429,14 @@ public function onContentPrepare($context, &$article, &$params, $page = 0) { $output .= $map->setTypeControlOpt($mapp->typecontrol, $mapp->typecontrolposition).','."\n"; $output .= $map->setNavigationControlOpt($mapp->zoomcontrol).','."\n"; $output .= $map->setMapOption('scaleControl', $mapp->scalecontrol, TRUE ).','."\n"; - $output .= $map->setMapOption('scrollwheel', $mapp->scrollwheelzoom).','."\n"; + //$output .= $map->setMapOption('scrollwheel', $mapp->scrollwheelzoom).','."\n"; + + if ($mapp->gesturehandling != '') { + $output .= $map->setMapOption('gestureHandling', '"' . $mapp->gesturehandling . '"').','."\n"; + } else { + $output .= $map->setMapOption('scrollwheel', $mapp->scrollwheelzoom).','."\n"; + } + $output .= $map->setMapOption('disableDoubleClickZoom', $mapp->disabledoubleclickzoom).','."\n"; // $output .= $map->setMapOption('googleBar', $mapp->googlebar).','."\n";// Not ready yet // $output .= $map->setMapOption('continuousZoom', $mapp->continuouszoom).','."\n";// Not ready yet @@ -534,6 +542,45 @@ public function onContentPrepare($context, &$article, &$params, $page = 0) { } else { + //OSM tracks + if ($tmpl['map_type'] == 2) { + + $tmpl['fitbounds'] = $mapp->fitbounds_osm; + $textarea = $mapp->trackfiles_osm; + $textarea = str_replace(array("\r\n", "\n", "\r"),'',$textarea); + $tracks = explode(",",$textarea); + + $textarea = $mapp->trackcolors_osm; + $textarea = str_replace(array("\r\n", "\n", "\r"),'',$textarea); + //$colors = explode(",",$textarea); + $colors = array_map('trim', explode(',', $textarea)); + + $tracksA = array(); + foreach ($tracks as $k => $v) { + $v = trim($v); + $ext = pathinfo($v,PATHINFO_EXTENSION); + + if (($ext != 'gpx') && ($ext != 'kml')) { + $v = ''; + } else { + //if no path specified add default path (hardcoded to /phocamapskml for now) + if (strpos($v,'/') === false) { + $v = 'phocamapskml/'.$v; + } + $v = trim($v,'/'); + + $tracksA[$k] = array(); + $tracksA[$k]['file'] = JFile::exists(JPATH_ROOT.'/'.$v) ? JURI::base().$v : ''; + $tracksA[$k]['color'] = isset($colors[$k]) ? $colors[$k] : ''; + } + } + $tmpl['tracks'] = $tracksA; + } else { + $tmpl['tracks'] = array(); + } + + + $map = new PhocaMapsMapOsm($id); @@ -636,6 +683,17 @@ public function onContentPrepare($context, &$article, &$params, $page = 0) { if ($tmpl['osm_easyprint'] == 1) { $map->renderEasyPrint(); } + + if (!empty($tmpl['tracks'])) { + foreach ($tmpl['tracks'] as $ky=>$trk) { + $fitbounds = $ky==0 ? $tmpl['fitbounds'] : false; + if (isset($trk['file'])) { + $map->renderTrack($trk['file'], $trk['color'], $fitbounds); + } + } + } + + $map->renderMap(); ########################### END OPENSTREETMAP diff --git a/phocamaps.xml b/phocamaps.xml index bd49437..e323808 100644 --- a/phocamaps.xml +++ b/phocamaps.xml @@ -2,12 +2,12 @@ plg_content_phocamaps Jan Pavelka (www.phoca.cz) - 19/12/2020 + 04/07/2021 https://www.phoca.cz Jan Pavelka GNU/GPL - 3.0.10 + 3.0.12 PLG_CONTENT_PHOCAMAPS_DESCRIPTION PhocaMapsPlugin