"TYPO3 4.0.1: typo3_src-4.0.1/typo3/sysext/version/class.tx_version_cm1.php Source File", "datetime" => "Sat Dec 2 19:22:34 2006", "date" => "2 Dec 2006", "doxygenversion" => "1.4.6", "projectname" => "TYPO3 4.0.1", "projectnumber" => "4.0.1" ); get_header($doxygen_vars); ?>

class.tx_version_cm1.php

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 ***************************************************************/
00054 class tx_version_cm1 {
00055 
00065         function main(&$backRef,$menuItems,$table,$uid) {
00066                 global $BE_USER,$TCA,$LANG;
00067                 
00068                 $localItems = Array();
00069                 if (!$backRef->cmLevel && $uid>0)       {
00070 
00071                                 // Returns directly, because the clicked item was not from the pages table
00072                         if (!$TCA[$table] || !$TCA[$table]['ctrl']['versioningWS'])     return $menuItems;
00073 
00074                                 // Adds the regular item
00075                         $LL = $this->includeLL();
00076 
00077                                 // "Versioning" element added:
00078                         $url = t3lib_extMgm::extRelPath('version').'cm1/index.php?table='.rawurlencode($table).'&uid='.$uid;
00079                         $localItems[] = $backRef->linkItem(
00080                                 $GLOBALS['LANG']->getLLL('title',$LL),
00081                                 $backRef->excludeIcon('<img src="'.$backRef->backPath.t3lib_extMgm::extRelPath('version').'cm1/cm_icon.gif" width="15" height="12" border="0" align="top" alt="" />'),
00082                                 $backRef->urlRefForCM($url),
00083                                 1
00084                         );
00085 
00086                                 // Find position of "delete" element:
00087                         reset($menuItems);
00088                         $c=0;
00089                         while(list($k)=each($menuItems))        {
00090                                 $c++;
00091                                 if (!strcmp($k,'delete'))       break;
00092                         }
00093                                 // .. subtract two (delete item + divider line)
00094                         $c-=2;
00095                                 // ... and insert the items just before the delete element.
00096                         array_splice(
00097                                 $menuItems,
00098                                 $c,
00099                                 0,
00100                                 $localItems
00101                         );
00102                 }
00103                 return $menuItems;
00104         }
00105 
00111         function includeLL()    {
00112                 global $LANG;
00113 
00114                 return $LANG->includeLLFile('EXT:version/locallang.xml',FALSE);
00115         }
00116 }
00117 
00118 
00119 
00120 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/version/class.tx_version_cm1.php'])    {
00121         include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['ext/version/class.tx_version_cm1.php']);
00122 }
00123 ?>