Added feature #7150: Add pageUnavailable_handling for system problems and maintenance
[Packages/TYPO3.CMS.git] / typo3 / alt_menu.php
index 07ac6d6..7797561 100755 (executable)
  * XHTML-trans compliant
  *
  * @author     Kasper Skaarhoj <kasperYYYY@typo3.com>
- * @co-author Sebastian Kurfürst <sebastian@garbage-group.de>
+ * @co-author Sebastian Kurfuerst <sebastian@garbage-group.de>
  */
 /**
  * [CLASS/FUNCTION INDEX of SCRIPT]
  *
  *
  *
- *   78: class SC_alt_menu
- *   89:     function init()
- *  105:     function main()
- *  182:     function printContent()
+ *   80: class SC_alt_menu
+ *   91:     function init()
+ *  108:     function main()
+ *  190:     function printContent()
  *
  * TOTAL FUNCTIONS: 3
  * (This index is automatically created/updated by the extension "extdeveval")
@@ -73,7 +73,7 @@ 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 Kurfürst <sebastian@garbage-group.de>
+ * @co-author Sebastian Kurfuerst <sebastian@garbage-group.de>
  * @package TYPO3
  * @subpackage core
  */
@@ -83,20 +83,33 @@ 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');
 
                        // Loads the backend modules available for the logged in user.
                $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);
        }
 
        /**
@@ -110,6 +123,7 @@ class SC_alt_menu {
                $TBE_TEMPLATE->docType='xhtml_trans';
                $TBE_TEMPLATE->divClass='vertical-menu';
                $TBE_TEMPLATE->bodyTagAdditions = 'onload="top.restoreHighlightedModuleMenuItem()"';
+
                $this->content.=$TBE_TEMPLATE->startPage('Vertical Backend Menu');
                $backPath = $GLOBALS['BACK_PATH'];
 
@@ -118,7 +132,7 @@ class SC_alt_menu {
                $this->content.= $alt_menuObj->topMenu($this->loadModules->modules);
 
                        // clear cache commands for Admins
-               if($BE_USER->isAdmin()) {
+               if($BE_USER->isAdmin()) {       //  && $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.='
@@ -128,21 +142,22 @@ class SC_alt_menu {
 -->
 <div id="typo3-alt-menu-php-adminFunc">';
 
-                               // Header: Admin functions
-                       $this->content.=
-                               '<h2 class="bgColor5">'.
-                               $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.adminFunctions',1).
-                               '</h2>';
 
                                // Table with those admin functions
                        $this->content.='
-                               <table border="0" cellpadding="0" cellspacing="1" width="100%">';
+                               <table border="0" cellpadding="0" cellspacing="1" width="100%" id="typo3-adminmenu">';
+
+                               // 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>
+                                       </tr>';
 
                        $rows=array();
                        foreach($functionsArray as $functionsArraySetup)        {
                                $rows[]='
-                                       <tr>
-                                               <td valign="top" align="center">'.$functionsArraySetup['icon'].'</td>
+                                       <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>';
                        }
@@ -161,6 +176,12 @@ 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>';
+               } else {
+                       $username = '<p id="username">['.htmlspecialchars($BE_USER->user['username']).']</p>';
+               }
                        // Printing bottons (logout button)
                $this->content.='
 
@@ -168,8 +189,7 @@ class SC_alt_menu {
 <!--
   Logout button / username
 -->
-<div id="typo3-alt-menu-php-logininfo">'.$alt_menuObj->topButtons().
-                                               '<p id="username">['.htmlspecialchars($BE_USER->user['username']).']</p>
+<div id="typo3-alt-menu-php-logininfo">'.$alt_menuObj->topButtons().$username.'
 </div>';
 
                        // End page: