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

[TASK] Editing of namespaces

parent 89e05286
No related branches found
No related tags found
No related merge requests found
......@@ -48,7 +48,7 @@ use TYPO3\CMS\Extbase\Utility\LocalizationUtility;
* Controller for the configuration mode of the backend module
*/
class ConfigurationController extends ActionController {
const DEFAULT_EXTENSION_KEY = 'sg_mail';
public const DEFAULT_EXTENSION_KEY = 'sg_mail';
  • Maintainer

    Setze deine IDE auf PHP 7.0, dass hier ist PHP 7.1.

    Generell: Wenn die Extension mit TYPO3 8.X kompatibel sein soll PHP 7.0, ansonsten 7.2.

  • Please register or sign in to reply
/**
* DocHeaderComponent
......@@ -88,6 +88,7 @@ class ConfigurationController extends ActionController {
}
}
$this->view->assign('extensionKey', self::DEFAULT_EXTENSION_KEY);
$this->view->assign('mode', $mode);
if ($mode === 'edit') {
$templateToEdit = $registerArray[$selectedExtension][$selectedTemplate];
......@@ -100,6 +101,7 @@ class ConfigurationController extends ActionController {
}
$this->view->assign('csv', $csv);
$this->view->assign('extensionKey', $selectedExtension);
$this->view->assign('description', $templateToEdit['description']);
$this->view->assign('editMode', 1);
}
......@@ -142,6 +144,7 @@ class ConfigurationController extends ActionController {
$configuration = $this->request->getArgument('configuration');
$templateName = $configuration['templateName'];
$extensionKey = $configuration['extensionKey'];
$csv = str_replace("\r", '', $configuration['csv']);
$subject = $configuration['subject'];
$description = $configuration['description'];
......@@ -163,7 +166,7 @@ class ConfigurationController extends ActionController {
$registerService = $this->objectManager->get(RegisterService::class);
$registerService->writeRegisterFile(
$templateName, self::DEFAULT_EXTENSION_KEY, $markers, $subject, $description
$templateName, $extensionKey, $markers, $subject, $description
);
$registerService->clearCaches();
......@@ -189,8 +192,8 @@ class ConfigurationController extends ActionController {
*
* @throws StopActionException
* @throws UnsupportedRequestTypeException
* @throws \TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\NoSuchArgumentException
* @throws \TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException
*/
public function editAction(): void {
if (!$this->request->hasArgument('configuration')) {
......@@ -205,6 +208,7 @@ class ConfigurationController extends ActionController {
$templateName = $configuration['templateName'];
$extensionKey = $configuration['extensionKey'];
$oldTemplateName = $configuration['oldTemplateName'];
$csv = str_replace("\r", '', $configuration['csv']);
$subject = $configuration['subject'];
$description = $configuration['description'];
......@@ -224,9 +228,9 @@ class ConfigurationController extends ActionController {
];
}
$registerService = $this->objectManager->get(RegisterService::class);
$registerService->deleteRegisterFile($templateName);
$registerService->deleteRegisterFile($oldTemplateName);
$registerService->writeRegisterFile(
$templateName, self::DEFAULT_EXTENSION_KEY, $markers, $subject, $description
$templateName, $extensionKey, $markers, $subject, $description
);
$registerService->clearCaches();
......
......@@ -160,13 +160,10 @@ class RegisterService implements \TYPO3\CMS\Core\SingletonInterface {
) {
// template_path means where to find the mail body content (usually it's set directly in the registration
// as template_content)
$templatePath = '';
if ($configArray['template_path']) {
$templatePath = $configArray['template_path'];
} else {
if (!ExtensionManagementUtility::isLoaded($extensionKey)) {
return;
}
} elseif (ExtensionManagementUtility::isLoaded($extensionKey)) {
// transform template directory name: your_templates => YourTemplates/
$templateDirectoryParts = GeneralUtility::trimExplode('_', $templateKey);
$templateDirectory = '';
......@@ -179,10 +176,6 @@ class RegisterService implements \TYPO3\CMS\Core\SingletonInterface {
self::DEFAULT_TEMPLATE_PATH . $templateDirectory;
}
if (!\is_dir($templatePath)) {
$templatePath = '';
}
$description = $configArray['description'];
$subject = $configArray['subject'];
$marker = $configArray['markers'];
......
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<xliff version="1.0">
<file source-language="en" target-language="de" datatype="plaintext" original="messages" date="2019-03-08T04:55:34Z">
<file source-language="en" target-language="de" datatype="plaintext" original="messages" date="2019-03-08T07:38:45Z">
<header>
<type>module</type>
<description>Language labels for the backend module belonging to extension 'sg_csv_importer'</description>
......@@ -65,6 +65,10 @@
<source><![CDATA[Description]]></source>
<target><![CDATA[Beschreibung]]></target>
</trans-unit>
<trans-unit id="backend.create.extensionKey" approved="yes">
<source><![CDATA[Namespace]]></source>
<target><![CDATA[Namespace]]></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 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>
......
<?xml version="1.0" encoding="utf-8" standalone="yes" ?>
<xliff version="1.0">
<file source-language="en" datatype="plaintext" original="messages" date="2019-03-08T04:55:34Z">
<file source-language="en" datatype="plaintext" original="messages" date="2019-03-08T07:38:45Z">
<header>
<type>module</type>
<description>Language labels for the backend module belonging to extension 'sg_csv_importer'</description>
......@@ -54,6 +54,9 @@
<trans-unit id="backend.create.description">
<source><![CDATA[Description]]></source>
</trans-unit>
<trans-unit id="backend.create.extensionKey">
<source><![CDATA[Namespace]]></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 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>
......
......@@ -27,6 +27,11 @@
<div class="row">
<div class="col-xs-12 col-md-10 col-md-offset-1">
<f:form.hidden name="extensionKey" value="{selectedExtensionKey}"/>
<f:form.hidden name="oldTemplateName" property="oldTemplateName" value="{templateName}"/>
<div class="form-group">
<label for="extensionKey"><f:translate key="backend.create.extensionKey" /></label>
<f:form.textfield class="form-control" property="extensionKey" id="extensionKey" required="TRUE" value="{extensionKey}" />
</div>
<div class="form-group">
<label for="templateName"><f:translate key="backend.create.templateName" /></label>
<f:form.textfield class="form-control" property="templateName" id="templateName" required="TRUE" value="{templateName}" />
......
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