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
00073 class alt_menu_functions {
00074
00075
00076 var $fsMod = array();
00077
00094 function topMenu($theModules,$dontLink=0,$backPath='',$descr=0) {
00095 global $LANG, $TBE_TEMPLATE, $BE_USER;
00096
00097
00098 $final='';
00099 $menuCode='';
00100 $descrCode='';
00101 $menuCode_sub='';
00102 $selectItems=array();
00103 $mIcons=array();
00104 $mJScmds=array();
00105 $onBlur=$GLOBALS['CLIENT']['FORMSTYLE'] ? 'this.blur();' : '';
00106
00107 $selectItems[] = '<option value="">[ '.$LANG->sL('LLL:EXT:lang/locallang_core.php:buttons.selMenu_modules',1).' ]</option>';
00108 $mC=0;
00109
00110
00111 if ($BE_USER->getTSConfigVal('options.disableDocModuleInAB')) {
00112 unset($theModules['doc']);
00113 }
00114
00115
00116 reset($theModules);
00117 while(list($moduleName,$moduleInfo)=each($theModules)) {
00118 $mC++;
00119
00120 $prefix=$this->getNavFramePrefix ($moduleInfo);
00121 if ($prefix) {
00122 $this->fsMod[]='fsMod.recentIds["'.$moduleName.'"]="";';
00123 }
00124
00125
00126 if (is_array($moduleInfo['sub'])) {
00127
00128 if ($moduleInfo['defaultMod']) {
00129 $link = $moduleInfo['sub'][$moduleInfo['defaultMod']]['script'];
00130 } else {
00131 reset($moduleInfo['sub']);
00132 $subTemp = current($moduleInfo['sub']);
00133 $link = $subTemp['script'];
00134 }
00135 $link_sub = 1;
00136 $link = '';
00137 } else {
00138 $link = $moduleInfo['script'];
00139 $link_sub = 0;
00140 }
00141
00142 $moduleKey = $moduleName.'_tab';
00143 $moduleCSSId = 'ID_'.t3lib_div::md5int($moduleName);
00144
00145
00146 $image = @getimagesize($this->mIconFile($LANG->moduleLabels['tabs_images'][$moduleKey],$backPath));
00147 $imageCode='';
00148 $descr3_title = $LANG->moduleLabels['tabs'][$moduleKey].' ';
00149 if ($image) {
00150 $Ifilename = $this->mIconFilename($LANG->moduleLabels['tabs_images'][$moduleKey],$backPath);
00151 $imageCode = '<img src="'.$Ifilename.'" '.$image[3].' alt="" />';
00152 $descr3_imageCode = '<img src="'.$Ifilename.'" '.$image[3].' title="'.htmlspecialchars($descr3_title).'" alt="" />';
00153 } else {
00154 $descr3_imageCode = '<img'.t3lib_iconWorks::skinImg($backPath,'gfx/dummy_module.gif','width="14" height="12"').' title="'.htmlspecialchars($descr3_title).'" alt="" />';
00155 }
00156
00157
00158 $label = $LANG->moduleLabels['tabs'][$moduleKey];
00159 if ($link && $prefix) $link=$prefix.rawurlencode($link);
00160 if ($link && !$dontLink) {
00161 $label = '<a href="#" onclick="top.goToModule(\''.$moduleName.'\');'.$onBlur.'return false;">'.$label.'</a>';
00162
00163 $mIcons[] = '<a href="#" onclick="top.goToModule(\''.$moduleName.'\');'.$onBlur.'return false;" class="c-mainitem" id="'.$moduleCSSId.'">'.$descr3_imageCode.'</a>';
00164
00165 $JScmd = '
00166 top.content.location=top.getModuleUrl(top.TS.PATH_typo3+\''.$this->wrapLinkWithAB($link).'\'+additionalGetVariables);
00167 top.highlightModuleMenuItem("'.$moduleCSSId.'",1);';
00168 $mJScmds[] = "case '".$moduleName."': \n ".$JScmd." \n break;";
00169 }
00170
00171 $selectItems[] = '<option value="top.goToModule(\''.$moduleName.'\');">'.htmlspecialchars($LANG->moduleLabels['tabs'][$moduleKey]).'</option>';
00172 $label=' <b>'.$label.'</b> ';
00173
00174
00175 $menuCode.='
00176 <tr class="c-mainitem" id="'.$moduleCSSId.'">
00177 <td colspan="3">'.$imageCode.'<span class="c-label">'.$label.'</span></td>
00178 </tr>';
00179
00180
00181 $descrCode.='
00182 <tr class="c-mainitem bgColor4">
00183 <td colspan="3">'.$imageCode.$label.'</td>
00184 </tr>';
00185
00186
00187
00188
00189
00190 $subCode='';
00191 if (is_array($moduleInfo['sub'])) {
00192 reset($moduleInfo['sub']);
00193 $c=0;
00194 while(list($subName,$subInfo)=each($moduleInfo['sub'])) {
00195 if ($c==0) {
00196 $subCode.='
00197 <tr class="c-first">
00198 <td colspan="3"></td>
00199 </tr>';
00200 $descrCode.='
00201 <tr class="c-first">
00202 <td colspan="3"></td>
00203 </tr>';
00204 }
00205
00206 $link = $subInfo['script'];
00207 $prefix=$this->getNavFramePrefix ($moduleInfo, $subInfo);
00208
00209 $subKey = $moduleName.'_'.$subName.'_tab';
00210 $moduleCSSId = 'ID_'.t3lib_div::md5int($moduleName.'_'.$subName);
00211
00212
00213 $image = @getimagesize($this->mIconFile($LANG->moduleLabels['tabs_images'][$subKey],$backPath));
00214 $imageCode='';
00215 $descr3_title = $LANG->moduleLabels['tabs'][$subKey].': '.$LANG->moduleLabels['labels'][$subKey.'label'];
00216 if ($image) {
00217 $Ifilename = $this->mIconFilename($LANG->moduleLabels['tabs_images'][$subKey],$backPath);
00218 $imageCode = '<img src="'.$Ifilename.'" '.$image[3].' title="'.htmlspecialchars($LANG->moduleLabels['labels'][$subKey.'label']).'" alt="" />';
00219 $descr3_imageCode = '<img src="'.$Ifilename.'" '.$image[3].' title="'.htmlspecialchars($descr3_title).'" alt="" />';
00220 } else {
00221 $descr3_imageCode = '<img'.t3lib_iconWorks::skinImg($backPath,'gfx/dummy_module.gif','width="14" height="12"').' title="'.htmlspecialchars($descr3_title).'" alt="" />';
00222 }
00223
00224
00225 $label = $LANG->moduleLabels['tabs'][$subKey];
00226 $label_descr = ' title="'.htmlspecialchars($LANG->moduleLabels['labels'][$subKey.'label']).'"';
00227 $flabel = htmlspecialchars($label);
00228 $origLink = $link;
00229 if ($link && $prefix) $link=$prefix.rawurlencode($link);
00230
00231
00232 $addJS = '';
00233 if ($moduleInfo['navFrameScript']) {$addJS="+'&id='+top.rawurlencode(top.fsMod.recentIds['".$moduleName."'])";}
00234
00235
00236 if ($link && !$dontLink) {
00237
00238 if ($addJS && $BE_USER->uc['condensedMode']) {$addJS.= "+(cMR?'&cMR=1':'')";}
00239
00240
00241 $JScmd = "
00242 top.content.location=top.getModuleUrl(top.TS.PATH_typo3+'".$this->wrapLinkWithAB($link)."'".$addJS.'+additionalGetVariables);
00243 top.fsMod.currentMainLoaded="'.$moduleName.'";
00244 ';
00245
00246
00247 if (!$BE_USER->uc['condensedMode'] && $moduleInfo['navFrameScript']) {
00248
00249
00250 $subNavFrameScript = $subInfo['navFrameScript'] ? $subInfo['navFrameScript'] : $moduleInfo['navFrameScript'] ;
00251
00252
00253 $subNavFrameScript = $this->wrapLinkWithAB($subNavFrameScript).$subInfo['navFrameScriptParam'];
00254
00255 $JScmd = '
00256 if (top.content.list_frame && top.fsMod.currentMainLoaded=="'.$moduleName.'") {
00257 top.currentSubScript="'.$origLink.'";
00258 top.content.list_frame.location=top.getModuleUrl(top.TS.PATH_typo3+"'.$this->wrapLinkWithAB($origLink).'"'.$addJS.'+additionalGetVariables);
00259 if(top.currentSubNavScript!="'.$subNavFrameScript.'") {
00260 top.currentSubNavScript="'.$subNavFrameScript.'";
00261 top.content.nav_frame.location=top.getModuleUrl(top.TS.PATH_typo3+"'.$subNavFrameScript.'");
00262 }
00263 } else {
00264 top.content.location=top.TS.PATH_typo3+(
00265 top.nextLoadModuleUrl?
00266 "'.($prefix?$this->wrapLinkWithAB($link).'&exScript=':'').'listframe_loader.php":
00267 "'.$this->wrapLinkWithAB($link).'"'.$addJS.'+additionalGetVariables
00268 );
00269 top.fsMod.currentMainLoaded="'.$moduleName.'";
00270 top.currentSubScript="'.$origLink.'";
00271 }
00272 ';
00273 }
00274 $selectItems[] = '<option value="top.goToModule(\''.$moduleName.'_'.$subName.'\');">'.htmlspecialchars('- '.$label).'</option>';
00275 $onClickString = htmlspecialchars('top.goToModule(\''.$moduleName.'_'.$subName.'\');'.$onBlur.'return false;');
00276
00277 $flabel = '<a href="#" onclick="'.$onClickString.'"'.$label_descr.'>'.htmlspecialchars($label).'</a>';
00278
00279 $mIcons[] = '<a href="#" onclick="'.$onClickString.'"'.$label_descr.' class="c-subitem" id="'.$moduleCSSId.'">'.$descr3_imageCode.'</a>';
00280
00281 $JScmd.= '
00282 top.highlightModuleMenuItem("'.$moduleCSSId.'");';
00283 $mJScmds[] = "case '".$moduleName.'_'.$subName."': \n ".$JScmd." \n break;";
00284 }
00285
00286 $subCode.='
00287 <tr class="c-subitem-row" id="'.$moduleCSSId.'">
00288 <td></td>
00289 <td align="center">'.(!$BE_USER->uc['hideSubmoduleIcons']?$imageCode:'').'</td>
00290 <td class="c-subitem-label">'.$flabel.'</td>
00291 </tr>';
00292
00293
00294 $descrCode.='
00295 <tr class="c-subitem-row">
00296 <td align="center">'.$imageCode.'</td>
00297 <td>'.$flabel.' </td>
00298 <td><strong>'.htmlspecialchars($LANG->moduleLabels['labels'][$subKey.'label']).'</strong><br />'.$LANG->moduleLabels['labels'][$subKey.'descr'].'</td>
00299 </tr>';
00300
00301
00302 $c++;
00303 if ($c<count($moduleInfo['sub'])) {
00304
00305 $subCode.='
00306 <tr class="c-divrow">
00307 <td colspan="3"><img'.t3lib_iconWorks::skinImg($backPath,'gfx/altmenuline.gif','width="105" height="3"').' alt="" /></td>
00308 </tr>';
00309 }
00310 }
00311
00312 if (count($theModules)>$mC) {
00313 $mIcons[]='<img src="'.$backPath.'gfx/acm_spacer2.gif" width="8" height="12" hspace="3" alt="" />';
00314 }
00315 }
00316
00317
00318 $subCode.='
00319 <tr class="c-endrow">
00320 <td colspan="3"></td>
00321 </tr>';
00322 $descrCode.='
00323 <tr class="c-endrow">
00324 <td colspan="3"></td>
00325 </tr>';
00326
00327
00328 $menuCode.=$subCode;
00329 }
00330
00331
00332 if ($menuCode) {
00333 $final = '
00334
00335
00336 <!--
00337 Vertical module menu, shown in left frame of backend.
00338 -->
00339 <table border="0" cellpadding="0" cellspacing="0" id="typo3-vmenu">
00340 '.$menuCode.'
00341 </table>';
00342 }
00343
00344
00345 if ($descr==1) {
00346 $descrCode = '
00347
00348
00349 <!--
00350 Listing of modules, for Help > About modules
00351 -->
00352 <table border="0" cellpadding="0" cellspacing="0" id="typo3-about-modules">
00353 '.$descrCode.'
00354 </table>';
00355 $final = $descrCode;
00356 }
00357
00358
00359 if ($descr==2) {
00360
00361
00362 if ($BE_USER->isAdmin()) {
00363 $functionArray = $this->adminFunctions($backPath);
00364 if (count($functionArray)) {
00365 $selectItems[] = '<option value=""></option>';
00366 foreach($functionArray as $fAoptions) {
00367 $selectItems[] = '<option value="'.htmlspecialchars("document.location='".$fAoptions['href']."';").'">[ '.htmlspecialchars($fAoptions['title']).' ]</option>';
00368 }
00369 }
00370 }
00371
00372
00373 $selectItems[] = '<option value=""></option>';
00374 $selectItems[] = '<option value="'.htmlspecialchars("top.location='logout.php';").'">[ '.$LANG->sL('LLL:EXT:lang/locallang_core.php:buttons.logout',1).' ]</option>';
00375 $final = '
00376 <select name="menuselector" onchange="eval(this.options[this.selectedIndex].value);">
00377 '.implode('
00378 ',$selectItems).'
00379 </select>';
00380 }
00381
00382 if ($descr==3) {
00383 $final = ''.implode('',$mIcons).'';
00384 }
00385
00386
00387 if ($descr==4) {
00388 $final = chr(10).implode(chr(10),$mJScmds).chr(10);
00389 }
00390
00391
00392 return $final;
00393 }
00394
00402 function getNavFramePrefix ($moduleInfo, $subModuleInfo=array()) {
00403 global $BE_USER;
00404
00405 $prefix = '';
00406 $navFrameScriptParam = $subModuleInfo['navFrameScriptParam'] ? $subModuleInfo['navFrameScriptParam'] : $moduleInfo['navFrameScriptParam'];
00407 if ($moduleInfo['navFrameScript']) {
00408 if ($BE_USER->uc['condensedMode']) {
00409 $prefix=$this->wrapLinkWithAB($moduleInfo['navFrameScript']).$navFrameScriptParam.'¤tSubScript=';
00410 } else {
00411 $prefix='alt_mod_frameset.php?'.
00412 'fW="+top.TS.navFrameWidth+"'.
00413 '&nav="+top.TS.PATH_typo3+"'.rawurlencode($this->wrapLinkWithAB($moduleInfo['navFrameScript']).$navFrameScriptParam).
00414 '&script=';
00415 }
00416 }
00417 return $prefix;
00418 }
00419
00429 function mIconFile($Ifilename,$backPath) {
00430 if (t3lib_div::isAbsPath($Ifilename)) {
00431 return $Ifilename;
00432 }
00433 return $backPath.$Ifilename;
00434 }
00435
00444 function mIconFilename($Ifilename,$backPath) {
00445 if (t3lib_div::isAbsPath($Ifilename)) {
00446 $Ifilename = '../'.substr($Ifilename,strlen(PATH_site));
00447 }
00448 return $backPath.$Ifilename;
00449 }
00450
00456 function topButtons() {
00457 global $LANG;
00458
00459 $out.= '<form action="logout.php" target="_top"><input type="submit" value="'.$LANG->sL('LLL:EXT:lang/locallang_core.php:buttons.logout',1).'" /></form>';
00460 return $out;
00461 }
00462
00468 function adminButtons() {
00469 global $LANG;
00470
00471 $functionArray = $this->adminFunctions('');
00472
00473 $icons=array();
00474 foreach($functionArray as $fAoptions) {
00475 $icons[]= '<a href="'.htmlspecialchars($fAoptions['href']).'">'.$fAoptions['icon'].'</a>';
00476 }
00477
00478 return implode('',$icons);
00479 }
00480
00487 function adminFunctions($backPath) {
00488 global $LANG,$BE_USER,$TYPO3_CONF_VARS;
00489
00490 $functions=array();
00491
00492
00493 if ($TYPO3_CONF_VARS['EXT']['extCache']) {
00494 $title = $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.clearCache_allTypo3Conf');
00495 $functions[]=array(
00496 'title' => $title,
00497 'href' => $backPath.'tce_db.php?vC='.$BE_USER->veriCode().'&redirect='.rawurlencode(t3lib_div::getIndpEnv('TYPO3_REQUEST_SCRIPT')).'&cacheCmd=temp_CACHED',
00498 'icon' => '<img'.t3lib_iconWorks::skinImg($backPath,'gfx/clear_cache_files_in_typo3c.gif','width="21" height="18"').' title="'.htmlspecialchars($title).'" alt="" />'
00499 );
00500 }
00501
00502
00503 $title = $LANG->sL('LLL:EXT:lang/locallang_core.php:rm.clearCache_all');
00504 $functions[]=array(
00505 'title' => $title,
00506 'href' => $backPath.'tce_db.php?vC='.$BE_USER->veriCode().'&redirect='.rawurlencode(t3lib_div::getIndpEnv('TYPO3_REQUEST_SCRIPT')).'&cacheCmd=all',
00507 'icon' => '<img'.t3lib_iconWorks::skinImg($backPath,'gfx/clear_all_cache.gif','width="21" height="18"').' title="'.htmlspecialchars($title).'" alt="" />'
00508 );
00509
00510
00511 return $functions;
00512 }
00513
00520 function wrapLinkWithAB($link) {
00521 if (!strstr($link,'?')) {
00522 return $link.'?';
00523 } else return $link;
00524 }
00525 }
00526
00527
00528 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.alt_menu_functions.inc']) {
00529 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/class.alt_menu_functions.inc']);
00530 }
00531 ?>