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

[TASK] Adding model & repository. Implementing index view + default layout

parent 3953b85a
No related branches found
No related tags found
1 merge request!1Feature sg mail
......@@ -26,6 +26,7 @@ namespace SGalinski\SgMail\Controller;
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use SGalinski\SgMail\Domain\Model\RegisteredTemplate;
use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
/**
......@@ -33,10 +34,54 @@ use TYPO3\CMS\Extbase\Mvc\Controller\ActionController;
*/
class MailController extends ActionController {
/**
* TemplateRepository
*
* @var \SGalinski\SgMail\Domain\Repository\RegisteredTemplateRepository
* @inject
*/
protected $registeredTemplateRepository;
/**
*
*/
public function indexAction() {
// @TODO auslagern in function, da jede action dies brauchen wird
$registeredTemplates = $this->registeredTemplateRepository->findAll();
$this->view->assign('extensions', $this->getDistinctExtensionKeys($registeredTemplates));
}
/**
* @param string $extensionKey
* @param string $template
* @return string $mailKey
*/
public function registerTemplate($extensionKey, $template) {
$registeredTemplate = new RegisteredTemplate();
$registeredTemplate->setExtKey($extensionKey);
$registeredTemplate->setTemplate($template);
$mailKey = uniqid();
$registeredTemplate->setMailKey($mailKey);
$this->registeredTemplateRepository->add($registeredTemplate);
return $mailKey;
}
/**
* @param array $templates
* @return array
*/
protected function getDistinctExtensionKeys($templates) {
$extensionKeys = [];
/** @var RegisteredTemplate $template */
foreach ($templates as $template) {
!in_array($template->getExtKey(), $extensionKeys) ? $extensionKeys = $template->getExtKey() : NULL;
}
return $extensionKeys;
}
}
<?php
namespace SGalinski\SgMail\Domain\Model;
use TYPO3\CMS\Extbase\DomainObject\AbstractEntity;
/***************************************************************
* 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!
***************************************************************/
/**
* The RegisteredTemplate Model
*/
class RegisteredTemplate extends AbstractEntity {
/**
* extKey
*
* @var string
*/
protected $extKey;
/**
* template
*
* @var string
*/
protected $template;
/**
* mailKey
*
* @var string
*/
protected $mailKey;
/**
* @return string
*/
public function getExtKey() {
return $this->extKey;
}
/**
* @param string $extKey
*/
public function setExtKey($extKey) {
$this->extKey = $extKey;
}
/**
* @return string
*/
public function getTemplate() {
return $this->template;
}
/**
* @param string $template
*/
public function setTemplate($template) {
$this->template = $template;
}
/**
* @return string
*/
public function getMailKey() {
return $this->mailKey;
}
/**
* @param string $mailKey
*/
public function setMailKey($mailKey) {
$this->mailKey = $mailKey;
}
}
<?php
namespace SGalinski\SgMail\Domain\Repository;
/***************************************************************
* 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\Extbase\Persistence\Generic\Typo3QuerySettings;
use TYPO3\CMS\Extbase\Persistence\Repository;
/**
* The repository for RegisteredExtensions
*/
class RegisteredTemplateRepository extends Repository {
/**
* Initializes the repository default settings
*
* @return void
*/
public function initializeObject() {
/** @TODO removing this doesnt work. talk about it in meeting */
/** @var $querySettings Typo3QuerySettings */
$querySettings = $this->objectManager->get(Typo3QuerySettings::class);
$querySettings->setRespectStoragePage(FALSE);
$this->setDefaultQuerySettings($querySettings);
}
}
plugin.tx_sgcmail {
view {
templateRootPath = EXT:sg_mail/Resources/Private/Templates/
partialRootPath = EXT:sg_mail/Resources/Private/Partials/
layoutRootPath = EXT:sg_mail/Resources/Private/Layouts/
publicRootPath = EXT:sg_mail/Resources/Public/
}
}
module.tx_sgcmail {
view {
templateRootPaths.0 = EXT:sg_mail/Resources/Private/Templates/
partialRootPaths.0 = EXT:sg_mail/Resources/Private/Partials/
layoutRootPaths.0 = EXT:sg_mail/Resources/Private/Layouts/
templateRootPath = {$plugin.tx_sgcmail.view.templateRootPath}
partialRootPath = {$plugin.tx_sgcmail.view.partialRootPath}
layoutRootPath = {$plugin.tx_sgcmail.view.layoutRootPath}
}
}
......@@ -9,48 +9,21 @@
<authorEmail>torsten@sgalinski.de</authorEmail>
</header>
<body>
<trans-unit id="backend.uploadAction.importSuccessful.message" approved="yes">
<source>Import was successful</source>
<target>Der Import war erfolgreich</target>
<trans-unit id="registeredExtension.action.message">
<source>Extension</source>
<target>Extension</target>
</trans-unit>
<trans-unit id="backend.uploadAction.invalidData.message" approved="yes">
<source>Invalid CSV Data</source>
<target>ungültige CSV-Daten</target>
<trans-unit id="mlang_labels_tabdescr">
<source>Mail Templates</source>
<target>Mail Templates</target>
</trans-unit>
<trans-unit id="backend.uploadAction.noFileSelected.message" approved="yes">
<source>No File selected</source>
<target>Keine Datei ausgewählt</target>
<trans-unit id="mlang_labels_tablabel">
<source>Mail Templates</source>
<target>Mail Templates</target>
</trans-unit>
<trans-unit id="backend.uploadAction.noImplementation.message" approved="yes">
<source>Not yet implemented</source>
<target>Noch nicht implementiert</target>
</trans-unit>
<trans-unit id="function.csv.import.internett" approved="yes">
<source>Internett Availability</source>
<target>Internett-Verfügbarkeit</target>
</trans-unit>
<trans-unit id="function.csv.import.users">
<source>Benutzer Kommmunalforum</source>
</trans-unit>
<trans-unit id="function.index.general" approved="yes">
<source>Please choose</source>
<target>Bitte wählen Sie</target>
</trans-unit>
<trans-unit id="mlang_labels_tabdescr" approved="yes">
<source>CSV Importer</source>
<target>CSV-Importer</target>
</trans-unit>
<trans-unit id="mlang_labels_tablabel" approved="yes">
<source>CSV Importer</source>
<target>CSV-Importer</target>
</trans-unit>
<trans-unit id="mlang_tabs_tab" approved="yes">
<source>CSV Importer</source>
<target>CSV-Importer</target>
</trans-unit>
<trans-unit id="backend.uploadAction.import.message" approved="yes">
<source>Import</source>
<target>Importieren</target>
<trans-unit id="mlang_tabs_tab">
<source>Mail Templates</source>
<target>Mail Templates</target>
</trans-unit>
</body>
</file>
......
......@@ -9,29 +9,8 @@
<authorEmail>torsten@sgalinski.de</authorEmail>
</header>
<body>
<trans-unit id="backend.uploadAction.import.message">
<source>Import</source>
</trans-unit>
<trans-unit id="backend.uploadAction.importSuccessful.message">
<source>Import was successful</source>
</trans-unit>
<trans-unit id="backend.uploadAction.invalidData.message">
<source>Invalid CSV Data</source>
</trans-unit>
<trans-unit id="backend.uploadAction.noFileSelected.message">
<source>No File selected</source>
</trans-unit>
<trans-unit id="backend.uploadAction.noImplementation.message">
<source>Not yet implemented</source>
</trans-unit>
<trans-unit id="function.csv.import.internett">
<source>Internett Availability</source>
</trans-unit>
<trans-unit id="function.csv.import.users">
<source>Benutzer Kommmunalforum</source>
</trans-unit>
<trans-unit id="function.index.general">
<source>Please choose</source>
<trans-unit id="registeredExtension.action.message">
<source>Extension</source>
</trans-unit>
<trans-unit id="mlang_labels_tabdescr">
<source>Mail Templates</source>
......
......@@ -4,11 +4,13 @@
<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:be.menus.actionMenuItem label="{f:translate(key:'function.csv.import.internett')}"
controller="Mail"
action="index" />
</f:be.menus.actionMenu>
<f:for each="{extensions}" as="extension">
<f:be.menus.actionMenu>
<f:be.menus.actionMenuItem label="{extension}"
controller="Mail"
action="index" />
</f:be.menus.actionMenu>
</f:for>
</div>
</div>
<div class="module-docheader-bar-column-right">
......
......@@ -4,6 +4,10 @@ if (!defined('TYPO3_MODE')) {
die('Access denied.');
}
TYPO3\CMS\Core\Utility\ExtensionManagementUtility::allowTableOnStandardPages(
'tx_sgmail_domain_model_registeredtemplate'
);
\TYPO3\CMS\Extbase\Utility\ExtensionUtility::registerModule(
'SGalinski.sg_mail',
'web',
......
#
# Table structure for table 'tx_sgmail_domain_model_registeredtemplate'
#
CREATE TABLE tx_sgmail_domain_model_registeredtemplate (
uid int(11) NOT NULL auto_increment,
pid int(11) DEFAULT '0' NOT NULL,
ext_key varchar(255) DEFAULT '' NOT NULL,
template varchar(255) DEFAULT '' NOT NULL,
mail_key varchar(255) DEFAULT '' NOT NULL,
tstamp int(11) unsigned DEFAULT '0' NOT NULL,
crdate int(11) unsigned DEFAULT '0' NOT NULL,
cruser_id int(11) unsigned DEFAULT '0' NOT NULL,
deleted tinyint(4) unsigned DEFAULT '0' NOT NULL,
hidden tinyint(4) unsigned DEFAULT '0' NOT NULL,
starttime int(11) unsigned DEFAULT '0' NOT NULL,
endtime int(11) unsigned DEFAULT '0' NOT NULL,
t3ver_oid int(11) DEFAULT '0' NOT NULL,
t3ver_id int(11) DEFAULT '0' NOT NULL,
t3ver_wsid int(11) DEFAULT '0' NOT NULL,
t3ver_label varchar(255) DEFAULT '' NOT NULL,
t3ver_state tinyint(4) DEFAULT '0' NOT NULL,
t3ver_stage int(11) DEFAULT '0' NOT NULL,
t3ver_count int(11) DEFAULT '0' NOT NULL,
t3ver_tstamp int(11) DEFAULT '0' NOT NULL,
t3ver_move_id int(11) DEFAULT '0' NOT NULL,
sys_language_uid int(11) DEFAULT '0' NOT NULL,
l10n_parent int(11) DEFAULT '0' NOT NULL,
l10n_diffsource mediumblob,
PRIMARY KEY (uid),
KEY parent (pid),
KEY t3ver_oid (t3ver_oid,t3ver_wsid),
KEY language (l10n_parent,sys_language_uid)
);
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