TYPO3 API  SVNRelease
tmenu_layers.php
Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com)
00006 *  All rights reserved
00007 *
00008 *  This script is part of the TYPO3 project. The TYPO3 project is
00009 *  free software; you can redistribute it and/or modify
00010 *  it under the terms of the GNU General Public License as published by
00011 *  the Free Software Foundation; either version 2 of the License, or
00012 *  (at your option) any later version.
00013 *
00014 *  The GNU General Public License can be found at
00015 *  http://www.gnu.org/copyleft/gpl.html.
00016 *  A copy is found in the textfile GPL.txt and important notices to the license
00017 *  from the author is found in LICENSE.txt distributed with these scripts.
00018 *
00019 *
00020 *  This script is distributed in the hope that it will be useful,
00021 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00022 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00023 *  GNU General Public License for more details.
00024 *
00025 *  This copyright notice MUST APPEAR in all copies of the script!
00026 ***************************************************************/
00027 /**
00028  * Contains the TMENU_LAYERS extension class, tslib_tmenu_layers
00029  *
00030  * $Id: tmenu_layers.php 10317 2011-01-26 00:56:49Z baschny $
00031  * Revised for TYPO3 3.6 June/2003 by Kasper Skårhøj
00032  * XHTML compliant
00033  *
00034  * @author  Kasper Skårhøj <kasperYYYY@typo3.com>
00035  */
00036 /**
00037  * [CLASS/FUNCTION INDEX of SCRIPT]
00038  *
00039  *
00040  *
00041  *   84: class tslib_tmenu_layers extends tslib_tmenu
00042  *  116:     function extProc_init()
00043  *  134:     function extProc_RO($key)
00044  *  150:     function extProc_beforeLinking($key)
00045  *  205:     function extProc_afterLinking($key)
00046  *  240:     function extProc_beforeAllWrap($item,$key)
00047  *  253:     function isSetIntval($in)
00048  *  262:     function extProc_finish ()
00049  *  444:     function extCalcBorderWithin($kind,$integer)
00050  *
00051  * TOTAL FUNCTIONS: 8
00052  * (This index is automatically created/updated by the extension "extdeveval")
00053  *
00054  */
00055 
00056 
00057 
00058 
00059 
00060 
00061 
00062 
00063 
00064 
00065 
00066 
00067 
00068 
00069 
00070 
00071 
00072 
00073 
00074 /**
00075  * Class extending tslib_tmenu for the creation of text based DHTML menus
00076  * NOTICE: The contents of this class is copied EXACTLY AS IS from gmenu_layers class! See notes in class (for BEGIN/END) and also 'diff.xmenu_layers.txt'
00077  *
00078  * @author  Kasper Skårhøj <kasperYYYY@typo3.com>
00079  * @package TYPO3
00080  * @subpackage tslib
00081  * @see diff.xmenu_layers.txt
00082  */
00083 class tslib_tmenu_layers extends tslib_tmenu {
00084 
00085 // FULL DUPLICATE FROM gmenu_layers BEGIN:
00086 
00087     var $GMENU_fixKey='layers';
00088     var $divLayers=Array();
00089 
00090     var $WMx=0;
00091     var $WMy=0;
00092     var $WMxyArray=array();
00093     var $WMextraScript='';
00094     var $WMlastKey='';
00095     var $WMrestoreScript='';
00096     var $WMresetSubMenus='';
00097     var $WMactiveHasSubMenu='';
00098     var $WMactiveKey='';
00099     var $WMtheSubMenu;
00100     var $WMisSub;
00101     var $WMhideCode;
00102     var $WMonlyOnLoad=0;
00103     var $WMbordersWithin=array();
00104     var $WMsubIds=array();
00105     var $WMtempStore=array();
00106     var $WMlockPosition_addAccumulated=array();
00107     var $VMmouseoverActions=array();
00108     var $VMmouseoutActions=array();
00109 
00110     /**
00111      * Creating unique menu id string plus other initialization of internal variables (all prefixed "WM")
00112      *
00113      * @return  void
00114      */
00115     function extProc_init() {
00116         $this->WMid = trim($this->mconf['layer_menu_id']) ? trim($this->mconf['layer_menu_id']) . 'x' : substr(md5('gl' . serialize($this->mconf)), 0, 6);
00117 
00118         $GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMid'][]=$this->WMid;
00119         $this->WMtempStore = $GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMid'];
00120         $GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMid']=array();
00121 
00122             // Save:
00123         $this->WMonlyOnLoad = ($this->mconf['displayActiveOnLoad'] && !$this->mconf['displayActiveOnLoad.']['onlyOnLoad']);
00124         $this->WMbordersWithin = t3lib_div::intExplode(',',$this->mconf['bordersWithin'].',0,0,0,0,0');
00125     }
00126 
00127     /**
00128      * Processing of mouse-over features depending on whether "freezeMouseover" property is set.
00129      *
00130      * @param   integer     Pointer to $this->menuArr[$key] where the current menu element record is found OR $this->result['RO'][$key] where the configuration for that elements RO version is found! Here it is used with the ->WMid to make unique names
00131      * @return  void
00132      */
00133     function extProc_RO($key)   {
00134         if ($this->mconf['freezeMouseover'])    {
00135             $this->VMmouseoverActions[$this->WMid.$key]='case "Menu'.$this->WMid.$key.'":'.$this->I['linkHREF']['onMouseover'].'; break;';
00136             $this->VMmouseoutActions[$this->WMid.$key]='case "Menu'.$this->WMid.$key.'":'.$this->I['linkHREF']['onMouseout'].'; break;';
00137             $this->I['linkHREF']['onMouseover']='GL'.$this->WMid.'_over(\'Menu'.$this->WMid.$key.'\');';
00138             $this->I['linkHREF']['onMouseout']='';
00139         }
00140     }
00141 
00142     /**
00143      * Processing before the links are created.
00144      * This means primarily creating some javaScript code for the management.
00145      *
00146      * @param   integer     Pointer to $this->menuArr[$key] where the current menu element record is found
00147      * @return  void
00148      */
00149     function extProc_beforeLinking($key)    {
00150         if ($this->I['uid'])    {
00151 
00152             array_push($GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMparentId'],$this->WMid);
00153             $this->WMtheSubMenu = $this->subMenu($this->I['uid'], $this->WMsubmenuObjSuffixes[$key]['sOSuffix']);
00154             array_pop($GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMparentId']);
00155             $this->WMisSub = trim($this->WMtheSubMenu) ? 1 : 0;
00156 
00157             if ($this->mconf['lockPosition_addSelf'])       {
00158                 $this->WMy+=(strcmp($this->mconf['setFixedHeight'],'')?$this->mconf['setFixedHeight']:$this->I['val']['output_h'])+intval($this->mconf['lockPosition_adjust']);
00159                 $this->WMx+=(strcmp($this->mconf['setFixedWidth'],'')?$this->mconf['setFixedWidth']:$this->I['val']['output_w'])+intval($this->mconf['lockPosition_adjust']);
00160             }
00161 
00162             if ($this->isActive($this->I['uid'], $this->getMPvar($key)) && $this->mconf['displayActiveOnLoad']) {   // orig: && $this->WMisSub, changed 210901
00163                 $this->WMactiveHasSubMenu = $this->WMisSub;
00164                 $this->WMactiveKey = 'Menu'.$this->WMid.$key;
00165 
00166 
00167                 $this->WMrestoreVars=trim('
00168 GLV_restoreMenu["'.$this->WMid.'"] = "'.$this->WMactiveKey.'";
00169                 ');
00170                 $this->WMrestoreScript='    GL_doTop("'.$this->WMid.'",GLV_restoreMenu["'.$this->WMid.'"]);'.($this->mconf['freezeMouseover']?'
00171     GL'.$this->WMid.'_over(GLV_restoreMenu["'.$this->WMid.'"]);
00172 ':'');
00173             }
00174 
00175             if ($this->WMisSub) {
00176                 $event="GL_stopMove('".$this->WMid."');";
00177                 $this->I['linkHREF']['onMouseover']='GL_doTop(\''.$this->WMid.'\', \'Menu'.$this->WMid.$key.'\');'.$this->I['linkHREF']['onMouseover'];
00178                     // IESelectFix - Activates IFRAME layer below menu
00179                 if ($this->mconf['ieSelectFix']) $this->I['linkHREF']['onMouseover']=$this->I['linkHREF']['onMouseover'].'GL_iframer(\''.$this->WMid.'\',\'Menu'.$this->WMid.$key.'\',true);';
00180                     // Added 120802; This means that everytime leaving a menuitem the layer should be shut down (and if the layer is hit in the meantime it is not though).
00181                     // This should happen only for items that are auto-hidden when not over and possibly only when a hide-timer is set. Problem is if the hide-timer is not set and we leave the main element, then the layer will be hidden unless we reach the layer before the timeout will happen and the menu hidden.
00182                 if (t3lib_div::intInRange($this->mconf['hideMenuWhenNotOver'],0,600) && $this->mconf['hideMenuTimer'])  {
00183                     $event.='GL_resetAll("'.$this->WMid.'");';
00184                 }
00185                 $this->I['linkHREF']['onMouseout'].=$event;
00186             } else {
00187                 $this->I['linkHREF']['onMouseover'] = 'GL_hideAll("'.$this->WMid.'");'.$this->I['linkHREF']['onMouseover'];
00188                     // IESelectFix - Hides IFRAME layer below menu
00189                 if ($this->mconf['ieSelectFix']) $this->I['linkHREF']['onMouseover'] = $this->I['linkHREF']['onMouseover'].'GL_iframer(\''.$this->WMid.'\',\'\',false);';
00190                 $event='GL_resetAll("'.$this->WMid.'");';
00191                 $this->I['linkHREF']['onMouseout'].=$event;
00192             }
00193 
00194             $this->WMxyArray[] = 'GLV_menuXY["'.$this->WMid.'"]["Menu'.$this->WMid.$key.'"] = new Array('.$this->WMx.','.$this->WMy.',"itemID'.t3lib_div::shortmd5($this->I['uid'].'-'.$this->WMid).'","anchorID'.t3lib_div::shortmd5($this->I['uid'].'-'.$this->WMid).'");';
00195         }
00196     }
00197 
00198     /**
00199      * Processing after linking, basically setting the <div>-layers for the menu items. Also some more JavaScript code is made.
00200      *
00201      * @param   integer     Pointer to $this->menuArr[$key] where the current menu element record is found
00202      * @return  void
00203      */
00204     function extProc_afterLinking($key) {
00205         if ($this->I['uid'])    {
00206             if (!$this->I['spacer'] && $this->WMisSub)  {
00207                 $exStyle=$this->mconf['layerStyle'] ? $this->mconf['layerStyle'] : 'position:absolute;visibility:hidden';
00208                 if (trim($exStyle)) {
00209                     $exStyle=' '.$exStyle;
00210                 }
00211                 $GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['layerCounter']++;
00212                 $zIndex = 10000-$GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['layerCounter'];
00213 #               $zIndex = (($key+2)*$this->menuNumber*100);
00214                 $divStart = '<div id="Menu'.$this->WMid.$key.'" style="z-index:'.$zIndex.';'.$exStyle.'">';
00215                 $divStop = '</div>';
00216 
00217                 $this->divLayers[]= $divStart.$this->WMtheSubMenu.$divStop;
00218 
00219                 $this->WMhideCode.='
00220     GL_getObjCss("Menu'.$this->WMid.$key.'").visibility = "hidden";';
00221                 $this->WMlastKey = 'Menu'.$this->WMid.$key;
00222             }
00223 
00224             if (!$this->mconf['lockPosition_addSelf'])      {
00225                 $this->WMy+=(strcmp($this->mconf['setFixedHeight'],'')?$this->mconf['setFixedHeight']:$this->I['val']['output_h'])+intval($this->mconf['lockPosition_adjust']);
00226                 $this->WMx+=(strcmp($this->mconf['setFixedWidth'],'')?$this->mconf['setFixedWidth']:$this->I['val']['output_w'])+intval($this->mconf['lockPosition_adjust']);
00227             }
00228         }
00229         $this->WMresult.=$this->I['theItem'];
00230     }
00231 
00232     /**
00233      * Wrapping the item in a <div> section if 'relativeToTriggerItem' was set
00234      *
00235      * @param   string      The current content of the menu item, $this->I['theItem'], passed along.
00236      * @param   integer     Pointer to $this->menuArr[$key] where the current menu element record is found
00237      * @return  string      The modified version of $item, going back into $this->I['theItem']
00238      */
00239     function extProc_beforeAllWrap($item,$key)  {
00240         if ($this->mconf['relativeToTriggerItem'])  {
00241             $item = '<div id="anchorID'.t3lib_div::shortmd5($this->I['uid'].'-'.$this->WMid).'" style="position:absolute;visibility:hidden;"></div><div id="itemID'.t3lib_div::shortmd5($this->I['uid'].'-'.$this->WMid).'" style="width:100%; height:100%;">'.$item.'</div>';
00242         }
00243         return $item;
00244     }
00245 
00246     /**
00247      * Returns true if different from ''  OR if intval()!=0
00248      *
00249      * @param   string      Value to evaluate
00250      * @return  boolean     true if $in is different from ''  OR if intval()!=0
00251      */
00252     function isSetIntval($in)   {
00253         return $this->mconf['blankStrEqFalse'] ? strcmp($in,'') : intval($in);
00254     }
00255 
00256     /**
00257      * Putting things together, in particular the JavaScript code needed for the DHTML menu.
00258      *
00259      * @return  mixed       Returns the value of a call to the parent function, parent::extProc_finish();
00260      */
00261     function extProc_finish ()  {
00262         $dirL = $this->mconf['directionLeft'] ? '-GL_getObj(id).width' : '';
00263         $dirU = $this->mconf['directionUp'] ? '-GL_getObj(id).height' : '';
00264 
00265         $parentLayerId = end($GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMparentId']);
00266 
00267         $DoTop=array();
00268         $GLV_menuOn=array();
00269         $relCode=array();
00270         $relFlag=0;
00271         if ($this->mconf['relativeToParentLayer'] && $parentLayerId)    {
00272             $relCode['X'].='GLV_curLayerX["'.$parentLayerId.'"]+';
00273             $relCode['Y'].='GLV_curLayerY["'.$parentLayerId.'"]+';
00274             if ($this->mconf['relativeToParentLayer.']['addWidth'])     {   $relCode['X'].='GLV_curLayerWidth["'.$parentLayerId.'"]+';  }
00275             if ($this->mconf['relativeToParentLayer.']['addHeight'])    {   $relCode['Y'].='GLV_curLayerHeight["'.$parentLayerId.'"]+'; }
00276         }
00277         if ($this->mconf['relativeToTriggerItem'])  {
00278             $DoTop[]='
00279         var parentObject = GL_getObj(GLV_menuXY[WMid][id][2]);
00280         var TI_width = parentObject.width;
00281         var TI_height = parentObject.height;
00282         var anchorObj = GL_getObj(GLV_menuXY[WMid][id][3]);
00283         var TI_x = anchorObj.x;
00284         var TI_y = anchorObj.y;
00285             ';
00286             $relCode['X'].='TI_x+';
00287             $relCode['Y'].='TI_y+';
00288 
00289             if ($this->mconf['relativeToTriggerItem.']['addWidth']) {   $relCode['X'].='TI_width+'; }
00290             if ($this->mconf['relativeToTriggerItem.']['addHeight'])    {   $relCode['Y'].='TI_height+';    }
00291             $relFlag=1;
00292         }
00293         if ($relFlag)   {
00294             $DoTop[]='GLV_menuOn["'.$this->WMid.'"].left = ('.$relCode['X'].intval($this->mconf['leftOffset']).$dirL.')+"px";';
00295             $DoTop[]='GLV_menuOn["'.$this->WMid.'"].top =  ('.$relCode['Y'].intval($this->mconf['topOffset']).$dirU.')+"px";';
00296         } else {
00297                 // X position (y is fixed)
00298             if (!strcmp($this->mconf['lockPosition'],'x'))  {
00299                 $DoTop[]='GLV_menuOn["'.$this->WMid.'"].left = ('.$relCode['X'].'GLV_menuXY["'.$this->WMid.'"][id][0]-('.intval($this->mconf['xPosOffset']).')'.$dirL.')+"px";';
00300                 if ($this->isSetIntval($this->mconf['topOffset']))  {
00301                     $DoTop[]='GLV_menuOn["'.$this->WMid.'"].top = ('.$relCode['Y'].intval($this->mconf['topOffset']).$dirU.')+"px";';
00302                 }
00303             } elseif ($this->isSetIntval($this->mconf['xPosOffset'])) {
00304                 $GLV_menuOn[]=$DoTop[]='GLV_menuOn["'.$this->WMid.'"].left = (GLV_x-('.intval($this->mconf['xPosOffset']).')'.$dirL.')+"px";';
00305                 if ($this->isSetIntval($this->mconf['topOffset']))  {
00306                     $DoTop[]='GLV_menuOn["'.$this->WMid.'"].top = ('.$relCode['Y'].intval($this->mconf['topOffset']).$dirU.')+"px";';
00307                 }
00308             }
00309                 // Y position   (x is fixed)
00310             if (!strcmp($this->mconf['lockPosition'],'y'))  {
00311                 $DoTop[]='GLV_menuOn["'.$this->WMid.'"].top = ('.$relCode['Y'].'GLV_menuXY["'.$this->WMid.'"][id][1]-('.intval($this->mconf['yPosOffset']).')'.$dirU.')+"px";';
00312                 if ($this->isSetIntval($this->mconf['leftOffset'])) {
00313                     $DoTop[]='GLV_menuOn["'.$this->WMid.'"].left = ('.$relCode['X'].intval($this->mconf['leftOffset']).$dirL.')+"px";';
00314                 }
00315             } elseif ($this->isSetIntval($this->mconf['yPosOffset']))   {
00316                 $GLV_menuOn[]=$DoTop[]='GLV_menuOn["'.$this->WMid.'"].top = (GLV_y-('.intval($this->mconf['yPosOffset']).')'.$dirU.')+"px";';
00317                 if ($this->isSetIntval($this->mconf['leftOffset'])) {
00318                     $DoTop[]='GLV_menuOn["'.$this->WMid.'"].left = ('.$relCode['X'].intval($this->mconf['leftOffset']).$dirL.')+"px";';
00319                 }
00320             }
00321         }
00322 
00323             // BordersWithIn:
00324         $DoTop[]=$this->extCalcBorderWithin('left',$this->WMbordersWithin[0]);
00325         $DoTop[]=$this->extCalcBorderWithin('top',$this->WMbordersWithin[1]);
00326         $DoTop[]=$this->extCalcBorderWithin('right',$this->WMbordersWithin[2]);
00327         $DoTop[]=$this->extCalcBorderWithin('bottom',$this->WMbordersWithin[3]);
00328         $DoTop[]=$this->extCalcBorderWithin('left',$this->WMbordersWithin[4]);
00329         $DoTop[]=$this->extCalcBorderWithin('top',$this->WMbordersWithin[5]);
00330 
00331 
00332         if ($this->mconf['freezeMouseover'] && !$this->mconf['freezeMouseover.']['alwaysKeep']) {
00333             $this->WMhideCode.='
00334 GL'.$this->WMid.'_out("");';
00335         }
00336 
00337         $TEST='';
00338         if (count($GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMid']))   {
00339             foreach ($GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMid'] as $mIdStr) {
00340                 $this->WMhideCode.='
00341 GL_hideAll("'.$mIdStr.'");';
00342                 $this->WMrestoreScript.='
00343 GL_restoreMenu("'.$mIdStr.'");';
00344                 $this->WMresetSubMenus.='
00345 if (!GLV_doReset["'.$mIdStr.'"] && GLV_currentLayer["'.$mIdStr.'"]!=null)   resetSubMenu=0;';
00346             }
00347         }
00348             // IESelectFix - Adds IFRAME tag to HTML, Hides IFRAME layer below menu
00349         if ($this->mconf['ieSelectFix']) {
00350             $this->WMhideCode.= '
00351     GL_iframer(\''.$this->WMid.'\',\'\',false);';
00352             $this->divLayers['iframe'] = '<iframe id="Iframe'.$this->WMid.'" scrolling="no" frameborder="0" style="position:absolute; top:0px; left:0px; background-color:transparent; layer-background-color:transparent; display:none;"></iframe>';
00353         }
00354         $GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMid']=array_merge($this->WMtempStore,$GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMid']);
00355         $GLOBALS['TSFE']->additionalHeaderData['gmenu_layer_shared']='<script type="text/javascript" src="'.t3lib_extMgm::siteRelPath('cms').'tslib/media/scripts/jsfunc.layermenu.js"></script>';
00356         $GLOBALS['TSFE']->JSCode.= '
00357 
00358 GLV_curLayerWidth["'.$this->WMid.'"]=0;
00359 GLV_curLayerHeight["'.$this->WMid.'"]=0;
00360 GLV_curLayerX["'.$this->WMid.'"]=0;
00361 GLV_curLayerY["'.$this->WMid.'"]=0;
00362 GLV_menuOn["'.$this->WMid.'"] = null;
00363 GLV_gap["'.$this->WMid.'"]='.t3lib_div::intInRange($this->mconf['hideMenuWhenNotOver'],0,600).';
00364 GLV_currentLayer["'.$this->WMid.'"] = null;
00365 GLV_currentROitem["'.$this->WMid.'"] = null;
00366 GLV_hasBeenOver["'.$this->WMid.'"]=0;
00367 GLV_doReset["'.$this->WMid.'"]=false;
00368 GLV_lastKey["'.$this->WMid.'"] = "'.$this->WMlastKey.'";
00369 GLV_onlyOnLoad["'.$this->WMid.'"] = '.($this->WMonlyOnLoad?1:0).';
00370 GLV_dontHideOnMouseUp["'.$this->WMid.'"] = '.($this->mconf['dontHideOnMouseUp']?1:0).';
00371 GLV_dontFollowMouse["'.$this->WMid.'"] = '.($this->mconf['dontFollowMouse']?1:0).';
00372 GLV_date = new Date();
00373 GLV_timeout["'.$this->WMid.'"] = GLV_date.getTime();
00374 GLV_timeoutRef["'.$this->WMid.'"] = '.t3lib_div::intInRange($this->mconf['hideMenuTimer'],0,20000).';
00375 GLV_menuXY["'.$this->WMid.'"] = new Array();
00376 '.implode(LF,$this->WMxyArray).'
00377 '.$this->WMrestoreVars;
00378 
00379         if ($this->mconf['freezeMouseover'])    {
00380             $GLOBALS['TSFE']->JSCode.= '
00381 // Alternative rollover/out functions for use with GMENU_LAYER
00382 function GL'.$this->WMid.'_over(mitm_id)    {
00383     GL'.$this->WMid.'_out("");  // removes any old roll over state of an item. Needed for alwaysKeep and Opera browsers.
00384     switch(mitm_id) {
00385 '.implode(LF,$this->VMmouseoverActions).'
00386     }
00387     GLV_currentROitem["'.$this->WMid.'"]=mitm_id;
00388 }
00389 function GL'.$this->WMid.'_out(mitm_id) {
00390     if (!mitm_id)   mitm_id=GLV_currentROitem["'.$this->WMid.'"];
00391     switch(mitm_id) {
00392 '.implode(LF,$this->VMmouseoutActions).'
00393     }
00394 }
00395 ';
00396         }
00397         $GLOBALS["TSFE"]->JSCode.= '
00398 function GL'.$this->WMid.'_getMouse(e) {
00399     if (GLV_menuOn["'.$this->WMid.'"]!=null && !GLV_dontFollowMouse["'.$this->WMid.'"]){
00400 '.implode(LF,$GLV_menuOn).'
00401     }
00402     GL_mouseMoveEvaluate("'.$this->WMid.'");
00403 }
00404 function GL'.$this->WMid.'_hideCode() {
00405 '.$this->WMhideCode.'
00406 }
00407 function GL'.$this->WMid.'_doTop(WMid,id) {
00408 '.trim(implode(LF,$DoTop)).'
00409 }
00410 function GL'.$this->WMid.'_restoreMenu() {
00411 '.$this->WMrestoreScript.'
00412 }
00413 function GL'.$this->WMid.'_resetSubMenus() {
00414     var resetSubMenu=1;
00415 '.$this->WMresetSubMenus.'
00416     return resetSubMenu;
00417 }
00418 
00419 GLV_timeout_pointers[GLV_timeout_count] = "'.$this->WMid.'";
00420 GLV_timeout_count++;
00421 
00422 ';
00423         $GLOBALS['TSFE']->JSeventFuncCalls['onload']['GL_initLayers()']= 'GL_initLayers();';
00424         $GLOBALS['TSFE']->JSeventFuncCalls['onload'][$this->WMid]=  'GL_restoreMenu("'.$this->WMid.'");';
00425         // Should be called BEFORE any of the 'local' getMouse functions!
00426         // is put inside in a try catch block to avoid JS errors in IE
00427         $GLOBALS['TSFE']->JSeventFuncCalls['onmousemove']['GL_getMouse(e)']= 'try{GL_getMouse(e);}catch(ex){};';
00428         $GLOBALS['TSFE']->JSeventFuncCalls['onmousemove'][$this->WMid]= 'try{GL'.$this->WMid.'_getMouse(e);}catch(ex){};';
00429         $GLOBALS['TSFE']->JSeventFuncCalls['onmouseup'][$this->WMid]= 'GL_mouseUp(\''.$this->WMid.'\',e);';
00430 
00431         $GLOBALS['TSFE']->divSection.=implode($this->divLayers,LF).LF;
00432 
00433         return parent::extProc_finish();
00434     }
00435 
00436     /**
00437      * Creates a JavaScript line which corrects the position of the layer based on the constraints in TypoScript property 'bordersWithin'
00438      *
00439      * @param   string      Direction to test.
00440      * @param   integer     The boundary limit in the direction set by $kind. If set then a value is returned, otherwise blank.
00441      * @return  string      JavaScript string for correction of the layer position (if $integer is true)
00442      * @see extProc_finish(), extProc_init()
00443      */
00444     function extCalcBorderWithin($kind,$integer)    {
00445         if ($integer)   {
00446             switch($kind)   {
00447                 case 'right':
00448                 case 'bottom':
00449                     $add='';
00450                     if ($kind=='right')     {$add='GL_getObj(id).width'; $key = 'left';}
00451                     if ($kind=='bottom')    {$add='GL_getObj(id).height'; $key = 'top';}
00452                     $str = 'if (parseInt(GLV_menuOn["'.$this->WMid.'"].'.$key.')+'.$add.'>'.$integer.') GLV_menuOn["'.$this->WMid.'"].'.$key.'='.$integer.'-'.$add.';';
00453                 break;
00454                 default:
00455                     $str = 'if (parseInt(GLV_menuOn["'.$this->WMid.'"].'.$kind.')<'.$integer.') GLV_menuOn["'.$this->WMid.'"].'.$kind.'='.$integer.';';
00456                 break;
00457             }
00458         }
00459         return $str;
00460     }
00461 }
00462 
00463 // FULL DUPLICATE FROM gmenu_layers END:
00464 
00465 
00466 $GLOBALS['TSFE']->tmpl->menuclasses.=',tmenu_layers';
00467 
00468 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['media/scripts/tmenu_layers.php'])) {
00469     include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['media/scripts/tmenu_layers.php']);
00470 }
00471 
00472 ?>