[BUGFIX] File list module headline
[Packages/TYPO3.CMS.git] / typo3 / sysext / filelist / Classes / Controller / FileListController.php
index f895dc4..1651f66 100644 (file)
@@ -299,12 +299,16 @@ class FileListController {
                        // add the folder info to the marker array
                        $otherMarkers['FOLDER_INFO'] = $this->filelist->getFolderInfo();
                        $docHeaderButtons = array_merge($this->getButtons(), $buttons);
+
                        // Build the <body> for the module
+                       $moduleHeadline = $this->getModuleHeadline();
                        // Create output
-                       $pageContent = '';
+                       $pageContent = $moduleHeadline !== '' ? '<h1>' . $moduleHeadline . '</h1>' : '';
+
                        $pageContent .= '<form action="' . htmlspecialchars($this->filelist->listURL()) . '" method="post" name="dblistForm">';
                        $pageContent .= $this->filelist->HTMLcode;
                        $pageContent .= '<input type="hidden" name="cmd" /></form>';
+
                        // Making listing options:
                        if ($this->filelist->HTMLcode) {
                                $pageContent .= '
@@ -354,6 +358,28 @@ class FileListController {
                }
        }
 
+       /**
+        * Get main headline based on active folder or storage for backend module
+        *
+        * Folder names are resolved to their special names like done in the tree view.
+        *
+        * @return string
+        */
+       protected function getModuleHeadline() {
+               $name = $this->folderObject->getName();
+               if ($name === '') {
+                       // Show storage name on storage root
+                       if ($this->folderObject->getIdentifier() === '/') {
+                               $name = $this->folderObject->getStorage()->getName();
+                       }
+               } else {
+                       $name = key(\TYPO3\CMS\Core\Resource\Utility\ListUtility::resolveSpecialFolderNames(
+                               array($name => $this->folderObject)
+                       ));
+               }
+               return $name;
+       }
+
        /**
         * Outputting the accumulated content to screen
         *