* Merging all changes from TYPO3_4-0 branch back into HEAD
[Packages/TYPO3.CMS.git] / typo3 / sysext / cms / tslib / media / scripts / gmenu_layers.php
1 <?php
2 /***************************************************************
3 * Copyright notice
4 *
5 * (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
6 * All rights reserved
7 *
8 * This script is part of the TYPO3 project. The TYPO3 project is
9 * free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License as published by
11 * the Free Software Foundation; either version 2 of the License, or
12 * (at your option) any later version.
13 *
14 * The GNU General Public License can be found at
15 * http://www.gnu.org/copyleft/gpl.html.
16 * A copy is found in the textfile GPL.txt and important notices to the license
17 * from the author is found in LICENSE.txt distributed with these scripts.
18 *
19 *
20 * This script is distributed in the hope that it will be useful,
21 * but WITHOUT ANY WARRANTY; without even the implied warranty of
22 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
23 * GNU General Public License for more details.
24 *
25 * This copyright notice MUST APPEAR in all copies of the script!
26 ***************************************************************/
27 /**
28 * Contains the GMENU_LAYERS extension class, tslib_gmenu_layers
29 *
30 * $Id$
31 * Revised for TYPO3 3.6 June/2003 by Kasper Skaarhoj
32 * XHTML compliant
33 *
34 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
35 */
36 /**
37 * [CLASS/FUNCTION INDEX of SCRIPT]
38 *
39 *
40 *
41 * 84: class tslib_gmenu_layers extends tslib_gmenu
42 * 116: function extProc_init()
43 * 134: function extProc_RO($key)
44 * 150: function extProc_beforeLinking($key)
45 * 205: function extProc_afterLinking($key)
46 * 240: function extProc_beforeAllWrap($item,$key)
47 * 253: function isSetIntval($in)
48 * 262: function extProc_finish ()
49 * 444: function extCalcBorderWithin($kind,$integer)
50 *
51 * TOTAL FUNCTIONS: 8
52 * (This index is automatically created/updated by the extension "extdeveval")
53 *
54 */
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74 /**
75 * Class extending tslib_gmenu for the creation of DHTML menus
76 * NOTICE: The contents of this class is made so that it can be copied EXACTLY AS IS to the tmenu_layers class! See notes in class (for BEGIN/END) and also "diff.xmenu_layers.txt"
77 *
78 * @author Kasper Skaarhoj <kasperYYYY@typo3.com>
79 * @package TYPO3
80 * @subpackage tslib
81 * @link http://typo3.org/doc.0.html?&tx_extrepmgm_pi1[extUid]=270&tx_extrepmgm_pi1[tocEl]=385&cHash=648519dd66
82 * @see diff.xmenu_layers.txt
83 */
84 class tslib_gmenu_layers extends tslib_gmenu {
85
86 // FULL DUPLICATE TO tmenu_layers BEGIN:
87
88 var $GMENU_fixKey='layers';
89 var $divLayers=Array();
90
91 var $WMx=0;
92 var $WMy=0;
93 var $WMxyArray=array();
94 var $WMextraScript='';
95 var $WMlastKey='';
96 var $WMrestoreScript='';
97 var $WMresetSubMenus='';
98 var $WMactiveHasSubMenu='';
99 var $WMactiveKey='';
100 var $WMtheSubMenu;
101 var $WMisSub;
102 var $WMhideCode;
103 var $WMonlyOnLoad=0;
104 var $WMbordersWithin=array();
105 var $WMsubIds=array();
106 var $WMtempStore=array();
107 var $WMlockPosition_addAccumulated=array();
108 var $VMmouseoverActions=array();
109 var $VMmouseoutActions=array();
110
111 /**
112 * Creating unique menu id string plus other initialization of internal variables (all prefixed "WM")
113 *
114 * @return void
115 */
116 function extProc_init() {
117 $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!
118
119 $GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMid'][]=$this->WMid;
120 $this->WMtempStore = $GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMid'];
121 $GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMid']=array();
122
123 // Save:
124 $this->WMonlyOnLoad = ($this->mconf['displayActiveOnLoad'] && !$this->mconf['displayActiveOnLoad.']['onlyOnLoad']);
125 $this->WMbordersWithin = t3lib_div::intExplode(',',$this->mconf['bordersWithin'].',0,0,0,0,0');
126 }
127
128 /**
129 * Processing of mouse-over features depending on whether "freezeMouseover" property is set.
130 *
131 * @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
132 * @return void
133 */
134 function extProc_RO($key) {
135 if ($this->mconf['freezeMouseover']) {
136 $this->VMmouseoverActions[$this->WMid.$key]='case "Menu'.$this->WMid.$key.'":'.$this->I['linkHREF']['onMouseover'].'; break;';
137 $this->VMmouseoutActions[$this->WMid.$key]='case "Menu'.$this->WMid.$key.'":'.$this->I['linkHREF']['onMouseout'].'; break;';
138 $this->I['linkHREF']['onMouseover']='GL'.$this->WMid.'_over(\'Menu'.$this->WMid.$key.'\');';
139 $this->I['linkHREF']['onMouseout']='';
140 }
141 }
142
143 /**
144 * Processing before the links are created.
145 * This means primarily creating some javaScript code for the management.
146 *
147 * @param integer Pointer to $this->menuArr[$key] where the current menu element record is found
148 * @return void
149 */
150 function extProc_beforeLinking($key) {
151 if ($this->I['uid']) {
152
153 array_push($GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMparentId'],$this->WMid);
154 $this->WMtheSubMenu = $this->subMenu($this->I['uid'], $this->WMsubmenuObjSuffixes[$key]['sOSuffix']);
155 array_pop($GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMparentId']);
156 $this->WMisSub = trim($this->WMtheSubMenu) ? 1 : 0;
157
158 if ($this->mconf['lockPosition_addSelf']) {
159 $this->WMy+=(strcmp($this->mconf['setFixedHeight'],'')?$this->mconf['setFixedHeight']:$this->I['val']['output_h'])+intval($this->mconf['lockPosition_adjust']);
160 $this->WMx+=(strcmp($this->mconf['setFixedWidth'],'')?$this->mconf['setFixedWidth']:$this->I['val']['output_w'])+intval($this->mconf['lockPosition_adjust']);
161 }
162
163 if ($this->isActive($this->I['uid'], $this->getMPvar($key)) && $this->mconf['displayActiveOnLoad']) { // orig: && $this->WMisSub, changed 210901
164 $this->WMactiveHasSubMenu = $this->WMisSub;
165 $this->WMactiveKey = 'Menu'.$this->WMid.$key;
166
167
168 $this->WMrestoreVars=trim('
169 GLV_restoreMenu["'.$this->WMid.'"] = "'.$this->WMactiveKey.'";
170 ');
171 $this->WMrestoreScript=' GL_doTop("'.$this->WMid.'",GLV_restoreMenu["'.$this->WMid.'"]);'.($this->mconf['freezeMouseover']?'
172 GL'.$this->WMid.'_over(GLV_restoreMenu["'.$this->WMid.'"]);
173 ':'');
174 }
175
176 if ($this->WMisSub) {
177 $event="GL_stopMove('".$this->WMid."');";
178 $this->I['linkHREF']['onMouseover']='GL_doTop(\''.$this->WMid.'\', \'Menu'.$this->WMid.$key.'\');'.$this->I['linkHREF']['onMouseover'];
179 // IESelectFix - Activates IFRAME layer below menu
180 if ($this->mconf['ieSelectFix']) $this->I['linkHREF']['onMouseover']=$this->I['linkHREF']['onMouseover'].'GL_iframer(\''.$this->WMid.'\',\'Menu'.$this->WMid.$key.'\',true);';
181 // 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).
182 // 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.
183 if (t3lib_div::intInRange($this->mconf['hideMenuWhenNotOver'],0,600) && $this->mconf['hideMenuTimer']) {
184 $event.='GL_resetAll("'.$this->WMid.'");';
185 }
186 $this->I['linkHREF']['onMouseout'].=$event;
187 } else {
188 $this->I['linkHREF']['onMouseover'] = 'GL_hideAll("'.$this->WMid.'");'.$this->I['linkHREF']['onMouseover'];
189 // IESelectFix - Hides IFRAME layer below menu
190 if ($this->mconf['ieSelectFix']) $this->I['linkHREF']['onMouseover'] = $this->I['linkHREF']['onMouseover'].'GL_iframer(\''.$this->WMid.'\',\'\',false);';
191 $event='GL_resetAll("'.$this->WMid.'");';
192 $this->I['linkHREF']['onMouseout'].=$event;
193 }
194
195 $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).'");';
196 }
197 }
198
199 /**
200 * Processing after linking, basically setting the <div>-layers for the menu items. Also some more JavaScript code is made.
201 *
202 * @param integer Pointer to $this->menuArr[$key] where the current menu element record is found
203 * @return void
204 */
205 function extProc_afterLinking($key) {
206 if ($this->I['uid']) {
207 if (!$this->I['spacer'] && $this->WMisSub) {
208 $exStyle=$this->mconf['layerStyle'] ? $this->mconf['layerStyle'] : 'position:absolute;visibility:hidden';
209 if (trim($exStyle)) {
210 $exStyle=' '.$exStyle;
211 }
212 $GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['layerCounter']++;
213 $zIndex = 10000-$GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['layerCounter'];
214 # $zIndex = (($key+2)*$this->menuNumber*100);
215 $divStart = '<div id="Menu'.$this->WMid.$key.'" style="z-index:'.$zIndex.';'.$exStyle.'">';
216 $divStop = '</div>';
217
218 $this->divLayers[]= $divStart.$this->WMtheSubMenu.$divStop;
219
220 $this->WMhideCode.='
221 GL_getObjCss("Menu'.$this->WMid.$key.'").visibility = "hidden";';
222 $this->WMlastKey = 'Menu'.$this->WMid.$key;
223 }
224
225 if (!$this->mconf['lockPosition_addSelf']) {
226 $this->WMy+=(strcmp($this->mconf['setFixedHeight'],'')?$this->mconf['setFixedHeight']:$this->I['val']['output_h'])+intval($this->mconf['lockPosition_adjust']);
227 $this->WMx+=(strcmp($this->mconf['setFixedWidth'],'')?$this->mconf['setFixedWidth']:$this->I['val']['output_w'])+intval($this->mconf['lockPosition_adjust']);
228 }
229 }
230 $this->WMresult.=$this->I['theItem'];
231 }
232
233 /**
234 * Wrapping the item in a <div> section if 'relativeToTriggerItem' was set
235 *
236 * @param string The current content of the menu item, $this->I['theItem'], passed along.
237 * @param integer Pointer to $this->menuArr[$key] where the current menu element record is found
238 * @return string The modified version of $item, going back into $this->I['theItem']
239 */
240 function extProc_beforeAllWrap($item,$key) {
241 if ($this->mconf['relativeToTriggerItem']) {
242 $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>';
243 }
244 return $item;
245 }
246
247 /**
248 * Returns true if different from '' OR if intval()!=0
249 *
250 * @param string Value to evaluate
251 * @return boolean true if $in is different from '' OR if intval()!=0
252 */
253 function isSetIntval($in) {
254 return $this->mconf['blankStrEqFalse'] ? strcmp($in,'') : intval($in);
255 }
256
257 /**
258 * Putting things together, in particular the JavaScript code needed for the DHTML menu.
259 *
260 * @return mixed Returns the value of a call to the parent function, parent::extProc_finish();
261 */
262 function extProc_finish () {
263 $dirL = $this->mconf['directionLeft'] ? '-GL_getObj(id).width' : '';
264 $dirU = $this->mconf['directionUp'] ? '-GL_getObj(id).height' : '';
265
266 $parentLayerId = end($GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMparentId']);
267
268 $DoTop=array();
269 $GLV_menuOn=array();
270 $relCode=array();
271 $relFlag=0;
272 if ($this->mconf['relativeToParentLayer'] && $parentLayerId) {
273 $relCode['X'].='GLV_curLayerX["'.$parentLayerId.'"]+';
274 $relCode['Y'].='GLV_curLayerY["'.$parentLayerId.'"]+';
275 if ($this->mconf['relativeToParentLayer.']['addWidth']) { $relCode['X'].='GLV_curLayerWidth["'.$parentLayerId.'"]+'; }
276 if ($this->mconf['relativeToParentLayer.']['addHeight']) { $relCode['Y'].='GLV_curLayerHeight["'.$parentLayerId.'"]+'; }
277 }
278 if ($this->mconf['relativeToTriggerItem']) {
279 $DoTop[]='
280 var parentObject = GL_getObj(GLV_menuXY[WMid][id][2]);
281 var TI_width = parentObject.width;
282 var TI_height = parentObject.height;
283 var anchorObj = GL_getObj(GLV_menuXY[WMid][id][3]);
284 var TI_x = anchorObj.x;
285 var TI_y = anchorObj.y;
286 ';
287 $relCode['X'].='TI_x+';
288 $relCode['Y'].='TI_y+';
289
290 if ($this->mconf['relativeToTriggerItem.']['addWidth']) { $relCode['X'].='TI_width+'; }
291 if ($this->mconf['relativeToTriggerItem.']['addHeight']) { $relCode['Y'].='TI_height+'; }
292 $relFlag=1;
293 }
294 if ($relFlag) {
295 $DoTop[]='GLV_menuOn["'.$this->WMid.'"].left = ('.$relCode['X'].intval($this->mconf['leftOffset']).$dirL.')+"px";';
296 $DoTop[]='GLV_menuOn["'.$this->WMid.'"].top = ('.$relCode['Y'].intval($this->mconf['topOffset']).$dirU.')+"px";';
297 } else {
298 // X position (y is fixed)
299 if (!strcmp($this->mconf['lockPosition'],'x')) {
300 $DoTop[]='GLV_menuOn["'.$this->WMid.'"].left = ('.$relCode['X'].'GLV_menuXY["'.$this->WMid.'"][id][0]-('.intval($this->mconf['xPosOffset']).')'.$dirL.')+"px";';
301 if ($this->isSetIntval($this->mconf['topOffset'])) {
302 $DoTop[]='GLV_menuOn["'.$this->WMid.'"].top = ('.$relCode['Y'].intval($this->mconf['topOffset']).$dirU.')+"px";';
303 }
304 } elseif ($this->isSetIntval($this->mconf['xPosOffset'])) {
305 $GLV_menuOn[]=$DoTop[]='GLV_menuOn["'.$this->WMid.'"].left = (GLV_x-('.intval($this->mconf['xPosOffset']).')'.$dirL.')+"px";';
306 if ($this->isSetIntval($this->mconf['topOffset'])) {
307 $DoTop[]='GLV_menuOn["'.$this->WMid.'"].top = ('.$relCode['Y'].intval($this->mconf['topOffset']).$dirU.')+"px";';
308 }
309 }
310 // Y position (x is fixed)
311 if (!strcmp($this->mconf['lockPosition'],'y')) {
312 $DoTop[]='GLV_menuOn["'.$this->WMid.'"].top = ('.$relCode['Y'].'GLV_menuXY["'.$this->WMid.'"][id][1]-('.intval($this->mconf['yPosOffset']).')'.$dirU.')+"px";';
313 if ($this->isSetIntval($this->mconf['leftOffset'])) {
314 $DoTop[]='GLV_menuOn["'.$this->WMid.'"].left = ('.$relCode['X'].intval($this->mconf['leftOffset']).$dirL.')+"px";';
315 }
316 } elseif ($this->isSetIntval($this->mconf['yPosOffset'])) {
317 $GLV_menuOn[]=$DoTop[]='GLV_menuOn["'.$this->WMid.'"].top = (GLV_y-('.intval($this->mconf['yPosOffset']).')'.$dirU.')+"px";';
318 if ($this->isSetIntval($this->mconf['leftOffset'])) {
319 $DoTop[]='GLV_menuOn["'.$this->WMid.'"].left = ('.$relCode['X'].intval($this->mconf['leftOffset']).$dirL.')+"px";';
320 }
321 }
322 }
323
324 // BordersWithIn:
325 $DoTop[]=$this->extCalcBorderWithin('left',$this->WMbordersWithin[0]);
326 $DoTop[]=$this->extCalcBorderWithin('top',$this->WMbordersWithin[1]);
327 $DoTop[]=$this->extCalcBorderWithin('right',$this->WMbordersWithin[2]);
328 $DoTop[]=$this->extCalcBorderWithin('bottom',$this->WMbordersWithin[3]);
329 $DoTop[]=$this->extCalcBorderWithin('left',$this->WMbordersWithin[4]);
330 $DoTop[]=$this->extCalcBorderWithin('top',$this->WMbordersWithin[5]);
331
332
333 if ($this->mconf['freezeMouseover'] && !$this->mconf['freezeMouseover.']['alwaysKeep']) {
334 $this->WMhideCode.='
335 GL'.$this->WMid.'_out("");';
336 }
337
338 $TEST='';
339 if (count($GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMid'])) {
340 reset($GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMid']);
341 while(list(,$mIdStr)=each($GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMid'])) {
342 $this->WMhideCode.='
343 GL_hideAll("'.$mIdStr.'");';
344 $this->WMrestoreScript.='
345 GL_restoreMenu("'.$mIdStr.'");';
346 $this->WMresetSubMenus.='
347 if (!GLV_doReset["'.$mIdStr.'"] && GLV_currentLayer["'.$mIdStr.'"]!=null) resetSubMenu=0;';
348 }
349 }
350 // IESelectFix - Adds IFRAME tag to HTML, Hides IFRAME layer below menu
351 if ($this->mconf['ieSelectFix']) {
352 $this->WMhideCode.= '
353 GL_iframer(\''.$this->WMid.'\',\'\',false);';
354 $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>';
355 }
356 $GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMid']=array_merge($this->WMtempStore,$GLOBALS['TSFE']->applicationData['GMENU_LAYERS']['WMid']);
357 $GLOBALS['TSFE']->additionalHeaderData['gmenu_layer_shared']='<script type="text/javascript" src="'.t3lib_extMgm::siteRelPath('cms').'tslib/media/scripts/jsfunc.layermenu.js"></script>';
358 $GLOBALS['TSFE']->JSCode.= '
359
360 GLV_curLayerWidth["'.$this->WMid.'"]=0;
361 GLV_curLayerHeight["'.$this->WMid.'"]=0;
362 GLV_curLayerX["'.$this->WMid.'"]=0;
363 GLV_curLayerY["'.$this->WMid.'"]=0;
364 GLV_menuOn["'.$this->WMid.'"] = null;
365 GLV_gap["'.$this->WMid.'"]='.t3lib_div::intInRange($this->mconf['hideMenuWhenNotOver'],0,600).';
366 GLV_currentLayer["'.$this->WMid.'"] = null;
367 GLV_currentROitem["'.$this->WMid.'"] = null;
368 GLV_hasBeenOver["'.$this->WMid.'"]=0;
369 GLV_doReset["'.$this->WMid.'"]=false;
370 GLV_lastKey["'.$this->WMid.'"] = "'.$this->WMlastKey.'";
371 GLV_onlyOnLoad["'.$this->WMid.'"] = '.($this->WMonlyOnLoad?1:0).';
372 GLV_dontHideOnMouseUp["'.$this->WMid.'"] = '.($this->mconf['dontHideOnMouseUp']?1:0).';
373 GLV_dontFollowMouse["'.$this->WMid.'"] = '.($this->mconf['dontFollowMouse']?1:0).';
374 GLV_date = new Date();
375 GLV_timeout["'.$this->WMid.'"] = GLV_date.getTime();
376 GLV_timeoutRef["'.$this->WMid.'"] = '.t3lib_div::intInRange($this->mconf['hideMenuTimer'],0,20000).';
377 GLV_menuXY["'.$this->WMid.'"] = new Array();
378 '.implode(chr(10),$this->WMxyArray).'
379 '.$this->WMrestoreVars;
380
381 if ($this->mconf['freezeMouseover']) {
382 $GLOBALS['TSFE']->JSCode.= '
383 // Alternative rollover/out functions for use with GMENU_LAYER
384 function GL'.$this->WMid.'_over(mitm_id) {
385 GL'.$this->WMid.'_out(""); // removes any old roll over state of an item. Needed for alwaysKeep and Opera browsers.
386 switch(mitm_id) {
387 '.implode(chr(10),$this->VMmouseoverActions).'
388 }
389 GLV_currentROitem["'.$this->WMid.'"]=mitm_id;
390 }
391 function GL'.$this->WMid.'_out(mitm_id) {
392 if (!mitm_id) mitm_id=GLV_currentROitem["'.$this->WMid.'"];
393 switch(mitm_id) {
394 '.implode(chr(10),$this->VMmouseoutActions).'
395 }
396 }
397 ';
398 }
399 $GLOBALS["TSFE"]->JSCode.= '
400 function GL'.$this->WMid.'_getMouse(e) {
401 if (GLV_menuOn["'.$this->WMid.'"]!=null && !GLV_dontFollowMouse["'.$this->WMid.'"]){
402 '.implode(chr(10),$GLV_menuOn).'
403 }
404 GL_mouseMoveEvaluate("'.$this->WMid.'");
405 }
406 function GL'.$this->WMid.'_hideCode() {
407 '.$this->WMhideCode.'
408 }
409 function GL'.$this->WMid.'_doTop(WMid,id) {
410 '.trim(implode(chr(10),$DoTop)).'
411 }
412 function GL'.$this->WMid.'_restoreMenu() {
413 '.$this->WMrestoreScript.'
414 }
415 function GL'.$this->WMid.'_resetSubMenus() {
416 var resetSubMenu=1;
417 '.$this->WMresetSubMenus.'
418 return resetSubMenu;
419 }
420
421 GLV_timeout_pointers[GLV_timeout_count] = "'.$this->WMid.'";
422 GLV_timeout_count++;
423
424 ';
425 $GLOBALS['TSFE']->JSeventFuncCalls['onload']['GL_initLayers()']= 'GL_initLayers();';
426 $GLOBALS['TSFE']->JSeventFuncCalls['onload'][$this->WMid]= 'GL_restoreMenu("'.$this->WMid.'");';
427 $GLOBALS['TSFE']->JSeventFuncCalls['onmousemove']['GL_getMouse(e)']= 'GL_getMouse(e);'; // Should be called BEFORE any of the 'local' getMouse functions!
428 $GLOBALS['TSFE']->JSeventFuncCalls['onmousemove'][$this->WMid]= 'GL'.$this->WMid.'_getMouse(e);';
429 $GLOBALS['TSFE']->JSeventFuncCalls['onmouseup'][$this->WMid]= 'GL_mouseUp(\''.$this->WMid.'\',e);';
430
431 $GLOBALS['TSFE']->divSection.=implode($this->divLayers,chr(10)).chr(10);
432
433 return parent::extProc_finish();
434 }
435
436 /**
437 * Creates a JavaScript line which corrects the position of the layer based on the constraints in TypoScript property 'bordersWithin'
438 *
439 * @param string Direction to test.
440 * @param integer The boundary limit in the direction set by $kind. If set then a value is returned, otherwise blank.
441 * @return string JavaScript string for correction of the layer position (if $integer is true)
442 * @see extProc_finish(), extProc_init()
443 */
444 function extCalcBorderWithin($kind,$integer) {
445 if ($integer) {
446 switch($kind) {
447 case 'right':
448 case 'bottom':
449 $add='';
450 if ($kind=='right') {$add='GL_getObj(id).width'; $key = 'left';}
451 if ($kind=='bottom') {$add='GL_getObj(id).height'; $key = 'top';}
452 $str = 'if (parseInt(GLV_menuOn["'.$this->WMid.'"].'.$key.')+'.$add.'>'.$integer.') GLV_menuOn["'.$this->WMid.'"].'.$key.'='.$integer.'-'.$add.';';
453 break;
454 default:
455 $str = 'if (parseInt(GLV_menuOn["'.$this->WMid.'"].'.$kind.')<'.$integer.') GLV_menuOn["'.$this->WMid.'"].'.$kind.'='.$integer.';';
456 break;
457 }
458 }
459 return $str;
460 }
461 }
462
463 // FULL DUPLICATE TO tmenu_layers END:
464
465
466 $GLOBALS['TSFE']->tmpl->menuclasses.=',gmenu_layers';
467
468 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['media/scripts/gmenu_layers.php']) {
469 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['media/scripts/gmenu_layers.php']);
470 }
471
472 ?>