Skip to content
Snippets Groups Projects
Commit d577f4cb authored by Torsten Oppermann's avatar Torsten Oppermann
Browse files

[TASK] Refactoring, fixing a bug that causes losing of selected template

parent 10fb3ee7
No related branches found
No related tags found
1 merge request!3New version 4 1
......@@ -74,7 +74,7 @@ class QueueController extends ActionController {
}
$siteRootId = BackendService::getSiteRoot((int) GeneralUtility::_GP('id'));
$queue = $this->mailRepository->findAllEntries($selectedExtension, $selectedTemplate, $siteRootId, 0, $filters);
$queue = $this->mailRepository->findAllEntries($siteRootId, 0, $filters);
// create doc header component
$pageUid = (int) GeneralUtility::_GP('id');
......@@ -87,17 +87,25 @@ class QueueController extends ActionController {
$this->view->assign('languages', BackendService::getLanguagesForFilter());
$this->view->assign('mode', 'queue');
if (!$filters['sent']) {
$filters['sent'] = 0;
if (!$filters['filterSent']) {
$filters['filterSent'] = 0;
}
$this->view->assign('filters', $filters);
$this->view->assign('queue', $queue);
$this->view->assign(
'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::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')
]
......
......@@ -57,15 +57,13 @@ class MailRepository extends AbstractRepository {
/**
* Find all mails (sent & unsent) for extension key and template name
*
* @param string $extensionKey
* @param string $templateName
* @param int $siteroot
* @param int $limit
* @param array $filters
* @return array|QueryResultInterface
* @throws \TYPO3\CMS\Extbase\Persistence\Exception\InvalidQueryException
*/
public function findAllEntries($extensionKey, $templateName, $siteroot = 0, $limit = NULL, array $filters = []) {
public function findAllEntries($siteroot = 0, $limit = NULL, array $filters = []) {
$query = $this->createQuery();
if ($limit) {
$query->setLimit($limit);
......@@ -133,7 +131,6 @@ class MailRepository extends AbstractRepository {
}
}
$constraintsAnd[] = $query->equals('extension_key', $extensionKey);
$constraintsAnd[] = $query->equals('site_root_id', (int) $siteroot);
$query->setOrderings(['tstamp' => Query::ORDER_DESCENDING]);
......
{namespace sgm=SGalinski\SgMail\ViewHelpers}
<f:be.container enableClickMenu="FALSE" loadExtJs="FALSE" includeCssFiles="{0: '{f:uri.resource(path: \'StyleSheets/backend.css\')}'}"
includeRequireJsModules="{
0: 'TYPO3/CMS/Backend/AjaxDataHandler',
1: '{f:if(condition: \'{typo3Version} < 8000000 \', then: \'TYPO3/CMS/Backend/ClickMenu\', else: \'TYPO3/CMS/Backend/ContextMenu\')}',
2: 'TYPO3/CMS/Backend/Tooltip'}">
<sgm:addJavaScriptFile javaScriptFile="{f:uri.resource(path: 'Scripts/Backend.js')}" />
<sgm:inlineLanguageLabels labels="backend.delete_template, backend.send_mail_manually, backend.send_mail_again" />
<div class="module" data-module-id="" data-module-name="">
<div class="module-docheader t3js-module-docheader">
<div class="module-docheader-bar module-docheader-bar-navigation t3js-module-docheader-bar t3js-module-docheader-bar-navigation">
<f:if condition="{pages}">
<f:then></f:then>
<f:else>
<div class="module-docheader-bar-column-left">
<f:be.menus.actionMenu>
<f:if condition="{mode} == 'queue'">
<f:then>
<sgm:be.menus.actionMenuItem label="{f:translate(key:'backend.mail_queue')}"
controller="Queue"
action="index"
additionalAttributes="{selected: 'selected'}"
arguments="{selectedTemplate: selectedTemplateKey, selectedExtension: selectedExtensionKey}" />
</f:then>
<f:else>
<sgm:be.menus.actionMenuItem label="{f:translate(key:'backend.mail_queue')}"
controller="Queue"
action="index"
arguments="{selectedTemplate: selectedTemplateKey, selectedExtension: selectedExtensionKey}" />
</f:else>
</f:if>
<f:if condition="{mode} == 'editor'">
<f:then>
<sgm:be.menus.actionMenuItem label="{f:translate(key:'backend.template_editor')}"
controller="Mail"
action="index"
arguments="{selectedTemplate: selectedTemplateKey, selectedExtension: selectedExtensionKey}"
additionalAttributes="{selected: 'selected'}" />
</f:then>
<f:else>
<sgm:be.menus.actionMenuItem label="{f:translate(key:'backend.template_editor')}"
controller="Mail"
action="index"
arguments="{selectedTemplate: selectedTemplateKey, selectedExtension: selectedExtensionKey}" />
</f:else>
</f:if>
</f:be.menus.actionMenu>
</div>
</f:else>
</f:if>
<div class="module-docheader-bar-column-right">
<span class="typo3-docheader-pagePath"><f:translate key="LLL:EXT:lang/locallang_core.xlf:labels.path" />: <f:format.raw>{docHeader.metaInformation.path}</f:format.raw></span>
<f:format.raw>{docHeader.metaInformation.recordInformation}</f:format.raw>
</div>
</div>
</div>
</div>
<div id="typo3-docbody">
<div id="typo3-inner-docbody">
<f:render section="content" />
</div>
</div>
</f:be.container>
{namespace sgm=SGalinski\SgMail\ViewHelpers}
<f:layout name="Default" />
<f:layout name="Queue" />
<f:section name="iconButtons">
</f:section>
......
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