[TASK] Use routing for folder navigation tree 47/42847/7
authorHelmut Hummel <helmut.hummel@typo3.org>
Sun, 23 Aug 2015 06:59:22 +0000 (08:59 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Tue, 25 Aug 2015 08:01:50 +0000 (10:01 +0200)
Resolves: #69293
Releases: master
Change-Id: I069f3758fc96148043890c6448fda8bc964fd91b
Reviewed-on: http://review.typo3.org/42847
Reviewed-by: Alexander Opitz <opitz.alexander@googlemail.com>
Tested-by: Alexander Opitz <opitz.alexander@googlemail.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/backend/Classes/Controller/FileSystemNavigationFrameController.php
typo3/sysext/backend/Configuration/Backend/Routes.php
typo3/sysext/backend/Modules/FileSystemNavigationFrame/conf.php [deleted file]
typo3/sysext/backend/Modules/FileSystemNavigationFrame/index.php [deleted file]
typo3/sysext/backend/ext_tables.php

index 0696559..7227b88 100644 (file)
@@ -14,8 +14,11 @@ namespace TYPO3\CMS\Backend\Controller;
  * The TYPO3 project - inspiring people to share!
  */
 
+use TYPO3\CMS\Core\Http\Response;
+use Psr\Http\Message\ServerRequestInterface;
 use TYPO3\CMS\Backend\Tree\View\ElementBrowserFolderTreeView;
 use TYPO3\CMS\Backend\Utility\IconUtility;
+use TYPO3\CMS\Core\Http\ControllerInterface;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
 use TYPO3\CMS\Filelist\FileListFolderTree;
 use TYPO3\CMS\Backend\Template\DocumentTemplate;
@@ -24,7 +27,7 @@ use TYPO3\CMS\Backend\Utility\BackendUtility;
 /**
  * Main script class for rendering of the folder tree
  */
-class FileSystemNavigationFrameController {
+class FileSystemNavigationFrameController implements ControllerInterface {
 
        // Internal, dynamic:
        // Content accumulates in this variable.
@@ -75,6 +78,19 @@ class FileSystemNavigationFrameController {
        }
 
        /**
+        * @param ServerRequestInterface $request
+        * @return Response
+        */
+       public function processRequest(ServerRequestInterface $request) {
+               $this->initPage();
+               $this->main();
+               /** @var Response $response */
+               $response = GeneralUtility::makeInstance(Response::class);
+               $response->getBody()->write($this->content);
+               return $response;
+       }
+
+       /**
         * Initialiation of the script class
         *
         * @return void
@@ -123,6 +139,7 @@ class FileSystemNavigationFrameController {
                $this->doHighlight = !$this->getBackendUser()->getTSConfigVal('options.pageTree.disableTitleHighlight');
                // Create template object:
                $this->doc = GeneralUtility::makeInstance(DocumentTemplate::class);
+               $this->doc->bodyTagId = 'ext-backend-Modules-FileSystemNavigationFrame-index-php';
                $this->doc->setModuleTemplate('EXT:backend/Resources/Private/Templates/alt_file_navframe.html');
                $this->doc->showFlashMessages = FALSE;
                // Adding javascript code for drag&drop and the filetree as well as the click menu code
@@ -187,8 +204,10 @@ class FileSystemNavigationFrameController {
         * Outputting the accumulated content to screen
         *
         * @return void
+        * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8
         */
        public function printContent() {
+               GeneralUtility::logDeprecatedFunction();
                echo $this->content;
        }
 
index 195c13d..3ddc4b1 100644 (file)
@@ -84,6 +84,13 @@ return [
 
 
        /** File- and folder-related routes */
+
+       // File navigation tree
+       'file_navframe' => [
+               'path' => '/folder/tree',
+               'controller' => Controller\FileSystemNavigationFrameController::class
+       ],
+
        // Editing the contents of a file
        'file_edit' => [
                'path' => '/file/editcontent',
diff --git a/typo3/sysext/backend/Modules/FileSystemNavigationFrame/conf.php b/typo3/sysext/backend/Modules/FileSystemNavigationFrame/conf.php
deleted file mode 100644 (file)
index 391a4db..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-<?php
-$MCONF['script'] = '_DISPATCH';
-$MCONF['name'] = 'file_navframe';
\ No newline at end of file
diff --git a/typo3/sysext/backend/Modules/FileSystemNavigationFrame/index.php b/typo3/sysext/backend/Modules/FileSystemNavigationFrame/index.php
deleted file mode 100644 (file)
index ffec77d..0000000
+++ /dev/null
@@ -1,25 +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!
- */
-
-/**
- * Folder tree in the File main module.
- */
-
-// Make instance if it is not an AJAX call
-if (!(TYPO3_REQUESTTYPE & TYPO3_REQUESTTYPE_AJAX)) {
-       $fileSystemNavigationFrameController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Controller\FileSystemNavigationFrameController::class);
-       $fileSystemNavigationFrameController->initPage();
-       $fileSystemNavigationFrameController->main();
-       $fileSystemNavigationFrameController->printContent();
-}
index 9ab59ff..575872e 100644 (file)
@@ -3,12 +3,6 @@ defined('TYPO3_MODE') or die();
 
 if (TYPO3_MODE === 'BE') {
 
-       // Register file_navframe
-       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModulePath(
-               'file_navframe',
-               'EXT:backend/Modules/FileSystemNavigationFrame/'
-       );
-
        \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModule(
                'web',
                'layout',