From 328a98218b820685085234ba6cb00582821fe055 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 7 Jan 2021 08:31:58 +0100 Subject: [PATCH 01/55] State compatibility with v10 Even if the extension is not yet ready. This is a work in progress, to ease transition we mark it compatible, so we can easily install, test and adapt before we release. Relates: #8092 --- composer.json | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 02b7e15..8c3a39a 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ } ], "require": { - "typo3/cms-core": "^9.5" + "typo3/cms-core": "^10.4" }, "autoload": { "psr-4": { @@ -21,8 +21,9 @@ "Wrm\\Events\\Tests\\": "Tests" } }, - "replace": { - "events": "self.version", - "typo3-ter/events": "self.version" + "extra": { + "typo3/cms": { + "extension-key": "events" + } } } From 5a17f0c838e6859c108148787bcfb2f1d5c29dc3 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 7 Jan 2021 08:45:18 +0100 Subject: [PATCH 02/55] Add missing dependencies The extension uses TYPO3 core extbase and fluid extensions. Therefore they should be part of the require. Otherwise a composer install will lead to an incomplete system setup for development. Also add generated files / folders to .gitignore. Otherwise they might end up in git. Relates: #8092 --- .gitignore | 4 +++- composer.json | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 42cd73d..ee4e287 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,3 @@ -/vendor/ \ No newline at end of file +/composer.lock +/public/ +/vendor/ diff --git a/composer.json b/composer.json index 8c3a39a..555803a 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,9 @@ } ], "require": { - "typo3/cms-core": "^10.4" + "typo3/cms-core": "^10.4", + "typo3/cms-extbase": "^10.4", + "typo3/cms-fluid": "^10.4" }, "autoload": { "psr-4": { From 00a37644b264539fa957acb2e4d7ff17d3a1a99b Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 7 Jan 2021 08:46:46 +0100 Subject: [PATCH 03/55] Add rector to auto migrate to TYPO3 v10 --- composer.json | 3 +++ rector.php | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 rector.php diff --git a/composer.json b/composer.json index 555803a..ef21bb7 100644 --- a/composer.json +++ b/composer.json @@ -27,5 +27,8 @@ "typo3/cms": { "extension-key": "events" } + }, + "require-dev": { + "ssch/typo3-rector": "^0.8.0" } } diff --git a/rector.php b/rector.php new file mode 100644 index 0000000..c29079c --- /dev/null +++ b/rector.php @@ -0,0 +1,60 @@ +parameters(); + + // Define what rule sets will be applied + $parameters->set(Option::SETS, [ + Typo3SetList::TYPO3_104, + ]); + + // FQN classes are not imported by default. If you don't do it manually after every Rector run, enable it by: + $parameters->set(Typo3Option::AUTO_IMPORT_NAMES, true); + + // this will not import root namespace classes, like \DateTime or \Exception + $parameters->set(Option::IMPORT_SHORT_CLASSES, false); + + // this will not import classes used in PHP DocBlocks, like in /** @var \Some\Class */ + $parameters->set(Option::IMPORT_DOC_BLOCKS, false); + + // Define your target version which you want to support + $parameters->set(Option::PHP_VERSION_FEATURES, PhpVersion::PHP_73); + + // If you would like to see the changelog url when a rector is applied + $parameters->set(Typo3Option::OUTPUT_CHANGELOG, true); + + // If you set option Typo3Option::AUTO_IMPORT_NAMES to true, you should consider excluding some TYPO3 files. + $parameters->set(Option::SKIP, [ + NameImportingPostRector::class => [ + 'ClassAliasMap.php', + 'class.ext_update.php', + 'ext_localconf.php', + 'ext_emconf.php', + 'ext_tables.php', + __DIR__ . '/**/TCA/*', + ], + ]); + + // If you have trouble that rector cannot run because some TYPO3 constants are not defined add an additional constants file + // Have a look at https://github.com/sabbelasichon/typo3-rector/blob/master/typo3.constants.php + // $parameters->set(Option::AUTOLOAD_PATHS, [ + // __DIR__ . '/typo3.constants.php' + // ]); + + // get services (needed for register a single rule) + // $services = $containerConfigurator->services(); + + // register a single rule + // $services->set(InjectAnnotationRector::class); +}; From b829a25738b2042757fd6ac508db9dc783b4c0a3 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 7 Jan 2021 08:47:15 +0100 Subject: [PATCH 04/55] Auto migrate code base to TYPO3 v10 Using: ./vendor/bin/typo3-rector process Classes Configuration ext_* Relates: #8092 --- Classes/Controller/DateController.php | 3 +- Classes/Domain/Model/Date.php | 4 +-- Classes/Domain/Model/Event.php | 10 +++--- Classes/Domain/Model/Organizer.php | 4 +-- Classes/Domain/Model/Region.php | 4 +-- Classes/Domain/Repository/DateRepository.php | 3 +- Classes/Domain/Repository/EventRepository.php | 3 +- .../Domain/Repository/OrganizerRepository.php | 3 +- .../Domain/Repository/RegionRepository.php | 3 +- .../Service/DestinationDataImportService.php | 19 +++++++---- Configuration/Commands.php | 10 ++++-- Configuration/TCA/Overrides/tt_content.php | 10 +++--- .../tx_events_domain_model_event.php | 4 +-- .../TCA/tx_events_domain_model_date.php | 4 --- .../TCA/tx_events_domain_model_event.php | 4 --- .../TCA/tx_events_domain_model_organizer.php | 4 --- .../TCA/tx_events_domain_model_region.php | 4 --- ext_localconf.php | 32 ++++++------------- ext_tables.php | 2 +- 19 files changed, 59 insertions(+), 71 deletions(-) diff --git a/Classes/Controller/DateController.php b/Classes/Controller/DateController.php index 511cdab..50e79fe 100644 --- a/Classes/Controller/DateController.php +++ b/Classes/Controller/DateController.php @@ -1,6 +1,7 @@ view->assign('date', $date); } diff --git a/Classes/Domain/Model/Date.php b/Classes/Domain/Model/Date.php index 84d596b..ff3b508 100644 --- a/Classes/Domain/Model/Date.php +++ b/Classes/Domain/Model/Date.php @@ -1,11 +1,11 @@ images = $images; } @@ -620,7 +622,7 @@ class Event extends AbstractEntity * @param \Wrm\Events\Domain\Model\Organizer $organizer * @return void */ - public function setOrganizer(\Wrm\Events\Domain\Model\Organizer $organizer) + public function setOrganizer(Organizer $organizer) { $this->organizer = $organizer; } @@ -637,7 +639,7 @@ class Event extends AbstractEntity * @param \Wrm\Events\Domain\Model\Region $region * @return void */ - public function setRegion(\Wrm\Events\Domain\Model\Region $region) + public function setRegion(Region $region) { $this->region = $region; } @@ -687,7 +689,7 @@ class Event extends AbstractEntity /** * @param \TYPO3\CMS\Extbase\Domain\Model\Category<\TYPO3\CMS\Extbase\Domain\Model\Category> $category */ - public function addCategory(\TYPO3\CMS\Extbase\Domain\Model\Category $category) + public function addCategory(Category $category) { $this->categories->attach($category); } diff --git a/Classes/Domain/Model/Organizer.php b/Classes/Domain/Model/Organizer.php index b0c73d0..3e4ce2e 100644 --- a/Classes/Domain/Model/Organizer.php +++ b/Classes/Domain/Model/Organizer.php @@ -1,7 +1,7 @@ sysCategoriesRepository->findOneByTitle($categoryTitle); if (!$tmpSysCategory) { $this->logger->info('Creating new category: ' . $categoryTitle); - $tmpSysCategory = $this->objectManager->get(\TYPO3\CMS\Extbase\Domain\Model\Category::class); + $tmpSysCategory = $this->objectManager->get(Category::class); $tmpSysCategory->setTitle($categoryTitle); $tmpSysCategory->setParent($sysParentCategory); $tmpSysCategory->setPid($this->sysCategoriesPid); @@ -371,7 +376,7 @@ class DestinationDataImportService { if (strtotime($date['start']) > $today) { $this->logger->info('Setup single date'); - $dateObj = $this->objectManager->get(\Wrm\Events\Domain\Model\Date::class); + $dateObj = $this->objectManager->get(Date::class); $start = new \DateTime($date['start'], new \DateTimeZone($date['tz'])); $end = new \DateTime($date['end'], new \DateTimeZone($date['tz'])); $this->logger->info('Start transformed ' . $start->format('Y-m-d H:i')); @@ -401,7 +406,7 @@ class DestinationDataImportService { $eventEnd = new \DateTime(); $eventEnd->setTimestamp($i); $eventEnd->setTime($until->format('H'), $until->format('i')); - $dateObj = $this->objectManager->get(\Wrm\Events\Domain\Model\Date::class); + $dateObj = $this->objectManager->get(Date::class); $dateObj->setLanguageUid(-1); $dateObj->setStart($eventStart); $dateObj->setEnd($eventEnd); @@ -427,7 +432,7 @@ class DestinationDataImportService { $eventEnd = new \DateTime(); $eventEnd->setTimestamp($i); $eventEnd->setTime($until->format('H'), $until->format('i')); - $dateObj = $this->objectManager->get(\Wrm\Events\Domain\Model\Date::class); + $dateObj = $this->objectManager->get(Date::class); $dateObj->setLanguageUid(-1); $dateObj->setStart($eventStart); $dateObj->setEnd($eventEnd); @@ -453,7 +458,7 @@ class DestinationDataImportService { $this->tmpCurrentEvent->setOrganizer($tmpOrganizer); continue; } - $tmpOrganizer = $this->objectManager->get(\Wrm\Events\Domain\Model\Organizer::class); + $tmpOrganizer = $this->objectManager->get(Organizer::class); $tmpOrganizer->setLanguageUid(-1); $tmpOrganizer->setName($address['name']); $tmpOrganizer->setCity($address['city']); @@ -587,7 +592,7 @@ class DestinationDataImportService { // New event is created $this->logger->info(substr($title, 0, 20) . ' does not exist'); - $event = $this->objectManager->get(\Wrm\Events\Domain\Model\Event::class); + $event = $this->objectManager->get(Event::class); // Create event and persist $event->setGlobalId($globalId); $event->setCategories(new ObjectStorage()); @@ -706,7 +711,7 @@ class DestinationDataImportService { $fieldname => $newId ); - $dataHandler = $this->objectManager->get(\TYPO3\CMS\Core\DataHandling\DataHandler::class); + $dataHandler = $this->objectManager->get(DataHandler::class); $dataHandler->start($data, array()); $dataHandler->process_datamap(); diff --git a/Configuration/Commands.php b/Configuration/Commands.php index 91b6d7f..11e5c0f 100644 --- a/Configuration/Commands.php +++ b/Configuration/Commands.php @@ -1,12 +1,16 @@ [ - 'class' => \Wrm\Events\Command\DestinationDataImportCommand::class + 'class' => DestinationDataImportCommand::class ], 'events:removeAll' => [ - 'class' => \Wrm\Events\Command\RemoveAllCommand::class + 'class' => RemoveAllCommand::class ], 'events:removePast' => [ - 'class' => \Wrm\Events\Command\RemovePastCommand::class + 'class' => RemovePastCommand::class ], ]; diff --git a/Configuration/TCA/Overrides/tt_content.php b/Configuration/TCA/Overrides/tt_content.php index ab4974d..eda0c55 100644 --- a/Configuration/TCA/Overrides/tt_content.php +++ b/Configuration/TCA/Overrides/tt_content.php @@ -1,11 +1,11 @@ true, ] ] -); \ No newline at end of file +); diff --git a/Configuration/TCA/tx_events_domain_model_date.php b/Configuration/TCA/tx_events_domain_model_date.php index 16d7b1e..05ebf39 100644 --- a/Configuration/TCA/tx_events_domain_model_date.php +++ b/Configuration/TCA/tx_events_domain_model_date.php @@ -19,9 +19,6 @@ return [ 'searchFields' => '', 'iconfile' => 'EXT:events/Resources/Public/Icons/tx_events_domain_model_date.gif' ], - 'interface' => [ - 'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, start, end', - ], 'types' => [ '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, start, end, event, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'], ], @@ -45,7 +42,6 @@ return [ ], 'l10n_parent' => [ 'displayCond' => 'FIELD:sys_language_uid:>:0', - 'exclude' => true, 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.l18n_parent', 'config' => [ 'type' => 'select', diff --git a/Configuration/TCA/tx_events_domain_model_event.php b/Configuration/TCA/tx_events_domain_model_event.php index c354a0e..4cdff31 100644 --- a/Configuration/TCA/tx_events_domain_model_event.php +++ b/Configuration/TCA/tx_events_domain_model_event.php @@ -19,9 +19,6 @@ return [ 'searchFields' => 'title,global_id,slug,teaser,details,price_info,street,district,city,zip,country,web,booking,ticket,facebook,youtube,latitude,longitude', 'iconfile' => 'EXT:events/Resources/Public/Icons/tx_events_domain_model_event.gif' ], - 'interface' => [ - 'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title, global_id, slug, highlight, teaser, details, price_info, name, street, district, city, zip, country, phone, web, ticket, facebook, youtube, instagram, latitude, longitude, images, categories, dates, organizer, region', - ], 'types' => [ '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title, global_id, slug, highlight, teaser, details, price_info, name, street, district, city, zip, country, phone, web, ticket, facebook, youtube, instagram, latitude, longitude, images, categories, dates, organizer, region, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'], ], @@ -45,7 +42,6 @@ return [ ], 'l10n_parent' => [ 'displayCond' => 'FIELD:sys_language_uid:>:0', - 'exclude' => true, 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.l18n_parent', 'config' => [ 'type' => 'select', diff --git a/Configuration/TCA/tx_events_domain_model_organizer.php b/Configuration/TCA/tx_events_domain_model_organizer.php index 4cf94db..3893357 100644 --- a/Configuration/TCA/tx_events_domain_model_organizer.php +++ b/Configuration/TCA/tx_events_domain_model_organizer.php @@ -19,9 +19,6 @@ return [ 'searchFields' => 'name,street,district,city,zip,phone,web,email', 'iconfile' => 'EXT:events/Resources/Public/Icons/tx_events_domain_model_organizer.gif' ], - 'interface' => [ - 'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, name, street, district, city, zip, phone, web, email', - ], 'types' => [ '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, name, street, district, city, zip, phone, web, email, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'], ], @@ -45,7 +42,6 @@ return [ ], 'l10n_parent' => [ 'displayCond' => 'FIELD:sys_language_uid:>:0', - 'exclude' => true, 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.l18n_parent', 'config' => [ 'type' => 'select', diff --git a/Configuration/TCA/tx_events_domain_model_region.php b/Configuration/TCA/tx_events_domain_model_region.php index b2cbaf8..027904e 100644 --- a/Configuration/TCA/tx_events_domain_model_region.php +++ b/Configuration/TCA/tx_events_domain_model_region.php @@ -19,9 +19,6 @@ return [ 'searchFields' => 'title', 'iconfile' => 'EXT:events/Resources/Public/Icons/tx_events_domain_model_region.gif' ], - 'interface' => [ - 'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title', - ], 'types' => [ '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'], ], @@ -45,7 +42,6 @@ return [ ], 'l10n_parent' => [ 'displayCond' => 'FIELD:sys_language_uid:>:0', - 'exclude' => true, 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.l18n_parent', 'config' => [ 'type' => 'select', diff --git a/ext_localconf.php b/ext_localconf.php index 672dd3b..b6ce6e3 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -1,41 +1,29 @@ 'search' - ], - [ - 'Date' => 'search' - ] + [\Wrm\Events\Controller\DateController::class => 'search'], + [\Wrm\Events\Controller\DateController::class => 'search'] ); \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( - 'Wrm.Events', + 'Events', 'DateList', - [ - 'Date' => 'list' - ], - [ - 'Date' => 'list' - ] + [\Wrm\Events\Controller\DateController::class => 'list'], + [\Wrm\Events\Controller\DateController::class => 'list'] ); \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( - 'Wrm.Events', + 'Events', 'DateShow', - [ - 'Date' => 'show' - ], - [ - 'Date' => 'show' - ] + [\Wrm\Events\Controller\DateController::class => 'show'], + [\Wrm\Events\Controller\DateController::class => 'show'] ); /* diff --git a/ext_tables.php b/ext_tables.php index 960f0f4..703a526 100644 --- a/ext_tables.php +++ b/ext_tables.php @@ -1,5 +1,5 @@ Date: Thu, 7 Jan 2021 08:48:00 +0100 Subject: [PATCH 05/55] Remove rector after auto code migration Relates: #8092 --- composer.json | 3 --- rector.php | 60 --------------------------------------------------- 2 files changed, 63 deletions(-) delete mode 100644 rector.php diff --git a/composer.json b/composer.json index ef21bb7..555803a 100644 --- a/composer.json +++ b/composer.json @@ -27,8 +27,5 @@ "typo3/cms": { "extension-key": "events" } - }, - "require-dev": { - "ssch/typo3-rector": "^0.8.0" } } diff --git a/rector.php b/rector.php deleted file mode 100644 index c29079c..0000000 --- a/rector.php +++ /dev/null @@ -1,60 +0,0 @@ -parameters(); - - // Define what rule sets will be applied - $parameters->set(Option::SETS, [ - Typo3SetList::TYPO3_104, - ]); - - // FQN classes are not imported by default. If you don't do it manually after every Rector run, enable it by: - $parameters->set(Typo3Option::AUTO_IMPORT_NAMES, true); - - // this will not import root namespace classes, like \DateTime or \Exception - $parameters->set(Option::IMPORT_SHORT_CLASSES, false); - - // this will not import classes used in PHP DocBlocks, like in /** @var \Some\Class */ - $parameters->set(Option::IMPORT_DOC_BLOCKS, false); - - // Define your target version which you want to support - $parameters->set(Option::PHP_VERSION_FEATURES, PhpVersion::PHP_73); - - // If you would like to see the changelog url when a rector is applied - $parameters->set(Typo3Option::OUTPUT_CHANGELOG, true); - - // If you set option Typo3Option::AUTO_IMPORT_NAMES to true, you should consider excluding some TYPO3 files. - $parameters->set(Option::SKIP, [ - NameImportingPostRector::class => [ - 'ClassAliasMap.php', - 'class.ext_update.php', - 'ext_localconf.php', - 'ext_emconf.php', - 'ext_tables.php', - __DIR__ . '/**/TCA/*', - ], - ]); - - // If you have trouble that rector cannot run because some TYPO3 constants are not defined add an additional constants file - // Have a look at https://github.com/sabbelasichon/typo3-rector/blob/master/typo3.constants.php - // $parameters->set(Option::AUTOLOAD_PATHS, [ - // __DIR__ . '/typo3.constants.php' - // ]); - - // get services (needed for register a single rule) - // $services = $containerConfigurator->services(); - - // register a single rule - // $services->set(InjectAnnotationRector::class); -}; From 59272afffdb8f0a942b7a5ca00853a6f515ec410 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 7 Jan 2021 08:50:43 +0100 Subject: [PATCH 06/55] Add php code sniffer to follow PSR-12 Also apply ./vendor/bin/phpcbf to auto migrate what is possible. Relates: #8092 --- .../Command/DestinationDataImportCommand.php | 14 +- Classes/Command/RemoveAllCommand.php | 1 + Classes/Command/RemovePastCommand.php | 1 + Classes/Controller/DateController.php | 1 + Classes/Controller/EventController.php | 9 +- Classes/Domain/Model/Date.php | 9 +- Classes/Domain/Model/Dto/DateDemand.php | 3 +- Classes/Domain/Model/Dto/EventDemand.php | 8 +- Classes/Domain/Model/Event.php | 74 ++++---- Classes/Domain/Model/Organizer.php | 58 +++--- Classes/Domain/Model/Region.php | 18 +- Classes/Domain/Repository/DateRepository.php | 4 +- Classes/Domain/Repository/EventRepository.php | 5 +- .../Domain/Repository/OrganizerRepository.php | 4 +- .../Domain/Repository/RegionRepository.php | 4 +- .../Service/DestinationDataImportService.php | 177 ++++++++++-------- Classes/ViewHelpers/FormViewHelper.php | 8 +- Tests/Unit/Controller/DateControllerTest.php | 1 + Tests/Unit/Controller/EventControllerTest.php | 1 + .../Unit/Controller/EventsControllerTest.php | 1 + Tests/Unit/Domain/Model/DateTest.php | 1 + Tests/Unit/Domain/Model/EventTest.php | 1 + Tests/Unit/Domain/Model/EventsTest.php | 1 + Tests/Unit/Domain/Model/OrganizerTest.php | 1 + Tests/Unit/Domain/Model/RegionTest.php | 1 + composer.json | 3 + ext_localconf.php | 4 +- ext_tables.php | 5 +- phpcs.xml.dist | 21 +++ 29 files changed, 255 insertions(+), 184 deletions(-) create mode 100644 phpcs.xml.dist diff --git a/Classes/Command/DestinationDataImportCommand.php b/Classes/Command/DestinationDataImportCommand.php index 79e45b1..a26d84a 100644 --- a/Classes/Command/DestinationDataImportCommand.php +++ b/Classes/Command/DestinationDataImportCommand.php @@ -1,18 +1,18 @@ addArgument('rest-experience', + $this->addArgument( + 'rest-experience', InputArgument::OPTIONAL, 'What is the rest experience?', 'stadtmarketing-erfurt' ); - $this->addArgument('files-folder', + $this->addArgument( + 'files-folder', InputArgument::OPTIONAL, 'Where to save the image files?', 'staedte/erfurt/events/' @@ -56,4 +58,4 @@ class DestinationDataImportCommand extends Command { $input->getArgument('files-folder') ); } -} \ No newline at end of file +} diff --git a/Classes/Command/RemoveAllCommand.php b/Classes/Command/RemoveAllCommand.php index 38306ab..0f87879 100644 --- a/Classes/Command/RemoveAllCommand.php +++ b/Classes/Command/RemoveAllCommand.php @@ -1,4 +1,5 @@ createDemandFromSettings(); $events = $this->eventRepository->findByDemand($demand); $this->view->assign('events', $events); - } /** * Action show - * + * * @param Event $event * @return void */ @@ -75,7 +75,7 @@ class EventController extends ActionController /** * action teaser - * + * * @return void */ public function teaserAction() @@ -96,7 +96,6 @@ class EventController extends ActionController $this->view->assign('search', $search); $this->view->assign('events', $this->eventRepository->findSearchWord($search)); - } /** diff --git a/Classes/Domain/Model/Date.php b/Classes/Domain/Model/Date.php index ff3b508..33b017f 100644 --- a/Classes/Domain/Model/Date.php +++ b/Classes/Domain/Model/Date.php @@ -1,7 +1,9 @@ _languageUid = $languageUid; } /** * @return int */ - public function getLanguageUid() { + public function getLanguageUid() + { return $this->_languageUid; } - } diff --git a/Classes/Domain/Model/Dto/DateDemand.php b/Classes/Domain/Model/Dto/DateDemand.php index fe6d447..319b40c 100644 --- a/Classes/Domain/Model/Dto/DateDemand.php +++ b/Classes/Domain/Model/Dto/DateDemand.php @@ -4,7 +4,8 @@ namespace Wrm\Events\Domain\Model\Dto; use TYPO3\CMS\Core\Utility\GeneralUtility; -class DateDemand { +class DateDemand +{ /** * @var string diff --git a/Classes/Domain/Model/Dto/EventDemand.php b/Classes/Domain/Model/Dto/EventDemand.php index 0367554..eb74e00 100644 --- a/Classes/Domain/Model/Dto/EventDemand.php +++ b/Classes/Domain/Model/Dto/EventDemand.php @@ -2,7 +2,8 @@ namespace Wrm\Events\Domain\Model\Dto; -class EventDemand { +class EventDemand +{ /** * @var string @@ -171,7 +172,4 @@ class EventDemand { { $this->limit = $limit; } - - - -} \ No newline at end of file +} diff --git a/Classes/Domain/Model/Event.php b/Classes/Domain/Model/Event.php index bd0e1a8..ab47e24 100644 --- a/Classes/Domain/Model/Event.php +++ b/Classes/Domain/Model/Event.php @@ -1,14 +1,15 @@ * @cascade remove */ @@ -181,21 +182,21 @@ class Event extends AbstractEntity /** * organizer - * + * * @var \Wrm\Events\Domain\Model\Organizer */ protected $organizer = null; /** * region - * + * * @var \Wrm\Events\Domain\Model\Region */ protected $region = null; /** * categories - * + * * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\Category> */ protected $categories; @@ -225,7 +226,7 @@ class Event extends AbstractEntity /** * Returns the globalId - * + * * @return string $globalId */ public function getGlobalId() @@ -481,7 +482,7 @@ class Event extends AbstractEntity /** * @return string $instagram - */ + */ public function getInstagram() { return $this->instagram; @@ -489,12 +490,12 @@ class Event extends AbstractEntity /** * @param string $instagram - */ + */ public function setInstagram(string $instagram) { $this->instagram = $instagram; } - + /** * @return string $latitude */ @@ -606,7 +607,8 @@ class Event extends AbstractEntity * @param ObjectStorage $dates * @return void */ - public function removeAllDates(ObjectStorage $dates) { + public function removeAllDates(ObjectStorage $dates) + { $this->dates->removeAll($dates); } @@ -714,14 +716,16 @@ class Event extends AbstractEntity * @param int $languageUid * @return void */ - public function setLanguageUid($languageUid) { + public function setLanguageUid($languageUid) + { $this->_languageUid = $languageUid; } /** * @return int */ - public function getLanguageUid() { + public function getLanguageUid() + { return $this->_languageUid; } } diff --git a/Classes/Domain/Model/Organizer.php b/Classes/Domain/Model/Organizer.php index 3e4ce2e..0106ed1 100644 --- a/Classes/Domain/Model/Organizer.php +++ b/Classes/Domain/Model/Organizer.php @@ -1,7 +1,9 @@ _languageUid = $languageUid; } /** * @return int */ - public function getLanguageUid() { + public function getLanguageUid() + { return $this->_languageUid; } } diff --git a/Classes/Domain/Model/Region.php b/Classes/Domain/Model/Region.php index eb252b1..0198035 100644 --- a/Classes/Domain/Model/Region.php +++ b/Classes/Domain/Model/Region.php @@ -1,7 +1,9 @@ _languageUid = $languageUid; } /** * @return int */ - public function getLanguageUid() { + public function getLanguageUid() + { return $this->_languageUid; } } diff --git a/Classes/Domain/Repository/DateRepository.php b/Classes/Domain/Repository/DateRepository.php index e6eb387..5fb5d5c 100644 --- a/Classes/Domain/Repository/DateRepository.php +++ b/Classes/Domain/Repository/DateRepository.php @@ -1,4 +1,5 @@ equals('event.region', $demand->getRegion()); } - if ($demand->getHighlight() !== FALSE) { + if ($demand->getHighlight() !== false) { $constraints['highlight'] = $query->equals('event.highlight', $demand->getHighlight()); } @@ -183,5 +184,4 @@ class DateRepository extends Repository return $statement->execute()->fetchAll(); } - } diff --git a/Classes/Domain/Repository/EventRepository.php b/Classes/Domain/Repository/EventRepository.php index 90331d4..551e08e 100644 --- a/Classes/Domain/Repository/EventRepository.php +++ b/Classes/Domain/Repository/EventRepository.php @@ -1,7 +1,9 @@ setLimit(20); return $query->execute(); } - -} \ No newline at end of file +} diff --git a/Classes/Domain/Repository/OrganizerRepository.php b/Classes/Domain/Repository/OrganizerRepository.php index 67f1849..87d7cc2 100644 --- a/Classes/Domain/Repository/OrganizerRepository.php +++ b/Classes/Domain/Repository/OrganizerRepository.php @@ -1,7 +1,9 @@ restExperience = $restExperience; $this->storagePid = $storagePid; @@ -237,21 +236,21 @@ class DestinationDataImportService { $restUrl = $this->restUrl . '?experience=' . $this->restExperience . '&licensekey=' . $this->restLicenseKey . '&type=' . $this->restType . '&mode=' . $this->restMode . '&limit=' . $this->restLimit . '&template=' . $this->restTemplate; $this->logger->info('Try to get data from ' . $restUrl); - if ($jsonResponse = json_decode(file_get_contents($restUrl),true)) { + if ($jsonResponse = json_decode(file_get_contents($restUrl), true)) { $this->logger->info('Received data with ' . count($jsonResponse['items']) . ' items'); return $this->processData($jsonResponse); } else { $this->logger->error('Could not receive data.'); return 1; } - } /** * @param $data * @return int */ - public function processData($data) { + public function processData($data) + { $this->logger->info('Processing json ' . count($data['items'])); @@ -259,7 +258,6 @@ class DestinationDataImportService { $selectedRegion = $this->regionRepository->findByUid($this->regionUid); foreach ($data['items'] as $event) { - $this->logger->info('Processing event ' . substr($event['title'], 0, 20)); // Event already exists? If not create one! @@ -275,50 +273,59 @@ class DestinationDataImportService { $this->tmpCurrentEvent->setTitle(substr($event['title'], 0, 254)); // Set Highlight (Is only set in rest if true) - if($event['highlight']) + if ($event['highlight']) { $this->tmpCurrentEvent->setHighlight($event['highlight']); + } // Set Texts - if($event['texts']) + if ($event['texts']) { $this->setTexts($event['texts']); + } // Set address and geo data - if($event['name'] || $event['street'] || $event['city'] || $event['zip'] || $event['country'] || $event['web']) + if ($event['name'] || $event['street'] || $event['city'] || $event['zip'] || $event['country'] || $event['web']) { $this->setAddress($event); + } // Set LatLng - if($event['geo']['main']['latitude'] && $event['geo']['main']['longitude']) + if ($event['geo']['main']['latitude'] && $event['geo']['main']['longitude']) { $this->setLatLng($event['geo']['main']['latitude'], $event['geo']['main']['longitude']); + } // Set Categories - if($event['categories']) + if ($event['categories']) { $this->setCategories($event['categories']); + } // Set Organizer - if($event['addresses']) + if ($event['addresses']) { $this->setOrganizer($event['addresses']); + } // Set Social - if($event['media_objects']) + if ($event['media_objects']) { $this->setSocial($event['media_objects']); + } // Set Tickets - if($event['media_objects']) + if ($event['media_objects']) { $this->setTickets($event['media_objects']); + } // Set Dates - if($event['timeIntervals']) + if ($event['timeIntervals']) { $this->setDates($event['timeIntervals']); + } // Set Assets - if($event['media_objects']) + if ($event['media_objects']) { $this->setAssets($event['media_objects']); + } // Update and persist $this->logger->info('Persist database'); $this->eventRepository->update($this->tmpCurrentEvent); $this->persistenceManager->persistAll(); - } $this->doSlugUpdate(); $this->logger->info('Finished import'); @@ -329,7 +336,8 @@ class DestinationDataImportService { * * @param array $categories */ - protected function setCategories(Array $categories) { + protected function setCategories(array $categories) + { $sysParentCategory = $this->sysCategoriesRepository->findByUid($this->categoryParentUid); foreach ($categories as $categoryTitle) { $tmpSysCategory = $this->sysCategoriesRepository->findOneByTitle($categoryTitle); @@ -351,7 +359,8 @@ class DestinationDataImportService { * @param array $timeIntervals * @TODO: split into functions */ - protected function setDates(Array $timeIntervals) { + protected function setDates(array $timeIntervals) + { // @TODO: does not seem to work --> //$currentEventDates = $this->tmpCurrentEvent->getDates(); @@ -370,10 +379,8 @@ class DestinationDataImportService { $today = $today->getTimestamp(); foreach ($timeIntervals as $date) { - // Check if dates are given as interval or not if (empty($date['interval'])) { - if (strtotime($date['start']) > $today) { $this->logger->info('Setup single date'); $dateObj = $this->objectManager->get(Date::class); @@ -387,18 +394,15 @@ class DestinationDataImportService { $dateObj->setEnd($end); $this->tmpCurrentEvent->addDate($dateObj); } - } else { - if ($date['freq'] == 'Daily' && empty($date['weekdays']) && !empty($date['repeatUntil'])) { - $this->logger->info('Setup daily interval dates'); $this->logger->info('Start ' . $date['start']); $this->logger->info('End ' . $date['repeatUntil']); $start = new \DateTime($date['start'], new \DateTimeZone($date['tz'])); $until = new \DateTime($date['repeatUntil'], new \DateTimeZone($date['tz'])); - for($i = strtotime($start->format('l'), $start->getTimestamp()); $i <= $until->getTimestamp(); $i = strtotime('+1 day', $i)) { + for ($i = strtotime($start->format('l'), $start->getTimestamp()); $i <= $until->getTimestamp(); $i = strtotime('+1 day', $i)) { if ($i >= $today) { $eventStart = new \DateTime(); $eventStart->setTimestamp($i); @@ -413,10 +417,7 @@ class DestinationDataImportService { $this->tmpCurrentEvent->addDate($dateObj); } } - - } - - else if ($date['freq'] == 'Weekly' && !empty($date['weekdays']) && !empty($date['repeatUntil'])) { + } elseif ($date['freq'] == 'Weekly' && !empty($date['weekdays']) && !empty($date['repeatUntil'])) { foreach ($date['weekdays'] as $day) { $this->logger->info('Setup weekly interval dates for ' . $day); $this->logger->info('Start ' . $date['start']); @@ -424,7 +425,7 @@ class DestinationDataImportService { $start = new \DateTime($date['start'], new \DateTimeZone($date['tz'])); $until = new \DateTime($date['repeatUntil'], new \DateTimeZone($date['tz'])); - for($i = strtotime($day, $start->getTimestamp()); $i <= $until->getTimestamp(); $i = strtotime('+1 week', $i)) { + for ($i = strtotime($day, $start->getTimestamp()); $i <= $until->getTimestamp(); $i = strtotime('+1 week', $i)) { if ($i >= $today) { $eventStart = new \DateTime(); $eventStart->setTimestamp($i); @@ -449,9 +450,9 @@ class DestinationDataImportService { /** * @param array $addresses */ - protected function setOrganizer(Array $addresses) { - foreach ($addresses as $address) - { + protected function setOrganizer(array $addresses) + { + foreach ($addresses as $address) { if ($address['rel'] == "organizer") { $tmpOrganizer = $this->organizerRepository->findOneByName($address['name']); if ($tmpOrganizer) { @@ -477,44 +478,55 @@ class DestinationDataImportService { /** * @param array $event */ - protected function setAddress(Array $event) { - if (!empty($event['name'])) + protected function setAddress(array $event) + { + if (!empty($event['name'])) { $this->tmpCurrentEvent->setName($event['name']); - if (!empty($event['street'])) + } + if (!empty($event['street'])) { $this->tmpCurrentEvent->setStreet($event['street']); - if (!empty($event['city'])) + } + if (!empty($event['city'])) { $this->tmpCurrentEvent->setCity($event['city']); - if (!empty($event['zip'])) + } + if (!empty($event['zip'])) { $this->tmpCurrentEvent->setZip($event['zip']); - if (!empty($event['country'])) + } + if (!empty($event['country'])) { $this->tmpCurrentEvent->setCountry($event['country']); - if (!empty($event['phone'])) + } + if (!empty($event['phone'])) { $this->tmpCurrentEvent->setPhone($event['phone']); - if (!empty($event['web'])) + } + if (!empty($event['web'])) { $this->tmpCurrentEvent->setWeb($event['web']); - } - - /** - * @param array $media - */ - protected function setSocial(Array $media) { - foreach ($media as $link) - { - if ($link['rel'] == "socialmedia" && $link['value'] == "Facebook") - $this->tmpCurrentEvent->setFacebook($link['url']); - if ($link['rel'] == "socialmedia" && $link['value'] == "YouTube") - $this->tmpCurrentEvent->setYouTube($link['url']); - if ($link['rel'] == "socialmedia" && $link['value'] == "Instagram") - $this->tmpCurrentEvent->setInstagram($link['url']); } } /** * @param array $media */ - protected function setTickets(Array $media) { - foreach ($media as $link) - { + protected function setSocial(array $media) + { + foreach ($media as $link) { + if ($link['rel'] == "socialmedia" && $link['value'] == "Facebook") { + $this->tmpCurrentEvent->setFacebook($link['url']); + } + if ($link['rel'] == "socialmedia" && $link['value'] == "YouTube") { + $this->tmpCurrentEvent->setYouTube($link['url']); + } + if ($link['rel'] == "socialmedia" && $link['value'] == "Instagram") { + $this->tmpCurrentEvent->setInstagram($link['url']); + } + } + } + + /** + * @param array $media + */ + protected function setTickets(array $media) + { + foreach ($media as $link) { if ($link['rel'] == "ticket") { $this->tmpCurrentEvent->setTicket($link['url']); break; @@ -531,14 +543,15 @@ class DestinationDataImportService { * @param string $needle * @param array $haystack */ - protected function multi_array_key_exists( $needle, $haystack ) { + protected function multi_array_key_exists($needle, $haystack) + { - foreach ( $haystack as $key => $value ) { - if ( $needle == $key ) { + foreach ($haystack as $key => $value) { + if ($needle == $key) { return true; } - if ( is_array( $value ) ) { - if ( $this->multi_array_key_exists( $needle, $value ) == true ) { + if (is_array($value)) { + if ($this->multi_array_key_exists($needle, $value) == true) { return true; } } @@ -550,7 +563,8 @@ class DestinationDataImportService { * @param string $lat * @param string $lng */ - protected function setLatLng(String $lat, String $lng) { + protected function setLatLng(string $lat, string $lng) + { $this->tmpCurrentEvent->setLatitude($lat); $this->tmpCurrentEvent->setLongitude($lng); } @@ -559,9 +573,9 @@ class DestinationDataImportService { * Set Texts * @param Array $texts */ - protected function setTexts(Array $texts) { - foreach ($texts as $text) - { + protected function setTexts(array $texts) + { + foreach ($texts as $text) { if ($text['rel'] == "details" && $text['type'] == "text/plain") { $this->tmpCurrentEvent->setDetails(str_replace('\n\n', '\n', $text['value'])); } @@ -579,7 +593,8 @@ class DestinationDataImportService { * @param String $globalId * @param String $title */ - protected function getOrCreateEvent(String $globalId, String $title) { + protected function getOrCreateEvent(string $globalId, string $title) + { $event = $this->eventRepository->findOneByGlobalId($globalId); @@ -605,16 +620,15 @@ class DestinationDataImportService { /** * @param array $assets */ - protected function setAssets(Array $assets) { + protected function setAssets(array $assets) + { $this->logger->info("Set assets"); $error = false; - foreach ($assets as $media_object) - { - if($media_object['rel'] == "default" && $media_object['type'] == "image/jpeg") { - + foreach ($assets as $media_object) { + if ($media_object['rel'] == "default" && $media_object['type'] == "image/jpeg") { $this->storage = $this->resourceFactory->getDefaultStorage(); $orgFileUrl = urldecode($media_object['url']); @@ -656,10 +670,9 @@ class DestinationDataImportService { $this->logger->info('No relation found'); $file = $this->storage->getFile($this->filesFolder . $orgFileNameSanitized); $this->metaDataRepository->update($file->getUid(), array('title' => $media_object['value'], 'description' => $media_object['description'], 'alternative' => 'DD Import')); - $this->createFileRelations($file->getUid(), 'tx_events_domain_model_event', $this->tmpCurrentEvent->getUid(), 'images', $this->storagePid); + $this->createFileRelations($file->getUid(), 'tx_events_domain_model_event', $this->tmpCurrentEvent->getUid(), 'images', $this->storagePid); } } - } $error = false; } @@ -670,7 +683,8 @@ class DestinationDataImportService { * @param string $file * @return string */ - protected function loadFile($file) { + protected function loadFile($file) + { $directory = $this->environment->getPublicPath() . "/uploads/tx_events/"; $filename = basename($file); $this->logger->info('Getting file ' . $file . ' as ' . $filename); @@ -692,7 +706,8 @@ class DestinationDataImportService { * @param string $storagePid * @return bool */ - protected function createFileRelations($uid_local, $tablenames, $uid_foreign, $fieldname, $storagePid) { + protected function createFileRelations($uid_local, $tablenames, $uid_foreign, $fieldname, $storagePid) + { $newId = 'NEW1234'; @@ -719,7 +734,7 @@ class DestinationDataImportService { return true; } - foreach($dataHandler->errorLog as $error) { + foreach ($dataHandler->errorLog as $error) { $this->logger->info($error); } return false; diff --git a/Classes/ViewHelpers/FormViewHelper.php b/Classes/ViewHelpers/FormViewHelper.php index 9231214..d7af5f8 100644 --- a/Classes/ViewHelpers/FormViewHelper.php +++ b/Classes/ViewHelpers/FormViewHelper.php @@ -2,8 +2,10 @@ namespace Wrm\Events\ViewHelpers; -class FormViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper { - protected function renderHiddenReferrerFields(){ +class FormViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\FormViewHelper +{ + protected function renderHiddenReferrerFields() + { return ''; } -} \ No newline at end of file +} diff --git a/Tests/Unit/Controller/DateControllerTest.php b/Tests/Unit/Controller/DateControllerTest.php index e6cfc3c..d9769de 100644 --- a/Tests/Unit/Controller/DateControllerTest.php +++ b/Tests/Unit/Controller/DateControllerTest.php @@ -1,4 +1,5 @@ + + This project coding standard + + Classes/ + Tests/ + ext_localconf.php + ext_tables.php + + + + + + + + + + + /Tests/* + + From b7adb97cbcce1fa1ee19173483889fdd5ddc42a4 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 7 Jan 2021 08:54:42 +0100 Subject: [PATCH 07/55] Adjust code and config to pass php code sniffer Relates: #8092 --- Classes/Domain/Repository/EventRepository.php | 9 ++++----- Classes/Domain/Repository/OrganizerRepository.php | 6 ++---- Classes/Domain/Repository/RegionRepository.php | 6 ++---- phpcs.xml.dist | 11 ++++++++--- 4 files changed, 16 insertions(+), 16 deletions(-) diff --git a/Classes/Domain/Repository/EventRepository.php b/Classes/Domain/Repository/EventRepository.php index 551e08e..ebcfcc2 100644 --- a/Classes/Domain/Repository/EventRepository.php +++ b/Classes/Domain/Repository/EventRepository.php @@ -2,9 +2,7 @@ namespace Wrm\Events\Domain\Repository; -use TYPO3\CMS\Extbase\Persistence\Repository; - -/** +/* * This file is part of the TYPO3 CMS project. * * It is free software; you can redistribute it and/or modify it under @@ -17,11 +15,12 @@ use TYPO3\CMS\Extbase\Persistence\Repository; * The TYPO3 project - inspiring people to share! */ -use Wrm\Events\Domain\Model\Dto\EventDemand; -use Wrm\Events\Service\CategoryService; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Persistence\QueryInterface; use TYPO3\CMS\Extbase\Persistence\QueryResultInterface; +use TYPO3\CMS\Extbase\Persistence\Repository; +use Wrm\Events\Domain\Model\Dto\EventDemand; +use Wrm\Events\Service\CategoryService; class EventRepository extends Repository { diff --git a/Classes/Domain/Repository/OrganizerRepository.php b/Classes/Domain/Repository/OrganizerRepository.php index 87d7cc2..e43570f 100644 --- a/Classes/Domain/Repository/OrganizerRepository.php +++ b/Classes/Domain/Repository/OrganizerRepository.php @@ -2,9 +2,7 @@ namespace Wrm\Events\Domain\Repository; -use TYPO3\CMS\Extbase\Persistence\Repository; - -/** +/* * This file is part of the TYPO3 CMS project. * * It is free software; you can redistribute it and/or modify it under @@ -17,7 +15,7 @@ use TYPO3\CMS\Extbase\Persistence\Repository; * The TYPO3 project - inspiring people to share! */ -use TYPO3\CMS\Extbase\Persistence\QueryResultInterface; +use TYPO3\CMS\Extbase\Persistence\Repository; class OrganizerRepository extends Repository { diff --git a/Classes/Domain/Repository/RegionRepository.php b/Classes/Domain/Repository/RegionRepository.php index 17fa7b0..213154a 100644 --- a/Classes/Domain/Repository/RegionRepository.php +++ b/Classes/Domain/Repository/RegionRepository.php @@ -2,9 +2,7 @@ namespace Wrm\Events\Domain\Repository; -use TYPO3\CMS\Extbase\Persistence\Repository; - -/** +/* * This file is part of the TYPO3 CMS project. * * It is free software; you can redistribute it and/or modify it under @@ -17,7 +15,7 @@ use TYPO3\CMS\Extbase\Persistence\Repository; * The TYPO3 project - inspiring people to share! */ -use TYPO3\CMS\Extbase\Persistence\QueryResultInterface; +use TYPO3\CMS\Extbase\Persistence\Repository; class RegionRepository extends Repository { diff --git a/phpcs.xml.dist b/phpcs.xml.dist index 8f39ece..0c873f7 100644 --- a/phpcs.xml.dist +++ b/phpcs.xml.dist @@ -14,8 +14,13 @@ - - - /Tests/* + + + + + + + + From 0c58be43ff52b68675853d328c1be9b7febb30b3 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 7 Jan 2021 08:58:03 +0100 Subject: [PATCH 08/55] Manual CGL adjustments Not covered by PSR / phpcs Relates: #8092 --- .../Command/DestinationDataImportCommand.php | 2 +- Classes/Controller/DateController.php | 8 ++++---- Classes/Controller/EventController.php | 6 +++--- Classes/Domain/Model/Event.php | 12 ++++++------ Classes/Domain/Model/Organizer.php | 9 +++++---- Classes/Domain/Model/Region.php | 9 +++++---- Classes/Domain/Repository/DateRepository.php | 8 ++++---- .../Service/DestinationDataImportService.php | 18 +++++++++--------- 8 files changed, 37 insertions(+), 35 deletions(-) diff --git a/Classes/Command/DestinationDataImportCommand.php b/Classes/Command/DestinationDataImportCommand.php index a26d84a..ca638ff 100644 --- a/Classes/Command/DestinationDataImportCommand.php +++ b/Classes/Command/DestinationDataImportCommand.php @@ -6,8 +6,8 @@ use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Output\OutputInterface; -use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Core\Core\Bootstrap; +use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Object\ObjectManager; use Wrm\Events\Service\DestinationDataImportService; diff --git a/Classes/Controller/DateController.php b/Classes/Controller/DateController.php index 1ad389e..b83e882 100644 --- a/Classes/Controller/DateController.php +++ b/Classes/Controller/DateController.php @@ -2,15 +2,15 @@ namespace Wrm\Events\Controller; -use Wrm\Events\Domain\Model\Date; +use TYPO3\CMS\Core\Database\QueryGenerator; use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; +use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; +use Wrm\Events\Domain\Model\Date; use Wrm\Events\Domain\Model\Dto\DateDemand; use Wrm\Events\Domain\Repository\CategoryRepository; use Wrm\Events\Domain\Repository\DateRepository; use Wrm\Events\Domain\Repository\RegionRepository; -use TYPO3\CMS\Core\Database\QueryGenerator; -use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; -use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; /** * DateController diff --git a/Classes/Controller/EventController.php b/Classes/Controller/EventController.php index b20b430..987f466 100644 --- a/Classes/Controller/EventController.php +++ b/Classes/Controller/EventController.php @@ -2,12 +2,12 @@ namespace Wrm\Events\Controller; -use Wrm\Events\Domain\Model\Dto\EventDemand; -use Wrm\Events\Domain\Model\Event; -use Wrm\Events\Domain\Repository\EventRepository; use TYPO3\CMS\Core\Database\QueryGenerator; use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; +use Wrm\Events\Domain\Model\Dto\EventDemand; +use Wrm\Events\Domain\Model\Event; +use Wrm\Events\Domain\Repository\EventRepository; /** * EventController diff --git a/Classes/Domain/Model/Event.php b/Classes/Domain/Model/Event.php index ab47e24..6df87af 100644 --- a/Classes/Domain/Model/Event.php +++ b/Classes/Domain/Model/Event.php @@ -2,14 +2,14 @@ namespace Wrm\Events\Domain\Model; -use TYPO3\CMS\Extbase\Domain\Model\FileReference; -use TYPO3\CMS\Extbase\Domain\Model\Category; -use Wrm\Events\Domain\Repository\DateRepository; -use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Annotation as Extbase; +use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; +use TYPO3\CMS\Extbase\Domain\Model\Category; +use TYPO3\CMS\Extbase\Domain\Model\FileReference; use TYPO3\CMS\Extbase\Object\ObjectManager; use TYPO3\CMS\Extbase\Persistence\ObjectStorage; +use Wrm\Events\Domain\Repository\DateRepository; /** * Event @@ -531,7 +531,7 @@ class Event extends AbstractEntity } /** - * @return \TYPO3\CMS\Extbase\Domain\Model\FileReference $images + * @return FileReference $images */ public function getImages() { @@ -539,7 +539,7 @@ class Event extends AbstractEntity } /** - * @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $images + * @param FileReference $images * @return void */ public function setImages(FileReference $images) diff --git a/Classes/Domain/Model/Organizer.php b/Classes/Domain/Model/Organizer.php index 0106ed1..583b1e6 100644 --- a/Classes/Domain/Model/Organizer.php +++ b/Classes/Domain/Model/Organizer.php @@ -2,9 +2,7 @@ namespace Wrm\Events\Domain\Model; -use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; - -/*** +/* * * This file is part of the "DD Events" Extension for TYPO3 CMS. * @@ -13,7 +11,10 @@ use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; * * (c) 2019 Dirk Koritnik * - ***/ + */ + +use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; + /** * Organizer */ diff --git a/Classes/Domain/Model/Region.php b/Classes/Domain/Model/Region.php index 0198035..8c8bae2 100644 --- a/Classes/Domain/Model/Region.php +++ b/Classes/Domain/Model/Region.php @@ -2,9 +2,7 @@ namespace Wrm\Events\Domain\Model; -use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; - -/*** +/* * * This file is part of the "DD Events" Extension for TYPO3 CMS. * @@ -13,7 +11,10 @@ use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; * * (c) 2019 Dirk Koritnik * - ***/ + */ + +use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; + /** * Region */ diff --git a/Classes/Domain/Repository/DateRepository.php b/Classes/Domain/Repository/DateRepository.php index 5fb5d5c..6ac94e9 100644 --- a/Classes/Domain/Repository/DateRepository.php +++ b/Classes/Domain/Repository/DateRepository.php @@ -2,14 +2,14 @@ namespace Wrm\Events\Domain\Repository; +use TYPO3\CMS\Core\Database\ConnectionPool; +use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface; +use TYPO3\CMS\Extbase\Persistence\QueryInterface; +use TYPO3\CMS\Extbase\Persistence\QueryResultInterface; use TYPO3\CMS\Extbase\Persistence\Repository; use Wrm\Events\Domain\Model\Dto\DateDemand; use Wrm\Events\Service\CategoryService; -use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Core\Database\ConnectionPool; -use TYPO3\CMS\Extbase\Persistence\QueryInterface; -use TYPO3\CMS\Extbase\Persistence\QueryResultInterface; class DateRepository extends Repository { diff --git a/Classes/Service/DestinationDataImportService.php b/Classes/Service/DestinationDataImportService.php index 003b352..7c72bf4 100644 --- a/Classes/Service/DestinationDataImportService.php +++ b/Classes/Service/DestinationDataImportService.php @@ -2,25 +2,25 @@ namespace Wrm\Events\Service; -use TYPO3\CMS\Extbase\Domain\Model\Category; -use Wrm\Events\Domain\Model\Date; -use Wrm\Events\Domain\Model\Organizer; -use Wrm\Events\Domain\Model\Event; -use TYPO3\CMS\Core\DataHandling\DataHandler; use TYPO3\CMS\Core\Core\Environment; +use TYPO3\CMS\Core\DataHandling\DataHandler; +use TYPO3\CMS\Core\DataHandling\SlugHelper; +use TYPO3\CMS\Core\Database\ConnectionPool; +use TYPO3\CMS\Core\Log\LogManager; use TYPO3\CMS\Core\Resource\FileRepository; use TYPO3\CMS\Core\Resource\Index\MetaDataRepository; use TYPO3\CMS\Core\Resource\ResourceFactory; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Core\DataHandling\SlugHelper; -use TYPO3\CMS\Core\Database\ConnectionPool; -use TYPO3\CMS\Core\Log\LogManager; use TYPO3\CMS\Extbase\Configuration\ConfigurationManager; use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; +use TYPO3\CMS\Extbase\Domain\Model\Category; use TYPO3\CMS\Extbase\Domain\Repository\CategoryRepository; -use TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager; use TYPO3\CMS\Extbase\Object\ObjectManager; +use TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager; use TYPO3\CMS\Extbase\Persistence\ObjectStorage; +use Wrm\Events\Domain\Model\Date; +use Wrm\Events\Domain\Model\Event; +use Wrm\Events\Domain\Model\Organizer; use Wrm\Events\Domain\Repository\DateRepository; use Wrm\Events\Domain\Repository\EventRepository; use Wrm\Events\Domain\Repository\OrganizerRepository; From cb50981a2b49d466df935a5ae86391f6f71d7c0d Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 7 Jan 2021 09:01:58 +0100 Subject: [PATCH 09/55] Setup unit testing * Add dependency. * Remove empty tearDown() methods. * Fix signature of setUp() to be compatible with recent phpunit. * Temporary fix syntax issues in test files Relates: #8092 --- Tests/Unit/Controller/DateControllerTest.php | 15 +++++---------- Tests/Unit/Controller/EventControllerTest.php | 15 +++++---------- .../Unit/Controller/EventsControllerTest.php | 15 +++++---------- Tests/Unit/Domain/Model/DateTest.php | 7 +------ Tests/Unit/Domain/Model/EventTest.php | 7 +------ Tests/Unit/Domain/Model/EventsTest.php | 19 +++++++------------ Tests/Unit/Domain/Model/OrganizerTest.php | 7 +------ Tests/Unit/Domain/Model/RegionTest.php | 7 +------ composer.json | 4 +++- 9 files changed, 29 insertions(+), 67 deletions(-) diff --git a/Tests/Unit/Controller/DateControllerTest.php b/Tests/Unit/Controller/DateControllerTest.php index d9769de..b9a7ba9 100644 --- a/Tests/Unit/Controller/DateControllerTest.php +++ b/Tests/Unit/Controller/DateControllerTest.php @@ -14,7 +14,7 @@ class DateControllerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase */ protected $subject = null; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->subject = $this->getMockBuilder(\Wrm\Events\Controller\DateController::class) @@ -23,11 +23,6 @@ class DateControllerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase ->getMock(); } - protected function tearDown() - { - parent::tearDown(); - } - /** * @test */ @@ -38,10 +33,10 @@ class DateControllerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase ->disableOriginalConstructor() ->getMock(); - $dateRepository = $this->getMockBuilder(\::class) - ->setMethods(['findAll']) - ->disableOriginalConstructor() - ->getMock(); + // $dateRepository = $this->getMockBuilder(\::class) + // ->setMethods(['findAll']) + // ->disableOriginalConstructor() + // ->getMock(); $dateRepository->expects(self::once())->method('findAll')->will(self::returnValue($allDates)); $this->inject($this->subject, 'dateRepository', $dateRepository); diff --git a/Tests/Unit/Controller/EventControllerTest.php b/Tests/Unit/Controller/EventControllerTest.php index 6a5309c..5ab1161 100644 --- a/Tests/Unit/Controller/EventControllerTest.php +++ b/Tests/Unit/Controller/EventControllerTest.php @@ -14,7 +14,7 @@ class EventControllerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase */ protected $subject = null; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->subject = $this->getMockBuilder(\Wrm\Events\Controller\EventController::class) @@ -23,11 +23,6 @@ class EventControllerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase ->getMock(); } - protected function tearDown() - { - parent::tearDown(); - } - /** * @test */ @@ -38,10 +33,10 @@ class EventControllerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase ->disableOriginalConstructor() ->getMock(); - $eventRepository = $this->getMockBuilder(\::class) - ->setMethods(['findAll']) - ->disableOriginalConstructor() - ->getMock(); + // $eventRepository = $this->getMockBuilder(\::class) + // ->setMethods(['findAll']) + // ->disableOriginalConstructor() + // ->getMock(); $eventRepository->expects(self::once())->method('findAll')->will(self::returnValue($allEvents)); $this->inject($this->subject, 'eventRepository', $eventRepository); diff --git a/Tests/Unit/Controller/EventsControllerTest.php b/Tests/Unit/Controller/EventsControllerTest.php index c0c3413..9efe3a9 100644 --- a/Tests/Unit/Controller/EventsControllerTest.php +++ b/Tests/Unit/Controller/EventsControllerTest.php @@ -14,7 +14,7 @@ class EventsControllerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCas */ protected $subject = null; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->subject = $this->getMockBuilder(\Wrm\Events\Controller\EventsController::class) @@ -23,11 +23,6 @@ class EventsControllerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCas ->getMock(); } - protected function tearDown() - { - parent::tearDown(); - } - /** * @test */ @@ -38,10 +33,10 @@ class EventsControllerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCas ->disableOriginalConstructor() ->getMock(); - $eventsRepository = $this->getMockBuilder(\::class) - ->setMethods(['findAll']) - ->disableOriginalConstructor() - ->getMock(); + // $eventsRepository = $this->getMockBuilder(\::class) + // ->setMethods(['findAll']) + // ->disableOriginalConstructor() + // ->getMock(); $eventsRepository->expects(self::once())->method('findAll')->will(self::returnValue($allEventss)); $this->inject($this->subject, 'eventsRepository', $eventsRepository); diff --git a/Tests/Unit/Domain/Model/DateTest.php b/Tests/Unit/Domain/Model/DateTest.php index da345a6..057c4a0 100644 --- a/Tests/Unit/Domain/Model/DateTest.php +++ b/Tests/Unit/Domain/Model/DateTest.php @@ -14,17 +14,12 @@ class DateTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase */ protected $subject = null; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->subject = new \Wrm\Events\Domain\Model\Date(); } - protected function tearDown() - { - parent::tearDown(); - } - /** * @test */ diff --git a/Tests/Unit/Domain/Model/EventTest.php b/Tests/Unit/Domain/Model/EventTest.php index d37fe9a..82de42c 100644 --- a/Tests/Unit/Domain/Model/EventTest.php +++ b/Tests/Unit/Domain/Model/EventTest.php @@ -14,17 +14,12 @@ class EventTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase */ protected $subject = null; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->subject = new \Wrm\Events\Domain\Model\Event(); } - protected function tearDown() - { - parent::tearDown(); - } - /** * @test */ diff --git a/Tests/Unit/Domain/Model/EventsTest.php b/Tests/Unit/Domain/Model/EventsTest.php index 0e8b3a1..25d9e4c 100644 --- a/Tests/Unit/Domain/Model/EventsTest.php +++ b/Tests/Unit/Domain/Model/EventsTest.php @@ -14,17 +14,12 @@ class EventsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase */ protected $subject = null; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->subject = new \Wrm\Events\Domain\Model\Events(); } - protected function tearDown() - { - parent::tearDown(); - } - /** * @test */ @@ -507,7 +502,7 @@ class EventsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase */ public function setDateForObjectStorageContainingSetsDate() { - $date = new (); + // $date = new (); $objectStorageHoldingExactlyOneDate = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); $objectStorageHoldingExactlyOneDate->attach($date); $this->subject->setDate($objectStorageHoldingExactlyOneDate); @@ -524,7 +519,7 @@ class EventsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase */ public function addDateToObjectStorageHoldingDate() { - $date = new (); + // $date = new (); $dateObjectStorageMock = $this->getMockBuilder(\TYPO3\CMS\Extbase\Persistence\ObjectStorage::class) ->setMethods(['attach']) ->disableOriginalConstructor() @@ -541,7 +536,7 @@ class EventsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase */ public function removeDateFromObjectStorageHoldingDate() { - $date = new (); + // $date = new (); $dateObjectStorageMock = $this->getMockBuilder(\TYPO3\CMS\Extbase\Persistence\ObjectStorage::class) ->setMethods(['detach']) ->disableOriginalConstructor() @@ -570,7 +565,7 @@ class EventsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase */ public function setRegionForObjectStorageContainingSetsRegion() { - $region = new (); + // $region = new (); $objectStorageHoldingExactlyOneRegion = new \TYPO3\CMS\Extbase\Persistence\ObjectStorage(); $objectStorageHoldingExactlyOneRegion->attach($region); $this->subject->setRegion($objectStorageHoldingExactlyOneRegion); @@ -587,7 +582,7 @@ class EventsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase */ public function addRegionToObjectStorageHoldingRegion() { - $region = new (); + // $region = new (); $regionObjectStorageMock = $this->getMockBuilder(\TYPO3\CMS\Extbase\Persistence\ObjectStorage::class) ->setMethods(['attach']) ->disableOriginalConstructor() @@ -604,7 +599,7 @@ class EventsTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase */ public function removeRegionFromObjectStorageHoldingRegion() { - $region = new (); + // $region = new (); $regionObjectStorageMock = $this->getMockBuilder(\TYPO3\CMS\Extbase\Persistence\ObjectStorage::class) ->setMethods(['detach']) ->disableOriginalConstructor() diff --git a/Tests/Unit/Domain/Model/OrganizerTest.php b/Tests/Unit/Domain/Model/OrganizerTest.php index b52b08f..1d38ff0 100644 --- a/Tests/Unit/Domain/Model/OrganizerTest.php +++ b/Tests/Unit/Domain/Model/OrganizerTest.php @@ -14,17 +14,12 @@ class OrganizerTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase */ protected $subject = null; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->subject = new \Wrm\Events\Domain\Model\Organizer(); } - protected function tearDown() - { - parent::tearDown(); - } - /** * @test */ diff --git a/Tests/Unit/Domain/Model/RegionTest.php b/Tests/Unit/Domain/Model/RegionTest.php index e74fb8f..0811d91 100644 --- a/Tests/Unit/Domain/Model/RegionTest.php +++ b/Tests/Unit/Domain/Model/RegionTest.php @@ -14,17 +14,12 @@ class RegionTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase */ protected $subject = null; - protected function setUp() + protected function setUp(): void { parent::setUp(); $this->subject = new \Wrm\Events\Domain\Model\Region(); } - protected function tearDown() - { - parent::tearDown(); - } - /** * @test */ diff --git a/composer.json b/composer.json index 0909f31..7431679 100644 --- a/composer.json +++ b/composer.json @@ -29,6 +29,8 @@ } }, "require-dev": { - "squizlabs/php_codesniffer": "^3.5" + "squizlabs/php_codesniffer": "^3.5", + "phpunit/phpunit": "^9.0", + "typo3/testing-framework": "^6.6" } } From 5a483b6b2a87ea84c4f1c3c4f1612dd1198cd059 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 7 Jan 2021 09:26:32 +0100 Subject: [PATCH 10/55] Allow to use plugin icon via identifier The icon is still a placeholder. Still we provide the identifier to already use it in sitepackages. That way the extension can exchange the file, but foreign configuration can stay. Relates: #8092 --- ext_localconf.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/ext_localconf.php b/ext_localconf.php index 9acbd89..d1ad0d8 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -26,15 +26,14 @@ call_user_func( [\Wrm\Events\Controller\DateController::class => 'show'] ); - /* $iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class); - $iconRegistry->registerIcon( 'events-plugin', \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class, ['source' => 'EXT:events/Resources/Public/Icons/user_plugin_events.svg'] ); + /* // wizards \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig( 'mod { From acc0c2bdc52cdb6b50c386937452e559ba20424e Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 7 Jan 2021 15:46:39 +0100 Subject: [PATCH 11/55] Manually migrate cascade annotation Relates: #8092 --- Classes/Domain/Model/Event.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Classes/Domain/Model/Event.php b/Classes/Domain/Model/Event.php index 6df87af..24bd30f 100644 --- a/Classes/Domain/Model/Event.php +++ b/Classes/Domain/Model/Event.php @@ -168,7 +168,7 @@ class Event extends AbstractEntity * images * * @var \TYPO3\CMS\Extbase\Domain\Model\FileReference - * @cascade remove + * @Extbase\ORM\Cascade remove */ protected $images = null; @@ -176,7 +176,7 @@ class Event extends AbstractEntity * dates * * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Wrm\Events\Domain\Model\Date> - * @cascade remove + * @Extbase\ORM\Cascade remove */ protected $dates = null; From 38b4844a9dc5f4af1d46ce43d7a15748c05b9278 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Mon, 11 Jan 2021 09:20:51 +0100 Subject: [PATCH 12/55] Add pages to events Allow editor to reference TYPO3 page records from events. E.g. used to provide further internal information links. Also those pages are resolved via DataProcessing. That allows integrators to be 100% flexible to resolve those page info. By default a menu is generated and media is resolved. Also validation is ignored, as this improves performance and allows to use the new class as injected property without validation fails. Models are not managed via frontend and therefore don't need validation. Relates: #8092 --- Classes/Controller/DateController.php | 18 ++ Classes/Controller/EventController.php | 18 ++ Classes/Domain/Model/Event.php | 32 ++- Classes/Service/DataProcessingForModels.php | 176 ++++++++++++ .../TCA/tx_events_domain_model_event.php | 15 +- Configuration/TypoScript/setup.typoscript | 15 ++ .../Language/de.locallang_csh_event.xlf | 254 +++++++++--------- .../Private/Language/locallang_csh_event.xlf | 187 ++++++------- ext_tables.sql | 1 + 9 files changed, 495 insertions(+), 221 deletions(-) create mode 100644 Classes/Service/DataProcessingForModels.php diff --git a/Classes/Controller/DateController.php b/Classes/Controller/DateController.php index b83e882..1a55ec9 100644 --- a/Classes/Controller/DateController.php +++ b/Classes/Controller/DateController.php @@ -4,6 +4,7 @@ namespace Wrm\Events\Controller; use TYPO3\CMS\Core\Database\QueryGenerator; use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Extbase\Annotation as Extbase; use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; use Wrm\Events\Domain\Model\Date; @@ -11,6 +12,7 @@ use Wrm\Events\Domain\Model\Dto\DateDemand; use Wrm\Events\Domain\Repository\CategoryRepository; use Wrm\Events\Domain\Repository\DateRepository; use Wrm\Events\Domain\Repository\RegionRepository; +use Wrm\Events\Service\DataProcessingForModels; /** * DateController @@ -38,6 +40,11 @@ class DateController extends ActionController */ protected $queryGenerator; + /** + * @var DataProcessingForModels + */ + protected $dataProcessing; + /** * @var array */ @@ -58,11 +65,20 @@ class DateController extends ActionController $this->categoryRepository = $categoryRepository; } + /** + * @param DataProcessingForModels $dataProcessing + */ + public function injectDataProcessingForModels(DataProcessingForModels $dataProcessing) + { + $this->dataProcessing = $dataProcessing; + } + /** * Action initializer */ protected function initializeAction() { + $this->dataProcessing->setConfigurationManager($this->configurationManager); $this->pluginSettings = $this->configurationManager->getConfiguration( ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK ); @@ -126,6 +142,8 @@ class DateController extends ActionController /** * action show * + * @Extbase\IgnoreValidation("date") + * * @param \Wrm\Events\Domain\Model\Date $date * @return void */ diff --git a/Classes/Controller/EventController.php b/Classes/Controller/EventController.php index 987f466..9c2e591 100644 --- a/Classes/Controller/EventController.php +++ b/Classes/Controller/EventController.php @@ -3,11 +3,13 @@ namespace Wrm\Events\Controller; use TYPO3\CMS\Core\Database\QueryGenerator; +use TYPO3\CMS\Extbase\Annotation as Extbase; use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; use Wrm\Events\Domain\Model\Dto\EventDemand; use Wrm\Events\Domain\Model\Event; use Wrm\Events\Domain\Repository\EventRepository; +use Wrm\Events\Service\DataProcessingForModels; /** * EventController @@ -26,6 +28,11 @@ class EventController extends ActionController */ protected $queryGenerator; + /** + * @var DataProcessingForModels + */ + protected $dataProcessing; + /** * @var array */ @@ -39,11 +46,20 @@ class EventController extends ActionController $this->eventRepository = $eventRepository; } + /** + * @param DataProcessingForModels $dataProcessing + */ + public function injectDataProcessingForModels(DataProcessingForModels $dataProcessing) + { + $this->dataProcessing = $dataProcessing; + } + /** * Action initializer */ protected function initializeAction() { + $this->dataProcessing->setConfigurationManager($this->configurationManager); $this->pluginSettings = $this->configurationManager->getConfiguration( ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK ); @@ -65,6 +81,8 @@ class EventController extends ActionController /** * Action show * + * @Extbase\IgnoreValidation("event") + * * @param Event $event * @return void */ diff --git a/Classes/Domain/Model/Event.php b/Classes/Domain/Model/Event.php index 24bd30f..d3ee979 100644 --- a/Classes/Domain/Model/Event.php +++ b/Classes/Domain/Model/Event.php @@ -2,7 +2,6 @@ namespace Wrm\Events\Domain\Model; -use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Annotation as Extbase; use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; use TYPO3\CMS\Extbase\Domain\Model\Category; @@ -10,6 +9,7 @@ use TYPO3\CMS\Extbase\Domain\Model\FileReference; use TYPO3\CMS\Extbase\Object\ObjectManager; use TYPO3\CMS\Extbase\Persistence\ObjectStorage; use Wrm\Events\Domain\Repository\DateRepository; +use Wrm\Events\Service\DataProcessingForModels; /** * Event @@ -194,6 +194,11 @@ class Event extends AbstractEntity */ protected $region = null; + /** + * @var string + */ + protected $pages = ''; + /** * categories * @@ -206,6 +211,11 @@ class Event extends AbstractEntity */ protected $_languageUid; + /** + * @var DataProcessingForModels + */ + private $dataProcessing = null; + /** * __construct */ @@ -216,6 +226,14 @@ class Event extends AbstractEntity $this->initStorageObjects(); } + /** + * @param DataProcessingForModels $dataProcessing + */ + public function injectDataProcessingForModels(DataProcessingForModels $dataProcessing) + { + $this->dataProcessing = $dataProcessing; + } + /** * @return void */ @@ -688,6 +706,18 @@ class Event extends AbstractEntity $this->country = $country; } + public function getPages(): array + { + static $pages = null; + if (is_array($pages)) { + return $pages; + } + + $pages = $this->dataProcessing->process($this); + + return $pages; + } + /** * @param \TYPO3\CMS\Extbase\Domain\Model\Category<\TYPO3\CMS\Extbase\Domain\Model\Category> $category */ diff --git a/Classes/Service/DataProcessingForModels.php b/Classes/Service/DataProcessingForModels.php new file mode 100644 index 0000000..bc5a596 --- /dev/null +++ b/Classes/Service/DataProcessingForModels.php @@ -0,0 +1,176 @@ + + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +use TYPO3\CMS\Core\Database\Connection; +use TYPO3\CMS\Core\Database\ConnectionPool; +use TYPO3\CMS\Core\SingletonInterface; +use TYPO3\CMS\Core\TypoScript\TypoScriptService; +use TYPO3\CMS\Core\Utility\ArrayUtility; +use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; +use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; +use TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapFactory; +use TYPO3\CMS\Frontend\ContentObject\ContentDataProcessor; +use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer; + +/** + * Used by models to apply data processing. + * This allows for flexibility of integrators. + * + * E.g. pages are saved for each event. + * An integrator now can resolve them via data processing to arrays or menus. + * + * dataProcessing is configured via TypoScript for each plugin or whole extension via + * settings.dataProcessing.fqcn, e.g.: + * + * plugin.tx_events { + * settings { + * dataProcessing { + * Wrm\Events\Domain\Model\Event { + * 10 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor + * 10 { + * special = list + * special.value.field = pages + * dataProcessing { + * 10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor + * 10 { + * references.fieldName = media + * } + * } + * } + * } + * } + * } + * } + * + * Currently supported by: + * + * - Event->getPages() + */ +class DataProcessingForModels implements SingletonInterface +{ + /** + * @var ContentObjectRenderer + */ + private $cObject; + + /** + * @var ContentDataProcessor + */ + private $processorHandler; + + /** + * @var Connection + */ + private $connection; + + /** + * @var DataMapFactory + */ + private $dataMapFactory; + + /** + * @var ConfigurationManagerInterface|null + */ + private $configurationManager; + + /** + * @var TypoScriptService + */ + private $typoScriptService; + + public function __construct( + ContentDataProcessor $processorHandler, + ConnectionPool $connectionPool, + DataMapFactory $dataMapFactory, + TypoScriptService $typoScriptService + ) { + $this->cObject = GeneralUtility::makeInstance(ContentObjectRenderer::class); + $this->processorHandler = $processorHandler; + $this->connection = $connectionPool->getConnectionByName('Default'); + $this->dataMapFactory = $dataMapFactory; + $this->typoScriptService = $typoScriptService; + } + + /** + * Used to set current configuration from within plugin. + * + * Inject and call this method, e.g. within initializeAction. + * Necessary to get plugin configuration containing dataProcessing configuration. + */ + public function setConfigurationManager(ConfigurationManagerInterface $configurationManager): void + { + $this->configurationManager = $configurationManager; + } + + public function process( + AbstractEntity $entity + ): array { + $configuration = $this->getConfiguration($entity); + + if ($configuration === []) { + return []; + } + + $this->cObject->start($this->getData($entity), $this->getTable($entity)); + return $this->processorHandler->process($this->cObject, $configuration, []); + } + + private function getData(AbstractEntity $entity): array + { + $row = $this->connection->select(['*'], $this->getTable($entity), ['uid' => $entity->getUid()])->fetch(); + if (is_array($row)) { + return $row; + } + + return []; + } + + private function getTable(AbstractEntity $entity): string + { + $dataMap = $this->dataMapFactory->buildDataMap(get_class($entity)); + return $dataMap->getTableName(); + } + + private function getConfiguration(AbstractEntity $entity): array + { + if ($this->configurationManager === null) { + return []; + } + + $className = get_class($entity); + $settings = $this->configurationManager->getConfiguration( + ConfigurationManagerInterface::CONFIGURATION_TYPE_SETTINGS + ); + + if (ArrayUtility::isValidPath($settings, 'dataProcessing.' . $className, '.') === false) { + return []; + } + + $configuration = ArrayUtility::getValueByPath($settings, 'dataProcessing.' . $className, '.'); + $configuration = $this->typoScriptService->convertPlainArrayToTypoScriptArray($configuration); + return [ + 'dataProcessing.' => $configuration, + ]; + } +} diff --git a/Configuration/TCA/tx_events_domain_model_event.php b/Configuration/TCA/tx_events_domain_model_event.php index 4cdff31..32ac676 100644 --- a/Configuration/TCA/tx_events_domain_model_event.php +++ b/Configuration/TCA/tx_events_domain_model_event.php @@ -20,7 +20,7 @@ return [ 'iconfile' => 'EXT:events/Resources/Public/Icons/tx_events_domain_model_event.gif' ], 'types' => [ - '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title, global_id, slug, highlight, teaser, details, price_info, name, street, district, city, zip, country, phone, web, ticket, facebook, youtube, instagram, latitude, longitude, images, categories, dates, organizer, region, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'], + '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title, global_id, slug, highlight, teaser, details, price_info, name, street, district, city, zip, country, phone, web, ticket, facebook, youtube, instagram, latitude, longitude, images, pages, categories, dates, organizer, region, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'], ], 'columns' => [ 'sys_language_uid' => [ @@ -185,7 +185,7 @@ return [ 'rows' => 15, 'eval' => 'trim', ], - + ], 'price_info' => [ 'exclude' => true, @@ -379,6 +379,16 @@ return [ ), ], + 'pages' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.pages', + 'config' => [ + 'type' => 'group', + 'internal_type' => 'db', + 'allowed' => 'pages', + ], + ], + 'categories' => [ 'exclude' => true, 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.categories', @@ -443,6 +453,5 @@ return [ 'maxitems' => 1, ], ], - ], ]; diff --git a/Configuration/TypoScript/setup.typoscript b/Configuration/TypoScript/setup.typoscript index 46197a6..71c4f8c 100644 --- a/Configuration/TypoScript/setup.typoscript +++ b/Configuration/TypoScript/setup.typoscript @@ -56,6 +56,21 @@ plugin.tx_events { categoriesPid = {$plugin.tx_events.settings.destinationData.categoriesPid} categoryParentUid = {$plugin.tx_events.settings.destinationData.categoryParentUid} } + dataProcessing { + Wrm\Events\Domain\Model\Event { + 10 = TYPO3\CMS\Frontend\DataProcessing\MenuProcessor + 10 { + special = list + special.value.field = pages + dataProcessing { + 10 = TYPO3\CMS\Frontend\DataProcessing\FilesProcessor + 10 { + references.fieldName = media + } + } + } + } + } } } diff --git a/Resources/Private/Language/de.locallang_csh_event.xlf b/Resources/Private/Language/de.locallang_csh_event.xlf index 0b8d472..5f157c9 100644 --- a/Resources/Private/Language/de.locallang_csh_event.xlf +++ b/Resources/Private/Language/de.locallang_csh_event.xlf @@ -1,128 +1,132 @@ - -
- - - Events - Veranstaltungen - - - Event Modul - Veranstaltungs Modul - - - Event - Veranstaltung - - - Title - Titel - - - Global UID - Globale UID - - - Slug - URL-Segment - - - Highlight - Höhepunkt - - - Teaser - Kurztext - - - Details - Text - - - Price Info - Preis Information - - - Name - Name - - - Street - Straße - - - District - Bundesland - - - City - Stadt - - - Zip - Postleitzahl - - - Country - Land - - - Web - Internet - - - Phone - Telefon - - - Ticket - Ticket - - - Facebook - Facebook - - - YouTube - YouTube - - - Instagram - Instagram - - - Latitude - Breitengrad - - - Longitude - Längengrad - - - Images - Bilder - - - Categories - Kategorien - - - Dates - Termine - - - Organizer - Organisator - - - Region - Region - - - Organizer - Organisator - - - + +
+ + + Events + Veranstaltungen + + + Event Modul + Veranstaltungs Modul + + + Event + Veranstaltung + + + Title + Titel + + + Global UID + Globale UID + + + Slug + URL-Segment + + + Highlight + Höhepunkt + + + Teaser + Kurztext + + + Details + Text + + + Price Info + Preis Information + + + Name + Name + + + Street + Straße + + + District + Bundesland + + + City + Stadt + + + Zip + Postleitzahl + + + Country + Land + + + Web + Internet + + + Phone + Telefon + + + Ticket + Ticket + + + Facebook + Facebook + + + YouTube + YouTube + + + Instagram + Instagram + + + Latitude + Breitengrad + + + Longitude + Längengrad + + + Images + Bilder + + + Pages + Seiten + + + Categories + Kategorien + + + Dates + Termine + + + Organizer + Organisator + + + Region + Region + + + Organizer + Organisator + + + diff --git a/Resources/Private/Language/locallang_csh_event.xlf b/Resources/Private/Language/locallang_csh_event.xlf index 6608918..7f781ba 100644 --- a/Resources/Private/Language/locallang_csh_event.xlf +++ b/Resources/Private/Language/locallang_csh_event.xlf @@ -1,95 +1,98 @@ - -
- - - Events - - - Event Modul - - - Event - - - Title - - - Global UID - - - Slug - - - Highlight - - - Teaser - - - Details - - - Price Info - - - Name - - - Street - - - District - - - City - - - Zip - - - Country - - - Web - - - Phone - - - Ticket - - - Facebook - - - Youtube - - - Instagram - - - Latitude - - - Longitude - - - Images - - - Categories - - - Dates - - - Organizer - - - Region - - - + +
+ + + Events + + + Event Modul + + + Event + + + Title + + + Global UID + + + Slug + + + Highlight + + + Teaser + + + Details + + + Price Info + + + Name + + + Street + + + District + + + City + + + Zip + + + Country + + + Web + + + Phone + + + Ticket + + + Facebook + + + Youtube + + + Instagram + + + Latitude + + + Longitude + + + Images + + + Pages + + + Categories + + + Dates + + + Organizer + + + Region + + + diff --git a/ext_tables.sql b/ext_tables.sql index d2b48a6..29ed630 100644 --- a/ext_tables.sql +++ b/ext_tables.sql @@ -26,6 +26,7 @@ CREATE TABLE tx_events_domain_model_event ( longitude varchar(255) DEFAULT '' NOT NULL, images int(11) unsigned NOT NULL default '0', categories int(11) DEFAULT '0' NOT NULL, + pages text, dates int(11) unsigned DEFAULT '0' NOT NULL, organizer int(11) unsigned DEFAULT '0', region int(11) unsigned DEFAULT '0', From 43d8a1c0d69af8e8608b43589d7861beb4392f60 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Mon, 11 Jan 2021 10:15:21 +0100 Subject: [PATCH 13/55] Add partner Add new record type partner. This can be something like a media partner or something else. Allow an event to have zero or more partner. Add necessary files and models with relations. Relates: #8092 --- Classes/Domain/Model/Event.php | 13 ++ Classes/Domain/Model/Partner.php | 59 ++++++++ .../TCA/tx_events_domain_model_event.php | 19 ++- .../TCA/tx_events_domain_model_partner.php | 133 ++++++++++++++++++ .../Language/de.locallang_csh_event.xlf | 4 + .../Language/de.locallang_csh_partner.xlf | 24 ++++ .../Private/Language/locallang_csh_event.xlf | 3 + .../Language/locallang_csh_partner.xlf | 20 +++ .../Icons/tx_events_domain_model_partner.gif | Bin 0 -> 230 bytes ext_tables.sql | 13 ++ 10 files changed, 287 insertions(+), 1 deletion(-) create mode 100644 Classes/Domain/Model/Partner.php create mode 100644 Configuration/TCA/tx_events_domain_model_partner.php create mode 100644 Resources/Private/Language/de.locallang_csh_partner.xlf create mode 100644 Resources/Private/Language/locallang_csh_partner.xlf create mode 100644 Resources/Public/Icons/tx_events_domain_model_partner.gif diff --git a/Classes/Domain/Model/Event.php b/Classes/Domain/Model/Event.php index d3ee979..db2996b 100644 --- a/Classes/Domain/Model/Event.php +++ b/Classes/Domain/Model/Event.php @@ -206,6 +206,11 @@ class Event extends AbstractEntity */ protected $categories; + /** + * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage + */ + protected $partner; + /** * @var int */ @@ -638,6 +643,14 @@ class Event extends AbstractEntity return $this->organizer; } + /** + * @return ObjectStorage + */ + public function getPartner(): ObjectStorage + { + return $this->partner; + } + /** * @param \Wrm\Events\Domain\Model\Organizer $organizer * @return void diff --git a/Classes/Domain/Model/Partner.php b/Classes/Domain/Model/Partner.php new file mode 100644 index 0000000..2b9a607 --- /dev/null +++ b/Classes/Domain/Model/Partner.php @@ -0,0 +1,59 @@ + + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; +use TYPO3\CMS\Extbase\Domain\Model\FileReference; +use TYPO3\CMS\Extbase\Persistence\ObjectStorage; + +class Partner extends AbstractEntity +{ + /** + * @var string + */ + protected $title = ''; + + /** + * @var string + */ + protected $link = ''; + + /** + * @var ObjectStorage + */ + protected $images = null; + + public function getTitle(): string + { + return $this->title; + } + + public function getLink(): string + { + return $this->link; + } + + public function getImages(): ObjectStorage + { + return $this->images; + } +} diff --git a/Configuration/TCA/tx_events_domain_model_event.php b/Configuration/TCA/tx_events_domain_model_event.php index 32ac676..b6eba8a 100644 --- a/Configuration/TCA/tx_events_domain_model_event.php +++ b/Configuration/TCA/tx_events_domain_model_event.php @@ -20,7 +20,7 @@ return [ 'iconfile' => 'EXT:events/Resources/Public/Icons/tx_events_domain_model_event.gif' ], 'types' => [ - '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title, global_id, slug, highlight, teaser, details, price_info, name, street, district, city, zip, country, phone, web, ticket, facebook, youtube, instagram, latitude, longitude, images, pages, categories, dates, organizer, region, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'], + '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title, global_id, slug, highlight, teaser, details, price_info, name, street, district, city, zip, country, phone, web, ticket, facebook, youtube, instagram, latitude, longitude, images, pages, categories, dates, organizer, region, partner, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'], ], 'columns' => [ 'sys_language_uid' => [ @@ -453,5 +453,22 @@ return [ 'maxitems' => 1, ], ], + + 'partner' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.partner', + 'config' => [ + 'type' => 'group', + 'internal_type' => 'db', + 'allowed' => 'tx_events_domain_model_partner', + 'fieldControl' => [ + 'addRecord' => [ + 'disabled' => false, + 'pid' => '###CURRENT_PID###', + 'table' => 'tx_events_domain_model_partner', + ], + ], + ], + ], ], ]; diff --git a/Configuration/TCA/tx_events_domain_model_partner.php b/Configuration/TCA/tx_events_domain_model_partner.php new file mode 100644 index 0000000..88320c3 --- /dev/null +++ b/Configuration/TCA/tx_events_domain_model_partner.php @@ -0,0 +1,133 @@ + [ + 'title' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_partner.xlf:tx_events_domain_model_partner', + 'label' => 'title', + 'thumbnail' => 'images', + 'tstamp' => 'tstamp', + 'crdate' => 'crdate', + 'cruser_id' => 'cruser_id', + 'versioningWS' => true, + 'languageField' => 'sys_language_uid', + 'transOrigPointerField' => 'l10n_parent', + 'transOrigDiffSourceField' => 'l10n_diffsource', + 'delete' => 'deleted', + 'enablecolumns' => [ + 'disabled' => 'hidden', + ], + 'searchFields' => 'title', + 'iconfile' => 'EXT:events/Resources/Public/Icons/tx_events_domain_model_partner.gif' + ], + 'types' => [ + '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title, link, images, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access'], + ], + 'columns' => [ + 'sys_language_uid' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.language', + 'config' => [ + 'type' => 'select', + 'renderType' => 'selectSingle', + 'special' => 'languages', + 'items' => [ + [ + 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.allLanguages', + -1, + 'flags-multiple' + ] + ], + 'default' => 0, + ], + ], + 'l10n_parent' => [ + 'displayCond' => 'FIELD:sys_language_uid:>:0', + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.l18n_parent', + 'config' => [ + 'type' => 'select', + 'renderType' => 'selectSingle', + 'default' => 0, + 'items' => [ + ['', 0], + ], + 'foreign_table' => 'tx_events_domain_model_partner', + 'foreign_table_where' => 'AND {#tx_events_domain_model_partner}.{#pid}=###CURRENT_PID### AND {#tx_events_domain_model_partner}.{#sys_language_uid} IN (-1,0)', + ], + ], + 'l10n_diffsource' => [ + 'config' => [ + 'type' => 'passthrough', + ], + ], + 't3ver_label' => [ + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.versionLabel', + 'config' => [ + 'type' => 'input', + 'size' => 30, + 'max' => 255, + ], + ], + 'hidden' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.visible', + 'config' => [ + 'type' => 'check', + 'renderType' => 'checkboxToggle', + 'items' => [ + [ + 0 => '', + 1 => '', + 'invertStateDisplay' => true + ] + ], + ], + ], + + 'title' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_partner.xlf:tx_events_domain_model_partner.title', + 'config' => [ + 'type' => 'input', + 'size' => 30, + 'eval' => 'trim' + ] + ], + 'link' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_partner.xlf:tx_events_domain_model_partner.link', + 'config' => [ + 'type' => 'input', + 'renderType' => 'inputLink', + 'eval' => 'trim', + 'max' => 1024, + 'size' => 50, + 'softref' => 'typolink', + ], + ], + 'images' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_partner.xlf:tx_events_domain_model_partner.images', + 'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig('images', [ + 'appearance' => [ + 'createNewRelationLinkTitle' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:images.addFileReference' + ], + // custom configuration for displaying fields in the overlay/reference table + // to use the imageoverlayPalette instead of the basicoverlayPalette + 'overrideChildTca' => [ + 'types' => [ + '0' => [ + 'showitem' => ' + --palette--;;imageoverlayPalette, + --palette--;;filePalette' + ], + \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [ + 'showitem' => ' + --palette--;;imageoverlayPalette, + --palette--;;filePalette' + ], + ], + ], + ], $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext']) + ], + ], +]; diff --git a/Resources/Private/Language/de.locallang_csh_event.xlf b/Resources/Private/Language/de.locallang_csh_event.xlf index 5f157c9..d221efd 100644 --- a/Resources/Private/Language/de.locallang_csh_event.xlf +++ b/Resources/Private/Language/de.locallang_csh_event.xlf @@ -127,6 +127,10 @@ Organizer Organisator + + Partner + Partner + diff --git a/Resources/Private/Language/de.locallang_csh_partner.xlf b/Resources/Private/Language/de.locallang_csh_partner.xlf new file mode 100644 index 0000000..4f026b9 --- /dev/null +++ b/Resources/Private/Language/de.locallang_csh_partner.xlf @@ -0,0 +1,24 @@ + + + +
+ + + Partner + Partner + + + Title + Titel + + + Link + Link + + + Images + Bilder + + + + diff --git a/Resources/Private/Language/locallang_csh_event.xlf b/Resources/Private/Language/locallang_csh_event.xlf index 7f781ba..256f3c7 100644 --- a/Resources/Private/Language/locallang_csh_event.xlf +++ b/Resources/Private/Language/locallang_csh_event.xlf @@ -93,6 +93,9 @@ Region + + Partner + diff --git a/Resources/Private/Language/locallang_csh_partner.xlf b/Resources/Private/Language/locallang_csh_partner.xlf new file mode 100644 index 0000000..cbfc87b --- /dev/null +++ b/Resources/Private/Language/locallang_csh_partner.xlf @@ -0,0 +1,20 @@ + + + +
+ + + Partner + + + Title + + + Link + + + Images + + + + diff --git a/Resources/Public/Icons/tx_events_domain_model_partner.gif b/Resources/Public/Icons/tx_events_domain_model_partner.gif new file mode 100644 index 0000000000000000000000000000000000000000..37ba37b9b3a220018e3a291bf2ee413d0da30ce0 GIT binary patch literal 230 zcmZ?wbh9u|6krfwIKlt|GBPr{y1EAX`lY3%Jv}|Mz+f2|Yy*R1U~nA_UV_1QFaYW; z2AhC~Q2fcl$iN`NpaW6^vXg-|S;5tE3G-Y5<#kHRdp8`B$dNv*cXpRhl~&t>ccvU1 zeHPQ2GIn^1cr6p&73IaoD$=91iK~a{(6rVH&ROOxH+%Y4hNqsq`BO~MkEuZ}q3Mby Zn_ZKDm69U|7Z(ptCx?^igb9ia)&LfwP0|1W literal 0 HcmV?d00001 diff --git a/ext_tables.sql b/ext_tables.sql index 29ed630..ade216c 100644 --- a/ext_tables.sql +++ b/ext_tables.sql @@ -29,6 +29,7 @@ CREATE TABLE tx_events_domain_model_event ( pages text, dates int(11) unsigned DEFAULT '0' NOT NULL, organizer int(11) unsigned DEFAULT '0', + partner text, region int(11) unsigned DEFAULT '0', KEY dataHandler (l10n_parent, t3ver_oid, deleted, t3ver_wsid, t3ver_state) ); @@ -50,6 +51,18 @@ CREATE TABLE tx_events_domain_model_organizer ( KEY dataHandler (l10n_parent, sys_language_uid, deleted) ); +# +# Table structure for table 'tx_events_domain_model_partner' +# +CREATE TABLE tx_events_domain_model_partner ( + + title varchar(255) DEFAULT '' NOT NULL, + link varchar(255) DEFAULT '' NOT NULL, + images int(11) unsigned NOT NULL default '0', + + KEY dataHandler (l10n_parent, sys_language_uid, deleted) +); + # # Table structure for table 'tx_events_domain_model_date' # From 8da7284e1f55b0f82c65910c545ff9f495cb2b59 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Mon, 11 Jan 2021 10:16:10 +0100 Subject: [PATCH 14/55] Allow f:debug for event models Private properties lead to an exception when using f:debug in Fluid. Relates: #8092 --- Classes/Domain/Model/Event.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/Domain/Model/Event.php b/Classes/Domain/Model/Event.php index db2996b..1ed3320 100644 --- a/Classes/Domain/Model/Event.php +++ b/Classes/Domain/Model/Event.php @@ -219,7 +219,7 @@ class Event extends AbstractEntity /** * @var DataProcessingForModels */ - private $dataProcessing = null; + protected $dataProcessing = null; /** * __construct From 17bd83eedfc3419e85fb08d873f0bade04fdc6af Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Tue, 12 Jan 2021 14:12:58 +0100 Subject: [PATCH 15/55] Provide new "Event selected" plugin Allow editors to select specific events to display. Therefore add new necessary demand and setting for events and respect them within repository. Relates: #8092 --- Classes/Controller/EventController.php | 4 +++ Classes/Domain/Model/Dto/EventDemand.php | 21 +++++++++++++ Classes/Domain/Repository/EventRepository.php | 27 ++++++++++++++++- Configuration/FlexForms/Selected.xml | 24 +++++++++++++++ Configuration/TCA/Overrides/tt_content.php | 16 ++++++++++ .../Private/Language/de.locallang_db.xlf | 30 +++++++++++-------- Resources/Private/Language/locallang_db.xlf | 25 +++++++++------- ext_localconf.php | 6 ++++ 8 files changed, 128 insertions(+), 25 deletions(-) create mode 100644 Configuration/FlexForms/Selected.xml diff --git a/Classes/Controller/EventController.php b/Classes/Controller/EventController.php index 9c2e591..fae6ed2 100644 --- a/Classes/Controller/EventController.php +++ b/Classes/Controller/EventController.php @@ -3,6 +3,7 @@ namespace Wrm\Events\Controller; use TYPO3\CMS\Core\Database\QueryGenerator; +use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Annotation as Extbase; use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; @@ -122,6 +123,7 @@ class EventController extends ActionController protected function createDemandFromSettings(): EventDemand { + /** @var EventDemand $demand */ $demand = $this->objectManager->get(EventDemand::class); $demand->setRegion((string)$this->settings['region']); @@ -138,6 +140,8 @@ class EventController extends ActionController $demand->setHighlight((bool)$this->settings['highlight']); + $demand->setRecordUids(GeneralUtility::intExplode(',', $this->settings['selectedRecords'], true)); + if (!empty($this->settings['limit'])) { $demand->setLimit($this->settings['limit']); } diff --git a/Classes/Domain/Model/Dto/EventDemand.php b/Classes/Domain/Model/Dto/EventDemand.php index eb74e00..f07f843 100644 --- a/Classes/Domain/Model/Dto/EventDemand.php +++ b/Classes/Domain/Model/Dto/EventDemand.php @@ -45,6 +45,11 @@ class EventDemand */ protected $limit = ''; + /** + * @var array + */ + protected $recordUids = []; + /** * @return string */ @@ -172,4 +177,20 @@ class EventDemand { $this->limit = $limit; } + + /** + * @return array + */ + public function getRecordUids(): array + { + return $this->recordUids; + } + + /** + * @param array $recordUids + */ + public function setRecordUids(array $recordUids): void + { + $this->recordUids = $recordUids; + } } diff --git a/Classes/Domain/Repository/EventRepository.php b/Classes/Domain/Repository/EventRepository.php index ebcfcc2..4b12613 100644 --- a/Classes/Domain/Repository/EventRepository.php +++ b/Classes/Domain/Repository/EventRepository.php @@ -20,6 +20,7 @@ use TYPO3\CMS\Extbase\Persistence\QueryInterface; use TYPO3\CMS\Extbase\Persistence\QueryResultInterface; use TYPO3\CMS\Extbase\Persistence\Repository; use Wrm\Events\Domain\Model\Dto\EventDemand; +use Wrm\Events\Domain\Model\Event; use Wrm\Events\Service\CategoryService; class EventRepository extends Repository @@ -56,6 +57,11 @@ class EventRepository extends Repository public function findByDemand(EventDemand $demand) { $query = $this->createDemandQuery($demand); + + if ($demand->getRecordUids() !== [] && $demand->getSortBy() === 'default') { + return $this->sortByDemand($query, $demand); + } + return $query->execute(); } @@ -70,7 +76,8 @@ class EventRepository extends Repository // sorting $sortBy = $demand->getSortBy(); - if ($sortBy && $sortBy !== 'singleSelection' && $sortBy !== 'default') { + $sortingsToIgnore = ['singleSelection', 'default']; + if ($sortBy && in_array($sortBy, $sortingsToIgnore) === false) { $order = strtolower($demand->getSortOrder()) === 'desc' ? QueryInterface::ORDER_DESCENDING : QueryInterface::ORDER_ASCENDING; $query->setOrderings([$sortBy => $order]); } @@ -88,6 +95,10 @@ class EventRepository extends Repository } } + if ($demand->getRecordUids() !== []) { + $constraints['recordUids'] = $query->in('uid', $demand->getRecordUids()); + } + if ($demand->getRegion() !== '') { $constraints['region'] = $query->equals('region', $demand->getRegion()); } @@ -133,6 +144,20 @@ class EventRepository extends Repository return $constraints; } + private function sortByDemand(QueryInterface $query, EventDemand $demand): array + { + $result = $query->execute()->toArray(); + $expectedSorting = $demand->getRecordUids(); + + usort($result, function (Event $eventA, Event $eventB) use ($expectedSorting) { + $positionOfA = array_search($eventA->getUid(), $expectedSorting); + $positionOfB = array_search($eventB->getUid(), $expectedSorting); + + return $positionOfA <=> $positionOfB; + }); + + return $result; + } public function findSearchWord($search) { diff --git a/Configuration/FlexForms/Selected.xml b/Configuration/FlexForms/Selected.xml new file mode 100644 index 0000000..d4a590e --- /dev/null +++ b/Configuration/FlexForms/Selected.xml @@ -0,0 +1,24 @@ + + + + + array + + + + 1 + + + group + db + tx_events_domain_model_event + 1 + 1 + + + + + + + + diff --git a/Configuration/TCA/Overrides/tt_content.php b/Configuration/TCA/Overrides/tt_content.php index eda0c55..b0fb92b 100644 --- a/Configuration/TCA/Overrides/tt_content.php +++ b/Configuration/TCA/Overrides/tt_content.php @@ -69,4 +69,20 @@ call_user_func(function () { ); + /* Event Selected Plugin */ + + \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin( + 'Events', + 'Selected', + 'Events: Show selected', + 'EXT:events/Resources/Public/Icons/user_plugin_events.svg' + ); + + $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['events_selected'] = 'pi_flexform'; + + \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue( + 'events_selected', + 'FILE:EXT:events/Configuration/FlexForms/Selected.xml' + ); + }); diff --git a/Resources/Private/Language/de.locallang_db.xlf b/Resources/Private/Language/de.locallang_db.xlf index 468831a..53d8dbd 100644 --- a/Resources/Private/Language/de.locallang_db.xlf +++ b/Resources/Private/Language/de.locallang_db.xlf @@ -1,16 +1,20 @@ - -
- - - Events - Veranstaltungen - - - Event Modul - Veranstaltungs Modul - - - + +
+ + + Events + Veranstaltungen + + + Event Modul + Veranstaltungs Modul + + + Records to show + Anzuzeigende Veranstaltungen + + + diff --git a/Resources/Private/Language/locallang_db.xlf b/Resources/Private/Language/locallang_db.xlf index 9462876..03080c4 100644 --- a/Resources/Private/Language/locallang_db.xlf +++ b/Resources/Private/Language/locallang_db.xlf @@ -1,14 +1,17 @@ - -
- - - Events - - - Event Modul - - - + +
+ + + Events + + + Event Modul + + + Records to show + + + diff --git a/ext_localconf.php b/ext_localconf.php index d1ad0d8..caa33be 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -26,6 +26,12 @@ call_user_func( [\Wrm\Events\Controller\DateController::class => 'show'] ); + \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( + 'Events', + 'Selected', + [\Wrm\Events\Controller\EventController::class => 'list'] + ); + $iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class); $iconRegistry->registerIcon( 'events-plugin', From f1118842994621d73bef049a9b0a4a8a699722a8 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Tue, 12 Jan 2021 14:34:13 +0100 Subject: [PATCH 16/55] Refactor and streamline event code Make controller smaller, remove unused code. Move creation of demand object into its own factory. Reduce npath complexity in repository and move parts into named methods. --- Classes/Controller/EventController.php | 117 +++----------- .../Domain/Model/Dto/EventDemandFactory.php | 58 +++++++ Classes/Domain/Repository/EventRepository.php | 150 +++++++++--------- 3 files changed, 150 insertions(+), 175 deletions(-) create mode 100644 Classes/Domain/Model/Dto/EventDemandFactory.php diff --git a/Classes/Controller/EventController.php b/Classes/Controller/EventController.php index fae6ed2..2f4ef3b 100644 --- a/Classes/Controller/EventController.php +++ b/Classes/Controller/EventController.php @@ -2,32 +2,20 @@ namespace Wrm\Events\Controller; -use TYPO3\CMS\Core\Database\QueryGenerator; -use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Annotation as Extbase; -use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; use Wrm\Events\Domain\Model\Dto\EventDemand; +use Wrm\Events\Domain\Model\Dto\EventDemandFactory; use Wrm\Events\Domain\Model\Event; use Wrm\Events\Domain\Repository\EventRepository; use Wrm\Events\Service\DataProcessingForModels; -/** - * EventController - */ - class EventController extends ActionController { - /** - * @var eventRepository + * @var EventRepository */ - protected $eventRepository = null; - - /** - * @var QueryGenerator - */ - protected $queryGenerator; + protected $eventRepository; /** * @var DataProcessingForModels @@ -35,117 +23,54 @@ class EventController extends ActionController protected $dataProcessing; /** - * @var array + * @var EventDemandFactory */ - protected $pluginSettings; + protected $demandFactory; - /** - * @param EventRepository $eventRepository - */ - public function injectEventRepository(EventRepository $eventRepository) - { + public function __construct( + EventRepository $eventRepository, + DataProcessingForModels $dataProcessing, + EventDemandFactory $demandFactory + ) { $this->eventRepository = $eventRepository; - } - - /** - * @param DataProcessingForModels $dataProcessing - */ - public function injectDataProcessingForModels(DataProcessingForModels $dataProcessing) - { $this->dataProcessing = $dataProcessing; + $this->demandFactory = $demandFactory; } - /** - * Action initializer - */ protected function initializeAction() { $this->dataProcessing->setConfigurationManager($this->configurationManager); - $this->pluginSettings = $this->configurationManager->getConfiguration( - ConfigurationManagerInterface::CONFIGURATION_TYPE_FRAMEWORK - ); } - /** - * Action list - * - * @return void - */ - public function listAction() + public function listAction(): void { - - $demand = $this->createDemandFromSettings(); + $demand = $this->demandFactory->fromSettings($this->settings); $events = $this->eventRepository->findByDemand($demand); $this->view->assign('events', $events); } /** - * Action show - * * @Extbase\IgnoreValidation("event") - * - * @param Event $event - * @return void */ - public function showAction(Event $event) + public function showAction(Event $event): void { $this->view->assign('event', $event); } /** - * action teaser - * - * @return void + * @deprecated Use listAction instead and configure settings properly. + * Use Settings or something else to switch between list and teaser rendering. */ - public function teaserAction() + public function teaserAction(): void { - $events = $this->eventRepository->findByUids($this->settings['eventUids']); - $this->view->assign('events', $events); + $this->view->assignMultiple([ + 'events' => $this->eventRepository->findByUids($this->settings['eventUids']), + ]); } - /** - * @param string $search - */ - public function searchAction(): void + public function searchAction(string $search = ''): void { - $search = ''; - if ($this->request->hasArgument('search')) { - $search = $this->request->getArgument('search'); - } - $this->view->assign('search', $search); $this->view->assign('events', $this->eventRepository->findSearchWord($search)); } - - /** - * @return EventDemand - */ - - protected function createDemandFromSettings(): EventDemand - { - /** @var EventDemand $demand */ - $demand = $this->objectManager->get(EventDemand::class); - - $demand->setRegion((string)$this->settings['region']); - - $demand->setCategories((string)$this->settings['categories']); - $categoryCombination = (int)$this->settings['categoryCombination'] === 1 ? 'or' : 'and'; - - $demand->setCategoryCombination($categoryCombination); - - $demand->setIncludeSubCategories((bool)$this->settings['includeSubcategories']); - - $demand->setSortBy((string)$this->settings['sortByEvent']); - $demand->setSortOrder((string)$this->settings['sortOrder']); - - $demand->setHighlight((bool)$this->settings['highlight']); - - $demand->setRecordUids(GeneralUtility::intExplode(',', $this->settings['selectedRecords'], true)); - - if (!empty($this->settings['limit'])) { - $demand->setLimit($this->settings['limit']); - } - - return $demand; - } } diff --git a/Classes/Domain/Model/Dto/EventDemandFactory.php b/Classes/Domain/Model/Dto/EventDemandFactory.php new file mode 100644 index 0000000..7011fc7 --- /dev/null +++ b/Classes/Domain/Model/Dto/EventDemandFactory.php @@ -0,0 +1,58 @@ + + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +use TYPO3\CMS\Core\Utility\GeneralUtility; + +class EventDemandFactory +{ + public function fromSettings(array $settings): EventDemand + { + /** @var EventDemand $demand */ + $demand = GeneralUtility::makeInstance(EventDemand::class); + + $demand->setRegion((string)$settings['region']); + + $demand->setCategories((string)$settings['categories']); + + $categoryCombination = 'and'; + if ((int)$settings['categoryCombination'] === 1) { + $categoryCombination = 'or'; + } + $demand->setCategoryCombination($categoryCombination); + + $demand->setIncludeSubCategories((bool)$settings['includeSubcategories']); + + $demand->setSortBy((string)$settings['sortByEvent']); + $demand->setSortOrder((string)$settings['sortOrder']); + + $demand->setHighlight((bool)$settings['highlight']); + + $demand->setRecordUids(GeneralUtility::intExplode(',', $settings['selectedRecords'], true)); + + if (!empty($settings['limit'])) { + $demand->setLimit($settings['limit']); + } + + return $demand; + } +} diff --git a/Classes/Domain/Repository/EventRepository.php b/Classes/Domain/Repository/EventRepository.php index 4b12613..a40eb95 100644 --- a/Classes/Domain/Repository/EventRepository.php +++ b/Classes/Domain/Repository/EventRepository.php @@ -16,6 +16,7 @@ namespace Wrm\Events\Domain\Repository; */ use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Extbase\Persistence\Generic\Qom\ConstraintInterface; use TYPO3\CMS\Extbase\Persistence\QueryInterface; use TYPO3\CMS\Extbase\Persistence\QueryResultInterface; use TYPO3\CMS\Extbase\Persistence\Repository; @@ -25,33 +26,16 @@ use Wrm\Events\Service\CategoryService; class EventRepository extends Repository { - - /** - * Find all products based on selected uids - * - * @param string $uids - * - * @return array - */ - public function findByUids($uids) + public function findByUids(string $uids): QueryResultInterface { - $uids = explode(',', $uids); - $query = $this->createQuery(); - //$query->getQuerySettings()->setRespectStoragePage(false); - - $query->matching( - $query->in('uid', $uids) - ); - - //return $this->orderByField($query->execute(), $uids); + $query->matching($query->in('uid', GeneralUtility::intExplode(',', $uids))); return $query->execute(); } /** - * @param EventDemand $demand - * @return QueryResultInterface + * @return QueryResultInterface|array * @throws InvalidQueryException */ public function findByDemand(EventDemand $demand) @@ -66,82 +50,42 @@ class EventRepository extends Repository } /** - * @param EventDemand $demand - * @return QueryInterface * @throws InvalidQueryException */ protected function createDemandQuery(EventDemand $demand): QueryInterface { $query = $this->createQuery(); + $query = $this->setOrderings($query, $demand); - // sorting - $sortBy = $demand->getSortBy(); - $sortingsToIgnore = ['singleSelection', 'default']; - if ($sortBy && in_array($sortBy, $sortingsToIgnore) === false) { - $order = strtolower($demand->getSortOrder()) === 'desc' ? QueryInterface::ORDER_DESCENDING : QueryInterface::ORDER_ASCENDING; - $query->setOrderings([$sortBy => $order]); - } - - $constraints = []; - - $categories = $demand->getCategories(); - - if ($categories) { - $categoryConstraints = $this->createCategoryConstraint($query, $categories, $demand->getIncludeSubCategories()); - if ($demand->getCategoryCombination() === 'or') { - $constraints['categories'] = $query->logicalOr($categoryConstraints); - } else { - $constraints['categories'] = $query->logicalAnd($categoryConstraints); - } - } - - if ($demand->getRecordUids() !== []) { - $constraints['recordUids'] = $query->in('uid', $demand->getRecordUids()); - } - - if ($demand->getRegion() !== '') { - $constraints['region'] = $query->equals('region', $demand->getRegion()); - } - - if ($demand->getHighlight()) { - $constraints['highlight'] = $query->equals('highlight', $demand->getHighlight()); + $constraints = $this->getConstraints($query, $demand); + if (!empty($constraints)) { + $query->matching($query->logicalAnd($constraints)); } if ($demand->getLimit() !== '') { $query->setLimit((int) $demand->getLimit()); } - if (!empty($constraints)) { - $query->matching($query->logicalAnd($constraints)); - } return $query; } - /** - * @param QueryInterface $query - * @param string $categories - * @param bool $includeSubCategories - * @return array - * @throws InvalidQueryException - */ - protected function createCategoryConstraint(QueryInterface $query, $categories, bool $includeSubCategories = false): array + private function setOrderings(QueryInterface $query, EventDemand $demand): QueryInterface { - $constraints = []; + $sortBy = $demand->getSortBy(); + $sortingsToIgnore = ['singleSelection', 'default']; - if ($includeSubCategories) { - $categoryService = GeneralUtility::makeInstance(CategoryService::class); - $allCategories = $categoryService->getChildrenCategories($categories); - if (!\is_array($allCategories)) { - $allCategories = GeneralUtility::intExplode(',', $allCategories, true); - } - } else { - $allCategories = GeneralUtility::intExplode(',', $categories, true); + if (!$sortBy || in_array($sortBy, $sortingsToIgnore)) { + return $query; } - foreach ($allCategories as $category) { - $constraints[] = $query->contains('categories', $category); + $order = QueryInterface::ORDER_ASCENDING; + if (strtolower($demand->getSortOrder()) === 'desc') { + $order = QueryInterface::ORDER_DESCENDING; } - return $constraints; + + $query->setOrderings([$sortBy => $order]); + + return $query; } private function sortByDemand(QueryInterface $query, EventDemand $demand): array @@ -159,12 +103,60 @@ class EventRepository extends Repository return $result; } + private function getConstraints(QueryInterface $query, EventDemand $demand): array + { + $constraints = []; + + if ($demand->getCategories()) { + $constraints['categories'] = $this->createCategoryConstraint($query, $demand); + } + + if ($demand->getRecordUids() !== []) { + $constraints['recordUids'] = $query->in('uid', $demand->getRecordUids()); + } + + if ($demand->getRegion() !== '') { + $constraints['region'] = $query->equals('region', $demand->getRegion()); + } + + if ($demand->getHighlight()) { + $constraints['highlight'] = $query->equals('highlight', $demand->getHighlight()); + } + + return $constraints; + } + + /** + * @throws InvalidQueryException + */ + protected function createCategoryConstraint(QueryInterface $query, EventDemand $demand): ConstraintInterface + { + $constraints = []; + + $allCategories = GeneralUtility::intExplode(',', $demand->getCategories(), true); + + if ($demand->includeSubCategories()) { + $categoryService = GeneralUtility::makeInstance(CategoryService::class); + $allCategories = $categoryService->getChildrenCategories($demand->getCategories()); + if (!\is_array($allCategories)) { + $allCategories = GeneralUtility::intExplode(',', $allCategories, true); + } + } + + foreach ($allCategories as $category) { + $constraints[] = $query->contains('demand->getCategories()', $category); + } + + if ($demand->getCategoryCombination() === 'or') { + return $query->logicalOr($constraints); + } + return $query->logicalAnd($constraints); + } + public function findSearchWord($search) { $query = $this->createQuery(); - $query->matching( - $query->like('title', '%' . $search . '%') - ); + $query->matching($query->like('title', '%' . $search . '%')); $query->setOrderings(['title' => QueryInterface::ORDER_ASCENDING]); $query->setLimit(20); return $query->execute(); From ca7340782b66cb08f4c486dc88acfe8598b0aaf4 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Tue, 12 Jan 2021 16:42:58 +0100 Subject: [PATCH 17/55] Allow an date to be marked as canceled That has no effect, the info is just available from model. This can be used to display a canceled date in a different way, or render a notice. Relates: #8092 --- Classes/Domain/Model/Date.php | 10 ++++ .../TCA/tx_events_domain_model_date.php | 17 ++++++- .../TCA/tx_events_domain_model_event.php | 2 + .../Language/de.locallang_csh_date.xlf | 50 +++++++++++-------- .../Private/Language/locallang_csh_date.xlf | 40 ++++++++------- ext_tables.sql | 1 + 6 files changed, 81 insertions(+), 39 deletions(-) diff --git a/Classes/Domain/Model/Date.php b/Classes/Domain/Model/Date.php index 33b017f..8915380 100644 --- a/Classes/Domain/Model/Date.php +++ b/Classes/Domain/Model/Date.php @@ -20,6 +20,11 @@ class Date extends AbstractEntity */ protected $end = null; + /** + * @var bool + */ + protected $canceled = false; + /** * @var \Wrm\Events\Domain\Model\Event */ @@ -64,6 +69,11 @@ class Date extends AbstractEntity $this->end = $end; } + public function isCanceled(): bool + { + return $this->canceled; + } + /** * @return Event */ diff --git a/Configuration/TCA/tx_events_domain_model_date.php b/Configuration/TCA/tx_events_domain_model_date.php index 05ebf39..1aa1f5c 100644 --- a/Configuration/TCA/tx_events_domain_model_date.php +++ b/Configuration/TCA/tx_events_domain_model_date.php @@ -1,8 +1,11 @@ [ 'title' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_date.xlf:tx_events_domain_model_date', 'label' => 'start', + 'label_alt' => 'end, canceled', + 'label_alt_force' => true, 'tstamp' => 'tstamp', 'crdate' => 'crdate', 'cruser_id' => 'cruser_id', @@ -20,7 +23,7 @@ return [ 'iconfile' => 'EXT:events/Resources/Public/Icons/tx_events_domain_model_date.gif' ], 'types' => [ - '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, start, end, event, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'], + '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, start, end, canceled, event, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'], ], 'columns' => [ 'sys_language_uid' => [ @@ -136,6 +139,18 @@ return [ 'default' => null, ], ], + 'canceled' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_date.xlf:tx_events_domain_model_date.canceled', + 'config' => [ + 'type' => 'check', + 'renderType' => 'checkboxToggle', + 'default' => 0, + 'items' => [ + ['LLL:EXT:events/Resources/Private/Language/locallang_csh_date.xlf:tx_events_domain_model_date.canceled.yes'], + ], + ], + ], 'event' => array( 'exclude' => 1, diff --git a/Configuration/TCA/tx_events_domain_model_event.php b/Configuration/TCA/tx_events_domain_model_event.php index b6eba8a..ed72bbf 100644 --- a/Configuration/TCA/tx_events_domain_model_event.php +++ b/Configuration/TCA/tx_events_domain_model_event.php @@ -1,8 +1,10 @@ [ 'title' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event', 'label' => 'title', + 'thumbnail' => 'images', 'tstamp' => 'tstamp', 'crdate' => 'crdate', 'cruser_id' => 'cruser_id', diff --git a/Resources/Private/Language/de.locallang_csh_date.xlf b/Resources/Private/Language/de.locallang_csh_date.xlf index f52c5ef..56e249a 100644 --- a/Resources/Private/Language/de.locallang_csh_date.xlf +++ b/Resources/Private/Language/de.locallang_csh_date.xlf @@ -1,24 +1,32 @@ - -
- - - Date - Termin - - - Start - Beginn - - - End - Ende - - - Associated event - Verknüpfte Veranstaltungen - - - + +
+ + + Date + Termin + + + Start + Beginn + + + End + Ende + + + Canceled? + Abgesagt? + + + Canceled + Abgesagt + + + Associated event + Verknüpfte Veranstaltungen + + + diff --git a/Resources/Private/Language/locallang_csh_date.xlf b/Resources/Private/Language/locallang_csh_date.xlf index 3270004..4613567 100644 --- a/Resources/Private/Language/locallang_csh_date.xlf +++ b/Resources/Private/Language/locallang_csh_date.xlf @@ -1,20 +1,26 @@ - -
- - - Date - - - Start - - - End - - - Associated event - - - + +
+ + + Date + + + Start + + + End + + + Canceled? + + + Canceled + + + Associated event + + + diff --git a/ext_tables.sql b/ext_tables.sql index ade216c..9122971 100644 --- a/ext_tables.sql +++ b/ext_tables.sql @@ -70,6 +70,7 @@ CREATE TABLE tx_events_domain_model_date ( event int(11) unsigned DEFAULT '0' NOT NULL, start int(11) DEFAULT NULL, end int(11) DEFAULT NULL, + canceled int(11) NOT NULL DEFAULT 0, KEY event (event), KEY dataHandler (event, t3ver_wsid, pid) ); From 201259d6748848d550162469707780647d987af2 Mon Sep 17 00:00:00 2001 From: Dirk Koritnik Date: Thu, 11 Feb 2021 12:05:02 +0100 Subject: [PATCH 18/55] Add new icons --- Configuration/FlexForms/DateList.xml | 12 +++++++++--- Configuration/TCA/Overrides/tt_content.php | 10 +++++----- .../Overrides/tx_events_domain_model_event.php | 2 +- Configuration/TCA/tx_events_domain_model_date.php | 2 +- .../TCA/tx_events_domain_model_event.php | 2 +- .../TCA/tx_events_domain_model_organizer.php | 4 ++-- .../TCA/tx_events_domain_model_partner.php | 2 +- .../TCA/tx_events_domain_model_region.php | 4 ++-- Resources/Public/Icons/Extension.svg | 2 +- Resources/Public/Icons/relation.gif | Bin 233 -> 0 bytes .../Public/Icons/tx_events_domain_model_date.gif | Bin 230 -> 0 bytes .../Public/Icons/tx_events_domain_model_date.svg | 1 + .../Public/Icons/tx_events_domain_model_event.gif | Bin 230 -> 0 bytes .../Public/Icons/tx_events_domain_model_event.svg | 1 + .../Icons/tx_events_domain_model_events.gif | Bin 230 -> 0 bytes .../Icons/tx_events_domain_model_organizer.gif | Bin 230 -> 0 bytes .../Icons/tx_events_domain_model_organizer.svg | 1 + .../Icons/tx_events_domain_model_partner.gif | Bin 230 -> 0 bytes .../Icons/tx_events_domain_model_partner.svg | 1 + .../Icons/tx_events_domain_model_region.gif | Bin 230 -> 0 bytes .../Icons/tx_events_domain_model_region.svg | 1 + Resources/Public/Icons/user_plugin_events.svg | 1 - ext_localconf.php | 2 +- ext_tables.php | 9 --------- 24 files changed, 29 insertions(+), 28 deletions(-) delete mode 100644 Resources/Public/Icons/relation.gif delete mode 100644 Resources/Public/Icons/tx_events_domain_model_date.gif create mode 100644 Resources/Public/Icons/tx_events_domain_model_date.svg delete mode 100644 Resources/Public/Icons/tx_events_domain_model_event.gif create mode 100644 Resources/Public/Icons/tx_events_domain_model_event.svg delete mode 100644 Resources/Public/Icons/tx_events_domain_model_events.gif delete mode 100644 Resources/Public/Icons/tx_events_domain_model_organizer.gif create mode 100644 Resources/Public/Icons/tx_events_domain_model_organizer.svg delete mode 100644 Resources/Public/Icons/tx_events_domain_model_partner.gif create mode 100644 Resources/Public/Icons/tx_events_domain_model_partner.svg delete mode 100644 Resources/Public/Icons/tx_events_domain_model_region.gif create mode 100644 Resources/Public/Icons/tx_events_domain_model_region.svg delete mode 100644 Resources/Public/Icons/user_plugin_events.svg diff --git a/Configuration/FlexForms/DateList.xml b/Configuration/FlexForms/DateList.xml index e971c51..8c9f409 100644 --- a/Configuration/FlexForms/DateList.xml +++ b/Configuration/FlexForms/DateList.xml @@ -13,6 +13,7 @@ select + selectSingle Start @@ -33,6 +34,7 @@ select + selectSingle @@ -128,6 +130,7 @@ select + selectSingle Default @@ -164,11 +167,12 @@ select + selectSingle tx_events_domain_model_region AND tx_events_domain_model_region.deleted = 0 AND tx_events_domain_model_region.hidden = 0 - 3 + 1 0 - 2 + 1 @@ -179,6 +183,7 @@ select + selectSingle And @@ -202,6 +207,7 @@ select + selectTree 20 sys_category AND sys_category.sys_language_uid IN (-1, 0) ORDER BY sys_category.title ASC @@ -233,4 +239,4 @@ - \ No newline at end of file + diff --git a/Configuration/TCA/Overrides/tt_content.php b/Configuration/TCA/Overrides/tt_content.php index b0fb92b..e52eb3a 100644 --- a/Configuration/TCA/Overrides/tt_content.php +++ b/Configuration/TCA/Overrides/tt_content.php @@ -8,7 +8,7 @@ call_user_func(function () { 'Events', 'Pi1', 'Events Plugin', - 'EXT:events/Resources/Public/Icons/user_plugin_events.svg' + 'EXT:events/Resources/Public/Icons/Extension.svg' ); $pluginSignature = 'events_pi1'; @@ -26,7 +26,7 @@ call_user_func(function () { 'Events', 'DateSearch', 'Events: Date Search', - 'EXT:events/Resources/Public/Icons/user_plugin_events.svg' + 'EXT:events/Resources/Public/Icons/Extension.svg' ); $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['events_datesearch'] = 'pi_flexform'; @@ -42,7 +42,7 @@ call_user_func(function () { 'Events', 'DateList', 'Events: Date List', - 'EXT:events/Resources/Public/Icons/user_plugin_events.svg' + 'EXT:events/Resources/Public/Icons/Extension.svg' ); $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['events_datelist'] = 'pi_flexform'; @@ -58,7 +58,7 @@ call_user_func(function () { 'Events', 'DateShow', 'Events: Date Show', - 'EXT:events/Resources/Public/Icons/user_plugin_events.svg' + 'EXT:events/Resources/Public/Icons/Extension.svg' ); $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['events_dateshow'] = 'pi_flexform'; @@ -75,7 +75,7 @@ call_user_func(function () { 'Events', 'Selected', 'Events: Show selected', - 'EXT:events/Resources/Public/Icons/user_plugin_events.svg' + 'EXT:events/Resources/Public/Icons/Extension.svg' ); $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist']['events_selected'] = 'pi_flexform'; diff --git a/Configuration/TCA/Overrides/tx_events_domain_model_event.php b/Configuration/TCA/Overrides/tx_events_domain_model_event.php index cd6e18b..9e75ded 100644 --- a/Configuration/TCA/Overrides/tx_events_domain_model_event.php +++ b/Configuration/TCA/Overrides/tx_events_domain_model_event.php @@ -3,7 +3,7 @@ defined('TYPO3') or die(); \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::makeCategorizable( - 'dd_events', + 'events', 'tx_events_domain_model_event', 'categories', [ diff --git a/Configuration/TCA/tx_events_domain_model_date.php b/Configuration/TCA/tx_events_domain_model_date.php index 1aa1f5c..3f8636d 100644 --- a/Configuration/TCA/tx_events_domain_model_date.php +++ b/Configuration/TCA/tx_events_domain_model_date.php @@ -20,7 +20,7 @@ return [ 'endtime' => 'endtime', ], 'searchFields' => '', - 'iconfile' => 'EXT:events/Resources/Public/Icons/tx_events_domain_model_date.gif' + 'iconfile' => 'EXT:events/Resources/Public/Icons/tx_events_domain_model_date.svg' ], 'types' => [ '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, start, end, canceled, event, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'], diff --git a/Configuration/TCA/tx_events_domain_model_event.php b/Configuration/TCA/tx_events_domain_model_event.php index ed72bbf..3900e2e 100644 --- a/Configuration/TCA/tx_events_domain_model_event.php +++ b/Configuration/TCA/tx_events_domain_model_event.php @@ -19,7 +19,7 @@ return [ 'endtime' => 'endtime', ], 'searchFields' => 'title,global_id,slug,teaser,details,price_info,street,district,city,zip,country,web,booking,ticket,facebook,youtube,latitude,longitude', - 'iconfile' => 'EXT:events/Resources/Public/Icons/tx_events_domain_model_event.gif' + 'iconfile' => 'EXT:events/Resources/Public/Icons/tx_events_domain_model_event.svg' ], 'types' => [ '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title, global_id, slug, highlight, teaser, details, price_info, name, street, district, city, zip, country, phone, web, ticket, facebook, youtube, instagram, latitude, longitude, images, pages, categories, dates, organizer, region, partner, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'], diff --git a/Configuration/TCA/tx_events_domain_model_organizer.php b/Configuration/TCA/tx_events_domain_model_organizer.php index 3893357..b3b80c0 100644 --- a/Configuration/TCA/tx_events_domain_model_organizer.php +++ b/Configuration/TCA/tx_events_domain_model_organizer.php @@ -17,7 +17,7 @@ return [ 'endtime' => 'endtime', ], 'searchFields' => 'name,street,district,city,zip,phone,web,email', - 'iconfile' => 'EXT:events/Resources/Public/Icons/tx_events_domain_model_organizer.gif' + 'iconfile' => 'EXT:events/Resources/Public/Icons/tx_events_domain_model_organizer.svg' ], 'types' => [ '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, name, street, district, city, zip, phone, web, email, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'], @@ -184,6 +184,6 @@ return [ 'eval' => 'trim' ], ], - + ], ]; diff --git a/Configuration/TCA/tx_events_domain_model_partner.php b/Configuration/TCA/tx_events_domain_model_partner.php index 88320c3..e4e142c 100644 --- a/Configuration/TCA/tx_events_domain_model_partner.php +++ b/Configuration/TCA/tx_events_domain_model_partner.php @@ -17,7 +17,7 @@ return [ 'disabled' => 'hidden', ], 'searchFields' => 'title', - 'iconfile' => 'EXT:events/Resources/Public/Icons/tx_events_domain_model_partner.gif' + 'iconfile' => 'EXT:events/Resources/Public/Icons/tx_events_domain_model_partner.svg' ], 'types' => [ '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title, link, images, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access'], diff --git a/Configuration/TCA/tx_events_domain_model_region.php b/Configuration/TCA/tx_events_domain_model_region.php index 027904e..822b513 100644 --- a/Configuration/TCA/tx_events_domain_model_region.php +++ b/Configuration/TCA/tx_events_domain_model_region.php @@ -17,7 +17,7 @@ return [ 'endtime' => 'endtime', ], 'searchFields' => 'title', - 'iconfile' => 'EXT:events/Resources/Public/Icons/tx_events_domain_model_region.gif' + 'iconfile' => 'EXT:events/Resources/Public/Icons/tx_events_domain_model_region.svg' ], 'types' => [ '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'], @@ -121,6 +121,6 @@ return [ 'eval' => 'trim' ], ], - + ], ]; diff --git a/Resources/Public/Icons/Extension.svg b/Resources/Public/Icons/Extension.svg index ec1bdec..f0baaf6 100644 --- a/Resources/Public/Icons/Extension.svg +++ b/Resources/Public/Icons/Extension.svg @@ -1 +1 @@ -Extension \ No newline at end of file + \ No newline at end of file diff --git a/Resources/Public/Icons/relation.gif b/Resources/Public/Icons/relation.gif deleted file mode 100644 index db61d7e18817e2969b740ccc62838a1447cd3c3c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 233 zcmZ?wbh9u|6krfwIKsfd$jB%yEgcvb*xK4Ud-m+*V6c9}`t4wF3=FP=!D}%14h9TB zki(G3kjIe9P{N?kkO3r981fmC8H$0t6rgAskS<}UWKjIc!pOiN#GnJx0zsgJEBshvI<>Lne0l)en}fzWvHFt6ysaM@@~DQbVIgvycNT2L~5d538f;ccvU1 zeHPQ2GIn^1cr6p&73IaoD$=91iK~a{(6rVH&ROOxH+%Y4hNqsq`BO~MkEuZ}q3Mby Zn_ZKDm69U|7Z(ptCx?^igb9ia)&LfwP0|1W diff --git a/Resources/Public/Icons/tx_events_domain_model_date.svg b/Resources/Public/Icons/tx_events_domain_model_date.svg new file mode 100644 index 0000000..d859b72 --- /dev/null +++ b/Resources/Public/Icons/tx_events_domain_model_date.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Resources/Public/Icons/tx_events_domain_model_event.gif b/Resources/Public/Icons/tx_events_domain_model_event.gif deleted file mode 100644 index 37ba37b9b3a220018e3a291bf2ee413d0da30ce0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 230 zcmZ?wbh9u|6krfwIKlt|GBPr{y1EAX`lY3%Jv}|Mz+f2|Yy*R1U~nA_UV_1QFaYW; z2AhC~Q2fcl$iN`NpaW6^vXg-|S;5tE3G-Y5<#kHRdp8`B$dNv*cXpRhl~&t>ccvU1 zeHPQ2GIn^1cr6p&73IaoD$=91iK~a{(6rVH&ROOxH+%Y4hNqsq`BO~MkEuZ}q3Mby Zn_ZKDm69U|7Z(ptCx?^igb9ia)&LfwP0|1W diff --git a/Resources/Public/Icons/tx_events_domain_model_event.svg b/Resources/Public/Icons/tx_events_domain_model_event.svg new file mode 100644 index 0000000..51822b4 --- /dev/null +++ b/Resources/Public/Icons/tx_events_domain_model_event.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Resources/Public/Icons/tx_events_domain_model_events.gif b/Resources/Public/Icons/tx_events_domain_model_events.gif deleted file mode 100644 index 37ba37b9b3a220018e3a291bf2ee413d0da30ce0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 230 zcmZ?wbh9u|6krfwIKlt|GBPr{y1EAX`lY3%Jv}|Mz+f2|Yy*R1U~nA_UV_1QFaYW; z2AhC~Q2fcl$iN`NpaW6^vXg-|S;5tE3G-Y5<#kHRdp8`B$dNv*cXpRhl~&t>ccvU1 zeHPQ2GIn^1cr6p&73IaoD$=91iK~a{(6rVH&ROOxH+%Y4hNqsq`BO~MkEuZ}q3Mby Zn_ZKDm69U|7Z(ptCx?^igb9ia)&LfwP0|1W diff --git a/Resources/Public/Icons/tx_events_domain_model_organizer.gif b/Resources/Public/Icons/tx_events_domain_model_organizer.gif deleted file mode 100644 index 37ba37b9b3a220018e3a291bf2ee413d0da30ce0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 230 zcmZ?wbh9u|6krfwIKlt|GBPr{y1EAX`lY3%Jv}|Mz+f2|Yy*R1U~nA_UV_1QFaYW; z2AhC~Q2fcl$iN`NpaW6^vXg-|S;5tE3G-Y5<#kHRdp8`B$dNv*cXpRhl~&t>ccvU1 zeHPQ2GIn^1cr6p&73IaoD$=91iK~a{(6rVH&ROOxH+%Y4hNqsq`BO~MkEuZ}q3Mby Zn_ZKDm69U|7Z(ptCx?^igb9ia)&LfwP0|1W diff --git a/Resources/Public/Icons/tx_events_domain_model_organizer.svg b/Resources/Public/Icons/tx_events_domain_model_organizer.svg new file mode 100644 index 0000000..fdbd451 --- /dev/null +++ b/Resources/Public/Icons/tx_events_domain_model_organizer.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Resources/Public/Icons/tx_events_domain_model_partner.gif b/Resources/Public/Icons/tx_events_domain_model_partner.gif deleted file mode 100644 index 37ba37b9b3a220018e3a291bf2ee413d0da30ce0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 230 zcmZ?wbh9u|6krfwIKlt|GBPr{y1EAX`lY3%Jv}|Mz+f2|Yy*R1U~nA_UV_1QFaYW; z2AhC~Q2fcl$iN`NpaW6^vXg-|S;5tE3G-Y5<#kHRdp8`B$dNv*cXpRhl~&t>ccvU1 zeHPQ2GIn^1cr6p&73IaoD$=91iK~a{(6rVH&ROOxH+%Y4hNqsq`BO~MkEuZ}q3Mby Zn_ZKDm69U|7Z(ptCx?^igb9ia)&LfwP0|1W diff --git a/Resources/Public/Icons/tx_events_domain_model_partner.svg b/Resources/Public/Icons/tx_events_domain_model_partner.svg new file mode 100644 index 0000000..e48ac0f --- /dev/null +++ b/Resources/Public/Icons/tx_events_domain_model_partner.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Resources/Public/Icons/tx_events_domain_model_region.gif b/Resources/Public/Icons/tx_events_domain_model_region.gif deleted file mode 100644 index 37ba37b9b3a220018e3a291bf2ee413d0da30ce0..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 230 zcmZ?wbh9u|6krfwIKlt|GBPr{y1EAX`lY3%Jv}|Mz+f2|Yy*R1U~nA_UV_1QFaYW; z2AhC~Q2fcl$iN`NpaW6^vXg-|S;5tE3G-Y5<#kHRdp8`B$dNv*cXpRhl~&t>ccvU1 zeHPQ2GIn^1cr6p&73IaoD$=91iK~a{(6rVH&ROOxH+%Y4hNqsq`BO~MkEuZ}q3Mby Zn_ZKDm69U|7Z(ptCx?^igb9ia)&LfwP0|1W diff --git a/Resources/Public/Icons/tx_events_domain_model_region.svg b/Resources/Public/Icons/tx_events_domain_model_region.svg new file mode 100644 index 0000000..f604194 --- /dev/null +++ b/Resources/Public/Icons/tx_events_domain_model_region.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/Resources/Public/Icons/user_plugin_events.svg b/Resources/Public/Icons/user_plugin_events.svg deleted file mode 100644 index 17e1eb1..0000000 --- a/Resources/Public/Icons/user_plugin_events.svg +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/ext_localconf.php b/ext_localconf.php index caa33be..fec78e1 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -36,7 +36,7 @@ call_user_func( $iconRegistry->registerIcon( 'events-plugin', \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class, - ['source' => 'EXT:events/Resources/Public/Icons/user_plugin_events.svg'] + ['source' => 'EXT:events/Resources/Public/Icons/Extension.svg'] ); /* diff --git a/ext_tables.php b/ext_tables.php index e4fd548..181bc7f 100644 --- a/ext_tables.php +++ b/ext_tables.php @@ -5,15 +5,6 @@ defined('TYPO3') || die('Access denied.'); call_user_func( function () { - /* - \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin( - 'Wrm.Events', - 'Pi1', - 'Events', - 'EXT:events/Resources/Public/Icons/user_plugin_events.svg' - ); - */ - \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addStaticFile('events', 'Configuration/TypoScript', 'Events'); \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('tx_events_domain_model_event', 'EXT:events/Resources/Private/Language/locallang_csh_tx_events_domain_model_event.xlf'); From 4c0a0a959bebce41d4d367ec826605cc64c637c6 Mon Sep 17 00:00:00 2001 From: Dirk Koritnik Date: Thu, 11 Feb 2021 13:13:05 +0100 Subject: [PATCH 19/55] Restructure event TCA --- .../TCA/tx_events_domain_model_event.php | 154 ++++++++++++------ .../Language/de.locallang_csh_event.xlf | 24 +++ .../Private/Language/locallang_csh_event.xlf | 18 ++ 3 files changed, 146 insertions(+), 50 deletions(-) diff --git a/Configuration/TCA/tx_events_domain_model_event.php b/Configuration/TCA/tx_events_domain_model_event.php index 3900e2e..6aac2a6 100644 --- a/Configuration/TCA/tx_events_domain_model_event.php +++ b/Configuration/TCA/tx_events_domain_model_event.php @@ -1,8 +1,15 @@ [ - 'title' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event', + 'title' => $l10nPath . ':tx_events_domain_model_event', 'label' => 'title', 'thumbnail' => 'images', 'tstamp' => 'tstamp', @@ -18,23 +25,67 @@ return [ 'starttime' => 'starttime', 'endtime' => 'endtime', ], - 'searchFields' => 'title,global_id,slug,teaser,details,price_info,street,district,city,zip,country,web,booking,ticket,facebook,youtube,latitude,longitude', + 'searchFields' => 'title,global_id,teaser', 'iconfile' => 'EXT:events/Resources/Public/Icons/tx_events_domain_model_event.svg' ], 'types' => [ - '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, title, global_id, slug, highlight, teaser, details, price_info, name, street, district, city, zip, country, phone, web, ticket, facebook, youtube, instagram, latitude, longitude, images, pages, categories, dates, organizer, region, partner, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'], + '1' => [ + 'showitem' => '--palette--;' . $l10nPathFE . ':palette.general;general, + sys_language_uid, + l10n_parent, + l10n_diffsource, + hidden, + highlight, + title, + teaser, + slug, + ticket, + global_id, + --div--;' . $l10nPath . ':tx_events_domain_model_event.tabs.text, + details, + price_info, + --div--;' . $l10nPath . ':tx_events_domain_model_event.tabs.dates, + dates, + --div--;' . $l10nPath . ':tx_events_domain_model_event.tabs.location, + name, + street, + district, + city, + zip, + country, + phone, + web, + latitude, + longitude, + --div--;' . $l10nPath . ':tx_events_domain_model_event.tabs.relations, + organizer, + region, + partner, + categories, + pages, + --div--;' . $l10nPath . ':tx_events_domain_model_event.tabs.media, + images, + --div--;' . $l10nPath . ':tx_events_domain_model_event.tabs.social, + facebook, + youtube, + instagram, + --div--;' . $l10nPathFE . ':tabs.access, + starttime, + endtime' + ], ], + 'columns' => [ 'sys_language_uid' => [ 'exclude' => true, - 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.language', + 'label' => $l10nPathGeneral . ':LGL.language', 'config' => [ 'type' => 'select', 'renderType' => 'selectSingle', 'special' => 'languages', 'items' => [ [ - 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.allLanguages', + $l10nPathGeneral . ':LGL.allLanguages', -1, 'flags-multiple' ] @@ -44,7 +95,7 @@ return [ ], 'l10n_parent' => [ 'displayCond' => 'FIELD:sys_language_uid:>:0', - 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.l18n_parent', + 'label' => $l10nPathGeneral . ':LGL.l18n_parent', 'config' => [ 'type' => 'select', 'renderType' => 'selectSingle', @@ -62,7 +113,7 @@ return [ ], ], 't3ver_label' => [ - 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.versionLabel', + 'label' => $l10nPathGeneral . ':LGL.versionLabel', 'config' => [ 'type' => 'input', 'size' => 30, @@ -71,7 +122,7 @@ return [ ], 'hidden' => [ 'exclude' => true, - 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.visible', + 'label' => $l10nPathGeneral . ':LGL.visible', 'config' => [ 'type' => 'check', 'renderType' => 'checkboxToggle', @@ -86,7 +137,7 @@ return [ ], 'starttime' => [ 'exclude' => true, - 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.starttime', + 'label' => $l10nPathGeneral . ':LGL.starttime', 'config' => [ 'type' => 'input', 'renderType' => 'inputDateTime', @@ -99,7 +150,7 @@ return [ ], 'endtime' => [ 'exclude' => true, - 'label' => 'LLL:EXT:core/Resources/Private/Language/locallang_general.xlf:LGL.endtime', + 'label' => $l10nPathGeneral . ':LGL.endtime', 'config' => [ 'type' => 'input', 'renderType' => 'inputDateTime', @@ -116,7 +167,7 @@ return [ 'title' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.title', + 'label' => $l10nPath . ':tx_events_domain_model_event.title', 'config' => [ 'type' => 'input', 'size' => 30, @@ -125,7 +176,7 @@ return [ ], 'global_id' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.global_id', + 'label' => $l10nPath . ':tx_events_domain_model_event.global_id', 'config' => [ 'type' => 'input', 'size' => 30, @@ -134,7 +185,7 @@ return [ ], 'slug' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.slug', + 'label' => $l10nPath . ':tx_events_domain_model_event.slug', 'config' => [ 'type' => 'slug', 'size' => 50, @@ -150,12 +201,12 @@ return [ ], 'highlight' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.highlight', + 'label' => $l10nPath . ':tx_events_domain_model_event.highlight', 'config' => [ 'type' => 'check', 'items' => [ '1' => [ - '0' => 'LLL:EXT:lang/locallang_core.xlf:labels.enabled' + '0' => $l10nPathLang . ':labels.enabled' ] ], 'default' => 0, @@ -163,17 +214,17 @@ return [ ], 'teaser' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.teaser', + 'label' => $l10nPath . ':tx_events_domain_model_event.teaser', 'config' => [ 'type' => 'text', - 'cols' => 40, - 'rows' => 15, + 'cols' => 30, + 'rows' => 5, 'eval' => 'trim' ] ], 'details' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.details', + 'label' => $l10nPath . ':tx_events_domain_model_event.details', 'config' => [ 'type' => 'text', 'enableRichtext' => true, @@ -191,7 +242,7 @@ return [ ], 'price_info' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.price_info', + 'label' => $l10nPath . ':tx_events_domain_model_event.price_info', 'config' => [ 'type' => 'text', 'cols' => 40, @@ -201,7 +252,7 @@ return [ ], 'name' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.name', + 'label' => $l10nPath . ':tx_events_domain_model_event.name', 'config' => [ 'type' => 'input', 'size' => 30, @@ -210,7 +261,7 @@ return [ ], 'street' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.street', + 'label' => $l10nPath . ':tx_events_domain_model_event.street', 'config' => [ 'type' => 'input', 'size' => 30, @@ -219,7 +270,7 @@ return [ ], 'district' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.district', + 'label' => $l10nPath . ':tx_events_domain_model_event.district', 'config' => [ 'type' => 'input', 'size' => 30, @@ -228,7 +279,7 @@ return [ ], 'city' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.city', + 'label' => $l10nPath . ':tx_events_domain_model_event.city', 'config' => [ 'type' => 'input', 'size' => 30, @@ -237,7 +288,7 @@ return [ ], 'zip' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.zip', + 'label' => $l10nPath . ':tx_events_domain_model_event.zip', 'config' => [ 'type' => 'input', 'size' => 30, @@ -246,7 +297,7 @@ return [ ], 'country' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.country', + 'label' => $l10nPath . ':tx_events_domain_model_event.country', 'config' => [ 'type' => 'input', 'size' => 30, @@ -255,7 +306,7 @@ return [ ], 'phone' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.phone', + 'label' => $l10nPath . ':tx_events_domain_model_event.phone', 'config' => [ 'type' => 'input', 'size' => 30, @@ -264,7 +315,7 @@ return [ ], 'web' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.web', + 'label' => $l10nPath . ':tx_events_domain_model_event.web', 'config' => [ 'type' => 'input', 'size' => 30, @@ -273,16 +324,19 @@ return [ ], 'ticket' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.ticket', + 'label' => $l10nPath . ':tx_events_domain_model_event.ticket', 'config' => [ 'type' => 'input', - 'size' => 30, - 'eval' => 'trim' + 'renderType' => 'inputLink', + 'eval' => 'trim', + 'max' => 1024, + 'size' => 50, + 'softref' => 'typolink', ], ], 'facebook' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.facebook', + 'label' => $l10nPath . ':tx_events_domain_model_event.facebook', 'config' => [ 'type' => 'input', 'size' => 30, @@ -291,7 +345,7 @@ return [ ], 'youtube' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.youtube', + 'label' => $l10nPath . ':tx_events_domain_model_event.youtube', 'config' => [ 'type' => 'input', 'size' => 30, @@ -300,7 +354,7 @@ return [ ], 'instagram' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.instagram', + 'label' => $l10nPath . ':tx_events_domain_model_event.instagram', 'config' => [ 'type' => 'input', 'size' => 30, @@ -309,7 +363,7 @@ return [ ], 'latitude' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.latitude', + 'label' => $l10nPath . ':tx_events_domain_model_event.latitude', 'config' => [ 'type' => 'input', 'size' => 30, @@ -318,7 +372,7 @@ return [ ], 'longitude' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.longitude', + 'label' => $l10nPath . ':tx_events_domain_model_event.longitude', 'config' => [ 'type' => 'input', 'size' => 30, @@ -327,12 +381,12 @@ return [ ], 'images' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.images', + 'label' => $l10nPath . ':tx_events_domain_model_event.images', 'config' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::getFileFieldTCAConfig( 'images', [ 'appearance' => [ - 'createNewRelationLinkTitle' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:images.addFileReference', + 'createNewRelationLinkTitle' => $l10nPathFE . ':images.addFileReference', 'showPossibleLocalizationRecords' => true, 'showRemovedLocalizationRecords' => true, 'showAllLocalizationLink' => true, @@ -346,32 +400,32 @@ return [ 'foreign_types' => [ '0' => [ 'showitem' => ' - --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, + --palette--;' . $l10nPathFE . ':sys_file_reference.imageoverlayPalette;imageoverlayPalette, --palette--;;filePalette' ], \TYPO3\CMS\Core\Resource\File::FILETYPE_TEXT => [ 'showitem' => ' - --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, + --palette--;' . $l10nPathFE . ':sys_file_reference.imageoverlayPalette;imageoverlayPalette, --palette--;;filePalette' ], \TYPO3\CMS\Core\Resource\File::FILETYPE_IMAGE => [ 'showitem' => ' - --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, + --palette--;' . $l10nPathFE . ':sys_file_reference.imageoverlayPalette;imageoverlayPalette, --palette--;;filePalette' ], \TYPO3\CMS\Core\Resource\File::FILETYPE_AUDIO => [ 'showitem' => ' - --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, + --palette--;' . $l10nPathFE . ':sys_file_reference.imageoverlayPalette;imageoverlayPalette, --palette--;;filePalette' ], \TYPO3\CMS\Core\Resource\File::FILETYPE_VIDEO => [ 'showitem' => ' - --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, + --palette--;' . $l10nPathFE . ':sys_file_reference.imageoverlayPalette;imageoverlayPalette, --palette--;;filePalette' ], \TYPO3\CMS\Core\Resource\File::FILETYPE_APPLICATION => [ 'showitem' => ' - --palette--;LLL:EXT:lang/locallang_tca.xlf:sys_file_reference.imageoverlayPalette;imageoverlayPalette, + --palette--;' . $l10nPathFE . ':sys_file_reference.imageoverlayPalette;imageoverlayPalette, --palette--;;filePalette' ] ], @@ -383,7 +437,7 @@ return [ 'pages' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.pages', + 'label' => $l10nPath . ':tx_events_domain_model_event.pages', 'config' => [ 'type' => 'group', 'internal_type' => 'db', @@ -393,7 +447,7 @@ return [ 'categories' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.categories', + 'label' => $l10nPath . ':tx_events_domain_model_event.categories', 'config' => [ 'type' => 'input', 'size' => 4, @@ -403,7 +457,7 @@ return [ 'dates' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.dates', + 'label' => $l10nPath . ':tx_events_domain_model_event.dates', 'config' => [ 'type' => 'inline', 'foreign_table' => 'tx_events_domain_model_date', @@ -435,7 +489,7 @@ return [ 'organizer' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.organizer', + 'label' => $l10nPath . ':tx_events_domain_model_event.organizer', 'config' => [ 'type' => 'select', 'renderType' => 'selectSingle', @@ -446,7 +500,7 @@ return [ ], 'region' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.region', + 'label' => $l10nPath . ':tx_events_domain_model_event.region', 'config' => [ 'type' => 'select', 'renderType' => 'selectSingle', @@ -458,7 +512,7 @@ return [ 'partner' => [ 'exclude' => true, - 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_event.xlf:tx_events_domain_model_event.partner', + 'label' => $l10nPath . ':tx_events_domain_model_event.partner', 'config' => [ 'type' => 'group', 'internal_type' => 'db', diff --git a/Resources/Private/Language/de.locallang_csh_event.xlf b/Resources/Private/Language/de.locallang_csh_event.xlf index d221efd..e132bc2 100644 --- a/Resources/Private/Language/de.locallang_csh_event.xlf +++ b/Resources/Private/Language/de.locallang_csh_event.xlf @@ -11,6 +11,30 @@ Event Modul Veranstaltungs Modul + + Text + Texte + + + Dates + Termine + + + Location + Veranstaltungsort + + + Relations + Relationen + + + Media + Medien + + + Social Media + Social Media + Event Veranstaltung diff --git a/Resources/Private/Language/locallang_csh_event.xlf b/Resources/Private/Language/locallang_csh_event.xlf index 256f3c7..cd72963 100644 --- a/Resources/Private/Language/locallang_csh_event.xlf +++ b/Resources/Private/Language/locallang_csh_event.xlf @@ -12,6 +12,24 @@ Event + + Text + + + Dates + + + Location + + + Relations + + + Media + + + Social Media + Title From ea103cb002c434d089c7e63d38c8115718c34e2b Mon Sep 17 00:00:00 2001 From: Dirk Koritnik Date: Thu, 11 Feb 2021 13:18:06 +0100 Subject: [PATCH 20/55] Little cleanups and remove old plugin code --- Configuration/ExtensionBuilder/settings.yaml | 101 ----- Configuration/FlexForms/Pi1.xml | 402 ------------------- ext_emconf.php | 12 +- ext_localconf.php | 23 +- 4 files changed, 2 insertions(+), 536 deletions(-) delete mode 100644 Configuration/ExtensionBuilder/settings.yaml delete mode 100644 Configuration/FlexForms/Pi1.xml diff --git a/Configuration/ExtensionBuilder/settings.yaml b/Configuration/ExtensionBuilder/settings.yaml deleted file mode 100644 index 3b52d12..0000000 --- a/Configuration/ExtensionBuilder/settings.yaml +++ /dev/null @@ -1,101 +0,0 @@ -# -# Extension Builder settings for extension events -# generated 2019-04-01T14:33:00Z -# -# See http://www.yaml.org/spec/1.2/spec.html -# - ---- - -########### Overwrite settings ########### -# -# These settings only apply, if the roundtrip feature of the extension builder -# is enabled in the extension manager -# -# Usage: -# nesting reflects the file structure -# a setting applies to a file or recursive to all files and subfolders -# -# merge: -# means for classes: All properties ,methods and method bodies -# of the existing class will be modified according to the new settings -# but not overwritten -# -# for locallang xlf files: Existing keys and labels are always -# preserved (renaming a property or DomainObject will result in new keys and new labels) -# -# for other files: You will find a Split token at the end of the file -# see: \EBT\ExtensionBuilder\Service\RoundTrip::SPLIT_TOKEN -# -# After this token you can write whatever you want and it will be appended -# everytime the code is generated -# -# keep: -# files are never overwritten -# These settings may break the functionality of the extension builder! -# Handle with care! -# -# - -############ extension settings ############## - -overwriteSettings: - Classes: - Controller: merge - Domain: - Model: merge - Repository: merge - - Configuration: - #TCA merge not possible - use overrides directory - #TypoScript: keep - - Resources: - Private: - #Language: merge - #Templates: keep - - user_extension.svg: keep - -# ext_localconf.php: merge - -# ext_tables.php: merge - -# ext_tables.sql: merge - -## use static date attribute in xliff files ## -#staticDateInXliffFiles: 2019-04-01T14:33:00Z - -## skip docComment (license header) ## -#skipDocComment - -## list of error codes for warnings that should be ignored ## -#ignoreWarnings: - #503 - -######### settings for classBuilder ############################# -# -# here you may define default parent classes for your classes -# these settings only apply for new generated classes -# you may also just change the parent class in the generated class file. -# It will be kept on next code generation, if the overwrite settings -# are configured to merge it -# -################################################################# - -classBuilder: - - Controller: - parentClass: \TYPO3\CMS\Extbase\Mvc\Controller\ActionController - - Model: - AbstractEntity: - parentClass: \TYPO3\CMS\Extbase\DomainObject\AbstractEntity - - AbstractValueObject: - parentClass: \TYPO3\CMS\Extbase\DomainObject\AbstractValueObject - - Repository: - parentClass: \TYPO3\CMS\Extbase\Persistence\Repository - - setDefaultValuesForClassProperties: true \ No newline at end of file diff --git a/Configuration/FlexForms/Pi1.xml b/Configuration/FlexForms/Pi1.xml deleted file mode 100644 index 2b7084d..0000000 --- a/Configuration/FlexForms/Pi1.xml +++ /dev/null @@ -1,402 +0,0 @@ - - - - - - Options - - array - - - - - reload - - select - - - Event List - Event->list - - - Event Teaser - Event->teaser - - - Event Show - Event->show - - - Date List - Date->list - - - - Date Show - Date->show - - - - Event Search - Event->search - - - - Date Search - Date->search - - - - - - - - - - 1 - - FIELD:switchableControllerActions:=:Event->list - - select - - - Title - title - - - Region - region - - - - - - - - - 1 - - - - FIELD:switchableControllerActions:=:Date->list - FIELD:switchableControllerActions:=:Date->search - - - - select - - - Start - start - - - End - end - - - - - - - - - 1 - - - - FIELD:switchableControllerActions:=:Event->list - FIELD:switchableControllerActions:=:Date->list - FIELD:switchableControllerActions:=:Date->search - - - - select - - - - Ascending - - ASC - - - - Descending - - DESC - - - ASC - - - - - - - 1 - - - - FIELD:switchableControllerActions:=:Event->list - FIELD:switchableControllerActions:=:Date->list - FIELD:switchableControllerActions:=:Date->search - - - - input - 10 - 30 - trim - - - - - - - 1 - - - - FIELD:switchableControllerActions:=:Event->list - FIELD:switchableControllerActions:=:Date->list - - - - check - 0 - - - - - - - 1 - - - - FIELD:switchableControllerActions:=:Event->list - FIELD:switchableControllerActions:=:Date->list - - - - check - 0 - - - - - - - 1 - - - - FIELD:switchableControllerActions:=:Event->list - FIELD:switchableControllerActions:=:Date->list - - - - check - 0 - - - - - - - 1 - - - - FIELD:switchableControllerActions:=:Event->list - FIELD:switchableControllerActions:=:Event->teaser - FIELD:switchableControllerActions:=:Event->search - FIELD:switchableControllerActions:=:Date->list - FIELD:switchableControllerActions:=:Date->teaser - FIELD:switchableControllerActions:=:Date->search - - - - group - db - pages - 1 - 1 - 0 - 1 - - - - - - - - - - FIELD:switchableControllerActions:=:Event->teaser - FIELD:switchableControllerActions:=:Date->teaser - - - - select - tx_events_domain_model_event - AND tx_events_domain_model_event.deleted = 0 AND tx_events_domain_model_event.hidden = 0 - 3 - 1 - 0 - 99 - - - - - - - - - - Template - - array - - - 1 - - - - FIELD:sDEF.switchableControllerActions:=:Event->list - FIELD:sDEF.switchableControllerActions:=:Date->list - - - - select - - - Default - default - - - Costum - costum - - - Table - table - - - Grid - grid - - - default - - - - - - - - - Regions & Categories - - array - - - - - - - FIELD:sDEF.switchableControllerActions:=:Event->list - FIELD:sDEF.switchableControllerActions:=:Date->list - - - - select - tx_events_domain_model_region - AND tx_events_domain_model_region.deleted = 0 AND tx_events_domain_model_region.hidden = 0 - 3 - 0 - 2 - - - - - - - 1 - - - - FIELD:sDEF.switchableControllerActions:=:Event->list - FIELD:sDEF.switchableControllerActions:=:Date->list - - - - select - - - And - 0 - - - Or - 1 - - - 0 - - - - - - - 1 - - - - FIELD:sDEF.switchableControllerActions:=:Event->list - FIELD:sDEF.switchableControllerActions:=:Date->list - - - - select - 20 - sys_category - AND sys_category.sys_language_uid IN (-1, 0) ORDER BY sys_category.title ASC - 1 - tree - 8 - - - 1 - 1 - - parent - - - - - - - - 1 - - FIELD:sDEF.switchableControllerActions:=:Event->list - - check - 0 - - - - - - - - \ No newline at end of file diff --git a/ext_emconf.php b/ext_emconf.php index c209312..bc04122 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -1,16 +1,6 @@ 'Events', 'description' => 'Extension to manage events', 'category' => 'plugin', diff --git a/ext_localconf.php b/ext_localconf.php index fec78e1..6899368 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -38,27 +38,6 @@ call_user_func( \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class, ['source' => 'EXT:events/Resources/Public/Icons/Extension.svg'] ); - - /* - // wizards - \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPageTSConfig( - 'mod { - wizards.newContentElement.wizardItems.plugins { - elements { - events { - iconIdentifier = events-plugin - title = LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events.name - description = LLL:EXT:events/Resources/Private/Language/locallang_db.xlf:tx_events.description - tt_content_defValues { - CType = list - list_type = events_pi1 - } - } - } - show = * - } - }' - ); - */ } + ); From 1d6d91e9e2faf7e80d468fff01f0a1190f69f49f Mon Sep 17 00:00:00 2001 From: Dirk Koritnik Date: Thu, 11 Feb 2021 13:29:41 +0100 Subject: [PATCH 21/55] Add location name to detail view --- Resources/Private/Templates/Date/Show.html | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/Resources/Private/Templates/Date/Show.html b/Resources/Private/Templates/Date/Show.html index 7d9ed35..4929454 100644 --- a/Resources/Private/Templates/Date/Show.html +++ b/Resources/Private/Templates/Date/Show.html @@ -21,8 +21,6 @@

{date.event.title}

{date.event.teaser}

{date.event.details} -

{event.price_info}

-
@@ -51,6 +49,7 @@

Veranstaltungsort:
+ {date.event.name}
{date.event.street}
{date.event.zip} {date.event.city}
{date.event.phone}
From 8e755d775af638d44dd479591aeb34bd6e23014a Mon Sep 17 00:00:00 2001 From: Dirk Koritnik Date: Thu, 11 Feb 2021 15:34:22 +0100 Subject: [PATCH 22/55] Remove old plugin --- Configuration/TCA/Overrides/tt_content.php | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/Configuration/TCA/Overrides/tt_content.php b/Configuration/TCA/Overrides/tt_content.php index e52eb3a..45af5df 100644 --- a/Configuration/TCA/Overrides/tt_content.php +++ b/Configuration/TCA/Overrides/tt_content.php @@ -4,22 +4,6 @@ defined('TYPO3') or die(); call_user_func(function () { - \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin( - 'Events', - 'Pi1', - 'Events Plugin', - 'EXT:events/Resources/Public/Icons/Extension.svg' - ); - - $pluginSignature = 'events_pi1'; - - $GLOBALS['TCA']['tt_content']['types']['list']['subtypes_addlist'][$pluginSignature] = 'pi_flexform'; - - \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addPiFlexFormValue( - $pluginSignature, - 'FILE:EXT:events/Configuration/FlexForms/Pi1.xml' - ); - /* Search Plugin */ \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerPlugin( From ce9a1e17e5c7d550cc1d9a7ffdb0d814d55216f6 Mon Sep 17 00:00:00 2001 From: Dirk Koritnik Date: Mon, 15 Feb 2021 09:58:51 +0100 Subject: [PATCH 23/55] Add subtitle filed to event --- Classes/Domain/Model/Event.php | 24 +++++++++++++++++++ .../TCA/tx_events_domain_model_event.php | 12 +++++++++- .../Language/de.locallang_csh_event.xlf | 4 ++++ .../Private/Language/locallang_csh_event.xlf | 3 +++ ext_tables.sql | 1 + 5 files changed, 43 insertions(+), 1 deletion(-) diff --git a/Classes/Domain/Model/Event.php b/Classes/Domain/Model/Event.php index 1ed3320..b74e9ad 100644 --- a/Classes/Domain/Model/Event.php +++ b/Classes/Domain/Model/Event.php @@ -24,6 +24,13 @@ class Event extends AbstractEntity */ protected $title = ''; + /** + * subtitle + * + * @var string + */ + protected $subtitle = ''; + /** * globalId * @@ -283,6 +290,23 @@ class Event extends AbstractEntity $this->title = $title; } + /** + * @return string $subtitle + */ + public function getSubtitle() + { + return $this->subtitle; + } + + /** + * @param string $subtitle + * @return void + */ + public function setSubtitle($subtitle) + { + $this->subtitle = $subtitle; + } + /** * @return string $teaser */ diff --git a/Configuration/TCA/tx_events_domain_model_event.php b/Configuration/TCA/tx_events_domain_model_event.php index 6aac2a6..abe1ab1 100644 --- a/Configuration/TCA/tx_events_domain_model_event.php +++ b/Configuration/TCA/tx_events_domain_model_event.php @@ -25,7 +25,7 @@ return [ 'starttime' => 'starttime', 'endtime' => 'endtime', ], - 'searchFields' => 'title,global_id,teaser', + 'searchFields' => 'title,subtitle,global_id,teaser', 'iconfile' => 'EXT:events/Resources/Public/Icons/tx_events_domain_model_event.svg' ], 'types' => [ @@ -37,6 +37,7 @@ return [ hidden, highlight, title, + subtitle, teaser, slug, ticket, @@ -174,6 +175,15 @@ return [ 'eval' => 'trim' ] ], + 'subtitle' => [ + 'exclude' => true, + 'label' => $l10nPath . ':tx_events_domain_model_event.subtitle', + 'config' => [ + 'type' => 'input', + 'size' => 30, + 'eval' => 'trim' + ] + ], 'global_id' => [ 'exclude' => true, 'label' => $l10nPath . ':tx_events_domain_model_event.global_id', diff --git a/Resources/Private/Language/de.locallang_csh_event.xlf b/Resources/Private/Language/de.locallang_csh_event.xlf index e132bc2..ced4f75 100644 --- a/Resources/Private/Language/de.locallang_csh_event.xlf +++ b/Resources/Private/Language/de.locallang_csh_event.xlf @@ -43,6 +43,10 @@ Title Titel + + Subtitle + Untertitel + Global UID Globale UID diff --git a/Resources/Private/Language/locallang_csh_event.xlf b/Resources/Private/Language/locallang_csh_event.xlf index cd72963..32c079c 100644 --- a/Resources/Private/Language/locallang_csh_event.xlf +++ b/Resources/Private/Language/locallang_csh_event.xlf @@ -33,6 +33,9 @@ Title + + Subtitle + Global UID diff --git a/ext_tables.sql b/ext_tables.sql index 9122971..224a099 100644 --- a/ext_tables.sql +++ b/ext_tables.sql @@ -4,6 +4,7 @@ CREATE TABLE tx_events_domain_model_event ( title varchar(255) DEFAULT '' NOT NULL, + subtitle text, global_id varchar(255) DEFAULT '' NOT NULL, slug varchar(255) DEFAULT '' NOT NULL, highlight smallint(5) unsigned DEFAULT '0' NOT NULL, From 431aa9bafa42b1af4d9010f935716e27a72ed5d5 Mon Sep 17 00:00:00 2001 From: Dirk Koritnik Date: Mon, 22 Feb 2021 10:49:29 +0100 Subject: [PATCH 24/55] Inrease image limit in event --- Configuration/TCA/tx_events_domain_model_event.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Configuration/TCA/tx_events_domain_model_event.php b/Configuration/TCA/tx_events_domain_model_event.php index abe1ab1..58fe3b4 100644 --- a/Configuration/TCA/tx_events_domain_model_event.php +++ b/Configuration/TCA/tx_events_domain_model_event.php @@ -439,7 +439,7 @@ return [ --palette--;;filePalette' ] ], - 'maxitems' => 1 + 'maxitems' => 3 ], $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] ), From 59db0d6432a1cc66d65e526261ddefb6f6660bd9 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Tue, 23 Feb 2021 11:11:44 +0100 Subject: [PATCH 25/55] Do not limit 3 categories There is no reason to limit. By default there should be no limit. If a specific installation needs a limit, it can set it itself. --- Configuration/TCA/Overrides/tx_events_domain_model_event.php | 1 - 1 file changed, 1 deletion(-) diff --git a/Configuration/TCA/Overrides/tx_events_domain_model_event.php b/Configuration/TCA/Overrides/tx_events_domain_model_event.php index 9e75ded..875c3e2 100644 --- a/Configuration/TCA/Overrides/tx_events_domain_model_event.php +++ b/Configuration/TCA/Overrides/tx_events_domain_model_event.php @@ -10,7 +10,6 @@ defined('TYPO3') or die(); 'label' => 'Categories', 'fieldConfiguration' => [ 'minitems' => 0, - 'maxitems' => 3, 'multiple' => true, ] ] From cbd59a366d70dc8fee087b6698f8d56a4213937c Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Tue, 23 Feb 2021 13:54:28 +0100 Subject: [PATCH 26/55] Support new DI Provide Services.yaml to provide new DI. Also remove deprecated command registration and move them into Services.yaml. --- Configuration/Commands.php | 16 ---------------- Configuration/Services.yaml | 23 +++++++++++++++++++++++ 2 files changed, 23 insertions(+), 16 deletions(-) delete mode 100644 Configuration/Commands.php create mode 100644 Configuration/Services.yaml diff --git a/Configuration/Commands.php b/Configuration/Commands.php deleted file mode 100644 index 11e5c0f..0000000 --- a/Configuration/Commands.php +++ /dev/null @@ -1,16 +0,0 @@ - [ - 'class' => DestinationDataImportCommand::class - ], - 'events:removeAll' => [ - 'class' => RemoveAllCommand::class - ], - 'events:removePast' => [ - 'class' => RemovePastCommand::class - ], -]; diff --git a/Configuration/Services.yaml b/Configuration/Services.yaml new file mode 100644 index 0000000..9f37eb6 --- /dev/null +++ b/Configuration/Services.yaml @@ -0,0 +1,23 @@ +services: + _defaults: + autowire: true + autoconfigure: true + public: false + + Wrm\Events\: + resource: '../Classes/*' + + Wrm\Events\Command\DestinationDataImportCommand: + tags: + - name: 'console.command' + command: 'events:destinationdataimport' + + Wrm\Events\Command\RemoveAllCommand: + tags: + - name: 'console.command' + command: 'events:removeAll' + + Wrm\Events\Command\RemovePastCommand: + tags: + - name: 'console.command' + command: 'events:removePast' From 4e2f1910305ec4ff665b443eaec73caa6b57c6d6 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Wed, 24 Feb 2021 10:46:53 +0100 Subject: [PATCH 27/55] Fix broken demand support for categories This was broken since changes during update. --- Classes/Domain/Repository/EventRepository.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Classes/Domain/Repository/EventRepository.php b/Classes/Domain/Repository/EventRepository.php index a40eb95..403c6db 100644 --- a/Classes/Domain/Repository/EventRepository.php +++ b/Classes/Domain/Repository/EventRepository.php @@ -135,7 +135,7 @@ class EventRepository extends Repository $allCategories = GeneralUtility::intExplode(',', $demand->getCategories(), true); - if ($demand->includeSubCategories()) { + if ($demand->getIncludeSubCategories()) { $categoryService = GeneralUtility::makeInstance(CategoryService::class); $allCategories = $categoryService->getChildrenCategories($demand->getCategories()); if (!\is_array($allCategories)) { @@ -144,7 +144,7 @@ class EventRepository extends Repository } foreach ($allCategories as $category) { - $constraints[] = $query->contains('demand->getCategories()', $category); + $constraints[] = $query->contains('categories', $category); } if ($demand->getCategoryCombination() === 'or') { From afa6384636190600c06c8fed1168d3f5b5feb795 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Wed, 24 Feb 2021 16:08:17 +0100 Subject: [PATCH 28/55] Allow localization of event --- Configuration/TCA/tx_events_domain_model_event.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Configuration/TCA/tx_events_domain_model_event.php b/Configuration/TCA/tx_events_domain_model_event.php index 58fe3b4..5f59a07 100644 --- a/Configuration/TCA/tx_events_domain_model_event.php +++ b/Configuration/TCA/tx_events_domain_model_event.php @@ -504,6 +504,7 @@ return [ 'type' => 'select', 'renderType' => 'selectSingle', 'foreign_table' => 'tx_events_domain_model_organizer', + 'default' => 0, 'minitems' => 0, 'maxitems' => 1, ], @@ -515,6 +516,7 @@ return [ 'type' => 'select', 'renderType' => 'selectSingle', 'foreign_table' => 'tx_events_domain_model_region', + 'default' => 0, 'minitems' => 0, 'maxitems' => 1, ], From 9d2825ed182831e0610f4f2e86eef56343a2dead Mon Sep 17 00:00:00 2001 From: Dirk Koritnik Date: Mon, 8 Mar 2021 13:25:43 +0100 Subject: [PATCH 29/55] Allow multiline in event name --- Configuration/TCA/tx_events_domain_model_event.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/Configuration/TCA/tx_events_domain_model_event.php b/Configuration/TCA/tx_events_domain_model_event.php index 5f59a07..720b526 100644 --- a/Configuration/TCA/tx_events_domain_model_event.php +++ b/Configuration/TCA/tx_events_domain_model_event.php @@ -264,8 +264,9 @@ return [ 'exclude' => true, 'label' => $l10nPath . ':tx_events_domain_model_event.name', 'config' => [ - 'type' => 'input', - 'size' => 30, + 'type' => 'text', + 'cols' => 40, + 'rows' => 2, 'eval' => 'trim' ], ], From 55530ee0628ee4eef91f3bd8024dc6ee73edd648 Mon Sep 17 00:00:00 2001 From: Dirk Koritnik Date: Mon, 8 Mar 2021 13:45:31 +0100 Subject: [PATCH 30/55] Allow multiline in title and subtitle --- .../TCA/tx_events_domain_model_event.php | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Configuration/TCA/tx_events_domain_model_event.php b/Configuration/TCA/tx_events_domain_model_event.php index 720b526..999088f 100644 --- a/Configuration/TCA/tx_events_domain_model_event.php +++ b/Configuration/TCA/tx_events_domain_model_event.php @@ -170,8 +170,9 @@ return [ 'exclude' => true, 'label' => $l10nPath . ':tx_events_domain_model_event.title', 'config' => [ - 'type' => 'input', - 'size' => 30, + 'type' => 'text', + 'cols' => 40, + 'rows' => 2, 'eval' => 'trim' ] ], @@ -179,8 +180,9 @@ return [ 'exclude' => true, 'label' => $l10nPath . ':tx_events_domain_model_event.subtitle', 'config' => [ - 'type' => 'input', - 'size' => 30, + 'type' => 'text', + 'cols' => 40, + 'rows' => 2, 'eval' => 'trim' ] ], @@ -264,9 +266,8 @@ return [ 'exclude' => true, 'label' => $l10nPath . ':tx_events_domain_model_event.name', 'config' => [ - 'type' => 'text', - 'cols' => 40, - 'rows' => 2, + 'type' => 'input', + 'size' => 30, 'eval' => 'trim' ], ], From ce723b01bce3fb2711a9868f013e4291953bc009 Mon Sep 17 00:00:00 2001 From: Dirk Koritnik Date: Thu, 11 Mar 2021 08:31:49 +0100 Subject: [PATCH 31/55] Extend date canceld form --- .../TCA/tx_events_domain_model_date.php | 19 +++++++++++++++---- .../Language/de.locallang_csh_date.xlf | 14 +++++++++++--- .../Private/Language/locallang_csh_date.xlf | 10 ++++++++-- ext_tables.sql | 2 +- 4 files changed, 35 insertions(+), 10 deletions(-) diff --git a/Configuration/TCA/tx_events_domain_model_date.php b/Configuration/TCA/tx_events_domain_model_date.php index 3f8636d..718e2ce 100644 --- a/Configuration/TCA/tx_events_domain_model_date.php +++ b/Configuration/TCA/tx_events_domain_model_date.php @@ -143,11 +143,22 @@ return [ 'exclude' => true, 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_date.xlf:tx_events_domain_model_date.canceled', 'config' => [ - 'type' => 'check', - 'renderType' => 'checkboxToggle', - 'default' => 0, + 'type' => 'select', + 'renderType' => 'selectSingle', + 'default' => 'no', 'items' => [ - ['LLL:EXT:events/Resources/Private/Language/locallang_csh_date.xlf:tx_events_domain_model_date.canceled.yes'], + '0' => [ + '0' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_date.xlf:tx_events_domain_model_date.canceled.options.no', + '1' => 'no', + ], + '1' => [ + '0' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_date.xlf:tx_events_domain_model_date.canceled.options.canceled', + '1' => 'canceled', + ], + '2' => [ + '0' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_date.xlf:tx_events_domain_model_date.canceled.options.postponed', + '1' => 'postponed', + ], ], ], ], diff --git a/Resources/Private/Language/de.locallang_csh_date.xlf b/Resources/Private/Language/de.locallang_csh_date.xlf index 56e249a..4071c3b 100644 --- a/Resources/Private/Language/de.locallang_csh_date.xlf +++ b/Resources/Private/Language/de.locallang_csh_date.xlf @@ -16,13 +16,21 @@ Ende - Canceled? - Abgesagt? + Canceled or postponed? + Abgesagt oder verschoben? - + + No + Nein + + Canceled Abgesagt + + Postponed + Verschoben + Associated event Verknüpfte Veranstaltungen diff --git a/Resources/Private/Language/locallang_csh_date.xlf b/Resources/Private/Language/locallang_csh_date.xlf index 4613567..ad2b6ef 100644 --- a/Resources/Private/Language/locallang_csh_date.xlf +++ b/Resources/Private/Language/locallang_csh_date.xlf @@ -13,11 +13,17 @@ End - Canceled? + Canceled or postponed? - + + No + + Canceled + + Postponed + Associated event diff --git a/ext_tables.sql b/ext_tables.sql index 224a099..f3d6c97 100644 --- a/ext_tables.sql +++ b/ext_tables.sql @@ -71,7 +71,7 @@ CREATE TABLE tx_events_domain_model_date ( event int(11) unsigned DEFAULT '0' NOT NULL, start int(11) DEFAULT NULL, end int(11) DEFAULT NULL, - canceled int(11) NOT NULL DEFAULT 0, + canceled varchar(255) DEFAULT 'no' NOT NULL, KEY event (event), KEY dataHandler (event, t3ver_wsid, pid) ); From 4a8abbe344940469b957eb5795230be33ea5903a Mon Sep 17 00:00:00 2001 From: Dirk Koritnik Date: Thu, 11 Mar 2021 17:39:15 +0100 Subject: [PATCH 32/55] Add getter and setter for caceled --- Classes/Domain/Model/Date.php | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/Classes/Domain/Model/Date.php b/Classes/Domain/Model/Date.php index 8915380..ed545ee 100644 --- a/Classes/Domain/Model/Date.php +++ b/Classes/Domain/Model/Date.php @@ -21,9 +21,9 @@ class Date extends AbstractEntity protected $end = null; /** - * @var bool + * @var string */ - protected $canceled = false; + protected $canceled = "no"; /** * @var \Wrm\Events\Domain\Model\Event @@ -69,10 +69,7 @@ class Date extends AbstractEntity $this->end = $end; } - public function isCanceled(): bool - { - return $this->canceled; - } + /** * @return Event @@ -107,4 +104,21 @@ class Date extends AbstractEntity { return $this->_languageUid; } + + /** + * @return string + */ + public function getCanceled(): string + { + return $this->canceled; + } + + /** + * @param string $canceled + * @return void + */ + public function setCanceled(string $canceled) + { + $this->canceled = $canceled; + } } From cf2b571fda92219032bfe74b0aa350a49b46ba60 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Tue, 16 Mar 2021 08:10:46 +0100 Subject: [PATCH 33/55] Support manual sorting in foreign language Given: Website uses copy / free mode of localization. and Editor selects specific events to display. Then: Those events should be displayed as selected. Before this change the sorting was applied on uid of objects, which is the uid of default lanugage record. But editors might select localized uids. Therefore a fallback is added in case no object was found. Relates: #8557 --- Classes/Domain/Model/Event.php | 8 ++++++++ Classes/Domain/Repository/EventRepository.php | 7 +++++++ 2 files changed, 15 insertions(+) diff --git a/Classes/Domain/Model/Event.php b/Classes/Domain/Model/Event.php index b74e9ad..4b9a2bd 100644 --- a/Classes/Domain/Model/Event.php +++ b/Classes/Domain/Model/Event.php @@ -795,4 +795,12 @@ class Event extends AbstractEntity { return $this->_languageUid; } + + /** + * @return int + */ + public function getLocalizedUid() + { + return $this->_localizedUid; + } } diff --git a/Classes/Domain/Repository/EventRepository.php b/Classes/Domain/Repository/EventRepository.php index 403c6db..2797deb 100644 --- a/Classes/Domain/Repository/EventRepository.php +++ b/Classes/Domain/Repository/EventRepository.php @@ -95,7 +95,14 @@ class EventRepository extends Repository usort($result, function (Event $eventA, Event $eventB) use ($expectedSorting) { $positionOfA = array_search($eventA->getUid(), $expectedSorting); + if ($positionOfA === false) { + $positionOfA = array_search($eventA->getLocalizedUid(), $expectedSorting); + } + $positionOfB = array_search($eventB->getUid(), $expectedSorting); + if ($positionOfB === false) { + $positionOfB = array_search($eventB->getLocalizedUid(), $expectedSorting); + } return $positionOfA <=> $positionOfB; }); From c65ae5023fa094cdc1257d6160f05a900ae68772 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Tue, 16 Mar 2021 11:14:25 +0100 Subject: [PATCH 34/55] Allow integrator to set start or end for date via settings Respect start and end when creating demand from settings. That way integrator can configure it via TypoScript, or provide an FlexForm. Also the query was adjusted. It now respects a single value and doesn't need start and end. That way upcoming events can be created. Relates: #8581 --- Classes/Controller/DateController.php | 2 ++ Classes/Domain/Repository/DateRepository.php | 16 ++++++++-------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/Classes/Controller/DateController.php b/Classes/Controller/DateController.php index 1a55ec9..2d74ef1 100644 --- a/Classes/Controller/DateController.php +++ b/Classes/Controller/DateController.php @@ -167,6 +167,8 @@ class DateController extends ActionController $demand->setSortBy((string)$this->settings['sortByDate']); $demand->setSortOrder((string)$this->settings['sortOrder']); $demand->setHighlight((int)$this->settings['highlight']); + $demand->setStart((string)$this->settings['start'] ?? ''); + $demand->setEnd((string)$this->settings['end'] ?? ''); if (!empty($this->settings['limit'])) { $demand->setLimit($this->settings['limit']); diff --git a/Classes/Domain/Repository/DateRepository.php b/Classes/Domain/Repository/DateRepository.php index 6ac94e9..6204037 100644 --- a/Classes/Domain/Repository/DateRepository.php +++ b/Classes/Domain/Repository/DateRepository.php @@ -80,14 +80,14 @@ class DateRepository extends Repository $constraints['userCategories'] = $query->in('event.categories.uid', $demand->getUserCategories()); } - if ($demand->getStart() !== '' && $demand->getEnd() != '') { - $constraints['daterange'] = $query->logicalAnd( - [ - $query->greaterThanOrEqual('start', $demand->getStart()), - $query->lessThanOrEqual('end', $demand->getEnd()) - ] - ); - } else { + if ($demand->getStart() !== '') { + $constraints['starts'] = $query->greaterThanOrEqual('start', $demand->getStart()); + } + if ($demand->getEnd() != '') { + $constraints['ends'] = $query->lessThanOrEqual('end', $demand->getEnd()); + } + + if ($demand->getStart() === '' && $demand->getEnd() === '') { $now = new \DateTime('now', new \DateTimeZone('Europe/Berlin')); $constraints['untilnow'] = $query->greaterThanOrEqual('start', $now); } From 10b4c34fe6565b644d1e18a21f3553df916b7556 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Tue, 16 Mar 2021 12:10:07 +0100 Subject: [PATCH 35/55] Allow to define a new date if current is postponed Relates: #8092 --- Classes/Domain/Model/Date.php | 14 +++++++++++++ .../TCA/tx_events_domain_model_date.php | 20 ++++++++++++++++++- .../Language/de.locallang_csh_date.xlf | 8 ++++++++ .../Private/Language/locallang_csh_date.xlf | 6 ++++++ ext_tables.sql | 1 + 5 files changed, 48 insertions(+), 1 deletion(-) diff --git a/Classes/Domain/Model/Date.php b/Classes/Domain/Model/Date.php index ed545ee..4c65766 100644 --- a/Classes/Domain/Model/Date.php +++ b/Classes/Domain/Model/Date.php @@ -25,6 +25,11 @@ class Date extends AbstractEntity */ protected $canceled = "no"; + /** + * @var Date + */ + protected $postponedDate; + /** * @var \Wrm\Events\Domain\Model\Event */ @@ -121,4 +126,13 @@ class Date extends AbstractEntity { $this->canceled = $canceled; } + + public function getPostponedDate(): ?Date + { + if ($this->getCanceled() === 'postponed') { + return $this->postponedDate; + } + + return null; + } } diff --git a/Configuration/TCA/tx_events_domain_model_date.php b/Configuration/TCA/tx_events_domain_model_date.php index 718e2ce..2b03c26 100644 --- a/Configuration/TCA/tx_events_domain_model_date.php +++ b/Configuration/TCA/tx_events_domain_model_date.php @@ -23,7 +23,7 @@ return [ 'iconfile' => 'EXT:events/Resources/Public/Icons/tx_events_domain_model_date.svg' ], 'types' => [ - '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, start, end, canceled, event, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'], + '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, start, end, canceled, postponed_date, event, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'], ], 'columns' => [ 'sys_language_uid' => [ @@ -162,6 +162,24 @@ return [ ], ], ], + 'postponed_date' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_date.xlf:tx_events_domain_model_date.postponed_date', + 'displayCond' => 'FIELD:canceled:=:postponed', + 'config' => [ + 'type' => 'select', + 'renderType' => 'selectSingle', + 'foreign_table' => 'tx_events_domain_model_date', + 'foreign_table_where' => ' AND {#tx_events_domain_model_date}.{#event} = ###REC_FIELD_event###', + 'default' => '0', + 'items' => [ + '0' => [ + '0' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_date.xlf:tx_events_domain_model_date.postponed_date.0', + '1' => '0', + ], + ], + ], + ], 'event' => array( 'exclude' => 1, diff --git a/Resources/Private/Language/de.locallang_csh_date.xlf b/Resources/Private/Language/de.locallang_csh_date.xlf index 4071c3b..257e605 100644 --- a/Resources/Private/Language/de.locallang_csh_date.xlf +++ b/Resources/Private/Language/de.locallang_csh_date.xlf @@ -31,6 +31,14 @@ Postponed Verschoben + + Postponed date + Verschoben auf folgendes Datum + + + Not defined + Noch nicht definiert + Associated event Verknüpfte Veranstaltungen diff --git a/Resources/Private/Language/locallang_csh_date.xlf b/Resources/Private/Language/locallang_csh_date.xlf index ad2b6ef..d52becb 100644 --- a/Resources/Private/Language/locallang_csh_date.xlf +++ b/Resources/Private/Language/locallang_csh_date.xlf @@ -24,6 +24,12 @@ Postponed + + Postponed date + + + Not defined + Associated event diff --git a/ext_tables.sql b/ext_tables.sql index f3d6c97..30526af 100644 --- a/ext_tables.sql +++ b/ext_tables.sql @@ -91,5 +91,6 @@ CREATE TABLE tx_events_domain_model_region ( CREATE TABLE tx_events_domain_model_date ( event int(11) unsigned DEFAULT '0' NOT NULL, + postponed_date int(11) unsigned DEFAULT '0' NOT NULL, ); From 3012816123b5a601411a0d6ac62b527dd81cb0e9 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Tue, 16 Mar 2021 13:32:34 +0100 Subject: [PATCH 36/55] Allow to delete events Relates: #8570 --- Configuration/TCA/tx_events_domain_model_event.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Configuration/TCA/tx_events_domain_model_event.php b/Configuration/TCA/tx_events_domain_model_event.php index 999088f..0a4c0b9 100644 --- a/Configuration/TCA/tx_events_domain_model_event.php +++ b/Configuration/TCA/tx_events_domain_model_event.php @@ -485,7 +485,7 @@ return [ 'dragdrop' => false, 'sort' => false, 'hide' => false, - 'delete' => false, + 'delete' => true, 'localize' => false, ), 'levelLinksPosition' => 'top', From bfaa25c707345242f930b60e435cc863ae6475c3 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Tue, 16 Mar 2021 15:22:27 +0100 Subject: [PATCH 37/55] Do not allow self reference for postponed date --- Configuration/TCA/tx_events_domain_model_date.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Configuration/TCA/tx_events_domain_model_date.php b/Configuration/TCA/tx_events_domain_model_date.php index 2b03c26..5a8a68b 100644 --- a/Configuration/TCA/tx_events_domain_model_date.php +++ b/Configuration/TCA/tx_events_domain_model_date.php @@ -170,7 +170,7 @@ return [ 'type' => 'select', 'renderType' => 'selectSingle', 'foreign_table' => 'tx_events_domain_model_date', - 'foreign_table_where' => ' AND {#tx_events_domain_model_date}.{#event} = ###REC_FIELD_event###', + 'foreign_table_where' => ' AND {#tx_events_domain_model_date}.{#event} = ###REC_FIELD_event### AND {#tx_events_domain_model_date}.{#uid} != ###THIS_UID###', 'default' => '0', 'items' => [ '0' => [ From cbbe56775ec190246c6b93446cb9e720665081c7 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Tue, 16 Mar 2021 16:05:39 +0100 Subject: [PATCH 38/55] Allow to add link for canceled dates E.g. allow users to get info about refunds. Relates: #8574 --- Classes/Domain/Model/Date.php | 14 +++++++++++++ .../TCA/tx_events_domain_model_date.php | 21 ++++++++++++++++++- .../Language/de.locallang_csh_date.xlf | 4 ++++ .../Private/Language/locallang_csh_date.xlf | 3 +++ ext_tables.sql | 1 + 5 files changed, 42 insertions(+), 1 deletion(-) diff --git a/Classes/Domain/Model/Date.php b/Classes/Domain/Model/Date.php index 4c65766..390a0b1 100644 --- a/Classes/Domain/Model/Date.php +++ b/Classes/Domain/Model/Date.php @@ -35,6 +35,11 @@ class Date extends AbstractEntity */ protected $event = null; + /** + * @var string + */ + protected $canceledLink = ''; + /** * @var int */ @@ -135,4 +140,13 @@ class Date extends AbstractEntity return null; } + + public function getCanceledLink(): string + { + if ($this->getCanceled() === 'canceled') { + return $this->canceledLink; + } + + return ''; + } } diff --git a/Configuration/TCA/tx_events_domain_model_date.php b/Configuration/TCA/tx_events_domain_model_date.php index 5a8a68b..f8a25ba 100644 --- a/Configuration/TCA/tx_events_domain_model_date.php +++ b/Configuration/TCA/tx_events_domain_model_date.php @@ -23,7 +23,7 @@ return [ 'iconfile' => 'EXT:events/Resources/Public/Icons/tx_events_domain_model_date.svg' ], 'types' => [ - '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, start, end, canceled, postponed_date, event, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'], + '1' => ['showitem' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, start, end, canceled, postponed_date, canceled_link, event, --div--;LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:tabs.access, starttime, endtime'], ], 'columns' => [ 'sys_language_uid' => [ @@ -180,6 +180,25 @@ return [ ], ], ], + 'canceled_link' => [ + 'exclude' => true, + 'label' => 'LLL:EXT:events/Resources/Private/Language/locallang_csh_date.xlf:tx_events_domain_model_date.canceled_link', + 'displayCond' => 'FIELD:canceled:=:canceled', + 'config' => [ + 'type' => 'input', + 'softref' => 'typolink', + 'renderType' => 'inputLink', + 'max' => 1024, + 'eval' => 'trim', + 'fieldControl' => [ + 'linkPopup' => [ + 'options' => [ + 'title' => 'LLL:EXT:frontend/Resources/Private/Language/locallang_ttc.xlf:header_link_formlabel', + ], + ], + ], + ], + ], 'event' => array( 'exclude' => 1, diff --git a/Resources/Private/Language/de.locallang_csh_date.xlf b/Resources/Private/Language/de.locallang_csh_date.xlf index 257e605..b931349 100644 --- a/Resources/Private/Language/de.locallang_csh_date.xlf +++ b/Resources/Private/Language/de.locallang_csh_date.xlf @@ -39,6 +39,10 @@ Not defined Noch nicht definiert + + Link regarding cancellation + Link bezüglich Absage + Associated event Verknüpfte Veranstaltungen diff --git a/Resources/Private/Language/locallang_csh_date.xlf b/Resources/Private/Language/locallang_csh_date.xlf index d52becb..42a521b 100644 --- a/Resources/Private/Language/locallang_csh_date.xlf +++ b/Resources/Private/Language/locallang_csh_date.xlf @@ -30,6 +30,9 @@ Not defined + + Link regarding cancellation + Associated event diff --git a/ext_tables.sql b/ext_tables.sql index 30526af..06dc017 100644 --- a/ext_tables.sql +++ b/ext_tables.sql @@ -92,5 +92,6 @@ CREATE TABLE tx_events_domain_model_date ( event int(11) unsigned DEFAULT '0' NOT NULL, postponed_date int(11) unsigned DEFAULT '0' NOT NULL, + canceled_link varchar(1024) DEFAULT '' NOT NULL, ); From 2450f5c6b72f276d48118734b3b7f67a5eb34fa6 Mon Sep 17 00:00:00 2001 From: Dirk Koritnik Date: Thu, 18 Mar 2021 16:39:04 +0100 Subject: [PATCH 39/55] Switch to Storage Object for images --- Classes/Domain/Model/Event.php | 8 ++++---- Configuration/TCA/tx_events_domain_model_event.php | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Classes/Domain/Model/Event.php b/Classes/Domain/Model/Event.php index 4b9a2bd..a613211 100644 --- a/Classes/Domain/Model/Event.php +++ b/Classes/Domain/Model/Event.php @@ -174,7 +174,7 @@ class Event extends AbstractEntity /** * images * - * @var \TYPO3\CMS\Extbase\Domain\Model\FileReference + * @var ObjectStorage * @Extbase\ORM\Cascade remove */ protected $images = null; @@ -578,15 +578,15 @@ class Event extends AbstractEntity } /** - * @return FileReference $images + * @return ObjectStorage $images */ - public function getImages() + public function getImages(): ObjectStorage { return $this->images; } /** - * @param FileReference $images + * @param ObjectStorage $images * @return void */ public function setImages(FileReference $images) diff --git a/Configuration/TCA/tx_events_domain_model_event.php b/Configuration/TCA/tx_events_domain_model_event.php index 0a4c0b9..a7de672 100644 --- a/Configuration/TCA/tx_events_domain_model_event.php +++ b/Configuration/TCA/tx_events_domain_model_event.php @@ -240,7 +240,7 @@ return [ 'config' => [ 'type' => 'text', 'enableRichtext' => true, - 'richtextConfiguration' => 'default', + 'richtextConfiguration' => 'Default', 'fieldControl' => [ 'fullScreenRichtext' => [ 'disabled' => false, From 9a8ee30580295527939b9ba315b8ce6217742aad Mon Sep 17 00:00:00 2001 From: Dirk Koritnik Date: Fri, 19 Mar 2021 14:26:47 +0100 Subject: [PATCH 40/55] Increase image limit --- Configuration/TCA/tx_events_domain_model_event.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Configuration/TCA/tx_events_domain_model_event.php b/Configuration/TCA/tx_events_domain_model_event.php index a7de672..216d84f 100644 --- a/Configuration/TCA/tx_events_domain_model_event.php +++ b/Configuration/TCA/tx_events_domain_model_event.php @@ -441,7 +441,7 @@ return [ --palette--;;filePalette' ] ], - 'maxitems' => 3 + 'maxitems' => 8 ], $GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'] ), From 1929a4a56610eff27a754ceb3d9d0b6c6153d3bb Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Tue, 23 Mar 2021 16:34:38 +0100 Subject: [PATCH 41/55] Use sorting of categories Extbase will properly use mm sorting. But categories can't be sorted within the TCA tree component. Therefore it makes more sense to use actual sys_category sorting. In order to do so, we add our own model and pass the sorting. That way PHP can do the sorting. That's the easiest approach. Also events shouldn't contain to many categories. A performance impact should not be high. Relates: #8459 --- Classes/Domain/Model/Category.php | 40 +++++++++++++++++++ Classes/Domain/Model/Event.php | 16 ++++---- Configuration/Extbase/Persistence/Classes.php | 9 +++++ Configuration/TCA/Overrides/sys_category.php | 16 ++++++++ 4 files changed, 74 insertions(+), 7 deletions(-) create mode 100644 Classes/Domain/Model/Category.php create mode 100644 Configuration/Extbase/Persistence/Classes.php create mode 100644 Configuration/TCA/Overrides/sys_category.php diff --git a/Classes/Domain/Model/Category.php b/Classes/Domain/Model/Category.php new file mode 100644 index 0000000..1b1412e --- /dev/null +++ b/Classes/Domain/Model/Category.php @@ -0,0 +1,40 @@ + + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +use TYPO3\CMS\Extbase\Domain\Model\Category as ExtbaseCategory; + +/** + * Extend original model to include furher properties. + */ +class Category extends ExtbaseCategory +{ + /** + * @var int + */ + protected $sorting = 0; + + public function getSorting(): int + { + return $this->sorting; + } +} diff --git a/Classes/Domain/Model/Event.php b/Classes/Domain/Model/Event.php index a613211..79d5772 100644 --- a/Classes/Domain/Model/Event.php +++ b/Classes/Domain/Model/Event.php @@ -4,7 +4,6 @@ namespace Wrm\Events\Domain\Model; use TYPO3\CMS\Extbase\Annotation as Extbase; use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; -use TYPO3\CMS\Extbase\Domain\Model\Category; use TYPO3\CMS\Extbase\Domain\Model\FileReference; use TYPO3\CMS\Extbase\Object\ObjectManager; use TYPO3\CMS\Extbase\Persistence\ObjectStorage; @@ -209,7 +208,7 @@ class Event extends AbstractEntity /** * categories * - * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\Category> + * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage */ protected $categories; @@ -763,12 +762,15 @@ class Event extends AbstractEntity $this->categories->attach($category); } - /** - * @return $categories - */ - public function getCategories() + public function getCategories(): array { - return $this->categories; + $categories = $this->categories->toArray(); + + usort($categories, function (Category $catA, Category $catB) { + return $catA->getSorting() <=> $catB->getSorting(); + }); + + return $categories; } /** diff --git a/Configuration/Extbase/Persistence/Classes.php b/Configuration/Extbase/Persistence/Classes.php new file mode 100644 index 0000000..ff15775 --- /dev/null +++ b/Configuration/Extbase/Persistence/Classes.php @@ -0,0 +1,9 @@ + [ + 'tableName' => 'sys_category', + ], +]; diff --git a/Configuration/TCA/Overrides/sys_category.php b/Configuration/TCA/Overrides/sys_category.php new file mode 100644 index 0000000..4c79736 --- /dev/null +++ b/Configuration/TCA/Overrides/sys_category.php @@ -0,0 +1,16 @@ + [ + 'sorting' => [ + 'config' => [ + // Allow extbase to map this column to model + 'type' => 'passthrough', + ], + ], + ], + ]); +})('events', 'sys_category'); From 5440ef4f727212900825a0d817c1fcfbac78dd95 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Mon, 14 Jun 2021 16:06:26 +0200 Subject: [PATCH 42/55] Fix not available cache for events_category Adjust cache name to match TYPO3 v10 convention without "cache_" prefix. Add default configuration to prevent issue if integrator does not configure cache. --- Classes/Service/CategoryService.php | 2 +- ext_localconf.php | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Classes/Service/CategoryService.php b/Classes/Service/CategoryService.php index d11aa32..a7b1637 100755 --- a/Classes/Service/CategoryService.php +++ b/Classes/Service/CategoryService.php @@ -21,7 +21,7 @@ class CategoryService public function __construct() { $this->timeTracker = GeneralUtility::makeInstance(TimeTracker::class); - $this->cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('cache_Events_category'); + $this->cache = GeneralUtility::makeInstance(CacheManager::class)->getCache('events_category'); } /** diff --git a/ext_localconf.php b/ext_localconf.php index 6899368..1b12074 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -32,6 +32,10 @@ call_user_func( [\Wrm\Events\Controller\EventController::class => 'list'] ); + if (!is_array($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['events_category'])) { + $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['events_category'] = []; + } + $iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class); $iconRegistry->registerIcon( 'events-plugin', From ed23c783cd84964d654a5d796fdef82109f37309 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Mon, 14 Jun 2021 16:08:43 +0200 Subject: [PATCH 43/55] Adjust formatting --- ext_localconf.php | 70 ++++++++++++++++++++++------------------------- 1 file changed, 33 insertions(+), 37 deletions(-) diff --git a/ext_localconf.php b/ext_localconf.php index 1b12074..06e7ea3 100644 --- a/ext_localconf.php +++ b/ext_localconf.php @@ -2,46 +2,42 @@ defined('TYPO3') || die('Access denied.'); -call_user_func( - function () { +call_user_func(function () { + \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( + 'Events', + 'DateSearch', + [\Wrm\Events\Controller\DateController::class => 'search'], + [\Wrm\Events\Controller\DateController::class => 'search'] + ); - \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( - 'Events', - 'DateSearch', - [\Wrm\Events\Controller\DateController::class => 'search'], - [\Wrm\Events\Controller\DateController::class => 'search'] - ); + \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( + 'Events', + 'DateList', + [\Wrm\Events\Controller\DateController::class => 'list'], + [\Wrm\Events\Controller\DateController::class => 'list'] + ); - \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( - 'Events', - 'DateList', - [\Wrm\Events\Controller\DateController::class => 'list'], - [\Wrm\Events\Controller\DateController::class => 'list'] - ); + \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( + 'Events', + 'DateShow', + [\Wrm\Events\Controller\DateController::class => 'show'], + [\Wrm\Events\Controller\DateController::class => 'show'] + ); - \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( - 'Events', - 'DateShow', - [\Wrm\Events\Controller\DateController::class => 'show'], - [\Wrm\Events\Controller\DateController::class => 'show'] - ); + \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( + 'Events', + 'Selected', + [\Wrm\Events\Controller\EventController::class => 'list'] + ); - \TYPO3\CMS\Extbase\Utility\ExtensionUtility::configurePlugin( - 'Events', - 'Selected', - [\Wrm\Events\Controller\EventController::class => 'list'] - ); - - if (!is_array($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['events_category'])) { - $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['events_category'] = []; - } - - $iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class); - $iconRegistry->registerIcon( - 'events-plugin', - \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class, - ['source' => 'EXT:events/Resources/Public/Icons/Extension.svg'] - ); + if (!is_array($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['events_category'])) { + $GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations']['events_category'] = []; } -); + $iconRegistry = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Core\Imaging\IconRegistry::class); + $iconRegistry->registerIcon( + 'events-plugin', + \TYPO3\CMS\Core\Imaging\IconProvider\SvgIconProvider::class, + ['source' => 'EXT:events/Resources/Public/Icons/Extension.svg'] + ); +}); From 36ecc9bbe8eadd63226d57bfca49a1f203a8f032 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Wed, 16 Jun 2021 11:19:11 +0200 Subject: [PATCH 44/55] Add cObject data to fluid when available Relates: #9012 --- Classes/Controller/AbstractController.php | 44 +++++++++++++++++++++++ Classes/Controller/DateController.php | 3 +- Classes/Controller/EventController.php | 3 +- 3 files changed, 46 insertions(+), 4 deletions(-) create mode 100644 Classes/Controller/AbstractController.php diff --git a/Classes/Controller/AbstractController.php b/Classes/Controller/AbstractController.php new file mode 100644 index 0000000..55e27d2 --- /dev/null +++ b/Classes/Controller/AbstractController.php @@ -0,0 +1,44 @@ + + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; +use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer; + +class AbstractController extends ActionController +{ + /** + * Extend original to also add data from current cobject if available. + */ + protected function resolveView() + { + $view = parent::resolveView(); + + $view->assign('data', []); + $cObject = $this->configurationManager->getContentObject(); + if ($cObject instanceof ContentObjectRenderer && is_array($cObject->data)) { + $view->assign('data', $cObject->data); + } + + return $view; + } +} diff --git a/Classes/Controller/DateController.php b/Classes/Controller/DateController.php index 2d74ef1..db6bea3 100644 --- a/Classes/Controller/DateController.php +++ b/Classes/Controller/DateController.php @@ -6,7 +6,6 @@ use TYPO3\CMS\Core\Database\QueryGenerator; use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Annotation as Extbase; use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; -use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; use Wrm\Events\Domain\Model\Date; use Wrm\Events\Domain\Model\Dto\DateDemand; use Wrm\Events\Domain\Repository\CategoryRepository; @@ -17,7 +16,7 @@ use Wrm\Events\Service\DataProcessingForModels; /** * DateController */ -class DateController extends ActionController +class DateController extends AbstractController { /** diff --git a/Classes/Controller/EventController.php b/Classes/Controller/EventController.php index 2f4ef3b..c247b06 100644 --- a/Classes/Controller/EventController.php +++ b/Classes/Controller/EventController.php @@ -3,14 +3,13 @@ namespace Wrm\Events\Controller; use TYPO3\CMS\Extbase\Annotation as Extbase; -use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; use Wrm\Events\Domain\Model\Dto\EventDemand; use Wrm\Events\Domain\Model\Dto\EventDemandFactory; use Wrm\Events\Domain\Model\Event; use Wrm\Events\Domain\Repository\EventRepository; use Wrm\Events\Service\DataProcessingForModels; -class EventController extends ActionController +class EventController extends AbstractController { /** * @var EventRepository From 97bcbe2065e848f40ef481773d9af4d566242507 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Thu, 17 Jun 2021 12:08:09 +0200 Subject: [PATCH 45/55] Add original date to dates if available This is not possible via native API. We therefore use the event to fetch and add the relation. Relates: #8857 --- Classes/Domain/Model/Date.php | 12 +++- Classes/Extbase/AddSpecialProperties.php | 75 ++++++++++++++++++++++++ Configuration/Services.yaml | 6 ++ 3 files changed, 92 insertions(+), 1 deletion(-) create mode 100644 Classes/Extbase/AddSpecialProperties.php diff --git a/Classes/Domain/Model/Date.php b/Classes/Domain/Model/Date.php index 390a0b1..06384b9 100644 --- a/Classes/Domain/Model/Date.php +++ b/Classes/Domain/Model/Date.php @@ -26,10 +26,15 @@ class Date extends AbstractEntity protected $canceled = "no"; /** - * @var Date + * @var null|Date */ protected $postponedDate; + /** + * @var null|Date + */ + protected $originalDate; + /** * @var \Wrm\Events\Domain\Model\Event */ @@ -141,6 +146,11 @@ class Date extends AbstractEntity return null; } + public function getOriginalDate(): ?Date + { + return $this->originalDate; + } + public function getCanceledLink(): string { if ($this->getCanceled() === 'canceled') { diff --git a/Classes/Extbase/AddSpecialProperties.php b/Classes/Extbase/AddSpecialProperties.php new file mode 100644 index 0000000..287495b --- /dev/null +++ b/Classes/Extbase/AddSpecialProperties.php @@ -0,0 +1,75 @@ + + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +use TYPO3\CMS\Core\Database\ConnectionPool; +use TYPO3\CMS\Extbase\Event\Persistence\AfterObjectThawedEvent; +use TYPO3\CMS\Extbase\Persistence\Generic\Mapper\DataMapper; +use Wrm\Events\Domain\Model\Date; + +class AddSpecialProperties +{ + /** + * @var ConnectionPool + */ + private $connectionPool; + + /** + * @var DataMapper + */ + private $dataMapper; + + public function __construct( + ConnectionPool $connectionPool, + DataMapper $dataMapper + ) { + $this->connectionPool = $connectionPool; + $this->dataMapper = $dataMapper; + } + + public function __invoke(AfterObjectThawedEvent $event): void + { + if ($event->getObject() instanceof Date) { + /** @var Date $date */ + $date = $event->getObject(); + $date->_setProperty('originalDate', $this->getOriginalDate($date->_getProperty('_localizedUid'))); + } + } + + private function getOriginalDate(int $uidOfReferencedDate): ?Date + { + $qb = $this->connectionPool->getQueryBuilderForTable('tx_events_domain_model_date'); + $qb->select('*'); + $qb->from('tx_events_domain_model_date'); + $qb->where($qb->expr()->eq('postponed_date', $uidOfReferencedDate)); + $qb->setMaxResults(1); + + $result = $qb->execute()->fetch(); + + if ($result === false) { + return null; + } + + $dates = $this->dataMapper->map(Date::class, [$result]); + return $dates[0] ?? null; + } +} diff --git a/Configuration/Services.yaml b/Configuration/Services.yaml index 9f37eb6..5d2e91e 100644 --- a/Configuration/Services.yaml +++ b/Configuration/Services.yaml @@ -21,3 +21,9 @@ services: tags: - name: 'console.command' command: 'events:removePast' + + Wrm\Events\Extbase\AddSpecialProperties: + tags: + - name: event.listener + identifier: 'WrmEventsAddSpecialPropertiesToDate' + event: TYPO3\CMS\Extbase\Event\Persistence\AfterObjectThawedEvent From 326378e2fc4c9a8de700a1c15d61dcadb9b10d30 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Tue, 13 Jul 2021 09:31:01 +0200 Subject: [PATCH 46/55] Allow to reference events from event This might be useful to allow editors and integrators to create something like "you might also be interested in" or "related events". --- Classes/Domain/Model/Event.php | 14 ++++++++++++++ .../TCA/tx_events_domain_model_event.php | 16 ++++++++++++++++ .../Private/Language/de.locallang_csh_event.xlf | 4 ++++ .../Private/Language/locallang_csh_event.xlf | 3 +++ ext_tables.sql | 1 + 5 files changed, 38 insertions(+) diff --git a/Classes/Domain/Model/Event.php b/Classes/Domain/Model/Event.php index 79d5772..3afcebe 100644 --- a/Classes/Domain/Model/Event.php +++ b/Classes/Domain/Model/Event.php @@ -217,6 +217,11 @@ class Event extends AbstractEntity */ protected $partner; + /** + * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage + */ + protected $referencesEvents; + /** * @var int */ @@ -251,6 +256,7 @@ class Event extends AbstractEntity protected function initStorageObjects() { $this->dates = new ObjectStorage(); + $this->referencesEvents = new ObjectStorage(); } /** @@ -674,6 +680,14 @@ class Event extends AbstractEntity return $this->partner; } + /** + * @return ObjectStorage + */ + public function getReferencesEvents(): ObjectStorage + { + return $this->referencesEvents; + } + /** * @param \Wrm\Events\Domain\Model\Organizer $organizer * @return void diff --git a/Configuration/TCA/tx_events_domain_model_event.php b/Configuration/TCA/tx_events_domain_model_event.php index 216d84f..0570c5f 100644 --- a/Configuration/TCA/tx_events_domain_model_event.php +++ b/Configuration/TCA/tx_events_domain_model_event.php @@ -63,6 +63,7 @@ return [ region, partner, categories, + references_events, pages, --div--;' . $l10nPath . ':tx_events_domain_model_event.tabs.media, images, @@ -524,6 +525,21 @@ return [ ], ], + 'references_events' => [ + 'exclude' => true, + 'label' => $l10nPath . ':tx_events_domain_model_event.references_events', + 'config' => [ + 'type' => 'group', + 'internal_type' => 'db', + 'allowed' => 'tx_events_domain_model_event', + 'suggestOptions' => [ + 'tx_events_domain_model_event' => [ + 'searchCondition' => 'tx_events_domain_model_event.sys_language_uid IN (0, -1)', + ], + ], + ], + ], + 'partner' => [ 'exclude' => true, 'label' => $l10nPath . ':tx_events_domain_model_event.partner', diff --git a/Resources/Private/Language/de.locallang_csh_event.xlf b/Resources/Private/Language/de.locallang_csh_event.xlf index ced4f75..59e8704 100644 --- a/Resources/Private/Language/de.locallang_csh_event.xlf +++ b/Resources/Private/Language/de.locallang_csh_event.xlf @@ -159,6 +159,10 @@ Partner Partner + + Related Events + Ähnliche Veranstaltungen + diff --git a/Resources/Private/Language/locallang_csh_event.xlf b/Resources/Private/Language/locallang_csh_event.xlf index 32c079c..97cb2f0 100644 --- a/Resources/Private/Language/locallang_csh_event.xlf +++ b/Resources/Private/Language/locallang_csh_event.xlf @@ -117,6 +117,9 @@ Partner + + Related Events + diff --git a/ext_tables.sql b/ext_tables.sql index 06dc017..5ec72fb 100644 --- a/ext_tables.sql +++ b/ext_tables.sql @@ -32,6 +32,7 @@ CREATE TABLE tx_events_domain_model_event ( organizer int(11) unsigned DEFAULT '0', partner text, region int(11) unsigned DEFAULT '0', + references_events text, KEY dataHandler (l10n_parent, t3ver_oid, deleted, t3ver_wsid, t3ver_state) ); From 39d4f628e39d74eb151c531bcb64c6adca9fb5c1 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Tue, 13 Jul 2021 09:31:42 +0200 Subject: [PATCH 47/55] Prevent broken event state when build from db result The process will not call __construct, the object storages might not be initialized. Therefore initializeObject is now implemented which is calling the existing method to initialize object storages. --- Classes/Domain/Model/Event.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Classes/Domain/Model/Event.php b/Classes/Domain/Model/Event.php index 3afcebe..c348e8d 100644 --- a/Classes/Domain/Model/Event.php +++ b/Classes/Domain/Model/Event.php @@ -250,6 +250,11 @@ class Event extends AbstractEntity $this->dataProcessing = $dataProcessing; } + public function initializeObject() + { + $this->initStorageObjects(); + } + /** * @return void */ From beca8c2e072b47c7343c4e3fa673bdade3c300e9 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Mon, 6 Sep 2021 15:02:42 +0200 Subject: [PATCH 48/55] Keep old legacy command identifier The old identifier had a trailing comma. Old installations would break if we do not keep the command under this identifier. Updating scheduler tasks is a bad thing, so we keep compatibility. --- Configuration/Services.yaml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Configuration/Services.yaml b/Configuration/Services.yaml index 5d2e91e..a0fd323 100644 --- a/Configuration/Services.yaml +++ b/Configuration/Services.yaml @@ -11,6 +11,11 @@ services: tags: - name: 'console.command' command: 'events:destinationdataimport' + events.levacy_comannd_identifier: + class: 'Wrm\Events\Command\DestinationDataImportCommand' + tags: + - name: 'console.command' + command: 'events:destinationdataimport‚' Wrm\Events\Command\RemoveAllCommand: tags: From 8ddbc2fb88c45f29a61ddbb76b4381410e5c5916 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Mon, 6 Sep 2021 15:18:48 +0200 Subject: [PATCH 49/55] Handle missing target folder on import --- Classes/Service/DestinationDataImportService.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Classes/Service/DestinationDataImportService.php b/Classes/Service/DestinationDataImportService.php index 7c72bf4..520c717 100644 --- a/Classes/Service/DestinationDataImportService.php +++ b/Classes/Service/DestinationDataImportService.php @@ -7,6 +7,7 @@ use TYPO3\CMS\Core\DataHandling\DataHandler; use TYPO3\CMS\Core\DataHandling\SlugHelper; use TYPO3\CMS\Core\Database\ConnectionPool; use TYPO3\CMS\Core\Log\LogManager; +use TYPO3\CMS\Core\Resource\Exception\FolderDoesNotExistException; use TYPO3\CMS\Core\Resource\FileRepository; use TYPO3\CMS\Core\Resource\Index\MetaDataRepository; use TYPO3\CMS\Core\Resource\ResourceFactory; @@ -656,7 +657,14 @@ class DestinationDataImportService if ($file = $this->loadFile($orgFileUrl)) { // Move file to defined folder $this->logger->info('Adding file ' . $file); - $this->storage->addFile($this->environment->getPublicPath() . "/uploads/tx_events/" . $file, $this->storage->getFolder($this->filesFolder)); + + try { + $targetFolder = $this->storage->getFolder($this->filesFolder); + } catch (FolderDoesNotExistException $e) { + $targetFolder = $this->storage->createFolder($this->filesFolder); + } + + $this->storage->addFile($this->environment->getPublicPath() . "/uploads/tx_events/" . $file, $targetFolder); } else { $error = true; } From 3822b86df669058cf3455426e207e89356d3daf6 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Mon, 6 Sep 2021 15:19:06 +0200 Subject: [PATCH 50/55] Fix Category type miss match during import Extbase Category repository was used, while custom Category instances were expected. --- Classes/Service/DestinationDataImportService.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Classes/Service/DestinationDataImportService.php b/Classes/Service/DestinationDataImportService.php index 520c717..ea2d717 100644 --- a/Classes/Service/DestinationDataImportService.php +++ b/Classes/Service/DestinationDataImportService.php @@ -15,13 +15,13 @@ use TYPO3\CMS\Core\Utility\GeneralUtility; use TYPO3\CMS\Extbase\Configuration\ConfigurationManager; use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface; use TYPO3\CMS\Extbase\Domain\Model\Category; -use TYPO3\CMS\Extbase\Domain\Repository\CategoryRepository; use TYPO3\CMS\Extbase\Object\ObjectManager; use TYPO3\CMS\Extbase\Persistence\Generic\PersistenceManager; use TYPO3\CMS\Extbase\Persistence\ObjectStorage; use Wrm\Events\Domain\Model\Date; use Wrm\Events\Domain\Model\Event; use Wrm\Events\Domain\Model\Organizer; +use Wrm\Events\Domain\Repository\CategoryRepository; use Wrm\Events\Domain\Repository\DateRepository; use Wrm\Events\Domain\Repository\EventRepository; use Wrm\Events\Domain\Repository\OrganizerRepository; From 8201782b6fe4b98412eea15e42e3befa88faa685 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Mon, 6 Sep 2021 15:34:23 +0200 Subject: [PATCH 51/55] Properly check for images Do not check for models, but actual file. They might be missing, e.g. cause not downloaded from production into dev environment. The new checks ensure the page will not break with an exception, but show default images. --- Resources/Private/Partials/Date/ListDefault.html | 4 ++-- Resources/Private/Partials/Date/ListTable.html | 4 ++-- Resources/Private/Templates/Date/Show.html | 4 ++-- Resources/Private/Templates/Date/Teaser.html | 6 +++--- Resources/Private/Templates/Event/List.html | 6 +++--- Resources/Private/Templates/Event/Search.html | 6 +++--- Resources/Private/Templates/Event/Show.html | 6 +++--- Resources/Private/Templates/Event/Teaser.html | 6 +++--- 8 files changed, 21 insertions(+), 21 deletions(-) diff --git a/Resources/Private/Partials/Date/ListDefault.html b/Resources/Private/Partials/Date/ListDefault.html index c62a6fb..dfc44c8 100644 --- a/Resources/Private/Partials/Date/ListDefault.html +++ b/Resources/Private/Partials/Date/ListDefault.html @@ -3,10 +3,10 @@

- + - + diff --git a/Resources/Private/Templates/Date/Show.html b/Resources/Private/Templates/Date/Show.html index 4929454..77b36a9 100644 --- a/Resources/Private/Templates/Date/Show.html +++ b/Resources/Private/Templates/Date/Show.html @@ -3,9 +3,9 @@
- + - + Dummy diff --git a/Resources/Private/Templates/Date/Teaser.html b/Resources/Private/Templates/Date/Teaser.html index 4f2f9de..fc1bf56 100644 --- a/Resources/Private/Templates/Date/Teaser.html +++ b/Resources/Private/Templates/Date/Teaser.html @@ -10,10 +10,10 @@ --> - \ No newline at end of file + diff --git a/Resources/Private/Templates/Event/List.html b/Resources/Private/Templates/Event/List.html index d9ec46f..50707dd 100644 --- a/Resources/Private/Templates/Event/List.html +++ b/Resources/Private/Templates/Event/List.html @@ -6,10 +6,10 @@
- \ No newline at end of file + diff --git a/Resources/Private/Templates/Event/Search.html b/Resources/Private/Templates/Event/Search.html index 2e5cd72..111d621 100644 --- a/Resources/Private/Templates/Event/Search.html +++ b/Resources/Private/Templates/Event/Search.html @@ -4,10 +4,10 @@
-
\ No newline at end of file +
diff --git a/Resources/Private/Templates/Event/Show.html b/Resources/Private/Templates/Event/Show.html index 49d418b..4ede781 100644 --- a/Resources/Private/Templates/Event/Show.html +++ b/Resources/Private/Templates/Event/Show.html @@ -3,10 +3,10 @@
- + - + @@ -34,4 +34,4 @@
- \ No newline at end of file + diff --git a/Resources/Private/Templates/Event/Teaser.html b/Resources/Private/Templates/Event/Teaser.html index b0019bb..396e6d9 100644 --- a/Resources/Private/Templates/Event/Teaser.html +++ b/Resources/Private/Templates/Event/Teaser.html @@ -6,10 +6,10 @@
- \ No newline at end of file + From 8816eca99e806204c9b9fcf65695058635f3ea0b Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Mon, 6 Sep 2021 15:35:08 +0200 Subject: [PATCH 52/55] Migrate Pagination configuration POST is no longer supported, only GET. Whole pagination is deprecated and will be removed in v12. --- Resources/Private/Partials/Date/ListTable.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Resources/Private/Partials/Date/ListTable.html b/Resources/Private/Partials/Date/ListTable.html index 7dd747e..30f73e0 100644 --- a/Resources/Private/Partials/Date/ListTable.html +++ b/Resources/Private/Partials/Date/ListTable.html @@ -1,7 +1,7 @@ - +
From d0cb951550e63546845a90952423750f7bfcce23 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Mon, 6 Sep 2021 16:11:04 +0200 Subject: [PATCH 53/55] Do not break performance when no postponed date exists Some sites do not use postponed_date at all. It would be a massive performance issue to still search for them for each and every date instance that is created. This small addition will solve the issue for those pages. It will still once at least one internal reference is added. We could then try to add proxies which are build and added, but don't use the DB. That way the performance would still be okay, and data will only be fetched when used. --- Classes/Extbase/AddSpecialProperties.php | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/Classes/Extbase/AddSpecialProperties.php b/Classes/Extbase/AddSpecialProperties.php index 287495b..77243d9 100644 --- a/Classes/Extbase/AddSpecialProperties.php +++ b/Classes/Extbase/AddSpecialProperties.php @@ -38,17 +38,32 @@ class AddSpecialProperties */ private $dataMapper; + /** + * Internal info to speed things up if we know there are none. + * @var bool + */ + private $doPostponedDatesExist = true; + public function __construct( ConnectionPool $connectionPool, DataMapper $dataMapper ) { $this->connectionPool = $connectionPool; $this->dataMapper = $dataMapper; + + $qb = $this->connectionPool->getQueryBuilderForTable('tx_events_domain_model_date'); + $qb->count('uid'); + $qb->from('tx_events_domain_model_date'); + $qb->where($qb->expr()->gt('postponed_date', $qb->createNamedParameter(0))); + $this->doPostponedDatesExist = $qb->execute()->fetchColumn() > 0; } public function __invoke(AfterObjectThawedEvent $event): void { - if ($event->getObject() instanceof Date) { + if ( + $this->doPostponedDatesExist + && $event->getObject() instanceof Date + ) { /** @var Date $date */ $date = $event->getObject(); $date->_setProperty('originalDate', $this->getOriginalDate($date->_getProperty('_localizedUid'))); From 018fdc697e3ef6448c1ba5ffc6a9b6a802096593 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Mon, 6 Sep 2021 16:32:43 +0200 Subject: [PATCH 54/55] Fix RemoveAllCommand return type The command should always return an integer as exit code. The called method does not return anything, resulting in null to be returned. --- Classes/Command/RemoveAllCommand.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Classes/Command/RemoveAllCommand.php b/Classes/Command/RemoveAllCommand.php index 0f87879..c338f45 100644 --- a/Classes/Command/RemoveAllCommand.php +++ b/Classes/Command/RemoveAllCommand.php @@ -22,8 +22,10 @@ class RemoveAllCommand extends Command { Bootstrap::initializeBackendAuthentication(); - return GeneralUtility::makeInstance(ObjectManager::class) + GeneralUtility::makeInstance(ObjectManager::class) ->get(CleanupService::class) ->deleteAllData(); + + return 0; } } From 410a73052edf4c37dc35d86228b98ac3fa4163e8 Mon Sep 17 00:00:00 2001 From: Daniel Siepmann Date: Mon, 6 Sep 2021 16:33:18 +0200 Subject: [PATCH 55/55] Fix type miss match of object storages The properties should always be ObjectStorage instances. We streamline the annotation and initialization to ensure exactly that. Also import needs small adjustment as it still expected null as possible return type. --- Classes/Domain/Model/Event.php | 22 +++++++++---------- .../Service/DestinationDataImportService.php | 2 +- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/Classes/Domain/Model/Event.php b/Classes/Domain/Model/Event.php index c348e8d..b877f71 100644 --- a/Classes/Domain/Model/Event.php +++ b/Classes/Domain/Model/Event.php @@ -176,15 +176,15 @@ class Event extends AbstractEntity * @var ObjectStorage * @Extbase\ORM\Cascade remove */ - protected $images = null; + protected $images; /** * dates * - * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Wrm\Events\Domain\Model\Date> + * @var ObjectStorage * @Extbase\ORM\Cascade remove */ - protected $dates = null; + protected $dates; /** * organizer @@ -196,7 +196,7 @@ class Event extends AbstractEntity /** * region * - * @var \Wrm\Events\Domain\Model\Region + * @var Region */ protected $region = null; @@ -208,17 +208,17 @@ class Event extends AbstractEntity /** * categories * - * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage + * @var ObjectStorage */ protected $categories; /** - * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage + * @var ObjectStorage */ protected $partner; /** - * @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage + * @var ObjectStorage */ protected $referencesEvents; @@ -232,13 +232,8 @@ class Event extends AbstractEntity */ protected $dataProcessing = null; - /** - * __construct - */ public function __construct() { - - //Do not remove the next line: It would break the functionality $this->initStorageObjects(); } @@ -260,7 +255,10 @@ class Event extends AbstractEntity */ protected function initStorageObjects() { + $this->images = new ObjectStorage(); $this->dates = new ObjectStorage(); + $this->categories = new ObjectStorage(); + $this->partner = new ObjectStorage(); $this->referencesEvents = new ObjectStorage(); } diff --git a/Classes/Service/DestinationDataImportService.php b/Classes/Service/DestinationDataImportService.php index ea2d717..d0b7c85 100644 --- a/Classes/Service/DestinationDataImportService.php +++ b/Classes/Service/DestinationDataImportService.php @@ -671,7 +671,7 @@ class DestinationDataImportService } if ($error !== true) { - if ($this->tmpCurrentEvent->getImages() !== null) { + if ($this->tmpCurrentEvent->getImages()->count() > 0) { $this->logger->info('Relation found'); // TODO: How to delete file references? } else {