diff --git a/Classes/Controller/ConfigurationController.php b/Classes/Controller/ConfigurationController.php index 087aba6ca526fc2b3c121ce88c89b2dc4349152b..6c965db2459f5e13feac891de0caaed781bd8e57 100644 --- a/Classes/Controller/ConfigurationController.php +++ b/Classes/Controller/ConfigurationController.php @@ -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) { + } + } } diff --git a/Resources/Private/Language/de.locallang.xlf b/Resources/Private/Language/de.locallang.xlf index dfc622bb7f4b0e7ee0dfb75ea48769d19b7314c8..7bc0ca1b3ea619c1ecb5abcb0312414b9d8e0d4b 100644 --- a/Resources/Private/Language/de.locallang.xlf +++ b/Resources/Private/Language/de.locallang.xlf @@ -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> diff --git a/Resources/Private/Language/locallang.xlf b/Resources/Private/Language/locallang.xlf index 820751dde15ae618d5756279fcf16ec55641435d..04ab7cc9effab149a833b4d7b9060c4fd33ad71e 100644 --- a/Resources/Private/Language/locallang.xlf +++ b/Resources/Private/Language/locallang.xlf @@ -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> diff --git a/Resources/Private/Templates/Configuration/Index.html b/Resources/Private/Templates/Configuration/Index.html index 9e45b5fe7b7a6b5f9c229e27cfc6dd0c560253e4..df5459e12c4d5db1dfe89b384d2755e3079556d1 100644 --- a/Resources/Private/Templates/Configuration/Index.html +++ b/Resources/Private/Templates/Configuration/Index.html @@ -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> diff --git a/ext_tables.php b/ext_tables.php index d90304c645ec6a1173658e95b81a5f141e2c5ec0..a3137964cf470912779e3f4c07d6d93defac1642 100644 --- a/ext_tables.php +++ b/ext_tables.php @@ -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',