[BUGFIX] sysext recycler: Typo in language label
[Packages/TYPO3.CMS.git] / typo3 / class.alt_menu_functions.inc
1 <?php
2 /***************************************************************
3 *  Copyright notice
4 *
5 *  (c) 1999-2009 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  * Class for generation of the module menu.
29  * Will make the vertical, horizontal, selectorbox based menus AND the "about modules" display.
30  * Basically it traverses the module structure and generates output based on that.
31  *
32  * Revised for TYPO3 3.6 2/2003 by Kasper Skårhøj
33  * XHTML compliant content
34  *
35  * @author      Kasper Skårhøj <kasperYYYY@typo3.com>
36  */
37 /**
38  * [CLASS/FUNCTION INDEX of SCRIPT]
39  *
40  *
41  *
42  *   73: class alt_menu_functions
43  *   94:     function topMenu($theModules,$dontLink=0,$backPath='',$descr=0)
44  *  473:     function getNavFramePrefix($moduleInfo, $subModuleInfo=array())
45  *  504:     function mIconFile($Ifilename,$backPath)
46  *  519:     function mIconFilename($Ifilename,$backPath)
47  *  531:     function topButtons()
48  *  544:     function adminButtons()
49  *  563:     function adminFunctions($backPath)
50  *  596:     function wrapLinkWithAB($link)
51  *
52  * TOTAL FUNCTIONS: 8
53  * (This index is automatically created/updated by the extension "extdeveval")
54  *
55  */
56
57
58
59
60
61
62
63
64
65 /**
66  * Class with menu functions
67  *
68  * @author      Kasper Skårhøj <kasperYYYY@typo3.com>
69  * @package TYPO3
70  * @subpackage core
71  */
72 class alt_menu_functions {
73
74                 // Internal
75         var $fsMod = array();
76
77         /**
78          * Creates the menu of modules.
79          *
80          * $descr determines the type of menu made:
81          *              0 = Ordinary vertical menu
82          *              1 = Descriptions for 'About modules' display
83          *              2 = selector-box menu
84          *              3 = topmenu - horizontal line of icons!
85          *              4 = part of JavaScript switch contruct for alt_main.php frameset.
86          *
87          * @param       array           $theModules is the output from load_modules class ($this->loadModules->modules)
88          * @param       boolean         $dontLink == TRUE will prevent the output from being linked with A-tags (used in the 'beuser' extension)
89          * @param       string          $backPath must be the 'backPath' to PATH_typo3 from where the menu is displayed.
90          * @param       integer         $descr determines the type of menu made (see above)
91          * @return      string          The menu HTML
92          */
93         function topMenu($theModules,$dontLink=0,$backPath='',$descr=0) {
94
95                         // By default module sections are collapsable, only if they are explicitly turned off via TSconfig, they are not:
96                 $tmpArr = $GLOBALS['BE_USER']->getTSConfig('options.moduleMenuCollapsable');
97                 $collapsable = (isset($tmpArr['value']) && $tmpArr['value']==0) ? 0 : 1;
98                 unset($tmpArr);
99
100                         // Initialize vars:
101                 $final='';
102                 $menuCode='';
103                 $descrCode='';
104                 $collection=array();
105                 $menuCode_sub='';
106                 $selectItems=array();
107                 $mIcons=array();
108                 $mJScmds=array();
109                 $onBlur=$GLOBALS['CLIENT']['FORMSTYLE'] ? 'this.blur();' : '';
110
111                 $selectItems[] = '<option value="">[ '.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:buttons.selMenu_modules',1).' ]</option>';
112                 $mC=0;
113
114                         // Get collapsed configuration
115                 if ($collapsable == 1) {
116                         $config = is_array ($GLOBALS['BE_USER']->uc['moduleData']['alt_menu.php']) ? $GLOBALS['BE_USER']->uc['moduleData']['alt_menu.php'] : array();
117                         $collapsedOverride = t3lib_div::_GP('collapsedOverride');
118                         if (is_array ($collapsedOverride)) {
119                                 $config = array_merge ($config, $collapsedOverride);
120                         }
121
122                         if (t3lib_div::_GP('collapsableExpandAll') == 1) {
123                                 $config['expandAll'] = t3lib_div::_GP('expandAll');
124                         }
125
126                         if ($config['expandAll'] && is_array($collapsedOverride)) {
127                                 $config = $collapsedOverride;
128                         }
129
130                         $GLOBALS['BE_USER']->uc['moduleData']['alt_menu.php'] = $config;
131                         $GLOBALS['BE_USER']->writeUC($GLOBALS['BE_USER']->uc);
132
133                                 // all items have to be expanded when expandAll is set
134                         if($config['expandAll'] == 1) {
135                                 foreach($config as $key => $value) {
136                                         if($key != 'expandAll')
137                                                 $config[$key] = 0;
138                                 }
139                         }
140                 }
141
142                         // Traverse array with modules
143                 foreach ($theModules as $moduleName => $moduleInfo) {
144                         $mC++;
145
146                         $prefix = $this->getNavFramePrefix($moduleInfo);
147                         if ($prefix) {
148                                 $this->fsMod[]='fsMod.recentIds["'.$moduleName.'"]="";';
149                         }
150
151                                 // If there are submodules:
152                         if (is_array($moduleInfo['sub']))       {
153                                         // Finding the default module to display
154                                 if ($moduleInfo['defaultMod'])  {
155                                         $link = $moduleInfo['sub'][$moduleInfo['defaultMod']]['script'];
156                                 } else {
157                                         reset($moduleInfo['sub']);
158                                         $subTemp = current($moduleInfo['sub']);
159                                         $link = $subTemp['script'];
160                                 }
161                                 $link_sub = 1;  // Tells that the main modules links to a submodule
162                                 $link = '';     // Does not link to submodules...
163                         } else {
164                                 $link = $moduleInfo['script'];
165                                 $link_sub = 0;
166                         }
167
168                         $link = t3lib_div::resolveBackPath($link);
169
170                         $moduleKey = $moduleName.'_tab';
171                         $moduleCSSId = 'ID_'.t3lib_div::md5int($moduleName);
172
173                         $collection[$moduleKey] = array(
174                                 'moduleName' => $moduleName,
175                                 'title' => $GLOBALS['LANG']->moduleLabels['tabs'][$moduleKey],
176                                 'onclick' => 'top.goToModule(\''.$moduleName.'\');',
177                         );
178
179                                 // Creating image icon
180                         $image = @getimagesize($this->mIconFile($GLOBALS['LANG']->moduleLabels['tabs_images'][$moduleKey],$backPath));
181                         $imageCode='';
182                         $descr3_title = $GLOBALS['LANG']->moduleLabels['tabs'][$moduleKey].' ';
183                         if ($image)     {
184                                 $Ifilename = $this->mIconFilename($GLOBALS['LANG']->moduleLabels['tabs_images'][$moduleKey],$backPath);
185                                 $collection[$moduleKey]['icon'] = array($Ifilename, $image[3]);
186                                 $imageCode = '<img src="'.$Ifilename.'" '.$image[3].' alt="" />';
187                                 $descr3_imageCode = '<img src="'.$Ifilename.'" '.$image[3].' title="'.htmlspecialchars($descr3_title).'" alt="" />';
188                         } else {
189                                 $descr3_imageCode = '<img'.t3lib_iconWorks::skinImg($backPath,'gfx/dummy_module.gif','width="14" height="12"').' title="'.htmlspecialchars($descr3_title).'" alt="" />';
190                         }
191
192                                 // Creating the various links:
193                         $label = $GLOBALS['LANG']->moduleLabels['tabs'][$moduleKey];
194                         if ($link && $prefix)   $link=$prefix.rawurlencode($link);
195                         if ($link && !$dontLink)        {
196                                 $label = '<a href="#" onclick="top.goToModule(\''.$moduleName.'\');'.$onBlur.'return false;">'.$label.'</a>';   //  && !$link_sub
197
198                                 $mIcons[] = '<a href="#" onclick="top.goToModule(\''.$moduleName.'\');'.$onBlur.'return false;" class="c-mainitem" id="'.$moduleCSSId.'">'.$descr3_imageCode.'</a>';
199
200                                 $JScmd = '
201                                                 top.content.location=top.getModuleUrl(top.TS.PATH_typo3+"'.$this->wrapLinkWithAB($link).'"+additionalGetVariables);
202                                                 top.highlightModuleMenuItem("'.$moduleCSSId.'",1);';
203                                 $mJScmds[] = "case '".$moduleName."': \n ".$JScmd." \n break;";
204                         }
205
206                         $selectItems[] = '<option value="top.goToModule(\''.$moduleName.'\');">'.htmlspecialchars($GLOBALS['LANG']->moduleLabels['tabs'][$moduleKey]).'</option>';
207                         $label='&nbsp;<strong>'.$label.'</strong>&nbsp;';
208
209
210                                 // make menu collapsable
211                         if($collapsable == 1 && is_array($moduleInfo['sub'])) {
212                                 $collapseJS = 'onclick="window.location.href=\'alt_menu.php?collapsedOverride['.$moduleName.']='.($config[$moduleName] ? '0' : '1').'\'"';
213                                 $collapseIcon = t3lib_iconWorks::getSpriteIcon('actions-view-table-' . ($config[$moduleName] ? 'expand' : 'collapse'), array('class' => 'c-iconCollapse'));
214                         } else {
215                                 $collapseJS = $collapseIcon = '';
216                         }
217
218                                 // Creating a main item for the vertical menu (descr=0)
219                         $menuCode.='
220                                                 <tr class="c-mainitem" id="'.$moduleCSSId.'">
221                                                         <td colspan="3" '.$collapseJS.' >'.$imageCode.'<span class="c-label">'.$label.'</span>'.$collapseIcon.'</td>
222                                                 </tr>';
223
224                                 // Code for "About modules"
225                         $descrCode.='
226                                                 <tr class="c-mainitem">
227                                                         <td colspan="3">'.$imageCode.$label.'</td>
228                                                 </tr>';
229
230
231                                 // Hide submodules when collapsed:
232                         if($collapsable == 1 && $config[$moduleName] == 1 && $descr == 0 && $config['expandAll'] != 1) {
233                                 unset($moduleInfo['sub']);
234                         }
235
236                                 // Traversing submodules
237                         $subCode='';
238                         if (is_array($moduleInfo['sub']))       {
239                                 $collection[$moduleKey]['subitems'] = array();
240                                 $c=0;
241                                 foreach ($moduleInfo['sub'] as $subName => $subInfo) {
242                                         if ($c==0)              {
243                                                 $subCode.='
244                                                                 <tr class="c-first">
245                                                                         <td colspan="3"></td>
246                                                                 </tr>';
247                                                 $descrCode.='
248                                                                 <tr class="c-first">
249                                                                         <td colspan="3"></td>
250                                                                 </tr>';
251                                         }
252
253                                         $link = t3lib_div::resolveBackPath($subInfo['script']);
254                                         $prefix = $this->getNavFramePrefix($moduleInfo, $subInfo);
255
256                                         $subKey = $moduleName.'_'.$subName.'_tab';
257                                         $moduleCSSId = 'ID_'.t3lib_div::md5int($moduleName.'_'.$subName);
258
259                                         $collection[$moduleKey]['subitems'][$subKey] = array(
260                                                 'moduleName' => $moduleName.'_'.$subName,
261                                                 'title' => $GLOBALS['LANG']->moduleLabels['tabs'][$subKey],
262                                                 'onclick' => 'top.goToModule(\''.$moduleName.'_'.$subName.'\');',
263                                         );
264
265                                                 // Creating image icon
266                                         $image = @getimagesize($this->mIconFile($GLOBALS['LANG']->moduleLabels['tabs_images'][$subKey],$backPath));
267                                         $imageCode='';
268                                         $descr3_title = $GLOBALS['LANG']->moduleLabels['tabs'][$subKey].': '.$GLOBALS['LANG']->moduleLabels['labels'][$subKey.'label'];
269                                         if ($image)     {
270                                                 $Ifilename = $this->mIconFilename($GLOBALS['LANG']->moduleLabels['tabs_images'][$subKey],$backPath);
271                                                 $collection[$moduleKey]['subitems'][$subKey]['icon'] = array($Ifilename, $image[3]);
272                                                 $imageCode = '<img src="'.$Ifilename.'" '.$image[3].' title="'.htmlspecialchars($GLOBALS['LANG']->moduleLabels['labels'][$subKey.'label']).'" alt="" />';
273                                                 $descr3_imageCode = '<img src="'.$Ifilename.'" '.$image[3].' title="'.htmlspecialchars($descr3_title).'" alt="" />';
274                                         } else {
275                                                 $descr3_imageCode = '<img'.t3lib_iconWorks::skinImg($backPath,'gfx/dummy_module.gif','width="14" height="12"').' title="'.htmlspecialchars($descr3_title).'" alt="" />';
276                                         }
277
278                                                 // Label for submodule:
279                                         $label = $GLOBALS['LANG']->moduleLabels['tabs'][$subKey];
280                                         $label_descr = ' title="'.htmlspecialchars($GLOBALS['LANG']->moduleLabels['labels'][$subKey.'label']).'"';
281                                         $flabel = htmlspecialchars($label);
282                                         $origLink = $link;
283                                         if ($link && $prefix)   $link=$prefix.rawurlencode($link);
284
285                                                 // Setting additional JavaScript if frameset script:
286                                         $addJS = '';
287                                         if ($moduleInfo['navFrameScript'])      {$addJS = "+'&id='+top.rawurlencodeAndRemoveSiteUrl(top.fsMod.recentIds['" . $moduleName . "'])";}
288
289                                                 // If there is a script to link to (and linking is not disabled.
290                                         if ($link && !$dontLink)        {
291                                                         // For condensed mode, send &cMR parameter to frameset script.
292                                                 if ($addJS && $GLOBALS['BE_USER']->uc['condensedMode']) {$addJS.=  "+(cMR?'&cMR=1':'')";}
293
294                                                         // Command for the selector box:
295                                                 $JScmd = '
296                                                                 top.content.location=top.getModuleUrl(top.TS.PATH_typo3+"'.$this->wrapLinkWithAB($link).'"'.$addJS.'+additionalGetVariables);
297                                                                 top.fsMod.currentMainLoaded="'.$moduleName.'";
298                                                                 ';
299
300                                                 if ($subInfo['navFrameScript']) {
301                                                         $JScmd.='
302                                                                 top.currentSubScript="'.$origLink.'";';
303                                                 }
304
305                                                         // If there is a frameset script in place:
306                                                 if (!$GLOBALS['BE_USER']->uc['condensedMode'] && $moduleInfo['navFrameScript']) {
307
308                                                                 // use special nav script from sub module, otherwise from the main module
309                                                         $subNavFrameScript = $subInfo['navFrameScript'] ? $subInfo['navFrameScript'] : $moduleInfo['navFrameScript'];
310                                                         $subNavFrameScript = t3lib_div::resolveBackPath($subNavFrameScript);
311
312                                                                 // add GET params for sub module to the nav script
313                                                         $subNavFrameScript = $this->wrapLinkWithAB($subNavFrameScript).$subInfo['navFrameScriptParam'];
314
315                                                         $JScmd = '
316                                                                 if (top.content.list_frame && top.fsMod.currentMainLoaded=="'.$moduleName.'") {
317                                                                         top.currentSubScript="'.$origLink.'";
318                                                                         top.content.list_frame.location=top.getModuleUrl(top.TS.PATH_typo3+"'.$this->wrapLinkWithAB($origLink).'"'.$addJS.'+additionalGetVariables);
319                                                                         if(top.currentSubNavScript!="'.$subNavFrameScript.'") {
320                                                                                 top.currentSubNavScript="'.$subNavFrameScript.'";
321                                                                                 top.content.nav_frame.location=top.getModuleUrl(top.TS.PATH_typo3+"'.$subNavFrameScript.'");
322                                                                         }
323                                                                 } else {
324                                                                         top.content.location=top.TS.PATH_typo3+(
325                                                                                 top.nextLoadModuleUrl?
326                                                                                 "'.($prefix?$this->wrapLinkWithAB($link).'&exScript=':'').'listframe_loader.php":
327                                                                                 "'.$this->wrapLinkWithAB($link).'"'.$addJS.'+additionalGetVariables
328                                                                         );
329                                                                         top.fsMod.currentMainLoaded="'.$moduleName.'";
330                                                                         top.currentSubScript="'.$origLink.'";
331                                                                 }
332                                                                 ';
333                                                 }
334                                                 $selectItems[] = '<option value="top.goToModule(\''.$moduleName.'_'.$subName.'\');">'.htmlspecialchars('- '.$label).'</option>';
335                                                 $onClickString = htmlspecialchars('top.goToModule(\''.$moduleName.'_'.$subName.'\');'.$onBlur.'return false;');
336
337                                                 $flabel = '<a href="#" onclick="'.$onClickString.'"'.$label_descr.'>'.htmlspecialchars($label).'</a>';
338
339                                                 $mIcons[] = '<a href="#" onclick="'.$onClickString.'"'.$label_descr.' class="c-subitem" id="'.$moduleCSSId.'">'.$descr3_imageCode.'</a>';
340
341                                                 $JScmd.= '
342                                                                 top.highlightModuleMenuItem("'.$moduleCSSId.'");';
343                                                 $mJScmds[] = "case '".$moduleName.'_'.$subName."': \n ".$JScmd." \n break;";
344                                         }
345
346                                         $subCode.='
347                                                         <tr class="c-subitem-row" id="'.$moduleCSSId.'">
348                                                                 <td></td>
349                                                                 <td align="center">'.(!$GLOBALS['BE_USER']->uc['hideSubmoduleIcons']?$imageCode:'').'</td>
350                                                                 <td class="c-subitem-label">'.$flabel.'</td>
351                                                         </tr>';
352
353                                                 // For "About modules":
354                                         $moduleLabel = htmlspecialchars($GLOBALS['LANG']->moduleLabels['labels'][$subKey.'label']);
355                                         $moduleLabelHtml = !empty($moduleLabel) ? '<strong>' . $moduleLabel . '</strong><br />' : '';
356                                         $moduleDescription = $GLOBALS['LANG']->moduleLabels['labels'][$subKey.'descr'];
357
358                                         $descrCode.='
359                                                         <tr class="c-subitem-row">
360                                                                 <td align="center">'.$imageCode.'</td>
361                                                                 <td>'.$flabel.'&nbsp;&nbsp;</td>';
362
363                                         if (!empty($moduleLabel) || !empty($moduleDescription)) {
364                                                 $descrCode .= '
365                                                                 <td class="module-description">' . $moduleLabelHtml . $moduleDescription . '</td>';
366                                         } else {
367                                                 $descrCode .= '
368                                                                 <td>&nbsp;</td>';
369                                         }
370
371                                         $descrCode .= '
372                                                         </tr>';
373
374                                                 // Possibly adding a divider line
375                                         $c++;
376                                         if ($c<count($moduleInfo['sub']))       {
377                                                         // Divider
378                                                 $subCode.='
379                                                         <tr class="c-divrow">
380                                                                 <td colspan="3"><img'.t3lib_iconWorks::skinImg($backPath,'gfx/altmenuline.gif','width="105" height="3"').' alt="" /></td>
381                                                         </tr>';
382                                         }
383                                 }
384                                         // Spacer gif for top menu:
385                                 if (count($theModules)>$mC)     {
386                                         $mIcons[]='<img src="'.$backPath.'gfx/acm_spacer2.gif" width="8" height="12" hspace="3" alt="" />';
387                                 }
388                         }
389
390                         if (!empty($subCode)) {
391                                         // Add spacers after each main section:
392                                 $subCode .= '
393                                                 <tr class="c-endrow">
394                                                         <td colspan="3"></td>
395                                                 </tr>';
396                                 $descrCode .= '
397                                                 <tr class="c-endrow">
398                                                         <td colspan="3"></td>
399                                                 </tr>';
400
401                                         // Add sub-code:
402                                 $menuCode .= $subCode;
403                         }
404                 }
405                         // $descr==0:   Ordinary vertical menu
406                 if ($menuCode)  {
407                         if($collapsable == 1 || $config['expandAll'] == 1) {
408                                 $collapseAllHTML = '<tr class="c-endrow">
409                                                 <td></td>
410                                                 <td align="center">
411                                                                 <form action="alt_menu.php" method="get">
412                                                                         <input type="hidden" name="collapsableExpandAll" value="1" />
413                                                                         <input type="checkbox" name="expandAll" id="expandall" value="1" onclick="this.form.submit();" '.($config['expandAll']?'checked="checked"':'').' />
414                                                                 </form>
415                                                 </td>
416                                                 <td class="c-subitem-label"><label for="expandall">'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.expandAll',1).'</label></td>
417                                         </tr>';
418                         } else {
419                                 $collapseAllHTML = '';
420                         }
421
422                         $final = '
423
424
425                                 <!--
426                                         Vertical module menu, shown in left frame of backend.
427                                 -->
428                                 <table border="0" cellpadding="0" cellspacing="0" id="typo3-vmenu">
429                                         '.$menuCode.'
430                                         <tr class="c-endrow">
431                                                 <td colspan="3">'.t3lib_BEfunc::cshItem('xMOD_csh_corebe', 'menu_modules', $GLOBALS['BACK_PATH']).'</td></tr>
432                                         '.$collapseAllHTML.'
433                                 </table>';
434                 }
435
436                         // Output for the "About modules" module
437                 if ($descr==1)  {
438                         $descrCode = '
439
440
441                                 <!--
442                                         Listing of modules, for Help > About modules
443                                 -->
444                                 <table border="0" cellpadding="0" cellspacing="0" id="typo3-about-modules">
445                                         '.$descrCode.'
446                                 </table>';
447                         $final = $descrCode;
448                 }
449
450                         // selector-box menu
451                 if ($descr==2)  {
452
453                                 // Add admin-functions for clearing caches:
454                         if ($GLOBALS['BE_USER']->isAdmin())     {
455                                 $functionArray = $this->adminFunctions($backPath);
456                                 if (count($functionArray))      {
457                                         $selectItems[] = '<option value=""></option>';
458                                         foreach($functionArray as $fAoptions)   {
459                                                 $selectItems[] = '<option value="'.htmlspecialchars("window.location.href='".$fAoptions['href']."';").'">[ '.htmlspecialchars($fAoptions['title']).' ]</option>';
460                                         }
461                                 }
462                         }
463
464                                 // Logout item:
465                         $selectItems[] = '<option value=""></option>';
466                         $selectItems[] = '<option value="'.htmlspecialchars("top.location='logout.php';").'">[ '.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:buttons.logout',1).' ]</option>';
467                         $final = '
468                                 <select name="menuselector" onchange="eval(this.options[this.selectedIndex].value);">
469                                         '.implode('
470                                         ',$selectItems).'
471                                 </select>';
472                 }
473                         // topmenu - horizontal line of icons!
474                 if ($descr==3)  {
475                         $final = ''.implode('',$mIcons).'';
476                 }
477
478                         // Output for the goToModules() function in main frameset.
479                 if ($descr==4)  {
480                         $final = chr(10).implode(chr(10),$mJScmds).chr(10);
481                 }
482
483                         // Output for TOPMENU BAR drop downs (but basically this is an array with which you can do many interesting things...)
484                 if ($descr==5)  {
485                         $final = $collection;
486                 }
487
488                         // Return result:
489                 return $final;
490         }
491
492         /**
493          * Returns a prefix used to call the navframe with parameters to call the scripts defined in the modules info array.
494          *
495          * @param       string          Module info array
496          * @param       string          Submodule info array
497          * @return      string          Result url string
498          */
499         function getNavFramePrefix($moduleInfo, $subModuleInfo=array()) {
500                 $prefix = '';
501                 $navFrameScript = $subModuleInfo['navFrameScript'] ? $subModuleInfo['navFrameScript'] : $moduleInfo['navFrameScript'];
502                 $navFrameScriptParam = isset($subModuleInfo['navFrameScriptParam']) ? $subModuleInfo['navFrameScriptParam'] : $moduleInfo['navFrameScriptParam'];
503                 if ($navFrameScript)    {
504                         $navFrameScript = t3lib_div::resolveBackPath($navFrameScript);
505                         $navFrameScript = $this->wrapLinkWithAB($navFrameScript);
506
507                         if ($GLOBALS['BE_USER']->uc['condensedMode'])   {
508                                 $prefix=$navFrameScript.$navFrameScriptParam.'&currentSubScript=';
509                         } else {
510                                 $prefix='alt_mod_frameset.php?'.
511                                         'fW="+top.TS.navFrameWidth+"'.
512                                         '&nav="+top.TS.PATH_typo3+"'.rawurlencode($navFrameScript.$navFrameScriptParam).
513                                         '&script=';
514                         }
515                 }
516                 return $prefix;
517         }
518
519         /**
520          * Returns $Ifilename readable for script in PATH_typo3.
521          * That means absolute names are just returned while relative names are prepended with $backPath (pointing back to typo3/ dir)
522          *
523          * @param       string          Icon filename
524          * @param       string          Back path
525          * @return      string          Result
526          * @see mIconFilename()
527          */
528         function mIconFile($Ifilename,$backPath)        {
529                 if (t3lib_div::isAbsPath($Ifilename))   {
530                         return $Ifilename;
531                 }
532                 return $backPath.$Ifilename;
533         }
534
535         /**
536          * Returns relative filename to the $Ifilename (for use in img-tags)
537          *
538          * @param       string          Icon filename
539          * @param       string          Back path
540          * @return      string          Result
541          * @see mIconFile()
542          */
543         function mIconFilename($Ifilename,$backPath)    {
544                 if (t3lib_div::isAbsPath($Ifilename))   {
545                         $Ifilename = '../'.substr($Ifilename,strlen(PATH_site));
546                 }
547                 return $backPath.$Ifilename;
548         }
549
550         /**
551          * Returns logout button.
552          *
553          * @return      string
554          */
555         function topButtons()   {
556                 $label = $GLOBALS['BE_USER']->user['ses_backuserid'] ? 'LLL:EXT:lang/locallang_core.php:buttons.exit' : 'LLL:EXT:lang/locallang_core.php:buttons.logout';
557                 $out = '<form action="logout.php" target="_top"><input type="submit" value="'.$GLOBALS['LANG']->sL($label,1).'" /></form>';
558                 return $out;
559         }
560
561         /**
562          * Returns logout button.
563          *
564          * @return      string
565          */
566         function adminButtons() {
567                 $functionArray = $this->adminFunctions('');
568
569                 $icons=array();
570                 foreach($functionArray as $fAoptions)   {
571                         $icons[]= '<a href="'.htmlspecialchars($fAoptions['href']).'">'.$fAoptions['icon'].'</a>';
572                 }
573
574                 return implode('',$icons);
575         }
576
577         /**
578          * Returns array with parts from which the admin functions can be constructed.
579          *
580          * @param       string          Backpath.
581          * @return      array
582          */
583         function adminFunctions($backPath)      {
584                 $functions=array();
585
586                         // Clearing of cache-files in typo3conf/ + menu
587                 if ($GLOBALS['TYPO3_CONF_VARS']['EXT']['extCache'])     {
588                         $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.clearCache_allTypo3Conf');
589                         $functions[]=array(
590                                 'id' => 'temp_CACHED',
591                                 'title' => $title,
592                                 'href' => $backPath .
593                                                 'tce_db.php?vC=' . $GLOBALS['BE_USER']->veriCode() .
594                                                 '&redirect=' . rawurlencode(t3lib_div::getIndpEnv('TYPO3_REQUEST_SCRIPT')) .
595                                                 '&cacheCmd=temp_CACHED' .
596                                                 t3lib_BEfunc::getUrlToken('tceAction'),
597                                 'icon' => '<img'.t3lib_iconWorks::skinImg($backPath,'gfx/clear_cache_files_in_typo3c.gif','width="21" height="18"').' title="'.htmlspecialchars($title).'" alt="" />'
598                         );
599                 }
600
601                         // Clear all page cache
602                 $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.clearCache_all');
603                 $functions[]=array(
604                         'id' => 'all',
605                         'title' => $title,
606                         'href' => $backPath . 'tce_db.php?vC=' . $GLOBALS['BE_USER']->veriCode() .
607                                         '&redirect=' . rawurlencode(t3lib_div::getIndpEnv('TYPO3_REQUEST_SCRIPT')) .
608                                         '&cacheCmd=all' .
609                                         t3lib_BEfunc::getUrlToken('tceAction'),
610                         'icon' => '<img'.t3lib_iconWorks::skinImg($backPath,'gfx/clear_all_cache.gif','width="21" height="18"').' title="'.htmlspecialchars($title).'" alt="" />'
611                 );
612
613                         // Return functions
614                 return $functions;
615         }
616
617         /**
618          * Appends a '?' if there is none in the string already
619          *
620          * @param       string          Link URL
621          * @return      string
622          */
623         function wrapLinkWithAB($link)  {
624                 if (!strstr($link,'?')) {
625                         return $link.'?';
626                 } else return $link;
627         }
628
629         /**
630          * Generates some JavaScript code for the frame.
631          *
632          * @return      string  goToModule javascript function
633          */
634         function generateMenuJScode($loadedModules, $menuType = 4)      {
635                 global $TBE_TEMPLATE;
636
637                 $goToModuleSwitch = $this->topMenu($loadedModules, 0, '', $menuType);
638
639                 $jsCode = '
640         /**
641          * Function used to switch switch module.
642          */
643         var currentModuleLoaded = "";
644         function goToModule(modName,cMR_flag,addGetVars)        {       //
645                 var additionalGetVariables = "";
646                 if (addGetVars) additionalGetVariables = addGetVars;
647
648                 var cMR = 0;
649                 if (cMR_flag)   cMR = 1;
650
651                 currentModuleLoaded = modName;
652
653                 switch(modName) {'.$goToModuleSwitch.'
654                 }
655         }';
656
657                 return $jsCode;
658         }
659 }
660
661
662 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/class.alt_menu_functions.inc'])) {
663         include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/class.alt_menu_functions.inc']);
664 }
665 ?>