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

[BUGFIX] Fixing csv import when creating manual templates, misc ui fixes'

parent db500a9b
No related branches found
No related tags found
1 merge request!12Feature backend config
......@@ -34,7 +34,6 @@ use TYPO3\CMS\Backend\Template\Components\DocHeaderComponent;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Cache\CacheManager;
use TYPO3\CMS\Core\Cache\Frontend\FrontendInterface;
use TYPO3\CMS\Core\Log\Logger;
use TYPO3\CMS\Core\Messaging\FlashMessage;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\VersionNumberUtility;
......@@ -125,16 +124,15 @@ class ConfigurationController extends ActionController {
$configuration = $this->request->getArgument('configuration');
$templateName = $configuration['templateName'];
$csv = $configuration['csv'];
$csv = str_replace("\r", '', $configuration['csv']);
$subject = $configuration['subject'];
$description = $configuration['description'];
// parse csv (,,,;,,,;)
$markersCsv = str_getcsv($csv, ';');
$markersCsv = \explode("\n", $csv);
$markers = [];
foreach ($markersCsv as $markerCsv) {
$rowArray = GeneralUtility::trimExplode(',', $markerCsv);
$rowArray = str_getcsv($markerCsv, ';');
if (!$rowArray[0]) {
continue;
}
......@@ -145,13 +143,9 @@ class ConfigurationController extends ActionController {
];
}
// write the new Register.php file
$this->writeRegisterFile($templateName, self::DEFAULT_EXTENSION_KEY, $markers, $subject, $description);
// call register function in mail template service class
MailTemplateService::registerExtensions();
// clear caches
$this->clearCaches();
// store selected template & extension key in the session
......
......@@ -70,8 +70,8 @@
<target><![CDATA[Beschreibung]]></target>
</trans-unit>
<trans-unit id="backend.create.info" approved="yes">
<source><![CDATA[Please insert the template marker in the following format: markerName, exampleValue, description <br /><br />Whitespaces in marker names are ignored. <br />If you have multiple markers, seperate them with semicolon (;): markerName1, exampleValue1, description1;markerName2, exampleValue2, description2 <br /><br />Example: first_name, Max, The first name of the client; last_name, Mustermann, The last name of the client]]></source>
<target><![CDATA[Bitte geben Sie die Template Marker im folgenden Format ein: markerName, beispiel, beschreibung <br /><br />Leerzeichen in Markernamen werden ignoriert. <br /><br />Mehrere Marker werden mit Semikolon (;) getrennt: markerName1, beispiel1, beschreibung1; markerName2, beispiel2, beschreibung2 <br /><br />Beispiel: first_name, Max, Der Vorname des Kunden; last_name, Mustermann, Der Nachname des Kunden]]></target>
<source><![CDATA[Please insert the template marker in the following format: markerName; exampleValue; description <br /><br />Whitespaces in marker names are ignored. <br />If you have multiple markers, seperate them with a new line: markerName1; exampleValue1; description1<br />markerName2; exampleValue2; description2 <br /><br />Example: first_name; Max; The first name of the client <br />last_name; Mustermann; The last name of the client]]></source>
<target><![CDATA[Bitte geben Sie die Template Marker im folgenden Format ein: markerName; beispiel; beschreibung <br /><br />Leerzeichen in Markernamen werden ignoriert. <br /><br />Mehrere Marker werden mit der Eingabetaste getrennt: markerName1; beispiel1; beschreibung1<br />markerName2; beispiel2; beschreibung2 <br /><br />Beispiel: first_name; Max; Der Vorname des Kunden<br /> last_name; Mustermann; Der Nachname des Kunden]]></target>
</trans-unit>
<trans-unit id="backend.create.info_header" approved="yes">
<source><![CDATA[Usage Information]]></source>
......@@ -101,6 +101,10 @@
<source><![CDATA[Mail template was successfully registered. You can now edit the content below.]]></source>
<target><![CDATA[Die Registrierung war erfolgreich. Sie können nun den Inhalt der Mails im Editor (siehe unten) bearbeiten.]]></target>
</trans-unit>
<trans-unit id="backend.default_extension_name" approved="yes">
<source><![CDATA[Own templates]]></source>
<target><![CDATA[Eigene Templates]]></target>
</trans-unit>
<trans-unit id="backend.delete_template" approved="yes">
<source><![CDATA[Do you really want to reset this template?]]></source>
<target><![CDATA[Möchten Sie wirklich den Ursprungszustand wiederherstellen?]]></target>
......
......@@ -55,7 +55,7 @@
<source><![CDATA[Description]]></source>
</trans-unit>
<trans-unit id="backend.create.info">
<source><![CDATA[Please insert the template marker in the following format: markerName, exampleValue, description <br /><br />Whitespaces in marker names are ignored. <br />If you have multiple markers, seperate them with semicolon (;): markerName1, exampleValue1, description1;markerName2, exampleValue2, description2 <br /><br />Example: first_name, Max, The first name of the client; last_name, Mustermann, The last name of the client]]></source>
<source><![CDATA[Please insert the template marker in the following format: markerName; exampleValue; description <br /><br />Whitespaces in marker names are ignored. <br />If you have multiple markers, seperate them with a new line: markerName1; exampleValue1; description1<br />markerName2; exampleValue2; description2 <br /><br />Example: first_name; Max; The first name of the client <br />last_name; Mustermann; The last name of the client]]></source>
</trans-unit>
<trans-unit id="backend.create.info_header">
<source><![CDATA[Usage Information]]></source>
......@@ -78,6 +78,9 @@
<trans-unit id="backend.create_message">
<source><![CDATA[Mail template was successfully registered. You can now edit the content below.]]></source>
</trans-unit>
<trans-unit id="backend.default_extension_name">
<source><![CDATA[Own templates]]></source>
</trans-unit>
<trans-unit id="backend.delete_template">
<source><![CDATA[Do you really want to reset this template?]]></source>
</trans-unit>
......
......@@ -85,7 +85,7 @@
</f:if>
<f:else>
<f:if condition="{mode} == 'editor'">
<sgm:be.menus.actionMenuOptionGroup label="{extensionKey}">
<sgm:be.menus.actionMenuOptionGroup label="{f:if(condition: '{extensionKey} == \'sg_mail\'', then: '{f:translate(key: \'backend.default_extension_name\')}', else: '{extensionKey}')}">
<f:for each="{template}" as="currentTemplate" key="templateKey">
<sgm:extendedIf condition="{selectedTemplateKey} == {templateKey}"
and="{selectedExtensionKey} == {extensionKey}">
......@@ -111,6 +111,7 @@
</f:be.menus.actionMenu>
</f:if>
</div>
<f:render section="iconButtons" />
<div class="module-docheader-bar-column-right">
<f:render partial="ButtonBar" arguments="{buttons:docHeader.buttons.right}" />
</div>
......
{namespace sgm=SGalinski\SgMail\ViewHelpers}
{namespace core=TYPO3\CMS\Core\ViewHelpers}
<f:layout name="Default" />
<f:section name="iconButtons">
&nbsp;
<f:link.action class="btn btn-default btn-sm" controller="Configuration" action="index" arguments="{template: selectedTemplateKey, extensionKey: selectedTemplate.extension}">
<core:icon identifier="actions-document-new" />
</f:link.action>
</f:section>
<f:section name="content">
<f:flashMessages />
<f:if condition="{selectedTemplate}">
<f:then>
<div class="row form-group col-md-12">
<div class="row form-group col-md-12 ">
<div class="editor-description col-md-6">
<p>{templateDescription}</p>
</div>
<div class=" col-md-3">
<f:link.action class="reset-all-btn btn-success btn col-md-12" controller="Configuration" action="index" arguments="{template: selectedTemplateKey, extensionKey: selectedTemplate.extension}">{f:translate(key:'backend.button_create')}</f:link.action>
</div>
<div class=" col-md-3">
<div class="col-md-3 col-md-offset-3">
<f:link.action class="reset-btn reset-all-btn btn-danger btn col-md-12" action="reset" arguments="{template: selectedTemplateKey, extensionKey: selectedTemplate.extension}">{f:translate(key:'backend.button_reset_all')}</f:link.action>
</div>
</div>
......
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