[TASK] Use language labels in Extension Manager javascript
authorJigal van Hemert <jigal@xs4all.nl>
Wed, 17 Oct 2012 11:59:01 +0000 (13:59 +0200)
committerHelmut Hummel <helmut.hummel@typo3.org>
Wed, 17 Oct 2012 20:19:32 +0000 (22:19 +0200)
Replace text in Javascript by language labels. Fix jQuery behaviour
for update, upload and other icons. Replace some text links by icons.
After answering No to update confirmation the mask in the background
is removed.

Change-Id: Id934e4c270897d5810ff68e1f076a91d7ba182fb
Fixes: #42033
Releases: 6.0
Reviewed-on: http://review.typo3.org/15759
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel
typo3/sysext/extensionmanager/Classes/Controller/ListController.php
typo3/sysext/extensionmanager/Classes/ViewHelpers/DownloadExtensionViewHelper.php
typo3/sysext/extensionmanager/Classes/ViewHelpers/ShowExtensionVersionsViewHelper.php
typo3/sysext/extensionmanager/Classes/ViewHelpers/UpdateFromTerViewHelper.php
typo3/sysext/extensionmanager/Resources/Private/Language/locallang.xlf
typo3/sysext/extensionmanager/Resources/Private/Templates/Configuration/ShowConfigurationForm.html
typo3/sysext/extensionmanager/Resources/Private/Templates/List/Index.html
typo3/sysext/extensionmanager/Resources/Public/JavaScript/main.js
typo3/sysext/extensionmanager/Resources/Public/JavaScript/ter.js
typo3/sysext/extensionmanager/Resources/Public/JavaScript/update.js
typo3/sysext/extensionmanager/Resources/Public/JavaScript/upload.js

index f4b683b..af93757 100644 (file)
@@ -83,6 +83,8 @@ class ListController extends \TYPO3\CMS\Extensionmanager\Controller\AbstractCont
         */
        public function indexAction() {
                $this->pageRenderer->addJsFile('../t3lib/js/extjs/notifications.js');
+               $this->pageRenderer->addInlineLanguageLabelFile('EXT:extensionmanager/Resources/Private/Language/locallang.xlf');
+               $this->pageRenderer->addJsFile(\TYPO3\CMS\Core\Extension\ExtensionManager::extRelPath('lang') . 'res/js/be/typo3lang.js');
                $availableExtensions = $this->listUtility->getAvailableExtensions();
                $availableAndInstalledExtensions = $this->listUtility->getAvailableAndInstalledExtensions($availableExtensions);
                $availableAndInstalledExtensions = $this->listUtility->enrichExtensionsWithEmConfAndTerInformation($availableAndInstalledExtensions);
index ecb6801..78c8e30 100644 (file)
@@ -64,7 +64,7 @@ class DownloadExtensionViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\FormViewH
                        'extension' => $extension->getUid()
                ), 'Download');
                $this->tag->addAttribute('href', $uri);
-               $label = '<input type="submit" value="Import and Install" />';
+               $label = '<input type="submit" value="' . \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('extensionList.downloadViewHelper.submit', 'extensionmanager') . '" />';
                $this->tag->setContent($label . $pathSelector);
                $this->tag->addAttribute('class', 'download');
                return '<div id="' . $extension->getExtensionKey() . '-downloadFromTer" class="downloadFromTer">' . $this->tag->render() . '</div>';
index 1169028..524b412 100644 (file)
@@ -54,7 +54,7 @@ class ShowExtensionVersionsViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Link\
                        'allVersions' => TRUE
                ), 'List');
                $this->tag->addAttribute('href', $uri);
-               $label = 'Show all versions';
+               $label = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('extensionList.showAllVersions.label', 'extensionmanager');
                $this->tag->setContent($label);
                return $this->tag->render();
        }
index b483df3..6ae9a26 100644 (file)
@@ -52,7 +52,7 @@ class UpdateFromTerViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Link\ActionVi
                $uriBuilder->setFormat('json');
                $uri = $uriBuilder->uriFor($action, array(), 'UpdateFromTer');
                $this->tag->addAttribute('href', $uri);
-               $label = 'Update Extension List';
+               $label = \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate('extensionList.updateFromTer.label', 'extensionmanager');
                $this->tag->setContent($label);
                $this->tag->addAttribute('class', 'text');
                return '<div class="updateFromTer">' . $this->tag->render() . '<span class="spinner"></span></div>';
index f2f4c4a..237a04a 100644 (file)
                        <trans-unit id="uploadTemplate.extensionLabel" xml:space="preserve">
                                <source>Extension</source>
                        </trans-unit>
+                       <trans-unit id="extensionList.removalConfirmation.title" xml:space="preserve">
+                               <source>Extension Removal</source>
+                       </trans-unit>
+                       <trans-unit id="extensionList.removalConfirmation.message" xml:space="preserve">
+                               <source>The extension is currently installed. Uninstall extension?</source>
+                       </trans-unit>
+                       <trans-unit id="extensionList.updateConfirmation.title" xml:space="preserve">
+                               <source>Update?</source>
+                       </trans-unit>
+                       <trans-unit id="extensionList.updateConfirmation.message" xml:space="preserve">
+                               <source>Update Comments:</source>
+                       </trans-unit>
+                       <trans-unit id="extensionList.updateConfirmation.questionVersionComments" xml:space="preserve">
+                               <source>Version Comments</source>
+                       </trans-unit>
+                       <trans-unit id="extensionList.updateFlashMessage.title" xml:space="preserve">
+                               <source>Extension Update</source>
+                       </trans-unit>
+                       <trans-unit id="extensionList.updateFlashMessage.message" xml:space="preserve">
+                               <source>{0} 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>
+                       <trans-unit id="extensionList.dependencies.title" xml:space="preserve">
+                               <source>Dependencies</source>
+                       </trans-unit>
+                       <trans-unit id="extensionList.dependenciesResolveDownloadError.title" xml:space="preserve">
+                               <source>Download Error</source>
+                       </trans-unit>
+                       <trans-unit id="extensionList.dependenciesResolveDownloadSuccess.message" xml:space="preserve">
+                               <source>Your installation of {0} was successful.</source>
+                       </trans-unit>
+                       <trans-unit id="extensionList.dependenciesResolveDownloadSuccess.header" xml:space="preserve">
+                               <source>Log</source>
+                       </trans-unit>
+                       <trans-unit id="extensionList.dependenciesResolveDownloadSuccess.item" xml:space="preserve">
+                               <source>Extensions</source>
+                       </trans-unit>
+                       <trans-unit id="extensionList.dependenciesResolveFlashMessage.title" xml:space="preserve">
+                               <source>{0} installed.</source>
+                       </trans-unit>
+                       <trans-unit id="extensionList.uploadFlashMessage.title" xml:space="preserve">
+                               <source>Extension Upload</source>
+                       </trans-unit>
+                       <trans-unit id="extensionList.uploadFlashMessage.message" xml:space="preserve">
+                               <source>{0} uploaded!</source>
+                       </trans-unit>
+                       <trans-unit id="extensionList.updateFromTerFlashMessage.title" xml:space="preserve">
+                               <source>Update Extension List</source>
+                       </trans-unit>
+                       <trans-unit id="extensionList.downloadViewHelper.submit" xml:space="preserve">
+                               <source>Import and Install</source>
+                       </trans-unit>
+                       <trans-unit id="extensionList.showAllVersions.label" xml:space="preserve">
+                               <source>Show all versions</source>
+                       </trans-unit>
+                       <trans-unit id="extensionList.updateFromTer.label" xml:space="preserve">
+                               <source>Update Extension List</source>
+                       </trans-unit>
                </body>
        </file>
 </xliff>
index 60098d1..430fac1 100644 (file)
@@ -1,13 +1,9 @@
 {namespace em=TYPO3\CMS\Extensionmanager\ViewHelpers}
 <f:layout name="main" />
 <f:section name="docHeaderRow1">
+       <f:be.buttons.icon uri="{f:uri.action(action:'index',controller:'List',additionalParams:{search:extension.key})}" icon="actions-view-go-back" title="{f:translate(key:'extConfTemplate.backToList')}" />
 </f:section>
 <f:section name="docHeaderRow2">
-       <span class="back">
-               <f:link.action action="index" controller="List" additionalParams="{search:extension.key}">
-                       <f:translate key="extConfTemplate.backToList" />
-               </f:link.action>
-       </span>
 </f:section>
 <f:section name="Content">
        <div id="typo3-extension-configuration-forms">
index 48a2558..576fa09 100644 (file)
@@ -2,7 +2,7 @@
 
 <f:layout name="main" />
 <f:section name="docHeaderRow1">
-    <f:be.buttons.icon uri="{f:uri.action(action:'form',controller:'UploadExtensionFile')}" icon="actions-edit-upload" title="{f:translate(key:'extensionList.uploadExtension')}"/>
+       <f:be.buttons.icon uri="{f:uri.action(action:'form',controller:'UploadExtensionFile')}" icon="actions-edit-upload" title="{f:translate(key:'extensionList.uploadExtension')}"/>
 </f:section>
 <f:section name="docHeaderRow2">
 </f:section>
                                </f:if>
                                <td>
                                        <f:if condition="{extension.updateAvailable}">
-                                               <f:link.action
-                                                       action="updateCommentForUpdatableVersions"
-                                                       controller="Download"
-                                                       arguments="{extension:extension.key, integerVersion: extension.terObject.integerVersion}"
-                                                       class="updateAvailable"
-                                                       format="json"
-                                               ><f:translate key="extensionList.update"/></f:link.action>
+                                               <f:be.buttons.icon
+                                                       uri="{f:uri.action(action:'updateCommentForUpdatableVersions',controller:'Download',arguments:{extension:extension.key, integerVersion: extension.terObject.integerVersion},format:'json')}"
+                                                       icon="actions-system-extension-update"
+                                                       title="{f:translate(key:'extensionList.update')}"
+                                               />
                                        </f:if>
                                </td>
                                <td>
@@ -70,7 +68,7 @@
                                <td>
                                        <em:configureExtension extension="{extension}" />
                                        <em:removeExtension extension="{extension}" />
-                    <f:be.buttons.icon uri="{f:uri.action(action:'downloadExtensionZip',controller:'Action',arguments:'{extension:extension.key}')}" icon="actions-system-extension-download" title="{f:translate(key:'extensionList.downloadzip')}"/>
+                                       <f:be.buttons.icon uri="{f:uri.action(action:'downloadExtensionZip',controller:'Action',arguments:'{extension:extension.key}')}" icon="actions-system-extension-download" title="{f:translate(key:'extensionList.downloadzip')}"/>
                                        <em:downloadExtensionData extension="{extension}" />
                                </td>
                                <td class="{extension.state}">
index 567d26a..d51e67e 100644 (file)
@@ -44,8 +44,8 @@ function bindActions() {
                jQuery(this).click(function() {
                        if (jQuery(this).hasClass('isLoadedWarning')) {
                                TYPO3.Dialog.QuestionDialog({
-                                       title: 'Extension Removal',
-                                       msg: 'The extension is currently installed. Uninstall extension?',
+                                       title: TYPO3.l10n.localize('extensionList.removalConfirmation.title'),
+                                       msg: TYPO3.l10n.localize('extensionList.removalConfirmation.message'),
                                        url: jQuery(this).data('href'),
                                        fn: function(button, dummy, dialog) {
                                                if (button == 'yes') {
@@ -59,7 +59,7 @@ function bindActions() {
                })
        });
 
-       jQuery('.updateAvailable').each(function() {
+       jQuery('.t3-icon-system-extension-update').parent().each(function() {
                jQuery(this).data('href', jQuery(this).attr('href'));
                jQuery(this).attr('href', 'javascript:void(0);');
                jQuery(this).addClass('transformed');
@@ -75,15 +75,15 @@ function bindActions() {
 }
 
 function updateExtension(data) {
-       var message = '<h1>Update?</h1>';
-       message += '<h2>Update Comments:</h2>';
+       var message = '<h1>' + TYPO3.l10n.localize('extensionList.updateConfirmation.title') + '</h1>';
+       message += '<h2>' + TYPO3.l10n.localize('extensionList.updateConfirmation.message') + '</h2>';
        jQuery.each(data.updateComments, function(version, comment) {
                message += '<h3>' + version + '</h3>';
                message += '<div>' + comment + '</div>';
        });
 
        TYPO3.Dialog.QuestionDialog({
-               title: 'Version Comments',
+               title: TYPO3.l10n.localize('extensionList.updateConfirmation.questionVersionComments'),
                msg: message,
                width: 600,
                url: data.url,
@@ -94,9 +94,12 @@ function updateExtension(data) {
                                        dataType: 'json',
                                        success: function(data) {
                                                jQuery('#typo3-extension-manager').unmask();
-                                               TYPO3.Flashmessage.display(TYPO3.Severity.information, 'Extension Update', data.extension + ' updated!', 15);
+                                               TYPO3.Flashmessage.display(TYPO3.Severity.information, TYPO3.l10n.localize('extensionList.updateFlashMessage.title'),
+                                                               TYPO3.l10n.localize('extensionList.updateFlashMessage.message').replace(/\{0\}/g, data.extension), 15);
                                        }
                                });
+                       } else {
+                               jQuery('#typo3-extension-manager').unmask();
                        }
                }
        });
@@ -105,8 +108,8 @@ function updateExtension(data) {
 
 function confirmDeletionAndDelete(url) {
        TYPO3.Dialog.QuestionDialog({
-               title: 'Extension Removal',
-               msg: 'Are you sure you want to remove the extension?',
+               title: TYPO3.l10n.localize('extensionList.removalConfirmation.title'),
+               msg: TYPO3.l10n.localize('extensionList.removalConfirmation.question'),
                url: url,
                fn: function(button, dummy, dialog) {
                        if (button == 'yes') {
@@ -126,6 +129,6 @@ function removeExtension(data) {
        if (data.success) {
                datatable.fnDeleteRow(datatable.fnGetPosition(document.getElementById(data.extension)));
        } else {
-               TYPO3.Flashmessage.display(TYPO3.Severity.error, 'Extension Removal', data.message, 15);
+               TYPO3.Flashmessage.display(TYPO3.Severity.error, TYPO3.l10n.localize('extensionList.removalConfirmation.title'), data.message, 15);
        }
 }
\ No newline at end of file
index f7adceb..571bccc 100644 (file)
@@ -57,7 +57,7 @@ function bindDownload() {
 function getDependencies(data) {
        if (data.dependencies.length) {
                TYPO3.Dialog.QuestionDialog({
-                       title: 'Dependencies',
+                       title: TYPO3.l10n.localize('extensionList.dependencies.title'),
                        msg: data.message,
                        url: data.url + '&tx_extensionmanager_tools_extensionmanagerextensionmanager[downloadPath]=' + downloadPath,
                        fn: getResolveDependenciesAndInstallResult
@@ -81,18 +81,18 @@ function getResolveDependenciesAndInstallResult(button, dummy, dialog) {
                        success: function (data) {
                                jQuery('#typo3-extension-manager').unmask();
                                if (data.errorMessage.length) {
-                                       TYPO3.Flashmessage.display(TYPO3.Severity.error, 'Download Error', data.errorMessage, 5);
+                                       TYPO3.Flashmessage.display(TYPO3.Severity.error, TYPO3.l10n.localize('extensionList.dependenciesResolveDownloadError.title'), data.errorMessage, 5);
                                } else {
-                                       var successMessage = 'Your installation of ' + data.extension + ' was successfull. <br />';
-                                       successMessage += '<br /><h3>Log:</h3>';
+                                       var successMessage = TYPO3.l10n.localize('extensionList.dependenciesResolveDownloadSuccess.message').replace(/\{0\}/g, data.extension) + ' <br />';
+                                       successMessage += '<br /><h3>' + TYPO3.l10n.localize('extensionList.dependenciesResolveDownloadSuccess.header') + ':</h3>';
                                        jQuery.each(data.result, function(index, value) {
-                                               successMessage += 'Extensions ' + index + ':<br /><ul>';
+                                               successMessage += TYPO3.l10n.localize('extensionList.dependenciesResolveDownloadSuccess.item') + ' ' + index + ':<br /><ul>';
                                                jQuery.each(value, function(extkey, extdata) {
                                                        successMessage += '<li>' + extkey + '</li>';
                                                });
                                                successMessage += '</ul>';
                                        });
-                                       TYPO3.Flashmessage.display(TYPO3.Severity.information, data.extension + ' installed.', successMessage, 15);
+                                       TYPO3.Flashmessage.display(TYPO3.Severity.information, TYPO3.l10n.localize('extensionList.dependenciesResolveFlashMessage.title').replace(/\{0\}/g, data.extension), successMessage, 15);
                                }
                        }
                });
index e65c3a4..74834cd 100644 (file)
@@ -24,7 +24,7 @@ function updateFromTer(url, forceUpdate) {
                        jQuery('.updateFromTer .spinner').hide();
 
                        if (data.errorMessage.length) {
-                               TYPO3.Flashmessage.display(TYPO3.Severity.warning, 'Update Extension List', data.errorMessage, 10);
+                               TYPO3.Flashmessage.display(TYPO3.Severity.warning, TYPO3.l10n.localize('extensionList.updateFromTerFlashMessage.title'), data.errorMessage, 10);
                        }
                        jQuery('.updateFromTer .text').html(
                                data.message
index 95988f0..940ff25 100644 (file)
@@ -1,19 +1,16 @@
 
 jQuery(document).ready(function() {
-       jQuery('.uploadExtension').not('.transformed').each(function(){
+       jQuery('.t3-icon-edit-upload').parent().not('.transformed').each(function () {
                jQuery(this).data('href', jQuery(this).attr('href'));
                jQuery(this).attr('href', 'javascript:void(0);');
                jQuery(this).addClass('transformed');
-               jQuery(this).click(function() {
+               jQuery(this).click(function () {
                        jQuery('.uploadForm').show();
-                       jQuery(this).hide();
                        jQuery.ajax({
-                               url: jQuery(this).data('href'),
-                               dataType: 'html',
-                               success: function(data) {
-                                       jQuery('.uploadForm').html(
-                                               data
-                                       );
+                               url:jQuery(this).data('href'),
+                               dataType:'html',
+                               success:function (data) {
+                                       jQuery('.uploadForm').html(data);
                                        handleUploadForm();
                                }
                        });
@@ -26,7 +23,7 @@ function handleUploadForm() {
                var ret = frames['typo3-extensionmanager-upload-target'].document.getElementsByTagName("body")[0].innerHTML;
                var data = eval("("+ret+")");
                if (data.success) {
-                       TYPO3.Flashmessage.display(TYPO3.Severity.information, 'Extension Upload', data.extension + ' uploaded!', 15);
+                       TYPO3.Flashmessage.display(TYPO3.Severity.information, TYPO3.l10n.localize('extensionList.uploadFlashMessage.title'), TYPO3.l10n.localize('extensionList.uploadFlashMessage.message').replace(/\{0\}/g, data.extension), 15);
                        location.reload();
                }
        })