fixed bugs 1642 and 4886: when installing an extension with new BE modules, the modul...
authorIngo Renner <ingo.renner@typo3.org>
Wed, 9 May 2007 09:30:05 +0000 (09:30 +0000)
committerIngo Renner <ingo.renner@typo3.org>
Wed, 9 May 2007 09:30:05 +0000 (09:30 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@2330 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/alt_main.php
typo3/alt_menu.php
typo3/alt_menu_sel.php
typo3/alt_topmenu_dummy.php
typo3/class.alt_menu_functions.inc
typo3/mod/tools/em/class.em_index.php
typo3/sysext/setup/mod/index.php

index 9aaa811..3e7c29a 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2007-05-09  Ingo Renner  <typo3@ingo-renner.com>
+
+       * fixed bugs 1642 and 4886: when installing an extension with new BE modules, the modules do not appear
+
 2007-05-09  Andreas Otto  <andreas.otto@dkd.de>
 
        * Fixed bug #2052: Color picker does not work properly in flex forms. Thanks to David Bruehlmeier for providing a patch and a testcase.
index c777855..3ce3ba3 100755 (executable)
@@ -95,12 +95,12 @@ class SC_alt_main {
                $this->loadModules = t3lib_div::makeInstance('t3lib_loadModules');
                $this->loadModules->load($TBE_MODULES);
 
-                       // Instantiates thee menu object which will generate some JavaScript for the goToModule() JS function in this frameset.
+                       // Instantiates the menu object which will generate some JavaScript for the goToModule() JS function in this frameset.
                $this->alt_menuObj = t3lib_div::makeInstance('alt_menu_functions');
 
                        // Check for distances defined in the styles array:
                if ($TBE_STYLES['dims']['leftMenuFrameW'])              $this->leftMenuFrameW = $TBE_STYLES['dims']['leftMenuFrameW'];
-               if ($TBE_STYLES['dims']['topFrameH'])           $this->topFrameH = $TBE_STYLES['dims']['topFrameH'];
+               if ($TBE_STYLES['dims']['topFrameH'])                   $this->topFrameH = $TBE_STYLES['dims']['topFrameH'];
                if ($TBE_STYLES['dims']['shortcutFrameH'])              $this->shortcutFrameH = $TBE_STYLES['dims']['shortcutFrameH'];
                if ($TBE_STYLES['dims']['selMenuFrame'])                $this->selMenuFrame = $TBE_STYLES['dims']['selMenuFrame'];
        }
@@ -121,6 +121,11 @@ class SC_alt_main {
                $newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule'));
                $pageModule = t3lib_BEfunc::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';
 
+               $menuFrameName = 'menu';
+               if ($GLOBALS['BE_USER']->uc['noMenuMode'] == 'icons') {
+                       $menuFrameName = 'topmenuFrame';
+               }
+
                $this->mainJScode='
        /**
         * Function similar to PHPs  rawurlencode();
@@ -330,20 +335,19 @@ class SC_alt_main {
        }
 
        /**
-        * Function used to switch switch module.
+        * Wrapper for the actual goToModule function in the menu frame
         */
        var currentModuleLoaded = "";
-       function goToModule(modName,cMR_flag,addGetVars)        {       //
-               var additionalGetVariables = "";
-               if (addGetVars) additionalGetVariables = addGetVars;
-
-               var cMR = 0;
-               if (cMR_flag)   cMR = 1;
-
+       function goToModule(modName, cMR_flag, addGetVars)      {       //
                currentModuleLoaded = modName;
+               top.'.$menuFrameName.'.goToModule(modName, cMR_flag, addGetVars);
+       }
 
-               switch(modName) {'.$goToModule_switch.'
-               }
+       /**
+        * reloads the menu frame
+        */
+       function refreshMenu() {
+               top.'.$menuFrameName.'.location.href = top.'.$menuFrameName.'.document.URL
        }
 
        /**
@@ -450,7 +454,7 @@ class SC_alt_main {
                if ($module) {
                        $this->mainJScode.='
                // open in module:
-       window.setTimeout("top.goToModule(\''.$module.'\',false,\''.$params.'\');",500);
+       window.setTimeout("top.goToModule(\''.$module.'\',false,\''.$params.'\');",1000);
                        ';
                }
        }
index 5ac7510..4a387f2 100755 (executable)
@@ -81,6 +81,7 @@ class SC_alt_menu {
 
                // Internal, Static: GPvar
        var $_clearCacheFiles;
+       var $alt_menuObj;               // Menu functions object.
 
        /**
         * Initialize
@@ -89,7 +90,7 @@ class SC_alt_menu {
         * @return      void
         */
        function init() {
-               global $TBE_MODULES;
+               global $TBE_MODULES, $TBE_TEMPLATE;
 
                        // Setting GPvars:
                $this->_clearCacheFiles = t3lib_div::_GP('_clearCacheFiles');
@@ -98,6 +99,11 @@ class SC_alt_menu {
                $this->loadModules = t3lib_div::makeInstance('t3lib_loadModules');
                $this->loadModules->observeWorkspaces = TRUE;
                $this->loadModules->load($TBE_MODULES);
+
+                       // Instantiates the menu object which will generate some JavaScript for the goToModule() JS function in this frame.
+               $this->alt_menuObj = t3lib_div::makeInstance('alt_menu_functions');
+
+               $TBE_TEMPLATE->JScodeArray[] = $this->alt_menuObj->generateMenuJScode($this->loadModules->modules);
        }
 
        /**
@@ -111,11 +117,7 @@ class SC_alt_menu {
                $TBE_TEMPLATE->docType='xhtml_trans';
                $TBE_TEMPLATE->divClass='vertical-menu';
                $TBE_TEMPLATE->bodyTagAdditions = 'onload="top.restoreHighlightedModuleMenuItem()"';
-               $TBE_TEMPLATE->JScodeArray[] = '
-               function refreshMenu() { 
-                       window.location.href = document.URL;
-               }
-';
+
                $this->content.=$TBE_TEMPLATE->startPage('Vertical Backend Menu');
                $backPath = $GLOBALS['BACK_PATH'];
 
index 2e352e7..4d7de14 100755 (executable)
@@ -90,10 +90,13 @@ class SC_alt_menu_sel {
                $TBE_TEMPLATE->form = '<form action="">';
                $TBE_TEMPLATE->docType = 'xhtml_trans';
 
+                       // add menu JS
+               $alt_menuObj = t3lib_div::makeInstance('alt_menu_functions');
+               $TBE_TEMPLATE->JScodeArray[] = $alt_menuObj->generateMenuJScode($loadModules->modules);
+
                $this->content.=$TBE_TEMPLATE->startPage('Selector box menu');
 
                        // Make menu and add it:
-               $alt_menuObj = t3lib_div::makeInstance('alt_menu_functions');
                $this->content.=$alt_menuObj->topMenu($loadModules->modules,0,'',2);
 
                        // End page:
index f5e48b0..743e529 100755 (executable)
@@ -120,6 +120,8 @@ class SC_alt_topmenu_dummy {
                                // Start page
                        $TBE_TEMPLATE->docType = 'xhtml_trans';
                        $TBE_TEMPLATE->bodyTagId.= '-iconmenu';
+                       $TBE_TEMPLATE->JScodeArray[] = $alt_menuObj->generateMenuJScode($loadModules->modules);
+
                        $this->content.=$TBE_TEMPLATE->startPage('Top frame icon menu');
 
                        if ($iconMenuMode)      {
index e86f451..fb47e00 100755 (executable)
@@ -621,6 +621,37 @@ class alt_menu_functions {
                        return $link.'?';
                } else return $link;
        }
+       
+       /**
+        * Generates some JavaScript code for the frame.
+        *
+        * @return      string  goToModule javascript function
+        */
+       function generateMenuJScode($loadedModules, $menuType = 4)      {
+               global $TBE_TEMPLATE;
+               
+               $goToModuleSwitch = $this->topMenu($loadedModules, 0, '', $menuType);
+
+               $jsCode = '
+       /**
+        * Function used to switch switch module.
+        */
+       var currentModuleLoaded = "";
+       function goToModule(modName,cMR_flag,addGetVars)        {       //
+               var additionalGetVariables = "";
+               if (addGetVars) additionalGetVariables = addGetVars;
+
+               var cMR = 0;
+               if (cMR_flag)   cMR = 1;
+
+               currentModuleLoaded = modName;
+
+               switch(modName) {'.$goToModuleSwitch.'
+               }
+       }';
+               
+               return $jsCode;
+       }
 }
 
 
index b5c1df2..9107953 100644 (file)
@@ -318,7 +318,8 @@ class SC_mod_tools_em_index extends t3lib_SCbase {
        var $inst_keys = array();                       // Storage of installed extensions
        var $gzcompress = 0;                            // Is set true, if system support compression.
 
-       var $terConnection;                     // instance of TER connection handler
+       var $terConnection;                                     // instance of TER connection handler
+       var $JScode;                                            // JavaScript code to be forwared to $this->doc->JScode
 
                // GPvars:
        var $CMD = array();                                     // CMD array
@@ -395,6 +396,12 @@ class SC_mod_tools_em_index extends t3lib_SCbase {
                                window.location.href = URL;
                        }
                ');
+
+                       // Reload left frame menu
+               if ($this->CMD['refreshMenu']) {
+                       $this->doc->JScode .= $this->doc->wrapScriptTags('top.refreshMenu();');
+               }
+
                $this->doc->form = '<form action="index.php" method="post" name="pageform">';
 
                // Descriptions:
@@ -1936,6 +1943,11 @@ EXTENSION KEYS:
                                                        if($this->CMD['standAlone'] || t3lib_div::_GP('standAlone')) {
                                                                $this->content .= 'Extension has been '.($this->CMD['load'] ? 'installed' : 'removed').'.<br /><br /><a href="javascript:opener.top.content.document.forms[0].submit();window.close();">Close window and recheck dependencies</a>';
                                                        } else {
+                                                                       // Determine if new modules were installed:
+                                                               $techInfo = $this->makeDetailedExtensionAnalysis($extKey, $list[$extKey]);
+                                                               if (($this->CMD['load'] || $this->CMD['remove']) && is_array($techInfo['flags']) && in_array('Module', $techInfo['flags'], true)) {                                                                     
+                                                                       $vA['CMD']['refreshMenu'] = 1;
+                                                               }
                                                                header('Location: '.t3lib_div::linkThisScript($vA));
                                                        }
                                                }
index a34e1c4..9358bcf 100755 (executable)
@@ -256,7 +256,7 @@ class SC_mod_user_setup_index {
                
                if ($this->languageUpdate) {
                        $this->doc->JScode.= '<script language="javascript" type="text/javascript">
-       top.menu.refreshMenu();
+       top.refreshMenu();
        if(top.shortcutFrame) {
                top.shortcutFrame.refreshShortcuts();
        }