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

[TASK] Changed UI, old registry with new options like language templates

parent 4cf8a87e
No related branches found
No related tags found
1 merge request!1Feature sg mail
Showing
with 396 additions and 368 deletions
......@@ -26,7 +26,7 @@ namespace SGalinski\SgMail\Controller;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
use SGalinski\SgMail\Service\MailTemplateService;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
/**
......@@ -38,36 +38,26 @@ class MailController extends ActionController {
*
*/
public function indexAction() {
$path = ExtensionManagementUtility::extPath(
'sg_mail'
) . 'Configuration/Templates/';
$results = scandir($path);
$this->view->assign('templates', MailTemplateService::getRegisterArray());
$extensions = [];
foreach ($results as $result) {
if ($result == '.' || $result == '..') {
continue;
}
is_dir($path . $result) ? $extensions[] = $result : NULL;
if ($this->request->hasArgument('key')) {
$extensionKey = $this->request->getArgument('key');
} else {
reset(MailTemplateService::getRegisterArray());
$extensionKey = key(MailTemplateService::getRegisterArray());
}
$this->view->assign('extensions', $extensions);
if (key_exists($extensionKey, MailTemplateService::getRegisterArray())) {
$this->view->assign('selection', MailTemplateService::getRegisterArray()[$extensionKey]);
}
}
/**
*
*
*/
public function showTemplatesAction() {
$extensionKey = $this->request->getArgument('ext_key');
public function showTemplateAction() {
$extPath = ExtensionManagementUtility::extPath(
'sg_mail'
) . 'Configuration/Templates/' . $extensionKey . '/';
$files = glob($extPath . '*.html');
$this->view->assign('templates', array_map('basename', $files));
$this->view->assign('extensionKey', $extensionKey);
}
/**
......@@ -75,19 +65,13 @@ class MailController extends ActionController {
*
*/
public function showMarkerAction() {
$extensionKey = $this->request->getArgument('extensionKey');
$template = $this->request->getArgument('template');
$templateContent = file_get_contents(
ExtensionManagementUtility::extPath(
'sg_mail'
) . 'Configuration/Templates/' . $extensionKey . '/' . $template
);
$marker = preg_match_all('/(?<={)[^}]+(?=})/', $templateContent, $matches) ? $matches[0] : [];
$comments = preg_match_all('/<!--(.|\s)*?-->/', $templateContent, $matches) ? $matches[0] : [];
}
$this->view->assign('marker', $marker);
$this->view->assign('comments', $comments);
/**
*
* @param array $marker
*/
public function saveMarkerAction(array $marker = []) {
}
}
......@@ -2,30 +2,30 @@
namespace SGalinski\SgMail\Service;
/***************************************************************
* 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\Core\Utility\ExtensionManagementUtility;
/***************************************************************
* 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\Core\SingletonInterface;
/**
* MailTemplateService
......@@ -33,24 +33,30 @@ use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
class MailTemplateService {
/**
* Holds default values for all Templates and their markers
* @var array
*/
protected $templateConfig = [];
private static $registerArray = [];
/**
* @var array
* @param string $extensionKey
* @param string $template
* @param array $marker
* @return string
*/
public static $registerArray = [];
public static function registerTemplate($extension, $templateName, $templateFiles, $description, array $marker) {
MailTemplateService::$registerArray[$templateName] = [
'description' => $description,
'templateFiles' => $templateFiles,
'marker' => $marker,
'extension' => $extension
];
}
/**
* @param $extensionKey
* @param $template
* @return string
* @return array
*/
public static function registerTemplate($extensionKey) {
if (!array_key_exists($extensionKey, MailTemplateService::$registerArray)) {
MailTemplateService::$registerArray[$extensionKey];
}
public static function getRegisterArray() {
return self::$registerArray;
}
}
<?php
namespace SGalinski\SgMail\Domain\Repository;
namespace SGalinski\SgMail\ViewHelpers;
/***************************************************************
* Copyright notice
*
* (c) sgalinski Internet Services (https://www.sgalinski.de)
* (c) sgalinski Internet Services (http://www.sgalinski.de)
*
* All rights reserved
*
......@@ -26,39 +26,48 @@ namespace SGalinski\SgMail\Domain\Repository;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use TYPO3\CMS\Core\Database\DatabaseConnection;
use TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings;
use TYPO3\CMS\Extbase\Persistence\Repository;
use TYPO3\CMS\Core\Page\PageRenderer;
use TYPO3\CMS\Fluid\ViewHelpers\Be\AbstractBackendViewHelper;
/**
* The repository for RegisteredExtensions
* Abstract view helper
*/
class RegisteredTemplateRepository extends Repository {
class AbstractViewHelper extends AbstractBackendViewHelper {
/**
* Initializes the repository default settings
* Returns an instance of the page renderer
*
* @return void
* @deprecated Implement the following migration if the extension just needs to support > 7.5.
* @return PageRenderer
*/
public function initializeObject() {
/** @TODO removing this doesnt work. talk about it in meeting */
/** @var $querySettings Typo3QuerySettings */
$querySettings = $this->objectManager->get(Typo3QuerySettings::class);
$querySettings->setRespectStoragePage(FALSE);
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();
}
$this->setDefaultQuerySettings($querySettings);
return $pageRenderer;
}
/**
* @param $registeredTemplate
* Returns the base url of the site
*
* Note: Works only in frontend mode
*
* @return string
*/
public static function addTemplate($extensionKey, $template) {
/** @var $databaseConnection DatabaseConnection */
$databaseConnection = $GLOBALS['TYPO3_DB'];
public function getBaseUrl() {
if ($GLOBALS['TSFE']->absRefPrefix !== '') {
$baseUrl = $GLOBALS['TSFE']->absRefPrefix;
} else {
$baseUrl = $GLOBALS['TSFE']->baseUrl;
}
$fieldsValues = [
'ext_key' => $extensionKey, 'template' => $template, 'mail_key' => uniqid()
];
$databaseConnection->exec_INSERTquery($table, $fieldsValues);
return $baseUrl;
}
}
?>
<?php
namespace SGalinski\SgMail\Domain\Model;
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
namespace SGalinski\SgMail\ViewHelpers\Be\Menus;
/***************************************************************
* Copyright notice
*
* (c) sgalinski Internet Services (https://www.sgalinski.de)
* (c) sgalinski Internet Services (http://www.sgalinski.de)
*
* All rights reserved
*
......@@ -28,72 +26,34 @@ use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper;
/**
* The RegisteredTemplate Model
* Class ActionMenuOptionGroupViewHelper
*/
class RegisteredTemplate extends AbstractEntity {
/**
* extKey
*
* @var string
*/
protected $extKey;
class ActionMenuOptionGroupViewHelper extends AbstractTagBasedViewHelper {
/**
* template
*
* @var string
*/
protected $template;
protected $tagName = 'optgroup';
/**
* mailKey
* Initialize
*
* @var string
*/
protected $mailKey;
/**
* @return string
*/
public function getExtKey() {
return $this->extKey;
}
/**
* @param string $extKey
*/
public function setExtKey($extKey) {
$this->extKey = $extKey;
}
/**
* @return string
*/
public function getTemplate() {
return $this->template;
}
/**
* @param string $template
* @return void
*/
public function setTemplate($template) {
$this->template = $template;
public function initializeArguments() {
parent::initializeArguments();
$this->registerUniversalTagAttributes();
$this->registerTagAttribute('label', 'string', 'Specifies a label for an option-group');
$this->registerTagAttribute('disabled', 'string', 'Specifies that an option-group should be disabled');
}
/**
* @return string
*/
public function getMailKey() {
return $this->mailKey;
}
/**
* @param string $mailKey
*/
public function setMailKey($mailKey) {
$this->mailKey = $mailKey;
public function render() {
$this->tag->setContent($this->renderChildren());
return $this->tag->render();
}
}
<?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!
***************************************************************/
use TYPO3\CMS\Fluid\Core\ViewHelper\AbstractConditionViewHelper;
/**
* ExtendedIfViewHelper
*/
class ExtendedIfViewHelper extends AbstractConditionViewHelper {
/**
* Initializes the "then" and "else" arguments
*/
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 method decides if the condition is TRUE or FALSE. It can be overriden in extending viewhelpers to adjust functionality.
*
* @param array $arguments ViewHelper arguments to evaluate the condition for this ViewHelper, allows for flexiblity in overriding this method.
* @return bool
*/
static protected function evaluateCondition($arguments = NULL) {
$conditionResult = (
isset($arguments['condition']) && $arguments['condition'] ||
isset($arguments['or']) && $arguments['or'] ||
isset($arguments['or2']) && $arguments['or2'] ||
isset($arguments['or3']) && $arguments['or3'] ||
isset($arguments['or4']) && $arguments['or4']
) && isset($arguments['and']) && $arguments['and'] &&
isset($arguments['and2']) && $arguments['and2'] &&
isset($arguments['and3']) && $arguments['and3'] &&
isset($arguments['and4']) && $arguments['and4'];
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');
}
}
?>
<?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>
';
}
}
?>
<?php
if (!defined('TYPO3_MODE')) {
die ('Access denied.');
}
return [
'ctrl' => [
'title' => 'LLL:EXT:sg_mail/Resources/Private/Language/locallang_db.xlf:tx_sg_mail_domain_model_registeredtemplate',
'label' => '',
'tstamp' => 'tstamp',
'crdate' => 'crdate',
'cruser_id' => 'cruser_id',
'dividers2tabs' => TRUE,
'versioningWS' => 2,
'versioning_followPages' => TRUE,
'languageField' => 'sys_language_uid',
'transOrigPointerField' => 'l10n_parent',
'transOrigDiffSourceField' => 'l10n_diffsource',
'delete' => 'deleted',
'enablecolumns' => [
'disabled' => 'hidden'
],
'searchFields' => 'ext_key, template, mail_key',
'iconfile' => 'EXT:sg_mail/Resources/Public/Icons/ModuleIcon.svg'
],
'interface' => [
'showRecordFieldList' => 'sys_language_uid, l10n_parent, l10n_diffsource, hidden, ext_key, template, mail_key',
],
'types' => [
'1' => ['showitem' => 'ext_key, template, mail_key, --div--;LLL:EXT:cms/locallang_ttc.xlf:tabs.access, hidden;;1;;, sys_language_uid;;6;;,'],
],
'palettes' => [
'1' => ['showitem' => 'ext_key, template, mail_key'],
'2' => ['showitem' => 'l10n_parent, l10n_diffsource,'],
],
'columns' => [
'sys_language_uid' => [
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.language',
'config' => [
'type' => 'select',
'foreign_table' => 'sys_language',
'foreign_table_where' => 'ORDER BY sys_language.title',
'items' => [
['LLL:EXT:lang/locallang_general.xlf:LGL.allLanguages', -1],
['LLL:EXT:lang/locallang_general.xlf:LGL.default_value', 0]
],
],
],
'l10n_parent' => [
'displayCond' => 'FIELD:sys_language_uid:>:0',
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.l18n_parent',
'config' => [
'type' => 'select',
'items' => [
['', 0],
],
'foreign_table' => 'tx_sg_mail_domain_model_registeredtemplate',
'foreign_table_where' => 'AND tx_sg_mail_domain_model_registeredtemplate.pid=###CURRENT_PID### AND tx_sg_mail_domain_model_registeredtemplate.sys_language_uid IN (-1,0)',
],
],
'l10n_diffsource' => [
'config' => [
'type' => 'passthrough',
],
],
't3ver_label' => [
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.versionLabel',
'config' => [
'type' => 'input',
'size' => 30,
'max' => 255,
]
],
'hidden' => [
'exclude' => 1,
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.hidden',
'config' => [
'type' => 'check',
],
],
'starttime' => [
'exclude' => 1,
'l10n_mode' => 'mergeIfNotBlank',
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.starttime',
'config' => [
'type' => 'input',
'size' => 13,
'max' => 20,
'eval' => 'datetime',
'checkbox' => 0,
'default' => 0,
'range' => [
'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y'))
],
],
],
'ext_key' => [
'exclude' => 1,
'l10n_mode' => 'mergeIfNotBlank',
'label' => 'LLL:EXT:lang/locallang_general.xlf:LGL.endtime',
'config' => [
'type' => 'input',
'size' => 13,
'max' => 20,
'eval' => 'datetime',
'checkbox' => 0,
'default' => 0,
'range' => [
'lower' => mktime(0, 0, 0, date('m'), date('d'), date('Y'))
],
],
],
'ext_key' => [
'exclude' => 1,
'label' => 'LLL:EXT:sg_mail/Resources/Private/Language/locallang_db.xlf:tx_sg_mail_domain_model_registeredtemplate.ext_key',
'config' => [
'type' => 'input',
'size' => 60,
'eval' => 'trim'
],
],
'template' => [
'exclude' => 1,
'label' => 'LLL:EXT:sg_mail/Resources/Private/Language/locallang_db.xlf:tx_sg_mail_domain_model_registeredtemplate.template',
'config' => [
'type' => 'text',
'cols' => 40,
'rows' => 8,
'eval' => 'trim'
]
],
'mail_key' => [
'exclude' => 1,
'label' => 'LLL:EXT:sg_mail/Resources/Private/Language/locallang_db.xlf:tx_sg_mail_domain_model_registeredtemplate.mail_key',
'config' => [
'type' => 'input',
'size' => 30,
'eval' => 'trim'
],
]
],
];
<!--this is the heading of the template-->
<h1>{heading}</h1>
<h1>{heading123}</h1>
{namespace sgm=SGalinski\SgMail\ViewHelpers}
<f:be.container enableClickMenu="FALSE" loadExtJs="FALSE">
<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="templateKey">
<sgm:be.menus.actionMenuOptionGroup label="{template.extension}">
<f:for each="{template.templateFiles}" as="langFileLabel" key="langFileOption">
<sgm:extendedIf condition="{template.extension} == {extensionSelection}"
and="{langFileOption} == {languageFileSelection}">
<f:then>
<f:be.menus.actionMenuItem label="{langFileLabel}"
controller="{controllerName}"
action="changeSelection"
arguments="{extensionSelection: extAddress, languageFileSelection: langFileOption}"
additionalAttributes="{selected: 'selected'}" />
</f:then>
<f:else>
<f:be.menus.actionMenuItem label="{langFileLabel}"
controller="{controllerName}"
action="changeSelection"
arguments="{extensionSelection: extAddress, languageFileSelection: langFileOption}" />
</f:else>
</sgm:extendedIf>
</f:for>
</sgm:be.menus.actionMenuOptionGroup>
</f:for>
</f:be.menus.actionMenu>
</div>
</div>
<div class="module-docheader-bar-column-right">
......@@ -23,7 +48,6 @@
<div id="typo3-docbody">
<div id="typo3-inner-docbody">
<f:render section="main" />
</div>
</div>
</div>
......
......@@ -4,12 +4,4 @@
</f:section>
<f:section name="main">
<f:flashMessages renderMode="div" />
<h3>Registered Extensions</h3>
<ul class="list-group">
<f:for each="{extensions}" as="extension">
<li class="list-group-item">
<f:link.action controller="Mail" action="showTemplates" arguments="{ext_key:'{extension}'}">{extension}</f:link.action>
</li>
</f:for>
</ul>
</f:section>
<f:layout name="Default" />
<f:section name="iconButtons">
&nbsp;
</f:section>
<f:section name="main">
<f:flashMessages renderMode="div" />
<ul class="list-group">
<f:for each="{marker}" as="currentMarker">
<li class="list-group-item">
{currentMarker}
</li>
</f:for>
</ul>
<ul class="list-group">
<f:for each="{comments}" as="comment">
<li class="list-group-item">
{comment}
</li>
</f:for>
</ul>
</f:section>
<f:layout name="Default" />
<f:section name="iconButtons">
&nbsp;
</f:section>
<f:section name="main">
<f:flashMessages renderMode="div" />
<ul class="list-group">
<f:for each="{templates}" as="template">
<li class="list-group-item">
<f:link.action controller="Mail" action="showMarker" arguments="{template:'{template}', extensionKey: '{extensionKey}'}">
{template}
</f:link.action>
</li>
</f:for>
</ul>
</f:section>
......@@ -30,6 +30,49 @@ if (!defined('TYPO3_MODE')) {
/** @noinspection PhpUndefinedVariableInspection */
$extPath = \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath('sg_mail');
$templateFiles = [
$extPath . 'Resources/Private/Templates/some-email.html',
$extPath . 'Resources/Private/Templates/de.some-email.html'
];
$marker = [
'header_content' => [
'content' => 'HEADING',
'description' => 'This is the heading of the Email'
],
'main_content' => [
'content' => 'Lorem Ipsum',
'description' => 'The Content of the Mail'
]
];
$description = 'This is just a Test Email';
\SGalinski\SgMail\Service\MailTemplateService::registerTemplate(
'sg_mail', 'system test email', $templateFiles, $description, $marker
);
$templateFiles = [
$extPath . 'Resources/Private/Templates/some-email.html',
$extPath . 'Resources/Private/Templates/de.some-email.html'
];
$marker = [
'header_content' => [
'content' => 'HEADING',
'description' => 'This is the heading of the Email'
],
'main_content' => [
'content' => 'Lorem Ipsum',
'description' => 'The Content of the Mail'
]
];
$description = 'This is just a Test Email';
\SGalinski\SgMail\Service\MailTemplateService::registerTemplate(
'sg_mail', 'test email2', $templateFiles, $description, $marker
);
if (TYPO3_MODE === 'BE') {
$tsPath = $extPath . 'Configuration/TypoScript/';
......
......@@ -10,7 +10,7 @@ if (!defined('TYPO3_MODE')) {
'Mail',
'',
[
'Mail' => 'index, showTemplates, showMarker',
'Mail' => 'index, showTemplate, showMarker, saveMarker',
],
[
'access' => 'admin,user,group',
......
#
# Table structure for table 'tx_sgmail_domain_model_registeredtemplate'
#
CREATE TABLE tx_sgmail_domain_model_registeredtemplate (
uid int(11) NOT NULL auto_increment,
pid int(11) DEFAULT '0' NOT NULL,
ext_key varchar(255) DEFAULT '' NOT NULL,
template varchar(255) DEFAULT '' NOT NULL,
mail_key varchar(255) DEFAULT '' NOT NULL,
tstamp int(11) unsigned DEFAULT '0' NOT NULL,
crdate int(11) unsigned DEFAULT '0' NOT NULL,
cruser_id int(11) unsigned DEFAULT '0' NOT NULL,
deleted tinyint(4) unsigned DEFAULT '0' NOT NULL,
hidden tinyint(4) unsigned DEFAULT '0' NOT NULL,
starttime int(11) unsigned DEFAULT '0' NOT NULL,
endtime int(11) unsigned DEFAULT '0' NOT NULL,
t3ver_oid int(11) DEFAULT '0' NOT NULL,
t3ver_id int(11) DEFAULT '0' NOT NULL,
t3ver_wsid int(11) DEFAULT '0' NOT NULL,
t3ver_label varchar(255) DEFAULT '' NOT NULL,
t3ver_state tinyint(4) DEFAULT '0' NOT NULL,
t3ver_stage int(11) DEFAULT '0' NOT NULL,
t3ver_count int(11) DEFAULT '0' NOT NULL,
t3ver_tstamp int(11) DEFAULT '0' NOT NULL,
t3ver_move_id int(11) DEFAULT '0' NOT NULL,
sys_language_uid int(11) DEFAULT '0' NOT NULL,
l10n_parent int(11) DEFAULT '0' NOT NULL,
l10n_diffsource mediumblob,
PRIMARY KEY (uid),
KEY parent (pid),
KEY t3ver_oid (t3ver_oid,t3ver_wsid),
KEY language (l10n_parent,sys_language_uid)
);
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