Commit 4828bbdd authored by Kevin Ditscheid's avatar Kevin Ditscheid
Browse files

[TASK] Make final adjustments after testing on softingit

parent 9a78eefe
......@@ -31,11 +31,17 @@ use TYPO3\CMS\Backend\Template\Components\DocHeaderComponent;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
use TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException;
use TYPO3\CMS\Core\Exception\SiteNotFoundException;
use TYPO3\CMS\Core\Imaging\Icon;
use TYPO3\CMS\Core\Imaging\IconFactory;
use TYPO3\CMS\Core\Messaging\FlashMessage;
use TYPO3\CMS\Core\Site\Entity\Site;
use TYPO3\CMS\Core\Site\SiteFinder;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Extbase\Mvc\Exception\NoSuchArgumentException;
use TYPO3\CMS\Extbase\Mvc\Exception\StopActionException;
use TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
use function count;
......@@ -65,6 +71,11 @@ abstract class AbstractController extends ActionController {
*/
protected $registerService;
/**
* @var Site
*/
protected $site;
/**
* @param RegisterService $registerService
*/
......@@ -79,7 +90,7 @@ abstract class AbstractController extends ActionController {
* @return string
*/
protected function getFromSession(string $key): string {
return $this->backendUserAuthentication->getSessionData(self::sessionKey . '_' . $key);
return $this->backendUserAuthentication->getSessionData(self::sessionKey . '_' . $key) ?? '';
}
/**
......@@ -92,6 +103,56 @@ abstract class AbstractController extends ActionController {
$this->backendUserAuthentication->setSessionData(self::sessionKey . '_' . $key, $data);
}
/**
* @throws NoSuchArgumentException
* @throws StopActionException
* @throws UnsupportedRequestTypeException
*/
protected function switchMode(): void {
$mode = $this->getFromSession('mode');
if ($this->request->hasArgument('controller')) {
$mode = $this->request->getArgument('controller');
}
if ($mode) {
$this->writeToSession('mode', $mode);
if ('SGalinski\\SgMail\\Controller\\' . $mode . 'Controller' !== static::class) {
$this->redirect('index', $this->getFromSession('mode'));
}
}
}
/**
* @throws StopActionException
*/
protected function requireSite(): void {
$pid = $this->getPid();
if (!$pid) {
$originalRequest = clone $this->request;
$this->request->setOriginalRequest($originalRequest);
$this->forward('index', 'Site', 'SgMail');
}
try {
$this->site = GeneralUtility::makeInstance(SiteFinder::class)->getSiteByPageId($pid);
} catch (SiteNotFoundException $exception) {
$originalRequest = clone $this->request;
$this->request->setOriginalRequest($originalRequest);
$this->forward('index', 'Site', $this->request->getArguments());
}
}
/**
* @throws NoSuchArgumentException
*/
protected function addMessage(): void {
if ($this->request->hasArgument('message')) {
$this->addFlashMessage($this->request->getArgument('message'), '', FlashMessage::INFO);
}
}
/**
* Get the page id from get parameters
*
......@@ -184,7 +245,7 @@ abstract class AbstractController extends ActionController {
$docHeaderComponent->setMetaInformation($pageInfo);
$this->makeButtons($docHeaderComponent);
$this->view->assign('docHeader', $this->docHeaderComponent->docHeaderContent());
$this->view->assign('docHeader', $docHeaderComponent->docHeaderContent());
}
/**
......
......@@ -32,6 +32,8 @@ use TYPO3\CMS\Backend\Clipboard\Clipboard;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Exception\NoSuchArgumentException;
use TYPO3\CMS\Extbase\Mvc\Exception\StopActionException;
use TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException;
use TYPO3\CMS\Extbase\Mvc\View\ViewInterface;
use function count;
use function is_array;
......@@ -95,31 +97,26 @@ class LayoutController extends AbstractController {
/**
* @throws NoSuchArgumentException
* @throws StopActionException
* @throws UnsupportedRequestTypeException
*/
public function indexAction(): void {
$pageUid = $this->getPid();
if ($this->request->hasArgument('controller')) {
$this->writeToSession('mode', $this->request->getArgument('controller'));
$this->requireSite();
$this->switchMode();
$pageInfo = BackendUtility::readPageAccess($this->site->getRootPageId(), $GLOBALS['BE_USER']->getPagePermsClause(1));
$layouts = $this->layoutRepository->findByPidForModule($this->site->getRootPageId());
$this->view->assign('layouts', $layouts);
$pasteData = $this->clipObj->elFromTable('tx_sgmail_domain_model_layout');
if (count($pasteData)) {
$pasteButton = [
'message' => $this->clipObj->confirmMsgText('pages', $pageInfo, 'into', $pasteData),
'url' => $this->clipObj->pasteUrl('', $this->site->getRootPageId())
];
$this->view->assign('pasteButton', $pasteButton);
}
// create doc header component
$pageInfo = BackendUtility::readPageAccess($pageUid, $GLOBALS['BE_USER']->getPagePermsClause(1));
if ($pageInfo && (int) $pageInfo['is_siteroot'] === 1) {
$layouts = $this->layoutRepository->findByPidForModule($pageUid);
$this->view->assign('layouts', $layouts);
$pasteData = $this->clipObj->elFromTable('tx_sgmail_domain_model_layout');
if (count($pasteData)) {
$pasteButton = [
'message' => $this->clipObj->confirmMsgText('pages', $pageInfo, 'into', $pasteData),
'url' => $this->clipObj->pasteUrl('', $pageUid)
];
$this->view->assign('pasteButton', $pasteButton);
}
} else {
$this->view->assign('pages', BackendService::getPages());
}
$this->view->assign('pageUid', $pageUid);
$this->view->assign('pageUid', $this->site->getRootPageId());
$this->makeDocheader();
}
......
......@@ -28,9 +28,7 @@ namespace SGalinski\SgMail\Controller;
use SGalinski\SgMail\Domain\Model\Template;
use SGalinski\SgMail\Domain\Repository\LayoutRepository;
use SGalinski\SgMail\Domain\Repository\TemplateRepository;
use SGalinski\SgMail\Service\BackendService;
use SGalinski\SgMail\Service\MailTemplateService;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException;
use TYPO3\CMS\Core\Exception\SiteNotFoundException;
use TYPO3\CMS\Core\Messaging\FlashMessage;
......@@ -40,10 +38,11 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\VersionNumberUtility;
use TYPO3\CMS\Extbase\Mvc\Exception\NoSuchArgumentException;
use TYPO3\CMS\Extbase\Mvc\Exception\StopActionException;
use TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException;
use TYPO3\CMS\Extbase\Mvc\View\ViewInterface;
use TYPO3\CMS\Extbase\Object\Exception;
use TYPO3\CMS\Extbase\Object\ObjectManager;
use TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException;
use TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException;
use TYPO3\CMS\Extbase\Persistence\Exception\UnknownObjectException;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
......@@ -91,26 +90,19 @@ class MailController extends AbstractController {
* Show template Selection and enable content input + mail preview
*
* @param array $parameters
* @throws StopActionException
* @throws NoSuchArgumentException
* @throws NoSuchCacheException
* @throws SiteNotFoundException
* @throws NoSuchArgumentException
* @throws StopActionException
* @throws UnsupportedRequestTypeException
* @throws InvalidQueryException
*/
public function indexAction(array $parameters = []): void {
if ($this->request->hasArgument('message')) {
$this->addFlashMessage($this->request->getArgument('message'), '', FlashMessage::INFO);
}
$pid = $this->getPid();
if ($this->request->hasArgument('controller')) {
$this->writeToSession('mode', $this->request->getArgument('controller'));
}
if ($this->getFromSession('mode') !== BackendService::BACKEND_MODE_EDITOR_CONTROLLER) {
$this->redirect('index', $this->getFromSession('mode'));
}
$this->switchMode();
$this->requireSite();
$this->addMessage();
$registerArray = $this->registerService->getNonBlacklistedTemplates($pid);
$registerArray = $this->registerService->getNonBlacklistedTemplates($this->site->getRootPageId());
// if no extensions are registered, redirect to empty action
if (!\is_array($registerArray) || \count($registerArray) <= 0) {
$this->forward('empty');
......@@ -125,10 +117,10 @@ class MailController extends AbstractController {
// store selected template & extension key in the session
$this->writeToSession('selectedTemplate', $parameters['selectedTemplate']);
$this->writeToSession('selectedExtension', $parameters['selectedExtension']);
$site = GeneralUtility::makeInstance(SiteFinder::class)->getSiteByPageId($pid);
$site = GeneralUtility::makeInstance(SiteFinder::class)->getSiteByPageId($this->site->getRootPageId());
$languages = $site->getLanguages();
$templatesFromDb = $this->templateRepository->findByTemplateProperties(
$parameters['selectedExtension'], $parameters['selectedTemplate'], $languages, $pid
$parameters['selectedExtension'], $parameters['selectedTemplate'], $languages, $this->site->getRootPageId()
)->toArray();
// if no templates are in the db, get the default from the files
......@@ -147,7 +139,9 @@ class MailController extends AbstractController {
$defaultTemplatePath = $registerArray[$parameters['selectedExtension']][$parameters['selectedTemplate']]['templatePath'];
$fallbackTemplateFile = $defaultTemplatePath . 'template.html';
$templateFromFile = new Template();
$templateFromFile = GeneralUtility::makeInstance(Template::class);
$templateFromFile->setExtensionKey($parameters['selectedExtension']);
$templateFromFile->setTemplateName($parameters['selectedTemplate']);
$templateFromFile->setSiteLanguage($language);
$templates[$language->getLanguageId()] = $templateFromFile;
if (\strpos($subject, 'LLL:') === 0) {
......@@ -194,29 +188,23 @@ class MailController extends AbstractController {
);
}
// create doc header component
$pageInfo = BackendUtility::readPageAccess($pid, $GLOBALS['BE_USER']->getPagePermsClause(1));
if ($pageInfo && (int) $pageInfo['is_siteroot'] === 1) {
$layouts = $this->layoutRepository->findByPidForModule($pid);
$layoutOptions = [
0 => LocalizationUtility::translate('backend.layout.default', 'SgMail'),
-1 => LocalizationUtility::translate('backend.layout.none', 'SgMail')
];
foreach ($layouts as $layout) {
$layoutOptions[(int) $layout['uid']] = $layout['name'];
}
$this->view->assignMultiple([
'templateDescription' => $templateDescription,
'selectedTemplate' => $registerArray[$parameters['selectedExtension']][$parameters['selectedTemplate']],
'selectedTemplateKey' => $parameters['selectedTemplate'],
'selectedExtensionKey' => $parameters['selectedExtension'],
'layoutOptions' => $layoutOptions
]);
} else {
$this->view->assign('pages', BackendService::getPages());
$layouts = $this->layoutRepository->findByPidForModule($this->site->getRootPageId());
$layoutOptions = [
0 => LocalizationUtility::translate('backend.layout.default', 'SgMail'),
-1 => LocalizationUtility::translate('backend.layout.none', 'SgMail')
];
foreach ($layouts as $layout) {
$layoutOptions[(int) $layout['uid']] = $layout['name'];
}
$this->view->assignMultiple([
'templateDescription' => $templateDescription,
'selectedTemplate' => $registerArray[$parameters['selectedExtension']][$parameters['selectedTemplate']],
'selectedTemplateKey' => $parameters['selectedTemplate'],
'selectedExtensionKey' => $parameters['selectedExtension'],
'layoutOptions' => $layoutOptions
]);
$this->makeDocheader();
$this->view->assignMultiple([
'beUserMail' => $GLOBALS['BE_USER']->user['email']
......@@ -230,10 +218,10 @@ class MailController extends AbstractController {
* @param array $parameters
* @throws IllegalObjectTypeException
* @throws NoSuchCacheException
* @throws StopActionException
* @throws ResourceDoesNotExistException
* @throws Exception
* @throws StopActionException
* @throws UnknownObjectException
* @throws UnsupportedRequestTypeException
*/
public function sendTestMailAction(array $parameters = []): void {
$arguments = [];
......@@ -255,13 +243,14 @@ class MailController extends AbstractController {
}
}
$pid = $this->getPid();
$site = GeneralUtility::makeInstance(SiteFinder::class)->getSiteByPageId($pid);
foreach ((array) $parameters['templates'] as $languageId => $template) {
$this->templateRepository->save(
$pid, $parameters['selectedExtension'], $parameters['selectedTemplate'],
$site->getLanguageById($languageId), $template
);
$this->requireSite();
$templates = [];
foreach ((array) $parameters['templates'] as $template) {
if ($template['uid']) {
$templates[] = $this->templateRepository->updateByUid($template['uid'], $template);
} else {
$templates[] = $this->templateRepository->create($template);
}
}
$message = LocalizationUtility::translate('backend.success', 'sg_mail');
......@@ -272,26 +261,17 @@ class MailController extends AbstractController {
$this->redirect('index', NULL, NULL, $arguments);
}
if (version_compare(VersionNumberUtility::getCurrentTypo3Version(), '10.4.0', '<')) {
$objectManager = GeneralUtility::makeInstance(ObjectManager::class);
/** @var \SGalinski\SgMail\Service\MailTemplateService $mailTemplateService */
$mailTemplateService = $objectManager->get(
MailTemplateService::class, $parameters['selectedTemplate'], $parameters['selectedExtension']
);
} else {
$mailTemplateService = GeneralUtility::makeInstance(
MailTemplateService::class, $parameters['selectedTemplate'], $parameters['selectedExtension']
);
}
$mailTemplateService = GeneralUtility::makeInstance(
MailTemplateService::class, $parameters['selectedTemplate'], $parameters['selectedExtension']
);
$mailTemplateService->setIgnoreMailQueue(TRUE);
$mailIsSend = FALSE;
foreach ((array) $parameters['templates'] as $languageId => $template) {
$mailTemplateService->setSiteLanguage($site->getLanguageById($languageId));
foreach ($templates as $template) {
$mailTemplateService->loadTemplateValues($template);
$mailTemplateService->setToAddresses($parameters['emailAddress']);
$mailTemplateService->setTemplateName($parameters['selectedTemplate']);
$mailTemplateService->setExtensionKey($parameters['selectedExtension']);
$mailTemplateService->setPreviewMarkers();
$mailIsSend = $mailTemplateService->sendEmail(TRUE);
$mailIsSend = $mailTemplateService->sendEmail();
}
if ($mailIsSend) {
......@@ -319,10 +299,11 @@ class MailController extends AbstractController {
* @param string $template
* @param string $extensionKey
* @throws StopActionException
* @throws UnsupportedRequestTypeException
*/
public function resetAction(string $template, string $extensionKey): void {
$pid = $this->getPid();
$this->templateRepository->deleteTemplate($extensionKey, $template, $pid);
$this->requireSite();
$this->templateRepository->deleteTemplate($extensionKey, $template, $this->site->getRootPageId());
$message = LocalizationUtility::translate('backend.template_reset', 'sg_mail');
$this->addFlashMessage($message, '', FlashMessage::OK);
......
......@@ -33,6 +33,7 @@ use SGalinski\SgMail\Service\BackendService;
use SGalinski\SgMail\Service\MailTemplateService;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException;
use TYPO3\CMS\Core\Exception\SiteNotFoundException;
use TYPO3\CMS\Core\Messaging\FlashMessage;
use TYPO3\CMS\Core\Resource\Exception\ResourceDoesNotExistException;
use TYPO3\CMS\Core\Site\SiteFinder;
......@@ -40,10 +41,11 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\VersionNumberUtility;
use TYPO3\CMS\Extbase\Mvc\Exception\NoSuchArgumentException;
use TYPO3\CMS\Extbase\Mvc\Exception\StopActionException;
use TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException;
use TYPO3\CMS\Extbase\Mvc\View\ViewInterface;
use TYPO3\CMS\Extbase\Object\Exception;
use TYPO3\CMS\Extbase\Object\ObjectManager;
use TYPO3\CMS\Extbase\Persistence\Exception\IllegalObjectTypeException;
use TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException;
use TYPO3\CMS\Extbase\Persistence\Exception\UnknownObjectException;
use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
......@@ -105,32 +107,26 @@ class NewsletterController extends AbstractController {
* Show template Selection and enable content input + mail preview
*
* @param array $parameters
* @throws StopActionException
* @throws NoSuchCacheException
* @throws NoSuchArgumentException
* @throws \TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException
* @throws NoSuchCacheException
* @throws StopActionException
* @throws SiteNotFoundException
* @throws UnsupportedRequestTypeException
* @throws InvalidQueryException
*/
public function indexAction(array $parameters = []): void {
if ($this->request->hasArgument('message')) {
$this->addFlashMessage($this->request->getArgument('message'), '', FlashMessage::INFO);
}
$pid = $this->getPid();
if ($this->request->hasArgument('controller')) {
$this->writeToSession('mode', $this->request->getArgument('controller'));
}
if ($this->getFromSession('mode') !== BackendService::BACKEND_MODE_QUEUE_NEWSLETTER) {
$this->redirect('index', $this->getFromSession('mode'));
}
$this->requireSite();
$this->switchMode();
$this->addMessage();
$registerArray = $this->registerService->getNonBlacklistedTemplates($pid);
$registerArray = $this->registerService->getNonBlacklistedTemplates($this->site->getRootPageId());
// if no extensions are registered, redirect to empty action
if (!\is_array($registerArray) || \count($registerArray) <= 0) {
$this->forward('empty');
}
$arguments = $this->request->getArguments();
$site = GeneralUtility::makeInstance(SiteFinder::class)->getSiteByPageId($pid);
$site = GeneralUtility::makeInstance(SiteFinder::class)->getSiteByPageId($this->site->getRootPageId());
// if no template & extensionKey is selected look for them in the session
if (
$parameters['selectedTemplate'] === NULL
......@@ -138,8 +134,8 @@ class NewsletterController extends AbstractController {
|| $parameters['selectedLanguage'] === NULL
) {
[$parameters['selectedExtension'], $parameters['selectedTemplate']] = $this->getSelectedExtensionAndTemplate();
if ($this->getFromSession('selectedLanguage') !== NULL) {
$parameters['selectedLanguage'] = $this->getFromSession('selectedLanguage');
if ($this->getFromSession('selectedLanguage') !== '') {
$parameters['selectedLanguage'] = (int) $this->getFromSession('selectedLanguage');
} else {
$parameters['selectedLanguage'] = $site->getDefaultLanguage()->getLanguageId();
}
......@@ -156,7 +152,7 @@ class NewsletterController extends AbstractController {
$parameters['selectedExtension'],
$parameters['selectedTemplate'],
[$selectedLanguage],
$pid
$this->site->getRootPageId()
);
// if no templates are in the db, get the default from the files
......@@ -247,31 +243,27 @@ class NewsletterController extends AbstractController {
}
// create doc header component
$pageInfo = BackendUtility::readPageAccess($pid, $GLOBALS['BE_USER']->getPagePermsClause(1));
if ($pageInfo && (int) $pageInfo['is_siteroot'] === 1) {
$layouts = $this->layoutRepository->findByPidForModule($pid);
$layoutOptions = [
0 => LocalizationUtility::translate('backend.layout.default', 'SgMail'),
-1 => LocalizationUtility::translate('backend.layout.none', 'SgMail')
];
foreach ($layouts as $layout) {
$layoutOptions[(int) $layout['uid']] = $layout['name'];
}
$this->view->assignMultiple([
'templateDescription' => $templateDescription,
'selectedTemplate' => $registerArray[$parameters['selectedExtension']][$parameters['selectedTemplate']],
'selectedTemplateKey' => $parameters['selectedTemplate'],
'selectedExtensionKey' => $parameters['selectedExtension'],
'layoutOptions' => $layoutOptions
]);
} else {
$this->view->assign('pages', BackendService::getPages());
$pageInfo = BackendUtility::readPageAccess($this->site->getRootPageId(), $GLOBALS['BE_USER']->getPagePermsClause(1));
$layouts = $this->layoutRepository->findByPidForModule($this->site->getRootPageId());
$layoutOptions = [
0 => LocalizationUtility::translate('backend.layout.default', 'SgMail'),
-1 => LocalizationUtility::translate('backend.layout.none', 'SgMail')
];
foreach ($layouts as $layout) {
$layoutOptions[(int) $layout['uid']] = $layout['name'];
}
$this->view->assignMultiple([
'templateDescription' => $templateDescription,
'selectedTemplate' => $registerArray[$parameters['selectedExtension']][$parameters['selectedTemplate']],
'selectedTemplateKey' => $parameters['selectedTemplate'],
'selectedExtensionKey' => $parameters['selectedExtension'],
'layoutOptions' => $layoutOptions
]);
$this->makeDocheader();
// get the default language label and pass it to the view
$pageTsConfig = BackendUtility::getPagesTSconfig($pid);
$pageTsConfig = BackendUtility::getPagesTSconfig($this->site->getRootPageId());
$defaultLanguageLabel = LocalizationUtility::translate(
'LLL:EXT:core/Resources/Private/Language/locallang_mod_web_list.xlf:defaultLanguage'
);
......@@ -303,10 +295,10 @@ class NewsletterController extends AbstractController {
* @throws IllegalObjectTypeException
* @throws NoSuchArgumentException
* @throws NoSuchCacheException
* @throws StopActionException
* @throws ResourceDoesNotExistException
* @throws Exception
* @throws StopActionException
* @throws UnknownObjectException
* @throws UnsupportedRequestTypeException
*/
public function sendTestMailAction(array $parameters = []): void {
$arguments = [];
......
......@@ -37,6 +37,7 @@ use TYPO3\CMS\Core\Site\SiteFinder;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Exception\NoSuchArgumentException;
use TYPO3\CMS\Extbase\Mvc\Exception\StopActionException;
use TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException;
use TYPO3\CMS\Extbase\Mvc\View\ViewInterface;
use TYPO3\CMS\Extbase\Object\Exception;
use TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException;
......@@ -76,9 +77,11 @@ class QueueController extends AbstractController {
* @throws NoSuchArgumentException
* @throws NoSuchCacheException
* @throws SiteNotFoundException
* @throws StopActionException
* @throws UnsupportedRequestTypeException
*/
public function indexAction($selectedTemplate = NULL, $selectedExtension = NULL, array $filters = []): void {
$pageUid = $this->getPid();
$this->requireSite();
$this->initSessionAndTemplateFilter($filters);
$this->view->assignMultiple([
'selectedTemplateFilter' => $filters['filterTemplate'],
......@@ -88,50 +91,45 @@ class QueueController extends AbstractController {
[$selectedExtension, $selectedTemplate] = $this->getSelectedExtensionAndTemplateFromRegister();
}
$pageInfo = BackendUtility::readPageAccess($pageUid, $GLOBALS['BE_USER']->getPagePermsClause(1));
if ($pageInfo && (int) $pageInfo['is_siteroot'] === 1) {
$queue = $this->mailRepository->findAllEntries($pageUid, 0, $filters);
if (!$filters['filterSent']) {
$filters['filterSent'] = 0;
}
$site = GeneralUtility::makeInstance(SiteFinder::class)->getSiteByPageId($this->getPid());
$this->view->assignMultiple([
'selectedTemplateKey' => $selectedTemplate,
'selectedExtensionKey' => $selectedExtension,
'templates' => $this->registerService->getNonBlacklistedTemplates($pageUid),
'templatesFilter' => $this->registerService->getTemplatesForFilter($pageUid),
'languages' => $site->getAvailableLanguages($this->backendUserAuthentication),
'mode' => 'queue',
'filters' => $filters,
'queue' => $queue,
'filterFields' => [
BackendService::SENDER_FILTER_OPTION => LocalizationUtility::translate(
'backend.filter.from', 'SgMail'
),
BackendService::RECIPIENT_FILTER_OPTION => LocalizationUtility::translate(
'backend.filter.to', 'SgMail'
),
BackendService::SUBJECT_FILTER_OPTION => LocalizationUtility::translate(
'backend.filter.subject', 'SgMail'
),
BackendService::MAILTEXT_FILTER_OPTION => LocalizationUtility::translate(
'backend.filter.mailtext', 'SgMail'
),
BackendService::CC_FILTER_OPTION => LocalizationUtility::translate('backend.filter.cc', 'SgMail'),
BackendService::BCC_FILTER_OPTION => LocalizationUtility::translate('backend.filter.bcc', 'SgMail'),
BackendService::FROM_NAME_FILTER_OPTION => LocalizationUtility::translate(
'backend.filter.from_name', 'SgMail'
),
BackendService::REPLY_TO_NAME_FILTER_OPTION => LocalizationUtility::translate(
'backend.filter.reply_to', 'SgMail'
),
]
]);
} else {
$this->view->assign('pages', BackendService::getPages());
$queue = $this->mailRepository->findAllEntries($this->site->getRootPageId(), 0, $filters);
if (!$filters['filterSent']) {
$filters['filterSent'] = 0;
}
$site = GeneralUtility::makeInstance(SiteFinder::class)->getSiteByPageId($this->getPid());
$this->view->assignMultiple([
'selectedTemplateKey' => $selectedTemplate,
'selectedExtensionKey' => $selectedExtension,
'templates' => $this->registerService->getNonBlacklistedTemplates($this->site->getRootPageId()),
'templatesFilter' => $this->registerService->getTemplatesForFilter($this->site->getRootPageId()),
'languages' => $site->getAvailableLanguages($this->backendUserAuthentication),
'mode' => 'queue',
'filters' => $filters,
'queue' => $queue,
'filterFields' => [
BackendService::SENDER_FILTER_OPTION => LocalizationUtility::translate(
'backend.filter.from', 'SgMail'
),