|
TYPO3 API
SVNRelease
|
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 GMENU_FOLDOUT extension class, tslib_gmenu_foldout 00029 * 00030 * $Id: gmenu_foldout.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 * 80: class tslib_gmenu_foldout extends tslib_gmenu 00042 * 96: function extProc_init() 00043 * 117: function extProc_beforeLinking($key) 00044 * 134: function extProc_afterLinking($key) 00045 * 160: function extProc_finish() 00046 * 00047 * TOTAL FUNCTIONS: 4 00048 * (This index is automatically created/updated by the extension "extdeveval") 00049 * 00050 */ 00051 00052 00053 00054 00055 00056 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 00067 00068 00069 00070 00071 00072 /** 00073 * Class extension tslib_gmenu for the creation of DHTML foldout menus 00074 * 00075 * @author Kasper Skårhøj <kasperYYYY@typo3.com> 00076 * @package TYPO3 00077 * @subpackage tslib 00078 */ 00079 class tslib_gmenu_foldout extends tslib_gmenu { 00080 var $GMENU_fixKey='foldout'; 00081 00082 var $WMarrowNO; 00083 var $WMarrowACT; 00084 var $WMimagesFlag; 00085 var $WMimageHTML; 00086 var $WMsubmenu; 00087 var $WMtableWrap; 00088 var $WM_activeOnLoad=''; 00089 00090 /** 00091 * Initializing, setting internal variables (prefixed WM) 00092 * 00093 * @return void 00094 */ 00095 function extProc_init() { 00096 $this->WMarrowNO=''; 00097 $this->WMarrowACT=''; 00098 $this->WMimagesFlag=0; 00099 $this->WMimageHTML =''; 00100 if (($this->mconf['arrowNO']||$this->mconf['arrowNO.']) && ($this->mconf['arrowACT']||$this->mconf['arrowACT.'])) { 00101 $this->WMarrowNO = $GLOBALS['TSFE']->cObj->getImgResource($this->mconf['arrowNO'],$this->mconf['arrowNO.']); 00102 $this->WMarrowACT = $GLOBALS['TSFE']->cObj->getImgResource($this->mconf['arrowACT'],$this->mconf['arrowACT.']); 00103 if (is_array($this->WMarrowACT) && is_array($this->WMarrowNO)) { 00104 $this->WMimagesFlag=1; 00105 } 00106 } 00107 } 00108 00109 /** 00110 * Processing before the links are created. 00111 * Basically this is setting an onclick handler for clicking the menu item. 00112 * 00113 * @param integer Pointer to $this->menuArr[$key] where the current menu element record is found 00114 * @return void 00115 */ 00116 function extProc_beforeLinking($key) { 00117 $this->I['addATagParams']=''; 00118 $this->WMsubmenu = $this->subMenu($this->I['uid'], $this->WMsubmenuObjSuffixes[$key]['sOSuffix']); 00119 if (trim($this->WMsubmenu)) { 00120 $this->I['addATagParams']=' onclick="GF_menu('.$key.');'.($this->mconf['dontLinkIfSubmenu'] ? ' return false;' : '').'"'; 00121 if ($this->isActive($this->I['uid'], $this->getMPvar($key)) && $this->mconf['displayActiveOnLoad']) { // orig: && $this->WMisSub, changed 210901 00122 $this->WM_activeOnLoad='GF_menu('.$key.');'; 00123 } 00124 } 00125 } 00126 00127 /** 00128 * Processing after linking, basically setting the <div>-layers for the menu items and possibly wrapping in table, adding bullet images. 00129 * 00130 * @param integer Pointer to $this->menuArr[$key] where the current menu element record is found 00131 * @return void 00132 */ 00133 function extProc_afterLinking($key) { 00134 $this->WMtableWrap = $this->mconf['dontWrapInTable'] ? '' : '<table cellspacing="0" cellpadding="0" width="100%" border="0"><tr><td>|</td></tr></table>'; 00135 00136 if ($this->WMimagesFlag) { 00137 $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="" />'; 00138 } else {$this->WMimageHTML="";} 00139 00140 if (strstr($this->I['theItem'], '###ARROW_IMAGE###')) { 00141 $this->I['theItem'] = str_replace('###ARROW_IMAGE###', $this->WMimageHTML, $this->I['theItem']); 00142 } else { 00143 $this->I['theItem'] = $this->WMimageHTML.$this->I['theItem']; 00144 } 00145 00146 $this->WMresult.= ' 00147 <div class="clTop" id="divTop'.($key+1).'">'.$this->tmpl->wrap($this->I['theItem'], $this->WMtableWrap).' 00148 <div class="clSub" id="divSub'.($key+1).'"> 00149 '.$this->WMsubmenu.' 00150 </div> 00151 </div>'; // Originally a <br /> between the div-tags, but it seemed to break stuff. 00152 } 00153 00154 /** 00155 * Putting things together, in particular the JavaScript code needed for the DHTML menu. 00156 * 00157 * @return string Empty string! (Since $GLOBALS['TSFE']->divSection is set with the <div>-sections used in the menu) 00158 */ 00159 function extProc_finish() { 00160 $bHeight = t3lib_div::intInRange(($this->mconf['bottomHeight']?$this->mconf['bottomHeight']:100) ,0,3000); 00161 $bottomContent = $this->mconf['bottomContent'] ? $GLOBALS['TSFE']->cObj->cObjGetSingle($this->mconf['bottomContent'],$this->mconf['bottomContent.'], '/GMENU_FOLDOUT/.bottomContent') : ''; 00162 $adjustTopHeights = intval($this->mconf['adjustItemsH']); 00163 $adjustSubHeights = intval($this->mconf['adjustSubItemsH']); 00164 $mWidth = t3lib_div::intInRange(($this->mconf['menuWidth']?$this->mconf['menuWidth']:170) ,0,3000); 00165 $mHeight = t3lib_div::intInRange(($this->mconf['menuHeight']?$this->mconf['menuHeight']:400) ,0,3000); 00166 $insertmColor= $this->mconf['menuBackColor'] ? 'BACKGROUND-COLOR: '.$this->mconf['menuBackColor'].'; layer-background-color: '.$this->mconf['menuBackColor'] : ''; 00167 $insertBottomColor= $this->mconf['bottomBackColor'] ? 'BACKGROUND-COLOR: '.$this->mconf['bottomBackColor'].'; layer-background-color: '.$this->mconf['bottomBackColor'] : ''; 00168 $menuOffset = t3lib_div::intExplode(',',$this->mconf['menuOffset'].','); 00169 $subOffset = t3lib_div::intExplode(',',$this->mconf['subMenuOffset'].','); 00170 00171 00172 $GLOBALS['TSFE']->additionalHeaderData['gmenu_layer_shared']='<script type="text/javascript" src="'.t3lib_extMgm::siteRelPath('cms').'tslib/media/scripts/jsfunc.layermenu.js"></script>'; 00173 $GLOBALS['TSFE']->additionalHeaderData['gmenu_foldout']='<script type="text/javascript" src="'.t3lib_extMgm::siteRelPath('cms').'tslib/media/scripts/jsfunc.foldout.js"></script>'; 00174 00175 $GLOBALS["TSFE"]->additionalHeaderData[].= ' 00176 <style type="text/css"> 00177 /*<![CDATA[*/ 00178 #divCont { 00179 Z-INDEX: 1; LEFT: '.$menuOffset[0].'px; VISIBILITY: hidden; WIDTH: '.$mWidth.'px; POSITION: absolute; TOP: '.$menuOffset[1].'px; HEIGHT: '.$mHeight.'px 00180 } 00181 .clTop { 00182 Z-INDEX: 1; WIDTH: '.$mWidth.'px; POSITION: absolute; '.$insertmColor.' 00183 } 00184 .clSub { 00185 Z-INDEX: 1; LEFT: '.$subOffset[0].'px; WIDTH: '.$mWidth.'px; POSITION: absolute; TOP: '.$subOffset[1].'px 00186 } 00187 .bottomLayer { 00188 Z-INDEX: 1; WIDTH: '.$mWidth.'px; CLIP: rect(0px '.$mWidth.'px '.$bHeight.'px 0px); POSITION: absolute; HEIGHT: '.$bHeight.'px; '.$insertBottomColor.' 00189 } 00190 /*]]>*/ 00191 </style> 00192 <script type="text/javascript"> 00193 /*<![CDATA[*/ 00194 <!-- 00195 GFV_foldNumber='.$this->WMmenuItems.'; //How many toplinks do you have? 00196 GFV_foldTimer='.t3lib_div::intInRange(($this->mconf['foldTimer']?$this->mconf['foldTimer']:40) ,1,3000).'; //The timeout in the animation, these are milliseconds. 00197 GFV_foldSpeed='.t3lib_div::intInRange($this->mconf['foldSpeed'],1,100).'; //How many steps in an animation? 00198 GFV_stayFolded='.($this->mconf['stayFolded'] ? 'true' : 'false').'; //Stay open when you click a new toplink? 00199 GFV_foldImg='.$this->WMimagesFlag.'; //Do you want images (if not set to 0 and remove the images from the body)? 00200 GFV_currentFold=null; 00201 GFV_foldStep1=null; 00202 GFV_foldStep2=null; 00203 GFV_step=0; 00204 GFV_active=false; //Don\'t change this one. 00205 GFV_adjustTopHeights = '.$adjustTopHeights.'; 00206 GFV_adjustSubHeights = '.$adjustSubHeights.'; 00207 if (bw.opera) { 00208 GFV_scrX= innerWidth; 00209 GFV_scrY= innerHeight; 00210 } 00211 00212 //This is the default image. 00213 //Remember to change the actual images in the page as well, but remember to keep the name of the image. 00214 var GFV_unImg=new Image(); 00215 GFV_unImg.src="'.$GLOBALS['TSFE']->absRefPrefix.$this->WMarrowNO[3].'"; 00216 00217 var GFV_exImg=new Image(); //Making an image variable... 00218 GFV_exImg.src="'.$GLOBALS['TSFE']->absRefPrefix.$this->WMarrowACT[3].'"; //...this is the source of the image that it changes to when the menu expands. 00219 00220 //--> 00221 /*]]>*/ 00222 </script> 00223 '; 00224 00225 $GLOBALS['TSFE']->JSeventFuncCalls['onmousemove']['GF_resizeForOpera()']= 'GF_resizeForOpera();'; 00226 $GLOBALS['TSFE']->JSeventFuncCalls['onload']['GMENU_FOLDOUT']= 'if(bw.bw) {GF_initFoldout();'.$this->WM_activeOnLoad.'}'; 00227 00228 $GLOBALS['TSFE']->divSection.= ' 00229 <div id="divCont"><!-- These are the contents of the foldoutmenu. --> 00230 '.$this->tmpl->wrap($this->WMresult,$this->mconf['wrap']).' 00231 <div class="bottomLayer" id="divTop'.($this->WMmenuItems+1).'"> 00232 <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. --> 00233 </div>'.$this->tmpl->wrap($bottomContent, $this->WMtableWrap).' 00234 </div> 00235 </div><!-- Here ends the foldoutmenu. --> 00236 '; 00237 return ''; 00238 } 00239 } 00240 00241 $GLOBALS['TSFE']->tmpl->menuclasses.=',gmenu_foldout'; 00242 00243 00244 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['media/scripts/gmenu_foldout.php'])) { 00245 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['media/scripts/gmenu_foldout.php']); 00246 } 00247 00248 ?>
1.8.0