Main Page | Directories | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Class Members | File Members | Related Pages | Examples

alt_clickmenu.php

Go to the documentation of this file.
00001 <?php
00002 /***************************************************************
00003 *  Copyright notice
00004 *
00005 *  (c) 1999-2004 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 ***************************************************************/
00112 require ('init.php');
00113 require ('template.php');
00114 require_once (PATH_t3lib.'class.t3lib_clipboard.php');
00115 $LANG->includeLLFile('EXT:lang/locallang_misc.xml');
00116 
00117 
00118 
00119 
00128 class clickMenu {
00129 
00130       // Internal, static: GPvar:
00131    var $cmLevel=0;            // Defines if the click menu is first level or second. Second means the click menu is triggered from another menu.
00132    var $CB;             // Clipboard array (submitted by eg. pressing the paste button)
00133 
00134       // Internal, static:
00135    var $backPath='';       // Backpath for scripts/images.
00136    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)
00137    var $listFrame=0;       // If set, the calling document should be in the listframe of a frameset.
00138    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)
00139    var $alwaysContentFrame=0; // If true, the "content" frame is always used for reference (when condensed mode is enabled)
00140    var $iParts=array();    // Stores the parts of the input $item string, splitted by "|": [0] = table/file, [1] = uid/blank, [2] = flag: If set, listFrame, [3] = ("+" prefix = disable all by default, enable these. Default is to disable) Items key list
00141    var $disabledItems=array();   // Contains list of keywords of items to disable in the menu
00142    var $dontDisplayTopFrameCM=0; // If true, the context sensitive menu will not appear in the top frame, only as a layer.
00143    var $leftIcons=0;       // If true, Show icons on the left.
00144    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.
00145 
00146       // Internal, dynamic:
00147    var $elCount=0;            // Counter for elements in the menu. Used to number the name / id of the mouse-over icon.
00148    var $editPageIconSet=0;    // Set, when edit icon is drawn.
00149    var $editOK=0;          // Set to true, if editing of the element is OK.
00150    var $rec=array();
00151 
00152 
00153 
00160    function init($item) {
00161 
00162          // Setting GPvars:
00163       $this->cmLevel = intval(t3lib_div::_GP('cmLevel'));
00164       $this->CB = t3lib_div::_GP('CB');
00165 
00166 
00167          // Explode the incoming command:
00168       $this->iParts = explode('|',$item);
00169 
00170          // Setting flags:
00171       if ($this->iParts[2])   $this->listFrame=1;
00172       if ($GLOBALS['BE_USER']->uc['condensedMode']) $this->alwaysContentFrame=1;
00173       if (strcmp($this->iParts[1],'')) $this->isDBmenu=1;
00174 
00175       $TSkey =($this->isDBmenu?'page':'folder').($this->listFrame?'List':'Tree');
00176       $this->disabledItems = t3lib_div::trimExplode(',',$GLOBALS['BE_USER']->getTSConfigVal('options.contextMenu.'.$TSkey.'.disableItems'),1);
00177       $this->leftIcons = $GLOBALS['BE_USER']->getTSConfigVal('options.contextMenu.options.leftIcons');
00178 
00179          // &cmLevel flag detected (2nd level menu)
00180       if (!$this->cmLevel) {
00181             // Make 1st level clickmenu:
00182          if ($this->isDBmenu) {
00183             $CMcontent = $this->printDBClickMenu($this->iParts[0],$this->iParts[1]);
00184          } else {
00185             $CMcontent = $this->printFileClickMenu($this->iParts[0]);
00186          }
00187       } else {
00188             // Make 2nd level clickmenu (only for DBmenus)
00189          if ($this->isDBmenu) {
00190             $CMcontent = $this->printNewDBLevel($this->iParts[0],$this->iParts[1]);
00191          }
00192       }
00193 
00194          // Return clickmenu conten:
00195       return $CMcontent;
00196    }
00197 
00203    function doDisplayTopFrameCM()   {
00204       return !$GLOBALS['SOBE']->doc->isCMlayers() || !$this->dontDisplayTopFrameCM;
00205    }
00206 
00207 
00208 
00209 
00210 
00211 
00212 
00213 
00214 
00215 
00216 
00217 
00218    /***************************************
00219     *
00220     * DATABASE
00221     *
00222     ***************************************/
00223 
00231    function printDBClickMenu($table,$uid) {
00232       global $TCA, $BE_USER;
00233 
00234          // Get record:
00235       $this->rec = t3lib_BEfunc::getRecord($table,$uid);
00236       $menuItems=array();
00237       $root=0;
00238       if ($table=='pages' && !strcmp($uid,'0')) {  // Rootlevel
00239          $root=1;
00240       }
00241 
00242          // If record found (or root), go ahead and fill the $menuItems array which will contain data for the elements to render.
00243       if (is_array($this->rec) || $root)  {
00244             // Get permissions
00245          $lCP = $BE_USER->calcPerms(t3lib_BEfunc::getRecord('pages',($table=='pages'?$this->rec['uid']:$this->rec['pid'])));
00246 
00247             // View
00248          if (!in_array('view',$this->disabledItems))  {
00249             if ($table=='pages') $menuItems['view']=$this->DB_view($uid);
00250             if ($table==$GLOBALS['TYPO3_CONF_VARS']['SYS']['contentTable'])   $menuItems['view']=$this->DB_view($this->rec['pid'],'#'.$uid);
00251          }
00252 
00253             // Edit:
00254          if(!$root && ($BE_USER->isPSet($lCP,$table,'edit')||$BE_USER->isPSet($lCP,$table,'editcontent')))  {
00255             if (!in_array('edit',$this->disabledItems))     $menuItems['edit']=$this->DB_edit($table,$uid);
00256             $this->editOK=1;
00257          }
00258 
00259             // New:
00260          if (!in_array('new',$this->disabledItems) && $BE_USER->isPSet($lCP,$table,'new'))   $menuItems['new']=$this->DB_new($table,$uid);
00261 
00262             // Info:
00263          if(!in_array('info',$this->disabledItems) && !$root)  $menuItems['info']=$this->DB_info($table,$uid);
00264 
00265          $menuItems['spacer1']='spacer';
00266 
00267             // Copy:
00268          if(!in_array('copy',$this->disabledItems) && !$root)  $menuItems['copy']=$this->DB_copycut($table,$uid,'copy');
00269             // Cut:
00270          if(!in_array('cut',$this->disabledItems) && !$root)   $menuItems['cut']=$this->DB_copycut($table,$uid,'cut');
00271 
00272             // Paste:
00273          $elFromAllTables = count($this->clipObj->elFromTable(''));
00274          if (!in_array('paste',$this->disabledItems) && $elFromAllTables)  {
00275             $selItem = $this->clipObj->getSelectedRecord();
00276             $elInfo=array(
00277                $selItem['_RECORD_TITLE'],
00278                ($root?$GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename']:t3lib_div::fixed_lgd_cs(t3lib_BEfunc::getRecordTitle($table,$this->rec),$BE_USER->uc['titleLen'])),
00279                $this->clipObj->currentMode()
00280             );
00281             if ($table=='pages' && ($lCP & 8))  {
00282                if ($elFromAllTables)   $menuItems['pasteinto']=$this->DB_paste('',$uid,'into',$elInfo);
00283             }
00284 
00285             $elFromTable = count($this->clipObj->elFromTable($table));
00286             if (!$root && $elFromTable  && $TCA[$table]['ctrl']['sortby']) $menuItems['pasteafter']=$this->DB_paste($table,-$uid,'after',$elInfo);
00287          }
00288 
00289             // Delete:
00290          $elInfo=array(t3lib_div::fixed_lgd_cs(t3lib_BEfunc::getRecordTitle($table,$this->rec),$BE_USER->uc['titleLen']));
00291          if(!in_array('delete',$this->disabledItems) && !$root && $BE_USER->isPSet($lCP,$table,'delete'))   {
00292             $menuItems['spacer2']='spacer';
00293             $menuItems['delete']=$this->DB_delete($table,$uid,$elInfo);
00294          }
00295       }
00296 
00297          // Adding external elements to the menuItems array
00298       $menuItems = $this->processingByExtClassArray($menuItems,$table,$uid);
00299 
00300          // Processing by external functions?
00301       $menuItems = $this->externalProcessingOfDBMenuItems($menuItems);
00302 
00303          // Return the printed elements:
00304       return $this->printItems($menuItems,
00305          $root?
00306          '<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']):
00307          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,1)
00308       );
00309    }
00310 
00318    function printNewDBLevel($table,$uid)  {
00319       global $TCA, $BE_USER;
00320 
00321          // Setting internal record to the table/uid :
00322       $this->rec = t3lib_BEfunc::getRecord($table,$uid);
00323       $menuItems=array();
00324       $root=0;
00325       if ($table=='pages' && !strcmp($uid,'0')) {  // Rootlevel
00326          $root=1;
00327       }
00328 
00329          // If record was found, check permissions and get menu items.
00330       if (is_array($this->rec) || $root)  {
00331          $lCP = $BE_USER->calcPerms(t3lib_BEfunc::getRecord('pages',($table=='pages'?$this->rec['uid']:$this->rec['pid'])));
00332             // Edit:
00333          if(!$root && ($BE_USER->isPSet($lCP,$table,'edit')||$BE_USER->isPSet($lCP,$table,'editcontent')))  {
00334             $this->editOK=1;
00335          }
00336 
00337          $menuItems = $this->processingByExtClassArray($menuItems,$table,$uid);
00338       }
00339 
00340          // Return the printed elements:
00341       if (!is_array($menuItems)) $menuItems=array();
00342       return $this->printItems($menuItems,
00343          $root?
00344          '<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']):
00345          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,1)
00346       );
00347    }
00348 
00355    function externalProcessingOfDBMenuItems($menuItems)  {
00356       return $menuItems;
00357    }
00358 
00367    function processingByExtClassArray($menuItems,$table,$uid)  {
00368       if (is_array($this->extClassArray)) {
00369          reset($this->extClassArray);
00370          while(list(,$conf)=each($this->extClassArray))  {
00371             $obj=t3lib_div::makeInstance($conf['name']);
00372             $menuItems = $obj->main($this,$menuItems,$table,$uid);
00373          }
00374       }
00375       return $menuItems;
00376    }
00377 
00386    function urlRefForCM($url,$retUrl='',$hideCM=1) {
00387       $loc='top.content'.($this->listFrame && !$this->alwaysContentFrame ?'.list_frame':'');
00388       $editOnClick='var docRef=(top.content.list_frame)?top.content.list_frame:'.$loc.'; docRef.document.location=top.TS.PATH_typo3+\''.$url.'\''.
00389          ($retUrl?"+'&".$retUrl."='+top.rawurlencode(".$this->frameLocation('docRef.document').')':'').';'.
00390          ($hideCM?'return hideCM();':'');
00391       return $editOnClick;
00392    }
00393 
00403    function DB_copycut($table,$uid,$type) {
00404       if ($this->clipObj->current=='normal') {
00405          $isSel = $this->clipObj->isSelected($table,$uid);
00406       }
00407 
00408       $addParam = array();
00409       if ($this->listFrame)   {
00410          $addParam['reloadListFrame'] = ($this->alwaysContentFrame ? 2 : 1);
00411       }
00412 
00413       return $this->linkItem(
00414          $this->label($type),
00415          $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/clip_'.$type.($isSel==$type?'_h':'').'.gif','width="12" height="12"').' alt="" />'),
00416          "top.loadTopMenu('".$this->clipObj->selUrlDB($table,$uid,($type=='copy'?1:0),($isSel==$type),$addParam)."');return false;"
00417       );
00418    }
00419 
00432    function DB_paste($table,$uid,$type,$elInfo) {
00433       $editOnClick = '';
00434       $loc = 'top.content'.($this->listFrame && !$this->alwaysContentFrame ?'.list_frame':'');
00435       $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])).')';
00436       $editOnClick = 'if('.$conf.'){'.$loc.'.document.location=top.TS.PATH_typo3+\''.$this->clipObj->pasteUrl($table,$uid,0).'&redirect=\'+top.rawurlencode('.$this->frameLocation($loc.'.document').'); hideCM();}';
00437 
00438       return $this->linkItem(
00439          $this->label('paste'.$type),
00440          $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/clip_paste'.$type.'.gif','width="12" height="12"').' alt="" />'),
00441          $editOnClick.'return false;'
00442       );
00443    }
00444 
00453    function DB_info($table,$uid) {
00454       return $this->linkItem(
00455          $this->label('info'),
00456          $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/zoom2.gif','width="12" height="12"').' alt="" />'),
00457          "top.launchView('".$table."', '".$uid."'); return hideCM();"
00458       );
00459    }
00460 
00469    function DB_history($table,$uid) {
00470       $url = 'show_rechis.php?element='.rawurlencode($table.':'.$uid);
00471       return $this->linkItem(
00472          $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLL('CM_history')),
00473          $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/history2.gif','width="13" height="12"').' alt="" />'),
00474          $this->urlRefForCM($url,'returnUrl'),
00475          0
00476       );
00477    }
00478 
00488    function DB_perms($table,$uid,$rec) {
00489       $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':'');
00490       return $this->linkItem(
00491          $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLL('CM_perms')),
00492          $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/perm.gif','width="7" height="12"').' alt="" />'),
00493          $this->urlRefForCM($url),
00494          0
00495       );
00496    }
00497 
00507    function DB_db_list($table,$uid,$rec)  {
00508       $url = t3lib_div::getIndpEnv('TYPO3_REQUEST_DIR').'db_list.php?table='.($table=='pages'?'':$table).'&id='.($table=='pages'?$uid:$rec['pid']);
00509       return $this->linkItem(
00510          $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLL('CM_db_list')),
00511          $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/list.gif','width="11" height="11"').' alt="" />'),
00512          "top.nextLoadModuleUrl='".$url."';top.goToModule('web_list',1);",
00513          0
00514       );
00515    }
00516 
00526    function DB_moveWizard($table,$uid,$rec)  {
00527       $url = 'move_el.php?table='.$table.'&uid='.$uid.
00528             ($table=='tt_content'?'&sys_language_uid='.intval($rec['sys_language_uid']):''); // Hardcoded field for tt_content elements.
00529 
00530       return $this->linkItem(
00531          $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLL('CM_moveWizard'.($table=='pages'?'_page':''))),
00532          $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/move_'.($table=='pages'?'page':'record').'.gif','width="11" height="12"').' alt="" />'),
00533          $this->urlRefForCM($url,'returnUrl'),
00534          0
00535       );
00536    }
00537 
00547    function DB_newWizard($table,$uid,$rec)   {
00548          //  If mod.web_list.newContentWiz.overrideWithExtension is set, use that extension's create new content wizard instead:
00549       $tmpTSc = t3lib_BEfunc::getModTSconfig($this->pageinfo['uid'],'mod.web_list');
00550       $tmpTSc = $tmpTSc ['properties']['newContentWiz.']['overrideWithExtension'];
00551       $newContentWizScriptPath = t3lib_extMgm::isLoaded($tmpTSc) ? (t3lib_extMgm::extRelPath($tmpTSc).'mod1/db_new_content_el.php') : 'sysext/cms/layout/db_new_content_el.php';
00552 
00553       $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']);
00554       return $this->linkItem(
00555          $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLL('CM_newWizard')),
00556          $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/new_'.($table=='pages'?'page':'record').'.gif','width="'.($table=='pages'?'13':'16').'" height="12"').' alt="" />'),
00557          $this->urlRefForCM($url,'returnUrl'),
00558          0
00559       );
00560    }
00561 
00570    function DB_editAccess($table,$uid) {
00571       $addParam='&columnsOnly='.rawurlencode(implode(',',$GLOBALS['TCA'][$table]['ctrl']['enablecolumns']).($table=='pages' ? ',extendToSubpages' :''));
00572       $url = 'alt_doc.php?edit['.$table.']['.$uid.']=edit'.$addParam;
00573       return $this->linkItem(
00574          $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLL('CM_editAccess')),
00575          $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/editaccess.gif','width="12" height="12"').' alt="" />'),
00576          $this->urlRefForCM($url,'returnUrl'),
00577          1  // no top frame CM!
00578       );
00579    }
00580 
00588    function DB_editPageHeader($uid) {
00589       $url = 'alt_doc.php?edit[pages]['.$uid.']=edit';
00590       return $this->linkItem(
00591          $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->getLL('CM_editPageHeader')),
00592          $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/edit2.gif','width="11" height="12"').' alt="" />'),
00593          $this->urlRefForCM($url,'returnUrl'),
00594          1  // no top frame CM!
00595       );
00596    }
00597 
00606    function DB_edit($table,$uid) {
00607       global $BE_USER;
00608          // If another module was specified, replace the default Page module with the new one
00609       $newPageModule = trim($BE_USER->getTSConfigVal('options.overridePageModule'));
00610       $pageModule = t3lib_BEfunc::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';
00611 
00612       $editOnClick='';
00613       $loc='top.content'.($this->listFrame && !$this->alwaysContentFrame ?'.list_frame':'');
00614       $addParam='';
00615       $theIcon = t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/edit2.gif','width="11" height="12"');
00616       if (
00617             $this->iParts[0]=='pages' &&
00618             $this->iParts[1] &&
00619             $BE_USER->check('modules', $pageModule)
00620          )  {
00621          $theIcon = t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/edit_page.gif','width="12" height="12"');
00622          $this->editPageIconSet=1;
00623          if ($BE_USER->uc['classicPageEditMode'] || !t3lib_extMgm::isLoaded('cms')) {
00624             $addParam='&editRegularContentFromId='.intval($this->iParts[1]);
00625          } else {
00626             $editOnClick="top.fsMod.recentIds['web']=".intval($this->iParts[1]).";top.goToModule('".$pageModule."',1);";
00627          }
00628       }
00629       if (!$editOnClick)   {
00630          $editOnClick='if('.$loc.'){'.$loc.".document.location=top.TS.PATH_typo3+'alt_doc.php?returnUrl='+top.rawurlencode(".$this->frameLocation($loc.'.document').")+'&edit[".$table."][".$uid."]=edit".$addParam."';}";
00631       }
00632 
00633       return $this->linkItem(
00634          $this->label('edit'),
00635          $this->excludeIcon('<img'.$theIcon.' alt="" />'),
00636          $editOnClick.'return hideCM();'
00637       );
00638    }
00639 
00648    function DB_new($table,$uid)  {
00649       $editOnClick='';
00650       $loc='top.content'.(!$this->alwaysContentFrame?'.list_frame':'');
00651       $editOnClick='if('.$loc.'){'.$loc.".document.location=top.TS.PATH_typo3+'".
00652          ($this->listFrame?
00653             "alt_doc.php?returnUrl='+top.rawurlencode(".$this->frameLocation($loc.'.document').")+'&edit[".$table."][-".$uid."]=new'":
00654             'db_new.php?id='.intval($uid)."'").
00655          ';}';
00656 
00657       return $this->linkItem(
00658          $this->label('new'),
00659          $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="" />'),
00660          $editOnClick.'return hideCM();'
00661       );
00662    }
00663 
00673    function DB_delete($table,$uid,$elInfo)   {
00674       $editOnClick='';
00675       $loc='top.content'.($this->listFrame && !$this->alwaysContentFrame ?'.list_frame':'');
00676       $editOnClick='if('.$loc." && confirm(".$GLOBALS['LANG']->JScharCode(sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:mess.delete'),$elInfo[0])).")){".$loc.".document.location=top.TS.PATH_typo3+'tce_db.php?redirect='+top.rawurlencode(".$this->frameLocation($loc.'.document').")+'".
00677          "&cmd[".$table.']['.$uid.'][delete]=1&prErr=1&vC='.$GLOBALS['BE_USER']->veriCode()."';hideCM();}";
00678 
00679       return $this->linkItem(
00680          $this->label('delete'),
00681          $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/garbage.gif','width="11" height="12"').' alt="" />'),
00682          $editOnClick.'return false;'
00683       );
00684    }
00685 
00694    function DB_view($id,$anchor='') {
00695       return $this->linkItem(
00696          $this->label('view'),
00697          $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/zoom.gif','width="12" height="12"').' alt="" />'),
00698          t3lib_BEfunc::viewOnClick($id,$this->PH_backPath,t3lib_BEfunc::BEgetRootLine($id),$anchor).'return hideCM();'
00699       );
00700    }
00701 
00709    function DB_tempMountPoint($page_id)   {
00710       return $this->linkItem(
00711          $this->label('tempMountPoint'),
00712          #$this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/___.gif','width="12" height="12"').' alt="" />'),
00713          '',
00714          "if (top.content.nav_frame) { top.content.nav_frame.document.location = 'alt_db_navframe.php?setTempDBmount=".intval($page_id)."'; } return hideCM();"
00715       );
00716    }
00717 
00727    function DB_hideUnhide($table,$rec,$hideField)  {
00728       return $this->DB_changeFlag($table, $rec, $hideField, $this->label(($rec[$hideField]?'un':'').'hide'), 'hide');
00729    }
00730 
00742    function DB_changeFlag($table, $rec, $flagField, $title, $name, $iconRelPath='gfx/')    {
00743        $uid=$rec['uid'];
00744        $editOnClick='';
00745        $loc='top.content'.($this->listFrame && !$this->alwaysContentFrame ?'.list_frame':'');
00746        $editOnClick='if('.$loc.'){'.$loc.".document.location=top.TS.PATH_typo3+'tce_db.php?redirect='+top.rawurlencode(".$this->frameLocation($loc.'.document').")+'".
00747            "&data[".$table.']['.$uid.']['.$flagField.']='.($rec[$flagField]?0:1).'&prErr=1&vC='.$GLOBALS['BE_USER']->veriCode()."';hideCM();}";
00748 
00749        return $this->linkItem(
00750            $title,
00751            $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,$iconRelPath.'button_'.($rec[$flagField]?'un':'').$name.'.gif','width="11" height="10"').' alt="" />'),
00752            $editOnClick.'return false;',
00753            1
00754        );
00755    }
00756 
00757 
00758 
00759 
00760 
00761 
00762 
00763 
00764    /***************************************
00765     *
00766     * FILE
00767     *
00768     ***************************************/
00769 
00776    function printFileClickMenu($path)  {
00777       $menuItems=array();
00778 
00779       if (@file_exists($path) && t3lib_div::isAllowedAbsPath($path)) {
00780          $fI = pathinfo($path);
00781          $icon = is_dir($path) ? 'folder.gif' : t3lib_BEfunc::getFileIcon(strtolower($fI['extension']));
00782          $size=' ('.t3lib_div::formatSize(filesize($path)).'bytes)';
00783          $icon = '<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/fileicons/'.$icon,'width="18" height="16"').' class="absmiddle" title="'.htmlspecialchars($fI['basename'].$size).'" alt="" />';
00784 
00785             // edit
00786          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');
00787             // rename
00788          if (!in_array('rename',$this->disabledItems))   $menuItems['rename']=$this->FILE_launch($path,'file_rename.php','rename','rename.gif');
00789             // upload
00790          if (!in_array('upload',$this->disabledItems) && is_dir($path)) $menuItems['upload']=$this->FILE_launch($path,'file_upload.php','upload','upload.gif');
00791             // new
00792          if (!in_array('new',$this->disabledItems) && is_dir($path)) $menuItems['new']=$this->FILE_launch($path,'file_newfolder.php','new','new_file.gif');
00793             // info
00794          if (!in_array('info',$this->disabledItems))  $menuItems['info']=$this->DB_info($path,'');
00795 
00796          $menuItems[]='spacer';
00797 
00798             // copy:
00799          if (!in_array('copy',$this->disabledItems))  $menuItems['copy']=$this->FILE_copycut($path,'copy');
00800             // cut:
00801          if (!in_array('cut',$this->disabledItems))   $menuItems['cut']=$this->FILE_copycut($path,'cut');
00802 
00803             // Paste:
00804          $elFromAllTables = count($this->clipObj->elFromTable('_FILE'));
00805          if (!in_array('paste',$this->disabledItems) && $elFromAllTables && is_dir($path))   {
00806             $elArr = $this->clipObj->elFromTable('_FILE');
00807             reset($elArr);
00808             $selItem = current($elArr);
00809             $elInfo=array(
00810                basename($selItem),
00811                basename($path),
00812                $this->clipObj->currentMode()
00813             );
00814             $menuItems['pasteinto']=$this->FILE_paste($path,$selItem,$elInfo);
00815          }
00816 
00817          $menuItems[]='spacer';
00818 
00819             // delete:
00820          if (!in_array('delete',$this->disabledItems))   $menuItems['delete']=$this->FILE_delete($path);
00821       }
00822 
00823          // Adding external elements to the menuItems array
00824       $menuItems = $this->processingByExtClassArray($menuItems,$path,0);
00825 
00826          // Processing by external functions?
00827       $menuItems = $this->externalProcessingOfFileMenuItems($menuItems);
00828 
00829          // Return the printed elements:
00830       return $this->printItems($menuItems,$icon.basename($path));
00831    }
00832 
00833 
00840    function externalProcessingOfFileMenuItems($menuItems)   {
00841       return $menuItems;
00842    }
00843 
00854    function FILE_launch($path,$script,$type,$image)   {
00855       $loc='top.content'.(!$this->alwaysContentFrame?'.list_frame':'');
00856 
00857       $editOnClick='if('.$loc.'){'.$loc.".document.location=top.TS.PATH_typo3+'".$script.'?target='.rawurlencode($path)."&returnUrl='+top.rawurlencode(".$this->frameLocation($loc.'.document').");}";
00858 
00859       return $this->linkItem(
00860          $this->label($type),
00861          $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/'.$image,'width="12" height="12"').' alt="" />'),
00862          $editOnClick.'return hideCM();'
00863       );
00864    }
00865 
00874    function FILE_copycut($path,$type)  {
00875       $table = '_FILE';    // Pseudo table name for use in the clipboard.
00876       $uid = t3lib_div::shortmd5($path);
00877       if ($this->clipObj->current=='normal') {
00878          $isSel = $this->clipObj->isSelected($table,$uid);
00879       }
00880 
00881       $addParam = array();
00882       if ($this->listFrame)   {
00883          $addParam['reloadListFrame'] = ($this->alwaysContentFrame ? 2 : 1);
00884       }
00885 
00886       return $this->linkItem(
00887          $this->label($type),
00888          $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/clip_'.$type.($isSel==$type?'_h':'').'.gif','width="12" height="12"').' alt="" />'),
00889          "top.loadTopMenu('".$this->clipObj->selUrlFile($path,($type=='copy'?1:0),($isSel==$type),$addParam)."');return false;"
00890       );
00891    }
00892 
00900    function FILE_delete($path)   {
00901       $editOnClick='';
00902       $loc='top.content'.($this->listFrame && !$this->alwaysContentFrame ?'.list_frame':'');
00903       $editOnClick='if('.$loc." && confirm(".$GLOBALS['LANG']->JScharCode(sprintf($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:mess.delete'),basename($path))).")){".$loc.".document.location=top.TS.PATH_typo3+'tce_file.php?redirect='+top.rawurlencode(".$this->frameLocation($loc.'.document').")+'".
00904          "&file[delete][0][data]=".rawurlencode($path).'&vC='.$GLOBALS['BE_USER']->veriCode()."';hideCM();}";
00905 
00906       return $this->linkItem(
00907          $this->label('delete'),
00908          $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/garbage.gif','width="11" height="12"').' alt="" />'),
00909          $editOnClick.'return false;'
00910       );
00911    }
00912 
00922    function FILE_paste($path,$target,$elInfo)   {
00923       $editOnClick='';
00924       $loc='top.content'.($this->listFrame && !$this->alwaysContentFrame ?'.list_frame':'');
00925       $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])).")";
00926       $editOnClick='if('.$conf.'){'.$loc.".document.location=top.TS.PATH_typo3+'".$this->clipObj->pasteUrl('_FILE',$path,0).
00927          "&redirect='+top.rawurlencode(".$this->frameLocation($loc.'.document').'); hideCM();}';
00928 
00929       return $this->linkItem(
00930          $this->label('pasteinto'),
00931          $this->excludeIcon('<img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/clip_pasteinto.gif','width="12" height="12"').' alt="" />'),
00932          $editOnClick.'return false;'
00933       );
00934    }
00935 
00936 
00937 
00938 
00939 
00940 
00941 
00942 
00943 
00944 
00945 
00946 
00947 
00948    /***************************************
00949     *
00950     * COMMON
00951     *
00952     **************************************/
00953 
00962    function printItems($menuItems,$item)  {
00963 
00964       $out='';
00965 
00966          // Enable/Disable items:
00967       $menuItems = $this->enableDisableItems($menuItems);
00968 
00969          // Clean up spacers:
00970       $menuItems = $this->cleanUpSpacers($menuItems);
00971 
00972          // Adding topframe part (horizontal clickmenu)
00973       if ($this->doDisplayTopFrameCM())   {
00974          $out.= '
00975 
00976             <!--
00977                Table, which contains the click menu when shown in the top frame of the backend:
00978             -->
00979             <table border="0" cellpadding="0" cellspacing="0" id="typo3-CSM-top">
00980                <tr>
00981 
00982                      <!-- Items: -->
00983                   <td class="c-item">'.
00984                      implode('</td>
00985                   <td><img'.t3lib_iconWorks::skinImg($this->PH_backPath,'gfx/acm_spacer2.gif','width="8" height="12"').' alt="" /></td>
00986                   <td class="c-item">',$this->menuItemsForTopFrame($menuItems)).
00987                   '</td>
00988 
00989                      <!-- Close button: -->
00990                   <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>
00991 
00992                      <!-- The item of the clickmenu: -->
00993                   <td class="c-itemicon">'.$item.'</td>
00994                </tr>
00995             </table>
00996          ';
00997 
00998             // Set remaining BACK_PATH to blank (if any)
00999          $out = str_replace($this->PH_backPath,'',$out);
01000       }
01001          // Adding JS part:
01002       $out.=$this->printLayerJScode($menuItems);
01003 
01004          // Return the content
01005       return $out;
01006    }
01007 
01014    function printLayerJScode($menuItems)  {
01015       $script='';
01016       if ($this->isCMlayers())   {  // Clipboard must not be submitted - then it's probably a copy/cut situation.
01017          $frameName = '.'.($this->listFrame ? 'list_frame' : 'nav_frame');
01018          if ($this->alwaysContentFrame)   $frameName='';
01019 
01020             // Create the table displayed in the clickmenu layer:
01021          $CMtable = '
01022             <table border="0" cellpadding="0" cellspacing="0" class="typo3-CSM bgColor4">
01023                '.implode('',$this->menuItemsForClickMenu($menuItems)).'
01024             </table>';
01025 
01026             // Wrap the inner table in another table to create outer border:
01027          $CMtable = $this->wrapColorTableCM($CMtable);
01028 
01029             // Set back path place holder to real back path
01030          $CMtable = str_replace($this->PH_backPath,$this->backPath,$CMtable);
01031 
01032             // Create JavaScript section:
01033          $script=$GLOBALS['TBE_TEMPLATE']->wrapScriptTags('
01034 
01035 if (top.content && top.content'.$frameName.' && top.content'.$frameName.'.setLayerObj) {
01036    top.content'.$frameName.'.setLayerObj(unescape("'.t3lib_div::rawurlencodeJS($CMtable).'"),'.$this->cmLevel.');
01037 }
01038 '.(!$this->doDisplayTopFrameCM()?'hideCM();':'')
01039 );
01040       }
01041 
01042       return $script;
01043    }
01044 
01052    function wrapColorTableCM($str)  {
01053 
01054          // Clear-gifs needed if opera is to set the table row height correctly in skins.
01055       $str = '<table border="0" cellspacing="0" class="typo3-CSM-wrapperCM">
01056             <tr class="c-rowA">
01057                <td class="c-aa">'.$str.'</td>
01058                <td class="c-ab"></td>
01059             </tr>
01060             <tr class="c-rowB">
01061                <td class="c-ba"><img src="clear.gif" width="1" height="1" alt="" /></td>
01062                <td class="c-bb"><img src="clear.gif" width="1" height="1" alt="" /></td>
01063             </tr>
01064          </table>';
01065       return $str;
01066    }
01067 
01075    function menuItemsForTopFrame($menuItems) {
01076       reset($menuItems);
01077       $out=array();
01078       while(list(,$i)=each($menuItems))   {
01079          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)
01080          if (is_array($i) && !$i[4])   $out[]=$i[0];
01081       }
01082       return $out;
01083    }
01084 
01092    function menuItemsForClickMenu($menuItems)   {
01093       reset($menuItems);
01094       $out=array();
01095       while(list($cc,$i)=each($menuItems))   {
01096          if (is_string($i) && $i=='spacer')  {  // MAKE horizontal spacer
01097             $out[]='
01098                <tr class="bgColor2">
01099                   <td colspan="2"><img src="clear.gif" width="1" height="1" alt="" /></td>
01100                </tr>';
01101          } else { // Just make normal element:
01102             $onClick=$i[3];
01103             $onClick=eregi_replace('return[[:space:]]+hideCM\(\)[[:space:]]*;','',$onClick);
01104             $onClick=eregi_replace('return[[:space:]]+false[[:space:]]*;','',$onClick);
01105             $onClick=eregi_replace('hideCM\(\);','',$onClick);
01106             if (!$i[5]) $onClick.='hideEmpty();';
01107 
01108             $out[]='
01109                <tr class="typo3-CSM-itemRow" onclick="'.htmlspecialchars($onClick).'" onmouseover="this.bgColor=\''.$GLOBALS['TBE_TEMPLATE']->bgColor5.'\';" onmouseout="this.bgColor=\'\';">
01110                   '.(!$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>').'
01111                </tr>';
01112          }
01113       }
01114       return $out;
01115    }
01116 
01126    function addMenuItems($menuItems,$newMenuItems,$position='')   {
01127       if (is_array($newMenuItems))  {
01128 
01129          if($position) {
01130 
01131             $posArr = t3lib_div::trimExplode(',', $position, 1);
01132             foreach($posArr as $pos) {
01133                list($place,$menuEntry) = t3lib_div::trimExplode(':', $pos, 1);
01134                list($place,$placeExtra) = t3lib_div::trimExplode('-', $place, 1);
01135 
01136                   // bottom
01137                $pointer = count($menuItems);
01138 
01139                $found=FALSE;
01140 
01141                if ($place) {
01142                   switch(strtolower($place)) {
01143                      case 'after':
01144                      case 'before':
01145                         if ($menuEntry) {
01146                            $p=1;
01147                            reset ($menuItems);
01148                            while (true) {
01149                               if (!strcmp(key($menuItems), $menuEntry)) {
01150                                  $pointer = $p;
01151                                  $found=TRUE;
01152                                  break;
01153                               }
01154                               if (!next($menuItems)) break;
01155                               $p++;
01156                            }
01157                            if (!$found) break;
01158 
01159                            if ($place=='before') {
01160                               $pointer--;
01161                               if ($placeExtra=='spacer' AND prev($menuItems)=='spacer') {
01162                                  $pointer--;
01163                               }
01164                            } elseif ($place=='after') {
01165                               if ($placeExtra=='spacer' AND next($menuItems)=='spacer') {
01166                                  $pointer++;
01167                               }
01168                            }
01169                         }
01170                      break;
01171                      default:
01172                         if (strtolower($place)=='top')   {
01173                            $pointer = 0;
01174                         } else {
01175                            $pointer = count($menuItems);
01176                         }
01177                         $found=TRUE;
01178                      break;
01179                   }
01180                }
01181                if($found) break;
01182             }
01183          }
01184          $pointer=max(0,$pointer);
01185          $menuItemsBefore = array_slice($menuItems, 0, ($pointer?$pointer:0));
01186          $menuItemsAfter = array_slice($menuItems, $pointer);
01187          $menuItems = $menuItemsBefore + $newMenuItems + $menuItemsAfter;
01188       }
01189       return $menuItems;
01190    }
01191 
01202    function linkItem($str,$icon,$onClick,$onlyCM=0,$dontHide=0)   {
01203       $this->elCount++;
01204 
01205       $WHattribs = t3lib_iconWorks::skinImg($BACK_PATH,'gfx/content_client.gif','width="7" height="10"',2);
01206 
01207       return array(
01208          '<img src="clear.gif" '.$WHattribs.' class="c-roimg" name="roimg_'.$this->elCount.'" alt="" />'.
01209             '<a href="#" onclick="'.htmlspecialchars($onClick).'" onmouseover="mo('.$this->elCount.');" onmouseout="mout('.$this->elCount.');">'.
01210             $str.$icon.
01211             '</a>',
01212          $str,
01213          $icon,
01214          $onClick,
01215          $onlyCM,
01216          $dontHide
01217       );
01218    }
01219 
01226    function excludeIcon($iconCode)  {
01227       return ($GLOBALS['BE_USER']->uc['noMenuMode'] && strcmp($GLOBALS['BE_USER']->uc['noMenuMode'],'icons')) ? '' : ' '.$iconCode;
01228    }
01229 
01236    function enableDisableItems($menuItems)   {
01237       if ($this->iParts[3])   {
01238 
01239             // Detect "only" mode: (only showing listed items)
01240          if (substr($this->iParts[3],0,1)=='+') {
01241             $this->iParts[3] = substr($this->iParts[3],1);
01242             $only = TRUE;
01243          } else {
01244             $only = FALSE;
01245          }
01246 
01247             // Do filtering:
01248          if ($only)  {  // Transfer ONLY elements which are mentioned (or are spacers)
01249             $newMenuArray = array();
01250             foreach($menuItems as $key => $value)  {
01251                if (t3lib_div::inList($this->iParts[3], $key) || (is_string($value) && $value=='spacer')) {
01252                   $newMenuArray[$key] = $value;
01253                }
01254             }
01255             $menuItems = $newMenuArray;
01256          } else { // Traverse all elements except those listed (just unsetting them):
01257             $elements = t3lib_div::trimExplode(',',$this->iParts[3],1);
01258             foreach($elements as $value)  {
01259                unset($menuItems[$value]);
01260             }
01261          }
01262       }
01263 
01264          // Return processed menu items:
01265       return $menuItems;
01266    }
01267 
01274    function cleanUpSpacers($menuItems) {
01275 
01276          // Remove doubles:
01277       $prevItemWasSpacer = FALSE;
01278       foreach($menuItems as $key => $value)  {
01279          if (is_string($value) && $value=='spacer')   {
01280             if ($prevItemWasSpacer) {
01281                unset($menuItems[$key]);
01282             }
01283             $prevItemWasSpacer = TRUE;
01284          } else {
01285             $prevItemWasSpacer = FALSE;
01286          }
01287       }
01288 
01289          // Remove first:
01290       reset($menuItems);
01291       $key = key($menuItems);
01292       $value = current($menuItems);
01293       if (is_string($value) && $value=='spacer')   {
01294          unset($menuItems[$key]);
01295       }
01296 
01297 
01298          // Remove last:
01299       end($menuItems);
01300       $key = key($menuItems);
01301       $value = current($menuItems);
01302       if (is_string($value) && $value=='spacer')   {
01303          unset($menuItems[$key]);
01304       }
01305 
01306          // Return processed menu items:
01307       return $menuItems;
01308    }
01309 
01316    function label($label)  {
01317       return $GLOBALS['LANG']->makeEntities($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:cm.'.$label,1));
01318    }
01319 
01325    function isCMlayers()   {
01326       return $GLOBALS['SOBE']->doc->isCMlayers() && !$this->CB;
01327    }
01328 
01335    function frameLocation($str)  {
01336       return $str.'.location';
01337    }
01338 }
01339 
01340 
01341 
01342 
01343 
01344 
01345 
01346 
01347 
01348 
01349 
01350 
01351 
01360 class SC_alt_clickmenu {
01361 
01362       // Internal, static: GPvar:
01363    var $backPath;             // Back path.
01364    var $item;                 // Definition of which item the click menu should be made for.
01365    var $reloadListFrame;         // Defines the name of the document object for which to reload the URL.
01366 
01367       // Internal:
01368    var $content='';           // Content accumulation
01369    var $doc;                  // Template object
01370    var $include_once=array();    // Files to include_once() - set in init() function
01371    var $extClassArray=array();      // Internal array of classes for extending the clickmenu
01372    var $dontDisplayTopFrameCM=0; // If set, then the clickmenu will NOT display in the top frame.
01373 
01379    function init()   {
01380       global $BE_USER,$BACK_PATH;
01381 
01382          // Setting GPvars:
01383       $this->backPath = t3lib_div::_GP('backPath');
01384       $this->item = t3lib_div::_GP('item');
01385       $this->reloadListFrame = t3lib_div::_GP('reloadListFrame');
01386 
01387          // Setting pseudo module name
01388       $this->MCONF['name']='xMOD_alt_clickmenu.php';
01389 
01390          // Takes the backPath as a parameter BUT since we are worried about someone forging a backPath (XSS security hole) we will check with sent md5 hash:
01391       $inputBP = explode('|',$this->backPath);
01392       if (count($inputBP)==2 && $inputBP[1]==t3lib_div::shortMD5($inputBP[0].'|'.$GLOBALS['TYPO3_CONF_VARS']['SYS']['encryptionKey'])) {
01393          $this->backPath = $inputBP[0];
01394       } else {
01395          $this->backPath = $BACK_PATH;
01396       }
01397 
01398          // Setting internal array of classes for extending the clickmenu:
01399       $this->extClassArray = $GLOBALS['TBE_MODULES_EXT']['xMOD_alt_clickmenu']['extendCMclasses'];
01400 
01401          // Traversing that array and setting files for inclusion:
01402       if (is_array($this->extClassArray)) {
01403          foreach($this->extClassArray as $extClassConf)  {
01404             if ($extClassConf['path']) $this->include_once[]=$extClassConf['path'];
01405          }
01406       }
01407 
01408          // Initialize template object
01409       $this->doc = t3lib_div::makeInstance('template');
01410       $this->doc->docType='xhtml_trans';
01411       $this->doc->backPath = $BACK_PATH;
01412 
01413          // Setting mode for display and background image in the top frame
01414       $this->dontDisplayTopFrameCM= $this->doc->isCMlayers() && !$BE_USER->getTSConfigVal('options.contextMenu.options.alwaysShowClickMenuInTopFrame');
01415       if ($this->dontDisplayTopFrameCM)   {
01416          $this->doc->bodyTagId.= '-notop';
01417       }
01418 
01419          // Setting clickmenu timeout
01420       $secs = t3lib_div::intInRange($BE_USER->getTSConfigVal('options.contextMenu.options.clickMenuTimeOut'),1,100,5);  // default is 5
01421 
01422          // Setting the JavaScript controlling the timer on the page
01423       $listFrameDoc = $this->reloadListFrame!=2 ? 'top.content.list_frame' : 'top.content';
01424       $this->doc->JScode.=$this->doc->wrapScriptTags('
01425    var date = new Date();
01426    var mo_timeout = Math.floor(date.getTime()/1000);
01427 
01428    roImg =new Image();
01429    roImg.src = "'.t3lib_iconWorks::skinImg($BACK_PATH,'gfx/content_client.gif','width="7" height="10"',1).'";
01430 
01431    routImg =new Image();
01432    routImg.src = "clear.gif";
01433 
01434    function mo(c) {  //
01435       var name="roimg_"+c;
01436       document[name].src = roImg.src;
01437       updateTime();
01438    }
01439    function mout(c)  {  //
01440       var name="roimg_"+c;
01441       document[name].src = routImg.src;
01442       updateTime();
01443    }
01444    function updateTime()   {  //
01445       date = new Date();
01446       mo_timeout = Math.floor(date.getTime()/1000);
01447    }
01448    function timeout_func() {  //
01449       date = new Date();
01450       if (Math.floor(date.getTime()/1000)-mo_timeout > '.$secs.') {
01451          hideCM();
01452          return false;
01453       } else {
01454          window.setTimeout("timeout_func();",1*1000);
01455       }
01456    }
01457    function hideCM() {  //
01458       document.location="alt_topmenu_dummy.php";
01459       return false;
01460    }
01461 
01462       // Start timer
01463    timeout_func();
01464 
01465    '.($this->reloadListFrame ? '
01466       // Reload list frame:
01467    if('.$listFrameDoc.'){'.$listFrameDoc.'.document.location='.$listFrameDoc.'.document.location;}' :
01468    '').'
01469       ');
01470    }
01471 
01477    function main()   {
01478 
01479          // Initialize Clipboard object:
01480       $clipObj = t3lib_div::makeInstance('t3lib_clipboard');
01481       $clipObj->initializeClipboard();
01482       $clipObj->lockToNormal();  // This locks the clipboard to the Normal for this request.
01483 
01484          // Update clipboard if some actions are sent.
01485       $CB = t3lib_div::_GET('CB');
01486       $clipObj->setCmd($CB);
01487       $clipObj->cleanCurrent();
01488       $clipObj->endClipboard();  // Saves
01489 
01490          // Create clickmenu object
01491       $clickMenu = t3lib_div::makeInstance('clickMenu');
01492 
01493          // Set internal vars in clickmenu object:
01494       $clickMenu->clipObj = $clipObj;
01495       $clickMenu->extClassArray = $this->extClassArray;
01496       $clickMenu->dontDisplayTopFrameCM = $this->dontDisplayTopFrameCM;
01497       $clickMenu->backPath = $this->backPath;
01498 
01499          // Start page
01500       $this->content.=$this->doc->startPage('Context Sensitive Menu');
01501 
01502          // Set content of the clickmenu with the incoming var, "item"
01503       $this->content.= $clickMenu->init($this->item);
01504    }
01505 
01511    function printContent() {
01512       $this->content.= $this->doc->endPage();
01513       echo $this->content;
01514    }
01515 }
01516 
01517 // Include extension?
01518 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_clickmenu.php']) {
01519    include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_clickmenu.php']);
01520 }
01521 
01522 
01523 
01524 
01525 
01526 
01527 
01528 
01529 
01530 
01531 // Make instance:
01532 $SOBE = t3lib_div::makeInstance('SC_alt_clickmenu');
01533 $SOBE->init();
01534 
01535 // Include files?
01536 foreach($SOBE->include_once as $INC_FILE) include_once($INC_FILE);
01537 
01538 $SOBE->main();
01539 $SOBE->printContent();
01540 ?>

Generated on Sun Oct 3 01:05:53 2004 for TYPO3core 3.7.0 dev by  doxygen 1.3.8-20040913