[TASK] Add backend routes for wizards 59/42359/9
authorBenjamin Mack <benni@typo3.org>
Fri, 7 Aug 2015 10:09:24 +0000 (12:09 +0200)
committerPhilipp Gampe <philipp.gampe@typo3.org>
Sat, 8 Aug 2015 17:09:35 +0000 (19:09 +0200)
Move all wizards to the Backend Routing

Resolves: #68858
Releases: master
Change-Id: I33efb406232d108d320eb120707ce80186cbbbeb
Reviewed-on: http://review.typo3.org/42359
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Philipp Gampe <philipp.gampe@typo3.org>
Tested-by: Philipp Gampe <philipp.gampe@typo3.org>
28 files changed:
typo3/sysext/compatibility6/Classes/Controller/Wizard/FormsController.php
typo3/sysext/compatibility6/Configuration/Backend/Routes.php [new file with mode: 0644]
typo3/sysext/compatibility6/Modules/Wizards/FormsWizard/conf.php [deleted file]
typo3/sysext/compatibility6/Modules/Wizards/FormsWizard/index.php [deleted file]
typo3/sysext/compatibility6/ext_tables.php
typo3/sysext/openid/Classes/Wizard.php
typo3/sysext/openid/Configuration/Backend/Routes.php [new file with mode: 0644]
typo3/sysext/openid/ext_tables.php
typo3/sysext/openid/wizard/conf.php [deleted file]
typo3/sysext/openid/wizard/index.php [deleted file]
typo3/sysext/recordlist/Classes/Browser/ElementBrowser.php
typo3/sysext/recordlist/Classes/Controller/ElementBrowserController.php
typo3/sysext/recordlist/Configuration/Backend/Routes.php [new file with mode: 0644]
typo3/sysext/recordlist/Modules/Wizards/ElementBrowserWizard/conf.php [deleted file]
typo3/sysext/recordlist/Modules/Wizards/ElementBrowserWizard/index.php [deleted file]
typo3/sysext/recordlist/ext_tables.php
typo3/sysext/rtehtmlarea/Classes/Controller/ParseHtmlController.php
typo3/sysext/rtehtmlarea/Classes/Controller/UserElementsController.php
typo3/sysext/rtehtmlarea/Configuration/Backend/Routes.php [new file with mode: 0644]
typo3/sysext/rtehtmlarea/Modules/BrowseLinks/conf.php [deleted file]
typo3/sysext/rtehtmlarea/Modules/BrowseLinks/index.php [deleted file]
typo3/sysext/rtehtmlarea/Modules/ParseHtml/conf.php [deleted file]
typo3/sysext/rtehtmlarea/Modules/ParseHtml/index.php [deleted file]
typo3/sysext/rtehtmlarea/Modules/SelectImage/conf.php [deleted file]
typo3/sysext/rtehtmlarea/Modules/SelectImage/index.php [deleted file]
typo3/sysext/rtehtmlarea/Modules/UserElements/conf.php [deleted file]
typo3/sysext/rtehtmlarea/Modules/UserElements/index.php [deleted file]
typo3/sysext/rtehtmlarea/ext_tables.php

index 02ece6f..e7d3bd7 100644 (file)
@@ -14,6 +14,9 @@ namespace TYPO3\CMS\Compatibility6\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\Backend\Utility\IconUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
@@ -105,7 +108,7 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
  *
  * The XML/phpArray structure is the internal format of the wizard.
  */
-class FormsController extends \TYPO3\CMS\Backend\Controller\Wizard\AbstractWizardController {
+class FormsController extends \TYPO3\CMS\Backend\Controller\Wizard\AbstractWizardController implements \TYPO3\CMS\Core\Http\ControllerInterface {
 
        /**
         * document template object
@@ -189,6 +192,22 @@ class FormsController extends \TYPO3\CMS\Backend\Controller\Wizard\AbstractWizar
        }
 
        /**
+        * 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 for rendering the form wizard HTML
         *
         * @return void
@@ -214,8 +233,10 @@ class FormsController extends \TYPO3\CMS\Backend\Controller\Wizard\AbstractWizar
         * 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;
        }
 
@@ -305,7 +326,7 @@ class FormsController extends \TYPO3\CMS\Backend\Controller\Wizard\AbstractWizar
                                $cfgArr = $this->cfgString2CfgArray($bodyText);
                        }
                        // If a save button has been pressed, then save the new field content:
-                       if ($_POST['savedok_x'] || $_POST['saveandclosedok_x']) {
+                       if (isset($_POST['savedok']) || isset($_POST['saveandclosedok'])) {
                                // Make TCEmain object:
                                $tce = GeneralUtility::makeInstance(\TYPO3\CMS\Core\DataHandling\DataHandler::class);
                                $tce->stripslashes_values = 0;
@@ -321,7 +342,7 @@ class FormsController extends \TYPO3\CMS\Backend\Controller\Wizard\AbstractWizar
                                // Re-load the record content:
                                $row = BackendUtility::getRecord($this->P['table'], $this->P['uid']);
                                // If the save/close button was pressed, then redirect the screen:
-                               if ($_POST['saveandclosedok_x']) {
+                               if (isset($_POST['saveandclosedok'])) {
                                        \TYPO3\CMS\Core\Utility\HttpUtility::redirect(GeneralUtility::sanitizeLocalUrl($this->P['returnUrl']));
                                }
                        }
diff --git a/typo3/sysext/compatibility6/Configuration/Backend/Routes.php b/typo3/sysext/compatibility6/Configuration/Backend/Routes.php
new file mode 100644 (file)
index 0000000..dfed485
--- /dev/null
@@ -0,0 +1,11 @@
+<?php
+/**
+ * Definitions of routes
+ */
+return [
+       // Register wizard
+       'wizard_forms' => [
+               'path' => '/wizard/forms',
+               'controller' => \TYPO3\CMS\Compatibility6\Controller\Wizard\FormsController::class
+       ]
+];
diff --git a/typo3/sysext/compatibility6/Modules/Wizards/FormsWizard/conf.php b/typo3/sysext/compatibility6/Modules/Wizards/FormsWizard/conf.php
deleted file mode 100644 (file)
index ea2c6d3..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-<?php
-$MCONF['name'] = 'wizard_forms';
-$MCONF['script'] = '_DISPATCH';
\ No newline at end of file
diff --git a/typo3/sysext/compatibility6/Modules/Wizards/FormsWizard/index.php b/typo3/sysext/compatibility6/Modules/Wizards/FormsWizard/index.php
deleted file mode 100644 (file)
index af4eaf8..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-<?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 help make forms (fx. for tt_content elements) of type 'form'.
- */
-$formsController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Compatibility6\Controller\Wizard\FormsController::class);
-$formsController->main();
-$formsController->printContent();
index f322fa2..a0601bc 100644 (file)
@@ -9,11 +9,4 @@ if (TYPO3_MODE === 'BE') {
                'LLL:EXT:compatibility6/Resources/Private/Language/wizards.xlf:mod_wizards'
        );
        \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addLLrefForTCAdescr('_MOD_web_func', 'EXT:compatibility6/Resources/Private/Language/wizards_csh.xlf');
-
-
-       // Register forms wizard
-       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModulePath(
-               'wizard_forms',
-               'EXT:compatibility6/Modules/Wizards/FormsWizard/'
-       );
 }
index 50ca2b3..2bc5972 100644 (file)
@@ -13,7 +13,9 @@ namespace TYPO3\CMS\Openid;
  *
  * 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\Messaging\FlashMessage;
 use TYPO3\CMS\Core\Messaging\FlashMessageService;
@@ -25,7 +27,7 @@ use TYPO3\CMS\Lang\LanguageService;
 /**
  * OpenID selection wizard for the backend
  */
-class Wizard extends OpenidService {
+class Wizard extends OpenidService implements \TYPO3\CMS\Core\Http\ControllerInterface {
 
        /**
         * OpenID of the user after authentication
@@ -49,11 +51,38 @@ class Wizard extends OpenidService {
        protected $parentFormFieldChangeFunc;
 
        /**
+        * Injects the request object for the current request or subrequest
+        * Process the wizard and render HTML to response
+        *
+        * @param ServerRequestInterface $request
+        * @return ResponseInterface $response
+        */
+       public function processRequest(ServerRequestInterface $request) {
+               $this->processWizard();
+               $content = $this->renderContent();
+
+               /** @var Response $response */
+               $response = GeneralUtility::makeInstance(Response::class);
+               $response->getBody()->write($content);
+               return $response;
+       }
+
+       /**
         * Run the wizard and output HTML.
         *
         * @return void
+        * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8, use processRequest() instead
         */
        public function main() {
+               GeneralUtility::logDeprecatedFunction();
+               $this->processWizard();
+               $this->renderHtml();
+       }
+
+       /**
+        * Run the wizard
+        */
+       protected function processWizard(){
                $p = GeneralUtility::_GP('P');
                if (isset($p['itemName'])) {
                        $this->parentFormItemName = $p['itemName'];
@@ -78,15 +107,14 @@ class Wizard extends OpenidService {
                        $flashMessage = GeneralUtility::makeInstance(
                                FlashMessage::class,
                                sprintf(
-                                       $this->getLanguageService()->sL('LLL:EXT:openid/Resources/Private/Language/locallang.xlf:error.setup'),
-                                       htmlspecialchars($openIDIdentifier)
+                                               $this->getLanguageService()->sL('LLL:EXT:openid/Resources/Private/Language/locallang.xlf:error.setup'),
+                                               htmlspecialchars($openIDIdentifier)
                                ),
                                $this->getLanguageService()->sL('LLL:EXT:openid/Resources/Private/Language/locallang.xlf:title.error'),
                                FlashMessage::ERROR
                        );
                        $flashMessageService->getMessageQueueByIdentifier()->enqueue($flashMessage);
                }
-               $this->renderHtml();
        }
 
        /**
@@ -158,11 +186,11 @@ class Wizard extends OpenidService {
        }
 
        /**
-        * Render HTML with message and OpenID form and output it
+        * Render HTML with message and OpenID form
         *
-        * @return void
+        * @return string
         */
-       protected function renderHtml() {
+       protected function renderContent() {
                // use FLUID standalone view for wizard content
                $view = GeneralUtility::makeInstance(StandaloneView::class);
                $view->getRequest()->setControllerExtensionName('openid');
@@ -190,8 +218,17 @@ class Wizard extends OpenidService {
                        $view->assign('openid_url', $_REQUEST['openid_url']);
                }
 
+               return $view->render();
+       }
+
+       /**
+        * Render HTML and output it
+        *
+        * @return void
+        */
+       protected function renderHtml(){
                header('HTTP/1.0 200 OK');
-               echo $view->render();
+               echo $this->renderContent();
        }
 
        /**
diff --git a/typo3/sysext/openid/Configuration/Backend/Routes.php b/typo3/sysext/openid/Configuration/Backend/Routes.php
new file mode 100644 (file)
index 0000000..36d79f3
--- /dev/null
@@ -0,0 +1,11 @@
+<?php
+/**
+ * Definitions of routes
+ */
+return [
+       // Register wizard
+       'wizard_openid' => [
+               'path' => '/wizard/openid',
+               'controller' => \TYPO3\CMS\Openid\Wizard::class
+       ]
+];
index 2004099..185b4a2 100644 (file)
@@ -2,11 +2,6 @@
 defined('TYPO3_MODE') or die();
 
 if (TYPO3_MODE === 'BE') {
-       // Register wizard
-       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModulePath(
-               'wizard_openid',
-               'EXT:openid/wizard/'
-       );
 
        // Add field to setup module
        $GLOBALS['TYPO3_USER_SETTINGS']['columns']['tx_openid_openid'] = array(
diff --git a/typo3/sysext/openid/wizard/conf.php b/typo3/sysext/openid/wizard/conf.php
deleted file mode 100644 (file)
index 1c2d1d5..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-<?php
-$MCONF['name'] = 'wizard_openid';
-$MCONF['script'] = '_DISPATCH';
\ No newline at end of file
diff --git a/typo3/sysext/openid/wizard/index.php b/typo3/sysext/openid/wizard/index.php
deleted file mode 100644 (file)
index fbee2a0..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-<?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 = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Openid\Wizard::class);
-$wizard->main();
index 7aa9d0b..e8ace7f 100755 (executable)
@@ -272,7 +272,12 @@ class ElementBrowser {
         * Sets the script url depending on being a module or script request
         */
        protected function determineScriptUrl() {
-               if ($moduleName = GeneralUtility::_GP('M')) {
+               if ($routePath = GeneralUtility::_GP('route')) {
+                       $router = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\Router::class);
+                       $route = $router->match($routePath);
+                       $uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
+                       $this->thisScript = (string)$uriBuilder->buildUriFromRoute($route->getOption('_identifier'));
+               } elseif ($moduleName = GeneralUtility::_GP('M')) {
                        $this->thisScript = BackendUtility::getModuleUrl($moduleName);
                } else {
                        $this->thisScript = GeneralUtility::getIndpEnv('SCRIPT_NAME');
index 8a14d52..acc5c1f 100644 (file)
@@ -14,8 +14,11 @@ namespace TYPO3\CMS\Recordlist\Controller;
  * The TYPO3 project - inspiring people to share!
  */
 
+use Psr\Http\Message\ServerRequestInterface;
+use Psr\Http\Message\ResponseInterface;
 use TYPO3\CMS\Backend\Template\DocumentTemplate;
 use TYPO3\CMS\Core\Authentication\BackendUserAuthentication;
+use TYPO3\CMS\Core\Http\Response;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Lang\LanguageService;
 use TYPO3\CMS\Recordlist\Browser\ElementBrowser;
@@ -23,7 +26,7 @@ use TYPO3\CMS\Recordlist\Browser\ElementBrowser;
 /**
  * Script class for the Element Browser window.
  */
-class ElementBrowserController {
+class ElementBrowserController implements \TYPO3\CMS\Core\Http\ControllerInterface {
 
        /**
         * The mode determines the main kind of output from the element browser.
@@ -74,9 +77,6 @@ class ElementBrowserController {
                $this->init();
        }
 
-       /**
-        * Init controller
-        */
        protected function init() {
                $this->getLanguageService()->includeLLFile('EXT:lang/locallang_browse_links.xlf');
 
@@ -87,6 +87,22 @@ class ElementBrowserController {
        }
 
        /**
+        * 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, detecting the current mode of the element browser and branching out to internal methods.
         *
         * @return void
@@ -188,8 +204,10 @@ class ElementBrowserController {
         * Print module content
         *
         * @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;
        }
 
diff --git a/typo3/sysext/recordlist/Configuration/Backend/Routes.php b/typo3/sysext/recordlist/Configuration/Backend/Routes.php
new file mode 100644 (file)
index 0000000..ecc9bcf
--- /dev/null
@@ -0,0 +1,11 @@
+<?php
+/**
+ * Definitions of routes
+ */
+return [
+       // Register wizard element browser
+       'wizard_element_browser' => [
+               'path' => '/wizard/record/browse',
+               'controller' => \TYPO3\CMS\Recordlist\Controller\ElementBrowserController::class
+       ]
+];
\ No newline at end of file
diff --git a/typo3/sysext/recordlist/Modules/Wizards/ElementBrowserWizard/conf.php b/typo3/sysext/recordlist/Modules/Wizards/ElementBrowserWizard/conf.php
deleted file mode 100644 (file)
index 6122409..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-<?php
-$MCONF['name'] = 'wizard_browse_links';
-$MCONF['script'] = '_DISPATCH';
\ No newline at end of file
diff --git a/typo3/sysext/recordlist/Modules/Wizards/ElementBrowserWizard/index.php b/typo3/sysext/recordlist/Modules/Wizards/ElementBrowserWizard/index.php
deleted file mode 100644 (file)
index 93f1c53..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<?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!
- */
-
-/**
- * Displays the page/file tree for browsing database records or files.
- * Used from TCEFORMS an other elements
- * In other words: This is the ELEMENT BROWSER!
- */
-$elementBrowserController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Recordlist\Controller\ElementBrowserController::class);
-$elementBrowserController->main();
-$elementBrowserController->printContent();
index aaed399..107d003 100644 (file)
@@ -23,10 +23,4 @@ if (TYPO3_MODE === 'BE') {
                        ),
                )
        );
-
-       // Register element browser wizard
-       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModulePath(
-               'wizard_element_browser',
-               'EXT:recordlist/Modules/Wizards/ElementBrowserWizard/'
-       );
 }
\ No newline at end of file
index 3210d71..d584d19 100644 (file)
@@ -14,12 +14,15 @@ namespace TYPO3\CMS\Rtehtmlarea\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\Core\Utility\GeneralUtility;
 
 /**
  * Content parsing for htmlArea RTE
  */
-class ParseHtmlController {
+class ParseHtmlController implements \TYPO3\CMS\Core\Http\ControllerInterface {
 
        /**
         * @var string
@@ -49,6 +52,13 @@ class ParseHtmlController {
        public $prefixId = 'TYPO3HtmlParser';
 
        /**
+        * Initialize
+        */
+       public function __construct() {
+               $this->init();
+       }
+
+       /**
         * @return void
         */
        public function init() {
@@ -63,11 +73,30 @@ class ParseHtmlController {
        }
 
        /**
+        * Injects the request object for the current request or subrequest
+        * As this controller goes only through the main_parse_html() method, it is rather simple for now
+        *
+        * @param ServerRequestInterface $request
+        * @return ResponseInterface $response
+        */
+       public function processRequest(ServerRequestInterface $request) {
+               $this->content .= $this->main_parse_html($this->modData['openKeys']);
+
+               /** @var Response $response */
+               $response = GeneralUtility::makeInstance(Response::class);
+               $response->getBody()->write($this->content);
+               $response = $response->withHeader('Content-Type', 'text/plain; charset=utf-8');
+               return $response;
+       }
+
+       /**
         * Main function
         *
         * @return void
+        * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8, use main_parse_html() instead
         */
        public function main() {
+               GeneralUtility::logDeprecatedFunction();
                $this->content .= $this->main_parse_html($this->modData['openKeys']);
                header('Content-Type: text/plain; charset=utf-8');
        }
@@ -76,8 +105,10 @@ class ParseHtmlController {
         * Print content
         *
         * @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;
        }
 
index 2de4907..8a157e9 100644 (file)
@@ -13,14 +13,16 @@ namespace TYPO3\CMS\Rtehtmlarea\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\Utility\BackendUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 
 /**
  * User defined content for htmlArea RTE
  */
-class UserElementsController {
+class UserElementsController implements \TYPO3\CMS\Core\Http\ControllerInterface {
 
        /**
         * @var string
@@ -55,6 +57,8 @@ class UserElementsController {
        public function __construct() {
                $GLOBALS['LANG']->includeLLFile('EXT:rtehtmlarea/Resources/Private/Language/locallang_userelementscontroller.xlf');
                $GLOBALS['LANG']->includeLLFile('EXT:rtehtmlarea/Resources/Private/Language/locallang_dialogs.xlf');
+
+               $this->init();
        }
 
        /**
@@ -118,11 +122,29 @@ class UserElementsController {
        }
 
        /**
+        * Injects the request object for the current request or subrequest
+        * As this controller goes only through the main_user() method, it is rather simple for now
+        *
+        * @param ServerRequestInterface $request
+        * @return ResponseInterface $response
+        */
+       public function processRequest(ServerRequestInterface $request) {
+               $content = $this->main_user($this->modData['openKeys']);
+
+               /** @var Response $response */
+               $response = GeneralUtility::makeInstance(Response::class);
+               $response->getBody()->write($content);
+               return $response;
+       }
+
+       /**
         * Main function
         *
         * @return void
+        * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8, use main_user() instead
         */
        public function main() {
+               GeneralUtility::logDeprecatedFunction();
                $this->content = '';
                $this->content .= $this->main_user($this->modData['openKeys']);
        }
@@ -131,8 +153,10 @@ class UserElementsController {
         * Print content
         *
         * @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;
        }
 
@@ -271,7 +295,11 @@ class UserElementsController {
                                } else {
                                        $title = $GLOBALS['LANG']->sL($title, TRUE);
                                }
-                               $lines[] = '<tr><td colspan="3" class="bgColor5"><a href="#" title="' . $GLOBALS['LANG']->getLL('expand', TRUE) . '" onClick="jumpToUrl(' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl($GLOBALS['MCONF']['name'], array('OC_key' => ($openKeys[$openK] ? 'C|' : 'O|') . $openK))) . ');return false;"><i class="fa fa-caret-square-o-' . ($openKeys[$openK] ? 'left' : 'right') . '" title="' . $GLOBALS['LANG']->getLL('expand', TRUE) . '"></i><strong>' . $title . '</strong></a></td></tr>';
+
+                               $uriBuilder = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Routing\UriBuilder::class);
+                               $url = (string)$uriBuilder->buildUriFromRoute('rtehtmlarea_wizard_user_elements', array('OC_key' => ($openKeys[$openK] ? 'C|' : 'O|') . $openK));
+
+                               $lines[] = '<tr><td colspan="3" class="bgColor5"><a href="#" title="' . $GLOBALS['LANG']->getLL('expand', TRUE) . '" onClick="jumpToUrl(' . GeneralUtility::quoteJSvalue($url) . ');return false;"><i class="fa fa-caret-square-o-' . ($openKeys[$openK] ? 'left' : 'right') . '" title="' . $GLOBALS['LANG']->getLL('expand', TRUE) . '"></i><strong>' . $title . '</strong></a></td></tr>';
                                $lines[] = $v;
                        }
                        $content .= '<table border="0" cellpadding="1" cellspacing="1">' . implode('', $lines) . '</table>';
diff --git a/typo3/sysext/rtehtmlarea/Configuration/Backend/Routes.php b/typo3/sysext/rtehtmlarea/Configuration/Backend/Routes.php
new file mode 100644 (file)
index 0000000..a407300
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+
+/**
+ * Definitions of routes
+ */
+return [
+       // Register RTE browse links wizard
+       'rtehtmlarea_wizard_browse_links' => [
+               'path' => '/rte/wizard/link',
+               'controller' => \TYPO3\CMS\Rtehtmlarea\Controller\BrowseLinksController::class
+       ],
+       // Register RTE select image wizard
+       'rtehtmlarea_wizard_select_image' => [
+               'path' => '/rte/wizard/image',
+               'controller' => \TYPO3\CMS\Rtehtmlarea\Controller\SelectImageController::class
+       ],
+       // Register RTE user elements wizard
+       'rtehtmlarea_wizard_user_elements' => [
+               'path' => '/rte/wizard/userelements',
+               'controller' => \TYPO3\CMS\Rtehtmlarea\Controller\UserElementsController::class
+       ],
+       // Register RTE parse html wizard
+       'rtehtmlarea_wizard_parse_html' => [
+               'path' => '/rte/wizard/parsehtml',
+               'controller' => \TYPO3\CMS\Rtehtmlarea\Controller\ParseHtmlController::class
+       ],
+];
diff --git a/typo3/sysext/rtehtmlarea/Modules/BrowseLinks/conf.php b/typo3/sysext/rtehtmlarea/Modules/BrowseLinks/conf.php
deleted file mode 100644 (file)
index 497f55c..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-<?php
-$MCONF['name'] = 'rtehtmlarea_wizard_browse_links';
-$MCONF['script'] = '_DISPATCH';
-$MCONF['access'] = '';
diff --git a/typo3/sysext/rtehtmlarea/Modules/BrowseLinks/index.php b/typo3/sysext/rtehtmlarea/Modules/BrowseLinks/index.php
deleted file mode 100644 (file)
index e15de04..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-<?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!
- */
-
-/**
- * Displays the page/file tree for browsing database records or files.
- * Used from TCEFORMS an other elements
- * In other words: This is the ELEMENT BROWSER!
- *
- * Adapted for htmlArea RTE by Stanislas Rolland
- */
-
-// Make instance:
-$elementBrowserController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Rtehtmlarea\Controller\BrowseLinksController::class);
-$elementBrowserController->main();
-$elementBrowserController->printContent();
diff --git a/typo3/sysext/rtehtmlarea/Modules/ParseHtml/conf.php b/typo3/sysext/rtehtmlarea/Modules/ParseHtml/conf.php
deleted file mode 100644 (file)
index 697767e..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-<?php
-$MCONF['name'] = 'rtehtmlarea_wizard_parse_html';
-$MCONF['script'] = '_DISPATCH';
-$MCONF['access'] = '';
\ No newline at end of file
diff --git a/typo3/sysext/rtehtmlarea/Modules/ParseHtml/index.php b/typo3/sysext/rtehtmlarea/Modules/ParseHtml/index.php
deleted file mode 100644 (file)
index 7a2ed3d..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<?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!
- */
-
-/**
- * Content parsing for htmlArea RTE
- */
-
-// Make instance:
-$GLOBALS['SOBE'] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Rtehtmlarea\Controller\ParseHtmlController::class);
-$GLOBALS['SOBE']->init();
-$GLOBALS['SOBE']->main();
-$GLOBALS['SOBE']->printContent();
diff --git a/typo3/sysext/rtehtmlarea/Modules/SelectImage/conf.php b/typo3/sysext/rtehtmlarea/Modules/SelectImage/conf.php
deleted file mode 100644 (file)
index 35bdbe6..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-<?php
-$MCONF['name'] = 'rtehtmlarea_wizard_select_image';
-$MCONF['script'] = '_DISPATCH';
-$MCONF['access'] = '';
diff --git a/typo3/sysext/rtehtmlarea/Modules/SelectImage/index.php b/typo3/sysext/rtehtmlarea/Modules/SelectImage/index.php
deleted file mode 100644 (file)
index 5bc3da8..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-<?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!
- */
-
-/**
- * Displays image selector for the RTE
- */
-
-// Make instance:
-$elementBrowserController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Rtehtmlarea\Controller\SelectImageController::class);
-$elementBrowserController->main();
-$elementBrowserController->printContent();
diff --git a/typo3/sysext/rtehtmlarea/Modules/UserElements/conf.php b/typo3/sysext/rtehtmlarea/Modules/UserElements/conf.php
deleted file mode 100644 (file)
index 19eefa6..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-<?php
-$MCONF['name'] = 'rtehtmlarea_wizard_user_elements';
-$MCONF['script'] = '_DISPATCH';
-$MCONF['access'] = '';
\ No newline at end of file
diff --git a/typo3/sysext/rtehtmlarea/Modules/UserElements/index.php b/typo3/sysext/rtehtmlarea/Modules/UserElements/index.php
deleted file mode 100644 (file)
index 70c2e79..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<?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!
- */
-
-/**
- * User defined content for htmlArea RTE
- */
-
-// Make instance:
-$GLOBALS['SOBE'] = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Rtehtmlarea\Controller\UserElementsController::class);
-$GLOBALS['SOBE']->init();
-$GLOBALS['SOBE']->main();
-$GLOBALS['SOBE']->printContent();
index 735506a..d4c3f9a 100644 (file)
@@ -60,28 +60,3 @@ if (TYPO3_MODE === 'BE' && \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::i
        ));
        $GLOBALS['TYPO3_USER_SETTINGS']['showitem'] .= ',--div--;LLL:EXT:rtehtmlarea/Resources/Private/Language/locallang.xlf:rteSettings,rteWidth,rteHeight,rteResize,rteMaxHeight,rteCleanPasteBehaviour';
 }
-if (TYPO3_MODE === 'BE') {
-       // Register RTE browse links wizard
-       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModulePath(
-               'rtehtmlarea_wizard_browse_links',
-               'EXT:rtehtmlarea/Modules/BrowseLinks/'
-       );
-
-       // Register RTE select image wizard
-       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModulePath(
-               'rtehtmlarea_wizard_select_image',
-               'EXT:rtehtmlarea/Modules/SelectImage/'
-       );
-
-       // Register RTE user elements wizard
-       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModulePath(
-               'rtehtmlarea_wizard_user_elements',
-               'EXT:rtehtmlarea/Modules/UserElements/'
-       );
-
-       // Register RTE parse html wizard
-       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModulePath(
-               'rtehtmlarea_wizard_parse_html',
-               'EXT:rtehtmlarea/Modules/ParseHtml/'
-       );
-}