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

[TASK] Misc fixes

parent e6ec7a54
No related branches found
No related tags found
1 merge request!1Feature sg mail
......@@ -38,17 +38,21 @@ class MailController extends ActionController {
*
*/
public function indexAction() {
$this->view->assign('extensions', array_keys(MailTemplateService::$registerArray));
$this->view->assign('extensions', MailTemplateService::$registerArray);
}
/**
* @return void
*
*
*/
public function showAction() {
print_r($_REQUEST);
public function showTemplatesAction() {
$extensionKey = $this->request->getArgument('ext_key');
$files = glob('/path/to/dir/*.xml');
$this->view->assign('templates', MailTemplateService::$registerArray[$extensionKey]);
$this->view->assign('extensions', array_keys(MailTemplateService::$registerArray));
$this->view->assign('templates', array_keys(MailTemplateService::$registerArray));
}
}
......@@ -2,35 +2,39 @@
namespace SGalinski\SgMail\Service;
/***************************************************************
* 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!
***************************************************************/
/***************************************************************
* 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!
***************************************************************/
use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
/**
* MailTemplateService
*/
class MailTemplateService {
/**
* @var array
*/
public static $registerArray = [];
/**
......@@ -39,6 +43,13 @@ class MailTemplateService {
* @return string
*/
public static function registerTemplate($extensionKey, $template) {
$path = ExtensionManagementUtility::extPath('sg_mail');
if (!file_exists($path . '/Configuration/Templates/' . $template . '.html')) {
// @TODO Throw exception
return;
}
if (!array_key_exists($extensionKey, MailTemplateService::$registerArray)) {
MailTemplateService::$registerArray[$extensionKey] = [$template];
} elseif (!in_array(MailTemplateService::$registerArray[$extensionKey], $template)) {
......
<h1>###heading###</h1>
......@@ -4,13 +4,7 @@
<div class="module-docheader-bar module-docheader-bar-navigation t3js-module-docheader-bar t3js-module-docheader-bar-navigation">
<div class="module-docheader-bar-column-left">
<div class="btn-toolbar" role="toolbar">
<f:be.menus.actionMenu>
<f:for each="{extensions}" as="extension">
<f:be.menus.actionMenuItem label="{extension}"
controller="Mail"
action="show" />
</f:for>
</f:be.menus.actionMenu>
</div>
</div>
<div class="module-docheader-bar-column-right">
......
......@@ -4,4 +4,14 @@
</f:section>
<f:section name="main">
<f:flashMessages renderMode="div" />
<h3>Registered Extensions</h3>
<ul class="list-group">
<f:for each="{extensions}" as="extension" key="key">
<li class="list-group-item">
<f:link.action controller="Mail" action="showTemplates" arguments="{ext_key:'{key}'}">{key}</f:link.action>
<span class="badge"><f:count>{extension}</f:count></span>
</li>
</f:for>
</ul>
</f:section>
......@@ -6,6 +6,6 @@
<f:flashMessages renderMode="div" />
<f:for each="{templates}" as="template">
<h3>{template}</h3>
{template}<br />
</f:for>
</f:section>
......@@ -10,7 +10,7 @@ if (!defined('TYPO3_MODE')) {
'Mail',
'',
[
'Mail' => 'index', 'show',
'Mail' => 'index, showTemplates',
],
[
'access' => 'admin,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