Skip to content

Commit

Permalink
Merge pull request #86 from mschwemer/v11_compat
Browse files Browse the repository at this point in the history
Provide V11 Compatibility

Ok. Thank you @mschwemer for your contribution. I'll merge this and will make the release asap.
  • Loading branch information
Alexander Bigga authored May 31, 2022
2 parents 3b2f056 + ac04cb3 commit 136006f
Show file tree
Hide file tree
Showing 19 changed files with 117 additions and 33 deletions.
19 changes: 19 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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

1 change: 1 addition & 0 deletions Classes/Controller/PluginController.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
1 change: 1 addition & 0 deletions Classes/Div.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
18 changes: 13 additions & 5 deletions Classes/Provider/Leaflet.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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/[email protected]/dist/');
$pageRenderer = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(PageRenderer::class);
$pageRenderer->addCssFile($this->path_leaflet . 'leaflet.css');
Expand Down Expand Up @@ -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;

Expand All @@ -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':
Expand All @@ -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;
Expand Down Expand Up @@ -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
Expand Down
11 changes: 5 additions & 6 deletions Classes/Provider/Openlayers.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
Expand All @@ -164,17 +164,16 @@ 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,
'offset_x' => -11,
'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)) {
Expand Down
8 changes: 7 additions & 1 deletion Classes/Provider/Openlayers3.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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');
Expand Down
1 change: 1 addition & 0 deletions Classes/Wizard/CoordinatepickerWizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 ...)
Expand Down
21 changes: 21 additions & 0 deletions Configuration/Icons.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

declare(strict_types=1);

use TYPO3\CMS\Core\Imaging\IconProvider\BitmapIconProvider;

$iconPath = 'EXT:ods_osm/Resources/Public/Icons/';
return [
'coordinate-picker-wizard' => [
'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',
],
];
3 changes: 2 additions & 1 deletion Configuration/TCA/Overrides/fe_groups.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
if (!defined('TYPO3_MODE')) die('Access denied.');

defined('TYPO3') || die();

/* --------------------------------------------------
Extend existing tables
Expand Down
3 changes: 2 additions & 1 deletion Configuration/TCA/Overrides/fe_users.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
if (!defined('TYPO3_MODE')) die('Access denied.');

defined('TYPO3') || die();

$tempColumns = array(
'tx_odsosm_lon' => array( // DECIMAL(9,6)
Expand Down
3 changes: 2 additions & 1 deletion Configuration/TCA/Overrides/sys_category.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
if (!defined('TYPO3_MODE')) die('Access denied.');

defined('TYPO3') || die();

/* --------------------------------------------------
Extend existing tables
Expand Down
3 changes: 2 additions & 1 deletion Configuration/TCA/Overrides/sys_template.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php
defined('TYPO3_MODE') or die();

defined('TYPO3') || die();

\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile(
'ods_osm',
Expand Down
4 changes: 1 addition & 3 deletions Configuration/TCA/Overrides/tt_content.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php

if ( ! defined( 'TYPO3_MODE' ) ) {
die( 'Access denied.' );
}
defined('TYPO3') || die();

/* --------------------------------------------------
Plugin
Expand Down
1 change: 1 addition & 0 deletions Documentation/Index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,4 @@ EXT: OpenStreetMap
Editors/Index
Administrators/Index
Tutorial/Index
Conribution/Index
File renamed without changes
29 changes: 27 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
],
"license": "GPL-2.0-or-later",
"require": {
"typo3/cms-core": "~9.5.26|~10.4.14",
"typo3/cms-core": "^10.4 || ^11.5",
"phayes/geophp": "^1.2"
},
"suggest": {
Expand All @@ -38,7 +38,32 @@
},
"extra": {
"typo3/cms": {
"extension-key": "ods_osm"
"extension-key": "ods_osm",
"web-dir": ".Build/public"
}
},
"require-dev": {
"friendsoftypo3/tt-address": "^6.0",
"helhum/typo3-console": "^7.0",
"typo3/cms-backend": "^11.5.6",
"typo3/cms-extbase": "^11.5.6",
"typo3/cms-extensionmanager": "^11.5.6",
"typo3/cms-filelist": "^11.5.6",
"typo3/cms-fluid": "dev-master",
"typo3/cms-fluid-styled-content": "^11.5.6",
"typo3/cms-frontend": "^11.5.6",
"typo3/cms-install": "^11.5.6",
"typo3/cms-recordlist": "^11.5.6",
"typo3/cms-setup": "^11.5.6",
"typo3/cms-tstemplate": "^11.5.6",
"typo3/cms-lowlevel": "^11.5.6"
},
"config": {
"vendor-dir": ".Build/vendor",
"bin-dir": ".Build/bin",
"allow-plugins": {
"typo3/cms-composer-installers": true,
"typo3/class-alias-loader": true
}
}
}
4 changes: 2 additions & 2 deletions ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@
'category' => 'plugin',
'constraints' => [
'depends' => [
'typo3' => '9.5.0-10.4.99',
'typo3' => '10.4.0-11.5.99',
],
'conflicts' => [],
'suggests' => [],
],
'createDirs' => 'uploads/tx_odsosm/map',
'state' => 'stable',
'uploadfolder' => 1,
'version' => '3.2.0',
'version' => '4.0.0-dev',
];
16 changes: 9 additions & 7 deletions ext_localconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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] = '';
Expand Down Expand Up @@ -63,6 +66,5 @@
}

$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['ext/install']['update']['odsOsmFileLocationUpdater']
= \Bobosch\OdsOsm\Updates\FileLocationUpdater::class;

= \Bobosch\OdsOsm\Updates\FileLocationUpdater::class;
}
4 changes: 1 addition & 3 deletions ext_tables.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?php

if ( ! defined( 'TYPO3_MODE' ) ) {
die( 'Access denied.' );
}
defined('TYPO3') || die();

/* --------------------------------------------------
New tables
Expand Down

0 comments on commit 136006f

Please sign in to comment.