[!!!][FEATURE] Introduce PSR-7-based Routing for Backend AJAX Requests
[Packages/TYPO3.CMS.git] / typo3 / sysext / backend / Classes / Controller / FileSystemNavigationFrameController.php
index a05e8e6..b4c6651 100644 (file)
@@ -145,7 +145,7 @@ class FileSystemNavigationFrameController {
                $this->doc->showFlashMessages = FALSE;
                // Adding javascript code for drag&drop and the filetree as well as the click menu code
                $dragDropCode = '
-                       Tree.ajaxID = "SC_alt_file_navframe::expandCollapse";
+                       Tree.ajaxID = "sc_alt_file_navframe_expandtoggle";
                        Tree.registerDragDropHandlers()';
                if ($this->doHighlight) {
                        $hlClass = $this->getBackendUser()->workspace === 0 ? 'active' : 'active active-ws wsver' . $GLOBALS['BE_USER']->workspace;
@@ -239,17 +239,20 @@ class FileSystemNavigationFrameController {
         * Makes the AJAX call to expand or collapse the foldertree.
         * Called by typo3/ajax.php
         *
-        * @param array $params Additional parameters (not used here)
-        * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj The AjaxRequestHandler object of this request
-        * @return void
+        * @param ServerRequestInterface $request
+        * @param ResponseInterface $response
+        * @return ResponseInterface
         */
-       public function ajaxExpandCollapse($params, $ajaxObj) {
+       public function ajaxExpandCollapse(ServerRequestInterface $request, ResponseInterface $response) {
+               $this->init();
                $tree = $this->foldertree->getBrowsableTree();
                if ($this->foldertree->getAjaxStatus() === FALSE) {
-                       $ajaxObj->setError($tree);
+                       $response->withStatus(500);
                } else {
-                       $ajaxObj->addContent('tree', $tree);
+                       $response->getBody()->write(json_encode($tree));
                }
+
+               return $response;
        }
 
        /**