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

[TASK] Implementing config controller

parent 1b127537
No related branches found
No related tags found
1 merge request!12Feature backend config
......@@ -30,9 +30,13 @@ use SGalinski\SgMail\Service\BackendService;
use SGalinski\SgMail\Session\PhpSession;
use TYPO3\CMS\Backend\Template\Components\DocHeaderComponent;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Exception;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\VersionNumberUtility;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
use TYPO3\CMS\Extbase\Mvc\Exception\NoSuchArgumentException;
use TYPO3\CMS\Extbase\Mvc\Exception\StopActionException;
use TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException;
/**
* Controller for the configuration mode of the backend module
......@@ -55,7 +59,6 @@ class ConfigurationController extends ActionController {
* @param string $selectedTemplate
* @param string $selectedExtension
* @param array $filters
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\NoSuchArgumentException
* @throws \TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException
*/
public function indexAction($selectedTemplate = NULL, $selectedExtension = NULL, array $filters = []) {
......@@ -76,8 +79,12 @@ class ConfigurationController extends ActionController {
$registerArray = BackendService::getNonBlacklistedTemplates($pageUid);
if ($selectedTemplate === NULL || $selectedTemplate === '') {
$selectedExtension = \key($registerArray);
$selectedTemplate = \key($registerArray[$selectedExtension]);
if (!empty($registerArray)) {
$selectedExtension = \key($registerArray);
}
if (!empty($registerArray)) {
$selectedTemplate = \key($registerArray[$selectedExtension]);
}
}
// make docheader
......@@ -97,4 +104,23 @@ class ConfigurationController extends ActionController {
$this->view->assign('selectedExtensionKey', $selectedExtension);
$this->view->assign('mode', 'editor');
}
/**
* Create the template or display errors that occured
*/
public function createAction() {
try {
/** @var array $configuration */
$configuration = $this->request->getArgument('configuration');
$templateName = $configuration['templateName'];
$csv = $configuration['csv'];
$subject = $configuration['subject'];
$description = $configuration['description'];
$this->redirect('index');
} catch (NoSuchArgumentException $e) {
} catch (Exception $e) {
}
}
}
......@@ -61,10 +61,30 @@
<source><![CDATA[Text]]></source>
<target><![CDATA[Text]]></target>
</trans-unit>
<trans-unit id="backend.create.csv" approved="yes">
<source><![CDATA[Marker (csv format)]]></source>
<target><![CDATA[Marker (csv Format)]]></target>
</trans-unit>
<trans-unit id="backend.create.description" approved="yes">
<source><![CDATA[Description]]></source>
<target><![CDATA[Beschreibung]]></target>
</trans-unit>
<trans-unit id="backend.create.markers" approved="yes">
<source><![CDATA[Template marker]]></source>
<target><![CDATA[Template Marker]]></target>
</trans-unit>
<trans-unit id="backend.create.save" approved="yes">
<source><![CDATA[Save]]></source>
<target><![CDATA[Speichern]]></target>
</trans-unit>
<trans-unit id="backend.create.subject" approved="yes">
<source><![CDATA[Subject]]></source>
<target><![CDATA[Betreff]]></target>
</trans-unit>
<trans-unit id="backend.create.templateName" approved="yes">
<source><![CDATA[Template name]]></source>
<target><![CDATA[Template Name]]></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>
......
......@@ -48,9 +48,24 @@
<trans-unit id="backend.content">
<source><![CDATA[Text]]></source>
</trans-unit>
<trans-unit id="backend.create.csv">
<source><![CDATA[Marker (csv format)]]></source>
</trans-unit>
<trans-unit id="backend.create.description">
<source><![CDATA[Description]]></source>
</trans-unit>
<trans-unit id="backend.create.markers">
<source><![CDATA[Template marker]]></source>
</trans-unit>
<trans-unit id="backend.create.save">
<source><![CDATA[Save]]></source>
</trans-unit>
<trans-unit id="backend.create.subject">
<source><![CDATA[Subject]]></source>
</trans-unit>
<trans-unit id="backend.create.templateName">
<source><![CDATA[Template name]]></source>
</trans-unit>
<trans-unit id="backend.delete_template">
<source><![CDATA[Do you really want to reset this template?]]></source>
</trans-unit>
......
......@@ -6,29 +6,43 @@
<f:section name="content">
<f:flashMessages />
<br>
<div class="row">
<div class="col-xs-12 col-md-8 col-md-offset-2">
<div class="panel panel-info">
<div class="panel-heading">
<f:translate key="backend.create.info_header" />
</div>
<div class="panel-body">
<p>
<f:translate key="backend.create.info" />
</p>
</div>
</div>
</div>
</div>
<f:form action="create" controller="Configuration" method="post" objectName="configuration" object="{configuration}">
<div class="row">
<div class="col-xs-12 col-md-3">
<div class="col-xs-12 col-md-8 col-md-offset-2">
<div class="form-group">
<label for="templateName"><f:translate key="backend.create.templateName" />TEMPLATE NAME</label>
<f:form.textfield class="form-control" property="templateName" id="templateName" />
<label for="templateName"><f:translate key="backend.create.templateName" /></label>
<f:form.textfield class="form-control" property="templateName" id="templateName" required="TRUE" />
</div>
<div class="form-group">
<label for="markers"><f:translate key="backend.create.markers" />markers</label>
<f:form.textfield class="form-control" property="markers" id="markers" />
<label for="csv"><f:translate key="backend.create.csv" /></label>
<f:form.textfield class="form-control" property="csv" id="csv" />
</div>
<div class="form-group">
<label for="subject"><f:translate key="backend.create.subject" />subject</label>
<label for="subject"><f:translate key="backend.create.subject" /></label>
<f:form.textfield class="form-control" property="subject" id="subject" />
</div>
<div class="form-group">
<label for="description"><f:translate key="backend.create.description" />description</label>
<label for="description"><f:translate key="backend.create.description" /></label>
<f:form.textarea class="form-control" property="description" id="description" />
</div>
<f:form.submit class="btn-primary btn form-group col-xs-12 col-md-2 col-md-offset-10" value="{f:translate(key:'backend.create.save')}" />
</div>
</div>
</f:form>
......
......@@ -12,7 +12,7 @@ if (!defined('TYPO3_MODE')) {
[
'Mail' => 'index, sendTestMail, empty, reset',
'Queue' => 'index, sendMail, export',
'Configuration' => 'index',
'Configuration' => 'index, create',
],
[
'access' => 'user,group',
......
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