[TASK] Use flash messages for status of branch export 67/42967/3
authorDaniel Goerz <ervaude@gmail.com>
Tue, 1 Sep 2015 18:45:02 +0000 (20:45 +0200)
committerWouter Wolters <typo3@wouterwolters.nl>
Wed, 2 Sep 2015 17:00:47 +0000 (19:00 +0200)
After a successful or unsuccessful attempt to export a
page branch to a file a short message about the outcome
is displayed. This patch improves the appearance of the
message by using a FlashMessage.

Additionally a call to an undefined method is removed.

Change-Id: I41940ca865211c9347707e731c3b4a90fb11b9ba
Releases: master
Resolves: #69460
Reviewed-on: http://review.typo3.org/42967
Reviewed-by: Michael Oehlhof <typo3@oehlhof.de>
Tested-by: Michael Oehlhof <typo3@oehlhof.de>
Reviewed-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
typo3/sysext/impexp/Classes/Controller/ImportExportController.php

index 7dcccb1..da05a94 100644 (file)
@@ -20,6 +20,7 @@ use TYPO3\CMS\Core\Database\DatabaseConnection;
 use TYPO3\CMS\Core\Http\Response;
 use TYPO3\CMS\Core\Imaging\Icon;
 use TYPO3\CMS\Core\Imaging\IconFactory;
+use TYPO3\CMS\Core\Messaging\FlashMessage;
 use TYPO3\CMS\Core\Page\PageRenderer;
 use TYPO3\CMS\Core\Resource\DuplicationBehavior;
 use TYPO3\CMS\Core\Resource\ResourceFactory;
@@ -457,10 +458,23 @@ class ImportExportController extends \TYPO3\CMS\Backend\Module\BaseScriptClass i
                                                $temporaryFolderForExport->delete();
                                        }
 
-                                       $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('exportdata_savedFile'), sprintf($GLOBALS['LANG']->getLL('exportdata_savedInSBytes', TRUE), $file->getPublicUrl(), GeneralUtility::formatSize(strlen($out))), 0, 1);
+                                       /** @var FlashMessage $flashMessage */
+                                       $flashMessage = GeneralUtility::makeInstance(
+                                               FlashMessage::class,
+                                               sprintf($GLOBALS['LANG']->getLL('exportdata_savedInSBytes', TRUE), $file->getPublicUrl(), GeneralUtility::formatSize(strlen($out))),
+                                               $GLOBALS['LANG']->getLL('exportdata_savedFile'),
+                                               FlashMessage::OK
+                                       );
                                } else {
-                                       $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('exportdata_problemsSavingFile'), sprintf($GLOBALS['LANG']->getLL('exportdata_badPathS', TRUE), $this->getTemporaryFolderPath()), 0, 1, 2);
+                                       /** @var FlashMessage $flashMessage */
+                                       $flashMessage = GeneralUtility::makeInstance(
+                                               FlashMessage::class,
+                                               sprintf($GLOBALS['LANG']->getLL('exportdata_badPathS', TRUE), $saveFolder->getPublicUrl()),
+                                               $GLOBALS['LANG']->getLL('exportdata_problemsSavingFile'),
+                                               FlashMessage::ERROR
+                                       );
                                }
+                               $this->content .= $flashMessage->render();
                        }
                }
                // OUTPUT to BROWSER: