From 758da9ec679f0c1778a73cf319f14e16d358ae66 Mon Sep 17 00:00:00 2001 From: Stefan Galinski <stefan@sgalinski.de> Date: Wed, 5 Oct 2016 18:29:36 +0200 Subject: [PATCH] [TASK] Cleanup and several fixes and simplifications --- Classes/Command/SendMailCommandController.php | 3 - Classes/Controller/MailController.php | 14 +--- Classes/Domain/Model/Template.php | 2 - .../Domain/Repository/AbstractRepository.php | 4 +- Classes/Domain/Repository/MailRepository.php | 1 - .../Domain/Repository/TemplateRepository.php | 1 - .../Service/FormhandlerFinisherService.php | 12 +-- Classes/Service/MailTemplateService.php | 23 +++--- Classes/Service/TypoScriptSettingsService.php | 2 +- Classes/Session/PhpSession.php | 4 +- Classes/ViewHelpers/AbstractViewHelper.php | 24 +----- Classes/ViewHelpers/AddCssFileViewHelper.php | 49 ------------ .../Be/Menus/ActionMenuItemViewHelper.php | 54 +++++++------- .../Menus/ActionMenuOptionGroupViewHelper.php | 2 +- Classes/ViewHelpers/ExtendedIfViewHelper.php | 73 ++++++++---------- .../InlineLanguageLabelsViewHelper.php | 74 ------------------- .../TCA/tx_sgmail_domain_model_mail.php | 3 +- .../TCA/tx_sgmail_domain_model_template.php | 7 +- Configuration/TypoScript/constants.ts | 1 - Configuration/TypoScript/setup.ts | 16 ++-- Resources/Private/Language/de.locallang.xlf | 6 +- Resources/Private/Language/locallang.xlf | 3 - Resources/Private/Layouts/Default.html | 9 +-- Resources/Private/Templates/Mail/Index.html | 3 +- ext_tables.php | 39 ++++------ 25 files changed, 115 insertions(+), 314 deletions(-) delete mode 100644 Classes/ViewHelpers/AddCssFileViewHelper.php delete mode 100644 Classes/ViewHelpers/InlineLanguageLabelsViewHelper.php diff --git a/Classes/Command/SendMailCommandController.php b/Classes/Command/SendMailCommandController.php index d2fcef46..95ca7c49 100644 --- a/Classes/Command/SendMailCommandController.php +++ b/Classes/Command/SendMailCommandController.php @@ -57,7 +57,6 @@ class SendMailCommandController extends CommandController { $mailsToSend = $this->mailRepository->findMailsToSend($sendCount); foreach ($mailsToSend as $mailToSend) { /** @var Mail $mailToSend */ - $fromAddress = $mailToSend->getFromAddress(); $toAddress = $mailToSend->getToAddress(); $ccAddresses = GeneralUtility::trimExplode(',', $mailToSend->getCcAddresses()); @@ -88,5 +87,3 @@ class SendMailCommandController extends CommandController { $this->persistenceManager->persistAll(); } } - -?> diff --git a/Classes/Controller/MailController.php b/Classes/Controller/MailController.php index 620ccbe0..9e826c54 100644 --- a/Classes/Controller/MailController.php +++ b/Classes/Controller/MailController.php @@ -339,21 +339,12 @@ class MailController extends ActionController { public function sendTestMailAction( $emailAddress, $selectedExtensionKey, $selectedTemplateKey, $selectedLanguageLeft, $selectedLanguageRight ) { - - if (!filter_var($this->settings['mail']['test']['from'], FILTER_VALIDATE_EMAIL)) { - $message = LocalizationUtility::translate('backend.invalid_test_email', 'sg_mail'); - $this->addFlashMessage($message, '', FlashMessage::ERROR); - - $arguments = $this->request->getArguments(); - $this->redirect('index', NULL, NULL, $arguments); - } - $objectManager = GeneralUtility::makeInstance(ObjectManager::class); /** @var \SGalinski\SgMail\Service\MailTemplateService $mailTemplateService */ $mailTemplateService = $objectManager->get(MailTemplateService::class); $mailTemplateService->setLanguage($selectedLanguageLeft); $mailTemplateService->setToAddresses($emailAddress); - $mailTemplateService->setFromAddress($this->settings['mail']['test']['from']); + $mailTemplateService->setFromAddress('noreply@example.org'); $mailTemplateService->setTemplateName($selectedTemplateKey); $mailTemplateService->setExtensionKey($selectedExtensionKey); $mailIsSend = $mailTemplateService->sendEmail($this->settings['mail']['test']['subject'], TRUE); @@ -363,7 +354,7 @@ class MailController extends ActionController { $mailTemplateService = $objectManager->get(MailTemplateService::class); $mailTemplateService->setLanguage($selectedLanguageRight); $mailTemplateService->setToAddresses($emailAddress); - $mailTemplateService->setFromAddress($this->settings['mail']['test']['from']); + $mailTemplateService->setFromAddress('noreply@example.org'); $mailTemplateService->setTemplateName($selectedTemplateKey); $mailTemplateService->setExtensionKey($selectedExtensionKey); $mailIsSend = $mailTemplateService->sendEmail($this->settings['mail']['test']['subject'], TRUE); @@ -379,6 +370,5 @@ class MailController extends ActionController { $arguments = $this->request->getArguments(); $this->redirect('index', NULL, NULL, $arguments); - } } diff --git a/Classes/Domain/Model/Template.php b/Classes/Domain/Model/Template.php index 483770ac..f5237f51 100644 --- a/Classes/Domain/Model/Template.php +++ b/Classes/Domain/Model/Template.php @@ -32,7 +32,6 @@ use TYPO3\CMS\Extbase\DomainObject\AbstractEntity; * Template domain model */ class Template extends AbstractEntity { - /** * @var string */ @@ -127,5 +126,4 @@ class Template extends AbstractEntity { public function setContent($content) { $this->content = $content; } - } diff --git a/Classes/Domain/Repository/AbstractRepository.php b/Classes/Domain/Repository/AbstractRepository.php index 848541a6..162c7b80 100644 --- a/Classes/Domain/Repository/AbstractRepository.php +++ b/Classes/Domain/Repository/AbstractRepository.php @@ -5,7 +5,7 @@ namespace SGalinski\SgMail\Domain\Repository; /*************************************************************** * Copyright notice * - * (c) sgalinski Internet Services (http://www.sgalinski.de) + * (c) sgalinski Internet Services (https://www.sgalinski.de) * * All rights reserved * @@ -78,5 +78,3 @@ abstract class AbstractRepository extends Repository { return $statement; } } - -?> diff --git a/Classes/Domain/Repository/MailRepository.php b/Classes/Domain/Repository/MailRepository.php index 05674977..7ee93cfd 100644 --- a/Classes/Domain/Repository/MailRepository.php +++ b/Classes/Domain/Repository/MailRepository.php @@ -28,7 +28,6 @@ namespace SGalinski\SgMail\Domain\Repository; use TYPO3\CMS\Extbase\Persistence\Generic\Query; use TYPO3\CMS\Extbase\Persistence\QueryResultInterface; -use TYPO3\CMS\Extbase\Persistence\Repository; /** * Repository for the Mail object diff --git a/Classes/Domain/Repository/TemplateRepository.php b/Classes/Domain/Repository/TemplateRepository.php index 481b4ffb..e364f9d1 100644 --- a/Classes/Domain/Repository/TemplateRepository.php +++ b/Classes/Domain/Repository/TemplateRepository.php @@ -33,7 +33,6 @@ use TYPO3\CMS\Extbase\Persistence\QueryResultInterface; * Repository for the Template object */ class TemplateRepository extends AbstractRepository { - /** * @param string $extensionKey * @param string $templateName diff --git a/Classes/Service/FormhandlerFinisherService.php b/Classes/Service/FormhandlerFinisherService.php index b866054b..d60eaf4a 100644 --- a/Classes/Service/FormhandlerFinisherService.php +++ b/Classes/Service/FormhandlerFinisherService.php @@ -1,10 +1,6 @@ <?php -namespace SGalinski\SgMail\Service; -use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Extbase\Object\ObjectManager; -use TYPO3\CMS\Lang\LanguageService; -use Typoheads\Formhandler\Finisher\AbstractFinisher; +namespace SGalinski\SgMail\Service; /*************************************************************** * Copyright notice @@ -30,6 +26,11 @@ use Typoheads\Formhandler\Finisher\AbstractFinisher; * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ +use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Extbase\Object\ObjectManager; +use TYPO3\CMS\Lang\LanguageService; +use Typoheads\Formhandler\Finisher\AbstractFinisher; + /** * Class FormhandlerFinisherService * @@ -94,5 +95,4 @@ class FormhandlerFinisherService extends AbstractFinisher { public function validateConfig() { parent::validateConfig(); } - } diff --git a/Classes/Service/MailTemplateService.php b/Classes/Service/MailTemplateService.php index 31e0559a..1a2ff5f5 100644 --- a/Classes/Service/MailTemplateService.php +++ b/Classes/Service/MailTemplateService.php @@ -2,14 +2,6 @@ namespace SGalinski\SgMail\Service; -use SGalinski\SgMail\Domain\Model\Mail; -use SGalinski\SgMail\Domain\Model\Template; -use SGalinski\SgMail\Domain\Repository\MailRepository; -use TYPO3\CMS\Core\Mail\MailMessage; -use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Extbase\Object\ObjectManager; -use TYPO3\CMS\Fluid\View\StandaloneView; - /*************************************************************** * Copyright notice * @@ -34,6 +26,14 @@ use TYPO3\CMS\Fluid\View\StandaloneView; * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ +use SGalinski\SgMail\Domain\Model\Mail; +use SGalinski\SgMail\Domain\Model\Template; +use SGalinski\SgMail\Domain\Repository\MailRepository; +use TYPO3\CMS\Core\Mail\MailMessage; +use TYPO3\CMS\Core\Utility\GeneralUtility; +use TYPO3\CMS\Extbase\Object\ObjectManager; +use TYPO3\CMS\Fluid\View\StandaloneView; + /** * MailTemplateService */ @@ -168,10 +168,9 @@ class MailTemplateService { * @param string $templatePath * @param string $description * @param array $markers - * @return string + * @return void */ public static function registerTemplate($extension, $templateName, $templatePath, $description, array $markers) { - MailTemplateService::$registerArray[$extension][$templateName] = [ 'templatePath' => $templatePath, 'description' => $description, @@ -198,7 +197,6 @@ class MailTemplateService { * @return boolean email was sent or added to mail queue successfully? */ public function sendEmail($subject = '', $isPreview = FALSE) { - /** @var Template $template */ $template = $this->templateRepository->findTemplate( $this->extensionKey, $this->templateName, $this->language @@ -286,7 +284,7 @@ class MailTemplateService { /** * @param array $registerArray - * @return MailTemplateService + * @return void */ public static function setRegisterArray(array $registerArray) { self::$registerArray = $registerArray; @@ -395,5 +393,4 @@ class MailTemplateService { $this->priority = $priority; return $this; } - } diff --git a/Classes/Service/TypoScriptSettingsService.php b/Classes/Service/TypoScriptSettingsService.php index e10ac5fb..b4d5ad1f 100644 --- a/Classes/Service/TypoScriptSettingsService.php +++ b/Classes/Service/TypoScriptSettingsService.php @@ -5,7 +5,7 @@ namespace SGalinski\SgMail\Service; /*************************************************************** * Copyright notice * - * (c) sgalinski Internet Services (http://www.sgalinski.de) + * (c) sgalinski Internet Services (https://www.sgalinski.de) * * All rights reserved * diff --git a/Classes/Session/PhpSession.php b/Classes/Session/PhpSession.php index 58752013..6babbd78 100644 --- a/Classes/Session/PhpSession.php +++ b/Classes/Session/PhpSession.php @@ -5,7 +5,7 @@ namespace SGalinski\SgMail\Session; /*************************************************************** * Copyright notice * - * (c) sgalinski Internet Services (http://www.sgalinski.de) + * (c) sgalinski Internet Services (https://www.sgalinski.de) * * All rights reserved * @@ -122,5 +122,3 @@ class PhpSession implements SingletonInterface { unset($_SESSION[$this->sessionKey]); } } - -?> diff --git a/Classes/ViewHelpers/AbstractViewHelper.php b/Classes/ViewHelpers/AbstractViewHelper.php index c11c063c..448e63e0 100644 --- a/Classes/ViewHelpers/AbstractViewHelper.php +++ b/Classes/ViewHelpers/AbstractViewHelper.php @@ -5,7 +5,7 @@ namespace SGalinski\SgMail\ViewHelpers; /*************************************************************** * Copyright notice * - * (c) sgalinski Internet Services (http://www.sgalinski.de) + * (c) sgalinski Internet Services (https://www.sgalinski.de) * * All rights reserved * @@ -26,32 +26,12 @@ namespace SGalinski\SgMail\ViewHelpers; * This copyright notice MUST APPEAR in all copies of the script! ***************************************************************/ -use TYPO3\CMS\Core\Page\PageRenderer; use TYPO3\CMS\Fluid\ViewHelpers\Be\AbstractBackendViewHelper; /** * Abstract view helper */ class AbstractViewHelper extends AbstractBackendViewHelper { - /** - * Returns an instance of the page renderer - * - * @deprecated Implement the following migration if the extension just needs to support > 7.5. - * @return PageRenderer - */ - public function getPageRenderer() { -// Migration -// return $this->objectManager->get(\TYPO3\CMS\Core\Page\PageRenderer::class); - if (TYPO3_MODE === 'BE') { - $pageRenderer = $this->getDocInstance()->getPageRenderer(); - } else { - /** @noinspection PhpUndefinedMethodInspection */ - $pageRenderer = $GLOBALS['TSFE']->getPageRenderer(); - } - - return $pageRenderer; - } - /** * Returns the base url of the site * @@ -69,5 +49,3 @@ class AbstractViewHelper extends AbstractBackendViewHelper { return $baseUrl; } } - -?> diff --git a/Classes/ViewHelpers/AddCssFileViewHelper.php b/Classes/ViewHelpers/AddCssFileViewHelper.php deleted file mode 100644 index 7f9d591b..00000000 --- a/Classes/ViewHelpers/AddCssFileViewHelper.php +++ /dev/null @@ -1,49 +0,0 @@ -<?php - -namespace SGalinski\SgMail\ViewHelpers; - - /*************************************************************** - * Copyright notice - * - * (c) sgalinski Internet Services (http://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! - ***************************************************************/ - -/** - * View helper to add custom css files - * - * Example: - * {namespace lfe=SGalinski\Lfeditor\ViewHelpers} - * <lfe:addCssFile cssFile="{f:uri.resource(path: 'StyleSheets/Frontend.css')}" /> - */ -class AddCssFileViewHelper extends AbstractViewHelper { - /** - * Adds a custom css file - * - * @param string $cssFile - * @return void - */ - public function render($cssFile) { - $cssFile = (TYPO3_MODE === 'FE' ? $this->getBaseUrl() : '') . $cssFile; - $this->getPageRenderer()->addCssFile($cssFile, 'stylesheet', 'all', '', FALSE); - } -} - -?> diff --git a/Classes/ViewHelpers/Be/Menus/ActionMenuItemViewHelper.php b/Classes/ViewHelpers/Be/Menus/ActionMenuItemViewHelper.php index 86687d64..55c0d12f 100644 --- a/Classes/ViewHelpers/Be/Menus/ActionMenuItemViewHelper.php +++ b/Classes/ViewHelpers/Be/Menus/ActionMenuItemViewHelper.php @@ -2,29 +2,32 @@ namespace SGalinski\SgMail\ViewHelpers\Be\Menus; - /*************************************************************** - * 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! - ***************************************************************/ +/*************************************************************** + * 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! + ***************************************************************/ + +use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper; + /** * Class ActionMenuItemViewHelper * @@ -33,7 +36,7 @@ namespace SGalinski\SgMail\ViewHelpers\Be\Menus; * * @package SGalinski\SgMail\ViewHelpers\Be\Menus */ -class ActionMenuItemViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper { +class ActionMenuItemViewHelper extends AbstractTagBasedViewHelper { /** * @var string */ @@ -53,9 +56,6 @@ class ActionMenuItemViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\Abstract $uriBuilder = $this->controllerContext->getUriBuilder(); $uri = $uriBuilder->reset()->uriFor($action, $arguments, $controller); $this->tag->addAttribute('value', $uri); - $currentRequest = $this->controllerContext->getRequest(); - $currentController = $currentRequest->getControllerName(); - $currentAction = $currentRequest->getControllerActionName(); $this->tag->setContent($label); return $this->tag->render(); } diff --git a/Classes/ViewHelpers/Be/Menus/ActionMenuOptionGroupViewHelper.php b/Classes/ViewHelpers/Be/Menus/ActionMenuOptionGroupViewHelper.php index 986a247c..64060974 100644 --- a/Classes/ViewHelpers/Be/Menus/ActionMenuOptionGroupViewHelper.php +++ b/Classes/ViewHelpers/Be/Menus/ActionMenuOptionGroupViewHelper.php @@ -5,7 +5,7 @@ namespace SGalinski\SgMail\ViewHelpers\Be\Menus; /*************************************************************** * Copyright notice * - * (c) sgalinski Internet Services (http://www.sgalinski.de) + * (c) sgalinski Internet Services (https://www.sgalinski.de) * * All rights reserved * diff --git a/Classes/ViewHelpers/ExtendedIfViewHelper.php b/Classes/ViewHelpers/ExtendedIfViewHelper.php index 10a30f21..e350a832 100644 --- a/Classes/ViewHelpers/ExtendedIfViewHelper.php +++ b/Classes/ViewHelpers/ExtendedIfViewHelper.php @@ -5,7 +5,7 @@ namespace SGalinski\SgMail\ViewHelpers; /*************************************************************** * Copyright notice * - * (c) sgalinski Internet Services (http://www.sgalinski.de) + * (c) sgalinski Internet Services (https://www.sgalinski.de) * * All rights reserved * @@ -38,35 +38,36 @@ class ExtendedIfViewHelper extends AbstractConditionViewHelper { */ public function initializeArguments() { parent::initializeArguments(); - $this->registerArgument('condition', 'boolean', 'Condition expression conforming to Fluid boolean rules', FALSE, FALSE); - $this->registerArgument('or', 'boolean', 'Condition expression conforming to Fluid boolean rules', FALSE, FALSE); - $this->registerArgument('or2', 'boolean', 'Condition expression conforming to Fluid boolean rules', FALSE, FALSE); - $this->registerArgument('or3', 'boolean', 'Condition expression conforming to Fluid boolean rules', FALSE, FALSE); - $this->registerArgument('or4', 'boolean', 'Condition expression conforming to Fluid boolean rules', FALSE, FALSE); - $this->registerArgument('and', 'boolean', 'Condition expression conforming to Fluid boolean rules', FALSE, TRUE); - $this->registerArgument('and2', 'boolean', 'Condition expression conforming to Fluid boolean rules', FALSE, TRUE); - $this->registerArgument('and3', 'boolean', 'Condition expression conforming to Fluid boolean rules', FALSE, TRUE); - $this->registerArgument('and4', 'boolean', 'Condition expression conforming to Fluid boolean rules', FALSE, TRUE); - $this->registerArgument('negate', 'boolean', 'Condition expression conforming to Fluid boolean rules', FALSE, FALSE); - } - /** - * renders <f:then> child if $condition or $or is true, otherwise renders <f:else> child. - * - * @return string - */ - public function render() { - if ($this->evaluateConditionFunctionExists()) { - return parent::render(); - } - - // @todo Remove the following part if only > 7.5 support. - $conditionResult = ($this->arguments['condition'] || $this->arguments['or'] || $this->arguments['or2'] || $this->arguments['or3'] || $this->arguments['or4']) - && $this->arguments['and'] && $this->arguments['and2'] && $this->arguments['and3'] && $this->arguments['and4']; - if ($this->arguments['negate'] ? !$conditionResult : $conditionResult) { - return $this->renderThenChild(); - } else { - return $this->renderElseChild(); - } + $this->registerArgument( + 'condition', 'boolean', 'Condition expression conforming to Fluid boolean rules', FALSE, FALSE + ); + $this->registerArgument( + 'or', 'boolean', 'Condition expression conforming to Fluid boolean rules', FALSE, FALSE + ); + $this->registerArgument( + 'or2', 'boolean', 'Condition expression conforming to Fluid boolean rules', FALSE, FALSE + ); + $this->registerArgument( + 'or3', 'boolean', 'Condition expression conforming to Fluid boolean rules', FALSE, FALSE + ); + $this->registerArgument( + 'or4', 'boolean', 'Condition expression conforming to Fluid boolean rules', FALSE, FALSE + ); + $this->registerArgument( + 'and', 'boolean', 'Condition expression conforming to Fluid boolean rules', FALSE, TRUE + ); + $this->registerArgument( + 'and2', 'boolean', 'Condition expression conforming to Fluid boolean rules', FALSE, TRUE + ); + $this->registerArgument( + 'and3', 'boolean', 'Condition expression conforming to Fluid boolean rules', FALSE, TRUE + ); + $this->registerArgument( + 'and4', 'boolean', 'Condition expression conforming to Fluid boolean rules', FALSE, TRUE + ); + $this->registerArgument( + 'negate', 'boolean', 'Condition expression conforming to Fluid boolean rules', FALSE, FALSE + ); } /** @@ -89,16 +90,4 @@ class ExtendedIfViewHelper extends AbstractConditionViewHelper { return isset($arguments['negate']) && $arguments['negate'] ? !$conditionResult : $conditionResult; } - - /** - * Returns true, if the function evaluateCondition exists in the AbstractConditionViewHelper class. - * - * @deprecated Remove this function if only > 7.5 support. - * @return boolean - */ - protected function evaluateConditionFunctionExists() { - return method_exists('TYPO3\CMS\Fluid\Core\ViewHelper\AbstractConditionViewHelper', 'evaluateCondition'); - } } - -?> diff --git a/Classes/ViewHelpers/InlineLanguageLabelsViewHelper.php b/Classes/ViewHelpers/InlineLanguageLabelsViewHelper.php deleted file mode 100644 index debfd9c4..00000000 --- a/Classes/ViewHelpers/InlineLanguageLabelsViewHelper.php +++ /dev/null @@ -1,74 +0,0 @@ -<?php - -namespace SGalinski\SgMail\ViewHelpers; - -/*************************************************************** - * Copyright notice - * - * (c) sgalinski Internet Services (http://www.sgalinski.de) - * - * All rights reserved - * - * This script is part of the AY project. The AY 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 TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Extbase\Utility\LocalizationUtility; - -/** - * View helper to render language labels to - * json array to be used in js applications. - * - * Renders to AY.lang.'extension name' object - * - * Example: - * {namespace rs=SGalinski\RsEvents\ViewHelpers} - * <rs:inlineLanguageLabels labels="label01,label02" /> - */ -class InlineLanguageLabelsViewHelper extends AbstractViewHelper { - /** - * Renders the required javascript to make the language labels available - * - * @param string $labels Comma separated list of label keys to include - * @param boolean $htmlEscape - * @return string - */ - public function render($labels = '', $htmlEscape = FALSE) { - $extensionName = $this->controllerContext->getRequest()->getControllerExtensionName(); - - $labels = GeneralUtility::trimExplode(',', $labels, TRUE); - $languageArray = array(); - foreach ($labels as $key) { - $value = LocalizationUtility::translate($key, $extensionName); - $languageArray[$key] = ($htmlEscape ? htmlentities($value) : $value); - } - - return ' - <script type="text/javascript"> - var AY = AY || {}; - AY.lang = AY.lang || {}; - AY.lang.' . $extensionName . ' = AY.lang.' . $extensionName . ' || {}; - var languageLabels = ' . json_encode($languageArray) . '; - for (label in languageLabels) { - AY.lang.' . $extensionName . '[label] = languageLabels[label]; - } - </script> - '; - } -} - -?> diff --git a/Configuration/TCA/tx_sgmail_domain_model_mail.php b/Configuration/TCA/tx_sgmail_domain_model_mail.php index 89959105..eb1c0591 100644 --- a/Configuration/TCA/tx_sgmail_domain_model_mail.php +++ b/Configuration/TCA/tx_sgmail_domain_model_mail.php @@ -40,8 +40,7 @@ return [ 'disabled' => 'hidden', ], 'default_sortby' => 'ORDER BY sent ASC, priority DESC', - 'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('sg_mail') . - 'Resources/Public/Icons/ModuleIconTCA.svg' + 'iconfile' => 'EXT:sg_mail/Resources/Public/Icons/ModuleIconTCA.svg' ], 'interface' => [ 'showRecordFieldList' => 'hidden, mail_subject, mail_body, to_address, from_address, sent, priority', diff --git a/Configuration/TCA/tx_sgmail_domain_model_template.php b/Configuration/TCA/tx_sgmail_domain_model_template.php index 5d01b7d1..1f92ee8c 100644 --- a/Configuration/TCA/tx_sgmail_domain_model_template.php +++ b/Configuration/TCA/tx_sgmail_domain_model_template.php @@ -27,8 +27,8 @@ return [ 'ctrl' => [ 'title' => 'LLL:EXT:sg_mail/Resources/Private/Language/locallang_db.xlf:tx_sgmail_domain_model_template', - 'label' => 'template', - 'label_alt' => '', + 'label' => 'extension_key', + 'label_alt' => 'template_name', 'label_alt_force' => TRUE, 'tstamp' => 'tstamp', 'crdate' => 'crdate', @@ -40,8 +40,7 @@ return [ 'disabled' => 'hidden', ], 'default_sortby' => 'ORDER BY extension_key ASC, template_name ASC', - 'iconfile' => \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extRelPath('sg_mail') . - 'Resources/Public/Icons/ModuleIconTCA.svg' + 'iconfile' => 'EXT:sg_mail/Resources/Public/Icons/ModuleIconTCA.svg' ], 'interface' => [ 'showRecordFieldList' => 'extension_key, template_name, language, content, subject', diff --git a/Configuration/TypoScript/constants.ts b/Configuration/TypoScript/constants.ts index 9077f77f..e3c15db4 100644 --- a/Configuration/TypoScript/constants.ts +++ b/Configuration/TypoScript/constants.ts @@ -3,6 +3,5 @@ plugin.tx_sgmail { templateRootPath = EXT:sg_mail/Resources/Private/Templates/ partialRootPath = EXT:sg_mail/Resources/Private/Partials/ layoutRootPath = EXT:sg_mail/Resources/Private/Layouts/ - publicRootPath = EXT:sg_mail/Resources/Public/ } } diff --git a/Configuration/TypoScript/setup.ts b/Configuration/TypoScript/setup.ts index 35f9cf5d..6847a026 100644 --- a/Configuration/TypoScript/setup.ts +++ b/Configuration/TypoScript/setup.ts @@ -1,21 +1,23 @@ module.tx_sgmail { view { - templateRootPath = {$plugin.tx_sgcmail.view.templateRootPath} - partialRootPath = {$plugin.tx_sgcmail.view.partialRootPath} - layoutRootPath = {$plugin.tx_sgcmail.view.layoutRootPath} + templateRootPath = {$plugin.tx_sgmail.view.templateRootPath} + partialRootPath = {$plugin.tx_sgmail.view.partialRootPath} + layoutRootPath = {$plugin.tx_sgmail.view.layoutRootPath} } settings { mail { - test.from = - test.subject = + # default from address + default.from = noreply@example.org - default.from = + # comma-separated list of additional bcc adresses default.bcc = + + # comma-separated list of additional cc adresses default.cc = } + # default template language templateDefaultLanguage = en - template.filename = mail_template.html } } diff --git a/Resources/Private/Language/de.locallang.xlf b/Resources/Private/Language/de.locallang.xlf index 1f7086e5..f0af5920 100644 --- a/Resources/Private/Language/de.locallang.xlf +++ b/Resources/Private/Language/de.locallang.xlf @@ -25,10 +25,6 @@ <source>There was an error when sending the Preview Email. Please check your Configuration</source> <target>Ein Fehler ist aufgetreten. Bitte überprüfen Sie die Konfiguration</target> </trans-unit> - <trans-unit id="backend.invalid_test_email" approved="yes"> - <source>The Test Email Address in your Configuration is invalid.</source> - <target>Die E-Mail Addresse in der Konfiguration ist nicht gültig.</target> - </trans-unit> <trans-unit id="backend.marker" approved="yes"> <source>Marker</source> <target>Marker</target> @@ -83,4 +79,4 @@ </trans-unit> </body> </file> -</xliff> \ No newline at end of file +</xliff> diff --git a/Resources/Private/Language/locallang.xlf b/Resources/Private/Language/locallang.xlf index 20f05a3c..e06274ff 100644 --- a/Resources/Private/Language/locallang.xlf +++ b/Resources/Private/Language/locallang.xlf @@ -21,9 +21,6 @@ <trans-unit id="backend.failure_mail"> <source>There was an error when sending the Preview Email. Please check your Configuration</source> </trans-unit> - <trans-unit id="backend.invalid_test_email"> - <source>The Test Email Address in your Configuration is invalid.</source> - </trans-unit> <trans-unit id="backend.marker"> <source>Marker</source> </trans-unit> diff --git a/Resources/Private/Layouts/Default.html b/Resources/Private/Layouts/Default.html index fe442b52..f61f7bce 100644 --- a/Resources/Private/Layouts/Default.html +++ b/Resources/Private/Layouts/Default.html @@ -1,16 +1,14 @@ {namespace sgm=SGalinski\SgMail\ViewHelpers} -<sgm:addCssFile cssFile="{f:uri.resource(path: 'StyleSheets/backend.css')}" /> -<f:be.container enableClickMenu="FALSE" loadExtJs="FALSE"> + +<f:be.container enableClickMenu="FALSE" loadExtJs="FALSE" includeCssFiles="{0: '{f:uri.resource(path: \'StyleSheets/backend.css\')}'}"> <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"> <div class="module-docheader-bar-column-left"> <div class="btn-toolbar" role="toolbar"> - <f:be.menus.actionMenu> <f:for each="{templates}" as="template" key="extensionKey"> <sgm:be.menus.actionMenuOptionGroup label="{extensionKey}"> - <f:for each="{template}" as="currentTemplate" key="templateKey"> <sgm:extendedIf condition="{selectedTemplateKey} == {templateKey}" and="{selectedExtensionKey} == {extensionKey}"> @@ -29,7 +27,6 @@ </f:else> </sgm:extendedIf> </f:for> - </sgm:be.menus.actionMenuOptionGroup> </f:for> </f:be.menus.actionMenu> @@ -55,5 +52,3 @@ </div> </div> </f:be.container> - - diff --git a/Resources/Private/Templates/Mail/Index.html b/Resources/Private/Templates/Mail/Index.html index d58ddcbd..52da4b02 100644 --- a/Resources/Private/Templates/Mail/Index.html +++ b/Resources/Private/Templates/Mail/Index.html @@ -1,8 +1,10 @@ {namespace sgm=SGalinski\SgMail\ViewHelpers} <f:layout name="Default" /> + <f:section name="iconButtons"> </f:section> + <f:section name="main"> <f:flashMessages renderMode="div" /> <div class="col-md-12"> @@ -111,5 +113,4 @@ </div> </div> </f:form> - </f:section> diff --git a/ext_tables.php b/ext_tables.php index d49d805d..2978290a 100644 --- a/ext_tables.php +++ b/ext_tables.php @@ -4,27 +4,20 @@ if (!defined('TYPO3_MODE')) { die('Access denied.'); } -if (TYPO3_MODE === 'BE') { - \TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule( - 'SGalinski.sg_mail', - 'web', - 'Mail', - '', - [ - 'Mail' => 'index, save, sendTestMail', - ], - [ - 'access' => 'admin,user,group', - 'icon' => 'EXT:sg_mail/Resources/Public/Icons/ModuleIcon.svg', - 'labels' => 'LLL:EXT:sg_mail/Resources/Private/Language/locallang.xlf', - ] - ); +\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule( + 'SGalinski.sg_mail', + 'web', + 'Mail', + '', + [ + 'Mail' => 'index, save, sendTestMail', + ], + [ + 'access' => 'admin,user,group', + 'icon' => 'EXT:sg_mail/Resources/Public/Icons/ModuleIcon.svg', + 'labels' => 'LLL:EXT:sg_mail/Resources/Private/Language/locallang.xlf', + ] +); - $tables = [ - 'tx_sgmail_domain_model_mail', - ]; - - foreach ($tables as $table) { - \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages($table); - } -} +\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages('tx_sgmail_domain_model_mail'); +\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages('tx_sgmail_domain_model_template'); -- GitLab