|
TYPO3 API
SVNRelease
|
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 1999-2011 Kasper Skårhøj (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 ***************************************************************/ 00027 /** 00028 * Class, adding extra context menu options 00029 * 00030 * $Id: class.tx_extrapagecmoptions.php 10120 2011-01-18 20:03:36Z ohader $ 00031 * Revised for TYPO3 3.6 November/2003 by Kasper Skårhøj 00032 * 00033 * @author Kasper Skårhøj <kasperYYYY@typo3.com> 00034 */ 00035 /** 00036 * [CLASS/FUNCTION INDEX of SCRIPT] 00037 * 00038 * 00039 * 00040 * 67: class tx_extrapagecmoptions 00041 * 79: function main(&$backRef,$menuItems,$table,$uid) 00042 * 158: function includeLL() 00043 * 00044 * TOTAL FUNCTIONS: 2 00045 * (This index is automatically created/updated by the extension "extdeveval") 00046 * 00047 */ 00048 00049 00050 00051 00052 00053 00054 00055 00056 00057 00058 00059 00060 /** 00061 * Class, adding extra context menu options 00062 * 00063 * @author Kasper Skårhøj <kasperYYYY@typo3.com> 00064 * @package TYPO3 00065 * @subpackage tx_extrapagecmoptions 00066 */ 00067 class tx_extrapagecmoptions { 00068 00069 /** 00070 * Adding various standard options to the context menu. 00071 * This includes both first and second level. 00072 * 00073 * @param object The calling object. Value by reference. 00074 * @param array Array with the currently collected menu items to show. 00075 * @param string Table name of clicked item. 00076 * @param integer UID of clicked item. 00077 * @return array Modified $menuItems array 00078 */ 00079 function main(&$backRef,$menuItems,$table,$uid) { 00080 global $BE_USER,$TCA,$LANG; 00081 00082 $localItems = array(); // Accumulation of local items. 00083 $subname = t3lib_div::_GP('subname'); 00084 00085 // Detecting menu level 00086 // LEVEL: Primary menu. 00087 if (!in_array('moreoptions', $backRef->disabledItems) && !$backRef->cmLevel) { 00088 // Creating menu items here: 00089 if ($backRef->editOK) { 00090 $LL = $this->includeLL(); 00091 00092 $localItems[]='spacer'; 00093 $localItems['moreoptions']=$backRef->linkItem( 00094 $GLOBALS['LANG']->makeEntities($LANG->getLLL('label',$LL)), 00095 $backRef->excludeIcon(''), 00096 "top.loadTopMenu('".t3lib_div::linkThisScript()."&cmLevel=1&subname=moreoptions');return false;", 00097 0, 00098 1 00099 ); 00100 00101 if (!in_array('hide',$backRef->disabledItems) && is_array($TCA[$table]['ctrl']['enablecolumns']) && $TCA[$table]['ctrl']['enablecolumns']['disabled']) 00102 $localItems['hide'] = $backRef->DB_hideUnhide($table,$backRef->rec,$TCA[$table]['ctrl']['enablecolumns']['disabled']); 00103 if (!in_array('edit_access',$backRef->disabledItems) && is_array($TCA[$table]['ctrl']['enablecolumns'])) 00104 $localItems['edit_access'] = $backRef->DB_editAccess($table,$uid); 00105 if (!in_array('edit_pageproperties',$backRef->disabledItems) && $table=='pages' && $backRef->editPageIconSet) 00106 $localItems['edit_pageproperties'] = $backRef->DB_editPageProperties($uid); 00107 } 00108 00109 // Find delete element among the input menu items and insert the local items just before that: 00110 $c=0; 00111 $deleteFound = FALSE; 00112 foreach ($menuItems as $k => $value) { 00113 $c++; 00114 if (!strcmp($k,'delete')) { 00115 $deleteFound = TRUE; 00116 break; 00117 } 00118 } 00119 00120 if ($deleteFound) { 00121 // .. subtract two... (delete item + its spacer element...) 00122 $c-=2; 00123 // and insert the items just before the delete element. 00124 array_splice( 00125 $menuItems, 00126 $c, 00127 0, 00128 $localItems 00129 ); 00130 } else { // If no delete item was found, then just merge in the items: 00131 $menuItems=array_merge($menuItems,$localItems); 00132 } 00133 } elseif ($subname==='moreoptions') { // LEVEL: Secondary level of menus (activated by an item on the first level). 00134 if ($backRef->editOK) { // If the page can be edited, then show this: 00135 if (!in_array('move_wizard',$backRef->disabledItems) && ($table=='pages' || $table=='tt_content')) $localItems['move_wizard']=$backRef->DB_moveWizard($table,$uid,$backRef->rec); 00136 if (!in_array('new_wizard',$backRef->disabledItems) && ($table=='pages' || $table=='tt_content')) $localItems['new_wizard']=$backRef->DB_newWizard($table,$uid,$backRef->rec); 00137 if (!in_array('perms',$backRef->disabledItems) && $table=='pages' && $BE_USER->check('modules','web_perm')) $localItems['perms']=$backRef->DB_perms($table,$uid,$backRef->rec); 00138 if (!in_array('db_list',$backRef->disabledItems) && $BE_USER->check('modules','web_list')) $localItems['db_list']=$backRef->DB_db_list($table,$uid,$backRef->rec); 00139 } 00140 00141 // Temporary mount point item: 00142 if ($table=='pages') { 00143 $localItems['temp_mount_point'] = $backRef->DB_tempMountPoint($uid); 00144 } 00145 00146 // Merge the locally made items into the current menu items passed to this function. 00147 $menuItems = array_merge($menuItems,$localItems); 00148 } 00149 return $menuItems; 00150 } 00151 00152 /** 00153 * Include local lang file. 00154 * 00155 * @return array Local lang array. 00156 */ 00157 function includeLL() { 00158 global $LANG; 00159 00160 $LOCAL_LANG = $LANG->includeLLFile('EXT:extra_page_cm_options/locallang.php',FALSE); 00161 return $LOCAL_LANG; 00162 } 00163 } 00164 00165 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/extra_page_cm_options/class.tx_extrapagecmoptions.php'])) { 00166 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/extra_page_cm_options/class.tx_extrapagecmoptions.php']); 00167 } 00168 00169 ?>
1.8.0