diff --git a/CHANGELOG.md b/CHANGELOG.md
index 3d83fea7c..e5d36e232 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,6 +1,17 @@
# In2publish Core Change Log
+12.5.7
+
+- [META] Set the EM conf version number to 12.5.7
+- [BUGFIX] respect unchanged redirect
+- [CODESTYLE] Fix Codestyle
+- [FEATURE] Add Reasons Modal to Redirects
+- [FEATURE] Add event for filtering redirects in redirects module
+- [FEATURE] Add event for editing module template
+
12.5.6:
+
+- [META] Set the EM conf version number to 12.5.6
- [TEST] Adjust PublishChangedContentTest
- [BUGFIX] Fix publishbackgroundall dependency index
- [BUGFIX] Fix DirtyProperties of Redirect
@@ -9,6 +20,8 @@
- [BUGFIX] Implement suggested bugfix for duplicate key exception
12.5.5:
+
+- [META] Set the EM conf version number to 12.5.5
- [BUGFIX] Correct Response of Compare Tool
- [BUGFIX] Make ResolverService public
- [BUGFIX] Fix cache clear task
@@ -16,11 +29,14 @@
- [TASK] Make search in file module case-insensitive
12.5.4:
+
+- [META] Set the EM conf version number to 12.5.4
- [BUGFIX] Enable Logging in Command on foreign
- [BUGFIX] LogLevel is evaluated correctly
12.5.3:
+- [META] Set the EM conf version number to 12.5.3
- [CODESTYLE] Make qa happy
- [BUGFIX] Add make target for installing qa tools
- [FEATURE] Adds Support for MM-Records to excluded Tables
@@ -43,6 +59,7 @@
12.5.2:
+- [META] Set the EM conf version number to 12.5.2
- [DOCS] Add known issue to explain missing (orphaned) MM records in the record tree
- [BUGFIX] Discard the table portion of a joined row if the joined record does not exist
- [META] Exclude compile-sass from archive
@@ -50,6 +67,7 @@
12.5.1:
+- [META] Set the EM conf version number to 12.5.1
- [BUGFIX] Correct evaluation of publishing state
- [BUGFIX] Fixes Databender for Redirects
diff --git a/Classes/Component/Core/Repository/SingleDatabaseRepository.php b/Classes/Component/Core/Repository/SingleDatabaseRepository.php
index 6f2d499fb..7e8226692 100644
--- a/Classes/Component/Core/Repository/SingleDatabaseRepository.php
+++ b/Classes/Component/Core/Repository/SingleDatabaseRepository.php
@@ -148,12 +148,10 @@ public function findByPropertyWithJoin(
$splitRow['mmtbl']['uid_local'],
$splitRow['mmtbl']['uid_foreign'],
];
- if(isset($splitRow['mmtbl']['tablenames']))
- {
+ if (isset($splitRow['mmtbl']['tablenames'])) {
$mmIdentityProperties[] = $splitRow['mmtbl']['tablenames'];
}
- if(isset($splitRow['mmtbl']['fieldname']))
- {
+ if (isset($splitRow['mmtbl']['fieldname'])) {
$mmIdentityProperties[] = $splitRow['mmtbl']['fieldname'];
}
$splitRows[hash('sha1', json_encode($mmIdentityProperties, JSON_THROW_ON_ERROR))] = $splitRow;
diff --git a/Classes/Controller/Traits/ControllerModuleTemplate.php b/Classes/Controller/Traits/ControllerModuleTemplate.php
index 8e974e663..1479f2d54 100644
--- a/Classes/Controller/Traits/ControllerModuleTemplate.php
+++ b/Classes/Controller/Traits/ControllerModuleTemplate.php
@@ -31,6 +31,8 @@
use In2code\In2publishCore\Backend\Button\ModuleShortcutButton;
use In2code\In2publishCore\CommonInjection\ModuleTemplateFactoryInjection;
+use In2code\In2publishCore\Event\ModuleTemplateWasPreparedForRendering;
+use Psr\EventDispatcher\EventDispatcherInterface;
use Psr\Http\Message\ResponseInterface;
use Psr\Http\Message\ServerRequestInterface;
use TYPO3\CMS\Backend\Template\ModuleTemplate;
@@ -43,6 +45,8 @@
/**
* @property Request $request
+ * @property EventDispatcherInterface $eventDispatcher
+ * @property string $actionMethodName
*/
trait ControllerModuleTemplate
{
@@ -84,6 +88,14 @@ protected function render(): string
$buttonBar->addButton($moduleShortcutButton);
$this->moduleTemplate->setContent($this->view->render());
+
+ $event = new ModuleTemplateWasPreparedForRendering(
+ $this->moduleTemplate,
+ static::class,
+ $this->actionMethodName
+ );
+ $this->eventDispatcher->dispatch($event);
+
return $this->moduleTemplate->renderContent();
}
}
diff --git a/Classes/Event/ModuleTemplateWasPreparedForRendering.php b/Classes/Event/ModuleTemplateWasPreparedForRendering.php
new file mode 100644
index 000000000..29ee1bf86
--- /dev/null
+++ b/Classes/Event/ModuleTemplateWasPreparedForRendering.php
@@ -0,0 +1,64 @@
+
+ *
+ * All rights reserved
+ *
+ * This script is part of the TYPO3 project. The TYPO3 project 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The GNU General Public License can be found at
+ * http://www.gnu.org/copyleft/gpl.html.
+ *
+ * This script 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.
+ *
+ * This copyright notice MUST APPEAR in all copies of the script!
+ */
+
+namespace In2code\In2publishCore\Event;
+
+use TYPO3\CMS\Backend\Template\ModuleTemplate;
+
+final class ModuleTemplateWasPreparedForRendering
+{
+ private ModuleTemplate $moduleTemplate;
+ private string $controllerClass;
+ private string $actionMethodName;
+
+ public function __construct(
+ ModuleTemplate $moduleTemplate,
+ string $controllerClass,
+ string $actionMethodName
+ ) {
+ $this->moduleTemplate = $moduleTemplate;
+ $this->controllerClass = $controllerClass;
+ $this->actionMethodName = $actionMethodName;
+ }
+
+ public function getModuleTemplate(): ModuleTemplate
+ {
+ return $this->moduleTemplate;
+ }
+
+ public function getControllerClass(): string
+ {
+ return $this->controllerClass;
+ }
+
+ public function getActionMethodName(): string
+ {
+ return $this->actionMethodName;
+ }
+}
diff --git a/Classes/Features/RedirectsSupport/Controller/RedirectController.php b/Classes/Features/RedirectsSupport/Controller/RedirectController.php
index e4a0d1648..10a185546 100644
--- a/Classes/Features/RedirectsSupport/Controller/RedirectController.php
+++ b/Classes/Features/RedirectsSupport/Controller/RedirectController.php
@@ -46,6 +46,7 @@
use In2code\In2publishCore\Features\RedirectsSupport\Domain\Dto\Filter;
use In2code\In2publishCore\Features\RedirectsSupport\Domain\Model\SysRedirectDatabaseRecord;
use In2code\In2publishCore\Features\RedirectsSupport\Domain\Repository\SysRedirectRepository;
+use In2code\In2publishCore\Features\RedirectsSupport\Event\RedirectsWereFilteredForListing;
use In2code\In2publishCore\Service\ForeignSiteFinderInjection;
use Psr\Http\Message\ResponseInterface;
use Throwable;
@@ -154,7 +155,11 @@ public function listAction(Filter $filter = null, int $page = 1): ResponseInterf
$this->demandResolver->resolveDemand($demands, $recordCollection);
$redirects = $this->getRedirectsByStateFromFilter($recordTree, $filter);
- $paginator = new ArrayPaginator($redirects, $page, 15);
+
+ $event = new RedirectsWereFilteredForListing($redirects);
+ $this->eventDispatcher->dispatch($event);
+
+ $paginator = new ArrayPaginator($event->getRedirects(), $page, 15);
$pagination = new SimplePagination($paginator);
$this->view->assignMultiple(
[
diff --git a/Classes/Features/RedirectsSupport/Event/RedirectsWereFilteredForListing.php b/Classes/Features/RedirectsSupport/Event/RedirectsWereFilteredForListing.php
new file mode 100644
index 000000000..3116f7d52
--- /dev/null
+++ b/Classes/Features/RedirectsSupport/Event/RedirectsWereFilteredForListing.php
@@ -0,0 +1,50 @@
+
+ *
+ * All rights reserved
+ *
+ * This script is part of the TYPO3 project. The TYPO3 project 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The GNU General Public License can be found at
+ * http://www.gnu.org/copyleft/gpl.html.
+ *
+ * This script 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.
+ *
+ * This copyright notice MUST APPEAR in all copies of the script!
+ */
+
+namespace In2code\In2publishCore\Features\RedirectsSupport\Event;
+
+final class RedirectsWereFilteredForListing
+{
+ private array $redirects;
+
+ public function __construct(array $redirects)
+ {
+ $this->redirects = $redirects;
+ }
+
+ public function getRedirects(): array
+ {
+ return $this->redirects;
+ }
+
+ public function setRedirects(array $redirects): void
+ {
+ $this->redirects = $redirects;
+ }
+}
diff --git a/Classes/Features/RedirectsSupport/ViewHelpers/ShowReasonsButtonViewHelper.php b/Classes/Features/RedirectsSupport/ViewHelpers/ShowReasonsButtonViewHelper.php
new file mode 100644
index 000000000..ff49712c8
--- /dev/null
+++ b/Classes/Features/RedirectsSupport/ViewHelpers/ShowReasonsButtonViewHelper.php
@@ -0,0 +1,74 @@
+
+ *
+ * All rights reserved
+ *
+ * This script is part of the TYPO3 project. The TYPO3 project 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 3 of the License, or
+ * (at your option) any later version.
+ *
+ * The GNU General Public License can be found at
+ * http://www.gnu.org/copyleft/gpl.html.
+ *
+ * This script 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.
+ *
+ * This copyright notice MUST APPEAR in all copies of the script!
+ */
+
+use In2code\In2publishCore\Features\RedirectsSupport\Domain\Model\SysRedirectDatabaseRecord;
+use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
+use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper;
+
+class ShowReasonsButtonViewHelper extends AbstractTagBasedViewHelper
+{
+ protected $tagName = 'a';
+
+ public function initializeArguments(): void
+ {
+ parent::initializeArguments();
+ $this->registerUniversalTagAttributes();
+ $this->registerArgument('redirectRecord', SysRedirectDatabaseRecord::class, '', true);
+ }
+
+ public function render(): string
+ {
+ /**
+ * @var $redirectRecord SysRedirectDatabaseRecord
+ */
+ $redirectRecord = $this->arguments['redirectRecord'];
+ $this->tag->addAttribute('href', '#');
+ $this->tag->setContent($this->renderChildren());
+ $modalConfiguration = [
+ 'settings' => [
+ 'title' => LocalizationUtility::translate('LLL:EXT:in2publish_core/Resources/Private/Language/locallang_mod5.xlf:modal.reasons.title'),
+ 'content' => implode("\r\n", $redirectRecord->getReasonsWhyTheRecordIsNotPublishableHumanReadable()),
+ 'severity' => 1,
+ ],
+ 'buttons' => [
+ 'abort' => [
+ 'text' => 'Abort',
+ 'btnClass' => 'btn btn-default',
+ 'name' => 'abort',
+ 'active' => true,
+ ],
+ ],
+ ];
+ $this->tag->addAttribute('data-modal-configuration', json_encode($modalConfiguration));
+
+ return $this->tag->render();
+ }
+}
diff --git a/Documentation/Developers/Events/ModuleTemplateWasPreparedForRendering.md b/Documentation/Developers/Events/ModuleTemplateWasPreparedForRendering.md
new file mode 100644
index 000000000..8e31abe03
--- /dev/null
+++ b/Documentation/Developers/Events/ModuleTemplateWasPreparedForRendering.md
@@ -0,0 +1,38 @@
+# ModuleTemplateWasPreparedForRendering
+
+## When
+
+This event is fired each time a backend module is opened.
+
+## What
+
+* `moduleTemplate`: an object of type TYPO3\CMS\Backend\Template\ModuleTemplate
+* `controllerClass`: controller class calling the event
+* `actionMethodName`: action method name calling the event
+
+## Possibilities
+
+With this event you can add e.g. buttons to the docheader of a backend module.
+
+### Example
+
+This example shows you how to add a button to the docheader of the redirect module.
+
+```php
+use In2code\In2publish\Features\ContentLanguageControl\Toolbar\LanguageSelectionButtonInjection;
+use In2code\In2publishCore\Event\ModuleTemplateWasPreparedForRendering;
+use In2code\In2publishCore\Features\RedirectsSupport\Controller\RedirectController;
+
+class ModuleTemplateButtonBarSelectionRenderer
+{
+ use LanguageSelectionButtonInjection;
+
+ public function whenModuleTemplateWasPreparedForRendering(ModuleTemplateWasPreparedForRendering $event): void
+ {
+ if (RedirectController::class === $event->getControllerClass() && 'listAction' === $event->getActionMethodName()){
+ $moduleTemplate = $event->getModuleTemplate();
+ $moduleTemplate->getDocHeaderComponent()->getButtonBar()->addButton($this->languageSelectionButton);
+ }
+ }
+}
+```
diff --git a/Documentation/Developers/Events/RedirectsWereFilteredForListing.md b/Documentation/Developers/Events/RedirectsWereFilteredForListing.md
new file mode 100644
index 000000000..c986e8533
--- /dev/null
+++ b/Documentation/Developers/Events/RedirectsWereFilteredForListing.md
@@ -0,0 +1,44 @@
+# RedirectsWereFilteredForListing
+
+## When
+
+The event is fired after the redirects are filtered for display in the listAction of the RedirectController.
+
+## What
+
+* `redirects`: an array of SysRedirectDatabaseRecord
+
+## Possibilities
+
+With this event you can filter the records in more detail on your own.
+
+### Example
+
+This example show how to filter the redirects with the Language Uid of the Parent Page.
+
+```php
+class FilterRedirectsBySelectedLanguages
+{
+ use UserSelectionServiceInjection;
+ use RawRecordServiceInjection;
+
+ public function __invoke(RedirectsWereFilteredForListing $event): void
+ {
+ $redirects = $event->getRedirects();
+ $selectedLanguages = [-1,0,4];
+
+ $redirects = array_filter($redirects, function (SysRedirectDatabaseRecord $redirect) use ($selectedLanguages) {
+ $pid = (int)$redirect->getLocalProps()['pid'];
+ if (0 === $pid) {
+ return true;
+ }
+ $record = $this->rawRecordService->getRawRecord('pages', $pid, 'local');
+ if (in_array($record['sys_language_uid'], $selectedLanguages)){
+ return true;
+ }
+ });
+
+ $event->setRedirects($redirects);
+ }
+}
+```
diff --git a/Resources/Private/Language/de.locallang_mod5.xlf b/Resources/Private/Language/de.locallang_mod5.xlf
index 2afeaf36d..40889ccca 100755
--- a/Resources/Private/Language/de.locallang_mod5.xlf
+++ b/Resources/Private/Language/de.locallang_mod5.xlf
@@ -15,6 +15,10 @@
TYPO3 Content Publisher - Redirects
+
+
+ Redirect kann nicht publiziert werden.
+