Fixed bug #14336: Merge modules "Cleanup and typo3temp/" of the Install Tool (thanks...
[Packages/TYPO3.CMS.git] / typo3 / class.alt_menu_functions.inc
old mode 100755 (executable)
new mode 100644 (file)
index 878f8b5..1667aa7
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 1999-2004 Kasper Skaarhoj (kasper@typo3.com)
+*  (c) 1999-2009 Kasper Skaarhoj (kasperYYYY@typo3.com)
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
 ***************************************************************/
 /**
  * Class for generation of the module menu.
 ***************************************************************/
 /**
  * Class for generation of the module menu.
- * Will make the the vertical, horizontal, selectorbox based menus AND the "about modules" display.
+ * Will make the vertical, horizontal, selectorbox based menus AND the "about modules" display.
  * Basically it traverses the module structure and generates output based on that.
  *
  * $Id$
  * Revised for TYPO3 3.6 2/2003 by Kasper Skaarhoj
  * XHTML compliant content
  *
  * Basically it traverses the module structure and generates output based on that.
  *
  * $Id$
  * Revised for TYPO3 3.6 2/2003 by Kasper Skaarhoj
  * XHTML compliant content
  *
- * @author     Kasper Skaarhoj <kasper@typo3.com>
+ * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
  */
 /**
  * [CLASS/FUNCTION INDEX of SCRIPT]
  *
  *
  *
  */
 /**
  * [CLASS/FUNCTION INDEX of SCRIPT]
  *
  *
  *
- *   72: class alt_menu_functions
- *   93:     function topMenu($theModules,$dontLink=0,$backPath='',$descr=0)
- *  386:     function mIconFile($Ifilename,$backPath)
- *  401:     function mIconFilename($Ifilename,$backPath)
- *  413:     function topButtons()
- *  425:     function adminButtons()
- *  444:     function adminFunctions($backPath)
- *  477:     function wrapLinkWithAB($link)
+ *   73: class alt_menu_functions
+ *   94:     function topMenu($theModules,$dontLink=0,$backPath='',$descr=0)
+ *  473:     function getNavFramePrefix($moduleInfo, $subModuleInfo=array())
+ *  504:     function mIconFile($Ifilename,$backPath)
+ *  519:     function mIconFilename($Ifilename,$backPath)
+ *  531:     function topButtons()
+ *  544:     function adminButtons()
+ *  563:     function adminFunctions($backPath)
+ *  596:     function wrapLinkWithAB($link)
  *
  *
- * TOTAL FUNCTIONS: 7
+ * TOTAL FUNCTIONS: 8
  * (This index is automatically created/updated by the extension "extdeveval")
  *
  */
  * (This index is automatically created/updated by the extension "extdeveval")
  *
  */
@@ -65,7 +66,7 @@
 /**
  * Class with menu functions
  *
 /**
  * Class with menu functions
  *
- * @author     Kasper Skaarhoj <kasper@typo3.com>
+ * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
  * @package TYPO3
  * @subpackage core
  */
  * @package TYPO3
  * @subpackage core
  */
@@ -86,17 +87,23 @@ class alt_menu_functions {
         *
         * @param       array           $theModules is the output from load_modules class ($this->loadModules->modules)
         * @param       boolean         $dontLink == true will prevent the output from being linked with A-tags (used in the 'beuser' extension)
         *
         * @param       array           $theModules is the output from load_modules class ($this->loadModules->modules)
         * @param       boolean         $dontLink == true will prevent the output from being linked with A-tags (used in the 'beuser' extension)
-        * @param       string          $backPath must be the 'backPath' to PATH_typo3 from where the the menu is displayed.
+        * @param       string          $backPath must be the 'backPath' to PATH_typo3 from where the menu is displayed.
         * @param       integer         $descr determines the type of menu made (see above)
         * @return      string          The menu HTML
         */
        function topMenu($theModules,$dontLink=0,$backPath='',$descr=0) {
                global $LANG, $TBE_TEMPLATE, $BE_USER;
 
         * @param       integer         $descr determines the type of menu made (see above)
         * @return      string          The menu HTML
         */
        function topMenu($theModules,$dontLink=0,$backPath='',$descr=0) {
                global $LANG, $TBE_TEMPLATE, $BE_USER;
 
+                       // By default module sections are collapsable, only if they are explicitly turned off via TSconfig, they are not:
+               $tmpArr = $BE_USER->getTSConfig('options.moduleMenuCollapsable');
+               $collapsable = (isset($tmpArr['value']) && $tmpArr['value']==0) ? 0 : 1;
+               unset($tmpArr);
+
                        // Initialize vars:
                $final='';
                $menuCode='';
                $descrCode='';
                        // Initialize vars:
                $final='';
                $menuCode='';
                $descrCode='';
+               $collection=array();
                $menuCode_sub='';
                $selectItems=array();
                $mIcons=array();
                $menuCode_sub='';
                $selectItems=array();
                $mIcons=array();
@@ -106,9 +113,32 @@ class alt_menu_functions {
                $selectItems[] = '<option value="">[ '.$LANG->sL('LLL:EXT:lang/locallang_core.php:buttons.selMenu_modules',1).' ]</option>';
                $mC=0;
 
                $selectItems[] = '<option value="">[ '.$LANG->sL('LLL:EXT:lang/locallang_core.php:buttons.selMenu_modules',1).' ]</option>';
                $mC=0;
 
-                       // Remove the 'doc' module?
-               if ($BE_USER->getTSConfigVal('options.disableDocModuleInAB'))   {
-                       unset($theModules['doc']);
+                       // Get collapsed configuration
+               if ($collapsable == 1) {
+                       $config = is_array ($BE_USER->uc['moduleData']['alt_menu.php']) ? $BE_USER->uc['moduleData']['alt_menu.php'] : array();
+                       $collapsedOverride = t3lib_div::_GP('collapsedOverride');
+                       if (is_array ($collapsedOverride)) {
+                               $config = array_merge ($config, $collapsedOverride);
+                       }
+
+                       if (t3lib_div::_GP('collapsableExpandAll') == 1) {
+                               $config['expandAll'] = t3lib_div::_GP('expandAll');
+                       }
+
+                       if ($config['expandAll'] && is_array($collapsedOverride)) {
+                               $config = $collapsedOverride;
+                       }
+
+                       $BE_USER->uc['moduleData']['alt_menu.php'] = $config;
+                       $BE_USER->writeUC($BE_USER->uc);
+
+                               // all items have to be expanded when expandAll is set
+                       if($config['expandAll'] == 1) {
+                               foreach($config as $key => $value) {
+                                       if($key != 'expandAll')
+                                               $config[$key] = 0;
+                               }
+                       }
                }
 
                        // Traverse array with modules
                }
 
                        // Traverse array with modules
@@ -116,16 +146,8 @@ class alt_menu_functions {
                while(list($moduleName,$moduleInfo)=each($theModules))  {
                        $mC++;
 
                while(list($moduleName,$moduleInfo)=each($theModules))  {
                        $mC++;
 
-                       $prefix='';
-                       if ($moduleInfo['navFrameScript'])      {
-                               if ($BE_USER->uc['condensedMode'])      {
-                                       $prefix=$moduleInfo['navFrameScript'].'?currentSubScript=';
-                               } else {
-                                       $prefix='alt_mod_frameset.php?'.
-                                               'fW="+top.TS.navFrameWidth+"'.
-                                               '&nav='.rawurlencode($moduleInfo['navFrameScript']).
-                                               '&script=';
-                               }
+                       $prefix = $this->getNavFramePrefix($moduleInfo);
+                       if ($prefix) {
                                $this->fsMod[]='fsMod.recentIds["'.$moduleName.'"]="";';
                        }
 
                                $this->fsMod[]='fsMod.recentIds["'.$moduleName.'"]="";';
                        }
 
@@ -133,28 +155,37 @@ class alt_menu_functions {
                        if (is_array($moduleInfo['sub']))       {
                                        // Finding the default module to display
                                if ($moduleInfo['defaultMod'])  {
                        if (is_array($moduleInfo['sub']))       {
                                        // Finding the default module to display
                                if ($moduleInfo['defaultMod'])  {
-                                       $link=$moduleInfo['sub'][$moduleInfo['defaultMod']]['script'];
+                                       $link = $moduleInfo['sub'][$moduleInfo['defaultMod']]['script'];
                                } else {
                                        reset($moduleInfo['sub']);
                                        $subTemp = current($moduleInfo['sub']);
                                } else {
                                        reset($moduleInfo['sub']);
                                        $subTemp = current($moduleInfo['sub']);
-                                       $link=$subTemp['script'];
+                                       $link = $subTemp['script'];
                                }
                                }
-                               $link_sub=1;    // Tells that the main modules links to a submodule
-                               $link='';       // Does not link to submodules...
+                               $link_sub = 1;  // Tells that the main modules links to a submodule
+                               $link = '';     // Does not link to submodules...
                        } else {
                        } else {
-                               $link=$moduleInfo['script'];
-                               $link_sub=0;
+                               $link = $moduleInfo['script'];
+                               $link_sub = 0;
                        }
 
                        }
 
+                       $link = t3lib_div::resolveBackPath($link);
+
                        $moduleKey = $moduleName.'_tab';
                        $moduleCSSId = 'ID_'.t3lib_div::md5int($moduleName);
 
                        $moduleKey = $moduleName.'_tab';
                        $moduleCSSId = 'ID_'.t3lib_div::md5int($moduleName);
 
+                       $collection[$moduleKey] = array(
+                               'moduleName' => $moduleName,
+                               'title' => $LANG->moduleLabels['tabs'][$moduleKey],
+                               'onclick' => 'top.goToModule(\''.$moduleName.'\');',
+                       );
+
                                // Creating image icon
                        $image = @getimagesize($this->mIconFile($LANG->moduleLabels['tabs_images'][$moduleKey],$backPath));
                        $imageCode='';
                        $descr3_title = $LANG->moduleLabels['tabs'][$moduleKey].' ';
                        if ($image)     {
                                $Ifilename = $this->mIconFilename($LANG->moduleLabels['tabs_images'][$moduleKey],$backPath);
                                // Creating image icon
                        $image = @getimagesize($this->mIconFile($LANG->moduleLabels['tabs_images'][$moduleKey],$backPath));
                        $imageCode='';
                        $descr3_title = $LANG->moduleLabels['tabs'][$moduleKey].' ';
                        if ($image)     {
                                $Ifilename = $this->mIconFilename($LANG->moduleLabels['tabs_images'][$moduleKey],$backPath);
+                               $collection[$moduleKey]['icon'] = array($Ifilename, $image[3]);
                                $imageCode = '<img src="'.$Ifilename.'" '.$image[3].' alt="" />';
                                $descr3_imageCode = '<img src="'.$Ifilename.'" '.$image[3].' title="'.htmlspecialchars($descr3_title).'" alt="" />';
                        } else {
                                $imageCode = '<img src="'.$Ifilename.'" '.$image[3].' alt="" />';
                                $descr3_imageCode = '<img src="'.$Ifilename.'" '.$image[3].' title="'.htmlspecialchars($descr3_title).'" alt="" />';
                        } else {
@@ -170,7 +201,7 @@ class alt_menu_functions {
                                $mIcons[] = '<a href="#" onclick="top.goToModule(\''.$moduleName.'\');'.$onBlur.'return false;" class="c-mainitem" id="'.$moduleCSSId.'">'.$descr3_imageCode.'</a>';
 
                                $JScmd = '
                                $mIcons[] = '<a href="#" onclick="top.goToModule(\''.$moduleName.'\');'.$onBlur.'return false;" class="c-mainitem" id="'.$moduleCSSId.'">'.$descr3_imageCode.'</a>';
 
                                $JScmd = '
-                                               top.content.location=top.getModuleUrl(top.TS.PATH_typo3+\''.$this->wrapLinkWithAB($link).'\');
+                                               top.content.location=top.getModuleUrl(top.TS.PATH_typo3+"'.$this->wrapLinkWithAB($link).'"+additionalGetVariables);
                                                top.highlightModuleMenuItem("'.$moduleCSSId.'",1);';
                                $mJScmds[] = "case '".$moduleName."': \n ".$JScmd." \n break;";
                        }
                                                top.highlightModuleMenuItem("'.$moduleCSSId.'",1);';
                                $mJScmds[] = "case '".$moduleName."': \n ".$JScmd." \n break;";
                        }
@@ -178,10 +209,19 @@ class alt_menu_functions {
                        $selectItems[] = '<option value="top.goToModule(\''.$moduleName.'\');">'.htmlspecialchars($LANG->moduleLabels['tabs'][$moduleKey]).'</option>';
                        $label='&nbsp;<b>'.$label.'</b>&nbsp;';
 
                        $selectItems[] = '<option value="top.goToModule(\''.$moduleName.'\');">'.htmlspecialchars($LANG->moduleLabels['tabs'][$moduleKey]).'</option>';
                        $label='&nbsp;<b>'.$label.'</b>&nbsp;';
 
+
+                               // make menu collapsable
+                       if($collapsable == 1 && is_array($moduleInfo['sub'])) {
+                               $collapseJS = 'onclick="window.location.href=\'alt_menu.php?collapsedOverride['.$moduleName.']='.($config[$moduleName] ? '0' : '1').'\'"';
+                               $collapseIcon = '<span class="c-iconCollapse"><img'.t3lib_iconWorks::skinImg($backPath,'gfx/ol/'.($config[$moduleName] ? 'plusbullet.gif':'minusbullet.gif'),'width="18" height="16"').' title="" alt="" /></span>';
+                       } else {
+                               $collapseJS = $collapseIcon = '';
+                       }
+
                                // Creating a main item for the vertical menu (descr=0)
                        $menuCode.='
                                                <tr class="c-mainitem" id="'.$moduleCSSId.'">
                                // Creating a main item for the vertical menu (descr=0)
                        $menuCode.='
                                                <tr class="c-mainitem" id="'.$moduleCSSId.'">
-                                                       <td colspan="3">'.$imageCode.'<span class="c-label">'.$label.'</span></td>
+                                                       <td colspan="3" '.$collapseJS.' >'.$imageCode.'<span class="c-label">'.$label.'</span>'.$collapseIcon.'</td>
                                                </tr>';
 
                                // Code for "About modules"
                                                </tr>';
 
                                // Code for "About modules"
@@ -191,12 +231,16 @@ class alt_menu_functions {
                                                </tr>';
 
 
                                                </tr>';
 
 
+                               // Hide submodules when collapsed:
+                       if($collapsable == 1 && $config[$moduleName] == 1 && $descr == 0 && $config['expandAll'] != 1) {
+                               unset($moduleInfo['sub']);
+                       }
 
 
-
-                               // Travesing submodules
+                               // Traversing submodules
                        $subCode='';
                        if (is_array($moduleInfo['sub']))       {
                                reset($moduleInfo['sub']);
                        $subCode='';
                        if (is_array($moduleInfo['sub']))       {
                                reset($moduleInfo['sub']);
+                               $collection[$moduleKey]['subitems'] = array();
                                $c=0;
                                while(list($subName,$subInfo)=each($moduleInfo['sub'])) {
                                        if ($c==0)              {
                                $c=0;
                                while(list($subName,$subInfo)=each($moduleInfo['sub'])) {
                                        if ($c==0)              {
@@ -210,16 +254,25 @@ class alt_menu_functions {
                                                                </tr>';
                                        }
 
                                                                </tr>';
                                        }
 
-                                       $link = $subInfo['script'];
+                                       $link = t3lib_div::resolveBackPath($subInfo['script']);
+                                       $prefix = $this->getNavFramePrefix($moduleInfo, $subInfo);
+
                                        $subKey = $moduleName.'_'.$subName.'_tab';
                                        $moduleCSSId = 'ID_'.t3lib_div::md5int($moduleName.'_'.$subName);
 
                                        $subKey = $moduleName.'_'.$subName.'_tab';
                                        $moduleCSSId = 'ID_'.t3lib_div::md5int($moduleName.'_'.$subName);
 
+                                       $collection[$moduleKey]['subitems'][$subKey] = array(
+                                               'moduleName' => $moduleName.'_'.$subName,
+                                               'title' => $LANG->moduleLabels['tabs'][$subKey],
+                                               'onclick' => 'top.goToModule(\''.$moduleName.'_'.$subName.'\');',
+                                       );
+
                                                // Creating image icon
                                        $image = @getimagesize($this->mIconFile($LANG->moduleLabels['tabs_images'][$subKey],$backPath));
                                        $imageCode='';
                                        $descr3_title = $LANG->moduleLabels['tabs'][$subKey].': '.$LANG->moduleLabels['labels'][$subKey.'label'];
                                        if ($image)     {
                                                $Ifilename = $this->mIconFilename($LANG->moduleLabels['tabs_images'][$subKey],$backPath);
                                                // Creating image icon
                                        $image = @getimagesize($this->mIconFile($LANG->moduleLabels['tabs_images'][$subKey],$backPath));
                                        $imageCode='';
                                        $descr3_title = $LANG->moduleLabels['tabs'][$subKey].': '.$LANG->moduleLabels['labels'][$subKey.'label'];
                                        if ($image)     {
                                                $Ifilename = $this->mIconFilename($LANG->moduleLabels['tabs_images'][$subKey],$backPath);
+                                               $collection[$moduleKey]['subitems'][$subKey]['icon'] = array($Ifilename, $image[3]);
                                                $imageCode = '<img src="'.$Ifilename.'" '.$image[3].' title="'.htmlspecialchars($LANG->moduleLabels['labels'][$subKey.'label']).'" alt="" />';
                                                $descr3_imageCode = '<img src="'.$Ifilename.'" '.$image[3].' title="'.htmlspecialchars($descr3_title).'" alt="" />';
                                        } else {
                                                $imageCode = '<img src="'.$Ifilename.'" '.$image[3].' title="'.htmlspecialchars($LANG->moduleLabels['labels'][$subKey.'label']).'" alt="" />';
                                                $descr3_imageCode = '<img src="'.$Ifilename.'" '.$image[3].' title="'.htmlspecialchars($descr3_title).'" alt="" />';
                                        } else {
@@ -235,7 +288,7 @@ class alt_menu_functions {
 
                                                // Setting additional JavaScript if frameset script:
                                        $addJS = '';
 
                                                // Setting additional JavaScript if frameset script:
                                        $addJS = '';
-                                       if ($moduleInfo['navFrameScript'])      {$addJS="+'&id='+top.rawurlencode(top.fsMod.recentIds['".$moduleName."'])";}
+                                       if ($moduleInfo['navFrameScript'])      {$addJS = "+'&id='+top.rawurlencodeAndRemoveSiteUrl(top.fsMod.recentIds['" . $moduleName . "'])";}
 
                                                // If there is a script to link to (and linking is not disabled.
                                        if ($link && !$dontLink)        {
 
                                                // If there is a script to link to (and linking is not disabled.
                                        if ($link && !$dontLink)        {
@@ -243,37 +296,42 @@ class alt_menu_functions {
                                                if ($addJS && $BE_USER->uc['condensedMode'])    {$addJS.=  "+(cMR?'&cMR=1':'')";}
 
                                                        // Command for the selector box:
                                                if ($addJS && $BE_USER->uc['condensedMode'])    {$addJS.=  "+(cMR?'&cMR=1':'')";}
 
                                                        // Command for the selector box:
-                                               $JScmd = "
-                                                               top.content.location=top.getModuleUrl(top.TS.PATH_typo3+'".$this->wrapLinkWithAB($link)."'".$addJS.');
+                                               $JScmd = '
+                                                               top.content.location=top.getModuleUrl(top.TS.PATH_typo3+"'.$this->wrapLinkWithAB($link).'"'.$addJS.'+additionalGetVariables);
                                                                top.fsMod.currentMainLoaded="'.$moduleName.'";
                                                                ';
 
                                                                top.fsMod.currentMainLoaded="'.$moduleName.'";
                                                                ';
 
+                                               if ($subInfo['navFrameScript']) {
+                                                       $JScmd.='
+                                                               top.currentSubScript="'.$origLink.'";';
+                                               }
+
                                                        // If there is a frameset script in place:
                                                if (!$BE_USER->uc['condensedMode'] && $moduleInfo['navFrameScript'])    {
 
                                                                // use special nav script from sub module, otherwise from the main module
                                                        // If there is a frameset script in place:
                                                if (!$BE_USER->uc['condensedMode'] && $moduleInfo['navFrameScript'])    {
 
                                                                // use special nav script from sub module, otherwise from the main module
-                                                       $subNavFrameScript = $subInfo['navFrameScript'] ? $subInfo['navFrameScript'] : $moduleInfo['navFrameScript'] ;
+                                                       $subNavFrameScript = $subInfo['navFrameScript'] ? $subInfo['navFrameScript'] : $moduleInfo['navFrameScript'];
+                                                       $subNavFrameScript = t3lib_div::resolveBackPath($subNavFrameScript);
 
 
-                                                               // should we add GET params for sub module to the nav script?
-                                                       if ($subInfo['navFrameScriptParam']) {
-                                                               $subNavFrameScript = $this->wrapLinkWithAB($subNavFrameScript).$subInfo['navFrameScriptParam'];
-                                                       }
+                                                               // add GET params for sub module to the nav script
+                                                       $subNavFrameScript = $this->wrapLinkWithAB($subNavFrameScript).$subInfo['navFrameScriptParam'];
 
                                                        $JScmd = '
                                                                if (top.content.list_frame && top.fsMod.currentMainLoaded=="'.$moduleName.'") {
                                                                        top.currentSubScript="'.$origLink.'";
 
                                                        $JScmd = '
                                                                if (top.content.list_frame && top.fsMod.currentMainLoaded=="'.$moduleName.'") {
                                                                        top.currentSubScript="'.$origLink.'";
-                                                                       top.content.list_frame.location=top.getModuleUrl(top.TS.PATH_typo3+"'.$this->wrapLinkWithAB($origLink).'"'.$addJS.');
+                                                                       top.content.list_frame.location=top.getModuleUrl(top.TS.PATH_typo3+"'.$this->wrapLinkWithAB($origLink).'"'.$addJS.'+additionalGetVariables);
                                                                        if(top.currentSubNavScript!="'.$subNavFrameScript.'") {
                                                                                top.currentSubNavScript="'.$subNavFrameScript.'";
                                                                        if(top.currentSubNavScript!="'.$subNavFrameScript.'") {
                                                                                top.currentSubNavScript="'.$subNavFrameScript.'";
-                                                                               top.content.nav_frame.location=top.getModuleUrl(top.TS.PATH_typo3+"'.$this->wrapLinkWithAB($subNavFrameScript).'");
+                                                                               top.content.nav_frame.location=top.getModuleUrl(top.TS.PATH_typo3+"'.$subNavFrameScript.'");
                                                                        }
                                                                } else {
                                                                        top.content.location=top.TS.PATH_typo3+(
                                                                                top.nextLoadModuleUrl?
                                                                                "'.($prefix?$this->wrapLinkWithAB($link).'&exScript=':'').'listframe_loader.php":
                                                                        }
                                                                } else {
                                                                        top.content.location=top.TS.PATH_typo3+(
                                                                                top.nextLoadModuleUrl?
                                                                                "'.($prefix?$this->wrapLinkWithAB($link).'&exScript=':'').'listframe_loader.php":
-                                                                               "'.$this->wrapLinkWithAB($link).'"'.$addJS.'
+                                                                               "'.$this->wrapLinkWithAB($link).'"'.$addJS.'+additionalGetVariables
                                                                        );
                                                                        top.fsMod.currentMainLoaded="'.$moduleName.'";
                                                                        );
                                                                        top.fsMod.currentMainLoaded="'.$moduleName.'";
+                                                                       top.currentSubScript="'.$origLink.'";
                                                                }
                                                                ';
                                                }
                                                                }
                                                                ';
                                                }
@@ -297,11 +355,24 @@ class alt_menu_functions {
                                                        </tr>';
 
                                                // For "About modules":
                                                        </tr>';
 
                                                // For "About modules":
+                                       $moduleLabel = htmlspecialchars($LANG->moduleLabels['labels'][$subKey.'label']);
+                                       $moduleLabelHtml = !empty($moduleLabel) ? '<strong>' . $moduleLabel . '</strong><br />' : '';
+                                       $moduleDescription = $LANG->moduleLabels['labels'][$subKey.'descr'];
+
                                        $descrCode.='
                                                        <tr class="c-subitem-row">
                                                                <td align="center">'.$imageCode.'</td>
                                        $descrCode.='
                                                        <tr class="c-subitem-row">
                                                                <td align="center">'.$imageCode.'</td>
-                                                               <td>'.$flabel.'&nbsp;&nbsp;</td>
-                                                               <td><strong>'.htmlspecialchars($LANG->moduleLabels['labels'][$subKey.'label']).'</strong><br />'.$LANG->moduleLabels['labels'][$subKey.'descr'].'</td>
+                                                               <td>'.$flabel.'&nbsp;&nbsp;</td>';
+
+                                       if (!empty($moduleLabel) || !empty($moduleDescription)) {
+                                               $descrCode .= '
+                                                               <td>' . $moduleLabelHtml . $moduleDescription . '</td>';
+                                       } else {
+                                               $descrCode .= '
+                                                               <td>&nbsp;</td>';
+                                       }
+
+                                       $descrCode .= '
                                                        </tr>';
 
                                                // Possibly adding a divider line
                                                        </tr>';
 
                                                // Possibly adding a divider line
@@ -336,6 +407,21 @@ class alt_menu_functions {
 
                        // $descr==0:   Ordinary vertical menu
                if ($menuCode)  {
 
                        // $descr==0:   Ordinary vertical menu
                if ($menuCode)  {
+                       if($collapsable == 1 || $config['expandAll'] == 1) {
+                               $collapseAllHTML = '<tr class="c-endrow">
+                                               <td></td>
+                                               <td align="center">
+                                                               <form action="alt_menu.php" method="get">
+                                                                       <input type="hidden" name="collapsableExpandAll" value="1" />
+                                                                       <input type="checkbox" name="expandAll" id="expandall" value="1" onclick="this.form.submit();" '.($config['expandAll']?'checked="checked"':'').' />
+                                                               </form>
+                                               </td>
+                                               <td class="c-subitem-label"><label for="expandall">'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.expandAll',1).'</label></td>
+                                       </tr>';
+                       } else {
+                               $collapseAllHTML = '';
+                       }
+
                        $final = '
 
 
                        $final = '
 
 
@@ -344,6 +430,9 @@ class alt_menu_functions {
                                -->
                                <table border="0" cellpadding="0" cellspacing="0" id="typo3-vmenu">
                                        '.$menuCode.'
                                -->
                                <table border="0" cellpadding="0" cellspacing="0" id="typo3-vmenu">
                                        '.$menuCode.'
+                                       <tr class="c-endrow">
+                                               <td colspan="3">'.t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'menu_modules', $GLOBALS['BACK_PATH']).'</td></tr>
+                                       '.$collapseAllHTML.'
                                </table>';
                }
 
                                </table>';
                }
 
@@ -370,7 +459,7 @@ class alt_menu_functions {
                                if (count($functionArray))      {
                                        $selectItems[] = '<option value=""></option>';
                                        foreach($functionArray as $fAoptions)   {
                                if (count($functionArray))      {
                                        $selectItems[] = '<option value=""></option>';
                                        foreach($functionArray as $fAoptions)   {
-                                               $selectItems[] = '<option value="'.htmlspecialchars("document.location='".$fAoptions['href']."';").'">[ '.htmlspecialchars($fAoptions['title']).' ]</option>';
+                                               $selectItems[] = '<option value="'.htmlspecialchars("window.location.href='".$fAoptions['href']."';").'">[ '.htmlspecialchars($fAoptions['title']).' ]</option>';
                                        }
                                }
                        }
                                        }
                                }
                        }
@@ -394,11 +483,45 @@ class alt_menu_functions {
                        $final = chr(10).implode(chr(10),$mJScmds).chr(10);
                }
 
                        $final = chr(10).implode(chr(10),$mJScmds).chr(10);
                }
 
+                       // Output for TOPMENU BAR drop downs (but basically this is an array with which you can do many interesting things...)
+               if ($descr==5)  {
+                       $final = $collection;
+               }
+
                        // Return result:
                return $final;
        }
 
        /**
                        // Return result:
                return $final;
        }
 
        /**
+        * Returns a prefix used to call the navframe with parameters to call the scripts defined in the modules info array.
+        *
+        * @param       string          Module info array
+        * @param       string          Submodule info array
+        * @return      string          Result url string
+        */
+       function getNavFramePrefix($moduleInfo, $subModuleInfo=array()) {
+               global $BE_USER;
+
+               $prefix = '';
+               $navFrameScript = $subModuleInfo['navFrameScript'] ? $subModuleInfo['navFrameScript'] : $moduleInfo['navFrameScript'];
+               $navFrameScriptParam = isset($subModuleInfo['navFrameScriptParam']) ? $subModuleInfo['navFrameScriptParam'] : $moduleInfo['navFrameScriptParam'];
+               if ($navFrameScript)    {
+                       $navFrameScript = t3lib_div::resolveBackPath($navFrameScript);
+                       $navFrameScript = $this->wrapLinkWithAB($navFrameScript);
+
+                       if ($BE_USER->uc['condensedMode'])      {
+                               $prefix=$navFrameScript.$navFrameScriptParam.'&currentSubScript=';
+                       } else {
+                               $prefix='alt_mod_frameset.php?'.
+                                       'fW="+top.TS.navFrameWidth+"'.
+                                       '&nav="+top.TS.PATH_typo3+"'.rawurlencode($navFrameScript.$navFrameScriptParam).
+                                       '&script=';
+                       }
+               }
+               return $prefix;
+       }
+
+       /**
         * Returns $Ifilename readable for script in PATH_typo3.
         * That means absolute names are just returned while relative names are prepended with $backPath (pointing back to typo3/ dir)
         *
         * Returns $Ifilename readable for script in PATH_typo3.
         * That means absolute names are just returned while relative names are prepended with $backPath (pointing back to typo3/ dir)
         *
@@ -437,7 +560,8 @@ class alt_menu_functions {
        function topButtons()   {
                global $LANG;
 
        function topButtons()   {
                global $LANG;
 
-               $out.= '<form action="logout.php" target="_top"><input type="submit" value="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:buttons.logout',1).'" /></form>';
+               $label = $GLOBALS['BE_USER']->user['ses_backuserid'] ? 'LLL:EXT:lang/locallang_core.php:buttons.exit' : 'LLL:EXT:lang/locallang_core.php:buttons.logout';
+               $out.= '<form action="logout.php" target="_top"><input type="submit" value="'.$LANG->sL($label,1).'" /></form>';
                return $out;
        }
 
                return $out;
        }
 
@@ -474,6 +598,7 @@ class alt_menu_functions {
                if ($TYPO3_CONF_VARS['EXT']['extCache'])        {
                        $title = $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.clearCache_allTypo3Conf');
                        $functions[]=array(
                if ($TYPO3_CONF_VARS['EXT']['extCache'])        {
                        $title = $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.clearCache_allTypo3Conf');
                        $functions[]=array(
+                               'id' => 'temp_CACHED',
                                'title' => $title,
                                'href' => $backPath.'tce_db.php?vC='.$BE_USER->veriCode().'&redirect='.rawurlencode(t3lib_div::getIndpEnv('TYPO3_REQUEST_SCRIPT')).'&cacheCmd=temp_CACHED',
                                'icon' => '<img'.t3lib_iconWorks::skinImg($backPath,'gfx/clear_cache_files_in_typo3c.gif','width="21" height="18"').' title="'.htmlspecialchars($title).'" alt="" />'
                                'title' => $title,
                                'href' => $backPath.'tce_db.php?vC='.$BE_USER->veriCode().'&redirect='.rawurlencode(t3lib_div::getIndpEnv('TYPO3_REQUEST_SCRIPT')).'&cacheCmd=temp_CACHED',
                                'icon' => '<img'.t3lib_iconWorks::skinImg($backPath,'gfx/clear_cache_files_in_typo3c.gif','width="21" height="18"').' title="'.htmlspecialchars($title).'" alt="" />'
@@ -483,6 +608,7 @@ class alt_menu_functions {
                        // Clear all page cache
                $title = $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.clearCache_all');
                $functions[]=array(
                        // Clear all page cache
                $title = $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.clearCache_all');
                $functions[]=array(
+                       'id' => 'all',
                        'title' => $title,
                        'href' => $backPath.'tce_db.php?vC='.$BE_USER->veriCode().'&redirect='.rawurlencode(t3lib_div::getIndpEnv('TYPO3_REQUEST_SCRIPT')).'&cacheCmd=all',
                        'icon' => '<img'.t3lib_iconWorks::skinImg($backPath,'gfx/clear_all_cache.gif','width="21" height="18"').' title="'.htmlspecialchars($title).'" alt="" />'
                        'title' => $title,
                        'href' => $backPath.'tce_db.php?vC='.$BE_USER->veriCode().'&redirect='.rawurlencode(t3lib_div::getIndpEnv('TYPO3_REQUEST_SCRIPT')).'&cacheCmd=all',
                        'icon' => '<img'.t3lib_iconWorks::skinImg($backPath,'gfx/clear_all_cache.gif','width="21" height="18"').' title="'.htmlspecialchars($title).'" alt="" />'
@@ -503,10 +629,41 @@ class alt_menu_functions {
                        return $link.'?';
                } else return $link;
        }
                        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;
+       }
 }
 
 
 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.alt_menu_functions.inc'])     {
        include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.alt_menu_functions.inc']);
 }
 }
 
 
 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.alt_menu_functions.inc'])     {
        include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.alt_menu_functions.inc']);
 }
-?>
\ No newline at end of file
+?>