[TASK] Remove superfluous parenthesis in sysext frontend
[Packages/TYPO3.CMS.git] / typo3 / sysext / frontend / Classes / ContentObject / Menu / GraphicalMenuFoldout.php
1 <?php
2 namespace TYPO3\CMS\Frontend\ContentObject\Menu;
3
4 /***************************************************************
5 * Copyright notice
6 *
7 * (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com)
8 * All rights reserved
9 *
10 * This script is part of the TYPO3 project. The TYPO3 project is
11 * free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * The GNU General Public License can be found at
17 * http://www.gnu.org/copyleft/gpl.html.
18 * A copy is found in the textfile GPL.txt and important notices to the license
19 * from the author is found in LICENSE.txt distributed with these scripts.
20 *
21 *
22 * This script is distributed in the hope that it will be useful,
23 * but WITHOUT ANY WARRANTY; without even the implied warranty of
24 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 * GNU General Public License for more details.
26 *
27 * This copyright notice MUST APPEAR in all copies of the script!
28 ***************************************************************/
29 /**
30 * Contains the GMENU_FOLDOUT extension class, tslib_gmenu_foldout
31 *
32 * Revised for TYPO3 3.6 June/2003 by Kasper Skårhøj
33 * XHTML compliant
34 *
35 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
36 */
37 /**
38 * Class extension tslib_gmenu for the creation of DHTML foldout menus
39 *
40 * @author Kasper Skårhøj <kasperYYYY@typo3.com>
41 * @package TYPO3
42 * @subpackage tslib
43 */
44 class GraphicalMenuFoldout extends \TYPO3\CMS\Frontend\ContentObject\Menu\GraphicalMenuContentObject {
45
46 /**
47 * @todo Define visibility
48 */
49 public $GMENU_fixKey = 'foldout';
50
51 /**
52 * @todo Define visibility
53 */
54 public $WMarrowNO;
55
56 /**
57 * @todo Define visibility
58 */
59 public $WMarrowACT;
60
61 /**
62 * @todo Define visibility
63 */
64 public $WMimagesFlag;
65
66 /**
67 * @todo Define visibility
68 */
69 public $WMimageHTML;
70
71 /**
72 * @todo Define visibility
73 */
74 public $WMsubmenu;
75
76 /**
77 * @todo Define visibility
78 */
79 public $WMtableWrap;
80
81 /**
82 * @todo Define visibility
83 */
84 public $WM_activeOnLoad = '';
85
86 /**
87 * Initializing, setting internal variables (prefixed WM)
88 *
89 * @return void
90 * @todo Define visibility
91 */
92 public function extProc_init() {
93 $this->WMarrowNO = '';
94 $this->WMarrowACT = '';
95 $this->WMimagesFlag = 0;
96 $this->WMimageHTML = '';
97 if (($this->mconf['arrowNO'] || $this->mconf['arrowNO.']) && ($this->mconf['arrowACT'] || $this->mconf['arrowACT.'])) {
98 $this->WMarrowNO = $GLOBALS['TSFE']->cObj->getImgResource($this->mconf['arrowNO'], $this->mconf['arrowNO.']);
99 $this->WMarrowACT = $GLOBALS['TSFE']->cObj->getImgResource($this->mconf['arrowACT'], $this->mconf['arrowACT.']);
100 if (is_array($this->WMarrowACT) && is_array($this->WMarrowNO)) {
101 $this->WMimagesFlag = 1;
102 }
103 }
104 }
105
106 /**
107 * Processing before the links are created.
108 * Basically this is setting an onclick handler for clicking the menu item.
109 *
110 * @param integer $key Pointer to $this->menuArr[$key] where the current menu element record is found
111 * @return void
112 * @todo Define visibility
113 */
114 public function extProc_beforeLinking($key) {
115 $this->I['addATagParams'] = '';
116 $this->WMsubmenu = $this->subMenu($this->I['uid'], $this->WMsubmenuObjSuffixes[$key]['sOSuffix']);
117 if (trim($this->WMsubmenu)) {
118 $this->I['addATagParams'] = ' onclick="GF_menu(' . $key . ');' . ($this->mconf['dontLinkIfSubmenu'] ? ' return false;' : '') . '"';
119 // orig: && $this->WMisSub, changed 210901
120 if ($this->isActive($this->I['uid'], $this->getMPvar($key)) && $this->mconf['displayActiveOnLoad']) {
121 $this->WM_activeOnLoad = 'GF_menu(' . $key . ');';
122 }
123 }
124 }
125
126 /**
127 * Processing after linking, basically setting the <div>-layers for the menu items and possibly wrapping in table, adding bullet images.
128 *
129 * @param integer $key Pointer to $this->menuArr[$key] where the current menu element record is found
130 * @return void
131 * @todo Define visibility
132 */
133 public function extProc_afterLinking($key) {
134 $this->WMtableWrap = $this->mconf['dontWrapInTable'] ? '' : '<table cellspacing="0" cellpadding="0" width="100%" border="0"><tr><td>|</td></tr></table>';
135 if ($this->WMimagesFlag) {
136 $this->WMimageHTML = '<img src="' . $GLOBALS['TSFE']->absRefPrefix . $this->WMarrowNO[3] . '" width="' . $this->WMarrowNO[0] . '" height="' . $this->WMarrowNO[1] . '" border="0" name="imgA' . $key . '"' . ($this->mconf['arrowImgParams'] ? ' ' . $this->mconf['arrowImgParams'] : '') . ' alt="" />';
137 } else {
138 $this->WMimageHTML = '';
139 }
140 if (strstr($this->I['theItem'], '###ARROW_IMAGE###')) {
141 $this->I['theItem'] = str_replace('###ARROW_IMAGE###', $this->WMimageHTML, $this->I['theItem']);
142 } else {
143 $this->I['theItem'] = $this->WMimageHTML . $this->I['theItem'];
144 }
145 $this->WMresult .= '
146 <div class="clTop" id="divTop' . ($key + 1) . '">' . $this->tmpl->wrap($this->I['theItem'], $this->WMtableWrap) . '
147 <div class="clSub" id="divSub' . ($key + 1) . '">
148 ' . $this->WMsubmenu . '
149 </div>
150 </div>';
151 }
152
153 /**
154 * Putting things together, in particular the JavaScript code needed for the DHTML menu.
155 *
156 * @return string Empty string! (Since $GLOBALS['TSFE']->divSection is set with the <div>-sections used in the menu)
157 * @todo Define visibility
158 */
159 public function extProc_finish() {
160 $bHeight = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->mconf['bottomHeight'] ? $this->mconf['bottomHeight'] : 100, 0, 3000);
161 $bottomContent = $this->mconf['bottomContent'] ? $GLOBALS['TSFE']->cObj->cObjGetSingle($this->mconf['bottomContent'], $this->mconf['bottomContent.'], '/GMENU_FOLDOUT/.bottomContent') : '';
162 $adjustTopHeights = intval($this->mconf['adjustItemsH']);
163 $adjustSubHeights = intval($this->mconf['adjustSubItemsH']);
164 $mWidth = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->mconf['menuWidth'] ? $this->mconf['menuWidth'] : 170, 0, 3000);
165 $mHeight = \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->mconf['menuHeight'] ? $this->mconf['menuHeight'] : 400, 0, 3000);
166 $insertmColor = $this->mconf['menuBackColor'] ? 'BACKGROUND-COLOR: ' . $this->mconf['menuBackColor'] . '; layer-background-color: ' . $this->mconf['menuBackColor'] : '';
167 $insertBottomColor = $this->mconf['bottomBackColor'] ? 'BACKGROUND-COLOR: ' . $this->mconf['bottomBackColor'] . '; layer-background-color: ' . $this->mconf['bottomBackColor'] : '';
168 $menuOffset = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $this->mconf['menuOffset'] . ',');
169 $subOffset = \TYPO3\CMS\Core\Utility\GeneralUtility::intExplode(',', $this->mconf['subMenuOffset'] . ',');
170 $GLOBALS['TSFE']->additionalHeaderData['gmenu_layer_shared'] = '<script type="text/javascript" src="' . \TYPO3\CMS\Core\Extension\ExtensionManager::siteRelPath('statictemplates') . 'media/scripts/jsfunc.layermenu.js"></script>';
171 $GLOBALS['TSFE']->additionalHeaderData['gmenu_foldout'] = '<script type="text/javascript" src="' . \TYPO3\CMS\Core\Extension\ExtensionManager::siteRelPath('statictemplates') . 'media/scripts/jsfunc.foldout.js"></script>';
172 $GLOBALS['TSFE']->additionalHeaderData[] .= '
173 <style type="text/css">
174 /*<![CDATA[*/
175 #divCont {
176 Z-INDEX: 1; LEFT: ' . $menuOffset[0] . 'px; VISIBILITY: hidden; WIDTH: ' . $mWidth . 'px; POSITION: absolute; TOP: ' . $menuOffset[1] . 'px; HEIGHT: ' . $mHeight . 'px
177 }
178 .clTop {
179 Z-INDEX: 1; WIDTH: ' . $mWidth . 'px; POSITION: absolute; ' . $insertmColor . '
180 }
181 .clSub {
182 Z-INDEX: 1; LEFT: ' . $subOffset[0] . 'px; WIDTH: ' . $mWidth . 'px; POSITION: absolute; TOP: ' . $subOffset[1] . 'px
183 }
184 .bottomLayer {
185 Z-INDEX: 1; WIDTH: ' . $mWidth . 'px; CLIP: rect(0px ' . $mWidth . 'px ' . $bHeight . 'px 0px); POSITION: absolute; HEIGHT: ' . $bHeight . 'px; ' . $insertBottomColor . '
186 }
187 /*]]>*/
188 </style>
189 <script type="text/javascript">
190 /*<![CDATA[*/
191 <!--
192 GFV_foldNumber=' . $this->WMmenuItems . '; //How many toplinks do you have?
193 GFV_foldTimer=' . \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange(($this->mconf['foldTimer'] ? $this->mconf['foldTimer'] : 40), 1, 3000) . '; //The timeout in the animation, these are milliseconds.
194 GFV_foldSpeed=' . \TYPO3\CMS\Core\Utility\MathUtility::forceIntegerInRange($this->mconf['foldSpeed'], 1, 100) . '; //How many steps in an animation?
195 GFV_stayFolded=' . ($this->mconf['stayFolded'] ? 'true' : 'false') . '; //Stay open when you click a new toplink?
196 GFV_foldImg=' . $this->WMimagesFlag . '; //Do you want images (if not set to 0 and remove the images from the body)?
197 GFV_currentFold=null;
198 GFV_foldStep1=null;
199 GFV_foldStep2=null;
200 GFV_step=0;
201 GFV_active=false; //Don\'t change this one.
202 GFV_adjustTopHeights = ' . $adjustTopHeights . ';
203 GFV_adjustSubHeights = ' . $adjustSubHeights . ';
204 if (bw.opera) {
205 GFV_scrX= innerWidth;
206 GFV_scrY= innerHeight;
207 }
208
209 //This is the default image.
210 //Remember to change the actual images in the page as well, but remember to keep the name of the image.
211 var GFV_unImg=new Image();
212 GFV_unImg.src="' . $GLOBALS['TSFE']->absRefPrefix . $this->WMarrowNO[3] . '";
213
214 var GFV_exImg=new Image(); //Making an image variable...
215 GFV_exImg.src="' . $GLOBALS['TSFE']->absRefPrefix . $this->WMarrowACT[3] . '"; //...this is the source of the image that it changes to when the menu expands.
216
217 //-->
218 /*]]>*/
219 </script>
220 ';
221 $GLOBALS['TSFE']->JSeventFuncCalls['onmousemove']['GF_resizeForOpera()'] = 'GF_resizeForOpera();';
222 $GLOBALS['TSFE']->JSeventFuncCalls['onload']['GMENU_FOLDOUT'] = 'if(bw.bw) {GF_initFoldout();' . $this->WM_activeOnLoad . '}';
223 $GLOBALS['TSFE']->divSection .= '
224 <div id="divCont"><!-- These are the contents of the foldoutmenu. -->
225 ' . $this->tmpl->wrap($this->WMresult, $this->mconf['wrap']) . '
226 <div class="bottomLayer" id="divTop' . ($this->WMmenuItems + 1) . '">
227 <div class="clSub" id="divSub' . ($this->WMmenuItems + 1) . '"><!-- This is a cover layer, it should always be the last one, and does NOT count in your number of toplinks! --><!-- So if this one is divTop7, the GFV_foldNumber variable should be set to 6 --><!-- This layer covers up the last sub, so if the last sub gets too big, increase this layers size in the stylesheet. --><!-- There are tables with width="100%" around the toplinks, to force NS4 to use the real width specified for the toplinks in the stylesheet. -->
228 </div>' . $this->tmpl->wrap($bottomContent, $this->WMtableWrap) . '
229 </div>
230 </div><!-- Here ends the foldoutmenu. -->
231 ';
232 return '';
233 }
234
235 }
236
237
238 ?>