[TASK] Remove extension class for ElementBrowserFolderTreeView 24/41024/3
authorThomas Schlumberger <thomas@b13.de>
Thu, 9 Jul 2015 09:45:56 +0000 (11:45 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 9 Jul 2015 10:28:37 +0000 (12:28 +0200)
EXT:recordlist ships with an extended ElementBrowserFolderTreeView
which is a subclass of the regular ElementBrowserFolderTreeView from
EXT:backend. The subclass can be easily merged into the parent class
as the logic is non-breaking for the areas which use the parent class.

The patch removes the child class (4th level inheritance!) into the parent
class and changes all occurences in the core to the parent class.

A class alias map is added for the old class into EXT:compatibility6.

Resolves: #67999
Releases: master
Change-Id: Id13f999311230a8aafbc2f61f4538c5e55d052c6
Reviewed-on: http://review.typo3.org/41024
Reviewed-by: Benjamin Mack <benni@typo3.org>
Tested-by: Benjamin Mack <benni@typo3.org>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/backend/Classes/Tree/View/ElementBrowserFolderTreeView.php
typo3/sysext/compatibility6/Migrations/Code/ClassAliasMap.php
typo3/sysext/recordlist/Classes/Browser/ElementBrowser.php
typo3/sysext/recordlist/Classes/Tree/View/ElementBrowserFolderTreeView.php [deleted file]
typo3/sysext/rtehtmlarea/Classes/SelectImage.php

index bc7e79d..5c517f8 100644 (file)
@@ -25,6 +25,13 @@ namespace TYPO3\CMS\Backend\Tree\View;
 class ElementBrowserFolderTreeView extends FolderTreeView {
 
        /**
+        * If file-drag mode is set, temp and recycler folders are filtered out.
+        *
+        * @var int
+        */
+       public $ext_noTempRecyclerDirs = 0;
+
+       /**
         * @var int
         */
        public $ext_IconMode = 1;
@@ -57,10 +64,10 @@ class ElementBrowserFolderTreeView extends FolderTreeView {
         * Returns TRUE if the input "record" contains a folder which can be linked.
         *
         * @param \TYPO3\CMS\Core\Resource\Folder $folderObject Object with information about the folder element. Contains keys like title, uid, path, _title
-        * @return bool TRUE is returned if the path is found in the web-part of the server and is NOT a recycler or temp folder
+        * @return bool TRUE is returned if the path is found in the web-part of the server and is NOT a recycler or temp folder AND if ->ext_noTempRecyclerDirs is not set.
         */
        public function ext_isLinkable(\TYPO3\CMS\Core\Resource\Folder $folderObject) {
-               if (strstr($folderObject->getIdentifier(), '_recycler_') || strstr($folderObject->getIdentifier(), '_temp_')) {
+               if ($this->ext_noTempRecyclerDirs && (substr($folderObject->getIdentifier(), -7) === '_temp_/' || substr($folderObject->getIdentifier(), -11) === '_recycler_/')) {
                        return FALSE;
                } else {
                        return TRUE;
index 7c8ff25..679a142 100644 (file)
@@ -1259,7 +1259,8 @@ return array(
        'localPageTree' => \TYPO3\CMS\Backend\Tree\View\ElementBrowserPageTreeView::class,
        'TBE_PageTree' => \TYPO3\CMS\Recordlist\Tree\View\ElementBrowserPageTreeView::class,
        'localFolderTree' => \TYPO3\CMS\Backend\Tree\View\ElementBrowserFolderTreeView::class,
-       'TBE_FolderTree' => \TYPO3\CMS\Recordlist\Tree\View\ElementBrowserFolderTreeView::class,
+       'TBE_FolderTree' => \TYPO3\CMS\Backend\Tree\View\ElementBrowserFolderTreeView::class,
+       'TYPO3\\CMS\\Recordlist\\Tree\\View\\ElementBrowserFolderTreeView' => \TYPO3\CMS\Backend\Tree\View\ElementBrowserFolderTreeView::class,
        'newRecordLocalPageTree' => \TYPO3\CMS\Backend\Tree\View\NewRecordPageTreeView::class,
        'backend_cacheActionsHook' => \TYPO3\CMS\Backend\Toolbar\ClearCacheActionsHookInterface::class,
        'TYPO3\\CMS\\Frontend\\ContentObject\\SearchResultContentObject' => \TYPO3\CMS\Compatibility6\ContentObject\SearchResultContentObject::class,
index 6b1c385..7e0046b 100644 (file)
@@ -1539,8 +1539,8 @@ class ElementBrowser {
                }
                $noThumbs = $noThumbs ?: !$_MOD_SETTINGS['displayThumbs'];
                // Create folder tree:
-               /** @var \TYPO3\CMS\Recordlist\Tree\View\ElementBrowserFolderTreeView $folderTree */
-               $folderTree = GeneralUtility::makeInstance(\TYPO3\CMS\Recordlist\Tree\View\ElementBrowserFolderTreeView::class);
+               /** @var \TYPO3\CMS\Backend\Tree\View\ElementBrowserFolderTreeView $folderTree */
+               $folderTree = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Tree\View\ElementBrowserFolderTreeView::class);
                $folderTree->thisScript = $this->thisScript;
                $folderTree->ext_noTempRecyclerDirs = $this->mode == 'filedrag';
                $tree = $folderTree->getBrowsableTree();
@@ -1610,8 +1610,8 @@ class ElementBrowser {
                        $createFolder = '';
                }
                // Create folder tree:
-               /** @var \TYPO3\CMS\Recordlist\Tree\View\ElementBrowserFolderTreeView $folderTree */
-               $folderTree = GeneralUtility::makeInstance(\TYPO3\CMS\Recordlist\Tree\View\ElementBrowserFolderTreeView::class);
+               /** @var \TYPO3\CMS\Backend\Tree\View\ElementBrowserFolderTreeView $folderTree */
+               $folderTree = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Tree\View\ElementBrowserFolderTreeView::class);
                $folderTree->thisScript = $this->thisScript;
                $folderTree->ext_noTempRecyclerDirs = $this->mode == 'filedrag';
                $tree = $folderTree->getBrowsableTree(FALSE);
diff --git a/typo3/sysext/recordlist/Classes/Tree/View/ElementBrowserFolderTreeView.php b/typo3/sysext/recordlist/Classes/Tree/View/ElementBrowserFolderTreeView.php
deleted file mode 100644 (file)
index 3e60d73..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-<?php
-namespace TYPO3\CMS\Recordlist\Tree\View;
-
-/*
- * 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!
- */
-
-/**
- * Extension class for the TBE file browser
- */
-class ElementBrowserFolderTreeView extends \TYPO3\CMS\Backend\Tree\View\ElementBrowserFolderTreeView {
-
-       /**
-        * If file-drag mode is set, temp and recycler folders are filtered out.
-        *
-        * @var int
-        */
-       public $ext_noTempRecyclerDirs = 0;
-
-       /**
-        * Returns TRUE if the input "record" contains a folder which can be linked.
-        *
-        * @param \TYPO3\CMS\Core\Resource\Folder $folderObject object with information about the folder element. Contains keys like title, uid, path, _title
-        *
-        * @return bool TRUE is returned if the path is NOT a recycler or temp folder AND if ->ext_noTempRecyclerDirs is not set.
-        */
-       public function ext_isLinkable($folderObject) {
-               if ($this->ext_noTempRecyclerDirs && (substr($folderObject->getIdentifier(), -7) == '_temp_/' || substr($folderObject->getIdentifier(), -11) == '_recycler_/')) {
-                       return FALSE;
-               } else {
-                       return TRUE;
-               }
-       }
-
-       /**
-        * Wrapping the title in a link, if applicable.
-        *
-        * @param string $title Title, ready for output.
-        * @param \TYPO3\CMS\Core\Resource\Folder $folderObject The folderObject 'record'
-        *
-        * @return string Wrapping title string.
-        */
-       public function wrapTitle($title, $folderObject) {
-               if ($this->ext_isLinkable($folderObject)) {
-                       $aOnClick = 'return jumpToUrl(' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($this->getThisScript() . 'act=' . $GLOBALS['SOBE']->browser->act . '&mode=' . $GLOBALS['SOBE']->browser->mode . '&expandFolder=' . rawurlencode($folderObject->getCombinedIdentifier())) . ');';
-
-                       return '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . $title . '</a>';
-               } else {
-                       return '<span class="text-muted">' . $title . '</span>';
-               }
-       }
-}
index a1b3277..1b3a3de 100644 (file)
@@ -487,7 +487,7 @@ class SelectImage extends \TYPO3\CMS\Recordlist\Browser\ElementBrowser {
                                $this->content .= '<br />';
                                break;
                        case 'dragdrop':
-                               $foldertree = GeneralUtility::makeInstance(\TYPO3\CMS\Recordlist\Tree\View\ElementBrowserFolderTreeView::class);
+                               $foldertree = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Tree\View\ElementBrowserFolderTreeView::class);
                                $foldertree->thisScript = $this->thisScript;
                                $foldertree->ext_noTempRecyclerDirs = TRUE;
                                $tree = $foldertree->getBrowsableTree();