[BUGFIX] Enable extenisions with BE modules don't refresh the module list
authorOliver Hader <oliver@typo3.org>
Fri, 2 Nov 2012 12:43:49 +0000 (13:43 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 2 Nov 2012 19:01:08 +0000 (20:01 +0100)
When installing an extension with BE modules through the new
extension manager, the left frame with modules is not
refreshed. An accordant call to the module menu widget needs
to be triggered in those cases.

Change-Id: Ibead3b1a0da99be300c16ae3237986387294a74f
Releases: 6.0
Fixes: #42009
Reviewed-on: http://review.typo3.org/16129
Reviewed-by: Wouter Wolters
Tested-by: Wouter Wolters
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
typo3/sysext/extensionmanager/Classes/Controller/AbstractController.php
typo3/sysext/extensionmanager/Classes/Controller/ActionController.php
typo3/sysext/extensionmanager/Classes/Controller/ListController.php
typo3/sysext/extensionmanager/Classes/ViewHelpers/Be/ContainerViewHelper.php
typo3/sysext/extensionmanager/Resources/Private/Layouts/Main.html

index 561a252..2f7625b 100644 (file)
@@ -35,6 +35,15 @@ namespace TYPO3\CMS\Extensionmanager\Controller;
  */
 class AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController {
 
+       const TRIGGER_RefreshModuleMenu = 'refreshModuleMenu';
+
+       /**
+        * @var array
+        */
+       protected $triggerArguments = array(
+               self::TRIGGER_RefreshModuleMenu,
+       );
+
        /**
         * Resolve view and initialize the general view-variables extensionName,
         * controllerName and actionName based on the request object
@@ -61,7 +70,25 @@ class AbstractController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionControl
        protected function translate($key, $arguments = NULL) {
                return \TYPO3\CMS\Extbase\Utility\LocalizationUtility::translate($key, 'extensionmanager', $arguments);
        }
-}
 
+       /**
+        * Handles trigger arguments, e.g. refreshing the module menu
+        * widget if an extension with backend modules has been enabled
+        * or disabled.
+        *
+        * @return void
+        */
+       protected function handleTriggerArguments() {
+               $triggers = array();
+
+               foreach ($this->triggerArguments as $triggerArgument) {
+                       if ($this->request->hasArgument($triggerArgument)) {
+                               $triggers[$triggerArgument] = $this->request->getArgument($triggerArgument);
+                       }
+               }
+
+               $this->view->assign('triggers', $triggers);
+       }
+}
 
 ?>
\ No newline at end of file
index 9ea2699..ae859e2 100644 (file)
@@ -88,7 +88,7 @@ class ActionController extends \TYPO3\CMS\Extensionmanager\Controller\AbstractCo
                                $this->installUtility->enrichExtensionWithDetails($extension)
                        );
                }
-               $this->redirect('index', 'List');
+               $this->redirect('index', 'List', NULL, array(self::TRIGGER_RefreshModuleMenu => TRUE));
        }
 
        /**
index 0ef1a21..9e5bac2 100644 (file)
@@ -94,6 +94,7 @@ class ListController extends \TYPO3\CMS\Extensionmanager\Controller\AbstractCont
                $availableAndInstalledExtensions = $this->listUtility->getAvailableAndInstalledExtensions($availableExtensions);
                $availableAndInstalledExtensions = $this->listUtility->enrichExtensionsWithEmConfAndTerInformation($availableAndInstalledExtensions);
                $this->view->assign('extensions', $availableAndInstalledExtensions);
+               $this->handleTriggerArguments();
        }
 
        /**
index 52c4ed6..d4ed92c 100644 (file)
@@ -65,11 +65,12 @@ class ContainerViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Be\AbstractBacken
         * @param boolean $enableExtJsDebug if TRUE, debug version of ExtJS is loaded. Use this for development only
         * @param array $addCssFiles Custom CSS files to be loaded
         * @param array $addJsFiles Custom JavaScript files to be loaded
+        * @param array $triggers Defined triggers to be forwarded to client (e.g. refreshing backend widgets)
         * @return string
         * @see template
         * @see t3lib_PageRenderer
         */
-       public function render($pageTitle = '', $enableJumpToUrl = TRUE, $enableClickMenu = TRUE, $loadPrototype = TRUE, $loadScriptaculous = FALSE, $scriptaculousModule = '', $loadExtJs = FALSE, $loadExtJsTheme = TRUE, $extJsAdapter = '', $enableExtJsDebug = FALSE, $addCssFiles = array(), $addJsFiles = array()) {
+       public function render($pageTitle = '', $enableJumpToUrl = TRUE, $enableClickMenu = TRUE, $loadPrototype = TRUE, $loadScriptaculous = FALSE, $scriptaculousModule = '', $loadExtJs = FALSE, $loadExtJsTheme = TRUE, $extJsAdapter = '', $enableExtJsDebug = FALSE, $addCssFiles = array(), $addJsFiles = array(), array $triggers = array()) {
                $doc = $this->getDocInstance();
                $pageRenderer = $doc->getPageRenderer();
                if ($enableJumpToUrl) {
@@ -108,6 +109,13 @@ class ContainerViewHelper extends \TYPO3\CMS\Fluid\ViewHelpers\Be\AbstractBacken
                                $pageRenderer->addJsFile($addJsFile);
                        }
                }
+               // Handle triggers
+               if (!empty($triggers[\TYPO3\CMS\Extensionmanager\Controller\AbstractController::TRIGGER_RefreshModuleMenu])) {
+                       $pageRenderer->addJsInlineCode(
+                               \TYPO3\CMS\Extensionmanager\Controller\AbstractController::TRIGGER_RefreshModuleMenu,
+                               'if (top.TYPO3ModuleMenu.refreshMenu) { top.TYPO3ModuleMenu.refreshMenu(); }'
+                       );
+               }
                $output = $this->renderChildren();
                $output = $doc->startPage($pageTitle) . $output;
                $output .= $doc->endPage();
index 5eef959..708fbbb 100644 (file)
@@ -1,5 +1,6 @@
 {namespace em=TYPO3\CMS\Extensionmanager\ViewHelpers}
 <em:be.container pageTitle="Extension Manager" enableJumpToUrl="true" enableClickMenu="false" loadPrototype="false" loadScriptaculous="false" loadExtJs="false" loadExtJsTheme="true"
+       triggers="{triggers}"
        addCssFiles="{
                0:'{f:uri.resource(path:\'Css/main.css\')}',
                1:'{f:uri.resource(path:\'Contrib/LoadMask/jquery.loadmask.css\')}'