|
TYPO3 API
SVNRelease
|
00001 <?php 00002 /*************************************************************** 00003 * Copyright notice 00004 * 00005 * (c) 2004-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 * 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 ***************************************************************/ 00024 /** 00025 * Addition of the versioning item to the clickmenu 00026 * 00027 * @author Kasper Skårhøj <kasperYYYY@typo3.com> 00028 */ 00029 /** 00030 * [CLASS/FUNCTION INDEX of SCRIPT] 00031 * 00032 * 00033 * 00034 * 54: class tx_version_cm1 00035 * 65: function main(&$backRef,$menuItems,$table,$uid) 00036 * 111: function includeLL() 00037 * 00038 * TOTAL FUNCTIONS: 2 00039 * (This index is automatically created/updated by the extension "extdeveval") 00040 * 00041 */ 00042 00043 00044 00045 00046 00047 /** 00048 * "Versioning" item added to click menu of elements. 00049 * 00050 * @author Kasper Skårhøj <kasperYYYY@typo3.com> 00051 * @package TYPO3 00052 * @subpackage core 00053 */ 00054 class tx_version_cm1 { 00055 00056 /** 00057 * Main function, adding the item to input menuItems array 00058 * 00059 * @param object References to parent clickmenu objects. 00060 * @param array Array of existing menu items accumulated. New element added to this. 00061 * @param string Table name of the element 00062 * @param integer Record UID of the element 00063 * @return array Modified menuItems array 00064 */ 00065 function main(&$backRef,$menuItems,$table,$uid) { 00066 global $BE_USER,$TCA,$LANG; 00067 00068 $localItems = Array(); 00069 if (!$backRef->cmLevel && $uid>0 && $BE_USER->check('modules','web_txversionM1')) { 00070 00071 // Returns directly, because the clicked item was not from the pages table 00072 if (in_array('versioning', $backRef->disabledItems) || !$TCA[$table] || !$TCA[$table]['ctrl']['versioningWS']) { 00073 return $menuItems; 00074 } 00075 00076 // Adds the regular item 00077 $LL = $this->includeLL(); 00078 00079 // "Versioning" element added: 00080 $url = t3lib_extMgm::extRelPath('version').'cm1/index.php?table='.rawurlencode($table).'&uid='.$uid; 00081 $localItems[] = $backRef->linkItem( 00082 $GLOBALS['LANG']->getLLL('title',$LL), 00083 $backRef->excludeIcon('<img src="'.$backRef->backPath.t3lib_extMgm::extRelPath('version').'cm1/cm_icon.gif" width="15" height="12" border="0" align="top" alt="" />'), 00084 $backRef->urlRefForCM($url), 00085 1 00086 ); 00087 00088 // "Send to review" element added: 00089 /* 00090 $url = t3lib_extMgm::extRelPath('version').'cm1/index.php?id='.($table=='pages'?$uid:$backRef->rec['pid']).'&table='.rawurlencode($table).'&uid='.$uid.'&sendToReview=1'; 00091 $localItems[] = $backRef->linkItem( 00092 $GLOBALS['LANG']->getLLL('title_review',$LL), 00093 $backRef->excludeIcon('<img src="'.$backRef->backPath.t3lib_extMgm::extRelPath('version').'cm1/cm_icon.gif" width="15" height="12" border="0" align="top" alt="" />'), 00094 $backRef->urlRefForCM($url), 00095 1 00096 ); 00097 */ 00098 00099 // Find position of "delete" element: 00100 $c=0; 00101 foreach ($menuItems as $k => $value) { 00102 $c++; 00103 if (!strcmp($k,'delete')) break; 00104 } 00105 // .. subtract two (delete item + divider line) 00106 $c-=2; 00107 // ... and insert the items just before the delete element. 00108 array_splice( 00109 $menuItems, 00110 $c, 00111 0, 00112 $localItems 00113 ); 00114 } 00115 return $menuItems; 00116 } 00117 00118 /** 00119 * Includes the [extDir]/locallang.php and returns the $LOCAL_LANG array found in that file. 00120 * 00121 * @return array Local lang array 00122 */ 00123 function includeLL() { 00124 global $LANG; 00125 00126 return $LANG->includeLLFile('EXT:version/locallang.xml',FALSE); 00127 } 00128 } 00129 00130 00131 00132 if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/version/class.tx_version_cm1.php'])) { 00133 include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['ext/version/class.tx_version_cm1.php']); 00134 } 00135 ?>
1.8.0