Skip to content

Commit

Permalink
Version 1.8.7
Browse files Browse the repository at this point in the history
SingleView shows now correct mapIcon
  • Loading branch information
joachimruhs committed Sep 6, 2023
1 parent 37177fb commit b30856e
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 51 deletions.
24 changes: 3 additions & 21 deletions Classes/Controller/AddressController.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,24 +69,6 @@ public function injectCategoryRepository(\WSR\Myleaflet\Domain\Repository\Catego
$this->categoryRepository = $categoryRepository;
}

/**
* TTAddressRepository
*
* @var \FriendsOfTYPO3\TtAddress\Domain\Repository\AddressRepository
*/
protected $ttaddressRepository;


/**
* Inject a ttaddressRepository to enable DI
*
* @param \FriendsOfTYPO3\TtAddress\Domain\Repository\AddressRepository $ttaddressRepository
* @return void
*/
public function injectTtAddressRepository(\FriendsOfTYPO3\TtAddress\Domain\Repository\AddressRepository $ttaddressRepository) {
$this->ttaddressRepository = $ttaddressRepository;
}


/**
* action show
Expand All @@ -97,11 +79,11 @@ public function showAction()
{
$this->_GP = $this->request->getArguments();
if ($this->_GP['locationUid'] = $this->_GP['locationUid'] ?? 0) {// called from list link
$address = $this->ttaddressRepository->findByUid(intval($this->_GP['locationUid']));
$address = $this->addressRepository->findByUid(intval($this->_GP['locationUid']));
// $address = $this->ttaddressRepository->findAll();
}
else {
$address = $this->ttaddressRepository->findByUid(intval($this->settings['singleViewUid']));
$address = $this->addressRepository->findByUid(intval($this->settings['singleViewUid']));
}
$this->view->assign('address', $address);
return $this->responseFactory->createResponse()
Expand Down Expand Up @@ -201,7 +183,7 @@ public function ajaxSearchAction()
$querySettings->setRespectStoragePage(true);
$querySettings->setStoragePageIds(array($customStoragePid));

$addresses = $this->ttaddressRepository->findAll();
$addresses = $this->addressRepository->findAll();

if ($this->settings['defaultLanguageUid'] > '') {
$querySettings->setLanguageUid($this->settings['defaultLanguageUid']);
Expand Down
23 changes: 2 additions & 21 deletions Classes/Controller/AjaxController.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,25 +68,6 @@ public function injectAddressRepository(AddressRepository $addressRepository) {
$this->addressRepository = $addressRepository;
}

/**
* TTAddressRepository
*
* @var \FriendsOfTYPO3\TtAddress\Domain\Repository\AddressRepository
*/
protected $ttaddressRepository;


/**
* Inject a ttaddressRepository to enable DI
*
* @param \FriendsOfTYPO3\TtAddress\Domain\Repository\AddressRepository $ttaddressRepository
* @return void
*/

public function injectTtAddressRepository(\FriendsOfTYPO3\TtAddress\Domain\Repository\AddressRepository $ttaddressRepository) {
$this->ttaddressRepository = $ttaddressRepository;
}

/**
* categoryRepository
*
Expand Down Expand Up @@ -333,8 +314,8 @@ public function ajaxEidAction() {
$locations[$i]['infoWindowAddress'] = str_replace(array("\r\n", "\r", "\n"), '<br />', htmlspecialchars($address, ENT_QUOTES));

if ($locations[$i]['image'] > 0) {
if ($this->ttaddressRepository->findByUid($locations[$i]['uid'])) {
$images = $this->ttaddressRepository->findByUid($locations[$i]['uid'])->getImage();
if ($this->addressRepository->findByUid($locations[$i]['uid'])) {
$images = $this->addressRepository->findByUid($locations[$i]['uid'])->getImage();
}
$locations[$i]['images'] = $images;
}
Expand Down
2 changes: 1 addition & 1 deletion Classes/Domain/Repository/AddressRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ public function getFirstCategoryImage($locationUid, $storagePid) {
)
);
*/

}

$result = $queryBuilder->execute()->fetchAll();
Expand Down
8 changes: 8 additions & 0 deletions Configuration/Extbase/Persistence/Classes.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<?php
declare(strict_types = 1);

return [
\WSR\Myleaflet\Domain\Model\Address::class => [
'tableName' => 'tt_address',
],
];
14 changes: 7 additions & 7 deletions Resources/Private/Templates/Address/Show.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,13 @@ <h1>Single View for MyLeaflet</h1>
<f:debug>{_all}</f:debug>
</f:comment>




<script>

var map = '';
var group = '';

$(document).ready(function () {

// map = L.map('map').setView([48.2, 7.7], 13);
var markerArray = [];

Expand Down Expand Up @@ -113,11 +111,13 @@ <h1>Single View for MyLeaflet</h1>
var lon = {address.longitude};
</f:format.raw>

var icon = "<f:format.raw>{address.leafletmapicon}</f:format.raw>";

if (icon > '0') {
var mapIcon = L.icon({
iconUrl: "/fileadmin/ext/myleaflet/Resources/Public/Icons/" + icon,
iconSize: [25, 41], // size of the icon
iconAnchor: [12, 41]
iconUrl: "/fileadmin/ext/myleaflet/Resources/Public/MapIcons/" + icon,
iconSize: [' . {settings["markerIconWidth"]} . ' , ' . {settings["markerIconHeight"]} . ' ], // size of the icon
iconAnchor: [' . intval({settings["markerIconWidth"]} / 2) . ' , ' . {settings["markerIconHeight"]} . ' ]
});

markerArray.push(L.marker([lat, lon], {icon: mapIcon}));
Expand Down
2 changes: 1 addition & 1 deletion ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
'uploadfolder' => 0,
'createDirs' => '',
'clearCacheOnLoad' => 0,
'version' => '1.8.6',
'version' => '1.8.7',
'constraints' => [
'depends' => [
'typo3' => '11.4.0-12.5.99',
Expand Down

0 comments on commit b30856e

Please sign in to comment.