[BUGFIX] Re-Introduce feature to go one level up in file list 12/25812/5
authorSteffen Ritter <info@rs-websystems.de>
Sat, 30 Nov 2013 20:09:31 +0000 (21:09 +0100)
committerSteffen Müller <typo3@t3node.com>
Fri, 6 Dec 2013 22:51:04 +0000 (23:51 +0100)
When the file list has been reworked to use FAL instead of
plain PHP file functions the feature to go one level up has
been removed accidentilly. This patch reintroduces the
original behaviour known from TYPO3 CMS 4.x.

Releases: 6.2
Resolves: #51866
Change-Id: Iad334c90d575f2b2f3b47af71e23c721edd76e1e
Reviewed-on: https://review.typo3.org/25812
Reviewed-by: Xavier Perseguers
Tested-by: Xavier Perseguers
Reviewed-by: Steffen Müller
Tested-by: Steffen Müller
typo3/sysext/filelist/Classes/FileList.php
typo3/sysext/filelist/Resources/Private/Templates/file_list.html

index d56e6c0..08bfff0 100644 (file)
@@ -214,6 +214,7 @@ class FileList extends \TYPO3\CMS\Backend\RecordList\AbstractRecordList {
                        'TITLE' => ''
                );
                $buttons = array(
+                       'level_up' => $this->getLinkToParentFolder($folderObject),
                        'refresh' => '',
                        'title' => '',
                        'page_icon' => '',
@@ -377,7 +378,7 @@ class FileList extends \TYPO3\CMS\Backend\RecordList\AbstractRecordList {
                        }
 
                        if (!empty($iOut)) {
-                               $out .= '<thead>' . $this->addelement(1, $levelUp, $theData, ' class="t3-row-header"', '') . '</thead>';
+                               $out .= '<thead>' . $this->addelement(1, '&nbsp;', $theData, ' class="t3-row-header"', '') . '</thead>';
                                $out .= '<tbody>' . $iOut . '</tbody>';
                                // half line is drawn
                                // finish
@@ -397,6 +398,33 @@ class FileList extends \TYPO3\CMS\Backend\RecordList\AbstractRecordList {
                return $out;
        }
 
+
+       /**
+        * If there is a parent folder and user has access to it, return an icon
+        * which is linked to the filelist of the parent folder.
+        *
+        * @param \TYPO3\CMS\Core\Resource\Folder $currentFolder
+        * @return string
+        */
+       protected function getLinkToParentFolder(\TYPO3\CMS\Core\Resource\Folder $currentFolder) {
+               $levelUp = '';
+               try {
+                       $currentStorage = $currentFolder->getStorage();
+                       $parentFolder = $currentStorage->getFolder(
+                               $currentStorage->getFolderIdentifierFromFileIdentifier($this->folderObject->getIdentifier())
+                       );
+                       if ($parentFolder->getIdentifier() !== $currentFolder->getIdentifier() && $currentStorage->isWithinFileMountBoundaries($parentFolder)) {
+                               $levelUp = $this->linkWrapDir(
+                                       IconUtility::getSpriteIcon(
+                                               'actions-view-go-up',
+                                               array('title' => $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.upOneLevel', TRUE))
+                                       ),
+                                       $parentFolder
+                               );
+                       }
+               } catch (\Exception $e) {}
+               return $levelUp;
+       }
        /**
         * Gets the number of files and total size of a folder
         *
index d0c7713..2af8b85 100644 (file)
@@ -26,7 +26,7 @@
 <!-- ###BUTTON_GROUP_WRAP### -->
 
 <!-- ###BUTTON_GROUPS_LEFT### -->
-<!-- ###BUTTON_GROUP4### -->###UPLOAD######NEW######PASTE###<!-- ###BUTTON_GROUP4### -->
+<!-- ###BUTTON_GROUP4### -->###LEVEL_UP######UPLOAD######NEW######PASTE###<!-- ###BUTTON_GROUP4### -->
 <!-- ###BUTTON_GROUPS_LEFT### -->
 
 <!-- ###BUTTON_GROUPS_RIGHT### -->