Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
TYPO3
sg_mail
Commits
7b981445
Commit
7b981445
authored
Sep 15, 2016
by
Torsten Oppermann
Browse files
[TASK] Necessary register array refactoring for dropdown to work correctly
parent
c9c78ccc
Changes
5
Hide whitespace changes
Inline
Side-by-side
Classes/Controller/MailController.php
View file @
7b981445
...
...
@@ -56,28 +56,34 @@ class MailController extends ActionController {
if
(
$this
->
request
->
hasArgument
(
'selectedTemplate'
)
&&
!
$this
->
request
->
hasArgument
(
'selectedLanguage'
))
{
$registerArray
=
MailTemplateService
::
getRegisterArray
();
$selectedTemplate
=
$registerArray
[
$this
->
request
->
getArgument
(
'selectedTemplate'
)];
$selectedExtensionArg
=
$this
->
request
->
getArgument
(
'selectedExtension'
);
$selectedTemplateArg
=
$this
->
request
->
getArgument
(
'selectedTemplate'
);
$selectedTemplate
=
$registerArray
[
$selectedExtensionArg
][
$selectedTemplateArg
];
$this
->
view
->
assign
(
'selectedTemplate'
,
$selectedTemplate
);
$this
->
view
->
assign
(
'selectedTemplateKey'
,
$this
->
request
->
getArgument
(
'selectedTemplate'
));
$this
->
view
->
assign
(
'selectedTemplateKey'
,
intval
(
$selectedTemplateArg
));
$this
->
view
->
assign
(
'selectedExtensionKey'
,
$selectedExtensionArg
);
}
elseif
(
!
$this
->
request
->
hasArgument
(
'selectedLanguage'
))
{
reset
(
MailTemplateService
::
getRegisterArray
());
$firstEntry
=
key
(
MailTemplateService
::
getRegisterArray
());
$this
->
view
->
assign
(
'selectedTemplate'
,
MailTemplateService
::
getRegisterArray
()[
$firstEntry
]);
$this
->
view
->
assign
(
'selectedTemplateKey'
,
$firstEntry
);
$this
->
view
->
assign
(
'selectedTemplate'
,
MailTemplateService
::
getRegisterArray
()[
$firstEntry
][
0
]);
$this
->
view
->
assign
(
'selectedTemplateKey'
,
intval
(
$firstEntry
));
$this
->
view
->
assign
(
'selectedExtensionKey'
,
$firstEntry
);
}
if
(
$this
->
request
->
hasArgument
(
'selectedLanguage'
)
&&
$this
->
request
->
hasArgument
(
'selectedTemplate'
)
&&
$this
->
request
->
hasArgument
(
'selected
Template
Key'
)
&&
$this
->
request
->
hasArgument
(
'selected
Extension
Key'
)
)
{
$this
->
view
->
assign
(
'selectedLanguage'
,
$this
->
request
->
getArgument
(
'selectedLanguage'
));
$this
->
view
->
assign
(
'selectedTemplate'
,
$this
->
request
->
getArgument
(
'selectedTemplate'
));
$this
->
view
->
assign
(
'selectedTemplateKey'
,
$this
->
request
->
getArgument
(
'selectedTemplateKey'
));
$this
->
view
->
assign
(
'selectedExtensionKey'
,
intval
(
$this
->
request
->
getArgument
(
'selectedExtensionKey'
)));
}
else
{
$this
->
view
->
assign
(
'selectedLanguage'
,
'en'
);
...
...
Classes/Service/MailTemplateService.php
View file @
7b981445
...
...
@@ -25,10 +25,6 @@ namespace SGalinski\SgMail\Service;
*
* This copyright notice MUST APPEAR in all copies of the script!
***************************************************************/
use
TYPO3\CMS\Core\SingletonInterface
;
use
TYPO3\CMS\Core\Utility\ExtensionManagementUtility
;
use
TYPO3\CMS\Lang\Domain\Model\Language
;
use
TYPO3\CMS\Lang\Domain\Repository\LanguageRepository
;
/**
* MailTemplateService
...
...
@@ -49,11 +45,12 @@ class MailTemplateService {
*/
public
static
function
registerTemplate
(
$extension
,
$templateName
,
$templatePath
,
$description
,
array
$marker
)
{
MailTemplateService
::
$registerArray
[
$
templateName
]
=
[
MailTemplateService
::
$registerArray
[
$
extension
][
]
=
[
'templatePath'
=>
$templatePath
,
'description'
=>
$description
,
'marker'
=>
$marker
,
'extension'
=>
$extension
'extension'
=>
$extension
,
'templateName'
=>
$templateName
];
}
...
...
Resources/Private/Layouts/Default.html
View file @
7b981445
...
...
@@ -7,23 +7,28 @@
<div
class=
"module-docheader-bar-column-left"
>
<div
class=
"btn-toolbar"
role=
"toolbar"
>
<f:be.menus.actionMenu>
<f:for
each=
"{templates}"
as=
"template"
key=
"templateKey"
>
<sgm:be.menus.actionMenuOptionGroup
label=
"{template.extension}"
>
<sgm:extendedIf
condition=
"{selectedTemplateKey} == {templateKey}"
>
<f:for
each=
"{templates}"
as=
"template"
key=
"extensionKey"
>
<sgm:be.menus.actionMenuOptionGroup
label=
"{extensionKey}"
>
<f:for
each=
"{template}"
as=
"currentTemplate"
key=
"templateKey"
>
<sgm:extendedIf
condition=
"{selectedTemplateKey} == {templateKey}"
and=
"{selectedExtensionKey} == {extensionKey}"
>
<f:then>
<sgm:be.menus.actionMenuItem
label=
"{
templateKey
}"
<sgm:be.menus.actionMenuItem
label=
"{
currentTemplate.templateName
}"
controller=
"Mail"
action=
"index"
arguments=
"{selectedTemplate: templateKey}"
arguments=
"{selectedTemplate: templateKey
, selectedExtension: extensionKey
}"
additionalAttributes=
"{selected: 'selected'}"
/>
</f:then>
<f:else>
<sgm:be.menus.actionMenuItem
label=
"{
templateKey
}"
<sgm:be.menus.actionMenuItem
label=
"{
currentTemplate.templateName
}"
controller=
"Mail"
action=
"index"
arguments=
"{selectedTemplate: templateKey}"
/>
arguments=
"{selectedTemplate: templateKey
, selectedExtension: extensionKey
}"
/>
</f:else>
</sgm:extendedIf>
</f:for>
</sgm:be.menus.actionMenuOptionGroup>
</f:for>
</f:be.menus.actionMenu>
...
...
Resources/Private/Templates/Mail/Index.html
View file @
7b981445
...
...
@@ -2,7 +2,6 @@
<f:layout
name=
"Default"
/>
<f:section
name=
"iconButtons"
>
</f:section>
<f:section
name=
"main"
>
<f:flashMessages
renderMode=
"div"
/>
...
...
@@ -32,14 +31,14 @@
<sgm:be.menus.actionMenuItem
label=
"{language}"
controller=
"Mail"
action=
"index"
arguments=
"{selectedLanguage: language, selectedTemplate: selectedTemplate, selectedTemplateKey: selectedTemplateKey}"
arguments=
"{selectedLanguage: language, selectedTemplate: selectedTemplate,
selectedExtensionKey: selectedExtensionKey,
selectedTemplateKey: selectedTemplateKey}"
additionalAttributes=
"{selected: 'selected'}"
/>
</f:then>
<f:else>
<sgm:be.menus.actionMenuItem
label=
"{language}"
controller=
"Mail"
action=
"index"
arguments=
"{selectedLanguage: language, selectedTemplate: selectedTemplate, selectedTemplateKey: selectedTemplateKey}"
/>
arguments=
"{selectedLanguage: language, selectedTemplate: selectedTemplate,
selectedExtensionKey: selectedExtensionKey,
selectedTemplateKey: selectedTemplateKey}"
/>
</f:else>
</sgm:extendedIf>
</f:for>
...
...
ext_localconf.php
View file @
7b981445
...
...
@@ -30,48 +30,46 @@ if (!defined('TYPO3_MODE')) {
/** @noinspection PhpUndefinedVariableInspection */
$extPath
=
\
TYPO3\CMS\Core\Utility\ExtensionManagementUtility
::
extPath
(
'sg_mail'
);
$templateFiles
=
[
$extPath
.
'Resources/Private/Templates/some-email.html'
,
$extPath
.
'Resources/Private/Templates/de.some-email.html'
];
$templatePath
=
$extPath
.
'Resources/Private/Templates/'
;
$marker
=
[
'header_content'
=>
[
'content'
=>
'HEADING'
,
'description'
=>
'This is the heading of the Email'
[
'marker'
=>
'kundennummer'
,
'value'
=>
'01234567890'
,
'description'
=>
'This is the Customer no'
],
'main_content'
=>
[
'content'
=>
'Lorem Ipsum'
,
'description'
=>
'The Content of the Mail'
[
'marker'
=>
'iban'
,
'value'
=>
'DE XXXXXXXXXX'
,
'description'
=>
'This is the Bank Information'
]
];
$description
=
'This is just a Test Email'
;
\
SGalinski\SgMail\Service\MailTemplateService
::
registerTemplate
(
'sg_mail'
,
'system test email'
,
$template
Files
,
$description
,
$marker
'sg_mail'
,
'system test email'
,
$template
Path
,
$description
,
$marker
);
$templateFiles
=
[
$extPath
.
'Resources/Private/Templates/some-email.html'
,
$extPath
.
'Resources/Private/Templates/de.some-email.html'
];
$templatePath
=
$extPath
.
'Resources/Private/'
;
$marker
=
[
'header_content'
=>
[
'content'
=>
'HEADING'
,
'description'
=>
'This is the heading of the Email'
[
'marker'
=>
'kundennummer'
,
'value'
=>
'6666666666666'
,
'description'
=>
'This is the Customer no'
],
'main_content'
=>
[
'content'
=>
'Lorem Ipsum'
,
'description'
=>
'The Content of the Mail'
[
'marker'
=>
'iban'
,
'value'
=>
'DE XXXXXXXXXX'
,
'description'
=>
'This is the Bank Information'
]
];
$description
=
'This is just a Test Email'
;
$description
=
'This is just a
another
Test Email'
;
\
SGalinski\SgMail\Service\MailTemplateService
::
registerTemplate
(
'sg_mail'
,
'test email
2
'
,
$template
Files
,
$description
,
$marker
'sg_mail'
,
'
system another
test email'
,
$template
Path
,
$description
,
$marker
);
if
(
TYPO3_MODE
===
'BE'
)
{
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment