Skip to content
Snippets Groups Projects
Commit b3ceca8e authored by Florian Will's avatar Florian Will
Browse files

[TASK] changed SiteController so it also uses Dochead and Buttons

parent fb165577
No related branches found
No related tags found
1 merge request!64Feature 5168 unify root page selector
<?php
/***************************************************************
* Copyright notice
*
* (c) sgalinski Internet Services (https://www.sgalinski.de)
*
* 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 SGalinski\SgMail\Controller;
use Doctrine\DBAL\Exception;
use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Backend\Template\ModuleTemplateFactory;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Database\ConnectionPool;
use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction;
use TYPO3\CMS\Core\Site\SiteFinder;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Extbase\Mvc\Request;
/**
......@@ -42,21 +16,16 @@ use TYPO3\CMS\Extbase\Mvc\Request;
*
* @package SGalinski\SgMail\Controller
*/
class SiteController extends ActionController {
protected ModuleTemplateFactory $moduleTemplateFactory;
protected SiteFinder $siteFinder;
class SiteController extends AbstractController {
protected ConnectionPool $connectionPool;
protected SiteFinder $siteFinder;
public function __construct(
ModuleTemplateFactory $moduleTemplateFactory,
SiteFinder $siteFinder,
ConnectionPool $connectionPool
ConnectionPool $connectionPool,
SiteFinder $siteFinder
) {
$this->moduleTemplateFactory = $moduleTemplateFactory;
$this->siteFinder = $siteFinder;
$this->connectionPool = $connectionPool;
$this->siteFinder = $siteFinder;
}
/**
......@@ -66,6 +35,8 @@ class SiteController extends ActionController {
* @throws Exception
*/
public function indexAction(): ResponseInterface {
$this->makeDocheader(); // Add docheader and buttons
$out = [];
$sites = $this->siteFinder->getAllSites();
$queryBuilder = $this->connectionPool->getQueryBuilderForTable('tx_sgmail_domain_model_mail');
......@@ -101,14 +72,12 @@ class SiteController extends ActionController {
$controllerName = $originalRequest->getAttribute('extbase')->getControllerName();
$actionName = $originalRequest->getAttribute('extbase')->getControllerActionName();
$moduleTemplate = $this->moduleTemplateFactory->create($this->request);
$moduleTemplate->assignMultiple([
$this->moduleTemplate->assignMultiple([
'sites' => $out,
'controller' => $controllerName,
'action' => $actionName
]);
return $moduleTemplate->renderResponse('Index');
return $this->moduleTemplate->renderResponse('Index');
}
}
{namespace sgm=SGalinski\SgMail\ViewHelpers}
<f:be.pageRenderer includeCssFiles="{0: '{f:uri.resource(path: \'StyleSheets/backend.css\')}'}"
includeJavaScriptModules="{
0: '@typo3/backend/ajax-data-handler.js',
1: '@typo3/backend/context-menu.js',
2: '@sgalinski/sg-mail/Backend.js'
}"
addJsInlineLabels="{
0: 'backend.delete_template',
1: 'backend.delete_template_custom',
2: 'backend.send_mail_manually',
3: 'backend.send_mail_again'
}" />
<div class="module" data-module-id="" data-module-name="">
<div class="module-docheader t3js-module-docheader">
<div
......@@ -7,10 +19,10 @@
<div class="module-docheader-bar-column-left">
</div>
<div class="module-docheader-bar-column-right">
<f:render partial="Path" arguments="{docHeader: docHeader}"/>
</div>
</div>
<div
class="module-docheader-bar module-docheader-bar-buttons t3js-module-docheader-bar t3js-module-docheader-bar-buttons">
<div class="module-docheader-bar module-docheader-bar-buttons t3js-module-docheader-bar t3js-module-docheader-bar-buttons">
<div class="module-docheader-bar-column-left">
</div>
<div class="module-docheader-bar-column-right" style="display: flex; align-items: center;">
......
......@@ -30,6 +30,7 @@
<img src="{f:uri.resource(path: 'Icons/logo-icon.svg')}" alt="Sgalinski Logo"
style="width: 34px; height: 25.75px;"/>
</a>
<f:render partial="ButtonBar" arguments="{buttons:docHeader.buttons.right}"/>
</div>
</div>
</div>
......
<!--Extbase Version -->
<div class="module-docheader-bar-column-left">
<f:render partial="Backend/ButtonBar" arguments="{buttons:docHeader.buttons.left}"/>
</div>
<div class="module-docheader-bar-column-right" style="display: flex; align-items: center;">
<a href="https://www.sgalinski.de/" target="_blank" rel="noopener noreferrer"
title="Created by the TYPO3 agency sgalinski">
<img src="{f:uri.resource(path: 'Icons/logo-icon.svg')}" alt="Sgalinski Logo"
style="width: 34px; height: 25.75px;"/>
</a>
<f:render partial="Backend/ButtonBar" arguments="{buttons:docHeader.buttons.right}"/>
</div>
<span class="typo3-docheader-pagePath">
<f:translate key="LLL:EXT:core/Resources/Private/Language/locallang_core.xlf:labels.path" />: <f:format.raw>{docHeader.metaInformation.path}</f:format.raw>
</span>
<f:format.raw>{docHeader.metaInformation.recordInformation}</f:format.raw>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment