[BUGFIX] Disable removal of installed extensions 49/29849/3
authorNicole Cordes <typo3@cordes.co>
Sun, 4 May 2014 11:54:04 +0000 (13:54 +0200)
committerMarc Bastian Heinrichs <typo3@mbh-software.de>
Sun, 4 May 2014 12:19:04 +0000 (14:19 +0200)
This patch removes the deletion possibility for installed extension in
the list view of the extension manager. Furthermore the javascript can
be adopted as the check for installed extensions can be removed as well.

Resolves: #58493
Related: #53459
Releases: 6.2
Change-Id: I713bbb93230108db144044be9184e77f484931c9
Reviewed-on: https://review.typo3.org/29849
Reviewed-by: Anja Leichsenring
Tested-by: Anja Leichsenring
Reviewed-by: Sascha Wilking
Tested-by: Sascha Wilking
Reviewed-by: Nadir S.
Tested-by: Nadir S.
Reviewed-by: Marc Bastian Heinrichs
Tested-by: Marc Bastian Heinrichs
typo3/sysext/extensionmanager/Classes/ViewHelpers/RemoveExtensionViewHelper.php
typo3/sysext/extensionmanager/Resources/Public/JavaScript/main.js

index 05508d2..338fc01 100644 (file)
@@ -41,10 +41,13 @@ class RemoveExtensionViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Link\Action
        /**
         * Renders an install link
         *
-        * @param string $extension
+        * @param array $extension
         * @return string the rendered a tag
         */
        public function render($extension) {
+               if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded($extension['key'])) {
+                       return '';
+               }
                if (
                        !in_array($extension['type'], \TYPO3\CMS\Extensionmanager\Domain\Model\Extension::returnAllowedInstallTypes()) ||
                        $extension['type'] === 'System'
@@ -60,9 +63,6 @@ class RemoveExtensionViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Link\Action
                ), 'Action');
                $this->tag->addAttribute('href', $uri);
                $cssClass = 'removeExtension';
-               if (\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::isLoaded($extension['key'])) {
-                       $cssClass .= ' isLoadedWarning';
-               }
                $this->tag->addAttribute('class', $cssClass);
                $this->tag->addAttribute('title', \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('extensionList.remove', 'extensionmanager'));
                $this->tag->setContent(\TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-edit-delete'));
index f775044..c1a4a1b 100644 (file)
                        $(this).attr('href', '#');
                        $(this).addClass('transformed');
                        $(this).click(function() {
-                               if ($(this).hasClass('isLoadedWarning')) {
-                                       TYPO3.Dialog.QuestionDialog({
-                                               title: TYPO3.l10n.localize('extensionList.removalConfirmation.title'),
-                                               msg: TYPO3.l10n.localize('extensionList.removalConfirmation.message'),
-                                               url: $(this).data('href'),
-                                               fn: function(button, dummy, dialog) {
-                                                       if (button == 'yes') {
-                                                               confirmDeletionAndDelete(dialog.url);
-                                                       }
+                               TYPO3.Dialog.QuestionDialog({
+                                       title: TYPO3.l10n.localize('extensionList.removalConfirmation.title'),
+                                       msg: TYPO3.l10n.localize('extensionList.removalConfirmation.question'),
+                                       url: $(this).data('href'),
+                                       fn: function(button, dummy, dialog) {
+                                               if (button == 'yes') {
+                                                       $('.typo3-extension-manager').mask();
+                                                       $.ajax({
+                                                               url: dialog.url,
+                                                               dataType: 'json',
+                                                               success: removeExtension
+                                                       });
                                                }
-                                       });
-                               } else {
-                                       confirmDeletionAndDelete($(this).data('href'));
-                               }
+                                       }
+                               });
                        });
                });
 
                });
        }
 
-       function confirmDeletionAndDelete(url) {
-               TYPO3.Dialog.QuestionDialog({
-                       title: TYPO3.l10n.localize('extensionList.removalConfirmation.title'),
-                       msg: TYPO3.l10n.localize('extensionList.removalConfirmation.question'),
-                       url: url,
-                       fn: function(button, dummy, dialog) {
-                               if (button == 'yes') {
-                                       $('.typo3-extension-manager').mask();
-                                       $.ajax({
-                                               url: dialog.url,
-                                               dataType: 'json',
-                                               success: removeExtension
-                                       });
-                               }
-                       }
-               });
-       }
-
        function removeExtension(data) {
                $('.typo3-extension-manager').unmask();
                if (data.success) {