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

[TASK] Adding Viewhelper for no primitive types, Adding usage field for markers

parent 2c97bb06
No related branches found
No related tags found
No related merge requests found
......@@ -43,7 +43,7 @@ class Register implements RegisterInterface {
/**
* @var array
*/
private $subjects = [];
private $subject = [];
/**
* @var string
......@@ -75,6 +75,11 @@ class Register implements RegisterInterface {
* initialize certain values
*/
public function init() {
$templateArray = [
'fistName' => 'Max',
'lastName' => 'Mustermann'
];
$this->markers = [
[
'marker' => 'firstname',
......@@ -87,11 +92,18 @@ class Register implements RegisterInterface {
'type' => \SGalinski\SgMail\Service\MailTemplateService::MARKER_TYPE_STRING,
'value' => 'Mustermann',
'description' => 'The Last Name of the Customer'
],
[
'marker' => 'person',
'type' => \SGalinski\SgMail\Service\MailTemplateService::MARKER_TYPE_ARRAY,
'value' => $templateArray,
'description' => 'An array with the customer Data',
'usage' => '{person.firstName}, {person.lastName}'
]
];
$this->description = 'Description about the Template';
$this->subjects = [
$this->subject = [
'en' => 'The english subject text',
'de' => 'The german subject text'
];
......@@ -105,7 +117,8 @@ class Register implements RegisterInterface {
*/
public function registerTemplate() {
\SGalinski\SgMail\Service\MailTemplateService::registerTemplate(
$this->extensionKey, $this->templateKey, $this->templatePath, $this->description, $this->markers, $this->subjects
$this->extensionKey, $this->templateKey, $this->templatePath, $this->description, $this->markers,
$this->subject
);
}
......@@ -128,16 +141,16 @@ class Register implements RegisterInterface {
/**
* @return array
*/
public function getSubjects() {
return $this->subjects;
public function getSubject() {
return $this->subject;
}
/**
* @param array $subjects
* @param array $subject
* @return RegisterInterface
*/
public function setSubjects(array $subjects) {
$this->subjects = $subjects;
public function setSubject(array $subject) {
$this->subject = $subject;
return $this;
}
......
......@@ -201,9 +201,10 @@ class MailTemplateService {
* @param mixed $description
* @param array $markers
* @param mixed $subject
* @param string $usage
*/
public static function registerTemplate(
$extension, $templateName, $templatePath, $description, array $markers, $subject
$extension, $templateName, $templatePath, $description, array $markers, $subject, $usage = ''
) {
MailTemplateService::$registerArray[$extension][$templateName] = [
'templatePath' => $templatePath,
......@@ -211,7 +212,8 @@ class MailTemplateService {
'marker' => $markers,
'extension' => $extension,
'templateName' => $templateName,
'subject' => $subject
'subject' => $subject,
'usage' => $usage
];
}
......
<?php
namespace SGalinski\SgMail\ViewHelpers;
/***************************************************************
* 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!
***************************************************************/
/**
* Checks if a fluid variable is a standard type or not
*
* @package SGalinski\SgMail\ViewHelper
*/
class TypeCheckViewHelper extends AbstractViewHelper {
/**
* Arguments Initialization
*/
public function initializeArguments() {
parent::initializeArguments();
$this->registerArgument('value', 'mixed', 'value to check', TRUE);
}
/**
* Returns true when the type is an array
* @param array $arguments
* @return bool
*/
protected static function evaluateCondition($arguments = NULL) {
return (isset($arguments['value']) && (TRUE === is_array($arguments['value'])));
}
}
?>
\ No newline at end of file
......@@ -65,6 +65,18 @@
<source>Marker</source>
<target>Marker</target>
</trans-unit>
<trans-unit id="backend.marker.type.array" approved="yes">
<source>Array</source>
<target>Array</target>
</trans-unit>
<trans-unit id="backend.marker.type.object" approved="yes">
<source>Object</source>
<target>Objekt</target>
</trans-unit>
<trans-unit id="backend.marker.type.string" approved="yes">
<source>String</source>
<target>String</target>
</trans-unit>
<trans-unit id="backend.no_extension" approved="yes">
<source>No Extension was registered</source>
<target>Es wurde noch keine Extension registriert</target>
......@@ -141,6 +153,10 @@
<source>Type</source>
<target>Typ</target>
</trans-unit>
<trans-unit id="backend.usage" approved="yes">
<source>Usage in Template</source>
<target>Gebrauch im Template</target>
</trans-unit>
<trans-unit id="backend.value" approved="yes">
<source>Value</source>
<target>Wert</target>
......
......@@ -9,129 +9,132 @@
<authorEmail>torsten@sgalinski.de</authorEmail>
</header>
<body>
<trans-unit id="backend.bcc">
<source>Bcc (Comma separated if multiple):</source>
</trans-unit>
<trans-unit id="backend.button_reset">
<source>Reset Template</source>
</trans-unit>
<trans-unit id="backend.button_reset_all">
<source>Reset all</source>
</trans-unit>
<trans-unit id="backend.cc">
<source>cc (Comma separated if multiple):</source>
</trans-unit>
<trans-unit id="backend.content">
<source>Text</source>
</trans-unit>
<trans-unit id="backend.delete_template">
<source>Do you really want to reset this Template ?</source>
</trans-unit>
<trans-unit id="backend.description">
<source>Description</source>
</trans-unit>
<trans-unit id="backend.email">
<source>Email</source>
</trans-unit>
<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.fromAddress">
<source>From</source>
</trans-unit>
<trans-unit id="backend.fromMail">
<source>From E-Mail Address:</source>
</trans-unit>
<trans-unit id="backend.fromName">
<source>From Name:</source>
</trans-unit>
<trans-unit id="backend.mail_queue">
<source>Mail Queue</source>
</trans-unit>
<trans-unit id="backend.marker">
<source>Marker</source>
</trans-unit>
<trans-unit id="backend.no_extension">
<source>No Extension was registered</source>
</trans-unit>
<trans-unit id="backend.not_sent">
<source>Not Sent</source>
</trans-unit>
<trans-unit id="backend.priority">
<source>Priority</source>
</trans-unit>
<trans-unit id="backend.replyTo">
<source>Reply to:</source>
</trans-unit>
<trans-unit id="backend.save">
<source>Save</source>
</trans-unit>
<trans-unit id="backend.select_language">
<source>Language (Reloads the page):</source>
</trans-unit>
<trans-unit id="backend.send_mail_again">
<source>Send this E-Mail again ?</source>
</trans-unit>
<trans-unit id="backend.send_mail_manually">
<source>Send this E-Mail now ?</source>
</trans-unit>
<trans-unit id="backend.send_test">
<source>Send Preview Mail</source>
</trans-unit>
<trans-unit id="backend.sending_time">
<source>Sending Time</source>
</trans-unit>
<trans-unit id="backend.sent">
<source>Sent</source>
</trans-unit>
<trans-unit id="backend.subject">
<source>Subject:</source>
</trans-unit>
<trans-unit id="backend.success">
<source>Successfully saved !</source>
</trans-unit>
<trans-unit id="backend.marker.type.string">
<source>String</source>
</trans-unit>
<trans-unit id="backend.marker.type.array">
<source>Array</source>
</trans-unit>
<trans-unit id="backend.marker.type.object">
<source>Object</source>
</trans-unit>
<trans-unit id="backend.success_mail">
<source>Preview Email sent</source>
</trans-unit>
<trans-unit id="backend.template_editor">
<source>Template Editor</source>
</trans-unit>
<trans-unit id="backend.template_path">
<source>Template Path:</source>
</trans-unit>
<trans-unit id="backend.template_reset">
<source>Template was resetted succesfully</source>
</trans-unit>
<trans-unit id="backend.toAddress">
<source>To</source>
</trans-unit>
<trans-unit id="backend.type">
<source>Type</source>
</trans-unit>
<trans-unit id="backend.value">
<source>Value</source>
</trans-unit>
<trans-unit id="mlang_labels_tabdescr">
<source>Mail Templates</source>
</trans-unit>
<trans-unit id="mlang_labels_tablabel">
<source>Mail Templates</source>
</trans-unit>
<trans-unit id="mlang_tabs_tab">
<source>Mail Templates</source>
</trans-unit>
<trans-unit id="registeredExtension.action.message">
<source>Extension</source>
</trans-unit>
<trans-unit id="backend.bcc">
<source>Bcc (Comma separated if multiple):</source>
</trans-unit>
<trans-unit id="backend.button_reset">
<source>Reset Template</source>
</trans-unit>
<trans-unit id="backend.button_reset_all">
<source>Reset all</source>
</trans-unit>
<trans-unit id="backend.cc">
<source>cc (Comma separated if multiple):</source>
</trans-unit>
<trans-unit id="backend.content">
<source>Text</source>
</trans-unit>
<trans-unit id="backend.delete_template">
<source>Do you really want to reset this Template ?</source>
</trans-unit>
<trans-unit id="backend.description">
<source>Description</source>
</trans-unit>
<trans-unit id="backend.email">
<source>Email</source>
</trans-unit>
<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.fromAddress">
<source>From</source>
</trans-unit>
<trans-unit id="backend.fromMail">
<source>From E-Mail Address:</source>
</trans-unit>
<trans-unit id="backend.fromName">
<source>From Name:</source>
</trans-unit>
<trans-unit id="backend.mail_queue">
<source>Mail Queue</source>
</trans-unit>
<trans-unit id="backend.marker">
<source>Marker</source>
</trans-unit>
<trans-unit id="backend.marker.type.array">
<source>Array</source>
</trans-unit>
<trans-unit id="backend.marker.type.object">
<source>Object</source>
</trans-unit>
<trans-unit id="backend.marker.type.string">
<source>String</source>
</trans-unit>
<trans-unit id="backend.no_extension">
<source>No Extension was registered</source>
</trans-unit>
<trans-unit id="backend.not_sent">
<source>Not Sent</source>
</trans-unit>
<trans-unit id="backend.priority">
<source>Priority</source>
</trans-unit>
<trans-unit id="backend.replyTo">
<source>Reply to:</source>
</trans-unit>
<trans-unit id="backend.save">
<source>Save</source>
</trans-unit>
<trans-unit id="backend.select_language">
<source>Language (Reloads the page):</source>
</trans-unit>
<trans-unit id="backend.send_mail_again">
<source>Send this E-Mail again ?</source>
</trans-unit>
<trans-unit id="backend.send_mail_manually">
<source>Send this E-Mail now ?</source>
</trans-unit>
<trans-unit id="backend.send_test">
<source>Send Preview Mail</source>
</trans-unit>
<trans-unit id="backend.sending_time">
<source>Sending Time</source>
</trans-unit>
<trans-unit id="backend.sent">
<source>Sent</source>
</trans-unit>
<trans-unit id="backend.subject">
<source>Subject:</source>
</trans-unit>
<trans-unit id="backend.success">
<source>Successfully saved !</source>
</trans-unit>
<trans-unit id="backend.success_mail">
<source>Preview Email sent</source>
</trans-unit>
<trans-unit id="backend.template_editor">
<source>Template Editor</source>
</trans-unit>
<trans-unit id="backend.template_path">
<source>Template Path:</source>
</trans-unit>
<trans-unit id="backend.template_reset">
<source>Template was resetted succesfully</source>
</trans-unit>
<trans-unit id="backend.toAddress">
<source>To</source>
</trans-unit>
<trans-unit id="backend.type">
<source>Type</source>
</trans-unit>
<trans-unit id="backend.usage">
<source>Usage in Template</source>
</trans-unit>
<trans-unit id="backend.value">
<source>Value</source>
</trans-unit>
<trans-unit id="mlang_labels_tabdescr">
<source>Mail Templates</source>
</trans-unit>
<trans-unit id="mlang_labels_tablabel">
<source>Mail Templates</source>
</trans-unit>
<trans-unit id="mlang_tabs_tab">
<source>Mail Templates</source>
</trans-unit>
<trans-unit id="registeredExtension.action.message">
<source>Extension</source>
</trans-unit>
</body>
</file>
</xliff>
\ No newline at end of file
......@@ -18,6 +18,7 @@
<th><f:translate key="backend.marker" /></th>
<th><f:translate key="backend.type" /></th>
<th><f:translate key="backend.value" /></th>
<th><f:translate key="backend.usage" /></th>
<th><f:translate key="backend.description" /></th>
</tr>
</thead>
......@@ -30,14 +31,20 @@
</f:if>
</td>
<td>
<f:if condition="{marker.value}">
<f:translate key="{marker.value}">{marker.value}</f:translate>
<f:if condition="<sgm:typeCheck val={marker.value} />">
<f:if condition="{marker.value}">
<f:translate key="{marker.value}">{marker.value}</f:translate>
</f:if>
</f:if>
<f:else>
{marker.usage}
</f:else>
</td>
<td>
<f:if condition="{marker.description}">
<f:translate key="{marker.description}">{marker.description}</f:translate>
</f:if>
{marker.usage}
</td>
<td>
<f:translate key="{marker.description}">{marker.description}</f:translate>
</td>
</tr>
</f:for>
......
......@@ -22,7 +22,7 @@
</thead>
<f:for each="{paginatedMails}" as="mail">
<tr>
<tr class="accordion">
<td>{mail.toAddress}</td>
<td>{mail.fromAddress}</td>
<td>
......@@ -54,6 +54,9 @@
</f:else>
</f:if>
</td>
<td>
<button class="btn-toggle">SHOW MAIL</button>
</td>
</tr>
</f:for>
</table>
......
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