diff --git a/typo3/sysext/belog/Classes/Controller/AbstractController.php b/typo3/sysext/belog/Classes/Controller/BackendLogController.php similarity index 65% rename from typo3/sysext/belog/Classes/Controller/AbstractController.php rename to typo3/sysext/belog/Classes/Controller/BackendLogController.php index 48b01d8b7ef3..91280205bf99 100644 --- a/typo3/sysext/belog/Classes/Controller/AbstractController.php +++ b/typo3/sysext/belog/Classes/Controller/BackendLogController.php @@ -15,64 +15,52 @@ */ use TYPO3\CMS\Backend\View\BackendTemplateView; -use TYPO3\CMS\Core\Utility\ExtensionManagementUtility; +use TYPO3\CMS\Belog\Domain\Model\Constraint; +use TYPO3\CMS\Belog\Domain\Model\LogEntry; +use TYPO3\CMS\Core\Messaging\AbstractMessage; use TYPO3\CMS\Extbase\Mvc\Controller\ActionController; -use TYPO3\CMS\Extbase\Mvc\View\ViewInterface; -use TYPO3\CMS\Extbase\Property\TypeConverter\PersistentObjectConverter; +use TYPO3\CMS\Extbase\Persistence\QueryResultInterface; +use TYPO3\CMS\Extbase\Utility\LocalizationUtility; /** * Abstract class to show log entries from sys_log */ -abstract class AbstractController extends ActionController +class BackendLogController extends ActionController { /** * @var int */ - const TIMEFRAME_THISWEEK = 0; + private const TIMEFRAME_THISWEEK = 0; /** * @var int */ - const TIMEFRAME_LASTWEEK = 1; + private const TIMEFRAME_LASTWEEK = 1; /** * @var int */ - const TIMEFRAME_LASTSEVENDAYS = 2; + private const TIMEFRAME_LASTSEVENDAYS = 2; /** * @var int */ - const TIMEFRAME_THISMONTH = 10; + private const TIMEFRAME_THISMONTH = 10; /** * @var int */ - const TIMEFRAME_LASTMONTH = 11; + private const TIMEFRAME_LASTMONTH = 11; /** * @var int */ - const TIMEFRAME_LAST31DAYS = 12; + private const TIMEFRAME_LAST31DAYS = 12; /** * @var int */ - const TIMEFRAME_CUSTOM = 30; - - /** - * Whether plugin is running in page context (sub module of Web > Info) - * - * @var bool - */ - protected $isInPageContext = false; - - /** - * Page ID in page context - * - * @var int - */ - protected $pageId = 0; + private const TIMEFRAME_CUSTOM = 30; /** * @var \TYPO3\CMS\Belog\Domain\Repository\LogEntryRepository @@ -93,46 +81,10 @@ public function injectLogEntryRepository(\TYPO3\CMS\Belog\Domain\Repository\LogE } /** - * Initialize the view - * - * @param ViewInterface $view The view - */ - protected function initializeView(ViewInterface $view) - { - if ($view instanceof BackendTemplateView) { - parent::initializeView($view); - $view->getModuleTemplate()->getPageRenderer()->loadRequireJsModule('TYPO3/CMS/Backend/DateTimePicker'); - } - } - - /** - * init all actions - */ - public function initializeAction() - { - if ($this->isInPageContext === false) { - $this->defaultViewObjectName = BackendTemplateView::class; - } - } - - /** - * Initialize index action - * - * @throws \RuntimeException + * Initialize list action */ - public function initializeIndexAction() + public function initializeListAction() { - // @TODO: Extbase backend modules rely on frontend TypoScript for view, persistence - // and settings. Thus, we need a TypoScript root template, that then loads the - // ext_typoscript_setup.typoscript file of this module. This is nasty, but can not be - // circumvented until there is a better solution in extbase. - // For now we throw an exception if no settings are detected. - if (empty($this->settings)) { - throw new \RuntimeException( - 'No settings detected. This usually happens if there is no frontend TypoScript template with root flag set. Please create one.', - 1333650506 - ); - } if (!isset($this->settings['dateFormat'])) { $this->settings['dateFormat'] = $GLOBALS['TYPO3_CONF_VARS']['SYS']['USdateFormat'] ? 'm-d-Y' : 'd-m-Y'; } @@ -140,56 +92,81 @@ public function initializeIndexAction() $this->settings['timeFormat'] = $GLOBALS['TYPO3_CONF_VARS']['SYS']['hhmm']; } $constraintConfiguration = $this->arguments->getArgument('constraint')->getPropertyMappingConfiguration(); - $constraintConfiguration->allowProperties('action')->setTypeConverterOption(PersistentObjectConverter::class, PersistentObjectConverter::CONFIGURATION_CREATION_ALLOWED, true); + $constraintConfiguration->allowAllProperties(); } /** * Show general information and the installed modules * - * @param \TYPO3\CMS\Belog\Domain\Model\Constraint $constraint + * @param Constraint $constraint + * @param int $pageId + * @param string $layout */ - public function indexAction(\TYPO3\CMS\Belog\Domain\Model\Constraint $constraint = null) + public function listAction(Constraint $constraint = null, int $pageId = null, string $layout = 'Default') { // Constraint object handling: // If there is none from GET, try to get it from BE user data, else create new if ($constraint === null) { $constraint = $this->getConstraintFromBeUserData(); - if ($constraint === null) { - $constraint = $this->objectManager->get(\TYPO3\CMS\Belog\Domain\Model\Constraint::class); - } } else { $this->persistConstraintInBeUserData($constraint); } - $constraint->setIsInPageContext($this->isInPageContext); - $constraint->setPageId($this->pageId); + $constraint->setPageId($pageId); $this->setStartAndEndTimeFromTimeSelector($constraint); $this->forceWorkspaceSelectionIfInWorkspace($constraint); $logEntries = $this->logEntryRepository->findByConstraint($constraint); $groupedLogEntries = $this->groupLogEntriesByPageAndDay($logEntries, $constraint->getGroupByPage()); - $this->view->assign('workspacesExtensionLoaded', ExtensionManagementUtility::isLoaded('workspaces')); - $this->view->assign('groupedLogEntries', $groupedLogEntries)->assign('constraint', $constraint)->assign('userGroups', $this->createUserAndGroupListForSelectOptions())->assign('workspaces', $this->createWorkspaceListForSelectOptions())->assign('pageDepths', $this->createPageDepthOptions()); + $this->view->assignMultiple([ + 'pageId' => $pageId, + 'layout' => $layout, + 'groupedLogEntries' => $groupedLogEntries, + 'constraint' => $constraint, + 'userGroups' => $this->createUserAndGroupListForSelectOptions(), + 'workspaces' => $this->createWorkspaceListForSelectOptions(), + 'pageDepths' => $this->createPageDepthOptions(), + ]); + } + + /** + * Delete all log entries that share the same message with the log entry given + * in $errorUid + * + * @param int $errorUid + */ + public function deleteMessageAction(int $errorUid) + { + /** @var \TYPO3\CMS\Belog\Domain\Model\LogEntry $logEntry */ + $logEntry = $this->logEntryRepository->findByUid($errorUid); + if (!$logEntry) { + $this->addFlashMessage(LocalizationUtility::translate('actions.delete.noRowFound', 'belog'), '', AbstractMessage::WARNING); + $this->redirect('list'); + } + $numberOfDeletedRows = $this->logEntryRepository->deleteByMessageDetails($logEntry); + $this->addFlashMessage(sprintf(LocalizationUtility::translate('actions.delete.message', 'belog'), $numberOfDeletedRows)); + $this->redirect('list'); } /** * Get module states (the constraint object) from user data * - * @return \TYPO3\CMS\Belog\Domain\Model\Constraint|null + * @return Constraint */ protected function getConstraintFromBeUserData() { $serializedConstraint = $GLOBALS['BE_USER']->getModuleData(static::class); - if (!is_string($serializedConstraint) || empty($serializedConstraint)) { - return null; + $constraint = null; + if (is_string($serializedConstraint) && !empty($serializedConstraint)) { + $constraint = @unserialize($serializedConstraint, ['allowed_classes' => [Constraint::class, \DateTime::class]]); } - return @unserialize($serializedConstraint); + return $constraint ?: $this->objectManager->get(Constraint::class); } /** * Save current constraint object in be user settings (uC) * - * @param \TYPO3\CMS\Belog\Domain\Model\Constraint $constraint + * @param Constraint $constraint */ - protected function persistConstraintInBeUserData(\TYPO3\CMS\Belog\Domain\Model\Constraint $constraint) + protected function persistConstraintInBeUserData(Constraint $constraint) { $GLOBALS['BE_USER']->pushModuleData(static::class, serialize($constraint)); } @@ -199,19 +176,19 @@ protected function persistConstraintInBeUserData(\TYPO3\CMS\Belog\Domain\Model\C * the query result of the sys log repository. * * If group by page is FALSE, pid is always -1 (will render a flat list), - * otherwise the output is splitted by pages. + * otherwise the output is split by pages. * '12345' is a sub array to split entries by day, number is first second of day * * [pid][dayTimestamp][items] * - * @param \TYPO3\CMS\Extbase\Persistence\QueryResultInterface<\TYPO3\CMS\Belog\Domain\Model\LogEntry> $logEntries + * @param QueryResultInterface $logEntries * @param bool $groupByPage Whether or not log entries should be grouped by page * @return array */ - protected function groupLogEntriesByPageAndDay(\TYPO3\CMS\Extbase\Persistence\QueryResultInterface $logEntries, $groupByPage = false) + protected function groupLogEntriesByPageAndDay(QueryResultInterface $logEntries, $groupByPage = false) { $targetStructure = []; - /** @var $entry \TYPO3\CMS\Belog\Domain\Model\LogEntry */ + /** @var $entry LogEntry */ foreach ($logEntries as $entry) { // Create page split list or flat list if ($groupByPage) { @@ -288,9 +265,9 @@ protected function createWorkspaceListForSelectOptions() * we force to show only log entries from the selected workspace, * and the workspace selector is not shown. * - * @param \TYPO3\CMS\Belog\Domain\Model\Constraint $constraint + * @param Constraint $constraint */ - protected function forceWorkspaceSelectionIfInWorkspace(\TYPO3\CMS\Belog\Domain\Model\Constraint $constraint) + protected function forceWorkspaceSelectionIfInWorkspace(Constraint $constraint) { if ($GLOBALS['BE_USER']->workspace !== 0) { $constraint->setWorkspaceUid($GLOBALS['BE_USER']->workspace); @@ -322,9 +299,9 @@ protected function createPageDepthOptions() /** * Calculate the start- and end timestamp from the different time selector options * - * @param \TYPO3\CMS\Belog\Domain\Model\Constraint $constraint + * @param Constraint $constraint */ - protected function setStartAndEndTimeFromTimeSelector(\TYPO3\CMS\Belog\Domain\Model\Constraint $constraint) + protected function setStartAndEndTimeFromTimeSelector(Constraint $constraint) { $startTime = 0; $endTime = $GLOBALS['EXEC_TIME']; @@ -359,33 +336,12 @@ protected function setStartAndEndTimeFromTimeSelector(\TYPO3\CMS\Belog\Domain\Mo $startTime = mktime(0, 0, 0) - 31 * 3600 * 24; break; case self::TIMEFRAME_CUSTOM: - $startDate = $constraint->getManualDateStart(); - $endDate = $constraint->getManualDateStop(); - $endTime = $GLOBALS['EXEC_TIME']; - if (!$startDate) { - $startDate = \DateTime::createFromFormat( - 'U', - 0 - ); - $constraint->setManualDateStart( - $startDate - ); + $startTime = $constraint->getStartTimestamp(); + if ($constraint->getEndTimestamp() > $constraint->getStartTimestamp()) { + $endTime = $constraint->getEndTimestamp(); + } else { + $endTime = $GLOBALS['EXEC_TIME']; } - - if (!$endDate) { - $endDate = \DateTime::createFromFormat( - 'U', - $endTime - )->setTimezone(new \DateTimeZone(date_default_timezone_get())); - $constraint->setManualDateStop( - $endDate - ); - } - $startTime = $startDate->getTimestamp(); - if ($endDate->getTimestamp() > $startDate->getTimestamp()) { - $endTime = $endDate->getTimestamp(); - } - break; default: } diff --git a/typo3/sysext/belog/Classes/Controller/ToolsController.php b/typo3/sysext/belog/Classes/Controller/ToolsController.php deleted file mode 100644 index c474c3ace26d..000000000000 --- a/typo3/sysext/belog/Classes/Controller/ToolsController.php +++ /dev/null @@ -1,42 +0,0 @@ -logEntryRepository->findByUid($errorUid); - if (!$logEntry) { - $this->addFlashMessage(LocalizationUtility::translate('actions.delete.noRowFound', 'belog'), '', AbstractMessage::WARNING); - $this->redirect('index'); - } - $numberOfDeletedRows = $this->logEntryRepository->deleteByMessageDetails($logEntry); - $this->addFlashMessage(sprintf(LocalizationUtility::translate('actions.delete.message', 'belog'), $numberOfDeletedRows)); - $this->redirect('index'); - } -} diff --git a/typo3/sysext/belog/Classes/Controller/WebInfoController.php b/typo3/sysext/belog/Classes/Controller/WebInfoController.php deleted file mode 100644 index c0085d0560fd..000000000000 --- a/typo3/sysext/belog/Classes/Controller/WebInfoController.php +++ /dev/null @@ -1,31 +0,0 @@ -Info module - */ -class WebInfoController extends \TYPO3\CMS\Belog\Controller\AbstractController -{ - /** - * Set context to 'in page mode' - */ - public function initializeAction() - { - $this->isInPageContext = true; - $this->pageId = (int)\TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id'); - parent::initializeAction(); - } -} diff --git a/typo3/sysext/belog/Classes/Domain/Model/Constraint.php b/typo3/sysext/belog/Classes/Domain/Model/Constraint.php index 5585baf717f8..6feb38b2124a 100644 --- a/typo3/sysext/belog/Classes/Domain/Model/Constraint.php +++ b/typo3/sysext/belog/Classes/Domain/Model/Constraint.php @@ -17,7 +17,7 @@ /** * Constraints for log entries */ -class Constraint extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity +class Constraint { /** * Selected user/group; possible values are "gr-" for a group, "us-" for a user or -1 for "all users" @@ -87,13 +87,6 @@ class Constraint extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity */ protected $manualDateStop; - /** - * Whether the plugin is called in page context (submodule of Web > Info) - * - * @var bool - */ - protected $isInPageContext = false; - /** * Selected page ID in page context * @@ -108,24 +101,6 @@ class Constraint extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity */ protected $depth = 0; - /** - * Default constructor - */ - public function __construct() - { - } - - /** - * added to prevent the deprecation message - * in Extbase\DomainObject\AbstractDomainObject - * - * @todo the constraints model needs another way of storing - * persisted search data than serialisation - */ - public function __wakeup() - { - } - /** * Set user * @@ -286,26 +261,6 @@ public function getEndTimestamp() return $this->endTimestamp; } - /** - * Set page context - * - * @param bool $pageContext - */ - public function setIsInPageContext($pageContext) - { - $this->isInPageContext = $pageContext; - } - - /** - * Get page context - * - * @return bool - */ - public function getIsInPageContext() - { - return (bool)$this->isInPageContext; - } - /** * Set page id * diff --git a/typo3/sysext/belog/Classes/Domain/Repository/LogEntryRepository.php b/typo3/sysext/belog/Classes/Domain/Repository/LogEntryRepository.php index c9874bf46d54..a31e22d7a976 100644 --- a/typo3/sysext/belog/Classes/Domain/Repository/LogEntryRepository.php +++ b/typo3/sysext/belog/Classes/Domain/Repository/LogEntryRepository.php @@ -101,9 +101,6 @@ protected function createQueryConstraints(\TYPO3\CMS\Extbase\Persistence\QueryIn */ protected function addPageTreeConstraintsToQuery(\TYPO3\CMS\Belog\Domain\Model\Constraint $constraint, \TYPO3\CMS\Extbase\Persistence\QueryInterface $query, array &$queryConstraints) { - if (!$constraint->getIsInPageContext()) { - return; - } $pageIds = []; // Check if we should get a whole tree of pages and not only a single page if ($constraint->getDepth() > 0) { @@ -115,8 +112,12 @@ protected function addPageTreeConstraintsToQuery(\TYPO3\CMS\Belog\Domain\Model\C $pageTree->getTree($constraint->getPageId(), $constraint->getDepth()); $pageIds = $pageTree->ids; } - $pageIds[] = $constraint->getPageId(); - $queryConstraints[] = $query->in('eventPid', $pageIds); + if (!empty($constraint->getPageId())) { + $pageIds[] = $constraint->getPageId(); + } + if (!empty($pageIds)) { + $queryConstraints[] = $query->in('eventPid', $pageIds); + } } /** diff --git a/typo3/sysext/belog/Classes/Module/BackendLogModuleBootstrap.php b/typo3/sysext/belog/Classes/Module/BackendLogModuleBootstrap.php index 13f366b8a02f..b67dee6aeb30 100644 --- a/typo3/sysext/belog/Classes/Module/BackendLogModuleBootstrap.php +++ b/typo3/sysext/belog/Classes/Module/BackendLogModuleBootstrap.php @@ -54,7 +54,9 @@ public function main() // in extbase to force a specific controller in backend mode. // Overwriting $_GET was the most simple solution here until extbase // provides a clean way to solve this. - $_GET['tx_belog_system_beloglog']['controller'] = 'WebInfo'; + $_GET['tx_belog_system_beloglog']['controller'] = 'BackendLog'; + $_GET['tx_belog_system_beloglog']['pageId'] = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('id'); + $_GET['tx_belog_system_beloglog']['layout'] = 'Plain'; /** @var $extbaseBootstrap \TYPO3\CMS\Extbase\Core\Bootstrap */ $extbaseBootstrap = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Extbase\Core\Bootstrap::class); return $extbaseBootstrap->run('', $configuration); diff --git a/typo3/sysext/belog/Resources/Private/Layouts/Default.html b/typo3/sysext/belog/Resources/Private/Layouts/Default.html new file mode 100644 index 000000000000..0712c33ab13c --- /dev/null +++ b/typo3/sysext/belog/Resources/Private/Layouts/Default.html @@ -0,0 +1,9 @@ + + + + + + + diff --git a/typo3/sysext/belog/Resources/Private/Layouts/Plain.html b/typo3/sysext/belog/Resources/Private/Layouts/Plain.html new file mode 100644 index 000000000000..290c79c67ca7 --- /dev/null +++ b/typo3/sysext/belog/Resources/Private/Layouts/Plain.html @@ -0,0 +1,8 @@ + + + + + + diff --git a/typo3/sysext/belog/Resources/Private/Partials/Content.html b/typo3/sysext/belog/Resources/Private/Partials/Content.html deleted file mode 100644 index d05d1c01b31a..000000000000 --- a/typo3/sysext/belog/Resources/Private/Partials/Content.html +++ /dev/null @@ -1,17 +0,0 @@ -

- -

- -
- -
- -
- - \ No newline at end of file diff --git a/typo3/sysext/belog/Resources/Private/Partials/Content/Filter.html b/typo3/sysext/belog/Resources/Private/Partials/Content/Filter.html index d5125216e1f2..b5a89cbd9f13 100644 --- a/typo3/sysext/belog/Resources/Private/Partials/Content/Filter.html +++ b/typo3/sysext/belog/Resources/Private/Partials/Content/Filter.html @@ -1,4 +1,7 @@ -{namespace belog=TYPO3\CMS\Belog\ViewHelpers} + This is an ugly workaround. @@ -7,11 +10,11 @@ that is not extbase based to figure the permissions. Thus, we have to add the page Id manually to hint the info module about that. - + - +
- +
+
@@ -153,3 +157,5 @@
+ + diff --git a/typo3/sysext/belog/Resources/Private/Partials/Content/LogEntries.html b/typo3/sysext/belog/Resources/Private/Partials/Content/LogEntries.html index d9b051fa0978..564604fd050f 100644 --- a/typo3/sysext/belog/Resources/Private/Partials/Content/LogEntries.html +++ b/typo3/sysext/belog/Resources/Private/Partials/Content/LogEntries.html @@ -1,5 +1,9 @@ -{namespace be=TYPO3\CMS\Backend\ViewHelpers} -{namespace belog=TYPO3\CMS\Belog\ViewHelpers} +
@@ -9,8 +13,8 @@

@@ -42,8 +46,8 @@

key="logForNonPageRelatedActionsOrRootLevelOrPage" arguments="{ 0: '{f:translate(key:\'forNonPageRelatedActions\')}', - 1: '{f:format.date(format:\'{settings.dateFormat} {settings.timeFormat}\', date:\'{constraint.manualDateStart}\')}', - 2: '{f:format.date(format:\'{settings.dateFormat} {settings.timeFormat}\', date:\'{constraint.manualDateStop}\')}' + 1: '{f:format.date(format:\'{settings.dateFormat} {settings.timeFormat}\', date:\'@{constraint.startTimestamp}\')}', + 2: '{f:format.date(format:\'{settings.dateFormat} {settings.timeFormat}\', date:\'@{constraint.endTimestamp}\')}' }" /> @@ -52,8 +56,8 @@

key="logForNonPageRelatedActionsOrRootLevelOrPage" arguments="{ 0: '{f:translate(key:\'forRootLevel\')}', - 1: '{f:format.date(format:\'{settings.dateFormat} {settings.timeFormat}\', date:\'{constraint.manualDateStart}\')}', - 2: '{f:format.date(format:\'{settings.dateFormat} {settings.timeFormat}\', date:\'{constraint.manualDateStop}\')}' + 1: '{f:format.date(format:\'{settings.dateFormat} {settings.timeFormat}\', date:\'@{constraint.startTimestamp}\')}', + 2: '{f:format.date(format:\'{settings.dateFormat} {settings.timeFormat}\', date:\'@{constraint.endTimestamp}\')}' }" /> @@ -65,10 +69,9 @@

2. Use this as argument for 'forPage' translate 3. Use this as argument for 'logForNonPageRelatedActionsOrRootLevelOrPage' translate - - - + /> @@ -89,8 +91,8 @@

key="logForNonPageRelatedActionsOrRootLevelOrPage" arguments="{ 0: '', - 1: '{f:format.date(format:\'{settings.dateFormat} {settings.timeFormat}\', date:\'{constraint.manualDateStart}\')}', - 2: '{f:format.date(format:\'{settings.dateFormat} {settings.timeFormat}\', date:\'{constraint.manualDateStop}\')}' + 1: '{f:format.date(format:\'{settings.dateFormat} {settings.timeFormat}\', date:\'@{constraint.startTimestamp}\')}', + 2: '{f:format.date(format:\'{settings.dateFormat} {settings.timeFormat}\', date:\'@{constraint.endTimestamp}\')}' }" /> @@ -115,7 +117,7 @@

- + @@ -177,7 +179,7 @@

- + {logItem.tableName} @@ -216,14 +218,12 @@

- + - + @@ -236,3 +236,5 @@

+ + diff --git a/typo3/sysext/belog/Resources/Private/Templates/BackendLog/List.html b/typo3/sysext/belog/Resources/Private/Templates/BackendLog/List.html new file mode 100644 index 000000000000..61f4f5346468 --- /dev/null +++ b/typo3/sysext/belog/Resources/Private/Templates/BackendLog/List.html @@ -0,0 +1,26 @@ + + + + +

+ +

+ +
+ +
+ +
+ + +
+ + diff --git a/typo3/sysext/belog/Resources/Private/Templates/Tools/Index.html b/typo3/sysext/belog/Resources/Private/Templates/Tools/Index.html deleted file mode 100644 index 7ab52f611c59..000000000000 --- a/typo3/sysext/belog/Resources/Private/Templates/Tools/Index.html +++ /dev/null @@ -1,2 +0,0 @@ - - \ No newline at end of file diff --git a/typo3/sysext/belog/Resources/Private/Templates/WebInfo/Index.html b/typo3/sysext/belog/Resources/Private/Templates/WebInfo/Index.html deleted file mode 100644 index b2de4e7eb370..000000000000 --- a/typo3/sysext/belog/Resources/Private/Templates/WebInfo/Index.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/typo3/sysext/belog/ext_tables.php b/typo3/sysext/belog/ext_tables.php index b74dd943e650..499b38c5762e 100644 --- a/typo3/sysext/belog/ext_tables.php +++ b/typo3/sysext/belog/ext_tables.php @@ -16,8 +16,7 @@ 'log', '', [ - 'Tools' => 'index,deleteMessage', - 'WebInfo' => 'index', + 'BackendLog' => 'list,deleteMessage', ], [ 'access' => 'admin', diff --git a/typo3/sysext/fluid/Classes/ViewHelpers/Be/ModuleLayoutViewHelper.php b/typo3/sysext/fluid/Classes/ViewHelpers/Be/ModuleLayoutViewHelper.php new file mode 100644 index 000000000000..6993db20e5f2 --- /dev/null +++ b/typo3/sysext/fluid/Classes/ViewHelpers/Be/ModuleLayoutViewHelper.php @@ -0,0 +1,69 @@ + + * + * + * + * + * + * + * + */ +class ModuleLayoutViewHelper extends AbstractViewHelper +{ + use CompileWithRenderStatic; + + /** + * @var bool + */ + protected $escapeOutput = false; + + public static function renderStatic( + array $arguments, + \Closure $renderChildrenClosure, + RenderingContextInterface $renderingContext + ) { + $viewHelperVariableContainer = $renderingContext->getViewHelperVariableContainer(); + if ($viewHelperVariableContainer->exists(self::class, ModuleTemplate::class)) { + throw new Exception('ModuleLayoutViewHelper can only be used once per module.', 1483292643); + } + + $moduleTemplate = GeneralUtility::makeInstance(ModuleTemplate::class); + $moduleTemplate->setFlashMessageQueue($renderingContext->getControllerContext()->getFlashMessageQueue()); + + $viewHelperVariableContainer->add(self::class, ModuleTemplate::class, $moduleTemplate); + $moduleTemplate->setContent($renderChildrenClosure()); + $viewHelperVariableContainer->remove(self::class, ModuleTemplate::class); + + return $moduleTemplate->renderContent(); + } +}