[FEATURE] EM: Choose version for update 30/38030/3
authorNicole Cordes <typo3@cordes.co>
Mon, 23 Mar 2015 10:02:05 +0000 (11:02 +0100)
committerHelmut Hummel <helmut.hummel@typo3.org>
Mon, 23 Mar 2015 20:38:35 +0000 (21:38 +0100)
If you update an extension, currently always the latest version is
installed. Due to compatibility issues this isn't always the right
solution. This patch adds the possibility to choose the version which
should be installed from the confirmation modal.

Resolves: #60070
Releases: master
Change-Id: Ie19ad2e59aa577092c300ed8592386eaad514809
Reviewed-on: http://review.typo3.org/38030
Reviewed-by: Jan Helke <typo3@helke.de>
Tested-by: Jan Helke <typo3@helke.de>
Reviewed-by: Andreas Fernandez <andreas.fernandez@aspedia.de>
Tested-by: Andreas Fernandez <andreas.fernandez@aspedia.de>
Reviewed-by: Helmut Hummel <helmut.hummel@typo3.org>
Tested-by: Helmut Hummel <helmut.hummel@typo3.org>
typo3/sysext/extensionmanager/Classes/Controller/DownloadController.php
typo3/sysext/extensionmanager/Resources/Public/JavaScript/Main.js

index 0e1d65d..f27bded 100644 (file)
@@ -181,9 +181,13 @@ class DownloadController extends AbstractController {
         */
        protected function updateExtensionAction() {
                $extensionKey = $this->request->getArgument('extension');
-               $highestTerVersionExtension = $this->extensionRepository->findHighestAvailableVersion($extensionKey);
+               $version = $this->request->getArgument('version');
+               $extension = $this->extensionRepository->findOneByExtensionKeyAndVersion($extensionKey, $version);
+               if (!$extension instanceof Extension) {
+                       $extension = $this->extensionRepository->findHighestAvailableVersion($extensionKey);
+               }
                try {
-                       $this->managementService->downloadMainExtension($highestTerVersionExtension);
+                       $this->managementService->downloadMainExtension($extension);
                        $this->addFlashMessage(
                                htmlspecialchars($this->translate('extensionList.updateFlashMessage.body', array($extensionKey))),
                                $this->translate('extensionList.updateFlashMessage.title')
index 8ad0ae7..91adca3 100644 (file)
@@ -170,10 +170,14 @@ define(['jquery', 'datatables', 'jquery/jquery.clearable'], function($) {
        ExtensionManager.updateExtension = function(data) {
                var message = '<h1>' + TYPO3.lang['extensionList.updateConfirmation.title'] + '</h1>';
                message += '<h2>' + TYPO3.lang['extensionList.updateConfirmation.message'] + '</h2>';
+               message += '<form>';
+               var i = 0;
                $.each(data.updateComments, function(version, comment) {
-                       message += '<h3>' + version + '</h3>';
+                       message += '<h3><input type="radio" ' + (i == 0 ? 'checked="checked" ' : '') + 'name="version" value="' + version + '" /> ' + version + '</h3>';
                        message += '<div>' + comment + '</div>';
+                       i++;
                });
+               message += '</form>';
 
                var $extManager = $(ExtensionManager.identifier.extensionManager);
                $extManager.unmask();
@@ -195,6 +199,11 @@ define(['jquery', 'datatables', 'jquery/jquery.clearable'], function($) {
                                        trigger: function() {
                                                $.ajax({
                                                        url: data.url,
+                                                       data: {
+                                                               tx_extensionmanager_tools_extensionmanagerextensionmanager: {
+                                                                       version: $('input:radio[name=version]:checked', top.TYPO3.Modal.currentModal).val()
+                                                               }
+                                                       },
                                                        dataType: 'json',
                                                        beforeSend: function() {
                                                                $extManager.mask();