[TASK] Add a "save and close" button in the extensionmanager 83/31083/7
authorEric Chavaillaz <eric.chavaillaz@gmail.com>
Mon, 23 Jun 2014 16:08:17 +0000 (18:08 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 24 Jul 2014 15:16:58 +0000 (17:16 +0200)
Resolves: #59812
Releases: 6.3, 6.2
Change-Id: I3ccfbdd496af2fca9a72d2675393537eafffd075
Reviewed-on: http://review.typo3.org/31083
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/extensionmanager/Classes/Controller/ConfigurationController.php
typo3/sysext/extensionmanager/Resources/Private/Language/locallang.xlf
typo3/sysext/extensionmanager/Resources/Private/Templates/Configuration/ShowConfigurationForm.html
typo3/sysext/extensionmanager/Resources/Public/JavaScript/configuration.js
typo3/sysext/extensionmanager/ext_tables.php

index 99d4202..5c23960 100644 (file)
@@ -13,6 +13,7 @@ namespace TYPO3\CMS\Extensionmanager\Controller;
  *
  * The TYPO3 project - inspiring people to share!
  */
+
 use TYPO3\CMS\Extensionmanager\Domain\Model\Extension;
 use TYPO3\CMS\Extensionmanager\Exception\ExtensionManagerException;
 
@@ -67,23 +68,15 @@ class ConfigurationController extends AbstractController {
        }
 
        /**
-        * Save configuration to file
-        * Merges existing with new configuration.
+        * Save configuration and redirects back to form
+        * or to the welcome page of a distribution
         *
         * @param array $config The new extension configuration
         * @param string $extensionKey The extension key
         * @return void
         */
        public function saveAction(array $config, $extensionKey) {
-               /** @var $configurationUtility \TYPO3\CMS\Extensionmanager\Utility\ConfigurationUtility */
-               $configurationUtility = $this->objectManager->get('TYPO3\\CMS\\Extensionmanager\\Utility\\ConfigurationUtility');
-               $newConfiguration = $configurationUtility->getCurrentConfiguration($extensionKey);
-               \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($newConfiguration, $config);
-               $configurationUtility->writeConfiguration(
-                       $configurationUtility->convertValuedToNestedConfiguration($newConfiguration),
-                       $extensionKey
-               );
-               $this->emitAfterExtensionConfigurationWriteSignal($newConfiguration);
+               $this->saveConfiguration($config, $extensionKey);
                /** @var Extension $extension */
                $extension = $this->extensionRepository->findOneByCurrentVersionByExtensionKey($extensionKey);
                // Different handling for distribution installation
@@ -97,6 +90,19 @@ class ConfigurationController extends AbstractController {
        }
 
        /**
+        * Saves new configuration and redirects back to list
+        *
+        * @param array $config
+        * @param string $extensionKey
+        * @return void
+        */
+       public function saveAndCloseAction(array $config, $extensionKey) {
+               $this->saveConfiguration($config, $extensionKey);
+               $this->redirect('index', 'List');
+       }
+
+
+       /**
         * Emits a signal after the configuration file was written
         *
         * @param array $newConfiguration
@@ -105,4 +111,23 @@ class ConfigurationController extends AbstractController {
                $this->signalSlotDispatcher->dispatch(__CLASS__, 'afterExtensionConfigurationWrite', array($newConfiguration, $this));
        }
 
+       /**
+        * Merge and save new configuration
+        *
+        * @param array $config
+        * @param $extensionKey
+        * @return void
+        */
+       protected function saveConfiguration(array $config, $extensionKey) {
+               /** @var $configurationUtility \TYPO3\CMS\Extensionmanager\Utility\ConfigurationUtility */
+               $configurationUtility = $this->objectManager->get('TYPO3\\CMS\\Extensionmanager\\Utility\\ConfigurationUtility');
+               $newConfiguration = $configurationUtility->getCurrentConfiguration($extensionKey);
+               \TYPO3\CMS\Core\Utility\ArrayUtility::mergeRecursiveWithOverrule($newConfiguration, $config);
+               $configurationUtility->writeConfiguration(
+                       $configurationUtility->convertValuedToNestedConfiguration($newConfiguration),
+                       $extensionKey
+               );
+               $this->emitAfterExtensionConfigurationWriteSignal($newConfiguration);
+       }
+
 }
index 8ba653f..708b20d 100644 (file)
@@ -60,9 +60,6 @@
                        <trans-unit id="extConfTemplate.backToList" xml:space="preserve">
                                <source>Back to list</source>
                        </trans-unit>
-                       <trans-unit id="extConfTemplate.submitButton" xml:space="preserve">
-                               <source>Submit</source>
-                       </trans-unit>
                        <trans-unit id="updateScript.headline" xml:space="preserve">
                                <source>Update script for %s</source>
                        </trans-unit>
index 35f2a62..b1aaaa7 100644 (file)
@@ -3,7 +3,8 @@
 
 <f:section name="docheader-buttons">
        <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:be.buttons.icon uri="javascript:document.configurationform.submit();" icon="actions-document-save" title="{f:translate(key:'extConfTemplate.submitButton')}"/>
+       <f:be.buttons.icon uri="javascript:document.configurationform.submit();" icon="actions-document-save" title="{f:translate(key:'LLL:EXT:lang/locallang_common.xlf:save')}" />
+       <f:be.buttons.icon uri="#" icon="actions-document-save-close" title="{f:translate(key:'LLL:EXT:lang/locallang_common.xlf:saveAndClose')}" />
 </f:section>
 
 <f:section name="module-headline">
index 6be285f..a0915be 100644 (file)
@@ -4,6 +4,9 @@
        $(document).ready(function() {
                configurationFieldSupport();
                $(".validate").validate();
+               $(".t3-icon-document-save-close").on("click", function() {
+                       $(".validate").append("<input type=\"hidden\" name=\"tx_extensionmanager_tools_extensionmanagerextensionmanager[action]\" value=\"saveAndClose\">").submit();
+               });
        });
 
        function configurationFieldSupport() {
index 3254ea2..ec11f9e 100644 (file)
@@ -8,7 +8,7 @@ if (TYPO3_MODE === 'BE') {
                'extensionmanager', '', array(
                        'List' => 'index,unresolvedDependencies,ter,showAllVersions,distributions',
                        'Action' => 'toggleExtensionInstallationState,installExtensionWithoutSystemDependencyCheck,removeExtension,downloadExtensionZip,downloadExtensionData',
-                       'Configuration' => 'showConfigurationForm,save',
+                       'Configuration' => 'showConfigurationForm,save,saveAndClose',
                        'Download' => 'checkDependencies,installFromTer,installExtensionWithoutSystemDependencyCheck,installDistribution,updateExtension,updateCommentForUpdatableVersions',
                        'UpdateScript' => 'show',
                        'UpdateFromTer' => 'updateExtensionListFromTer',