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
c77ca08f
Commit
c77ca08f
authored
6 years ago
by
Torsten Oppermann
Browse files
Options
Downloads
Patches
Plain Diff
[TASK] Code cleanup
parent
df03c2cc
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Classes/Controller/ConfigurationController.php
+32
-27
32 additions, 27 deletions
Classes/Controller/ConfigurationController.php
with
32 additions
and
27 deletions
Classes/Controller/ConfigurationController.php
+
32
−
27
View file @
c77ca08f
<?php
<?php
/** @noinspection CallableParameterUseCaseInTypeContextInspection */
namespace
SGalinski\SgMail\Controller
;
...
...
@@ -27,28 +27,23 @@ namespace SGalinski\SgMail\Controller;
***************************************************************/
use
SGalinski\SgMail\Service\BackendService
;
use
SGalinski\SgMail\Service\MailTemplateService
;
use
SGalinski\SgMail\Service\RegisterService
;
use
SGalinski\SgMail\Service\TypoScriptSettingsService
;
use
SGalinski\SgMail\Session\PhpSession
;
use
TYPO3\CMS\Backend\Template\Components\DocHeaderComponent
;
use
TYPO3\CMS\Backend\Utility\BackendUtility
;
use
TYPO3\CMS\Core\Cache\CacheManager
;
use
TYPO3\CMS\Core\Cache\Frontend\FrontendInterface
;
use
TYPO3\CMS\Core\Messaging\FlashMessage
;
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\StopActionException
;
use
TYPO3\CMS\Extbase\Mvc\Exception\UnsupportedRequestTypeException
;
use
TYPO3\CMS\Extbase\Object\ObjectManager
;
use
TYPO3\CMS\Extbase\Utility\LocalizationUtility
;
/**
* Controller for the configuration mode of the backend module
*/
class
ConfigurationController
extends
ActionController
{
public
const
DEFAULT_EXTENSION_KEY
=
'sg_mail'
;
const
DEFAULT_EXTENSION_KEY
=
'sg_mail'
;
/**
* DocHeaderComponent
...
...
@@ -92,18 +87,24 @@ class ConfigurationController extends ActionController {
$this
->
view
->
assign
(
'mode'
,
$mode
);
if
(
$mode
===
'edit'
)
{
$templateToEdit
=
$registerArray
[
$selectedExtension
][
$selectedTemplate
];
$this
->
view
->
assign
(
'templateName'
,
$selectedTemplate
);
$this
->
view
->
assign
(
'subject'
,
$templateToEdit
[
'subject'
]);
$this
->
view
->
assign
(
'templateContent'
,
$templateToEdit
[
'templateContent'
]);
$csv
=
''
;
foreach
(
$templateToEdit
[
'marker'
]
as
$arr
)
{
$csv
.
=
implode
(
';'
,
$arr
)
.
"
\r\n
"
;
}
$this
->
view
->
assign
(
'csv'
,
$csv
);
$this
->
view
->
assign
(
'extensionKey'
,
$selectedExtension
);
$this
->
view
->
assign
(
'description'
,
$templateToEdit
[
'description'
]);
$this
->
view
->
assign
(
'editMode'
,
1
);
$this
->
view
->
assignMultiple
(
[
'templateName'
=>
$selectedTemplate
,
'subject'
=>
$templateToEdit
[
'subject'
],
'templateContent'
=>
$templateToEdit
[
'templateContent'
],
'csv'
=>
$csv
,
'extensionKey'
=>
$selectedExtension
,
'description'
=>
$templateToEdit
[
'description'
],
'editMode'
=>
1
]
);
}
// make docheader
...
...
@@ -115,13 +116,17 @@ class ConfigurationController extends ActionController {
$this
->
docHeaderComponent
->
setMetaInformation
(
$pageInfo
);
BackendService
::
makeButtons
(
$this
->
docHeaderComponent
,
$this
->
request
);
$this
->
view
->
assign
(
'docHeader'
,
$this
->
docHeaderComponent
->
docHeaderContent
());
$this
->
view
->
assign
(
'selectedTemplateFilter'
,
$filters
[
'filterTemplate'
]);
$this
->
view
->
assign
(
'selectedExtensionFilter'
,
$filters
[
'filterExtension'
]);
$this
->
view
->
assign
(
'typo3Version'
,
VersionNumberUtility
::
convertVersionNumberToInteger
(
TYPO3_version
));
$this
->
view
->
assign
(
'selectedTemplateKey'
,
$selectedTemplate
);
$this
->
view
->
assign
(
'selectedExtensionKey'
,
$selectedExtension
);
$this
->
view
->
assign
(
'mode'
,
'editor'
);
$this
->
view
->
assignMultiple
(
[
'docHeader'
=>
$this
->
docHeaderComponent
->
docHeaderContent
(),
'selectedTemplateFilter'
=>
$filters
[
'filterTemplate'
],
'selectedExtensionFilter'
=>
$filters
[
'filterExtension'
],
'typo3Version'
=>
VersionNumberUtility
::
convertVersionNumberToInteger
(
TYPO3_version
),
'selectedTemplateKey'
=>
$selectedTemplate
,
'selectedExtensionKey'
=>
$selectedExtension
,
'mode'
=>
'editor'
]
);
}
/**
...
...
@@ -132,7 +137,7 @@ class ConfigurationController extends ActionController {
* @throws \TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\NoSuchArgumentException
*/
public
function
createAction
()
:
void
{
public
function
createAction
()
{
if
(
!
$this
->
request
->
hasArgument
(
'configuration'
))
{
$this
->
redirect
(
'index'
,
'Configuration'
,
NULL
,
...
...
@@ -145,7 +150,7 @@ class ConfigurationController extends ActionController {
$templateName
=
$configuration
[
'templateName'
];
$extensionKey
=
$configuration
[
'extensionKey'
];
$csv
=
str_replace
(
"
\r
"
,
''
,
$configuration
[
'csv'
]);
$csv
=
\
str_replace
(
"
\r
"
,
''
,
$configuration
[
'csv'
]);
$subject
=
$configuration
[
'subject'
];
$description
=
$configuration
[
'description'
];
...
...
@@ -195,7 +200,7 @@ class ConfigurationController extends ActionController {
* @throws \TYPO3\CMS\Extbase\Mvc\Exception\NoSuchArgumentException
* @throws \TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException
*/
public
function
editAction
()
:
void
{
public
function
editAction
()
{
if
(
!
$this
->
request
->
hasArgument
(
'configuration'
))
{
$this
->
redirect
(
'index'
,
'Configuration'
,
NULL
,
...
...
@@ -210,14 +215,14 @@ class ConfigurationController extends ActionController {
$extensionKey
=
$configuration
[
'extensionKey'
];
$oldTemplateName
=
$configuration
[
'oldTemplateName'
];
$oldExtensionKey
=
$configuration
[
'oldExtensionKey'
];
$csv
=
str_replace
(
"
\r
"
,
''
,
$configuration
[
'csv'
]);
$csv
=
\
str_replace
(
"
\r
"
,
''
,
$configuration
[
'csv'
]);
$subject
=
$configuration
[
'subject'
];
$description
=
$configuration
[
'description'
];
$markersCsv
=
\explode
(
"
\n
"
,
$csv
);
$markers
=
[];
foreach
(
$markersCsv
as
$markerCsv
)
{
$rowArray
=
str_getcsv
(
$markerCsv
,
';'
);
$rowArray
=
\
str_getcsv
(
$markerCsv
,
';'
);
if
(
!
$rowArray
[
0
])
{
continue
;
}
...
...
@@ -262,7 +267,7 @@ class ConfigurationController extends ActionController {
* @throws UnsupportedRequestTypeException
* @throws \TYPO3\CMS\Core\Cache\Exception\NoSuchCacheException
*/
public
function
deleteAction
(
string
$selectedTemplate
,
string
$selectedExtension
)
:
void
{
public
function
deleteAction
(
string
$selectedTemplate
,
string
$selectedExtension
)
{
$registerService
=
$this
->
objectManager
->
get
(
RegisterService
::
class
);
$registerService
->
deleteTemplate
(
$selectedExtension
,
$selectedTemplate
);
$this
->
redirect
(
...
...
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