Documentation TYPO3 par Ameos |
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 2004-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 * 00017 * This script is distributed in the hope that it will be useful, 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 * GNU General Public License for more details. 00021 * 00022 * This copyright notice MUST APPEAR in all copies of the script! 00023 ***************************************************************/ 00051 class tx_version_cm1 { 00052 00060 function main(&$backRef,$menuItems,$table,$uid) { 00061 global $BE_USER,$TCA,$LANG; 00062 00063 $localItems = Array(); 00064 if (!$backRef->cmLevel) { 00065 00066 // Returns directly, because the clicked item was not from the pages table 00067 if (!$TCA[$table] && $TCA[$table]['ctrl']['versioning']) return $menuItems; 00068 00069 // Adds the regular item: 00070 $LL = $this->includeLL(); 00071 00072 // Repeat this (below) for as many items you want to add! 00073 // Remember to add entries in the localconf.php file for additional titles. 00074 $url = t3lib_extMgm::extRelPath("version")."cm1/index.php?table=".rawurlencode($table)."&uid=".$uid; 00075 $localItems[] = $backRef->linkItem( 00076 $GLOBALS["LANG"]->getLLL("cm1_title",$LL), 00077 $backRef->excludeIcon('<img src="'.$backRef->backPath.t3lib_extMgm::extRelPath("version").'cm1/cm_icon.gif" width="15" height="12" border=0 align=top>'), 00078 $backRef->urlRefForCM($url), 00079 1 // Disables the item in the top-bar. Set this to zero if you with the item to appear in the top bar! 00080 ); 00081 00082 00083 00084 // Find position of "delete" element: 00085 reset($menuItems); 00086 $c=0; 00087 while(list($k)=each($menuItems)) { 00088 $c++; 00089 if (!strcmp($k,"delete")) break; 00090 } 00091 // .. subtract two (delete item + divider line) 00092 $c-=2; 00093 // ... and insert the items just before the delete element. 00094 array_splice( 00095 $menuItems, 00096 $c, 00097 0, 00098 $localItems 00099 ); 00100 } 00101 return $menuItems; 00102 } 00103 00109 function includeLL() { 00110 global $LANG; 00111 00112 return $LANG->includeLLFile('EXT:version/locallang.php',FALSE); 00113 } 00114 } 00115 00116 00117 00118 if (defined("TYPO3_MODE") && $TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/version/class.tx_version_cm1.php"]) { 00119 include_once($TYPO3_CONF_VARS[TYPO3_MODE]["XCLASS"]["ext/version/class.tx_version_cm1.php"]); 00120 } 00121 ?>