[TASK] EM: Remove ExtJS 01/35901/9
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Thu, 8 Jan 2015 13:25:01 +0000 (14:25 +0100)
committerBenjamin Mack <benni@typo3.org>
Sat, 10 Jan 2015 18:21:57 +0000 (19:21 +0100)
Replaces ExtJS dialogs with the new TYPO3 modals. Additionaly, all calls
to TYPO3.l10n.localize() are replaced by accessing the TYPO3.lang array
directly.

Resolves: #63495
Related: #48867
Releases: master
Change-Id: Ibb9be75cf2fab266413e4519c9b6a93ed349e6dc
Reviewed-on: http://review.typo3.org/35901
Reviewed-by: Mathias Schreiber <mathias.schreiber@wmdb.de>
Tested-by: Mathias Schreiber <mathias.schreiber@wmdb.de>
Reviewed-by: Benjamin Mack <benni@typo3.org>
Tested-by: Benjamin Mack <benni@typo3.org>
typo3/sysext/extensionmanager/Classes/Controller/DownloadController.php
typo3/sysext/extensionmanager/Resources/Private/Language/locallang.xlf
typo3/sysext/extensionmanager/Resources/Private/Layouts/Main.html
typo3/sysext/extensionmanager/Resources/Private/Partials/List/UnresolvedDependencies.html
typo3/sysext/extensionmanager/Resources/Private/Partials/List/UnresolvedDependencies.json
typo3/sysext/extensionmanager/Resources/Private/Partials/List/UnresolvedDependenciesMessage.html
typo3/sysext/extensionmanager/Resources/Public/JavaScript/Main.js

index ba1f1b6..4445435 100644 (file)
@@ -68,7 +68,7 @@ class DownloadController extends AbstractController {
                        $dependencyTypes = $this->managementService->getAndResolveDependencies($extension);
                        if (count($dependencyTypes) > 0) {
                                $hasDependencies = TRUE;
-                               $message = $this->translate('downloadExtension.dependencies.headline');
+                               $message = '<p>' . $this->translate('downloadExtension.dependencies.headline') . '</p>';
                                foreach ($dependencyTypes as $dependencyType => $dependencies) {
                                        $extensions = '';
                                        foreach ($dependencies as $extensionKey => $dependency) {
index 2dccfee..42b5a00 100644 (file)
                        <trans-unit id="updateScript.none" xml:space="preserve">
                                <source>No update necessary.</source>
                        </trans-unit>
+                       <trans-unit id="button.cancel" xml:space="preserve">
+                               <source>Cancel</source>
+                       </trans-unit>
+                       <trans-unit id="button.remove" xml:space="preserve">
+                               <source>Remove extension</source>
+                       </trans-unit>
+                       <trans-unit id="button.updateExtension" xml:space="preserve">
+                               <source>Update extension</source>
+                       </trans-unit>
+                       <trans-unit id="button.resolveDependencies" xml:space="preserve">
+                               <source>Resolve dependencies</source>
+                       </trans-unit>
+                       <trans-unit id="button.resolveDependenciesIgnore" xml:space="preserve">
+                               <source>Continue anyway</source>
+                       </trans-unit>
                        <trans-unit id="extensionList.clickToConfigure" xml:space="preserve">
                                <source>(Click to configure)</source>
                        </trans-unit>
index 5ba8263..71c51ff 100644 (file)
@@ -1,6 +1,6 @@
 {namespace em=TYPO3\CMS\Extensionmanager\ViewHelpers}
 
-<f:be.container pageTitle="Extension Manager" enableClickMenu="false" loadPrototype="false" loadScriptaculous="false" loadExtJs="false" loadExtJsTheme="true" loadJQuery="true"
+<f:be.container pageTitle="Extension Manager" enableClickMenu="false" loadPrototype="false" loadExtJsTheme="false" loadJQuery="true"
 
        includeCssFiles="{
                0:'{f:uri.resource(path:\'Contrib/LoadMask/jquery.loadmask.css\')}'
index 58edb4f..48ac8d6 100644 (file)
@@ -1,4 +1,4 @@
-<f:translate key="dependencyCheck.headline" arguments="{extensionKey: extension.extensionKey}" />:
+<p><f:translate key="dependencyCheck.headline" arguments="{extensionKey: extension.extensionKey}" />:</p>
 <ul>
        <f:for each="{unresolvedDependencies}" key="key" as="messages">
                <f:if condition="{key} == {extension.extensionKey}">
index 010d8f1..0c56e7d 100644 (file)
@@ -1,6 +1,6 @@
 <f:render partial="List/UnresolvedDependencies.html" arguments="{_all}" />
 
-<h3><span class="t3-icon t3-icon-actions t3-icon-dialog-error">&nbsp;</span> <f:translate key="dependencyCheck.unresolvedDependencies.title" /></h3>
+<h3><span class="fa fa-exclamation-triangle"></span> <f:translate key="dependencyCheck.unresolvedDependencies.title" /></h3>
 <f:render partial="List/UnresolvedDependenciesMessage.html" />
 <br /><br />
 <strong><f:translate key="dependencyCheck.unresolvedDependencies.question" /></strong>
\ No newline at end of file
index e8f8bd5..7d6a5d4 100644 (file)
@@ -1 +1 @@
-<f:translate key="dependencyCheck.unresolvedDependencies.message" />
\ No newline at end of file
+<p><f:translate key="dependencyCheck.unresolvedDependencies.message" /></p>
\ No newline at end of file
index b8ea367..59ce5e2 100644 (file)
@@ -73,26 +73,27 @@ define(['jquery', 'datatables', 'jquery/jquery.clearable'], function($) {
                        $me.attr('href', '#');
                        $me.addClass('transformed');
                        $me.click(function() {
-                               var $extManager = $(ExtensionManager.identifier.extensionManager);
-                               TYPO3.Dialog.QuestionDialog({
-                                       title: TYPO3.l10n.localize('extensionList.removalConfirmation.title'),
-                                       msg: TYPO3.l10n.localize('extensionList.removalConfirmation.question'),
-                                       url: $me.data('href'),
-                                       fn: function(button, dummy, dialog) {
-                                               if (button == 'yes') {
-                                                       $extManager.mask();
-                                                       $.ajax({
-                                                               url: dialog.url,
-                                                               success: function() {
-                                                                       location.reload();
-                                                               },
-                                                               error: function() {
-                                                                       $extManager.unmask();
-                                                               }
-                                                       });
+                               top.TYPO3.Modal.confirm(
+                                       TYPO3.lang['extensionList.removalConfirmation.title'],
+                                       TYPO3.lang['extensionList.removalConfirmation.question'],
+                                       top.TYPO3.Severity.error,
+                                       [
+                                               {
+                                                       text: TYPO3.lang['button.cancel'],
+                                                       active: true,
+                                                       trigger: function() {
+                                                               top.TYPO3.Modal.dismiss();
+                                                       }
+                                               }, {
+                                                       text: TYPO3.lang['button.remove'],
+                                                       btnClass: 'btn-danger',
+                                                       trigger: function() {
+                                                               ExtensionManager.removeExtensionFromDisk($me);
+                                                               top.TYPO3.Modal.dismiss();
+                                                       }
                                                }
-                                       }
-                               });
+                                       ]
+                               );
                        });
                });
 
@@ -102,16 +103,32 @@ define(['jquery', 'datatables', 'jquery/jquery.clearable'], function($) {
                        $me.attr('href', '#');
                        $me.addClass('transformed');
                        $me.click(function() {
-                               $(ExtensionManager.identifier.extensionManager).mask();
                                $.ajax({
                                        url: $(this).data('href'),
                                        dataType: 'json',
+                                       beforeSend: function() {
+                                               $(ExtensionManager.identifier.extensionManager).mask();
+                                       },
                                        success: ExtensionManager.updateExtension
                                });
                        });
                });
        };
 
+       ExtensionManager.removeExtensionFromDisk = function($extension) {
+               var $extManager = $(Repository.identifier.extensionManager);
+               $extManager.mask();
+               $.ajax({
+                       url: $extension.data('href'),
+                       success: function() {
+                               location.reload();
+                       },
+                       error: function() {
+                               $extManager.unmask();
+                       }
+               });
+       };
+
        ExtensionManager.getUrlVars = function() {
                var vars = [], hash;
                var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
@@ -168,60 +185,74 @@ define(['jquery', 'datatables', 'jquery/jquery.clearable'], function($) {
        };
 
        ExtensionManager.updateExtension = function(data) {
-               var message = '<h1>' + TYPO3.l10n.localize('extensionList.updateConfirmation.title') + '</h1>';
-               message += '<h2>' + TYPO3.l10n.localize('extensionList.updateConfirmation.message') + '</h2>';
+               var message = '<h1>' + TYPO3.lang['extensionList.updateConfirmation.title'] + '</h1>';
+               message += '<h2>' + TYPO3.lang['extensionList.updateConfirmation.message'] + '</h2>';
                $.each(data.updateComments, function(version, comment) {
                        message += '<h3>' + version + '</h3>';
                        message += '<div>' + comment + '</div>';
                });
 
-               TYPO3.Dialog.QuestionDialog({
-                       title: TYPO3.l10n.localize('extensionList.updateConfirmation.questionVersionComments'),
-                       msg: message,
-                       width: 600,
-                       url: data.url,
-                       fn: function(button, dummy, dialog) {
-                               var $extManager = $(ExtensionManager.identifier.extensionManager);
-                               if (button == 'yes') {
-                                       $.ajax({
-                                               url: dialog.url,
-                                               dataType: 'json',
-                                               success: function(data) {
-                                                       if (data.hasErrors) {
+               var $extManager = $(ExtensionManager.identifier.extensionManager);
+               $extManager.unmask();
+
+               top.TYPO3.Modal.confirm(
+                       TYPO3.lang['extensionList.updateConfirmation.questionVersionComments'],
+                       message,
+                       top.TYPO3.Severity.warning,
+                       [
+                               {
+                                       text: TYPO3.lang['button.cancel'],
+                                       active: true,
+                                       trigger: function() {
+                                               top.TYPO3.Modal.dismiss();
+                                       }
+                               }, {
+                                       text: TYPO3.lang['button.updateExtension'],
+                                       btnClass: 'btn-warning',
+                                       trigger: function() {
+                                               $.ajax({
+                                                       url: data.url,
+                                                       dataType: 'json',
+                                                       beforeSend: function() {
+                                                               $extManager.mask();
+                                                       },
+                                                       success: function(data) {
+                                                               if (data.hasErrors) {
+                                                                       top.TYPO3.Flashmessage.display(
+                                                                               top.TYPO3.Severity.error,
+                                                                               TYPO3.lang['downloadExtension.updateExtension.error'],
+                                                                               data.errorMessage,
+                                                                               15
+                                                                       );
+                                                                       $extManager.unmask();
+                                                               } else {
+                                                                       top.TYPO3.Flashmessage.display(
+                                                                               top.TYPO3.Severity.info,
+                                                                               TYPO3.lang['extensionList.updateFlashMessage.title'],
+                                                                               TYPO3.lang['extensionList.updateFlashMessage.message'].replace(/\{0\}/g, data.extension),
+                                                                               15
+                                                                       );
+                                                                       location.reload();
+                                                               }
+                                                       },
+                                                       error: function(jqXHR, textStatus, errorThrown) {
+                                                               // Create an error message with diagnosis info.
+                                                               var errorMessage = textStatus + '(' + errorThrown + '): ' + jqXHR.responseText;
+
                                                                top.TYPO3.Flashmessage.display(
                                                                        top.TYPO3.Severity.error,
-                                                                       TYPO3.l10n.localize('downloadExtension.updateExtension.error'),
-                                                                       data.errorMessage,
-                                                                       15
-                                                               );
-                                                       } else {
-                                                               top.TYPO3.Flashmessage.display(
-                                                                       top.TYPO3.Severity.info,
-                                                                       TYPO3.l10n.localize('extensionList.updateFlashMessage.title'),
-                                                                       TYPO3.l10n.localize('extensionList.updateFlashMessage.message').replace(/\{0\}/g, data.extension),
+                                                                       TYPO3.lang['downloadExtension.updateExtension.error'],
+                                                                       errorMessage,
                                                                        15
                                                                );
+                                                               $extManager.unmask();
                                                        }
-                                                       $extManager.unmask();
-                                               },
-                                               error: function(jqXHR, textStatus, errorThrown) {
-                                                       // Create an error message with diagnosis info.
-                                                       var errorMessage = textStatus + '(' + errorThrown + '): ' + jqXHR.responseText;
-
-                                                       top.TYPO3.Flashmessage.display(
-                                                               top.TYPO3.Severity.error,
-                                                               TYPO3.l10n.localize('downloadExtension.updateExtension.error'),
-                                                               errorMessage,
-                                                               15
-                                                       );
-                                                       $extManager.unmask();
-                                               }
-                                       });
-                               } else {
-                                       $extManager.unmask();
+                                               });
+                                               top.TYPO3.Modal.dismiss();
+                                       }
                                }
-                       }
-               });
+                       ]
+               );
        };
 
        /**
@@ -330,78 +361,90 @@ define(['jquery', 'datatables', 'jquery/jquery.clearable'], function($) {
                installButtons.off('click');
                installButtons.on('click', function(event) {
                        event.preventDefault();
-                       $(Repository.identifier.extensionManager).mask();
                        var url = $(event.currentTarget.form).attr('data-href');
                        Repository.downloadPath = $(event.currentTarget.form).find('input.downloadPath:checked').val();
                        $.ajax({
                                url: url,
                                dataType: 'json',
+                               beforeSend: function() {
+                                       $(Repository.identifier.extensionManager).mask();
+                               },
                                success: Repository.getDependencies
                        });
                });
        };
 
        Repository.getDependencies = function(data) {
+               var $extManager = $(Repository.identifier.extensionManager);
+               $extManager.unmask();
                if (data.hasDependencies) {
-                       TYPO3.Dialog.QuestionDialog({
-                               title: data.title,
-                               msg: data.message,
-                               url: data.url + '&tx_extensionmanager_tools_extensionmanagerextensionmanager[downloadPath]=' + Repository.downloadPath,
-                               fn: Repository.getResolveDependenciesAndInstallResult
-                       });
+                       top.TYPO3.Modal.confirm(data.title, data.message, top.TYPO3.Severity.info, [
+                               {
+                                       text: TYPO3.lang['button.cancel'],
+                                       active: true,
+                                       trigger: function() {
+                                               top.TYPO3.Modal.dismiss();
+                                       }
+                               }, {
+                                       text: TYPO3.lang['button.resolveDependencies'],
+                                       btnClass: 'btn-info',
+                                       trigger: function() {
+                                               Repository.getResolveDependenciesAndInstallResult(data.url + '&tx_extensionmanager_tools_extensionmanagerextensionmanager[downloadPath]=' + Repository.downloadPath);
+                                               top.TYPO3.Modal.dismiss();
+                                       }
+                               }
+                       ]);
                } else {
                        if(data.hasErrors) {
-                               $(Repository.identifier.extensionManager).unmask();
                                top.TYPO3.Flashmessage.display(top.TYPO3.Severity.error, data.title, data.message, 15);
                        } else {
-                               var button = 'yes';
-                               var dialog = [];
-                               var dummy = '';
-                               dialog['url'] = data.url + '&tx_extensionmanager_tools_extensionmanagerextensionmanager[downloadPath]=' + Repository.downloadPath;
-                               Repository.getResolveDependenciesAndInstallResult(button, dummy, dialog);
+                               Repository.getResolveDependenciesAndInstallResult(data.url + '&tx_extensionmanager_tools_extensionmanagerextensionmanager[downloadPath]=' + Repository.downloadPath);
                        }
                }
                return false;
        };
 
-       Repository.getResolveDependenciesAndInstallResult = function(button, dummy, dialog) {
-               var $emViewport = $(Repository.identifier.extensionManager);
-               if (button === 'yes') {
-                       var newUrl = dialog.url;
-                       $.ajax({
-                               url: newUrl,
-                               dataType: 'json',
-                               success: function (data) {
-                                       $emViewport.unmask();
-                                       if (data.errorCount > 0) {
-                                               TYPO3.Dialog.QuestionDialog({
-                                                       title: data.errorTitle,
-                                                       msg: data.errorMessage,
-                                                       url: data.skipDependencyUri,
-                                                       fn: function (button, dummy, dialog) {
-                                                               if (button == 'yes') {
-                                                                       $emViewport.mask();
-                                                                       Repository.getResolveDependenciesAndInstallResult('yes', dummy, dialog);
-                                                               }
+       Repository.getResolveDependenciesAndInstallResult = function(url) {
+               var $extManager = $(Repository.identifier.extensionManager);
+               $.ajax({
+                       url: url,
+                       dataType: 'json',
+                       beforeSend: function() {
+                               $extManager.mask();
+                       },
+                       success: function (data) {
+                               $extManager.unmask();
+                               if (data.errorCount > 0) {
+                                       top.TYPO3.Modal.confirm(data.errorTitle, data.errorMessage, top.TYPO3.Severity.warning, [
+                                               {
+                                                       text: TYPO3.lang['button.cancel'],
+                                                       active: true,
+                                                       trigger: function() {
+                                                               top.TYPO3.Modal.dismiss();
                                                        }
+                                               }, {
+                                                       text: TYPO3.lang['button.resolveDependenciesIgnore'],
+                                                       btnClass: 'btn-warning',
+                                                       trigger: function() {
+                                                               Repository.getResolveDependenciesAndInstallResult(data.skipDependencyUri);
+                                                               top.TYPO3.Modal.dismiss();
+                                                       }
+                                               }
+                                       ]);
+                               } else {
+                                       var successMessage = TYPO3.lang['extensionList.dependenciesResolveDownloadSuccess.message'].replace(/\{0\}/g, data.extension) + ' <br />';
+                                       successMessage += '<br /><h3>' + TYPO3.lang['extensionList.dependenciesResolveDownloadSuccess.header'] + ':</h3>';
+                                       $.each(data.result, function(index, value) {
+                                               successMessage += TYPO3.lang['extensionList.dependenciesResolveDownloadSuccess.item'] + ' ' + index + ':<br /><ul>';
+                                               $.each(value, function(extkey, extdata) {
+                                                       successMessage += '<li>' + extkey + '</li>';
                                                });
-                                       } else {
-                                               var successMessage = TYPO3.l10n.localize('extensionList.dependenciesResolveDownloadSuccess.message').replace(/\{0\}/g, data.extension) + ' <br />';
-                                               successMessage += '<br /><h3>' + TYPO3.l10n.localize('extensionList.dependenciesResolveDownloadSuccess.header') + ':</h3>';
-                                               $.each(data.result, function(index, value) {
-                                                       successMessage += TYPO3.l10n.localize('extensionList.dependenciesResolveDownloadSuccess.item') + ' ' + index + ':<br /><ul>';
-                                                       $.each(value, function(extkey, extdata) {
-                                                               successMessage += '<li>' + extkey + '</li>';
-                                                       });
-                                                       successMessage += '</ul>';
-                                               });
-                                               top.TYPO3.Flashmessage.display(top.TYPO3.Severity.info, TYPO3.l10n.localize('extensionList.dependenciesResolveFlashMessage.title').replace(/\{0\}/g, data.extension), successMessage, 15);
-                                       }
+                                               successMessage += '</ul>';
+                                       });
+                                       top.TYPO3.Flashmessage.display(top.TYPO3.Severity.info, TYPO3.lang['extensionList.dependenciesResolveFlashMessage.title'].replace(/\{0\}/g, data.extension), successMessage, 15);
                                }
-                       });
-               } else {
-                       $emViewport.unmask();
-               }
+                       }
+               });
        };
 
        Repository.bindSearchFieldResetter = function() {
@@ -473,7 +516,7 @@ define(['jquery', 'datatables', 'jquery/jquery.clearable'], function($) {
                        success: function(data) {
                                // Something went wrong, show message
                                if (data.errorMessage.length) {
-                                       top.TYPO3.Flashmessage.display(top.TYPO3.Severity.warning, TYPO3.l10n.localize('extensionList.updateFromTerFlashMessage.title'), data.errorMessage, 10);
+                                       top.TYPO3.Flashmessage.display(top.TYPO3.Severity.warning, TYPO3.lang['extensionList.updateFromTerFlashMessage.title'], data.errorMessage, 10);
                                }
 
                                // Message with latest updates
@@ -481,7 +524,7 @@ define(['jquery', 'datatables', 'jquery/jquery.clearable'], function($) {
                                $lastUpdate.text(data.timeSinceLastUpdate);
                                $lastUpdate.attr(
                                        'title',
-                                       TYPO3.l10n.localize('extensionList.updateFromTer.lastUpdate.timeOfLastUpdate') + data.lastUpdateTime
+                                       TYPO3.lang['extensionList.updateFromTer.lastUpdate.timeOfLastUpdate'] + data.lastUpdateTime
                                );
 
                                if (data.updated) {
@@ -501,7 +544,7 @@ define(['jquery', 'datatables', 'jquery/jquery.clearable'], function($) {
 
                                top.TYPO3.Flashmessage.display(
                                        top.TYPO3.Severity.warning,
-                                       TYPO3.l10n.localize('extensionList.updateFromTerFlashMessage.title'),
+                                       TYPO3.lang['extensionList.updateFromTerFlashMessage.title'],
                                        errorMessage,
                                        10
                                );