* Raising Extbase and Fluid version numbers to 0.9.12
[Packages/TYPO3.CMS.git] / typo3 / alt_main.php
old mode 100755 (executable)
new mode 100644 (file)
index 02d8d16..651df5e
@@ -2,7 +2,7 @@
 /***************************************************************
 *  Copyright notice
 *
-*  (c) 1999-2005 Kasper Skaarhoj (kasperYYYY@typo3.com)
+*  (c) 1999-2009 Kasper Skaarhoj (kasperYYYY@typo3.com)
 *  All rights reserved
 *
 *  This script is part of the TYPO3 project. The TYPO3 project is
  * Main frameset of the TYPO3 backend
  * Sending the GET var "alt_main.php?edit=[page id]" will load the page id in the editing module configured.
  *
+ *
+ *    IMPORTANT!
+ *
+ *    This file is deprecated since TYPO3 4.2 and will be removed with TYPO3 4.4
+ *
+ *
+ *
+ *
+ *
  * $Id$
  * Revised for TYPO3 3.6 2/2003 by Kasper Skaarhoj
  * XHTML Compliant (almost)
@@ -54,8 +63,6 @@
 
 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');
 $LANG->includeLLFile('EXT:lang/locallang_misc.xml');
 
@@ -74,7 +81,19 @@ class SC_alt_main {
                // Internal, dynamic:
        var $content;
        var $mainJScode;
+
+       /**
+        * Object for backend modules, load modules-object
+        *
+        * @var t3lib_loadModules
+        */
        var $loadModules;               // Load modules-object
+
+       /**
+        * Menu functions object
+        *
+        * @var alt_menu_functions
+        */
        var $alt_menuObj;               // Menu functions object.
 
                // Internal, static:
@@ -95,12 +114,12 @@ class SC_alt_main {
                $this->loadModules = t3lib_div::makeInstance('t3lib_loadModules');
                $this->loadModules->load($TBE_MODULES);
 
-                       // Instantiates thee menu object which will generate some JavaScript for the goToModule() JS function in this frameset.
+                       // Instantiates the menu object which will generate some JavaScript for the goToModule() JS function in this frameset.
                $this->alt_menuObj = t3lib_div::makeInstance('alt_menu_functions');
 
                        // Check for distances defined in the styles array:
                if ($TBE_STYLES['dims']['leftMenuFrameW'])              $this->leftMenuFrameW = $TBE_STYLES['dims']['leftMenuFrameW'];
-               if ($TBE_STYLES['dims']['topFrameH'])           $this->topFrameH = $TBE_STYLES['dims']['topFrameH'];
+               if ($TBE_STYLES['dims']['topFrameH'])                   $this->topFrameH = $TBE_STYLES['dims']['topFrameH'];
                if ($TBE_STYLES['dims']['shortcutFrameH'])              $this->shortcutFrameH = $TBE_STYLES['dims']['shortcutFrameH'];
                if ($TBE_STYLES['dims']['selMenuFrame'])                $this->selMenuFrame = $TBE_STYLES['dims']['selMenuFrame'];
        }
@@ -121,6 +140,11 @@ class SC_alt_main {
                $newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule'));
                $pageModule = t3lib_BEfunc::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';
 
+               $menuFrameName = 'menu';
+               if ($GLOBALS['BE_USER']->uc['noMenuMode'] === 'icons') {
+                       $menuFrameName = 'topmenuFrame';
+               }
+
                $this->mainJScode='
        /**
         * Function similar to PHPs  rawurlencode();
@@ -159,7 +183,7 @@ class SC_alt_main {
        function typoSetup()    {       //
                this.PATH_typo3 = "'.$pt3.'";
                this.PATH_typo3_enc = "'.rawurlencode($pt3).'";
-               this.username = "'.$BE_USER->user['username'].'";
+               this.username = "'.htmlspecialchars($BE_USER->user['username']).'";
                this.uniqueID = "'.t3lib_div::shortMD5(uniqid('')).'";
                this.navFrameWidth = 0;
        }
@@ -215,7 +239,7 @@ class SC_alt_main {
        function launchView(table,uid,bP)       {       //
                var backPath= bP ? bP : "";
                var thePreviewWindow="";
-               thePreviewWindow = window.open(TS.PATH_typo3+"show_item.php?table="+escape(table)+"&uid="+escape(uid),"ShowItem"+TS.uniqueID,"height=300,width=410,status=0,menubar=0,resizable=0,location=0,directories=0,scrollbars=1,toolbar=0");
+               thePreviewWindow = window.open(TS.PATH_typo3+"show_item.php?table="+encodeURIComponent(table)+"&uid="+encodeURIComponent(uid),"ShowItem"+TS.uniqueID,"height=400,width=550,status=0,menubar=0,resizable=0,location=0,directories=0,scrollbars=1,toolbar=0");
                if (thePreviewWindow && thePreviewWindow.focus) {
                        thePreviewWindow.focus();
                }
@@ -330,23 +354,26 @@ class SC_alt_main {
        }
 
        /**
-        * Function used to switch switch module.
+        * Wrapper for the actual goToModule function in the menu frame
         */
        var currentModuleLoaded = "";
-       function goToModule(modName,cMR_flag,addGetVars)        {       //
-               var additionalGetVariables = "";
-               if (addGetVars) additionalGetVariables = addGetVars;
-
-               var cMR = 0;
-               if (cMR_flag)   cMR = 1;
-
-               currentModuleLoaded = modName;
-
-               switch(modName) {'.$goToModule_switch.'
+       function goToModule(modName, cMR_flag, addGetVars)      {       //
+               if (top.'.$menuFrameName.' && top.'.$menuFrameName.'.goToModule) {
+                       currentModuleLoaded = modName;
+                       top.'.$menuFrameName.'.goToModule(modName, cMR_flag, addGetVars);
+               } else {
+                       window.setTimeout(function() { top.goToModule(modName, cMR_flag, addGetVars); }, 500);
                }
        }
 
        /**
+        * reloads the menu frame
+        */
+       function refreshMenu() {
+               top.'.$menuFrameName.'.location.href = top.'.$menuFrameName.'.document.URL
+       }
+
+       /**
         * Frameset Module object
         *
         * Used in main modules with a frameset for submodules to keep the ID between modules
@@ -437,15 +464,20 @@ class SC_alt_main {
        function startModule() {
                global $BE_USER;
                $module = preg_replace('/[^[:alnum:]_]/','',t3lib_div::_GET('module'));
-               if (!$module && $BE_USER->uc['startInTaskCenter']) {
-                       $module = 'user_task';
+
+               if (!$module)   {
+                       if ($BE_USER->uc['startModule'])        {
+                               $module = $BE_USER->uc['startModule'];
+                       } elseif ($BE_USER->uc['startInTaskCenter'])    {
+                               $module = 'user_task';
+                       }
                }
 
                $params = t3lib_div::_GET('modParams');
                if ($module) {
                        $this->mainJScode.='
                // open in module:
-       window.setTimeout("top.goToModule(\''.$module.'\',false,\''.$params.'\');",500);
+       top.goToModule(\''.$module.'\',false,'.t3lib_div::quoteJSvalue($params).');
                        ';
                }
        }
@@ -467,6 +499,7 @@ class SC_alt_main {
                $GLOBALS['TBE_TEMPLATE']->JScode= '
                        <script type="text/javascript" src="md5.js"></script>
                        <script type="text/javascript" src="../t3lib/jsfunc.evalfield.js"></script>
+                       <script type="text/javascript" src="js/backend.js"></script>
                        ';
                $GLOBALS['TBE_TEMPLATE']->JScode.=$GLOBALS['TBE_TEMPLATE']->wrapScriptTags($this->mainJScode);
 
@@ -535,17 +568,13 @@ class SC_alt_main {
        }
 }
 
-// Include extension?
+
 if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_main.php'])     {
        include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/alt_main.php']);
 }
 
 
 
-
-
-
-
 // ******************************
 // Starting document output
 // ******************************