diff --git a/.gitignore b/.gitignore index c79132a..3132a05 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,21 @@ .vscode Documentation-GENERATED-temp + +.Build +.idea +nbproject +.DS_Store +.DS_Store? + +composer.lock +package-lock.json + +/.php_cs +/.php_cs.cache + +.ddev/** +.project/** + +/var +/config + diff --git a/Classes/Controller/PluginController.php b/Classes/Controller/PluginController.php index 4418707..d2b19d1 100644 --- a/Classes/Controller/PluginController.php +++ b/Classes/Controller/PluginController.php @@ -236,6 +236,7 @@ private function extractGroup($record_ids) // if no markers are set, select current page to find records on it if (count($record_ids) == 0) { + //@extensionScannerIgnoreLine $record_ids['pages'] = array($GLOBALS['TSFE']->id); } diff --git a/Classes/Div.php b/Classes/Div.php index 71f2142..b997d13 100644 --- a/Classes/Div.php +++ b/Classes/Div.php @@ -17,6 +17,7 @@ class Div { + const RESOURCE_BASE_PATH = 'EXT:ods_osm/Resources/Public/'; public static function getConstraintsForQueryBuilder($table, ContentObjectRenderer $cObj, \TYPO3\CMS\Core\Database\Query\QueryBuilder $queryBuilder) : array diff --git a/Classes/Provider/Leaflet.php b/Classes/Provider/Leaflet.php index 00617ee..c2e1015 100644 --- a/Classes/Provider/Leaflet.php +++ b/Classes/Provider/Leaflet.php @@ -2,6 +2,7 @@ namespace Bobosch\OdsOsm\Provider; +use Bobosch\OdsOsm\Div; use TYPO3\CMS\Core\Core\Environment; use TYPO3\CMS\Core\Page\PageRenderer; use TYPO3\CMS\Core\Resource\FileRepository; @@ -22,7 +23,11 @@ class Leaflet extends BaseProvider public function getMapCore($backpath = '') { - $this->path_res = ($backpath ? $backpath : $GLOBALS['TSFE']->absRefPrefix) . PathUtility::stripPathSitePrefix(ExtensionManagementUtility::extPath('ods_osm')) . 'Resources/Public/JavaScript/Leaflet/'; + $this->path_res = ($backpath ? $backpath : + PathUtility::getAbsoluteWebPath( + GeneralUtility::getFileAbsFileName(Div::RESOURCE_BASE_PATH . 'JavaScript/Leaflet/') + ) + ); $this->path_leaflet = ($this->config['local_js'] ? $this->path_res . 'Core/' : 'https://unpkg.com/leaflet@1.7.1/dist/'); $pageRenderer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(PageRenderer::class); $pageRenderer->addCssFile($this->path_leaflet . 'leaflet.css'); @@ -165,7 +170,9 @@ protected function getMarker($item, $table) break; } - $path = $GLOBALS['TSFE']->absRefPrefix . PathUtility::stripPathSitePrefix(ExtensionManagementUtility::extPath('ods_osm')) . 'Resources/Public/JavaScript/Leaflet/'; + $path = PathUtility::getAbsoluteWebPath( + GeneralUtility::getFileAbsFileName(Div::RESOURCE_BASE_PATH . 'JavaScript/Leaflet/') + ); // Add tracks to layerswitcher $this->layers[1][$item['title']] = $jsElementVar; @@ -175,7 +182,7 @@ protected function getMarker($item, $table) $this->scripts['leaflet-plugins'] = ['src' => $path . 'leaflet-plugins/layer/vector/KML.js']; $jsMarker .= 'var ' . $jsElementVar . ' = new L.KML('; - $jsMarker .= '"/' . $file->getPublicUrl() . '"'; + $jsMarker .= '"' . $file->getPublicUrl() . '"'; $jsMarker .= ");\n"; break; case 'gpx': @@ -192,7 +199,8 @@ protected function getMarker($item, $table) 'shadowUrl' => $path . 'leaflet-gpx/pin-shadow.png', ), ); - $jsMarker .= 'var ' . $jsElementVar . ' = new L.GPX("/' . $file->getPublicUrl() . '",'; + $jsMarker .= 'var ' . $jsElementVar . ' = new L.GPX("' . $file->getPublicUrl() . '",'; + $jsMarker .= json_encode($options) . ");\n"; $jsMarker .= $this->config['id'] . '.addLayer(' . $jsElementVar . ');' . "\n"; break; @@ -258,7 +266,7 @@ protected function getMarker($item, $table) $markerOptions['icon'] = 'icon: new L.Icon(' . json_encode($iconOptions) . ')'; } } else { - $icon = $GLOBALS['TSFE']->absRefPrefix . PathUtility::stripPathSitePrefix(ExtensionManagementUtility::extPath('ods_osm')) . 'Resources/Public/JavaScript/Leaflet/Core/images/marker-icon.png'; + $icon = $this->path_leaflet . 'Core/images/marker-icon.png'; } $jsMarker .= 'var ' . $jsElementVar . ' = new L.Marker([' . $item['latitude'] . ', ' . $item['longitude'] . '], {' . implode(',', $markerOptions) . "});\n"; // Add group to layer switch diff --git a/Classes/Provider/Openlayers.php b/Classes/Provider/Openlayers.php index 4283fbe..f639e60 100644 --- a/Classes/Provider/Openlayers.php +++ b/Classes/Provider/Openlayers.php @@ -16,7 +16,7 @@ class Openlayers extends BaseProvider public function getMapCore($backpath = '') { - $path = ($backpath ? $backpath : $GLOBALS['TSFE']->absRefPrefix) . PathUtility::stripPathSitePrefix(ExtensionManagementUtility::extPath('ods_osm')) . 'Resources/Public/'; + $path = ($backpath ? $backpath : Div::RESOURCE_BASE_PATH); if ($this->config['local_js']) { $this->scripts['Openlayers'] = ['src' => $path . 'OpenLayers/OpenLayers.js']; } else { @@ -145,7 +145,7 @@ protected function getMarker($item, $table) } else { break; } - $jsMarker .= "mapGpx(" . $this->config['id'] . ",'/" . $file->getPublicUrl() . "','" . $item['title'] . "','" . $item['color'] . "'," . $item['width'] . ");\n"; + $jsMarker .= "mapGpx(" . $this->config['id'] . ",'" . $file->getPublicUrl() . "','" . $item['title'] . "','" . $item['color'] . "'," . $item['width'] . ");\n"; break; case 'tx_odsosm_vector': $fileRepository = GeneralUtility::makeInstance(FileRepository::class); @@ -164,7 +164,9 @@ protected function getMarker($item, $table) $marker = $item['tx_odsosm_marker']; } else { $marker = array( - 'icon' => PathUtility::stripPathSitePrefix(ExtensionManagementUtility::extPath('ods_osm')) . 'Resources/Public/OpenLayers/img/marker.png', + 'icon' => PathUtility::getAbsoluteWebPath( + GeneralUtility::getFileAbsFileName(Div::RESOURCE_BASE_PATH . 'OpenLayers/img/marker.png') + ), 'type' => 'image', 'size_x' => 21, 'size_y' => 25, @@ -172,9 +174,6 @@ protected function getMarker($item, $table) 'offset_y' => -25 ); } - if ($marker['type'] != 'html') { - $marker['icon'] = $GLOBALS['TSFE']->absRefPrefix . $marker['icon']; - } // Add group to layer switch if (!in_array($item['group_title'], $this->group_titles)) { diff --git a/Classes/Provider/Openlayers3.php b/Classes/Provider/Openlayers3.php index c38ce3a..afab545 100644 --- a/Classes/Provider/Openlayers3.php +++ b/Classes/Provider/Openlayers3.php @@ -2,7 +2,9 @@ namespace Bobosch\OdsOsm\Provider; +use Bobosch\OdsOsm\Div; use TYPO3\CMS\Core\Page\PageRenderer; +use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Utility\PathUtility; use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; @@ -12,7 +14,11 @@ class Openlayers3 extends BaseProvider public function getMapCore($backpath = '') { - $path = ($backpath ? $backpath : $GLOBALS['TSFE']->absRefPrefix) . PathUtility::stripPathSitePrefix(ExtensionManagementUtility::extPath('ods_osm')) . 'Resources/Public/'; + $path = ($backpath ? $backpath : + PathUtility::getAbsoluteWebPath( + GeneralUtility::getFileAbsFileName(Div::RESOURCE_BASE_PATH) + ) + ); $path = ($this->config['local_js'] ? $path . 'OpenLayers3/' : 'https://cdnjs.cloudflare.com/ajax/libs/openlayers/3.20.1/'); $pageRenderer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(PageRenderer::class); $pageRenderer->addCssFile($path . 'ol.css'); diff --git a/Classes/Wizard/CoordinatepickerWizard.php b/Classes/Wizard/CoordinatepickerWizard.php index 44d36e7..afae285 100644 --- a/Classes/Wizard/CoordinatepickerWizard.php +++ b/Classes/Wizard/CoordinatepickerWizard.php @@ -45,6 +45,7 @@ public function render(): array $nameLatitude = str_replace('lon', 'lat', $nameLongitude); $nameLatitudeActive = str_replace('data', 'control[active]', $nameLatitude); $geoCodeUrl = ''; + $geoCodeUrlShort = ''; if (empty((float)$lat) || empty((float)$lon)) { // remove all after first slash in address (top, floor ...) diff --git a/Configuration/Icons.php b/Configuration/Icons.php new file mode 100644 index 0000000..3dd8c5e --- /dev/null +++ b/Configuration/Icons.php @@ -0,0 +1,21 @@ + [ + 'provider' => BitmapIconProvider::class, + 'source' => $iconPath . 'ce_wiz.png', + ], + 'vectordraw-wizard' => [ + 'provider' => BitmapIconProvider::class, + 'source' => $iconPath . 'vector.png', + ], + 'ods_osm' => [ + 'provider' => BitmapIconProvider::class, + 'source' => $iconPath . 'osm.png', + ], +]; diff --git a/Configuration/TCA/Overrides/fe_groups.php b/Configuration/TCA/Overrides/fe_groups.php index 99f71ec..834c7ac 100644 --- a/Configuration/TCA/Overrides/fe_groups.php +++ b/Configuration/TCA/Overrides/fe_groups.php @@ -1,5 +1,6 @@ array( // DECIMAL(9,6) diff --git a/Configuration/TCA/Overrides/sys_category.php b/Configuration/TCA/Overrides/sys_category.php index b94d732..e61944f 100644 --- a/Configuration/TCA/Overrides/sys_category.php +++ b/Configuration/TCA/Overrides/sys_category.php @@ -1,5 +1,6 @@ 'plugin', 'constraints' => [ 'depends' => [ - 'typo3' => '9.5.0-10.4.99', + 'typo3' => '10.4.0-11.5.99', ], 'conflicts' => [], 'suggests' => [], @@ -15,5 +15,5 @@ 'createDirs' => 'uploads/tx_odsosm/map', 'state' => 'stable', 'uploadfolder' => 1, - 'version' => '3.2.0', + 'version' => '4.0.0-dev', ]; diff --git a/ext_localconf.php b/ext_localconf.php index cfd4e93..57286eb 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -11,8 +11,8 @@ ); if (TYPO3_MODE === 'BE') { - - \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig(' + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig( + ' mod.wizards.newContentElement.wizardItems.plugins.elements.odsosm { iconIdentifier = ods_osm_wizard title = LLL:EXT:ods_osm/Resources/Private/Language/locallang.xlf:pi1_title @@ -24,11 +24,14 @@ } mod.wizards.newContentElement.wizardItems.plugins.show := addToList(odsosm) - '); + ' + ); - \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addUserTSConfig(' + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addUserTSConfig( + ' options.saveDocNew.tx_odsosm_track=1 - '); + ' + ); $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_tcemain.php']['processDatamapClass'][] = \Bobosch\OdsOsm\TceMain::class; $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['tce']['formevals'][\Bobosch\OdsOsm\Evaluation\LonLat::class] = ''; @@ -63,6 +66,5 @@ } $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['odsOsmFileLocationUpdater'] - = \Bobosch\OdsOsm\Updates\FileLocationUpdater::class; - + = \Bobosch\OdsOsm\Updates\FileLocationUpdater::class; } diff --git a/ext_tables.php b/ext_tables.php index 788413f..a6ea5a8 100644 --- a/ext_tables.php +++ b/ext_tables.php @@ -1,8 +1,6 @@