[BUGFIX] Root node in folder tree in ElementBrowser works again 89/41989/3
authorMarkus Klein <markus.klein@typo3.org>
Mon, 27 Jul 2015 17:49:09 +0000 (19:49 +0200)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Tue, 28 Jul 2015 19:45:16 +0000 (21:45 +0200)
The root node can be collapsed again without reloading the whole
ElementBrowser and killing its functionality.

Expanding the node works now too.

Releases: master
Resolves: #68486
Change-Id: I67e19c82302bb4df85153862ce07d2507d15865e
Reviewed-on: http://review.typo3.org/41989
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Tested-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
typo3/sysext/backend/Classes/Tree/View/FolderTreeView.php
typo3/sysext/backend/Resources/Public/JavaScript/LegacyTree.js

index d2bdb3d..f6febb7 100644 (file)
@@ -288,11 +288,15 @@ class FolderTreeView extends AbstractTreeView {
                                $firstHtml = '';
                        } else {
                                // Only show and link icon if storage is browseable
-                               $link = '';
-                               if ($this->thisScript) {
-                                       $link = ' href="' . htmlspecialchars($this->getThisScript() . 'PM=' . $cmd) . '"';
+                               if (get_class($this) !== ElementBrowserFolderTreeView::class) {
+                                       $link = '';
+                                       if ($this->thisScript) {
+                                               $link = ' href="' . htmlspecialchars($this->getThisScript() . 'PM=' . $cmd) . '"';
+                                       }
+                                       $firstHtml = '<a class="list-tree-control list-tree-control-' . ($isOpen ? 'open' : 'closed') . '"' . $link . '><i class="fa"></i></a>';
+                               } else {
+                                       $firstHtml = $this->PMiconATagWrap('', $cmd, !$isOpen);
                                }
-                               $firstHtml = '<a class="list-tree-control list-tree-control-' . ($isOpen ? 'open' : 'closed') . '"' . $link . '><i class="fa"></i></a>';
                        }
                        // Mark a storage which is not online, as offline
                        // maybe someday there will be a special icon for this
@@ -313,7 +317,8 @@ class FolderTreeView extends AbstractTreeView {
                                'row' => $row,
                                'bank' => $this->bank,
                                // hasSub is TRUE when the root of the storage is expanded
-                               'hasSub' => $isOpen && $storageObject->isBrowsable()
+                               'hasSub' => $isOpen && $storageObject->isBrowsable(),
+                               'invertedDepth' => 1000,
                        );
                        // If the mount is expanded, go down:
                        if ($isOpen && $storageObject->isBrowsable()) {
index 395de0e..6f990af 100644 (file)
@@ -160,6 +160,9 @@ define(['jquery'], function($) {
 
                // selects the activated item again, in case it collapsed and got expanded again
                reSelectActiveItem: function() {
+                       if (!top.fsMod) {
+                               return;
+                       }
                        var $activeItem = $('#' + top.fsMod.navFrameHighlightedID[this.frameSetModule]);
                        if ($activeItem.length) {
                                $activeItem.addClass(Tree.highlightClass);
@@ -195,4 +198,4 @@ define(['jquery'], function($) {
        return function() {
                return Tree;
        }();
-});
\ No newline at end of file
+});