[BUGFIX] Filename not displayed in selector (file_reference) 58/23058/5
authorMartin Borer <mbarts@gmx.ch>
Thu, 5 Sep 2013 21:29:49 +0000 (23:29 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Sun, 8 Sep 2013 13:12:15 +0000 (15:12 +0200)
The selector values in BE-fields with type group->file_reference are
empty. The filename should be displayed at this place.

Resolves: #47414
Releases: 6.2, 6.1, 6.0
Change-Id: I9fa237d2cd14ff0e9b347736090bd2171eb8a747
Reviewed-on: https://review.typo3.org/23058
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter
Reviewed-by: Frans Saris
Tested-by: Frans Saris
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
typo3/sysext/backend/Classes/Form/DataPreprocessor.php
typo3/sysext/backend/Classes/Form/FormEngine.php

index 1987dd2..56127c3 100644 (file)
@@ -29,6 +29,7 @@ namespace TYPO3\CMS\Backend\Form;
 
 use TYPO3\CMS\Backend\Utility\BackendUtility;
 use TYPO3\CMS\Core\Utility\GeneralUtility;
+use TYPO3\CMS\Core\Utility\PathUtility;
 
 /**
  * Class for getting and transforming data for display in backend forms (TCEforms)
@@ -329,6 +330,7 @@ class DataPreprocessor {
         */
        public function renderRecord_groupProc($data, $fieldConfig, $TSconfig, $table, $row, $field) {
                switch ($fieldConfig['config']['internal_type']) {
+                       case 'file_reference':
                        case 'file':
                                // Init array used to accumulate the files:
                                $dataAcc = array();
@@ -339,14 +341,14 @@ class DataPreprocessor {
                                        // Setting dummy startup
                                        foreach ($loadDB->itemArray as $value) {
                                                if ($value['id']) {
-                                                       $dataAcc[] = rawurlencode($value['id']) . '|' . rawurlencode($value['id']);
+                                                       $dataAcc[] = rawurlencode($value['id']) . '|' . rawurlencode(PathUtility::basename($value['id']));
                                                }
                                        }
                                } else {
                                        $fileList = GeneralUtility::trimExplode(',', $data, TRUE);
                                        foreach ($fileList as $value) {
                                                if ($value) {
-                                                       $dataAcc[] = rawurlencode($value) . '|' . rawurlencode($value);
+                                                       $dataAcc[] = rawurlencode($value) . '|' . rawurlencode(PathUtility::basename($value));
                                                }
                                        }
                                }
index c0fb241..f0ab270 100644 (file)
@@ -3737,7 +3737,7 @@ function ' . $evalData . '(value) {
                                        foreach ($itemArray as $item) {
                                                $itemParts = explode('|', $item);
                                                $uidList[] = ($pUid = ($pTitle = $itemParts[0]));
-                                               $title = htmlspecialchars(basename(rawurldecode($itemParts[1])));
+                                               $title = htmlspecialchars(rawurldecode($itemParts[1]));
                                                $opt[] = '<option value="' . htmlspecialchars(rawurldecode($itemParts[0])) . '" title="' . $title . '">' . $title . '</option>';
                                        }
                                        break;