class.alt_menu_functions.inc

Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2008 Kasper Skaarhoj (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 4591 2008-12-22 11:56:15Z steffenk $
00033  * Revised for TYPO3 3.6 2/2003 by Kasper Skaarhoj
00034  * XHTML compliant content
00035  *
00036  * @author  Kasper Skaarhoj <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 Skaarhoj <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         reset($theModules);
00146         while(list($moduleName,$moduleInfo)=each($theModules))  {
00147             $mC++;
00148 
00149             $prefix = $this->getNavFramePrefix($moduleInfo);
00150             if ($prefix) {
00151                 $this->fsMod[]='fsMod.recentIds["'.$moduleName.'"]="";';
00152             }
00153 
00154                 // If there are submodules:
00155             if (is_array($moduleInfo['sub']))   {
00156                     // Finding the default module to display
00157                 if ($moduleInfo['defaultMod'])  {
00158                     $link = $moduleInfo['sub'][$moduleInfo['defaultMod']]['script'];
00159                 } else {
00160                     reset($moduleInfo['sub']);
00161                     $subTemp = current($moduleInfo['sub']);
00162                     $link = $subTemp['script'];
00163                 }
00164                 $link_sub = 1;  // Tells that the main modules links to a submodule
00165                 $link = ''; // Does not link to submodules...
00166             } else {
00167                 $link = $moduleInfo['script'];
00168                 $link_sub = 0;
00169             }
00170 
00171             $link = t3lib_div::resolveBackPath($link);
00172 
00173             $moduleKey = $moduleName.'_tab';
00174             $moduleCSSId = 'ID_'.t3lib_div::md5int($moduleName);
00175 
00176             $collection[$moduleKey] = array(
00177                 'moduleName' => $moduleName,
00178                 'title' => $LANG->moduleLabels['tabs'][$moduleKey],
00179                 'onclick' => 'top.goToModule(\''.$moduleName.'\');',
00180             );
00181 
00182                 // Creating image icon
00183             $image = @getimagesize($this->mIconFile($LANG->moduleLabels['tabs_images'][$moduleKey],$backPath));
00184             $imageCode='';
00185             $descr3_title = $LANG->moduleLabels['tabs'][$moduleKey].' ';
00186             if ($image) {
00187                 $Ifilename = $this->mIconFilename($LANG->moduleLabels['tabs_images'][$moduleKey],$backPath);
00188                 $collection[$moduleKey]['icon'] = array($Ifilename, $image[3]);
00189                 $imageCode = '<img src="'.$Ifilename.'" '.$image[3].' alt="" />';
00190                 $descr3_imageCode = '<img src="'.$Ifilename.'" '.$image[3].' title="'.htmlspecialchars($descr3_title).'" alt="" />';
00191             } else {
00192                 $descr3_imageCode = '<img'.t3lib_iconWorks::skinImg($backPath,'gfx/dummy_module.gif','width="14" height="12"').' title="'.htmlspecialchars($descr3_title).'" alt="" />';
00193             }
00194 
00195                 // Creating the various links:
00196             $label = $LANG->moduleLabels['tabs'][$moduleKey];
00197             if ($link && $prefix)   $link=$prefix.rawurlencode($link);
00198             if ($link && !$dontLink)    {
00199                 $label = '<a href="#" onclick="top.goToModule(\''.$moduleName.'\');'.$onBlur.'return false;">'.$label.'</a>';   //  && !$link_sub
00200 
00201                 $mIcons[] = '<a href="#" onclick="top.goToModule(\''.$moduleName.'\');'.$onBlur.'return false;" class="c-mainitem" id="'.$moduleCSSId.'">'.$descr3_imageCode.'</a>';
00202 
00203                 $JScmd = '
00204                         top.content.location=top.getModuleUrl(top.TS.PATH_typo3+"'.$this->wrapLinkWithAB($link).'"+additionalGetVariables);
00205                         top.highlightModuleMenuItem("'.$moduleCSSId.'",1);';
00206                 $mJScmds[] = "case '".$moduleName."': \n ".$JScmd." \n break;";
00207             }
00208 
00209             $selectItems[] = '<option value="top.goToModule(\''.$moduleName.'\');">'.htmlspecialchars($LANG->moduleLabels['tabs'][$moduleKey]).'</option>';
00210             $label='&nbsp;<b>'.$label.'</b>&nbsp;';
00211 
00212 
00213                 // make menu collapsable
00214             if($collapsable == 1 && is_array($moduleInfo['sub'])) {
00215                 $collapseJS = 'onclick="window.location.href=\'alt_menu.php?collapsedOverride['.$moduleName.']='.($config[$moduleName] ? '0' : '1').'\'"';
00216                 $collapseIcon = '<span class="c-iconCollapse"><img'.t3lib_iconWorks::skinImg($backPath,'gfx/ol/'.($config[$moduleName] ? 'plusbullet.gif':'minusbullet.gif'),'width="18" height="16"').' title="" alt="" /></span>';
00217             } else {
00218                 $collapseJS = $collapseIcon = '';
00219             }
00220 
00221                 // Creating a main item for the vertical menu (descr=0)
00222             $menuCode.='
00223                         <tr class="c-mainitem" id="'.$moduleCSSId.'">
00224                             <td colspan="3" '.$collapseJS.' >'.$imageCode.'<span class="c-label">'.$label.'</span>'.$collapseIcon.'</td>
00225                         </tr>';
00226 
00227                 // Code for "About modules"
00228             $descrCode.='
00229                         <tr class="c-mainitem bgColor4">
00230                             <td colspan="3">'.$imageCode.$label.'</td>
00231                         </tr>';
00232 
00233 
00234                 // Hide submodules when collapsed:
00235             if($collapsable == 1 && $config[$moduleName] == 1 && $descr == 0 && $config['expandAll'] != 1) {
00236                 unset($moduleInfo['sub']);
00237             }
00238 
00239                 // Traversing submodules
00240             $subCode='';
00241             if (is_array($moduleInfo['sub']))   {
00242                 reset($moduleInfo['sub']);
00243                 $collection[$moduleKey]['subitems'] = array();
00244                 $c=0;
00245                 while(list($subName,$subInfo)=each($moduleInfo['sub'])) {
00246                     if ($c==0)      {
00247                         $subCode.='
00248                                 <tr class="c-first">
00249                                     <td colspan="3"></td>
00250                                 </tr>';
00251                         $descrCode.='
00252                                 <tr class="c-first">
00253                                     <td colspan="3"></td>
00254                                 </tr>';
00255                     }
00256 
00257                     $link = t3lib_div::resolveBackPath($subInfo['script']);
00258                     $prefix = $this->getNavFramePrefix($moduleInfo, $subInfo);
00259 
00260                     $subKey = $moduleName.'_'.$subName.'_tab';
00261                     $moduleCSSId = 'ID_'.t3lib_div::md5int($moduleName.'_'.$subName);
00262 
00263                     $collection[$moduleKey]['subitems'][$subKey] = array(
00264                         'moduleName' => $moduleName.'_'.$subName,
00265                         'title' => $LANG->moduleLabels['tabs'][$subKey],
00266                         'onclick' => 'top.goToModule(\''.$moduleName.'_'.$subName.'\');',
00267                     );
00268 
00269                         // Creating image icon
00270                     $image = @getimagesize($this->mIconFile($LANG->moduleLabels['tabs_images'][$subKey],$backPath));
00271                     $imageCode='';
00272                     $descr3_title = $LANG->moduleLabels['tabs'][$subKey].': '.$LANG->moduleLabels['labels'][$subKey.'label'];
00273                     if ($image) {
00274                         $Ifilename = $this->mIconFilename($LANG->moduleLabels['tabs_images'][$subKey],$backPath);
00275                         $collection[$moduleKey]['subitems'][$subKey]['icon'] = array($Ifilename, $image[3]);
00276                         $imageCode = '<img src="'.$Ifilename.'" '.$image[3].' title="'.htmlspecialchars($LANG->moduleLabels['labels'][$subKey.'label']).'" alt="" />';
00277                         $descr3_imageCode = '<img src="'.$Ifilename.'" '.$image[3].' title="'.htmlspecialchars($descr3_title).'" alt="" />';
00278                     } else {
00279                         $descr3_imageCode = '<img'.t3lib_iconWorks::skinImg($backPath,'gfx/dummy_module.gif','width="14" height="12"').' title="'.htmlspecialchars($descr3_title).'" alt="" />';
00280                     }
00281 
00282                         // Label for submodule:
00283                     $label = $LANG->moduleLabels['tabs'][$subKey];
00284                     $label_descr = ' title="'.htmlspecialchars($LANG->moduleLabels['labels'][$subKey.'label']).'"';
00285                     $flabel = htmlspecialchars($label);
00286                     $origLink = $link;
00287                     if ($link && $prefix)   $link=$prefix.rawurlencode($link);
00288 
00289                         // Setting additional JavaScript if frameset script:
00290                     $addJS = '';
00291                     if ($moduleInfo['navFrameScript'])  {$addJS = "+'&id='+top.rawurlencodeAndRemoveSiteUrl(top.fsMod.recentIds['" . $moduleName . "'])";}
00292 
00293                         // If there is a script to link to (and linking is not disabled.
00294                     if ($link && !$dontLink)    {
00295                             // For condensed mode, send &cMR parameter to frameset script.
00296                         if ($addJS && $BE_USER->uc['condensedMode'])    {$addJS.=  "+(cMR?'&cMR=1':'')";}
00297 
00298                             // Command for the selector box:
00299                         $JScmd = '
00300                                 top.content.location=top.getModuleUrl(top.TS.PATH_typo3+"'.$this->wrapLinkWithAB($link).'"'.$addJS.'+additionalGetVariables);
00301                                 top.fsMod.currentMainLoaded="'.$moduleName.'";
00302                                 ';
00303 
00304                         if ($subInfo['navFrameScript']) {
00305                             $JScmd.='
00306                                 top.currentSubScript="'.$origLink.'";';
00307                         }
00308 
00309                             // If there is a frameset script in place:
00310                         if (!$BE_USER->uc['condensedMode'] && $moduleInfo['navFrameScript'])    {
00311 
00312                                 // use special nav script from sub module, otherwise from the main module
00313                             $subNavFrameScript = $subInfo['navFrameScript'] ? $subInfo['navFrameScript'] : $moduleInfo['navFrameScript'];
00314                             $subNavFrameScript = t3lib_div::resolveBackPath($subNavFrameScript);
00315 
00316                                 // add GET params for sub module to the nav script
00317                             $subNavFrameScript = $this->wrapLinkWithAB($subNavFrameScript).$subInfo['navFrameScriptParam'];
00318 
00319                             $JScmd = '
00320                                 if (top.content.list_frame && top.fsMod.currentMainLoaded=="'.$moduleName.'") {
00321                                     top.currentSubScript="'.$origLink.'";
00322                                     top.content.list_frame.location=top.getModuleUrl(top.TS.PATH_typo3+"'.$this->wrapLinkWithAB($origLink).'"'.$addJS.'+additionalGetVariables);
00323                                     if(top.currentSubNavScript!="'.$subNavFrameScript.'") {
00324                                         top.currentSubNavScript="'.$subNavFrameScript.'";
00325                                         top.content.nav_frame.location=top.getModuleUrl(top.TS.PATH_typo3+"'.$subNavFrameScript.'");
00326                                     }
00327                                 } else {
00328                                     top.content.location=top.TS.PATH_typo3+(
00329                                         top.nextLoadModuleUrl?
00330                                         "'.($prefix?$this->wrapLinkWithAB($link).'&exScript=':'').'listframe_loader.php":
00331                                         "'.$this->wrapLinkWithAB($link).'"'.$addJS.'+additionalGetVariables
00332                                     );
00333                                     top.fsMod.currentMainLoaded="'.$moduleName.'";
00334                                     top.currentSubScript="'.$origLink.'";
00335                                 }
00336                                 ';
00337                         }
00338                         $selectItems[] = '<option value="top.goToModule(\''.$moduleName.'_'.$subName.'\');">'.htmlspecialchars('- '.$label).'</option>';
00339                         $onClickString = htmlspecialchars('top.goToModule(\''.$moduleName.'_'.$subName.'\');'.$onBlur.'return false;');
00340 
00341                         $flabel = '<a href="#" onclick="'.$onClickString.'"'.$label_descr.'>'.htmlspecialchars($label).'</a>';
00342 
00343                         $mIcons[] = '<a href="#" onclick="'.$onClickString.'"'.$label_descr.' class="c-subitem" id="'.$moduleCSSId.'">'.$descr3_imageCode.'</a>';
00344 
00345                         $JScmd.= '
00346                                 top.highlightModuleMenuItem("'.$moduleCSSId.'");';
00347                         $mJScmds[] = "case '".$moduleName.'_'.$subName."': \n ".$JScmd." \n break;";
00348                     }
00349 
00350                     $subCode.='
00351                             <tr class="c-subitem-row" id="'.$moduleCSSId.'">
00352                                 <td></td>
00353                                 <td align="center">'.(!$BE_USER->uc['hideSubmoduleIcons']?$imageCode:'').'</td>
00354                                 <td class="c-subitem-label">'.$flabel.'</td>
00355                             </tr>';
00356 
00357                         // For "About modules":
00358                     $descrCode.='
00359                             <tr class="c-subitem-row">
00360                                 <td align="center">'.$imageCode.'</td>
00361                                 <td>'.$flabel.'&nbsp;&nbsp;</td>
00362                                 <td><strong>'.htmlspecialchars($LANG->moduleLabels['labels'][$subKey.'label']).'</strong><br />'.$LANG->moduleLabels['labels'][$subKey.'descr'].'</td>
00363                             </tr>';
00364 
00365                         // Possibly adding a divider line
00366                     $c++;
00367                     if ($c<count($moduleInfo['sub']))   {
00368                             // Divider
00369                         $subCode.='
00370                             <tr class="c-divrow">
00371                                 <td colspan="3"><img'.t3lib_iconWorks::skinImg($backPath,'gfx/altmenuline.gif','width="105" height="3"').' alt="" /></td>
00372                             </tr>';
00373                     }
00374                 }
00375                     // Spacer gif for top menu:
00376                 if (count($theModules)>$mC) {
00377                     $mIcons[]='<img src="'.$backPath.'gfx/acm_spacer2.gif" width="8" height="12" hspace="3" alt="" />';
00378                 }
00379             }
00380 
00381                 // Add spacers after each main section:
00382             $subCode.='
00383                     <tr class="c-endrow">
00384                         <td colspan="3"></td>
00385                     </tr>';
00386             $descrCode.='
00387                     <tr class="c-endrow">
00388                         <td colspan="3"></td>
00389                     </tr>';
00390 
00391                 // Add sub-code:
00392             $menuCode.=$subCode;
00393         }
00394 
00395             // $descr==0:   Ordinary vertical menu
00396         if ($menuCode)  {
00397             if($collapsable == 1 || $config['expandAll'] == 1) {
00398                 $collapseAllHTML = '<tr class="c-endrow">
00399                         <td></td>
00400                         <td align="center">
00401                                 <form action="alt_menu.php" method="get">
00402                                     <input type="hidden" name="collapsableExpandAll" value="1" />
00403                                     <input type="checkbox" name="expandAll" id="expandall" value="1" onclick="this.form.submit();" '.($config['expandAll']?'checked="checked"':'').' />
00404                                 </form>
00405                         </td>
00406                         <td class="c-subitem-label"><label for="expandall">'.$LANG->sL('LLL:EXT:lang/locallang_core.php:labels.expandAll',1).'</label></td>
00407                     </tr>';
00408             } else {
00409                 $collapseAllHTML = '';
00410             }
00411 
00412             $final = '
00413 
00414 
00415                 <!--
00416                     Vertical module menu, shown in left frame of backend.
00417                 -->
00418                 <table border="0" cellpadding="0" cellspacing="0" id="typo3-vmenu">
00419                     '.$menuCode.'
00420                     <tr class="c-endrow">
00421                         <td colspan="3">'.t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'menu_modules', $GLOBALS['BACK_PATH']).'</td></tr>
00422                     '.$collapseAllHTML.'
00423                 </table>';
00424         }
00425 
00426             // Output for the "About modules" module
00427         if ($descr==1)  {
00428             $descrCode = '
00429 
00430 
00431                 <!--
00432                     Listing of modules, for Help > About modules
00433                 -->
00434                 <table border="0" cellpadding="0" cellspacing="0" id="typo3-about-modules">
00435                     '.$descrCode.'
00436                 </table>';
00437             $final = $descrCode;
00438         }
00439 
00440             // selector-box menu
00441         if ($descr==2)  {
00442 
00443                 // Add admin-functions for clearing caches:
00444             if ($BE_USER->isAdmin())    {
00445                 $functionArray = $this->adminFunctions($backPath);
00446                 if (count($functionArray))  {
00447                     $selectItems[] = '<option value=""></option>';
00448                     foreach($functionArray as $fAoptions)   {
00449                         $selectItems[] = '<option value="'.htmlspecialchars("window.location.href='".$fAoptions['href']."';").'">[ '.htmlspecialchars($fAoptions['title']).' ]</option>';
00450                     }
00451                 }
00452             }
00453 
00454                 // Logout item:
00455             $selectItems[] = '<option value=""></option>';
00456             $selectItems[] = '<option value="'.htmlspecialchars("top.location='logout.php';").'">[ '.$LANG->sL('LLL:EXT:lang/locallang_core.php:buttons.logout',1).' ]</option>';
00457             $final = '
00458                 <select name="menuselector" onchange="eval(this.options[this.selectedIndex].value);">
00459                     '.implode('
00460                     ',$selectItems).'
00461                 </select>';
00462         }
00463             // topmenu - horizontal line of icons!
00464         if ($descr==3)  {
00465             $final = ''.implode('',$mIcons).'';
00466         }
00467 
00468             // Output for the goToModules() function in main frameset.
00469         if ($descr==4)  {
00470             $final = chr(10).implode(chr(10),$mJScmds).chr(10);
00471         }
00472 
00473             // Output for TOPMENU BAR drop downs (but basically this is an array with which you can do many interesting things...)
00474         if ($descr==5)  {
00475             $final = $collection;
00476         }
00477 
00478             // Return result:
00479         return $final;
00480     }
00481 
00482     /**
00483      * Returns a prefix used to call the navframe with parameters to call the scripts defined in the modules info array.
00484      *
00485      * @param   string      Module info array
00486      * @param   string      Submodule info array
00487      * @return  string      Result url string
00488      */
00489     function getNavFramePrefix($moduleInfo, $subModuleInfo=array()) {
00490         global $BE_USER;
00491 
00492         $prefix = '';
00493         $navFrameScript = $subModuleInfo['navFrameScript'] ? $subModuleInfo['navFrameScript'] : $moduleInfo['navFrameScript'];
00494         $navFrameScriptParam = isset($subModuleInfo['navFrameScriptParam']) ? $subModuleInfo['navFrameScriptParam'] : $moduleInfo['navFrameScriptParam'];
00495         if ($navFrameScript)    {
00496             $navFrameScript = t3lib_div::resolveBackPath($navFrameScript);
00497             $navFrameScript = $this->wrapLinkWithAB($navFrameScript);
00498 
00499             if ($BE_USER->uc['condensedMode'])  {
00500                 $prefix=$navFrameScript.$navFrameScriptParam.'&currentSubScript=';
00501             } else {
00502                 $prefix='alt_mod_frameset.php?'.
00503                     'fW="+top.TS.navFrameWidth+"'.
00504                     '&nav="+top.TS.PATH_typo3+"'.rawurlencode($navFrameScript.$navFrameScriptParam).
00505                     '&script=';
00506             }
00507         }
00508         return $prefix;
00509     }
00510 
00511     /**
00512      * Returns $Ifilename readable for script in PATH_typo3.
00513      * That means absolute names are just returned while relative names are prepended with $backPath (pointing back to typo3/ dir)
00514      *
00515      * @param   string      Icon filename
00516      * @param   string      Back path
00517      * @return  string      Result
00518      * @see mIconFilename()
00519      */
00520     function mIconFile($Ifilename,$backPath)    {
00521         if (t3lib_div::isAbsPath($Ifilename))   {
00522             return $Ifilename;
00523         }
00524         return $backPath.$Ifilename;
00525     }
00526 
00527     /**
00528      * Returns relative filename to the $Ifilename (for use in img-tags)
00529      *
00530      * @param   string      Icon filename
00531      * @param   string      Back path
00532      * @return  string      Result
00533      * @see mIconFile()
00534      */
00535     function mIconFilename($Ifilename,$backPath)    {
00536         if (t3lib_div::isAbsPath($Ifilename))   {
00537             $Ifilename = '../'.substr($Ifilename,strlen(PATH_site));
00538         }
00539         return $backPath.$Ifilename;
00540     }
00541 
00542     /**
00543      * Returns logout button.
00544      *
00545      * @return  string
00546      */
00547     function topButtons()   {
00548         global $LANG;
00549 
00550         $label = $GLOBALS['BE_USER']->user['ses_backuserid'] ? 'LLL:EXT:lang/locallang_core.php:buttons.exit' : 'LLL:EXT:lang/locallang_core.php:buttons.logout';
00551         $out.= '<form action="logout.php" target="_top"><input type="submit" value="'.$LANG->sL($label,1).'" /></form>';
00552         return $out;
00553     }
00554 
00555     /**
00556      * Returns logout button.
00557      *
00558      * @return  string
00559      */
00560     function adminButtons() {
00561         global $LANG;
00562 
00563         $functionArray = $this->adminFunctions('');
00564 
00565         $icons=array();
00566         foreach($functionArray as $fAoptions)   {
00567             $icons[]= '<a href="'.htmlspecialchars($fAoptions['href']).'">'.$fAoptions['icon'].'</a>';
00568         }
00569 
00570         return implode('',$icons);
00571     }
00572 
00573     /**
00574      * Returns array with parts from which the admin functions can be constructed.
00575      *
00576      * @param   string      Backpath.
00577      * @return  array
00578      */
00579     function adminFunctions($backPath)  {
00580         global $LANG,$BE_USER,$TYPO3_CONF_VARS;
00581 
00582         $functions=array();
00583 
00584             // Clearing of cache-files in typo3conf/ + menu
00585         if ($TYPO3_CONF_VARS['EXT']['extCache'])    {
00586             $title = $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.clearCache_allTypo3Conf');
00587             $functions[]=array(
00588                 'id' => 'temp_CACHED',
00589                 'title' => $title,
00590                 'href' => $backPath.'tce_db.php?vC='.$BE_USER->veriCode().'&redirect='.rawurlencode(t3lib_div::getIndpEnv('TYPO3_REQUEST_SCRIPT')).'&cacheCmd=temp_CACHED',
00591                 'icon' => '<img'.t3lib_iconWorks::skinImg($backPath,'gfx/clear_cache_files_in_typo3c.gif','width="21" height="18"').' title="'.htmlspecialchars($title).'" alt="" />'
00592             );
00593         }
00594 
00595             // Clear all page cache
00596         $title = $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.clearCache_all');
00597         $functions[]=array(
00598             'id' => 'all',
00599             'title' => $title,
00600             'href' => $backPath.'tce_db.php?vC='.$BE_USER->veriCode().'&redirect='.rawurlencode(t3lib_div::getIndpEnv('TYPO3_REQUEST_SCRIPT')).'&cacheCmd=all',
00601             'icon' => '<img'.t3lib_iconWorks::skinImg($backPath,'gfx/clear_all_cache.gif','width="21" height="18"').' title="'.htmlspecialchars($title).'" alt="" />'
00602         );
00603 
00604             // Return functions
00605         return $functions;
00606     }
00607 
00608     /**
00609      * Appends a '?' if there is none in the string already
00610      *
00611      * @param   string      Link URL
00612      * @return  string
00613      */
00614     function wrapLinkWithAB($link)  {
00615         if (!strstr($link,'?')) {
00616             return $link.'?';
00617         } else return $link;
00618     }
00619 
00620     /**
00621      * Generates some JavaScript code for the frame.
00622      *
00623      * @return  string  goToModule javascript function
00624      */
00625     function generateMenuJScode($loadedModules, $menuType = 4)  {
00626         global $TBE_TEMPLATE;
00627 
00628         $goToModuleSwitch = $this->topMenu($loadedModules, 0, '', $menuType);
00629 
00630         $jsCode = '
00631     /**
00632      * Function used to switch switch module.
00633      */
00634     var currentModuleLoaded = "";
00635     function goToModule(modName,cMR_flag,addGetVars)    {   //
00636         var additionalGetVariables = "";
00637         if (addGetVars) additionalGetVariables = addGetVars;
00638 
00639         var cMR = 0;
00640         if (cMR_flag)   cMR = 1;
00641 
00642         currentModuleLoaded = modName;
00643 
00644         switch(modName) {'.$goToModuleSwitch.'
00645         }
00646     }';
00647 
00648         return $jsCode;
00649     }
00650 }
00651 
00652 
00653 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.alt_menu_functions.inc'])  {
00654     include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.alt_menu_functions.inc']);
00655 }
00656 ?>

Generated on Sat Jan 3 04:23:28 2009 for TYPO3 API by  doxygen 1.4.7