[BUGFIX] Warning in list module
[Packages/TYPO3.CMS.git] / typo3 / alt_menu.php
old mode 100755 (executable)
new mode 100644 (file)
index 5ac7510..6ea459a
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
+*  (c) 1999-2011 Kasper Skårhøj (kasperYYYY@typo3.com)
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
  * Displays the vertical menu in the left most frame of TYPO3s backend
  *
  * $Id$
- * Revised for TYPO3 3.6 2/2003 by Kasper Skaarhoj
+ * Revised for TYPO3 3.6 2/2003 by Kasper Skårhøj
  * XHTML-trans compliant
  *
- * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
- * @co-author Sebastian Kurfuerst <sebastian@garbage-group.de>
+ * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
+ * @co-author Sebastian Kurfürst <sebastian@garbage-group.de>
  */
 /**
  * [CLASS/FUNCTION INDEX of SCRIPT]
  * TOTAL FUNCTIONS: 3
  * (This index is automatically created/updated by the extension "extdeveval")
  *
+ * @deprecated since TYPO3 4.5, this file will be removed in TYPO3 4.7. The TYPO3 backend is using typo3/backend.php with less frames, which makes this file obsolete.
  */
 
 
 require ('init.php');
 require ('template.php');
-require_once (PATH_t3lib.'class.t3lib_loadmodules.php');
-require_once (PATH_t3lib.'class.t3lib_basicfilefunc.php');
 require_once ('class.alt_menu_functions.inc');
 
 
+t3lib_div::deprecationLog('alt_palette.php is deprecated since TYPO3 4.5, this file will be removed in TYPO3 4.7. The TYPO3 backend is using typo3/backend.php with less frames, which makes this file obsolete.');
 
 
 
@@ -72,8 +72,8 @@ require_once ('class.alt_menu_functions.inc');
 /**
  * Script Class for rendering the vertical menu in the left side of the backend frameset
  *
- * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
- * @co-author Sebastian Kurfuerst <sebastian@garbage-group.de>
+ * @author     Kasper Skårhøj <kasperYYYY@typo3.com>
+ * @co-author Sebastian Kurfürst <sebastian@garbage-group.de>
  * @package TYPO3
  * @subpackage core
  */
@@ -83,13 +83,20 @@ class SC_alt_menu {
        var $_clearCacheFiles;
 
        /**
+        * Menu functions object
+        *
+        * @var alt_menu_functions
+        */
+       var $alt_menuObj;
+
+       /**
         * Initialize
         * Loads the backend modules available for the logged in user.
         *
         * @return      void
         */
        function init() {
-               global $TBE_MODULES;
+               global $TBE_MODULES, $TBE_TEMPLATE;
 
                        // Setting GPvars:
                $this->_clearCacheFiles = t3lib_div::_GP('_clearCacheFiles');
@@ -98,6 +105,11 @@ class SC_alt_menu {
                $this->loadModules = t3lib_div::makeInstance('t3lib_loadModules');
                $this->loadModules->observeWorkspaces = TRUE;
                $this->loadModules->load($TBE_MODULES);
+
+                       // Instantiates the menu object which will generate some JavaScript for the goToModule() JS function in this frame.
+               $this->alt_menuObj = t3lib_div::makeInstance('alt_menu_functions');
+
+               $TBE_TEMPLATE->JScodeArray[] = $this->alt_menuObj->generateMenuJScode($this->loadModules->modules);
        }
 
        /**
@@ -108,14 +120,9 @@ class SC_alt_menu {
        function main() {
                global $BE_USER,$TYPO3_CONF_VARS,$TBE_TEMPLATE;
 
-               $TBE_TEMPLATE->docType='xhtml_trans';
                $TBE_TEMPLATE->divClass='vertical-menu';
                $TBE_TEMPLATE->bodyTagAdditions = 'onload="top.restoreHighlightedModuleMenuItem()"';
-               $TBE_TEMPLATE->JScodeArray[] = '
-               function refreshMenu() { 
-                       window.location.href = document.URL;
-               }
-';
+
                $this->content.=$TBE_TEMPLATE->startPage('Vertical Backend Menu');
                $backPath = $GLOBALS['BACK_PATH'];
 
@@ -123,8 +130,10 @@ class SC_alt_menu {
                $alt_menuObj = t3lib_div::makeInstance('alt_menu_functions');
                $this->content.= $alt_menuObj->topMenu($this->loadModules->modules);
 
-                       // clear cache commands for Admins
-               if($BE_USER->isAdmin()) {       //  && $BE_USER->workspace===0 NOT used anyway because under a workspace developers might still like to clear cache!
+                       // clear cache commands for Admins and allowed users
+               if($GLOBALS['BE_USER']->isAdmin()
+               || $GLOBALS['BE_USER']->getTSConfigVal('options.clearCache.pages')
+               || $GLOBALS['BE_USER']->getTSConfigVal('options.clearCache.all')) {     //  && $BE_USER->workspace===0 NOT used anyway because under a workspace developers might still like to clear cache!
                        $functionsArray = $alt_menuObj->adminFunctions($backPath);
 
                        $this->content.='
@@ -142,16 +151,19 @@ class SC_alt_menu {
                                // Header: Admin functions
                        $this->content.='
                                        <tr class="c-mainitem">
-                                               <td colspan="2"><span class="c-label"><b>'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.adminFunctions',1).'</b>&nbsp;</span><span class="c-iconCollapse"></span></td>
+                                               <td colspan="2"><span class="c-label"><strong>'.$GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.adminFunctions',1).'</strong>&nbsp;</span><span class="c-iconCollapse"></span></td>
                                        </tr>';
 
                        $rows=array();
-                       foreach($functionsArray as $functionsArraySetup)        {
-                               $rows[]='
-                                       <tr class="c-subitem">
-                                               <td valign="top" align="center" class="icon">'.$functionsArraySetup['icon'].'</td>
-                                               <td><a href="'.htmlspecialchars($functionsArraySetup['href']).'">'.htmlspecialchars($functionsArraySetup['title']).'</a></td>
-                                       </tr>';
+                       foreach($functionsArray as $functionsArraySetup) {
+                               if(($functionsArraySetup['id'] == 'all' && ($GLOBALS['BE_USER']->isAdmin() || $GLOBALS['BE_USER']->getTSConfigVal('options.clearCache.all')))
+                               || ($functionsArraySetup['id'] == 'temp_CACHED' && $GLOBALS['BE_USER']->isAdmin())) {
+                                       $rows[]='
+                                               <tr class="c-subitem">
+                                                       <td valign="top" align="center" class="icon">'.$functionsArraySetup['icon'].'</td>
+                                                       <td><a href="'.htmlspecialchars($functionsArraySetup['href']).'">'.htmlspecialchars($functionsArraySetup['title']).'</a></td>
+                                               </tr>';
+                                       }
                        }
 
                                // Imploding around the divider table row:
@@ -170,11 +182,13 @@ class SC_alt_menu {
 
                        // superuser mode
                if($BE_USER->user['ses_backuserid']) {
-                       $username = '<p id="username" class="typo3-red-background">[SU: '.htmlspecialchars($BE_USER->user['username']).']</p>';
+                       $username = '<p id="username" class="typo3-red-background">[' .
+                               $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_misc.xml:switchtousershort') . ' ' .
+                               htmlspecialchars($BE_USER->user['username']) . ']</p>';
                } else {
-                       $username = '<p id="username">['.htmlspecialchars($BE_USER->user['username']).']</p>';
+                       $username = '<p id="username">[' . htmlspecialchars($BE_USER->user['username']) . ']</p>';
                }
-                       // Printing bottons (logout button)
+                       // Printing buttons (logout button)
                $this->content.='
 
 
@@ -198,19 +212,10 @@ class SC_alt_menu {
        }
 }
 
-// Include extension?
-if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_menu.php'])     {
-       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_menu.php']);
-}
-
-
-
-
-
-
-
-
 
+if (defined('TYPO3_MODE') && isset($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/alt_menu.php'])) {
+       include_once($GLOBALS['TYPO3_CONF_VARS'][TYPO3_MODE]['XCLASS']['typo3/alt_menu.php']);
+}
 
 
 
@@ -219,4 +224,5 @@ $SOBE = t3lib_div::makeInstance('SC_alt_menu');
 $SOBE->init();
 $SOBE->main();
 $SOBE->printContent();
-?>
\ No newline at end of file
+
+?>