Commit 42d40735 authored by Manuel Selbach's avatar Manuel Selbach Committed by Wouter Wolters
Browse files

[TASK] Add backend routes for wizards (part 2)

Move all wizards to the Backend Routing for extension backend

Resolves: #68881
Releases: master
Change-Id: I76122ab0f40ba5aa97f28531a5a55efde28cff22
Reviewed-on: http://review.typo3.org/42447


Reviewed-by: Daniel Maier's avatarDaniel Maier <dani-maier@gmx.de>
Tested-by: Daniel Maier's avatarDaniel Maier <dani-maier@gmx.de>
Reviewed-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
parent f681fbf4
......@@ -14,6 +14,9 @@ namespace TYPO3\CMS\Backend\Controller;
* The TYPO3 project - inspiring people to share!
*/
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Core\Http\Response;
use TYPO3\CMS\Backend\Template\DocumentTemplate;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\Utility\IconUtility;
......@@ -28,7 +31,7 @@ use TYPO3\CMS\Core\Utility\ExtensionManagementUtility;
/**
* Script Class for grid wizard
*/
class BackendLayoutWizardController {
class BackendLayoutWizardController implements \TYPO3\CMS\Core\Http\ControllerInterface {
// GET vars:
// Wizard parameters, coming from TCEforms linking to the wizard.
......@@ -60,6 +63,13 @@ class BackendLayoutWizardController {
*/
public $fieldName;
/**
* Constructor
*/
public function __construct(){
$this->init();
}
/**
* Initialises the Class
*
......@@ -196,6 +206,22 @@ class BackendLayoutWizardController {
$this->doc->styleSheetFile_post = ExtensionManagementUtility::extRelPath('backend') . 'Resources/Public/Css/grideditor.css';
}
/**
* Injects the request object for the current request or subrequest
* As this controller goes only through the main() method, it is rather simple for now
*
* @param ServerRequestInterface $request
* @return ResponseInterface $response
*/
public function processRequest(ServerRequestInterface $request) {
$this->main();
/** @var Response $response */
$response = GeneralUtility::makeInstance(Response::class);
$response->getBody()->write($this->doc->render('Grid wizard', $this->content));
return $response;
}
/**
* Main Method, rendering either colorpicker or frameset depending on ->showPicker
*
......@@ -245,8 +271,10 @@ class BackendLayoutWizardController {
* Returns the sourcecode to the browser
*
* @return void
* @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8, use processRequest() instead
*/
public function printContent() {
GeneralUtility::logDeprecatedFunction();
echo $this->doc->render('Grid wizard', $this->content);
}
......
......@@ -14,6 +14,9 @@ namespace TYPO3\CMS\Backend\Controller\Wizard;
* The TYPO3 project - inspiring people to share!
*/
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Core\Http\Response;
use TYPO3\CMS\Backend\Form\DataPreprocessor;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Configuration\FlexForm\FlexFormTools;
......@@ -25,7 +28,7 @@ use TYPO3\CMS\Core\Utility\MathUtility;
/**
* Script Class for adding new items to a group/select field. Performs proper redirection as needed.
*/
class AddController extends AbstractWizardController {
class AddController extends AbstractWizardController implements \TYPO3\CMS\Core\Http\ControllerInterface {
/**
* Content accumulation for the module.
......@@ -137,6 +140,21 @@ class AddController extends AbstractWizardController {
}
}
/**
* Injects the request object for the current request or subrequest
* As this controller goes only through the main() method, it is rather simple for now
*
* @param ServerRequestInterface $request
* @return ResponseInterface $response
*/
public function processRequest(ServerRequestInterface $request) {
$this->main();
/** @var Response $response */
$response = GeneralUtility::makeInstance(Response::class);
return $response;
}
/**
* Main function
* Will issue a location-header, redirecting either BACK or to a new FormEngine instance...
......
......@@ -14,6 +14,9 @@ namespace TYPO3\CMS\Backend\Controller\Wizard;
* The TYPO3 project - inspiring people to share!
*/
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Core\Http\Response;
use TYPO3\CMS\Backend\Template\DocumentTemplate;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Page\PageRenderer;
......@@ -22,7 +25,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* Script Class for colorpicker wizard
*/
class ColorpickerController extends AbstractWizardController {
class ColorpickerController extends AbstractWizardController implements \TYPO3\CMS\Core\Http\ControllerInterface {
/**
* Wizard parameters, coming from FormEngine linking to the wizard.
......@@ -194,6 +197,25 @@ class ColorpickerController extends AbstractWizardController {
$this->content .= $this->doc->startPage($this->getLanguageService()->getLL('colorpicker_title'));
}
/**
* Injects the request object for the current request or subrequest
* As this controller goes only through the main() method, it is rather simple for now
*
* @param ServerRequestInterface $request
* @return ResponseInterface $response
*/
public function processRequest(ServerRequestInterface $request) {
$this->main();
$this->content .= $this->doc->endPage();
$this->content = $this->doc->insertStylesAndJS($this->content);
/** @var Response $response */
$response = GeneralUtility::makeInstance(Response::class);
$response->getBody()->write($this->content);
return $response;
}
/**
* Main Method, rendering either colorpicker or frameset depending on ->showPicker
*
......@@ -252,8 +274,10 @@ class ColorpickerController extends AbstractWizardController {
* Returns the sourcecode to the browser
*
* @return void
* @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8, use processRequest() instead
*/
public function printContent() {
GeneralUtility::logDeprecatedFunction();
$this->content .= $this->doc->endPage();
$this->content = $this->doc->insertStylesAndJS($this->content);
echo $this->content;
......
......@@ -14,6 +14,9 @@ namespace TYPO3\CMS\Backend\Controller\Wizard;
* The TYPO3 project - inspiring people to share!
*/
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Core\Http\Response;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Database\RelationHandler;
use TYPO3\CMS\Core\Utility\GeneralUtility;
......@@ -22,7 +25,7 @@ use TYPO3\CMS\Core\Utility\HttpUtility;
/**
* Script Class for redirecting a backend user to the editing form when an "Edit wizard" link was clicked in FormEngine somewhere
*/
class EditController extends AbstractWizardController {
class EditController extends AbstractWizardController implements \TYPO3\CMS\Core\Http\ControllerInterface {
/**
* Wizard parameters, coming from FormEngine linking to the wizard.
......@@ -38,6 +41,13 @@ class EditController extends AbstractWizardController {
*/
public $doClose;
/**
* A little JavaScript to close the open window.
*
* @var string
*/
protected $closeWindow = '<script language="javascript" type="text/javascript">close();</script>';
/**
* Constructor
*/
......@@ -59,15 +69,31 @@ class EditController extends AbstractWizardController {
$this->doClose = GeneralUtility::_GP('doClose');
}
/**
* Injects the request object for the current request or subrequest
* As this controller goes only through the main() method, it is rather simple for now
*
* @param ServerRequestInterface $request
* @return ResponseInterface $response
*/
public function processRequest(ServerRequestInterface $request) {
$content = $this->main();
/** @var Response $response */
$response = GeneralUtility::makeInstance(Response::class);
$response->getBody()->write($content);
return $response;
}
/**
* Main function
* Makes a header-location redirect to an edit form IF POSSIBLE from the passed data - otherwise the window will just close.
*
* @return void
* @return string
*/
public function main() {
if ($this->doClose) {
$this->closeWindow();
return $this->closeWindow;
}
// Initialize:
$table = $this->P['table'];
......@@ -105,7 +131,7 @@ class EditController extends AbstractWizardController {
$url = BackendUtility::getModuleUrl('record_edit', $urlParameters);
HttpUtility::redirect($url);
} else {
$this->closeWindow();
return $this->closeWindow;
}
}
......@@ -113,9 +139,11 @@ class EditController extends AbstractWizardController {
* Printing a little JavaScript to close the open window.
*
* @return void
* @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
*/
public function closeWindow() {
echo '<script language="javascript" type="text/javascript">close();</script>';
GeneralUtility::logDeprecatedFunction();
echo $this->closeWindow;
die;
}
......
......@@ -14,13 +14,16 @@ namespace TYPO3\CMS\Backend\Controller\Wizard;
* The TYPO3 project - inspiring people to share!
*/
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Core\Http\Response;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* Script Class for redirecting the user to the Web > List module if a wizard-link has been clicked in FormEngine
*/
class ListController extends AbstractWizardController {
class ListController extends AbstractWizardController implements \TYPO3\CMS\Core\Http\ControllerInterface {
/**
* @var int
......@@ -59,6 +62,21 @@ class ListController extends AbstractWizardController {
$this->id = GeneralUtility::_GP('id');
}
/**
* Injects the request object for the current request or subrequest
* As this controller goes only through the main() method, it is rather simple for now
*
* @param ServerRequestInterface $request
* @return ResponseInterface $response
*/
public function processRequest(ServerRequestInterface $request) {
$this->main();
/** @var Response $response */
$response = GeneralUtility::makeInstance(Response::class);
return $response;
}
/**
* Main function
* Will issue a location-header, redirecting either BACK or to a new FormEngine instance...
......
......@@ -14,6 +14,9 @@ namespace TYPO3\CMS\Backend\Controller\Wizard;
* The TYPO3 project - inspiring people to share!
*/
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Core\Http\Response;
use TYPO3\CMS\Backend\Form\DataPreprocessor;
use TYPO3\CMS\Backend\Form\FormEngine;
use TYPO3\CMS\Backend\Form\Utility\FormEngineUtility;
......@@ -27,7 +30,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* Script class for rendering the full screen RTE display
*/
class RteController extends AbstractWizardController {
class RteController extends AbstractWizardController implements \TYPO3\CMS\Core\Http\ControllerInterface {
/**
* Document template object
......@@ -108,6 +111,22 @@ class RteController extends AbstractWizardController {
$this->doc->form = '<form action="' . htmlspecialchars(BackendUtility::getModuleUrl('tce_db')) . '" method="post" enctype="multipart/form-data" name="editform" onsubmit="return TBE_EDITOR.checkSubmit(1);">';
}
/**
* Injects the request object for the current request or subrequest
* As this controller goes only through the main() method, it is rather simple for now
*
* @param ServerRequestInterface $request
* @return ResponseInterface $response
*/
public function processRequest(ServerRequestInterface $request) {
$this->main();
/** @var Response $response */
$response = GeneralUtility::makeInstance(Response::class);
$response->getBody()->write($this->content);
return $response;
}
/**
* Main function, rendering the document with the iFrame with the RTE in.
*
......@@ -198,8 +217,10 @@ class RteController extends AbstractWizardController {
* Outputting the accumulated content to screen
*
* @return void
* @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8, use processRequest() instead
*/
public function printContent() {
GeneralUtility::logDeprecatedFunction();
echo $this->content;
}
......
......@@ -14,6 +14,9 @@ namespace TYPO3\CMS\Backend\Controller\Wizard;
* The TYPO3 project - inspiring people to share!
*/
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use TYPO3\CMS\Core\Http\Response;
use TYPO3\CMS\Backend\Template\DocumentTemplate;
use TYPO3\CMS\Backend\Utility\BackendUtility;
use TYPO3\CMS\Backend\Utility\IconUtility;
......@@ -29,7 +32,7 @@ use TYPO3\CMS\Core\Utility\StringUtility;
/**
* Script Class for rendering the Table Wizard
*/
class TableController extends AbstractWizardController {
class TableController extends AbstractWizardController implements \TYPO3\CMS\Core\Http\ControllerInterface {
/**
* Document template object
......@@ -145,6 +148,22 @@ class TableController extends AbstractWizardController {
$this->tableParsing_quote = '';
}
/**
* Injects the request object for the current request or subrequest
* As this controller goes only through the main() method, it is rather simple for now
*
* @param ServerRequestInterface $request
* @return ResponseInterface $response
*/
public function processRequest(ServerRequestInterface $request) {
$this->main();
/** @var Response $response */
$response = GeneralUtility::makeInstance(Response::class);
$response->getBody()->write($this->content);
return $response;
}
/**
* Main function, rendering the table wizard
*
......@@ -171,8 +190,10 @@ class TableController extends AbstractWizardController {
* Outputting the accumulated content to screen
*
* @return void
* @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8, use processRequest() instead
*/
public function printContent() {
GeneralUtility::logDeprecatedFunction();
echo $this->content;
}
......
......@@ -31,5 +31,47 @@ return [
'logout' => [
'path' => '/logout',
'controller' => Controller\LogoutController::class
]
],
// Register backend_layout wizard
'wizard_backend_layout' => [
'path' => '/wizard/backendlayout',
'controller' => \TYPO3\CMS\Backend\Controller\BackendLayoutWizardController::class
],
// Register colorpicker wizard
'wizard_colorpicker' => [
'path' => '/wizard/colorpicker',
'controller' => \TYPO3\CMS\Backend\Controller\Wizard\ColorpickerController::class
],
// Register table wizard
'wizard_table' => [
'path' => '/wizard/table',
'controller' => \TYPO3\CMS\Backend\Controller\Wizard\TableController::class
],
// Register rte wizard
'wizard_rte' => [
'path' => '/wizard/rte',
'controller' => \TYPO3\CMS\Backend\Controller\Wizard\RteController::class
],
// Register add wizard
'wizard_add' => [
'path' => '/wizard/add',
'controller' => \TYPO3\CMS\Backend\Controller\Wizard\AddController::class
],
// Register list wizard
'wizard_list' => [
'path' => '/wizard/list',
'controller' => \TYPO3\CMS\Backend\Controller\Wizard\ListController::class
],
// Register edit wizard
'wizard_edit' => [
'path' => '/wizard/edit',
'controller' => \TYPO3\CMS\Backend\Controller\Wizard\EditController::class
],
];
<?php
$MCONF['name'] = 'wizard_add';
$MCONF['script'] = '_DISPATCH';
\ No newline at end of file
<?php
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
/**
* Wizard to add new records to a group/select TCEform formfield
*/
$editController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Controller\Wizard\AddController::class);
$editController->main();
<?php
$MCONF['name'] = 'wizard_backend_layout';
$MCONF['script'] = '_DISPATCH';
\ No newline at end of file
<?php
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
/**
* Grid wizard
*/
$backendLayoutWizardController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Controller\BackendLayoutWizardController::class);
$backendLayoutWizardController->init();
$backendLayoutWizardController->main();
$backendLayoutWizardController->printContent();
\ No newline at end of file
<?php
$MCONF['name'] = 'wizard_colorpicker';
$MCONF['script'] = '_DISPATCH';
\ No newline at end of file
<?php
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
/**
* Wizard for choosing colors in TCEforms
*/
$colorpickerController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Controller\Wizard\ColorpickerController::class);
$colorpickerController->main();
$colorpickerController->printContent();
<?php
$MCONF['name'] = 'wizard_edit';
$MCONF['script'] = '_DISPATCH';
\ No newline at end of file
<?php
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
/**
* Wizard to edit records from group/select lists in TCEforms
*/
$editController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Controller\Wizard\EditController::class);
$editController->main();
<?php
$MCONF['name'] = 'wizard_list';
$MCONF['script'] = '_DISPATCH';
\ No newline at end of file
<?php
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
/**
* Wizard to list records from a page id.
*/
$listController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Controller\Wizard\ListController::class);
$listController->main();
<?php
$MCONF['name'] = 'wizard_rte';
$MCONF['script'] = '_DISPATCH';
\ No newline at end of file
<?php
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
/**
* Wizard to display the RTE in "full screen" mode
*/
\TYPO3\CMS\Backend\Utility\BackendUtility::lockRecords();