/src/typo3_src-4.1.2/typo3/alt_clickmenu.php

00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2005 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 ***************************************************************/
00119 require ('init.php');
00120 require ('template.php');
00121 require_once (PATH_t3lib.'class.t3lib_clipboard.php');
00122 require_once(PATH_t3lib.'class.t3lib_ajax.php');
00123 $LANG->includeLLFile('EXT:lang/locallang_misc.xml');
00124 
00125 
00126 
00127 
00136 class clickMenu {
00137 
00138                 // Internal, static: GPvar:
00139         var $cmLevel=0;                         // Defines if the click menu is first level or second. Second means the click menu is triggered from another menu.
00140         var $CB;                                        // Clipboard array (submitted by eg. pressing the paste button)
00141 
00142                 // Internal, static:
00143         var $backPath='';                       // Backpath for scripts/images.
00144         var $PH_backPath='###BACK_PATH###';             // BackPath place holder: We need different backPath set whether the clickmenu is written back to a frame which is not in typo3/ dir or if the clickmenu is shown in the top frame (no backpath)
00145         var $listFrame=0;                       // If set, the calling document should be in the listframe of a frameset.
00146         var $isDBmenu=0;                        // If set, the menu is about database records, not files. (set if part 2 [1] of the item-var is NOT blank)
00147         var $alwaysContentFrame=0;      // If true, the "content" frame is always used for reference (when condensed mode is enabled)
00148         var $iParts=array();            // Stores the parts of the input $item string, splitted by "|": [0] = table/file, [1] = uid/blank, [2] = flag: If set, listFrame, If "2" then "content frame" is forced  [3] = ("+" prefix = disable all by default, enable these. Default is to disable) Items key list
00149         var $disabledItems=array();     // Contains list of keywords of items to disable in the menu
00150         var $dontDisplayTopFrameCM=0;   // If true, the context sensitive menu will not appear in the top frame, only as a layer.
00151         var $leftIcons=0;                       // If true, Show icons on the left.
00152         var $extClassArray=array();             // Array of classes to be used for user processing of the menu content. This is for the API of adding items to the menu from outside.
00153         var $ajax=0; // enable/disable ajax behavior
00154 
00155                 // Internal, dynamic:
00156         var $elCount=0;                         // Counter for elements in the menu. Used to number the name / id of the mouse-over icon.
00157         var $editPageIconSet=0;         // Set, when edit icon is drawn.
00158         var $editOK=0;                          // Set to true, if editing of the element is OK.
00159         var $rec=array();
00160 
00161 
00162 
00168         function init() {
00169                         // Setting GPvars:
00170                 $this->cmLevel = intval(t3lib_div::_GP('cmLevel'));
00171                 $this->CB = t3lib_div::_GP('CB');
00172                 if(t3lib_div::_GP('ajax'))      {
00173                         $this->ajax = 1;
00174                         ini_set('display_errors',0);    // XML has to be parsed, no parse errors allowed
00175                 }
00176 
00177                         // Deal with Drag&Drop context menus
00178                 if (strcmp(t3lib_div::_GP('dragDrop'),''))      {
00179                         $CMcontent = $this->printDragDropClickMenu(t3lib_div::_GP('dragDrop'),t3lib_div::_GP('srcId'),t3lib_div::_GP('dstId'));
00180                         return $CMcontent;
00181                 }
00182 
00183                         // can be set differently as well
00184                 $this->iParts[0] = t3lib_div::_GP('table');
00185                 $this->iParts[1] = t3lib_div::_GP('uid');
00186                 $this->iParts[2] = t3lib_div::_GP('listFr');
00187                 $this->iParts[3] = t3lib_div::_GP('enDisItems');
00188 
00189                         // Setting flags:
00190                 if ($this->iParts[2])   $this->listFrame=1;
00191                 if ($GLOBALS['BE_USER']->uc['condensedMode'] || $this->iParts[2]==2) $this->alwaysContentFrame=1;
00192                 if (strcmp($this->iParts[1],''))        $this->isDBmenu=1;
00193 
00194                 $TSkey =($this->isDBmenu?'page':'folder').($this->listFrame?'List':'Tree');
00195                 $this->disabledItems = t3lib_div::trimExplode(',',$GLOBALS['BE_USER']->getTSConfigVal('options.contextMenu.'.$TSkey.'.disableItems'),1);
00196                 $this->leftIcons = $GLOBALS['BE_USER']->getTSConfigVal('options.contextMenu.options.leftIcons');
00197 
00198                         // &cmLevel flag detected (2nd level menu)
00199                 if (!$this->cmLevel)    {
00200                                 // Make 1st level clickmenu:
00201                         if ($this->isDBmenu)    {
00202                                 $CMcontent = $this->printDBClickMenu($this->iParts[0],$this->iParts[1]);
00203                         } else {
00204                                 $CMcontent = $this->printFileClickMenu($this->iParts[0]);
00205                         }
00206                 } else {
00207                                 // Make 2nd level clickmenu (only for DBmenus)
00208                         if ($this->isDBmenu)    {
00209                                 $CMcontent = $this->printNewDBLevel($this->iParts[0],$this->iParts[1]);
00210                         }
00211                 }
00212 
00213                         // Return clickmenu content:
00214                 return $CMcontent;
00215         }
00216 
00222         function doDisplayTopFrameCM()  {
00223                 if($this->ajax) {
00224                         return false;
00225                 } else {
00226                         return !$GLOBALS['SOBE']->doc->isCMlayers() || !$this->dontDisplayTopFrameCM;
00227                 }
00228         }
00229 
00230 
00231 
00232 
00233 
00234 
00235 
00236 
00237 
00238 
00239 
00240 
00241         /***************************************
00242          *
00243          * DATABASE
00244          *
00245          ***************************************/
00246 
00254         function printDBClickMenu($table,$uid)  {
00255                 global $TCA, $BE_USER;
00256 
00257                         // Get record:
00258                 $this->rec = t3lib_BEfunc::getRecordWSOL($table,$uid);
00259                 $menuItems=array();
00260                 $root=0;
00261                 if ($table=='pages' && !strcmp($uid,'0'))       {       // Rootlevel
00262                         $root=1;
00263                 }
00264 
00265                         // If record found (or root), go ahead and fill the $menuItems array which will contain data for the elements to render.
00266                 if (is_array($this->rec) || $root)      {
00267 
00268                                 // Get permissions
00269                         $lCP = $BE_USER->calcPerms(t3lib_BEfunc::getRecord('pages',($table=='pages'?$this->rec['uid']:$this->rec['pid'])));
00270 
00271                                 // View
00272                         if (!in_array('view',$this->disabledItems))     {
00273                                 if ($table=='pages')    $menuItems['view']=$this->DB_view($uid);
00274                                 if ($table==$GLOBALS['TYPO3_CONF_VARS']['SYS']['contentTable']) {
00275                                         $ws_rec = t3lib_BEfunc::getRecordWSOL($table,$this->rec['t3ver_oid']);
00276                                         $menuItems['view']=$this->DB_view($ws_rec['pid']);
00277                                 }
00278                         }
00279 
00280                                 // Edit:
00281                         if(!$root && ($BE_USER->isPSet($lCP,$table,'edit')||$BE_USER->isPSet($lCP,$table,'editcontent')))       {
00282                                 if (!in_array('edit',$this->disabledItems))             $menuItems['edit']=$this->DB_edit($table,$uid);
00283                                 $this->editOK=1;
00284                         }
00285 
00286                                 // New:
00287                         if (!in_array('new',$this->disabledItems) && $BE_USER->isPSet($lCP,$table,'new'))       $menuItems['new']=$this->DB_new($table,$uid);
00288 
00289                                 // Info:
00290                         if(!in_array('info',$this->disabledItems) && !$root)    $menuItems['info']=$this->DB_info($table,$uid);
00291 
00292                         $menuItems['spacer1']='spacer';
00293 
00294                                 // Copy:
00295                         if(!in_array('copy',$this->disabledItems) && !$root)    $menuItems['copy']=$this->DB_copycut($table,$uid,'copy');
00296                                 // Cut:
00297                         if(!in_array('cut',$this->disabledItems) && !$root)     $menuItems['cut']=$this->DB_copycut($table,$uid,'cut');
00298 
00299                                 // Paste:
00300                         $elFromAllTables = count($this->clipObj->elFromTable(''));
00301                         if (!in_array('paste',$this->disabledItems) && $elFromAllTables)        {
00302                                 $selItem = $this->clipObj->getSelectedRecord();
00303                                 $elInfo=array(
00304                                         t3lib_div::fixed_lgd_cs($selItem['_RECORD_TITLE'],$BE_USER->uc['titleLen']),
00305                                         ($root?$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']:t3lib_div::fixed_lgd_cs(t3lib_BEfunc::getRecordTitle($table,$this->rec),$BE_USER->uc['titleLen'])),
00306                                         $this->clipObj->currentMode()
00307                                 );
00308                                 if ($table=='pages' && ($lCP & 8))      {
00309                                         if ($elFromAllTables)   $menuItems['pasteinto']=$this->DB_paste('',$uid,'into',$elInfo);
00310                                 }
00311 
00312                                 $elFromTable = count($this->clipObj->elFromTable($table));
00313                                 if (!$root && $elFromTable  && $TCA[$table]['ctrl']['sortby'])  $menuItems['pasteafter']=$this->DB_paste($table,-$uid,'after',$elInfo);
00314                         }
00315 
00316                                 // Delete:
00317                         $elInfo=array(t3lib_div::fixed_lgd_cs(t3lib_BEfunc::getRecordTitle($table,$this->rec),$BE_USER->uc['titleLen']));
00318                         if(!in_array('delete',$this->disabledItems) && !$root && $BE_USER->isPSet($lCP,$table,'delete'))        {
00319                                 $menuItems['spacer2']='spacer';
00320                                 $menuItems['delete']=$this->DB_delete($table,$uid,$elInfo);
00321                         }
00322 
00323                         if(!in_array('history',$this->disabledItems))   {
00324                                 $menuItems['history']=$this->DB_history($table,$uid,$elInfo);
00325                         }
00326                 }
00327 
00328                         // Adding external elements to the menuItems array
00329                 $menuItems = $this->processingByExtClassArray($menuItems,$table,$uid);
00330 
00331                         // Processing by external functions?
00332                 $menuItems = $this->externalProcessingOfDBMenuItems($menuItems);
00333 
00334                         // Return the printed elements:
00335                 return $this->printItems($menuItems,
00336                         $root?
00337                         '<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/i/_icon_website.gif','width="18" height="16"').' class="absmiddle" alt="" />'.htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']):
00338                         t3lib_iconWorks::getIconImage($table,$this->rec,$this->PH_backPath,' class="absmiddle" title="'.htmlspecialchars(t3lib_BEfunc::getRecordIconAltText($this->rec,$table)).'"').t3lib_BEfunc::getRecordTitle($table,$this->rec,TRUE)
00339                 );
00340         }
00341 
00349         function printNewDBLevel($table,$uid)   {
00350                 global $TCA, $BE_USER;
00351 
00352                         // Setting internal record to the table/uid :
00353                 $this->rec = t3lib_BEfunc::getRecordWSOL($table,$uid);
00354                 $menuItems=array();
00355                 $root=0;
00356                 if ($table=='pages' && !strcmp($uid,'0'))       {       // Rootlevel
00357                         $root=1;
00358                 }
00359 
00360                         // If record was found, check permissions and get menu items.
00361                 if (is_array($this->rec) || $root)      {
00362                         $lCP = $BE_USER->calcPerms(t3lib_BEfunc::getRecord('pages',($table=='pages'?$this->rec['uid']:$this->rec['pid'])));
00363                                 // Edit:
00364                         if(!$root && ($BE_USER->isPSet($lCP,$table,'edit')||$BE_USER->isPSet($lCP,$table,'editcontent')))       {
00365                                 $this->editOK=1;
00366                         }
00367 
00368                         $menuItems = $this->processingByExtClassArray($menuItems,$table,$uid);
00369                 }
00370 
00371                         // Return the printed elements:
00372                 if (!is_array($menuItems))      $menuItems=array();
00373                 return $this->printItems($menuItems,
00374                         $root?
00375                         '<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/i/_icon_website.gif','width="18" height="16"').' class="absmiddle" alt="" />'.htmlspecialchars($GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']):
00376                         t3lib_iconWorks::getIconImage($table,$this->rec,$this->PH_backPath,' class="absmiddle" title="'.htmlspecialchars(t3lib_BEfunc::getRecordIconAltText($this->rec,$table)).'"').t3lib_BEfunc::getRecordTitle($table,$this->rec,TRUE)
00377                 );
00378         }
00379 
00386         function externalProcessingOfDBMenuItems($menuItems)    {
00387                 return $menuItems;
00388         }
00389 
00398         function processingByExtClassArray($menuItems,$table,$uid)      {
00399                 if (is_array($this->extClassArray))     {
00400                         reset($this->extClassArray);
00401                         while(list(,$conf)=each($this->extClassArray))  {
00402                                 $obj=t3lib_div::makeInstance($conf['name']);
00403                                 $menuItems = $obj->main($this,$menuItems,$table,$uid);
00404                         }
00405                 }
00406                 return $menuItems;
00407         }
00408 
00418         function urlRefForCM($url,$retUrl='',$hideCM=1,$overrideLoc='') {
00419                 $loc='top.content'.($this->listFrame && !$this->alwaysContentFrame ?'.list_frame':'');
00420                 $editOnClick= ($overrideLoc ? 'var docRef='.$overrideLoc : 'var docRef=(top.content.list_frame)?top.content.list_frame:'.$loc).'; docRef.location.href=top.TS.PATH_typo3+\''.$url.'\''.
00421                         ($retUrl?"+'&".$retUrl."='+top.rawurlencode(".$this->frameLocation('docRef.document').')':'').';'.
00422                         ($hideCM?'return hideCM();':'');
00423                 return $editOnClick;
00424         }
00425 
00435         function DB_copycut($table,$uid,$type)  {
00436                 if ($this->clipObj->current=='normal')  {
00437                         $isSel = $this->clipObj->isSelected($table,$uid);
00438                 }
00439 
00440                 $addParam = array();
00441                 if ($this->listFrame)   {
00442                         $addParam['reloadListFrame'] = ($this->alwaysContentFrame ? 2 : 1);
00443                 }
00444 
00445                 return $this->linkItem(
00446                         $this->label($type),
00447                         $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/clip_'.$type.($isSel==$type?'_h':'').'.gif','width="12" height="12"').' alt="" />'),
00448                         "top.loadTopMenu('".$this->clipObj->selUrlDB($table,$uid,($type=='copy'?1:0),($isSel==$type),$addParam)."');return false;"
00449                 );
00450         }
00451 
00464         function DB_paste($table,$uid,$type,$elInfo)    {
00465                 $editOnClick = '';
00466                 $loc = 'top.content'.($this->listFrame && !$this->alwaysContentFrame ?'.list_frame':'');
00467                 if($GLOBALS['BE_USER']->jsConfirmation(2))      {
00468                 $conf = $loc.' && confirm('.$GLOBALS['LANG']->JScharCode(sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:mess.'.($elInfo[2]=='copy'?'copy':'move').'_'.$type),$elInfo[0],$elInfo[1])).')';
00469                 } else {
00470                         $conf = $loc;
00471                 }
00472                 $editOnClick = 'if('.$conf.'){'.$loc.'.location.href=top.TS.PATH_typo3+\''.$this->clipObj->pasteUrl($table,$uid,0).'&redirect=\'+top.rawurlencode('.$this->frameLocation($loc.'.document').'); hideCM();}';
00473 
00474                 return $this->linkItem(
00475                         $this->label('paste'.$type),
00476                         $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/clip_paste'.$type.'.gif','width="12" height="12"').' alt="" />'),
00477                         $editOnClick.'return false;'
00478                 );
00479         }
00480 
00489         function DB_info($table,$uid)   {
00490                 return $this->linkItem(
00491                         $this->label('info'),
00492                         $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/zoom2.gif','width="12" height="12"').' alt="" />'),
00493                         "top.launchView('".$table."', '".$uid."'); return hideCM();"
00494                 );
00495         }
00496 
00505         function DB_history($table,$uid)        {
00506                 $url = 'show_rechis.php?element='.rawurlencode($table.':'.$uid);
00507                 return $this->linkItem(
00508                         $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLL('CM_history')),
00509                         $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/history2.gif','width="13" height="12"').' alt="" />'),
00510                         $this->urlRefForCM($url,'returnUrl'),
00511                         0
00512                 );
00513         }
00514 
00524         function DB_perms($table,$uid,$rec)     {
00525                 $url = 'mod/web/perm/index.php?id='.$uid.($rec['perms_userid']==$GLOBALS['BE_USER']->user['uid']||$GLOBALS['BE_USER']->isAdmin()?'&return_id='.$uid.'&edit=1':'');
00526                 return $this->linkItem(
00527                         $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLL('CM_perms')),
00528                         $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/perm.gif','width="7" height="12"').' alt="" />'),
00529                         $this->urlRefForCM($url),
00530                         0
00531                 );
00532         }
00533 
00543         function DB_db_list($table,$uid,$rec)   {
00544                 $url = t3lib_div::getIndpEnv('TYPO3_REQUEST_DIR').'db_list.php?table='.($table=='pages'?'':$table).'&id='.($table=='pages'?$uid:$rec['pid']);
00545                 return $this->linkItem(
00546                         $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLL('CM_db_list')),
00547                         $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/list.gif','width="11" height="11"').' alt="" />'),
00548                         "top.nextLoadModuleUrl='".$url."';top.goToModule('web_list',1);",
00549                         0
00550                 );
00551         }
00552 
00562         function DB_moveWizard($table,$uid,$rec)        {
00563                 $url = 'move_el.php?table='.$table.'&uid='.$uid.
00564                                 ($table=='tt_content'?'&sys_language_uid='.intval($rec['sys_language_uid']):'');        // Hardcoded field for tt_content elements.
00565 
00566                 return $this->linkItem(
00567                         $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLL('CM_moveWizard'.($table=='pages'?'_page':''))),
00568                         $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/move_'.($table=='pages'?'page':'record').'.gif','width="11" height="12"').' alt="" />'),
00569                         $this->urlRefForCM($url,'returnUrl'),
00570                         0
00571                 );
00572         }
00573 
00583         function DB_newWizard($table,$uid,$rec) {
00584                         //  If mod.web_list.newContentWiz.overrideWithExtension is set, use that extension's create new content wizard instead:
00585                 $tmpTSc = t3lib_BEfunc::getModTSconfig($this->pageinfo['uid'],'mod.web_list');
00586                 $tmpTSc = $tmpTSc ['properties']['newContentWiz.']['overrideWithExtension'];
00587                 $newContentWizScriptPath = t3lib_extMgm::isLoaded($tmpTSc) ? (t3lib_extMgm::extRelPath($tmpTSc).'mod1/db_new_content_el.php') : 'sysext/cms/layout/db_new_content_el.php';
00588 
00589                 $url = ($table=='pages' || !t3lib_extMgm::isLoaded('cms')) ? 'db_new.php?id='.$uid.'&pagesOnly=1' : $newContentWizScriptPath.'?id='.$rec['pid'].'&sys_language_uid='.intval($rec['sys_language_uid']);
00590                 return $this->linkItem(
00591                         $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLL('CM_newWizard')),
00592                         $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/new_'.($table=='pages'?'page':'record').'.gif','width="'.($table=='pages'?'13':'16').'" height="12"').' alt="" />'),
00593                         $this->urlRefForCM($url,'returnUrl'),
00594                         0
00595                 );
00596         }
00597 
00606         function DB_editAccess($table,$uid)     {
00607                 $addParam='&columnsOnly='.rawurlencode(implode(',',$GLOBALS['TCA'][$table]['ctrl']['enablecolumns']).($table=='pages' ? ',extendToSubpages' :''));
00608                 $url = 'alt_doc.php?edit['.$table.']['.$uid.']=edit'.$addParam;
00609                 return $this->linkItem(
00610                         $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLL('CM_editAccess')),
00611                         $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/editaccess.gif','width="12" height="12"').' alt="" />'),
00612                         $this->urlRefForCM($url,'returnUrl'),
00613                         1       // no top frame CM!
00614                 );
00615         }
00616 
00625         function DB_editPageHeader($uid)        {
00626                 return $this->DB_editPageProperties($uid);
00627         }
00628 
00636         function DB_editPageProperties($uid)    {
00637                 $url = 'alt_doc.php?edit[pages]['.$uid.']=edit';
00638                 return $this->linkItem(
00639                         $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLL('CM_editPageProperties')),
00640                         $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/edit2.gif','width="11" height="12"').' alt="" />'),
00641                         $this->urlRefForCM($url,'returnUrl'),
00642                         1       // no top frame CM!
00643                 );
00644         }
00645 
00654         function DB_edit($table,$uid)   {
00655                 global $BE_USER;
00656                         // If another module was specified, replace the default Page module with the new one
00657                 $newPageModule = trim($BE_USER->getTSConfigVal('options.overridePageModule'));
00658                 $pageModule = t3lib_BEfunc::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';
00659 
00660                 $editOnClick='';
00661                 $loc='top.content'.($this->listFrame && !$this->alwaysContentFrame ?'.list_frame':'');
00662                 $addParam='';
00663                 $theIcon = t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/edit2.gif','width="11" height="12"');
00664                 if (
00665                                 $this->iParts[0]=='pages' &&
00666                                 $this->iParts[1] &&
00667                                 $BE_USER->check('modules', $pageModule)
00668                         )       {
00669                         $theIcon = t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/edit_page.gif','width="12" height="12"');
00670                         $this->editPageIconSet=1;
00671                         if ($BE_USER->uc['classicPageEditMode'] || !t3lib_extMgm::isLoaded('cms'))      {
00672                                 $addParam='&editRegularContentFromId='.intval($this->iParts[1]);
00673                         } else {
00674                                 $editOnClick="top.fsMod.recentIds['web']=".intval($this->iParts[1]).";top.goToModule('".$pageModule."',1);";
00675                         }
00676                 }
00677                 if (!$editOnClick)      {
00678                         $editOnClick='if('.$loc.'){'.$loc.".location.href=top.TS.PATH_typo3+'alt_doc.php?returnUrl='+top.rawurlencode(".$this->frameLocation($loc.'.document').")+'&edit[".$table."][".$uid."]=edit".$addParam."';}";
00679                 }
00680 
00681                 return $this->linkItem(
00682                         $this->label('edit'),
00683                         $this->excludeIcon('<img'.$theIcon.' alt="" />'),
00684                         $editOnClick.'return hideCM();'
00685                 );
00686         }
00687 
00696         function DB_new($table,$uid)    {
00697                 $editOnClick='';
00698                 $loc='top.content'.(!$this->alwaysContentFrame?'.list_frame':'');
00699                 $editOnClick='if('.$loc.'){'.$loc.".location.href=top.TS.PATH_typo3+'".
00700                         ($this->listFrame?
00701                                 "alt_doc.php?returnUrl='+top.rawurlencode(".$this->frameLocation($loc.'.document').")+'&edit[".$table."][-".$uid."]=new'":
00702                                 'db_new.php?id='.intval($uid)."'").
00703                         ';}';
00704 
00705                 return $this->linkItem(
00706                         $this->label('new'),
00707                         $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/new_'.($table=='pages'&&$this->listFrame?'page':'el').'.gif','width="'.($table=='pages'?'13':'11').'" height="12"').' alt="" />'),
00708                         $editOnClick.'return hideCM();'
00709                 );
00710         }
00711 
00721         function DB_delete($table,$uid,$elInfo) {
00722                 $editOnClick='';
00723                 $loc='top.content'.($this->listFrame && !$this->alwaysContentFrame ?'.list_frame':'');
00724                 if($GLOBALS['BE_USER']->jsConfirmation(4))      {
00725                         $conf = "confirm(".$GLOBALS['LANG']->JScharCode(sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:mess.delete'),$elInfo[0]).t3lib_BEfunc::referenceCount($table,$uid,' (There are %s reference(s) to this record!)')).")";
00726                 } else {
00727                         $conf = '1==1';
00728                 }
00729                 $editOnClick='if('.$loc." && ".$conf." ){".$loc.".location.href=top.TS.PATH_typo3+'tce_db.php?redirect='+top.rawurlencode(".$this->frameLocation($loc.'.document').")+'".
00730                         "&cmd[".$table.']['.$uid.'][delete]=1&prErr=1&vC='.$GLOBALS['BE_USER']->veriCode()."';hideCM();}";
00731 
00732                 return $this->linkItem(
00733                         $this->label('delete'),
00734                         $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/garbage.gif','width="11" height="12"').' alt="" />'),
00735                         $editOnClick.'return false;'
00736                 );
00737         }
00738 
00747         function DB_view($id,$anchor='')        {
00748                 return $this->linkItem(
00749                         $this->label('view'),
00750                         $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/zoom.gif','width="12" height="12"').' alt="" />'),
00751                         t3lib_BEfunc::viewOnClick($id,$this->PH_backPath,t3lib_BEfunc::BEgetRootLine($id),$anchor).'return hideCM();'
00752                 );
00753         }
00754 
00762         function DB_tempMountPoint($page_id)    {
00763                 return $this->linkItem(
00764                         $this->label('tempMountPoint'),
00765                         $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/placeasroot.gif','width="14" height="12"').' alt="" />'),
00766                         "if (top.content.nav_frame) { top.content.nav_frame.location.href = 'alt_db_navframe.php?setTempDBmount=".intval($page_id)."'; } return hideCM();"
00767                 );
00768         }
00769 
00779         function DB_hideUnhide($table,$rec,$hideField)  {
00780                 return $this->DB_changeFlag($table, $rec, $hideField, $this->label(($rec[$hideField]?'un':'').'hide'), 'hide');
00781         }
00782 
00794         function DB_changeFlag($table, $rec, $flagField, $title, $name, $iconRelPath='gfx/')    {
00795             $uid = $rec['_ORIG_uid'] ? $rec['_ORIG_uid'] : $rec['uid'];
00796             $editOnClick='';
00797             $loc='top.content'.($this->listFrame && !$this->alwaysContentFrame ?'.list_frame':'');
00798             $editOnClick='if('.$loc.'){'.$loc.".location.href=top.TS.PATH_typo3+'tce_db.php?redirect='+top.rawurlencode(".$this->frameLocation($loc.'.document').")+'".
00799                 "&data[".$table.']['.$uid.']['.$flagField.']='.($rec[$flagField]?0:1).'&prErr=1&vC='.$GLOBALS['BE_USER']->veriCode()."';hideCM();}";
00800 
00801             return $this->linkItem(
00802                 $title,
00803                 $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,$iconRelPath.'button_'.($rec[$flagField]?'un':'').$name.'.gif','width="11" height="10"').' alt="" />'),
00804                 $editOnClick.'return false;',
00805                 1
00806             );
00807         }
00808 
00809 
00810 
00811 
00812 
00813 
00814 
00815 
00816         /***************************************
00817          *
00818          * FILE
00819          *
00820          ***************************************/
00821 
00828         function printFileClickMenu($path)      {
00829                 $menuItems=array();
00830 
00831                 if (@file_exists($path) && t3lib_div::isAllowedAbsPath($path))  {
00832                         $fI = pathinfo($path);
00833                         $icon = is_dir($path) ? 'folder.gif' : t3lib_BEfunc::getFileIcon(strtolower($fI['extension']));
00834                         $size=' ('.t3lib_div::formatSize(filesize($path)).'bytes)';
00835                         $icon = '<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/fileicons/'.$icon,'width="18" height="16"').' class="absmiddle" title="'.htmlspecialchars($fI['basename'].$size).'" alt="" />';
00836 
00837                                 // edit
00838                         if (!in_array('edit',$this->disabledItems) && is_file($path) && t3lib_div::inList($GLOBALS['TYPO3_CONF_VARS']['SYS']['textfile_ext'],$fI['extension'])) $menuItems['edit']=$this->FILE_launch($path,'file_edit.php','edit','edit_file.gif');
00839                                 // rename
00840                         if (!in_array('rename',$this->disabledItems))   $menuItems['rename']=$this->FILE_launch($path,'file_rename.php','rename','rename.gif');
00841                                 // upload
00842                         if (!in_array('upload',$this->disabledItems) && is_dir($path)) $menuItems['upload']=$this->FILE_launch($path,'file_upload.php','upload','upload.gif');
00843                                 // new
00844                         if (!in_array('new',$this->disabledItems) && is_dir($path)) $menuItems['new']=$this->FILE_launch($path,'file_newfolder.php','new','new_file.gif');
00845                                 // info
00846                         if (!in_array('info',$this->disabledItems))     $menuItems['info']=$this->DB_info($path,'');
00847 
00848                         $menuItems[]='spacer';
00849 
00850                                 // copy:
00851                         if (!in_array('copy',$this->disabledItems))     $menuItems['copy']=$this->FILE_copycut($path,'copy');
00852                                 // cut:
00853                         if (!in_array('cut',$this->disabledItems))      $menuItems['cut']=$this->FILE_copycut($path,'cut');
00854 
00855                                 // Paste:
00856                         $elFromAllTables = count($this->clipObj->elFromTable('_FILE'));
00857                         if (!in_array('paste',$this->disabledItems) && $elFromAllTables && is_dir($path))       {
00858                                 $elArr = $this->clipObj->elFromTable('_FILE');
00859                                 reset($elArr);
00860                                 $selItem = current($elArr);
00861                                 $elInfo=array(
00862                                         basename($selItem),
00863                                         basename($path),
00864                                         $this->clipObj->currentMode()
00865                                 );
00866                                 $menuItems['pasteinto']=$this->FILE_paste($path,$selItem,$elInfo);
00867                         }
00868 
00869                         $menuItems[]='spacer';
00870 
00871                                 // delete:
00872                         if (!in_array('delete',$this->disabledItems))   $menuItems['delete']=$this->FILE_delete($path);
00873                 }
00874 
00875                         // Adding external elements to the menuItems array
00876                 $menuItems = $this->processingByExtClassArray($menuItems,$path,0);
00877 
00878                         // Processing by external functions?
00879                 $menuItems = $this->externalProcessingOfFileMenuItems($menuItems);
00880 
00881                         // Return the printed elements:
00882                 return $this->printItems($menuItems,$icon.basename($path));
00883         }
00884 
00885 
00892         function externalProcessingOfFileMenuItems($menuItems)  {
00893                 return $menuItems;
00894         }
00895 
00906         function FILE_launch($path,$script,$type,$image)        {
00907                 $loc='top.content'.(!$this->alwaysContentFrame?'.list_frame':'');
00908 
00909                 $editOnClick='if('.$loc.'){'.$loc.".location.href=top.TS.PATH_typo3+'".$script.'?target='.rawurlencode($path)."&returnUrl='+top.rawurlencode(".$this->frameLocation($loc.'.document').");}";
00910 
00911                 return $this->linkItem(
00912                         $this->label($type),
00913                         $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/'.$image,'width="12" height="12"').' alt="" />'),
00914                         $editOnClick.'return hideCM();'
00915                 );
00916         }
00917 
00926         function FILE_copycut($path,$type)      {
00927                 $table = '_FILE';               // Pseudo table name for use in the clipboard.
00928                 $uid = t3lib_div::shortmd5($path);
00929                 if ($this->clipObj->current=='normal')  {
00930                         $isSel = $this->clipObj->isSelected($table,$uid);
00931                 }
00932 
00933                 $addParam = array();
00934                 if ($this->listFrame)   {
00935                         $addParam['reloadListFrame'] = ($this->alwaysContentFrame ? 2 : 1);
00936                 }
00937 
00938                 return $this->linkItem(
00939                         $this->label($type),
00940                         $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/clip_'.$type.($isSel==$type?'_h':'').'.gif','width="12" height="12"').' alt="" />'),
00941                         "top.loadTopMenu('".$this->clipObj->selUrlFile($path,($type=='copy'?1:0),($isSel==$type),$addParam)."');return false;"
00942                 );
00943         }
00944 
00952         function FILE_delete($path)     {
00953                 $editOnClick='';
00954                 $loc='top.content'.($this->listFrame && !$this->alwaysContentFrame ?'.list_frame':'');
00955                 if($GLOBALS['BE_USER']->jsConfirmation(4))      {
00956                         $conf = "confirm(".$GLOBALS['LANG']->JScharCode(sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:mess.delete'),basename($path)).t3lib_BEfunc::referenceCount('_FILE',$path,' (There are %s reference(s) to this file!)')).")";
00957                 } else {
00958                         $conf = '1==1';
00959                 }
00960                 $editOnClick='if('.$loc." && ".$conf." ){".$loc.".location.href=top.TS.PATH_typo3+'tce_file.php?redirect='+top.rawurlencode(".$this->frameLocation($loc.'.document').")+'".
00961                         "&file[delete][0][data]=".rawurlencode($path).'&vC='.$GLOBALS['BE_USER']->veriCode()."';hideCM();}";
00962 
00963                 return $this->linkItem(
00964                         $this->label('delete'),
00965                         $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/garbage.gif','width="11" height="12"').' alt="" />'),
00966                         $editOnClick.'return false;'
00967                 );
00968         }
00969 
00979         function FILE_paste($path,$target,$elInfo)      {
00980                 $editOnClick='';
00981                 $loc='top.content'.($this->listFrame && !$this->alwaysContentFrame ?'.list_frame':'');
00982                 if($GLOBALS['BE_USER']->jsConfirmation(2))      {
00983                 $conf=$loc." && confirm(".$GLOBALS['LANG']->JScharCode(sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:mess.'.($elInfo[2]=='copy'?'copy':'move').'_into'),$elInfo[0],$elInfo[1])).")";
00984                 } else {
00985                         $conf=$loc;
00986                 }
00987 
00988                 $editOnClick='if('.$conf.'){'.$loc.".location.href=top.TS.PATH_typo3+'".$this->clipObj->pasteUrl('_FILE',$path,0).
00989                         "&redirect='+top.rawurlencode(".$this->frameLocation($loc.'.document').'); hideCM();}';
00990 
00991                 return $this->linkItem(
00992                         $this->label('pasteinto'),
00993                         $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/clip_pasteinto.gif','width="12" height="12"').' alt="" />'),
00994                         $editOnClick.'return false;'
00995                 );
00996         }
00997 
00998 
00999 
01000 
01001 
01002         /***************************************
01003          *
01004          * DRAG AND DROP
01005          *
01006          ***************************************/
01007 
01016         function printDragDropClickMenu($table,$srcId,$dstId)   {
01017                 $menuItems=array();
01018 
01019                         // If the drag and drop menu should apply to PAGES use this set of menu items
01020                 if ($table == 'pages')  {
01021                                 // Move Into:
01022                         $menuItems['movePage_into']=$this->dragDrop_copymovepage($srcId,$dstId,'move','into');
01023                                 // Move After:
01024                         $menuItems['movePage_after']=$this->dragDrop_copymovepage($srcId,$dstId,'move','after');
01025                                 // Copy Into:
01026                         $menuItems['copyPage_into']=$this->dragDrop_copymovepage($srcId,$dstId,'copy','into');
01027                                 // Copy After:
01028                         $menuItems['copyPage_after']=$this->dragDrop_copymovepage($srcId,$dstId,'copy','after');
01029                 }
01030 
01031                         // If the drag and drop menu should apply to FOLDERS use this set of menu items
01032                 if ($table == 'folders')        {
01033                                 // Move Into:
01034                         $menuItems['moveFolder_into']=$this->dragDrop_copymovefolder($srcId,$dstId,'move');
01035                                 // Copy Into:
01036                         $menuItems['copyFolder_into']=$this->dragDrop_copymovefolder($srcId,$dstId,'copy');
01037                 }
01038 
01039                         // Adding external elements to the menuItems array
01040                 $menuItems = $this->processingByExtClassArray($menuItems,"dragDrop_".$table,$srcId);  // to extend this, you need to apply a Context Menu to a "virtual" table called "dragDrop_pages" or similar
01041 
01042                         // Processing by external functions?
01043                 $menuItems = $this->externalProcessingOfDBMenuItems($menuItems);
01044 
01045                         // Return the printed elements:
01046                 return $this->printItems($menuItems,
01047                         t3lib_iconWorks::getIconImage($table,$this->rec,$this->PH_backPath,' class="absmiddle" title="'.htmlspecialchars(t3lib_BEfunc::getRecordIconAltText($this->rec,$table)).'"').t3lib_BEfunc::getRecordTitle($table,$this->rec,TRUE)
01048                 );
01049         }
01050 
01051 
01058         function externalProcessingOfDragDropMenuItems($menuItems)      {
01059                 return $menuItems;
01060         }
01061 
01062 
01073         function dragDrop_copymovepage($srcUid,$dstUid,$action,$into)   {
01074                 $negativeSign = ($into == 'into') ? '' : '-';
01075                 $editOnClick='';
01076                 $loc='top.content'.($this->listFrame && !$this->alwaysContentFrame ?'.list_frame':'');
01077                 $editOnClick='if('.$loc.'){'.$loc.'.document.location=top.TS.PATH_typo3+"tce_db.php?redirect="+top.rawurlencode('.$this->frameLocation($loc.'.document').')+"'.
01078                         '&cmd[pages]['.$srcUid.']['.$action.']='.$negativeSign.$dstUid.'&prErr=1&vC='.$GLOBALS['BE_USER']->veriCode().'";hideCM();}';
01079 
01080                 return $this->linkItem(
01081                         $this->label($action.'Page_'.$into),
01082                         $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/'.$action.'_page_'.$into.'.gif','width="11" height="12"').' alt="" />'),
01083                         $editOnClick.'return false;',
01084                         0
01085                 );
01086         }
01087 
01088 
01098         function dragDrop_copymovefolder($srcPath,$dstPath,$action)     {
01099                 $editOnClick='';
01100                 $loc='top.content'.($this->listFrame && !$this->alwaysContentFrame ?'.list_frame':'');
01101                 $editOnClick='if('.$loc.'){'.$loc.'.document.location=top.TS.PATH_typo3+"tce_file.php?redirect="+top.rawurlencode('.$this->frameLocation($loc.'.document').')+"'.
01102                         '&file['.$action.'][0][data]='.$srcPath.'&file['.$action.'][0][target]='.$dstPath.'&prErr=1&vC='.$GLOBALS['BE_USER']->veriCode().'";hideCM();}';
01103 
01104                 return $this->linkItem(
01105                         $this->label($action.'Folder_into'),
01106                         $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/'.$action.'_folder_into.gif','width="11" height="12"').' alt="" />'),
01107                         $editOnClick.'return false;',
01108                         0
01109                 );
01110         }
01111 
01112 
01113 
01114 
01115 
01116 
01117 
01118 
01119 
01120         /***************************************
01121          *
01122          * COMMON
01123          *
01124          **************************************/
01125 
01134         function printItems($menuItems,$item)   {
01135 
01136                 $out='';
01137 
01138                         // Enable/Disable items:
01139                 $menuItems = $this->enableDisableItems($menuItems);
01140 
01141                         // Clean up spacers:
01142                 $menuItems = $this->cleanUpSpacers($menuItems);
01143 
01144                         // Adding topframe part (horizontal clickmenu)
01145                 if ($this->doDisplayTopFrameCM())       {
01146                         $out.= '
01147 
01148                                 <!--
01149                                         Table, which contains the click menu when shown in the top frame of the backend:
01150                                 -->
01151                                 <table border="0" cellpadding="0" cellspacing="0" id="typo3-CSM-top">
01152                                         <tr>
01153 
01154                                                         <!-- Items: -->
01155                                                 <td class="c-item">'.
01156                                                         implode('</td>
01157                                                 <td><img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/acm_spacer2.gif','width="8" height="12"').' alt="" /></td>
01158                                                 <td class="c-item">',$this->menuItemsForTopFrame($menuItems)).
01159                                                 '</td>
01160 
01161                                                         <!-- Close button: -->
01162                                                 <td class="c-closebutton"><a href="#" onclick="hideCM();return false;"><img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/close_12h.gif','width="11" height="12"').' title="'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:labels.close',1).'" alt="" /></a></td>
01163 
01164                                                         <!-- The item of the clickmenu: -->
01165                                                 <td class="c-itemicon">'.$item.'</td>
01166                                         </tr>
01167                                 </table>
01168                         ';
01169 
01170                                 // Set remaining BACK_PATH to blank (if any)
01171                         $out = str_replace($this->PH_backPath,'',$out);
01172                 }
01173                         // Adding JS part:
01174                 $out.=$this->printLayerJScode($menuItems);
01175 
01176                         // Return the content
01177                 return $out;
01178         }
01179 
01186         function printLayerJScode($menuItems)   {
01187                 $script='';
01188                 if ($this->isCMlayers())        {       // Clipboard must not be submitted - then it's probably a copy/cut situation.
01189                         $frameName = '.'.($this->listFrame ? 'list_frame' : 'nav_frame');
01190                         if ($this->alwaysContentFrame)  $frameName='';
01191 
01192                                 // Create the table displayed in the clickmenu layer:
01193                         $CMtable = '
01194                                 <table border="0" cellpadding="0" cellspacing="0" class="typo3-CSM bgColor4">
01195                                         '.implode('',$this->menuItemsForClickMenu($menuItems)).'
01196                                 </table>';
01197 
01198                                 // Wrap the inner table in another table to create outer border:
01199                         $CMtable = $this->wrapColorTableCM($CMtable);
01200 
01201                                 // Set back path place holder to real back path
01202                         $CMtable = str_replace($this->PH_backPath,$this->backPath,$CMtable);
01203                         if ($this->ajax)        {
01204                                 $innerXML = '<data><clickmenu><htmltable><![CDATA['.$CMtable.']]></htmltable><cmlevel>'.$this->cmLevel.'</cmlevel></clickmenu></data>';
01205                                 return $innerXML;
01206                         } else {
01207                                         // Create JavaScript section:
01208                                 $script=$GLOBALS['TBE_TEMPLATE']->wrapScriptTags('
01209 
01210                                 if (top.content && top.content'.$frameName.' && top.content'.$frameName.'.setLayerObj)  {
01211                                         top.content'.$frameName.'.setLayerObj(unescape("'.t3lib_div::rawurlencodeJS($CMtable).'"),'.$this->cmLevel.');
01212                                 }
01213                                 '.(!$this->doDisplayTopFrameCM()?'hideCM();':'')
01214                                 );
01215                                 return $script;
01216                         }
01217                 }
01218         }
01219 
01227         function wrapColorTableCM($str) {
01228 
01229                         // Clear-gifs needed if opera is to set the table row height correctly in skins.
01230                 $str = '<table border="0" cellspacing="0" class="typo3-CSM-wrapperCM">
01231                                 <tr class="c-rowA">
01232                                         <td class="c-aa">'.$str.'</td>
01233                                         <td class="c-ab"></td>
01234                                 </tr>
01235                                 <tr class="c-rowB">
01236                                         <td class="c-ba"><img src="clear.gif" width="1" height="1" alt="" /></td>
01237                                         <td class="c-bb"><img src="clear.gif" width="1" height="1" alt="" /></td>
01238                                 </tr>
01239                         </table>';
01240                 return $str;
01241         }
01242 
01250         function menuItemsForTopFrame($menuItems)       {
01251                 reset($menuItems);
01252                 $out=array();
01253                 while(list(,$i)=each($menuItems))       {
01254                         if ($i[4]==1 && !$GLOBALS['SOBE']->doc->isCMlayers())   $i[4]=0;        // IF the topbar is the ONLY means of the click menu, then items normally disabled from the top menu will appear anyways IF they are disabled with a "1" (2+ will still disallow them in the topbar)
01255                         if (is_array($i) && !$i[4])     $out[]=$i[0];
01256                 }
01257                 return $out;
01258         }
01259 
01267         function menuItemsForClickMenu($menuItems)      {
01268                 reset($menuItems);
01269                 $out=array();
01270                 while(list($cc,$i)=each($menuItems))    {
01271                         if (is_string($i) && $i=='spacer')      {       // MAKE horizontal spacer
01272                                 $out[]='
01273                                         <tr class="bgColor2">
01274                                                 <td colspan="2"><img src="clear.gif" width="1" height="1" alt="" /></td>
01275                                         </tr>';
01276                         } else {        // Just make normal element:
01277                                 $onClick=$i[3];
01278                                 $onClick=eregi_replace('return[[:space:]]+hideCM\(\)[[:space:]]*;','',$onClick);
01279                                 $onClick=eregi_replace('return[[:space:]]+false[[:space:]]*;','',$onClick);
01280                                 $onClick=eregi_replace('hideCM\(\);','',$onClick);
01281                                 if (!$i[5])     $onClick.='hideEmpty();';
01282 
01283                                 if ($GLOBALS['TYPO3_CONF_VARS']['BE']['useOnContextMenuHandler'])   {
01284                                         $CSM = ' oncontextmenu="'.htmlspecialchars($onClick).';return false;"';
01285                                 }
01286 
01287                                 $out[]='
01288                                         <tr class="typo3-CSM-itemRow" onclick="'.htmlspecialchars($onClick).'" onmouseover="this.bgColor=\''.$GLOBALS['TBE_TEMPLATE']->bgColor5.'\';" onmouseout="this.bgColor=\'\';"'.$CSM.'>
01289                                                 '.(!$this->leftIcons?'<td class="typo3-CSM-item">'.$i[1].'</td><td align="center">'.$i[2].'</td>' : '<td align="center">'.$i[2].'</td><td class="typo3-CSM-item">'.$i[1].'</td>').'
01290                                         </tr>';
01291                         }
01292                 }
01293                 return $out;
01294         }
01295 
01305         function addMenuItems($menuItems,$newMenuItems,$position='')    {
01306                 if (is_array($newMenuItems))    {
01307 
01308                         if($position) {
01309 
01310                                 $posArr = t3lib_div::trimExplode(',', $position, 1);
01311                                 foreach($posArr as $pos) {
01312                                         list($place,$menuEntry) = t3lib_div::trimExplode(':', $pos, 1);
01313                                         list($place,$placeExtra) = t3lib_div::trimExplode('-', $place, 1);
01314 
01315                                                 // bottom
01316                                         $pointer = count($menuItems);
01317 
01318                                         $found=FALSE;
01319 
01320                                         if ($place) {
01321                                                 switch(strtolower($place))      {
01322                                                         case 'after':
01323                                                         case 'before':
01324                                                                 if ($menuEntry) {
01325                                                                         $p=1;
01326                                                                         reset ($menuItems);
01327                                                                         while (true) {
01328                                                                                 if (!strcmp(key($menuItems), $menuEntry))       {
01329                                                                                         $pointer = $p;
01330                                                                                         $found=TRUE;
01331                                                                                         break;
01332                                                                                 }
01333                                                                                 if (!next($menuItems)) break;
01334                                                                                 $p++;
01335                                                                         }
01336                                                                         if (!$found) break;
01337 
01338                                                                         if ($place=='before') {
01339                                                                                 $pointer--;
01340                                                                                 if ($placeExtra=='spacer' AND prev($menuItems)=='spacer') {
01341                                                                                         $pointer--;
01342                                                                                 }
01343                                                                         } elseif ($place=='after') {
01344                                                                                 if ($placeExtra=='spacer' AND next($menuItems)=='spacer') {
01345                                                                                         $pointer++;
01346                                                                                 }
01347                                                                         }
01348                                                                 }
01349                                                         break;
01350                                                         default:
01351                                                                 if (strtolower($place)=='top')  {
01352                                                                         $pointer = 0;
01353                                                                 } else {
01354                                                                         $pointer = count($menuItems);
01355