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