From 53d7e5894ecdc5aaebae994849d5c7323ecf5c27 Mon Sep 17 00:00:00 2001
From: Felix Kopp <felix-source@phorax.com>
Date: Sun, 19 May 2013 12:28:29 +0200
Subject: [PATCH] [BUGFIX] File list module headline

View should guide users and always prompt the current status.
File list has been lacking a main headline - until now.

Change-Id: Id3d2d1963bbedf917d2e8bc8f7756c10a026512e
Resolves: #48380
Releases: 6.2
Reviewed-on: https://review.typo3.org/20906
Reviewed-by: Philipp Gampe
Tested-by: Philipp Gampe
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
---
 .../Classes/Controller/FileListController.php | 28 ++++++++++++++++++-
 .../structure/module_file_list.css            |  1 -
 2 files changed, 27 insertions(+), 2 deletions(-)

diff --git a/typo3/sysext/filelist/Classes/Controller/FileListController.php b/typo3/sysext/filelist/Classes/Controller/FileListController.php
index f895dc45134a..1651f665b468 100644
--- a/typo3/sysext/filelist/Classes/Controller/FileListController.php
+++ b/typo3/sysext/filelist/Classes/Controller/FileListController.php
@@ -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
 	 *
diff --git a/typo3/sysext/t3skin/stylesheets/structure/module_file_list.css b/typo3/sysext/t3skin/stylesheets/structure/module_file_list.css
index f249718212a9..535c473d4ff9 100644
--- a/typo3/sysext/t3skin/stylesheets/structure/module_file_list.css
+++ b/typo3/sysext/t3skin/stylesheets/structure/module_file_list.css
@@ -4,7 +4,6 @@ File > List
 - - - - - - - - - - - - - - - - - - - - - */
 
 table#typo3-filelist {
-	margin-top: 24px;
 	width: 100%;
 }
 
-- 
GitLab