Documentation TYPO3 par Ameos |
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 ***************************************************************/ 00067 class tx_extrapagecmoptions { 00068 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 if (!$backRef->cmLevel) { // LEVEL: Primary menu. 00087 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_pageheader',$backRef->disabledItems) && $table=='pages' && $backRef->editPageIconSet) 00106 $localItems['edit_pageheader'] = $backRef->DB_editPageHeader($uid); 00107 } 00108 00109 // Find delete element among the input menu items and insert the local items just before that: 00110 reset($menuItems); 00111 $c=0; 00112 $deleteFound = FALSE; 00113 while(list($k)=each($menuItems)) { 00114 $c++; 00115 if (!strcmp($k,'delete')) { 00116 $deleteFound = TRUE; 00117 break; 00118 } 00119 } 00120 00121 if ($deleteFound) { 00122 // .. subtract two... (delete item + its spacer element...) 00123 $c-=2; 00124 // and insert the items just before the delete element. 00125 array_splice( 00126 $menuItems, 00127 $c, 00128 0, 00129 $localItems 00130 ); 00131 } else { // If no delete item was found, then just merge in the items: 00132 $menuItems=array_merge($menuItems,$localItems); 00133 } 00134 } elseif ($subname==='moreoptions') { // LEVEL: Secondary level of menus (activated by an item on the first level). 00135 if ($backRef->editOK) { // If the page can be edited, then show this: 00136 if (!in_array('move_wizard',$backRef->disabledItems) && ($table=='pages' || $table=='tt_content')) $localItems['move_wizard']=$backRef->DB_moveWizard($table,$uid,$backRef->rec); 00137 if (!in_array('new_wizard',$backRef->disabledItems) && ($table=='pages' || $table=='tt_content')) $localItems['new_wizard']=$backRef->DB_newWizard($table,$uid,$backRef->rec); 00138 if (!in_array('history',$backRef->disabledItems)) $localItems['history']=$backRef->DB_history($table,$uid); 00139 if (!in_array('perms',$backRef->disabledItems) && $table=='pages' && $BE_USER->check('modules','web_perm')) $localItems['perms']=$backRef->DB_perms($table,$uid,$backRef->rec); 00140 if (!in_array('db_list',$backRef->disabledItems) && $BE_USER->check('modules','web_list')) $localItems['db_list']=$backRef->DB_db_list($table,$uid,$backRef->rec); 00141 } 00142 00143 // Temporary mount point item: 00144 if ($table=='pages') { 00145 $localItems['perms'] = $backRef->DB_tempMountPoint($uid); 00146 } 00147 00148 // Merge the locally made items into the current menu items passed to this function. 00149 $menuItems = array_merge($menuItems,$localItems); 00150 } 00151 return $menuItems; 00152 } 00153 00159 function includeLL() { 00160 global $LANG; 00161 00162 $LOCAL_LANG = $LANG->includeLLFile('EXT:extra_page_cm_options/locallang.php',FALSE); 00163 return $LOCAL_LANG; 00164 } 00165 } 00166 00167 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/extra_page_cm_options/class.tx_extrapagecmoptions.php']) { 00168 include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/extra_page_cm_options/class.tx_extrapagecmoptions.php']); 00169 } 00170 ?>