*/ class tslib_tmenu_layers extends tslib_tmenu { // FULL DUPLICATE FROM gmenu_layers BEGIN: var $GMENU_fixKey="layers"; var $divLayers=Array(); var $WMx=0; var $WMy=0; var $WMxyArray=array(); var $WMextraScript=""; var $WMlastKey=""; var $WMrestoreScript=""; var $WMresetSubMenus=""; var $WMactiveHasSubMenu=""; var $WMactiveKey=""; var $WMtheSubMenu; var $WMisSub; var $WMhideCode; var $WMonlyOnLoad=0; var $WMbordersWithin=array(); var $WMsubIds=array(); var $WMtempStore=array(); var $WMlockPosition_addAccumulated=array(); var $VMmouseoverActions=array(); var $VMmouseoutActions=array(); function extProc_init() { $this->WMid = trim($this->mconf["layer_menu_id"])?trim($this->mconf["layer_menu_id"])."x":substr(md5(microtime()),0,6); // NO "_" (underscore) in the ID!!! NN4 breaks! $GLOBALS["TSFE"]->applicationData["GMENU_LAYERS"]["WMid"][]=$this->WMid; $this->WMtempStore = $GLOBALS["TSFE"]->applicationData["GMENU_LAYERS"]["WMid"]; $GLOBALS["TSFE"]->applicationData["GMENU_LAYERS"]["WMid"]=array(); // Save: # $this->WMlockPosition_addAccumulated = $GLOBALS["TSFE"]->applicationData["GMENU_LAYERS"]["lockPosition_addAccumulated"]; # $this->WMfreezePrefix = $this->mconf["freezeMouseover"] ? "GL".$this->WMid."_" : ""; $this->WMonlyOnLoad = ($this->mconf["displayActiveOnLoad"] && !$this->mconf["displayActiveOnLoad."]["onlyOnLoad"]); $this->WMbordersWithin = t3lib_div::intExplode(",",$this->mconf["bordersWithin"].",0,0,0,0,0"); } function extProc_RO($key) { if ($this->mconf["freezeMouseover"]) { $this->VMmouseoverActions[$this->WMid.$key]='case "Menu'.$this->WMid.$key.'":'.$this->I["linkHREF"]["onMouseover"].'; break;'; $this->VMmouseoutActions[$this->WMid.$key]='case "Menu'.$this->WMid.$key.'":'.$this->I["linkHREF"]["onMouseout"].'; break;'; $this->I["linkHREF"]["onMouseover"]="GL".$this->WMid."_over('Menu".$this->WMid.$key."');"; $this->I["linkHREF"]["onMouseout"]=""; } } function extProc_beforeLinking($key) { if ($this->I["uid"]) { array_push($GLOBALS["TSFE"]->applicationData["GMENU_LAYERS"]["WMparentId"],$this->WMid); $this->WMtheSubMenu = $this->subMenu($this->I["uid"],$this->I["mount_pid"]); array_pop($GLOBALS["TSFE"]->applicationData["GMENU_LAYERS"]["WMparentId"]); $this->WMisSub = trim($this->WMtheSubMenu) ? 1 : 0; # $GLOBALS["TSFE"]->applicationData["GMENU_LAYERS"]["lockPosition_addAccumulated"]["y"]+=$this->I["val"]["output_h"]; # $GLOBALS["TSFE"]->applicationData["GMENU_LAYERS"]["lockPosition_addAccumulated"]["x"]+=$this->I["val"]["output_w"]; #debug($GLOBALS["TSFE"]->applicationData["GMENU_LAYERS"]["lockPosition_addAccumulated"]); if ($this->mconf["lockPosition_addSelf"]) { $this->WMy+=(strcmp($this->mconf["setFixedHeight"],"")?$this->mconf["setFixedHeight"]:$this->I["val"]["output_h"])+intval($this->mconf["lockPosition_adjust"]); $this->WMx+=(strcmp($this->mconf["setFixedWidth"],"")?$this->mconf["setFixedWidth"]:$this->I["val"]["output_w"])+intval($this->mconf["lockPosition_adjust"]); } if ($this->isActive($this->I["uid"]) && $this->mconf["displayActiveOnLoad"]) { // orig: && $this->WMisSub, changed 210901 $this->WMactiveHasSubMenu = $this->WMisSub; $this->WMactiveKey = "Menu".$this->WMid.$key; $this->WMrestoreVars=trim(' GLV_restoreMenu["'.$this->WMid.'"] = "'.$this->WMactiveKey.'"; '); $this->WMrestoreScript=' GL_doTop("'.$this->WMid.'",GLV_restoreMenu["'.$this->WMid.'"]);'.($this->mconf["freezeMouseover"]?' GL'.$this->WMid.'_over(GLV_restoreMenu["'.$this->WMid.'"]); ':''); /* $this->WMextraScript=''; */ } if ($this->WMisSub) { $event="GL_stopMove('".$this->WMid."');"; $this->I["linkHREF"]["onMouseover"]='GL_doTop(\''.$this->WMid.'\', \'Menu'.$this->WMid.$key.'\');iframer(true,\'Menu'.$this->WMid.$key.'\')'.$this->I["linkHREF"]["onMouseover"]; // 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). // 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. if (t3lib_div::intInRange($this->mconf["hideMenuWhenNotOver"],0,600) && $this->mconf["hideMenuTimer"]) { $event.="GL_resetAll('".$this->WMid."');"; } $this->I["linkHREF"]["onMouseout"].=$event; } else { $this->I["linkHREF"]["onMouseover"]="GL_hideAll('".$this->WMid."');".$this->I["linkHREF"]["onMouseover"]; $event="GL_resetAll('".$this->WMid."');"; $this->I["linkHREF"]["onMouseout"].=$event; } $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)."');"; } #debug($this->I); } function extProc_afterLinking($key) { if ($this->I["uid"]) { if (!$this->I["spacer"] && $this->WMisSub) { $exStyle=$this->mconf["layerStyle"] ? $this->mconf["layerStyle"] : 'position:absolute;visibility:hidden'; if (trim($exStyle)) { $exStyle=" ".$exStyle; } $GLOBALS["TSFE"]->applicationData["GMENU_LAYERS"]["layerCounter"]++; $zIndex = 10000-$GLOBALS["TSFE"]->applicationData["GMENU_LAYERS"]["layerCounter"]; # $zIndex = (($key+2)*$this->menuNumber*100); $divStart = ''; $iframe = ''; $this->divLayers[]= $divStart.$this->WMtheSubMenu.$divStop; $this->divLayers['iframe']= $iframe; #$this->mr = $this->mr+1; #$this->mr_str = ''; #$this->mr_str.= ' #var DivRef'.$this->mr.' = document.getElementById(\'Menu'.$this->WMid.$key.'\'); #var IfrRef'.$this->mr.' = document.getElementById(\'Iframe'.$this->WMid.$key.'\'); #'; # $this->mr_str2.= ' # DivRef'.$this->mr.'.style.display = "block"; # IfrRef'.$this->mr.'.style.width = DivRef'.$this->mr.'.offsetWidth; # IfrRef'.$this->mr.'.style.height = DivRef'.$this->mr.'.offsetHeight; # IfrRef'.$this->mr.'.style.top = DivRef'.$this->mr.'.style.top; # IfrRef'.$this->mr.'.style.left = DivRef'.$this->mr.'.style.left; # IfrRef'.$this->mr.'.style.zIndex = DivRef'.$this->mr.'.style.zIndex - 1; #IfrRef'.$this->mr.'.style.display = "block"; #'; #$this->mr_str3.= ' #DivRef'.$this->mr.'.style.display = "none"; #IfrRef'.$this->mr.'.style.display = "none"; #'; $this->WMhideCode.=' GL_getObjCss("Menu'.$this->WMid.$key.'").visibility = "hidden";'; $this->WMlastKey = "Menu".$this->WMid.$key; } if (!$this->mconf["lockPosition_addSelf"]) { $this->WMy+=(strcmp($this->mconf["setFixedHeight"],"")?$this->mconf["setFixedHeight"]:$this->I["val"]["output_h"])+intval($this->mconf["lockPosition_adjust"]); $this->WMx+=(strcmp($this->mconf["setFixedWidth"],"")?$this->mconf["setFixedWidth"]:$this->I["val"]["output_w"])+intval($this->mconf["lockPosition_adjust"]); } } $this->WMresult.=$this->I["theItem"]; } function extProc_beforeAllWrap($item,$key) { if ($this->mconf["relativeToTriggerItem"]) { $item = '
WMid).'" style="position:absolute;visibility:hidden;">
WMid).'" width="100%" height="100%">'.$item.'
'; } //debug(array($item)); return $item; } function isSetIntval($in) { return $this->mconf["blankStrEqFalse"] ? strcmp($in,"") : intval($in); // return true if different from "" OR if intval()!=0 } function extProc_finish () { $dirL = $this->mconf["directionLeft"] ? '-GL_getObj(id).width' : ''; $dirU = $this->mconf["directionUp"] ? '-GL_getObj(id).height' : ''; $parentLayerId = end($GLOBALS["TSFE"]->applicationData["GMENU_LAYERS"]["WMparentId"]); /* $offset_addAccumulated=t3lib_div::intInRange($this->mconf["offset_addAccumulated"],-1,1); $offset_addSelf=t3lib_div::intInRange($this->mconf["offset_addSelf"],-1,1); $accuDim = $this->WMlockPosition_addAccumulated; $accuDim["y"]=$offset_addAccumulated * $accuDim["y"]; $accuDim["x"]=$offset_addAccumulated * $accuDim["x"]; */ $DoTop=array(); $GLV_menuOn=array(); $relCode=array(); $relFlag=0; if ($this->mconf["relativeToParentLayer"] && $parentLayerId) { $relCode["X"].='GLV_curLayerX["'.$parentLayerId.'"]+'; $relCode["Y"].='GLV_curLayerY["'.$parentLayerId.'"]+'; if ($this->mconf["relativeToParentLayer."]["addWidth"]) { $relCode["X"].='GLV_curLayerWidth["'.$parentLayerId.'"]+'; } if ($this->mconf["relativeToParentLayer."]["addHeight"]) { $relCode["Y"].='GLV_curLayerHeight["'.$parentLayerId.'"]+'; } } if ($this->mconf["relativeToTriggerItem"]) { $DoTop[]=' var parentObject = GL_getObj(GLV_menuXY[WMid][id][2]); var TI_width = parentObject.width; var TI_halfWidth = parentObject.width/2; var TI_height = parentObject.height; var anchorObj = GL_getObj(GLV_menuXY[WMid][id][3]); var TI_x = anchorObj.x; var TI_y = anchorObj.y; // alert(""+TI_width+" | "+TI_height+" | "+TI_x+" | "+TI_y) '; $relCode["X"].='TI_x+'; $relCode["Y"].='TI_y+'; #$relCode["X-"].='TI_x-'; if ($this->mconf["relativeToTriggerItem."]["addWidth"]) { $relCode["X"].='TI_width+'; } if ($this->mconf["relativeToTriggerItem."]["addHeight"]) { $relCode["Y"].='TI_height'.$this->mconf["relativeToTriggerItem."]["addHeight"].'+'; } if ($this->mconf["relativeToTriggerItem."]["subWidth"]) { $relCode["X"]='TI_x-TI_halfWidth'.$this->mconf["relativeToTriggerItem."]["subWidth"].'+'; } #if ($this->mconf["relativeToTriggerItem."]["addPixelX"]) { $relCode["X"].=$this->mconf["relativeToTriggerItem."]["addPixelX"].'+';} #if ($this->mconf["relativeToTriggerItem."]["addPixelY"]) { $relCode["Y"].=$this->mconf["relativeToTriggerItem."]["addPixelY"].'+';} $relFlag=1; } if ($relFlag) { $DoTop[]='GLV_menuOn["'.$this->WMid.'"].left = '.$relCode["X"].intval($this->mconf["leftOffset"]).$dirL.';'; $DoTop[]='GLV_menuOn["'.$this->WMid.'"].top = '.$relCode["Y"].intval($this->mconf["topOffset"]).$dirU.';'; } else { // X position (y is fixed) if (!strcmp($this->mconf["lockPosition"],"x")) { $DoTop[]='GLV_menuOn["'.$this->WMid.'"].left = '.$relCode["X"].'GLV_menuXY["'.$this->WMid.'"][id][0]-('.intval($this->mconf["xPosOffset"]).')'.$dirL.';'; if ($this->isSetIntval($this->mconf["topOffset"])) { $DoTop[]='GLV_menuOn["'.$this->WMid.'"].top = '.$relCode["Y"].intval($this->mconf["topOffset"]).$dirU.';'; } } elseif ($this->isSetIntval($this->mconf["xPosOffset"])) { $GLV_menuOn[]=$DoTop[]='GLV_menuOn["'.$this->WMid.'"].left = GLV_x-('.intval($this->mconf["xPosOffset"]).')'.$dirL.';'; if ($this->isSetIntval($this->mconf["topOffset"])) { $DoTop[]='GLV_menuOn["'.$this->WMid.'"].top = '.$relCode["Y"].intval($this->mconf["topOffset"]).$dirU.';'; } } // Y position (x is fixed) if (!strcmp($this->mconf["lockPosition"],"y")) { $DoTop[]='GLV_menuOn["'.$this->WMid.'"].top = '.$relCode["Y"].'GLV_menuXY["'.$this->WMid.'"][id][1]-('.intval($this->mconf["yPosOffset"]).')'.$dirU.';'; if ($this->isSetIntval($this->mconf["leftOffset"])) { $DoTop[]='GLV_menuOn["'.$this->WMid.'"].left = '.$relCode["X"].intval($this->mconf["leftOffset"]).$dirL.';'; } } elseif ($this->isSetIntval($this->mconf["yPosOffset"])) { $GLV_menuOn[]=$DoTop[]='GLV_menuOn["'.$this->WMid.'"].top = GLV_y-('.intval($this->mconf["yPosOffset"]).')'.$dirU.';'; if ($this->isSetIntval($this->mconf["leftOffset"])) { $DoTop[]='GLV_menuOn["'.$this->WMid.'"].left = '.$relCode["X"].intval($this->mconf["leftOffset"]).$dirL.';'; } } } // BordersWithIn: $DoTop[]=$this->extCalcBorderWithin('left',$this->WMbordersWithin[0]); $DoTop[]=$this->extCalcBorderWithin('top',$this->WMbordersWithin[1]); $DoTop[]=$this->extCalcBorderWithin('right',$this->WMbordersWithin[2]); $DoTop[]=$this->extCalcBorderWithin('bottom',$this->WMbordersWithin[3]); $DoTop[]=$this->extCalcBorderWithin('left',$this->WMbordersWithin[4]); $DoTop[]=$this->extCalcBorderWithin('top',$this->WMbordersWithin[5]); // Code for hiding nested LAYER-menus. #debug(array($GLOBALS["TSFE"]->applicationData["GMENU_LAYERS"]["WMid"],$this->WMtempStore,$this->menuNumber,$this->WMid)); if ($this->mconf["freezeMouseover"] && !$this->mconf["freezeMouseover."]["alwaysKeep"]) { $this->WMhideCode.=' GL'.$this->WMid.'_out("");'; } $TEST=""; if (count($GLOBALS["TSFE"]->applicationData["GMENU_LAYERS"]["WMid"])) { reset($GLOBALS["TSFE"]->applicationData["GMENU_LAYERS"]["WMid"]); while(list(,$mIdStr)=each($GLOBALS["TSFE"]->applicationData["GMENU_LAYERS"]["WMid"])) { $this->WMhideCode.=' GL_hideAll("'.$mIdStr.'");'; $this->WMrestoreScript.=' GL_restoreMenu("'.$mIdStr.'");'; $this->WMresetSubMenus.=' if (!GLV_doReset["'.$mIdStr.'"] && GLV_currentLayer["'.$mIdStr.'"]!=null) resetSubMenu=0;'; /* $TEST.=' testStr+=" | "+GLV_doReset["'.$mIdStr.'"]+","+GLV_currentLayer["'.$mIdStr.'"]; testStr2+=(!GLV_doReset["'.$mIdStr.'"] && GLV_currentLayer["'.$mIdStr.'"]!=null)?1:0;'; */ } } $GLOBALS["TSFE"]->applicationData["GMENU_LAYERS"]["WMid"]=array_merge($this->WMtempStore,$GLOBALS["TSFE"]->applicationData["GMENU_LAYERS"]["WMid"]); // Restore: # $GLOBALS["TSFE"]->applicationData["GMENU_LAYERS"]["lockPosition_addAccumulated"] = $this->WMlockPosition_addAccumulated; $GLOBALS["TSFE"]->additionalHeaderData["gmenu_layer_shared"]=''; $GLOBALS["TSFE"]->JSCode.= ' GLV_curLayerWidth["'.$this->WMid.'"]=0; GLV_curLayerHeight["'.$this->WMid.'"]=0; GLV_curLayerX["'.$this->WMid.'"]=0; GLV_curLayerY["'.$this->WMid.'"]=0; GLV_menuOn["'.$this->WMid.'"] = null; GLV_gap["'.$this->WMid.'"]='.t3lib_div::intInRange($this->mconf["hideMenuWhenNotOver"],0,600).'; GLV_currentLayer["'.$this->WMid.'"] = null; GLV_currentROitem["'.$this->WMid.'"] = null; GLV_hasBeenOver["'.$this->WMid.'"]=0; GLV_doReset["'.$this->WMid.'"]=false; GLV_lastKey["'.$this->WMid.'"] = "'.$this->WMlastKey.'"; GLV_onlyOnLoad["'.$this->WMid.'"] = '.($this->WMonlyOnLoad?1:0).'; GLV_dontHideOnMouseUp["'.$this->WMid.'"] = '.($this->mconf["dontHideOnMouseUp"]?1:0).'; GLV_dontFollowMouse["'.$this->WMid.'"] = '.($this->mconf["dontFollowMouse"]?1:0).'; GLV_date = new Date(); GLV_timeout["'.$this->WMid.'"] = GLV_date.getTime(); GLV_timeoutRef["'.$this->WMid.'"] = '.t3lib_div::intInRange($this->mconf["hideMenuTimer"],0,20000).'; GLV_menuXY["'.$this->WMid.'"] = new Array(); '.implode(chr(10),$this->WMxyArray).' '.$this->WMrestoreVars; if ($this->mconf["freezeMouseover"]) { $GLOBALS["TSFE"]->JSCode.= ' // Alternative rollover/out functions for use with GMENU_LAYER function GL'.$this->WMid.'_over(mitm_id) { GL'.$this->WMid.'_out(""); // removes any old roll over state of an item. Needed for alwaysKeep and Opera browsers. switch(mitm_id) { '.implode(chr(10),$this->VMmouseoverActions).' } GLV_currentROitem["'.$this->WMid.'"]=mitm_id; } function GL'.$this->WMid.'_out(mitm_id) { if (!mitm_id) mitm_id=GLV_currentROitem["'.$this->WMid.'"]; switch(mitm_id) { '.implode(chr(10),$this->VMmouseoutActions).' } } '; } $GLOBALS["TSFE"]->JSCode.= ' function GL'.$this->WMid.'_getMouse(e) { if (GLV_menuOn["'.$this->WMid.'"]!=null && !GLV_dontFollowMouse["'.$this->WMid.'"]){ '.implode(chr(10),$GLV_menuOn).' } GL_mouseMoveEvaluate("'.$this->WMid.'"); } function GL'.$this->WMid.'_hideCode() { '.$this->WMhideCode.' } function GL'.$this->WMid.'_doTop(WMid,id) { '.trim(implode(chr(10),$DoTop)).' } function GL'.$this->WMid.'_restoreMenu() { '.$this->WMrestoreScript.' } function GL'.$this->WMid.'_resetSubMenus() { var resetSubMenu=1; '.$this->WMresetSubMenus.' return resetSubMenu; } GLV_timeout_pointers[GLV_timeout_count] = "'.$this->WMid.'"; GLV_timeout_count++; '; ##### $GLOBALS["TSFE"]->JSCode.= ' function iframer(state,key) { var DivRef = document.getElementById(key); var IfrRef = document.getElementById(\'Iframe\'); if(state) { DivRef.style.display = "block"; IfrRef.style.width = DivRef.offsetWidth; IfrRef.style.height = DivRef.offsetHeight; IfrRef.style.top = DivRef.style.top; IfrRef.style.left = DivRef.style.left; IfrRef.style.zIndex = DivRef.style.zIndex - 1; IfrRef.style.display = "block"; } else { //DivRef.style.display = "none"; IfrRef.style.display = "none"; } } '; ##### /* $GLOBALS["TSFE"]->JSCode.= ' function test_func(){ var testStr=""; var testStr2=""; '.$TEST.' window.status = testStr2+" - "+testStr; } '; */ /* $GLOBALS["TSFE"]->JSCode.= ' function debugObj(obj,name) { var acc; for (i in obj) { if (obj[i]) { acc+=i+": "+obj[i]+"\n"; } } alert("Object: "+name+"\n\n"+acc); } '; */ $GLOBALS["TSFE"]->JSeventFuncCalls["onload"]["GL_initLayers()"]= 'GL_initLayers();'; $GLOBALS["TSFE"]->JSeventFuncCalls["onload"][$this->WMid]= 'GL_restoreMenu("'.$this->WMid.'");'; $GLOBALS["TSFE"]->JSeventFuncCalls["onmousemove"]["GL_getMouse(e)"]= 'GL_getMouse(e);'; // Should be called BEFORE any of the "local" getMouse functions! $GLOBALS["TSFE"]->JSeventFuncCalls["onmousemove"][$this->WMid]= 'GL'.$this->WMid.'_getMouse(e);'; $GLOBALS["TSFE"]->JSeventFuncCalls["onmouseup"][$this->WMid]= 'GL_mouseUp(\''.$this->WMid.'\',e);'; $GLOBALS["TSFE"]->divSection.=implode($this->divLayers,chr(10)).chr(10); return parent::extProc_finish(); } function extCalcBorderWithin($kind,$integer) { if ($integer) { switch($kind) { case "right": case "bottom": $add=""; if ($kind=="right") {$add='GL_getObj(id).width'; $key = "left";} if ($kind=="bottom") {$add='GL_getObj(id).height'; $key = "top";} $str = 'if (parseInt(GLV_menuOn["'.$this->WMid.'"].'.$key.')+'.$add.'>'.$integer.') GLV_menuOn["'.$this->WMid.'"].'.$key.'='.$integer.'-'.$add.';'; break; default: $str = 'if (parseInt(GLV_menuOn["'.$this->WMid.'"].'.$kind.')<'.$integer.') GLV_menuOn["'.$this->WMid.'"].'.$kind.'='.$integer.';'; break; } } return $str; } } // FULL DUPLICATE FROM gmenu_layers END: $GLOBALS["TSFE"]->tmpl->menuclasses.=",tmenu_layers"; if (defined("TYPO3_MODE") && $TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["media/scripts/tmenu_layers.php"]) { include_once($TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["media/scripts/tmenu_layers.php"]); } ?>