Skip to content

Commit

Permalink
[RELEASE] Version 12.5.7 Bugfixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tinzog committed Nov 27, 2024
2 parents 9a286fd + 8ca8c69 commit 0b82d2b
Show file tree
Hide file tree
Showing 13 changed files with 352 additions and 30 deletions.
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -9,18 +20,23 @@
- [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
- [BUGFIX] Fix filters in file module
- [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
Expand All @@ -43,13 +59,15 @@

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
- [BUGFIX] Cast pageuid to integer to build the preview URL

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
12 changes: 12 additions & 0 deletions Classes/Controller/Traits/ControllerModuleTemplate.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -43,6 +45,8 @@

/**
* @property Request $request
* @property EventDispatcherInterface $eventDispatcher
* @property string $actionMethodName
*/
trait ControllerModuleTemplate
{
Expand Down Expand Up @@ -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();
}
}
64 changes: 64 additions & 0 deletions Classes/Event/ModuleTemplateWasPreparedForRendering.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
<?php

declare(strict_types=1);

/*
* Copyright notice
*
* (c) 2024 in2code.de and the following authors:
* Daniel Hoffmann <[email protected]>
*
* 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;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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(
[
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<?php

declare(strict_types=1);

/*
* Copyright notice
*
* (c) 2024 in2code.de and the following authors:
* Daniel Hoffmann <[email protected]>
*
* 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;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
<?php

declare(strict_types=1);

namespace In2code\In2publishCore\Features\RedirectsSupport\ViewHelpers;

/*
* Copyright notice
*
* (c) 2024 in2code.de
* Daniel Hoffmann <[email protected]>
*
* 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();
}
}
Original file line number Diff line number Diff line change
@@ -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);
}
}
}
```
Loading

0 comments on commit 0b82d2b

Please sign in to comment.