[BUGFIX] Reload extension list after update 36/37536/3
authorNicole Cordes <typo3@cordes.co>
Tue, 3 Mar 2015 14:10:12 +0000 (15:10 +0100)
committerNicole Cordes <typo3@cordes.co>
Wed, 4 Mar 2015 20:32:14 +0000 (21:32 +0100)
If an extension was updated the list should be reloaded to show
update information.

Releases: master, 6.2
Resolves: #64733
Change-Id: I27598995fd365745eab14a1e095fd342cd198093
Reviewed-on: http://review.typo3.org/37536
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Nicole Cordes <typo3@cordes.co>
Tested-by: Nicole Cordes <typo3@cordes.co>
typo3/sysext/extensionmanager/Classes/Controller/DownloadController.php
typo3/sysext/extensionmanager/Resources/Private/Language/locallang.xlf
typo3/sysext/extensionmanager/Resources/Private/Templates/Download/UpdateExtension.json [deleted file]
typo3/sysext/extensionmanager/Resources/Public/JavaScript/main.js

index 116a4b7..eb1fda9 100644 (file)
@@ -176,23 +176,22 @@ class DownloadController extends AbstractController {
         * already. This method should only be called if we are sure that there is
         * an update.
         *
-        * @return void
+        * @return string
         */
        protected function updateExtensionAction() {
-               $hasErrors = FALSE;
-               $errorMessage = '';
-
                $extensionKey = $this->request->getArgument('extension');
                $highestTerVersionExtension = $this->extensionRepository->findHighestAvailableVersion($extensionKey);
                try {
                        $this->managementService->downloadMainExtension($highestTerVersionExtension);
+                       $this->addFlashMessage(
+                               htmlspecialchars($this->translate('extensionList.updateFlashMessage.body', array($extensionKey))),
+                               $this->translate('extensionList.updateFlashMessage.title')
+                       );
                } catch (\Exception $e) {
-                       $hasErrors = TRUE;
-                       $errorMessage = $e->getMessage();
+                       $this->addFlashMessage(htmlspecialchars($e->getMessage()), '', \TYPO3\CMS\Core\Messaging\FlashMessage::ERROR);
                }
-               $this->view->assign('extension', $highestTerVersionExtension)
-                       ->assign('hasErrors', $hasErrors)
-                       ->assign('errorMessage', $errorMessage);
+
+               return '';
        }
 
        /**
index 385831e..711e51b 100644 (file)
                        <trans-unit id="extensionList.updateFlashMessage.title" xml:space="preserve">
                                <source>Extension Update</source>
                        </trans-unit>
-                       <trans-unit id="extensionList.updateFlashMessage.message" xml:space="preserve">
+                       <trans-unit id="extensionList.updateFlashMessage.message" xml:space="preserve" deprecated="Unused since CMS 6.2">
                                <source>{0} updated!</source>
                        </trans-unit>
+                       <trans-unit id="extensionList.updateFlashMessage.body" xml:space="preserve">
+                               <source>%s was updated!</source>
+                       </trans-unit>
                        <trans-unit id="extensionList.removalConfirmation.question" xml:space="preserve">
                                <source>Are you sure you want to remove the extension?</source>
                        </trans-unit>
diff --git a/typo3/sysext/extensionmanager/Resources/Private/Templates/Download/UpdateExtension.json b/typo3/sysext/extensionmanager/Resources/Private/Templates/Download/UpdateExtension.json
deleted file mode 100644 (file)
index 4195df6..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-{namespace em=TYPO3\CMS\Extensionmanager\ViewHelpers}
-<em:format.jsonEncode additionalAttributes="{extension:extension.extensionKey,
-errorMessage:errorMessage,
-hasErrors:hasErrors
-}" />
\ No newline at end of file
index 8e69a6d..394ac7a 100644 (file)
                                        $.ajax({
                                                url: dialog.url,
                                                dataType: 'json',
-                                               success: function(data) {
-                                                       if (data.hasErrors) {
-                                                               TYPO3.Flashmessage.display(
-                                                                       TYPO3.Severity.error,
-                                                                       TYPO3.l10n.localize('downloadExtension.updateExtension.error'),
-                                                                       data.errorMessage,
-                                                                       15
-                                                               );
-                                                       } else {
-                                                               TYPO3.Flashmessage.display(
-                                                                       TYPO3.Severity.information,
-                                                                       TYPO3.l10n.localize('extensionList.updateFlashMessage.title'),
-                                                                       TYPO3.l10n.localize('extensionList.updateFlashMessage.message').replace(/\{0\}/g, data.extension),
-                                                                       15
-                                                               );
-                                                       }
-                                                       $('.typo3-extension-manager').unmask();
-                                               },
-                                               error: function(jqXHR, textStatus, errorThrown) {
-                                                       // Create an error message with diagnosis info.
-                                                       var errorMessage = textStatus + '(' + errorThrown + '): ' + jqXHR.responseText;
-
-                                                       TYPO3.Flashmessage.display(
-                                                               TYPO3.Severity.error,
-                                                               TYPO3.l10n.localize('downloadExtension.updateExtension.error'),
-                                                               errorMessage,
-                                                               15
-                                                       );
-                                                       $('.typo3-extension-manager').unmask();
+                                               complete: function(data) {
+                                                       location.reload();
                                                }
                                        });
                                } else {