00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034
00035
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073 class alt_menu_functions {
00074
00075
00076 var $fsMod = array();
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094 function topMenu($theModules,$dontLink=0,$backPath='',$descr=0) {
00095 global $LANG, $TBE_TEMPLATE, $BE_USER;
00096
00097
00098 $tmpArr = $BE_USER->getTSConfig('options.moduleMenuCollapsable');
00099 $collapsable = (isset($tmpArr['value']) && $tmpArr['value']==0) ? 0 : 1;
00100 unset($tmpArr);
00101
00102
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
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
00136 if($config['expandAll'] == 1) {
00137 foreach($config as $key => $value) {
00138 if($key != 'expandAll')
00139 $config[$key] = 0;
00140 }
00141 }
00142 }
00143
00144
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
00155 if (is_array($moduleInfo['sub'])) {
00156
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;
00165 $link = '';
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
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
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>';
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=' <b>'.$label.'</b> ';
00211
00212
00213
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
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
00228 $descrCode.='
00229 <tr class="c-mainitem bgColor4">
00230 <td colspan="3">'.$imageCode.$label.'</td>
00231 </tr>';
00232
00233
00234
00235 if($collapsable == 1 && $config[$moduleName] == 1 && $descr == 0 && $config['expandAll'] != 1) {
00236 unset($moduleInfo['sub']);
00237 }
00238
00239
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
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
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
00290 $addJS = '';
00291 if ($moduleInfo['navFrameScript']) {$addJS = "+'&id='+top.rawurlencodeAndRemoveSiteUrl(top.fsMod.recentIds['" . $moduleName . "'])";}
00292
00293
00294 if ($link && !$dontLink) {
00295
00296 if ($addJS && $BE_USER->uc['condensedMode']) {$addJS.= "+(cMR?'&cMR=1':'')";}
00297
00298
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
00310 if (!$BE_USER->uc['condensedMode'] && $moduleInfo['navFrameScript']) {
00311
00312
00313 $subNavFrameScript = $subInfo['navFrameScript'] ? $subInfo['navFrameScript'] : $moduleInfo['navFrameScript'];
00314 $subNavFrameScript = t3lib_div::resolveBackPath($subNavFrameScript);
00315
00316
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
00358 $descrCode.='
00359 <tr class="c-subitem-row">
00360 <td align="center">'.$imageCode.'</td>
00361 <td>'.$flabel.' </td>
00362 <td><strong>'.htmlspecialchars($LANG->moduleLabels['labels'][$subKey.'label']).'</strong><br />'.$LANG->moduleLabels['labels'][$subKey.'descr'].'</td>
00363 </tr>';
00364
00365
00366 $c++;
00367 if ($c<count($moduleInfo['sub'])) {
00368
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
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
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
00392 $menuCode.=$subCode;
00393 }
00394
00395
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
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
00441 if ($descr==2) {
00442
00443
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
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
00464 if ($descr==3) {
00465 $final = ''.implode('',$mIcons).'';
00466 }
00467
00468
00469 if ($descr==4) {
00470 $final = chr(10).implode(chr(10),$mJScmds).chr(10);
00471 }
00472
00473
00474 if ($descr==5) {
00475 $final = $collection;
00476 }
00477
00478
00479 return $final;
00480 }
00481
00482
00483
00484
00485
00486
00487
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.'¤tSubScript=';
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
00513
00514
00515
00516
00517
00518
00519
00520 function mIconFile($Ifilename,$backPath) {
00521 if (t3lib_div::isAbsPath($Ifilename)) {
00522 return $Ifilename;
00523 }
00524 return $backPath.$Ifilename;
00525 }
00526
00527
00528
00529
00530
00531
00532
00533
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
00544
00545
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
00557
00558
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
00575
00576
00577
00578
00579 function adminFunctions($backPath) {
00580 global $LANG,$BE_USER,$TYPO3_CONF_VARS;
00581
00582 $functions=array();
00583
00584
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
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
00605 return $functions;
00606 }
00607
00608
00609
00610
00611
00612
00613
00614 function wrapLinkWithAB($link) {
00615 if (!strstr($link,'?')) {
00616 return $link.'?';
00617 } else return $link;
00618 }
00619
00620
00621
00622
00623
00624
00625 function generateMenuJScode($loadedModules, $menuType = 4) {
00626 global $TBE_TEMPLATE;
00627
00628 $goToModuleSwitch = $this->topMenu($loadedModules, 0, '', $menuType);
00629
00630 $jsCode = '
00631
00632
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 ?>