|
TYPO3 API
SVNRelease
|
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 1999-2009 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 * Class for generation of the module menu. 00029 * Will make the vertical, horizontal, selectorbox based menus AND the "about modules" display. 00030 * Basically it traverses the module structure and generates output based on that. 00031 * 00032 * $Id: class.alt_menu_functions.inc 10161 2011-01-20 14:54:34Z baschny $ 00033 * Revised for TYPO3 3.6 2/2003 by Kasper Skårhøj 00034 * XHTML compliant content 00035 * 00036 * @author Kasper Skårhøj <kasperYYYY@typo3.com> 00037 */ 00038 /** 00039 * [CLASS/FUNCTION INDEX of SCRIPT] 00040 * 00041 * 00042 * 00043 * 73: class alt_menu_functions 00044 * 94: function topMenu($theModules,$dontLink=0,$backPath='',$descr=0) 00045 * 473: function getNavFramePrefix($moduleInfo, $subModuleInfo=array()) 00046 * 504: function mIconFile($Ifilename,$backPath) 00047 * 519: function mIconFilename($Ifilename,$backPath) 00048 * 531: function topButtons() 00049 * 544: function adminButtons() 00050 * 563: function adminFunctions($backPath) 00051 * 596: function wrapLinkWithAB($link) 00052 * 00053 * TOTAL FUNCTIONS: 8 00054 * (This index is automatically created/updated by the extension "extdeveval") 00055 * 00056 */ 00057 00058 00059 00060 00061 00062 00063 00064 00065 00066 /** 00067 * Class with menu functions 00068 * 00069 * @author Kasper Skårhøj <kasperYYYY@typo3.com> 00070 * @package TYPO3 00071 * @subpackage core 00072 */ 00073 class alt_menu_functions { 00074 00075 // Internal 00076 var $fsMod = array(); 00077 00078 /** 00079 * Creates the menu of modules. 00080 * 00081 * $descr determines the type of menu made: 00082 * 0 = Ordinary vertical menu 00083 * 1 = Descriptions for 'About modules' display 00084 * 2 = selector-box menu 00085 * 3 = topmenu - horizontal line of icons! 00086 * 4 = part of JavaScript switch contruct for alt_main.php frameset. 00087 * 00088 * @param array $theModules is the output from load_modules class ($this->loadModules->modules) 00089 * @param boolean $dontLink == true will prevent the output from being linked with A-tags (used in the 'beuser' extension) 00090 * @param string $backPath must be the 'backPath' to PATH_typo3 from where the menu is displayed. 00091 * @param integer $descr determines the type of menu made (see above) 00092 * @return string The menu HTML 00093 */ 00094 function topMenu($theModules,$dontLink=0,$backPath='',$descr=0) { 00095 global $LANG, $TBE_TEMPLATE, $BE_USER; 00096 00097 // By default module sections are collapsable, only if they are explicitly turned off via TSconfig, they are not: 00098 $tmpArr = $BE_USER->getTSConfig('options.moduleMenuCollapsable'); 00099 $collapsable = (isset($tmpArr['value']) && $tmpArr['value']==0) ? 0 : 1; 00100 unset($tmpArr); 00101 00102 // Initialize vars: 00103 $final=''; 00104 $menuCode=''; 00105 $descrCode=''; 00106 $collection=array(); 00107 $menuCode_sub=''; 00108 $selectItems=array(); 00109 $mIcons=array(); 00110 $mJScmds=array(); 00111 $onBlur=$GLOBALS['CLIENT']['FORMSTYLE'] ? 'this.blur();' : ''; 00112 00113 $selectItems[] = '<option value="">[ '.$LANG->sL('LLL:EXT:lang/locallang_core.php:buttons.selMenu_modules',1).' ]</option>'; 00114 $mC=0; 00115 00116 // Get collapsed configuration 00117 if ($collapsable == 1) { 00118 $config = is_array ($BE_USER->uc['moduleData']['alt_menu.php']) ? $BE_USER->uc['moduleData']['alt_menu.php'] : array(); 00119 $collapsedOverride = t3lib_div::_GP('collapsedOverride'); 00120 if (is_array ($collapsedOverride)) { 00121 $config = array_merge ($config, $collapsedOverride); 00122 } 00123 00124 if (t3lib_div::_GP('collapsableExpandAll') == 1) { 00125 $config['expandAll'] = t3lib_div::_GP('expandAll'); 00126 } 00127 00128 if ($config['expandAll'] && is_array($collapsedOverride)) { 00129 $config = $collapsedOverride; 00130 } 00131 00132 $BE_USER->uc['moduleData']['alt_menu.php'] = $config; 00133 $BE_USER->writeUC($BE_USER->uc); 00134 00135 // all items have to be expanded when expandAll is set 00136 if($config['expandAll'] == 1) { 00137 foreach($config as $key => $value) { 00138 if($key != 'expandAll') 00139 $config[$key] = 0; 00140 } 00141 } 00142 } 00143 00144 // Traverse array with modules 00145 foreach ($theModules as $moduleName => $moduleInfo) { 00146 $mC++; 00147 00148 $prefix = $this->getNavFramePrefix($moduleInfo); 00149 if ($prefix) { 00150 $this->fsMod[]='fsMod.recentIds["'.$moduleName.'"]="";'; 00151 } 00152 00153 // If there are submodules: 00154 if (is_array($moduleInfo['sub'])) { 00155 // Finding the default module to display 00156 if ($moduleInfo['defaultMod']) { 00157 $link = $moduleInfo['sub'][$moduleInfo['defaultMod']]['script']; 00158 } else { 00159 reset($moduleInfo['sub']); 00160 $subTemp = current($moduleInfo['sub']); 00161 $link = $subTemp['script']; 00162 } 00163 $link_sub = 1; // Tells that the main modules links to a submodule 00164 $link = ''; // Does not link to submodules... 00165 } else { 00166 $link = $moduleInfo['script']; 00167 $link_sub = 0; 00168 } 00169 00170 $link = t3lib_div::resolveBackPath($link); 00171 00172 $moduleKey = $moduleName.'_tab'; 00173 $moduleCSSId = 'ID_'.t3lib_div::md5int($moduleName); 00174 00175 $collection[$moduleKey] = array( 00176 'moduleName' => $moduleName, 00177 'title' => $LANG->moduleLabels['tabs'][$moduleKey], 00178 'onclick' => 'top.goToModule(\''.$moduleName.'\');', 00179 ); 00180 00181 // Creating image icon 00182 $image = @getimagesize($this->mIconFile($LANG->moduleLabels['tabs_images'][$moduleKey],$backPath)); 00183 $imageCode=''; 00184 $descr3_title = $LANG->moduleLabels['tabs'][$moduleKey].' '; 00185 if ($image) { 00186 $Ifilename = $this->mIconFilename($LANG->moduleLabels['tabs_images'][$moduleKey],$backPath); 00187 $collection[$moduleKey]['icon'] = array($Ifilename, $image[3]); 00188 $imageCode = '<img src="'.$Ifilename.'" '.$image[3].' alt="" />'; 00189 $descr3_imageCode = '<img src="'.$Ifilename.'" '.$image[3].' title="'.htmlspecialchars($descr3_title).'" alt="" />'; 00190 } else { 00191 $descr3_imageCode = '<img'.t3lib_iconWorks::skinImg($backPath,'gfx/dummy_module.gif','width="14" height="12"').' title="'.htmlspecialchars($descr3_title).'" alt="" />'; 00192 } 00193 00194 // Creating the various links: 00195 $label = $LANG->moduleLabels['tabs'][$moduleKey]; 00196 if ($link && $prefix) $link=$prefix.rawurlencode($link); 00197 if ($link && !$dontLink) { 00198 $label = '<a href="#" onclick="top.goToModule(\''.$moduleName.'\');'.$onBlur.'return false;">'.$label.'</a>'; // && !$link_sub 00199 00200 $mIcons[] = '<a href="#" onclick="top.goToModule(\''.$moduleName.'\');'.$onBlur.'return false;" class="c-mainitem" id="'.$moduleCSSId.'">'.$descr3_imageCode.'</a>'; 00201 00202 $JScmd = ' 00203 top.content.location=top.getModuleUrl(top.TS.PATH_typo3+"'.$this->wrapLinkWithAB($link).'"+additionalGetVariables); 00204 top.highlightModuleMenuItem("'.$moduleCSSId.'",1);'; 00205 $mJScmds[] = "case '".$moduleName."': \n ".$JScmd." \n break;"; 00206 } 00207 00208 $selectItems[] = '<option value="top.goToModule(\''.$moduleName.'\');">'.htmlspecialchars($LANG->moduleLabels['tabs'][$moduleKey]).'</option>'; 00209 $label=' <strong>'.$label.'</strong> '; 00210 00211 00212 // make menu collapsable 00213 if($collapsable == 1 && is_array($moduleInfo['sub'])) { 00214 $collapseJS = 'onclick="window.location.href=\'alt_menu.php?collapsedOverride['.$moduleName.']='.($config[$moduleName] ? '0' : '1').'\'"'; 00215 $collapseIcon = t3lib_iconWorks::getSpriteIcon('actions-view-table-' . ($config[$moduleName] ? 'expand' : 'collapse'), array('class' => 'c-iconCollapse')); 00216 } else { 00217 $collapseJS = $collapseIcon = ''; 00218 } 00219 00220 // Creating a main item for the vertical menu (descr=0) 00221 $menuCode.=' 00222 <tr class="c-mainitem" id="'.$moduleCSSId.'"> 00223 <td colspan="3" '.$collapseJS.' >'.$imageCode.'<span class="c-label">'.$label.'</span>'.$collapseIcon.'</td> 00224 </tr>'; 00225 00226 // Code for "About modules" 00227 $descrCode.=' 00228 <tr class="c-mainitem"> 00229 <td colspan="3">'.$imageCode.$label.'</td> 00230 </tr>'; 00231 00232 00233 // Hide submodules when collapsed: 00234 if($collapsable == 1 && $config[$moduleName] == 1 && $descr == 0 && $config['expandAll'] != 1) { 00235 unset($moduleInfo['sub']); 00236 } 00237 00238 // Traversing submodules 00239 $subCode=''; 00240 if (is_array($moduleInfo['sub'])) { 00241 $collection[$moduleKey]['subitems'] = array(); 00242 $c=0; 00243 foreach ($moduleInfo['sub'] as $subName => $subInfo) { 00244 if ($c==0) { 00245 $subCode.=' 00246 <tr class="c-first"> 00247 <td colspan="3"></td> 00248 </tr>'; 00249 $descrCode.=' 00250 <tr class="c-first"> 00251 <td colspan="3"></td> 00252 </tr>'; 00253 } 00254 00255 $link = t3lib_div::resolveBackPath($subInfo['script']); 00256 $prefix = $this->getNavFramePrefix($moduleInfo, $subInfo); 00257 00258 $subKey = $moduleName.'_'.$subName.'_tab'; 00259 $moduleCSSId = 'ID_'.t3lib_div::md5int($moduleName.'_'.$subName); 00260 00261 $collection[$moduleKey]['subitems'][$subKey] = array( 00262 'moduleName' => $moduleName.'_'.$subName, 00263 'title' => $LANG->moduleLabels['tabs'][$subKey], 00264 'onclick' => 'top.goToModule(\''.$moduleName.'_'.$subName.'\');', 00265 ); 00266 00267 // Creating image icon 00268 $image = @getimagesize($this->mIconFile($LANG->moduleLabels['tabs_images'][$subKey],$backPath)); 00269 $imageCode=''; 00270 $descr3_title = $LANG->moduleLabels['tabs'][$subKey].': '.$LANG->moduleLabels['labels'][$subKey.'label']; 00271 if ($image) { 00272 $Ifilename = $this->mIconFilename($LANG->moduleLabels['tabs_images'][$subKey],$backPath); 00273 $collection[$moduleKey]['subitems'][$subKey]['icon'] = array($Ifilename, $image[3]); 00274 $imageCode = '<img src="'.$Ifilename.'" '.$image[3].' title="'.htmlspecialchars($LANG->moduleLabels['labels'][$subKey.'label']).'" alt="" />'; 00275 $descr3_imageCode = '<img src="'.$Ifilename.'" '.$image[3].' title="'.htmlspecialchars($descr3_title).'" alt="" />'; 00276 } else { 00277 $descr3_imageCode = '<img'.t3lib_iconWorks::skinImg($backPath,'gfx/dummy_module.gif','width="14" height="12"').' title="'.htmlspecialchars($descr3_title).'" alt="" />'; 00278 } 00279 00280 // Label for submodule: 00281 $label = $LANG->moduleLabels['tabs'][$subKey]; 00282 $label_descr = ' title="'.htmlspecialchars($LANG->moduleLabels['labels'][$subKey.'label']).'"'; 00283 $flabel = htmlspecialchars($label); 00284 $origLink = $link; 00285 if ($link && $prefix) $link=$prefix.rawurlencode($link); 00286 00287 // Setting additional JavaScript if frameset script: 00288 $addJS = ''; 00289 if ($moduleInfo['navFrameScript']) {$addJS = "+'&id='+top.rawurlencodeAndRemoveSiteUrl(top.fsMod.recentIds['" . $moduleName . "'])";} 00290 00291 // If there is a script to link to (and linking is not disabled. 00292 if ($link && !$dontLink) { 00293 // For condensed mode, send &cMR parameter to frameset script. 00294 if ($addJS && $BE_USER->uc['condensedMode']) {$addJS.= "+(cMR?'&cMR=1':'')";} 00295 00296 // Command for the selector box: 00297 $JScmd = ' 00298 top.content.location=top.getModuleUrl(top.TS.PATH_typo3+"'.$this->wrapLinkWithAB($link).'"'.$addJS.'+additionalGetVariables); 00299 top.fsMod.currentMainLoaded="'.$moduleName.'"; 00300 '; 00301 00302 if ($subInfo['navFrameScript']) { 00303 $JScmd.=' 00304 top.currentSubScript="'.$origLink.'";'; 00305 } 00306 00307 // If there is a frameset script in place: 00308 if (!$BE_USER->uc['condensedMode'] && $moduleInfo['navFrameScript']) { 00309 00310 // use special nav script from sub module, otherwise from the main module 00311 $subNavFrameScript = $subInfo['navFrameScript'] ? $subInfo['navFrameScript'] : $moduleInfo['navFrameScript']; 00312 $subNavFrameScript = t3lib_div::resolveBackPath($subNavFrameScript); 00313 00314 // add GET params for sub module to the nav script 00315 $subNavFrameScript = $this->wrapLinkWithAB($subNavFrameScript).$subInfo['navFrameScriptParam']; 00316 00317 $JScmd = ' 00318 if (top.content.list_frame && top.fsMod.currentMainLoaded=="'.$moduleName.'") { 00319 top.currentSubScript="'.$origLink.'"; 00320 top.content.list_frame.location=top.getModuleUrl(top.TS.PATH_typo3+"'.$this->wrapLinkWithAB($origLink).'"'.$addJS.'+additionalGetVariables); 00321 if(top.currentSubNavScript!="'.$subNavFrameScript.'") { 00322 top.currentSubNavScript="'.$subNavFrameScript.'"; 00323 top.content.nav_frame.location=top.getModuleUrl(top.TS.PATH_typo3+"'.$subNavFrameScript.'"); 00324 } 00325 } else { 00326 top.content.location=top.TS.PATH_typo3+( 00327 top.nextLoadModuleUrl? 00328 "'.($prefix?$this->wrapLinkWithAB($link).'&exScript=':'').'listframe_loader.php": 00329 "'.$this->wrapLinkWithAB($link).'"'.$addJS.'+additionalGetVariables 00330 ); 00331 top.fsMod.currentMainLoaded="'.$moduleName.'"; 00332 top.currentSubScript="'.$origLink.'"; 00333 } 00334 '; 00335 } 00336 $selectItems[] = '<option value="top.goToModule(\''.$moduleName.'_'.$subName.'\');">'.htmlspecialchars('- '.$label).'</option>'; 00337 $onClickString = htmlspecialchars('top.goToModule(\''.$moduleName.'_'.$subName.'\');'.$onBlur.'return false;'); 00338 00339 $flabel = '<a href="#" onclick="'.$onClickString.'"'.$label_descr.'>'.htmlspecialchars($label).'</a>'; 00340 00341 $mIcons[] = '<a href="#" onclick="'.$onClickString.'"'.$label_descr.' class="c-subitem" id="'.$moduleCSSId.'">'.$descr3_imageCode.'</a>'; 00342 00343 $JScmd.= ' 00344 top.highlightModuleMenuItem("'.$moduleCSSId.'");'; 00345 $mJScmds[] = "case '".$moduleName.'_'.$subName."': \n ".$JScmd." \n break;"; 00346 } 00347 00348 $subCode.=' 00349 <tr class="c-subitem-row" id="'.$moduleCSSId.'"> 00350 <td></td> 00351 <td align="center">'.(!$BE_USER->uc['hideSubmoduleIcons']?$imageCode:'').'</td> 00352 <td class="c-subitem-label">'.$flabel.'</td> 00353 </tr>'; 00354 00355 // For "About modules": 00356 $moduleLabel = htmlspecialchars($LANG->moduleLabels['labels'][$subKey.'label']); 00357 $moduleLabelHtml = !empty($moduleLabel) ? '<strong>' . $moduleLabel . '</strong><br />' : ''; 00358 $moduleDescription = $LANG->moduleLabels['labels'][$subKey.'descr']; 00359 00360 $descrCode.=' 00361 <tr class="c-subitem-row"> 00362 <td align="center">'.$imageCode.'</td> 00363 <td>'.$flabel.' </td>'; 00364 00365 if (!empty($moduleLabel) || !empty($moduleDescription)) { 00366 $descrCode .= ' 00367 <td class="module-description">' . $moduleLabelHtml . $moduleDescription . '</td>'; 00368 } else { 00369 $descrCode .= ' 00370 <td> </td>'; 00371 } 00372 00373 $descrCode .= ' 00374 </tr>'; 00375 00376 // Possibly adding a divider line 00377 $c++; 00378 if ($c<count($moduleInfo['sub'])) { 00379 // Divider 00380 $subCode.=' 00381 <tr class="c-divrow"> 00382 <td colspan="3"><img'.t3lib_iconWorks::skinImg($backPath,'gfx/altmenuline.gif','width="105" height="3"').' alt="" /></td> 00383 </tr>'; 00384 } 00385 } 00386 // Spacer gif for top menu: 00387 if (count($theModules)>$mC) { 00388 $mIcons[]='<img src="'.$backPath.'gfx/acm_spacer2.gif" width="8" height="12" hspace="3" alt="" />'; 00389 } 00390 } 00391 00392 if (!empty($subCode)) { 00393 // Add spacers after each main section: 00394 $subCode .= ' 00395 <tr class="c-endrow"> 00396 <td colspan="3"></td> 00397 </tr>'; 00398 $descrCode .= ' 00399 <tr class="c-endrow"> 00400 <td colspan="3"></td> 00401 </tr>'; 00402 00403 // Add sub-code: 00404 $menuCode .= $subCode; 00405 } 00406 } 00407 // $descr==0: Ordinary vertical menu 00408 if ($menuCode) { 00409 if($collapsable == 1 || $config['expandAll'] == 1) { 00410 $collapseAllHTML = '<tr class="c-endrow"> 00411 <td></td> 00412 <td align="center"> 00413 <form action="alt_menu.php" method="get"> 00414 <input type="hidden" name="collapsableExpandAll" value="1" /> 00415 <input type="checkbox" name="expandAll" id="expandall" value="1" onclick="this.form.submit();" '.($config['expandAll']?'checked="checked"':'').' /> 00416 </form> 00417 </td> 00418 <td class="c-subitem-label"><label for="expandall">'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.expandAll',1).'</label></td> 00419 </tr>'; 00420 } else { 00421 $collapseAllHTML = ''; 00422 } 00423 00424 $final = ' 00425 00426 00427 <!-- 00428 Vertical module menu, shown in left frame of backend. 00429 --> 00430 <table border="0" cellpadding="0" cellspacing="0" id="typo3-vmenu"> 00431 '.$menuCode.' 00432 <tr class="c-endrow"> 00433 <td colspan="3">'.t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'menu_modules', $GLOBALS['BACK_PATH']).'</td></tr> 00434 '.$collapseAllHTML.' 00435 </table>'; 00436 } 00437 00438 // Output for the "About modules" module 00439 if ($descr==1) { 00440 $descrCode = ' 00441 00442 00443 <!-- 00444 Listing of modules, for Help > About modules 00445 --> 00446 <table border="0" cellpadding="0" cellspacing="0" id="typo3-about-modules"> 00447 '.$descrCode.' 00448 </table>'; 00449 $final = $descrCode; 00450 } 00451 00452 // selector-box menu 00453 if ($descr==2) { 00454 00455 // Add admin-functions for clearing caches: 00456 if ($BE_USER->isAdmin()) { 00457 $functionArray = $this->adminFunctions($backPath); 00458 if (count($functionArray)) { 00459 $selectItems[] = '<option value=""></option>'; 00460 foreach($functionArray as $fAoptions) { 00461 $selectItems[] = '<option value="'.htmlspecialchars("window.location.href='".$fAoptions['href']."';").'">[ '.htmlspecialchars($fAoptions['title']).' ]</option>'; 00462 } 00463 } 00464 } 00465 00466 // Logout item: 00467 $selectItems[] = '<option value=""></option>'; 00468 $selectItems[] = '<option value="'.htmlspecialchars("top.location='logout.php';").'">[ '.$LANG->sL('LLL:EXT:lang/locallang_core.php:buttons.logout',1).' ]</option>'; 00469 $final = ' 00470 <select name="menuselector" onchange="eval(this.options[this.selectedIndex].value);"> 00471 '.implode(' 00472 ',$selectItems).' 00473 </select>'; 00474 } 00475 // topmenu - horizontal line of icons! 00476 if ($descr==3) { 00477 $final = ''.implode('',$mIcons).''; 00478 } 00479 00480 // Output for the goToModules() function in main frameset. 00481 if ($descr==4) { 00482 $final = chr(10).implode(chr(10),$mJScmds).chr(10); 00483 } 00484 00485 // Output for TOPMENU BAR drop downs (but basically this is an array with which you can do many interesting things...) 00486 if ($descr==5) { 00487 $final = $collection; 00488 } 00489 00490 // Return result: 00491 return $final; 00492 } 00493 00494 /** 00495 * Returns a prefix used to call the navframe with parameters to call the scripts defined in the modules info array. 00496 * 00497 * @param string Module info array 00498 * @param string Submodule info array 00499 * @return string Result url string 00500 */ 00501 function getNavFramePrefix($moduleInfo, $subModuleInfo=array()) { 00502 global $BE_USER; 00503 00504 $prefix = ''; 00505 $navFrameScript = $subModuleInfo['navFrameScript'] ? $subModuleInfo['navFrameScript'] : $moduleInfo['navFrameScript']; 00506 $navFrameScriptParam = isset($subModuleInfo['navFrameScriptParam']) ? $subModuleInfo['navFrameScriptParam'] : $moduleInfo['navFrameScriptParam']; 00507 if ($navFrameScript) { 00508 $navFrameScript = t3lib_div::resolveBackPath($navFrameScript); 00509 $navFrameScript = $this->wrapLinkWithAB($navFrameScript); 00510 00511 if ($BE_USER->uc['condensedMode']) { 00512 $prefix=$navFrameScript.$navFrameScriptParam.'¤tSubScript='; 00513 } else { 00514 $prefix='alt_mod_frameset.php?'. 00515 'fW="+top.TS.navFrameWidth+"'. 00516 '&nav="+top.TS.PATH_typo3+"'.rawurlencode($navFrameScript.$navFrameScriptParam). 00517 '&script='; 00518 } 00519 } 00520 return $prefix; 00521 } 00522 00523 /** 00524 * Returns $Ifilename readable for script in PATH_typo3. 00525 * That means absolute names are just returned while relative names are prepended with $backPath (pointing back to typo3/ dir) 00526 * 00527 * @param string Icon filename 00528 * @param string Back path 00529 * @return string Result 00530 * @see mIconFilename() 00531 */ 00532 function mIconFile($Ifilename,$backPath) { 00533 if (t3lib_div::isAbsPath($Ifilename)) { 00534 return $Ifilename; 00535 } 00536 return $backPath.$Ifilename; 00537 } 00538 00539 /** 00540 * Returns relative filename to the $Ifilename (for use in img-tags) 00541 * 00542 * @param string Icon filename 00543 * @param string Back path 00544 * @return string Result 00545 * @see mIconFile() 00546 */ 00547 function mIconFilename($Ifilename,$backPath) { 00548 if (t3lib_div::isAbsPath($Ifilename)) { 00549 $Ifilename = '../'.substr($Ifilename,strlen(PATH_site)); 00550 } 00551 return $backPath.$Ifilename; 00552 } 00553 00554 /** 00555 * Returns logout button. 00556 * 00557 * @return string 00558 */ 00559 function topButtons() { 00560 global $LANG; 00561 00562 $label = $GLOBALS['BE_USER']->user['ses_backuserid'] ? 'LLL:EXT:lang/locallang_core.php:buttons.exit' : 'LLL:EXT:lang/locallang_core.php:buttons.logout'; 00563 $out.= '<form action="logout.php" target="_top"><input type="submit" value="'.$LANG->sL($label,1).'" /></form>'; 00564 return $out; 00565 } 00566 00567 /** 00568 * Returns logout button. 00569 * 00570 * @return string 00571 */ 00572 function adminButtons() { 00573 global $LANG; 00574 00575 $functionArray = $this->adminFunctions(''); 00576 00577 $icons=array(); 00578 foreach($functionArray as $fAoptions) { 00579 $icons[]= '<a href="'.htmlspecialchars($fAoptions['href']).'">'.$fAoptions['icon'].'</a>'; 00580 } 00581 00582 return implode('',$icons); 00583 } 00584 00585 /** 00586 * Returns array with parts from which the admin functions can be constructed. 00587 * 00588 * @param string Backpath. 00589 * @return array 00590 */ 00591 function adminFunctions($backPath) { 00592 global $LANG,$BE_USER,$TYPO3_CONF_VARS; 00593 00594 $functions=array(); 00595 00596 // Clearing of cache-files in typo3conf/ + menu 00597 if ($TYPO3_CONF_VARS['EXT']['extCache']) { 00598 $title = $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.clearCache_allTypo3Conf'); 00599 $functions[]=array( 00600 'id' => 'temp_CACHED', 00601 'title' => $title, 00602 'href' => $backPath . 00603 'tce_db.php?vC=' . $BE_USER->veriCode() . 00604 '&redirect=' . rawurlencode(t3lib_div::getIndpEnv('TYPO3_REQUEST_SCRIPT')) . 00605 '&cacheCmd=temp_CACHED' . 00606 t3lib_BEfunc::getUrlToken('tceAction'), 00607 'icon' => '<img'.t3lib_iconWorks::skinImg($backPath,'gfx/clear_cache_files_in_typo3c.gif','width="21" height="18"').' title="'.htmlspecialchars($title).'" alt="" />' 00608 ); 00609 } 00610 00611 // Clear all page cache 00612 $title = $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.clearCache_all'); 00613 $functions[]=array( 00614 'id' => 'all', 00615 'title' => $title, 00616 'href' => $backPath . 'tce_db.php?vC=' . $BE_USER->veriCode() . 00617 '&redirect=' . rawurlencode(t3lib_div::getIndpEnv('TYPO3_REQUEST_SCRIPT')) . 00618 '&cacheCmd=all' . 00619 t3lib_BEfunc::getUrlToken('tceAction'), 00620 'icon' => '<img'.t3lib_iconWorks::skinImg($backPath,'gfx/clear_all_cache.gif','width="21" height="18"').' title="'.htmlspecialchars($title).'" alt="" />' 00621 ); 00622 00623 // Return functions 00624 return $functions; 00625 } 00626 00627 /** 00628 * Appends a '?' if there is none in the string already 00629 * 00630 * @param string Link URL 00631 * @return string 00632 */ 00633 function wrapLinkWithAB($link) { 00634 if (!strstr($link,'?')) { 00635 return $link.'?'; 00636 } else return $link; 00637 } 00638 00639 /** 00640 * Generates some JavaScript code for the frame. 00641 * 00642 * @return string goToModule javascript function 00643 */ 00644 function generateMenuJScode($loadedModules, $menuType = 4) { 00645 global $TBE_TEMPLATE; 00646 00647 $goToModuleSwitch = $this->topMenu($loadedModules, 0, '', $menuType); 00648 00649 $jsCode = ' 00650 /** 00651 * Function used to switch switch module. 00652 */ 00653 var currentModuleLoaded = ""; 00654 function goToModule(modName,cMR_flag,addGetVars) { // 00655 var additionalGetVariables = ""; 00656 if (addGetVars) additionalGetVariables = addGetVars; 00657 00658 var cMR = 0; 00659 if (cMR_flag) cMR = 1; 00660 00661 currentModuleLoaded = modName; 00662 00663 switch(modName) {'.$goToModuleSwitch.' 00664 } 00665 }'; 00666 00667 return $jsCode; 00668 } 00669 } 00670 00671 00672 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/class.alt_menu_functions.inc'])) { 00673 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/class.alt_menu_functions.inc']); 00674 } 00675 ?>
1.8.0