Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
sg_mail
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
TYPO3
sg_mail
Commits
02b6ae9e
Commit
02b6ae9e
authored
8 years ago
by
Torsten Oppermann
Browse files
Options
Downloads
Patches
Plain Diff
[TASK] Some code / cgl fixes
parent
9b8b03fd
No related branches found
Branches containing commit
No related tags found
Tags containing commit
1 merge request
!1
Feature sg mail
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
Classes/Controller/MailController.php
+24
-28
24 additions, 28 deletions
Classes/Controller/MailController.php
Configuration/TypoScript/constants.ts
+4
-0
4 additions, 0 deletions
Configuration/TypoScript/constants.ts
with
28 additions
and
28 deletions
Classes/Controller/MailController.php
+
24
−
28
View file @
02b6ae9e
...
...
@@ -43,7 +43,7 @@ class MailController extends ActionController {
protected
$languageRepository
=
NULL
;
/**
*
@todo Code-Dokumentation
*
Show template Selection and enable content input + mail preview
*
* @param string $selectedTemplate
* @param string $selectedExtension
...
...
@@ -74,8 +74,6 @@ class MailController extends ActionController {
$this
->
view
->
assign
(
'languages'
,
$languages
);
$this
->
view
->
assign
(
'templates'
,
MailTemplateService
::
getRegisterArray
());
// @todo Code-Formattierung. Keine new lines am Anfang und am Ende einer if-Bedingung
if
(
isset
(
$selectedTemplate
)
&&
!
isset
(
$selectedLanguageLeft
)
&&
!
isset
(
$selectedLanguageRight
)
...
...
@@ -89,10 +87,12 @@ class MailController extends ActionController {
}
elseif
(
!
isset
(
$selectedLanguageLeft
)
&&
!
isset
(
$selectedLanguageRight
))
{
$this
->
view
->
assign
(
// @todo Könnte ein Fehler schmeißen, wenn der Wert nicht existiert. Bin mir nicht sicher, besser isset() nutzen
'selectedTemplate'
,
MailTemplateService
::
getRegisterArray
()[
$firstEntry
][
$secondLevelFirstEntry
]
);
if
(
isset
(
MailTemplateService
::
getRegisterArray
()[
$firstEntry
][
$secondLevelFirstEntry
]))
{
$this
->
view
->
assign
(
'selectedTemplate'
,
MailTemplateService
::
getRegisterArray
()[
$firstEntry
][
$secondLevelFirstEntry
]
);
}
$this
->
view
->
assign
(
'selectedTemplateKey'
,
$secondLevelFirstEntry
);
$this
->
view
->
assign
(
'selectedExtensionKey'
,
$firstEntry
);
}
...
...
@@ -127,7 +127,6 @@ class MailController extends ActionController {
}
/**
* @todo Code-Dokumentation, unklar, bzw. falsch Beschrieben
*
* creates a language File for this Template
*
...
...
@@ -137,29 +136,28 @@ class MailController extends ActionController {
private
function
writeLanguageFile
(
\TYPO3\CMS\Lang\Domain\Model\Language
$language
,
$path
)
{
$currentLangFile
=
$path
.
$language
->
getLocale
()
.
'.sg_mail.locallang.html'
;
// @todo Wir machen early returns, so haben wir keine große Verschachtlung
if
(
!
file_exists
(
$currentLangFile
))
{
$langFileContent
=
'TEST: '
.
$language
->
getLocale
();
file_put_contents
(
$currentLangFile
,
$langFileContent
);
if
(
file_exists
(
$currentLangFile
))
{
return
;
}
$langFileContent
=
'TEST: '
.
$language
->
getLocale
();
file_put_contents
(
$currentLangFile
,
$langFileContent
);
}
/**
* Save content (left & right)
* if left & right is the same language, the right content will apply
* @todo Ungenutzter Parameter
*
* @param string $contentLeft
* @param string $contentRight
* @param string $selectedExtension
* @param string $selectedTemplate
* @param string $extensionKey
* @param string $selectedLanguageLeft
* @param string $selectedLanguageRight
*/
public
function
saveAction
(
$contentLeft
=
NULL
,
$contentRight
=
NULL
,
$selectedExtension
=
NULL
,
$selectedTemplate
=
NULL
,
$extensionKey
=
NULL
,
$selectedLanguageLeft
=
NULL
,
$selectedLanguageRight
=
NULL
$selectedLanguageLeft
=
NULL
,
$selectedLanguageRight
=
NULL
)
{
$templatePath
=
$this
->
getTemplatePath
(
$selectedExtension
,
$selectedTemplate
);
...
...
@@ -170,8 +168,7 @@ class MailController extends ActionController {
$filename
=
$templatePath
.
$selectedLanguageRight
.
'.sg_mail.locallang.html'
;
file_put_contents
(
$filename
,
$contentRight
);
// @todo SgMail -> sg_mail | Evtl. kein Fehler, da TYPO3 das für dich macht :)
$message
=
LocalizationUtility
::
translate
(
'backend.success'
,
'SgMail'
);
$message
=
LocalizationUtility
::
translate
(
'backend.success'
,
'sg_mail'
);
$this
->
addFlashMessage
(
$message
,
''
,
FlashMessage
::
OK
);
$arguments
=
$this
->
request
->
getArguments
();
...
...
@@ -202,34 +199,33 @@ class MailController extends ActionController {
}
/**
* @todo Rechtschreibung, Parameter vergessen bei param
*
* send a test email to a given address
* redirect to index action
*
* @param string $emailAddress
* @param string $
t
emplateKey
* @param string $
e
xtensionKey
* @param string $
l
anguageLeft
* @param string $
l
anguageRight
* @param string $
selectedT
emplateKey
* @param string $
selectedE
xtensionKey
* @param string $
selectedL
anguageLeft
* @param string $
selectedL
anguageRight
*/
public
function
sendTestMailAction
(
$emailAddress
=
NULL
,
$selectedExtensionKey
=
NULL
,
$selectedTemplateKey
=
NULL
,
$selectedLanguageLeft
=
NULL
,
$selectedLanguageRight
=
NULL
)
{
// @todo Die "From email" sollte eine TypoScript-Konfiguration sein.
MailTemplateService
::
sendEmail
(
$selectedLanguageLeft
,
$selectedTemplateKey
,
$selectedExtensionKey
,
$emailAddress
,
'test@sgmail.de'
,
$selectedLanguageLeft
,
$selectedTemplateKey
,
$selectedExtensionKey
,
$emailAddress
,
$this
->
settings
[
'mail'
][
'from'
][
'test'
],
'This is just a Test E-Mail'
,
[],
TRUE
);
MailTemplateService
::
sendEmail
(
$selectedLanguageRight
,
$selectedTemplateKey
,
$selectedExtensionKey
,
$emailAddress
,
'test@sgmail.de'
,
$selectedLanguageRight
,
$selectedTemplateKey
,
$selectedExtensionKey
,
$emailAddress
,
$this
->
settings
[
'mail'
][
'from'
][
'test'
],
'This is just a Test E-Mail'
,
[],
TRUE
);
// @todo SgMail -> sg_mail | Evtl. kein Fehler, da TYPO3 das für dich macht :)
$message
=
LocalizationUtility
::
translate
(
'backend.success_mail'
,
'SgMail'
);
$message
=
LocalizationUtility
::
translate
(
'backend.success_mail'
,
'sg_mail'
);
$this
->
addFlashMessage
(
$message
,
''
,
FlashMessage
::
OK
);
$arguments
=
$this
->
request
->
getArguments
();
...
...
This diff is collapsed.
Click to expand it.
Configuration/TypoScript/constants.ts
+
4
−
0
View file @
02b6ae9e
...
...
@@ -6,4 +6,8 @@ plugin.tx_sgcmail {
layoutRootPath
=
EXT
:
sg_mail
/
Resources
/
Private
/
Layouts
/
publicRootPath
=
EXT
:
sg_mail
/
Resources
/
Public
/
}
mail
{
from
.
test
=
'
info@test.de
'
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment