Julle, 20030308:
authorChristian Jul Jensen <christian.jensen@typo3.org>
Tue, 9 Mar 2004 08:44:12 +0000 (08:44 +0000)
committerChristian Jul Jensen <christian.jensen@typo3.org>
Tue, 9 Mar 2004 08:44:12 +0000 (08:44 +0000)
The following problems with handling of mount points in menus fixed:
- Unfolding of submenus at the wrong point
- No checking for mount points at menu entry level.

git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@134 709f56b5-9817-0410-a4d7-c38de5d9e867

typo3/sysext/cms/tslib/class.tslib_menu.php

index f116993..a33e2a4 100755 (executable)
@@ -198,6 +198,16 @@ class tslib_menu {
 
                                // ID
                        $this->id = $id ? $id : $this->tmpl->rootLine[$this->entryLevel]['uid'];                // If $id not stated with start() then the base-id will be found from rootLine[$this->entryLevel]
+
+
+                       //added by Julle: Check if page is a mount point, and set id and MP_array.
+                       $idPage = $GLOBALS['TSFE']->sys_page->getRawRecord('pages',$this->id);
+                       if (is_array($idPage) && $GLOBALS['TYPO3_CONF_VARS']['FE']['enable_mount_pids'] && $idPage['mount_pid']>0)      {
+                         $this->MP_array[] =$idPage['mount_pid'].'-'.$idPage['uid'];
+                         $this->id=$idPage['mount_pid'];
+                       };
+                       //end addition.
+
                        $this->menuNumber = $menuNumber;
                        $this->nextActive = $this->tmpl->rootLine[$this->entryLevel+$this->menuNumber]['uid'];  
 
@@ -864,6 +874,8 @@ class tslib_menu {
         */
        function subMenu($uid,$mount_point=0)   {
                        // starts a submenu...
+         // Added by Julle: keep original uid in order to unfold submenus at the right point
+               $orig_uid = $uid;
                if ($GLOBALS['TYPO3_CONF_VARS']['FE']['enable_mount_pids'] && $mount_point>0)   {
                        $MP=$mount_point.'-'.$uid;
                        $uid=$mount_point;
@@ -874,8 +886,8 @@ class tslib_menu {
                if (is_array($this->menuArr[$this->I['key']]['_SUB_MENU']) && count($this->menuArr[$this->I['key']]['_SUB_MENU']))      {
                        $altArray = $this->menuArr[$this->I['key']]['_SUB_MENU'];
                }
-
-               if ($this->subLevelClass && ($this->mconf['expAll'] || ($uid && $uid==$this->nextActive) || is_array($altArray)) && !$this->mconf['sectionIndex'])      {
+               //Modified by Julle: Make submenu if the original page, and not the mount point, is the next active.
+               if ($this->subLevelClass && ($this->mconf['expAll'] || ($uid && $orig_uid==$this->nextActive) || is_array($altArray)) && !$this->mconf['sectionIndex']) {
                        $submenu = t3lib_div::makeInstance('tslib_'.$this->subLevelClass);
                        $submenu->entryLevel = $this->entryLevel+1;
                        $submenu->MP_array = $this->MP_array;
@@ -2327,4 +2339,4 @@ if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['tslib/class
        include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['tslib/class.tslib_menu.php']);
 }
 
-?>
\ No newline at end of file
+?>