[BUGFIX] Removed call to render() after getFlashMessageForMissingFile 14/46914/2
authorMichael Oehlhof <typo3@oehlhof.de>
Sun, 3 Jan 2016 01:30:51 +0000 (02:30 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 26 Feb 2016 15:27:50 +0000 (16:27 +0100)
Replace calls to deprecated method render() and to the function
getFlashMessageForMissingFile() with appropriate html code.

Resolves: #72508
Releases: master, 7.6
Change-Id: I90846f8349726e88dfa6aa77ab595fe28280e81b
Reviewed-on: https://review.typo3.org/46914
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Build/Resources/Public/Less/TYPO3/_element_label.less
typo3/sysext/backend/Classes/Controller/ContentElement/ElementInformationController.php
typo3/sysext/backend/Classes/Form/Container/InlineRecordContainer.php
typo3/sysext/backend/Classes/Form/Element/GroupElement.php
typo3/sysext/backend/Classes/Utility/BackendUtility.php
typo3/sysext/core/Classes/Resource/Hook/FileInfoHook.php
typo3/sysext/filelist/Classes/FileList.php
typo3/sysext/t3skin/Resources/Public/Css/backend.css

index 64930e2..27785bc 100644 (file)
 }
 .label-block {
        display: block;
+}
+
+.label-space-left {
+       margin-left: 1em;
+}
+.label-space-right {
+       margin-right: 1em;
 }
\ No newline at end of file
index e4f7c00..7971571 100644 (file)
@@ -288,8 +288,9 @@ class ElementInformationController
 
         // check if file is marked as missing
         if ($this->fileObject->isMissing()) {
-            $flashMessage = \TYPO3\CMS\Core\Resource\Utility\BackendUtility::getFlashMessageForMissingFile($this->fileObject);
-            $previewTag .= $flashMessage->render();
+            $previewTag .= '<span class="label label-danger">'
+                . htmlspecialchars(static::getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:warning.file_missing'))
+                . '</span>&nbsp;' . htmlspecialchars($this->fileObject->getName()) . '<br />';
         } else {
 
             /** @var \TYPO3\CMS\Core\Resource\Rendering\RendererRegistry $rendererRegistry */
index 10ee65d..92a49ce 100644 (file)
@@ -315,8 +315,9 @@ class InlineRecordContainer extends AbstractContainer
                     $fileObject = null;
                 }
                 if ($fileObject && $fileObject->isMissing()) {
-                    $flashMessage = \TYPO3\CMS\Core\Resource\Utility\BackendUtility::getFlashMessageForMissingFile($fileObject);
-                    $thumbnail = $flashMessage->render();
+                    $thumbnail .= '<span class="label label-danger">'
+                        . htmlspecialchars(static::getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:warning.file_missing'))
+                        . '</span>&nbsp;' . htmlspecialchars($fileObject->getName()) . '<br />';
                 } elseif ($fileObject) {
                     $imageSetup = $inlineConfig['appearance']['headerThumbnail'];
                     unset($imageSetup['field']);
index 02b6589..7945436 100644 (file)
@@ -137,7 +137,9 @@ class GroupElement extends AbstractFormElement
                             $fileObject = $fileFactory->getFileObject($imgP[0]);
                             if ($fileObject->isMissing()) {
                                 $thumbnails[] = array(
-                                    'message' => \TYPO3\CMS\Core\Resource\Utility\BackendUtility::getFlashMessageForMissingFile($fileObject)->render()
+                                    'message' => '<span class="label label-danger">'
+                                        . htmlspecialchars(static::getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:warning.file_missing'))
+                                        . '</span>&nbsp;' . htmlspecialchars($fileObject->getName()) . '<br />'
                                 );
                             } elseif (GeneralUtility::inList($GLOBALS['TYPO3_CONF_VARS']['GFX']['imagefile_ext'], $fileObject->getExtension())) {
                                 $thumbnails[] = array(
index a8ab0af..cb37ea3 100755 (executable)
@@ -1727,8 +1727,9 @@ class BackendUtility
                 $fileObject = $fileReferenceObject->getOriginalFile();
 
                 if ($fileObject->isMissing()) {
-                    $flashMessage = \TYPO3\CMS\Core\Resource\Utility\BackendUtility::getFlashMessageForMissingFile($fileObject);
-                    $thumbData .= $flashMessage->render();
+                    $thumbData .= '<span class="label label-danger">'
+                        . htmlspecialchars(static::getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:warning.file_missing'))
+                        . '</span>&nbsp;' . htmlspecialchars($fileObject->getName()) . '<br />';
                     continue;
                 }
 
@@ -1777,18 +1778,15 @@ class BackendUtility
                             continue;
                         }
                         if ($fileObject->isMissing()) {
-                            $flashMessage = \TYPO3\CMS\Core\Resource\Utility\BackendUtility::getFlashMessageForMissingFile($fileObject);
-                            $thumbData .= $flashMessage->render();
+                            $thumbData .= '<span class="label label-danger">'
+                                . htmlspecialchars(static::getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:warning.file_missing'))
+                                . '</span>&nbsp;' . htmlspecialchars($fileObject->getName()) . '<br />';
                             continue;
                         }
                     } catch (ResourceDoesNotExistException $exception) {
-                        /** @var FlashMessage $flashMessage */
-                        $flashMessage = GeneralUtility::makeInstance(\TYPO3\CMS\Core\Messaging\FlashMessage::class,
-                            htmlspecialchars($exception->getMessage()),
-                            static::getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:warning.file_missing', true),
-                            FlashMessage::ERROR
-                        );
-                        $thumbData .= $flashMessage->render();
+                        $thumbData .= '<span class="label label-danger">'
+                            . htmlspecialchars(static::getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:warning.file_missing'))
+                            . '</span>&nbsp;' . htmlspecialchars($fileName) . '<br />';
                         continue;
                     }
 
index 04e79f3..c5d9742 100644 (file)
@@ -68,8 +68,9 @@ class FileInfoHook
             $previewImage = $processedFile->getPublicUrl(true);
             $content = '';
             if ($file->isMissing()) {
-                $flashMessage = \TYPO3\CMS\Core\Resource\Utility\BackendUtility::getFlashMessageForMissingFile($file);
-                $content .= $flashMessage->render();
+                $content .= '<span class="label label-danger label-space-right">'
+                    . htmlspecialchars($lang->sL('LLL:EXT:lang/locallang_core.xlf:warning.file_missing'))
+                    . '</span>';
             }
             if ($previewImage) {
                 $content .= '<img src="' . htmlspecialchars($previewImage) . '" ' .
index 8cd814e..d3cad33 100644 (file)
@@ -772,8 +772,9 @@ class FileList extends AbstractRecordList
                         $theData[$field] = $this->linkWrapFile(htmlspecialchars($fileName), $fileObject);
 
                         if ($fileObject->isMissing()) {
-                            $flashMessage = \TYPO3\CMS\Core\Resource\Utility\BackendUtility::getFlashMessageForMissingFile($fileObject);
-                            $theData[$field] .= $flashMessage->render();
+                            $theData[$field] .= '<span class="label label-danger label-space-left">'
+                                . htmlspecialchars($this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:warning.file_missing'))
+                                . '</span>';
                             // Thumbnails?
                         } elseif ($this->thumbs && ($this->isImage($ext) || $this->isMediaFile($ext))) {
                             $processedFile = $fileObject->process(ProcessedFile::CONTEXT_IMAGEPREVIEW, array());
index 227041a..342aefe 100644 (file)
@@ -11361,6 +11361,12 @@ ul.tree div.treeLinkItem span.dragIcon {
 .label-block {
   display: block;
 }
+.label-space-left {
+  margin-left: 1em;
+}
+.label-space-right {
+  margin-right: 1em;
+}
 .badge-info {
   background-color: #6daae0;
 }