added initial cleaner backend project work (backend.php)
authorIngo Renner <ingo.renner@typo3.org>
Thu, 8 Nov 2007 19:01:43 +0000 (19:01 +0000)
committerIngo Renner <ingo.renner@typo3.org>
Thu, 8 Nov 2007 19:01:43 +0000 (19:01 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@2678 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
typo3/backend.php [new file with mode: 0644]
typo3/classes/class.modulemenu.php [new file with mode: 0644]
typo3/classes/class.typo3logo.php
typo3/css/backend-scaffolding.css [new file with mode: 0644]
typo3/css/backend-style.css [new file with mode: 0644]
typo3/css/verticalmenu.css [new file with mode: 0644]
typo3/gfx/bar.png [new file with mode: 0644]
typo3/gfx/typo3logo_mini.png [new file with mode: 0644]
typo3/js/sizemanager.js [new file with mode: 0644]

index a089638..717f093 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2007-11-08  Ingo Renner        <ingo@typo3.org>
+
+       * added initial cleaner backend project work (backend.php)
+
 2007-11-08  Stanislas Rolland  <stanislas.rolland@fructifor.ca>
 
        * Feature #6668 continued: Some minor adjustments when htmlArea RTE uses the Ajax request
diff --git a/typo3/backend.php b/typo3/backend.php
new file mode 100644 (file)
index 0000000..29f949e
--- /dev/null
@@ -0,0 +1,592 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2007 Ingo Renner <ingo@typo3.org>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*  A copy is found in the textfile GPL.txt and important notices to the license
+*  from the author is found in LICENSE.txt distributed with these scripts.
+*
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+require_once ('init.php');
+require_once ('template.php');
+require ('classes/class.typo3logo.php');
+require ('classes/class.modulemenu.php');
+
+require_once (PATH_t3lib.'class.t3lib_loadmodules.php');
+require_once (PATH_t3lib.'class.t3lib_basicfilefunc.php');
+require_once ('class.alt_menu_functions.inc');
+$GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_misc.xml');
+
+/**
+ * Class for rendering the TYPO3 backend version 4.2+
+ *
+ * @author     Ingo Renner <ingo@typo3.org>
+ * @package TYPO3
+ * @subpackage core
+ */
+class TYPO3backend {
+
+       private $content;
+       private $cssFiles;
+       private $js;
+       private $jsFiles;
+
+       /**
+        * Object for loading backend modules
+        *
+        * @var t3lib_loadModules
+        */
+       private $moduleLoader;
+
+       /**
+        * module menu generating object
+        *
+        * @var ModuleMenu
+        */
+       private $moduleMenu;
+
+       private $leftMenuWidth;
+       private $topHeight;
+       private $selectMenu;
+
+       /**
+        * constructor
+        *
+        * @return      void
+        */
+       public function __construct() {
+                       // Initializes the backend modules structure for use later.
+               $this->moduleLoader = t3lib_div::makeInstance('t3lib_loadModules');
+               $this->moduleLoader->load($GLOBALS['TBE_MODULES']);
+
+               $this->moduleMenu = t3lib_div::makeInstance('ModuleMenu');
+
+                       // Check for distances defined in the styles array:
+               if ($TBE_STYLES['dims']['leftMenuFrameW']) {
+                       $this->leftMenuWidth = $TBE_STYLES['dims']['leftMenuFrameW'];
+               }
+               if ($TBE_STYLES['dims']['topFrameH']) {
+                       $this->topHeight = $TBE_STYLES['dims']['topFrameH'];
+               }
+               if ($TBE_STYLES['dims']['selMenuFrame']) {
+                       $this->selectMenu = $TBE_STYLES['dims']['selMenuFrame'];
+               }
+
+                       // add default BE javascript
+               $this->js = '';
+               $this->jsFiles = array(
+                       'contrib/prototype/prototype.js',
+                       'md5.js',
+                       'js/sizemanager.js',
+                       '../t3lib/jsfunc.evalfield.js'
+               );
+
+                       // add default BE css
+               $this->cssFiles = array(
+                       'css/backend-scaffolding.css',
+                       'css/backend-style.css',
+                       'css/verticalmenu.css'
+               );
+       }
+
+       /**
+        * main function generating the BE scaffolding
+        *
+        * @return      void
+        */
+       public function render()        {
+
+                       // set doctype
+               $GLOBALS['TBE_TEMPLATE']->docType = 'xhtml_trans';
+
+                       // add javascript
+               foreach($this->jsFiles as $jsFile) {
+                       $GLOBALS['TBE_TEMPLATE']->JScode .= '
+                       <script type="text/javascript" src="'.$jsFile.'"></script>';
+               }
+               $GLOBALS['TBE_TEMPLATE']->JScode .= chr(10);
+               $this->generateJavascript();
+               $GLOBALS['TBE_TEMPLATE']->JScode .= $GLOBALS['TBE_TEMPLATE']->wrapScriptTags($this->js);
+
+                       // abusing the JS container to add CSS
+                       // TODO fix template.php
+               foreach($this->cssFiles as $cssFile) {
+                       $GLOBALS['TBE_TEMPLATE']->JScode .= '
+                       <link rel="stylesheet" type="text/css" href="'.$cssFile.'" />
+                       ';
+               }
+
+                       // set document title
+               $title = $TYPO3_CONF_VARS['SYS']['sitename'] ?
+                                       $TYPO3_CONF_VARS['SYS']['sitename'].' [TYPO3 '.TYPO3_version.']'
+                               :       'TYPO3 '.TYPO3_version;
+
+                       // start page header:
+               $this->content .= $GLOBALS['TBE_TEMPLATE']->startPage($title);
+               $this->content .= $GLOBALS['TBE_TEMPLATE']->endPage();
+
+               $logo         = t3lib_div::makeInstance('TYPO3Logo');
+               $logo->setLogo('gfx/typo3logo_mini.png');
+
+               $menu         = $this->moduleMenu->render();
+               $cacheActions = $this->moduleMenu->renderCacheActions();
+               $logout       = $this->moduleMenu->renderLogoutButton();
+               $loginInfo    = $this->getLoggedInUserLabel();
+
+                       // create backend scaffolding
+                       // TODO change typo3-top to render without iframe, directly into the div
+               $this->content .= '
+       <div id="typo3-backend">
+               <div id="typo3-top-container">
+                       <div id="typo3-logo">'.$logo->render().'</div>
+                       <div id="typo3-top" class="typo3-alt-topmenu-dummy-php">
+                               &nbsp;
+                       </div>
+               </div>
+               <div id="typo3-main-container">
+                       <div id="typo3-side-menu">'
+                               .$menu
+                               .$cacheActions
+                               .$logout
+                               .$loginInfo
+                               .'
+                       </div>
+                       <div id="typo3-content">
+                               <iframe src="alt_intro.php" name="content" id="content" marginwidth="0" marginheight="0" frameborder="0"  scrolling="auto" noresize="noresize"></iframe>
+                       </div>
+               </div>
+       </div>
+</body>
+</html>';
+
+               echo $this->content;
+       }
+
+       /**
+        * gets the label of the currently loged in BE user
+        *
+        * @return      string          html code snippet displaying the currently logged in user
+        */
+       private function getLoggedInUserLabel() {
+               $username = '<p id="username">['.htmlspecialchars($GLOBALS['BE_USER']->user['username']).']</p>';;
+
+                       // superuser mode
+               if($BE_USER->user['ses_backuserid']) {
+                       $username = '<p id="username" class="typo3-red-background">[SU: '.htmlspecialchars($GLOBALS['BE_USER']->user['username']).']</p>';
+               }
+
+               return '<div id="login-info">'.$username.'</div>';
+       }
+
+       /**
+        * Generates the JavaScript code for the backend.
+        *
+        * @return      void
+        */
+       private function generateJavascript() {
+
+               $pathTYPO3          = t3lib_div::dirname(t3lib_div::getIndpEnv('SCRIPT_NAME')).'/';
+               $goToModuleSwitch   = $this->moduleMenu->getGotoModuleJavascript();
+               $moduleFramesHelper = implode(chr(10), $this->moduleMenu->getFsMod());
+
+                       // If another page module was specified, replace the default Page module with the new one
+               $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->js .= '
+       /**
+        * Function similar to PHPs  rawurlencode();
+        */
+       function rawurlencode(str)      {       //
+               var output = escape(str);
+               output = str_replace("*","%2A", output);
+               output = str_replace("+","%2B", output);
+               output = str_replace("/","%2F", output);
+               output = str_replace("@","%40", output);
+               return output;
+       }
+
+       /**
+        * String-replace function
+        */
+       function str_replace(match,replace,string)      {       //
+               var input = ""+string;
+               var matchStr = ""+match;
+               if (!matchStr)  {return string;}
+               var output = "";
+               var pointer=0;
+               var pos = input.indexOf(matchStr);
+               while (pos!=-1) {
+                       output+=""+input.substr(pointer, pos-pointer)+replace;
+                       pointer=pos+matchStr.length;
+                       pos = input.indexOf(match,pos+1);
+               }
+               output+=""+input.substr(pointer);
+               return output;
+       }
+
+       /**
+        * TypoSetup object.
+        */
+       function typoSetup()    {       //
+               this.PATH_typo3 = "'.$pathTYPO3.'";
+               this.PATH_typo3_enc = "'.rawurlencode($pathTYPO3).'";
+               this.username = "'.$GLOBALS['BE_USER']->user['username'].'";
+               this.uniqueID = "'.t3lib_div::shortMD5(uniqid('')).'";
+               this.navFrameWidth = 0;
+       }
+       var TS = new typoSetup();
+
+       /**
+        * Functions for session-expiry detection:
+        */
+       function busy() {       //
+               this.loginRefreshed = busy_loginRefreshed;
+               this.checkLoginTimeout = busy_checkLoginTimeout;
+               this.openRefreshWindow = busy_OpenRefreshWindow;
+               this.busyloadTime=0;
+               this.openRefreshW=0;
+               this.reloginCancelled=0;
+       }
+       function busy_loginRefreshed()  {       //
+               var date = new Date();
+               this.busyloadTime = Math.floor(date.getTime()/1000);
+               this.openRefreshW=0;
+       }
+       function busy_checkLoginTimeout()       {       //
+               var date = new Date();
+               var theTime = Math.floor(date.getTime()/1000);
+               if (theTime > this.busyloadTime+'.intval($GLOBALS['BE_USER']->auth_timeout_field).'-30) {
+                       return true;
+               }
+       }
+       function busy_OpenRefreshWindow()       {       //
+               vHWin=window.open("login_frameset.php","relogin_"+TS.uniqueID,"height=350,width=700,status=0,menubar=0,location=1");
+               vHWin.focus();
+               this.openRefreshW=1;
+       }
+       function busy_checkLoginTimeout_timer() {       //
+               if (busy.checkLoginTimeout() && !busy.reloginCancelled && !busy.openRefreshW)   {
+                       if (confirm('.$GLOBALS['LANG']->JScharCode($GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:mess.refresh_login')).'))      {
+                               busy.openRefreshWindow();
+                       } else  {
+                               busy.reloginCancelled = 1;
+                       }
+               }
+               window.setTimeout("busy_checkLoginTimeout_timer();",2*1000);    // Each 2nd second is enough for checking. The popup will be triggered 10 seconds before the login expires (see above, busy_checkLoginTimeout())
+
+                       // Detecting the frameset module navigation frame widths (do this AFTER setting new timeout so that any errors in the code below does not prevent another time to be set!)
+               if (top && top.content && top.content.nav_frame && top.content.nav_frame.document && top.content.nav_frame.document.body)       {
+                       TS.navFrameWidth = (top.content.nav_frame.document.documentElement && top.content.nav_frame.document.documentElement.clientWidth) ? top.content.nav_frame.document.documentElement.clientWidth : top.content.nav_frame.document.body.clientWidth;
+               }
+       }
+
+       /**
+        * Launcing information window for records/files (fileref as "table" argument)
+        */
+       function launchView(table,uid,bP)       {       //
+               var backPath= bP ? bP : "";
+               var thePreviewWindow="";
+               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();
+               }
+       }
+
+       /**
+        * Opens plain window with url
+        */
+       function openUrlInWindow(url,windowName)        {       //
+               regularWindow = window.open(url,windowName,"status=1,menubar=1,resizable=1,location=1,directories=0,scrollbars=1,toolbar=1");
+               regularWindow.focus();
+               return false;
+       }
+
+       /**
+        * Loads a URL in the topmenuFrame
+        */
+       function loadTopMenu(url)       {       //
+               top.topmenuFrame.location = url;
+       }
+
+       /**
+        * Loads a page id for editing in the page edit module:
+        */
+       function loadEditId(id,addGetVars)      {       //
+               top.fsMod.recentIds["web"]=id;
+               top.fsMod.navFrameHighlightedID["web"]="pages"+id+"_0";         // For highlighting
+
+               if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav)  {
+                       top.content.nav_frame.refresh_nav();
+               }
+
+               top.goToModule("'.$pageModule.'", 0, addGetVars?addGetVars:"");
+       }
+
+       /**
+        * Returns incoming URL (to a module) unless nextLoadModuleUrl is set. If that is the case nextLoadModuleUrl is returned (and cleared)
+        * Used by the shortcut frame to set a "intermediate URL"
+        */
+       var nextLoadModuleUrl="";
+       function getModuleUrl(inUrl)    {       //
+               var nMU;
+               if (top.nextLoadModuleUrl)      {
+                       nMU=top.nextLoadModuleUrl;
+                       top.nextLoadModuleUrl="";
+                       return nMU;
+               } else {
+                       return inUrl;
+               }
+       }
+
+       /**
+        * Print properties of an object
+        */
+       function debugObj(obj,name)     {       //
+               var acc;
+               for (i in obj) {
+                       if (obj[i])     {
+                               acc+=i+":  "+obj[i]+"\n";
+                       }
+               }
+               alert("Object: "+name+"\n\n"+acc);
+       }
+
+       /**
+        * Initialize login expiration warning object
+        */
+       var busy = new busy();
+       busy.loginRefreshed();
+       busy_checkLoginTimeout_timer();
+
+
+       /**
+        * Highlight module:
+        */
+       var currentlyHighLightedId = "";
+       var currentlyHighLighted_restoreValue = "";
+       var currentlyHighLightedMain = "";
+       function highlightModuleMenuItem(trId, mainModule)      {       //
+               currentlyHighLightedMain = mainModule;
+                       // Get document object:
+               if (top.menu && top.menu.document)      {
+                       var docObj = top.menu.document;
+                       var HLclass = mainModule ? "c-mainitem-HL" : "c-subitem-row-HL";
+               } else if (top.topmenuFrame && top.topmenuFrame.document)       {
+                       var docObj = top.topmenuFrame.document;
+                       var HLclass = mainModule ? "c-mainitem-HL" : "c-subitem-HL";
+               }
+
+               if (docObj)     {
+                               // Reset old:
+                       if (currentlyHighLightedId && docObj.getElementById(currentlyHighLightedId))    {
+                               docObj.getElementById(currentlyHighLightedId).attributes.getNamedItem("class").nodeValue = currentlyHighLighted_restoreValue;
+                       }
+                               // Set new:
+                       currentlyHighLightedId = trId;
+                       if (currentlyHighLightedId && docObj.getElementById(currentlyHighLightedId))    {
+                               var classAttribObject = docObj.getElementById(currentlyHighLightedId).attributes.getNamedItem("class");
+                               currentlyHighLighted_restoreValue = classAttribObject.nodeValue;
+                               classAttribObject.nodeValue = HLclass;
+                       }
+               }
+       }
+
+       /**
+        * Function restoring previous selection in left menu after clearing cache
+        */
+       function restoreHighlightedModuleMenuItem() {   //
+               if (currentlyHighLightedId) {
+                       highlightModuleMenuItem(currentlyHighLightedId,currentlyHighLightedMain);
+               }
+       }
+
+       '.$goToModuleSwitch.'
+
+       /**
+        * 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
+        * Typically that is set by something like this in a Web>* sub module:
+        *              if (top.fsMod) top.fsMod.recentIds["web"] = "\'.intval($this->id).\'";
+        *              if (top.fsMod) top.fsMod.recentIds["file"] = "...(file reference/string)...";
+        */
+       function fsModules()    {       //
+               this.recentIds=new Array();                                     // used by frameset modules to track the most recent used id for list frame.
+               this.navFrameHighlightedID=new Array();         // used by navigation frames to track which row id was highlighted last time
+               this.currentMainLoaded="";
+               this.currentBank="0";
+       }
+       var fsMod = new fsModules();
+       '.$moduleFramesHelper.'
+
+               // Used by Frameset Modules
+       var condensedMode = '.($GLOBALS['BE_USER']->uc['condensedMode']?1:0).';
+       var currentSubScript = "";
+       var currentSubNavScript = "";
+
+               // Used for tab-panels:
+       var DTM_currentTabs = new Array();
+               ';
+
+                       // Check editing of page:
+               $this->editPageHandling();
+               $this->setStartupModule();
+       }
+
+       /**
+        * Checking if the "&edit" variable was sent so we can open for editing the page.
+        * Code based on code from "alt_shortcut.php"
+        *
+        * @return      void
+        */
+       private function editPageHandling()     {
+
+               if(!t3lib_extMgm::isLoaded('cms'))      {
+                       return;
+               }
+
+                       // EDIT page:
+               $editId     = preg_replace('/[^[:alnum:]_]/', '', t3lib_div::_GET('edit'));
+               $editRecord = '';
+
+               if($editId)     {
+
+                               // Looking up the page to edit, checking permissions:
+                       $where = ' AND ('.$GLOBALS['BE_USER']->getPagePermsClause(2)
+                                       .' OR '.$GLOBALS['BE_USER']->getPagePermsClause(16).')';
+
+                       if(t3lib_div::testInt($editId)) {
+                               $editRecord = t3lib_BEfunc::getRecordWSOL('pages', $editId, '*', $where);
+                       } else {
+                               $records = t3lib_BEfunc::getRecordsByField('pages', 'alias', $editId, $where);
+
+                               if(is_array($records))  {
+                                       reset($records);
+                                       $editRecord = current($records);
+                                       t3lib_BEfunc::workspaceOL('pages', $editRecord);
+                               }
+                       }
+
+                               // If the page was accessible, then let the user edit it.
+                       if(is_array($editRecord) && $GLOBALS['BE_USER']->isInWebMount($editRecord['uid']))      {
+                                       // Setting JS code to open editing:
+                               $this->js .= '
+               // Load page to edit:
+       window.setTimeout("top.loadEditId('.intval($editRecord['uid']).');", 500);
+                       ';
+                                       // Checking page edit parameter:
+                               if(!$GLOBALS['BE_USER']->getTSConfigVal('options.shortcut_onEditId_dontSetPageTree')) {
+
+                                               // Expanding page tree:
+                                       t3lib_BEfunc::openPageTree(intval($editRecord['pid']), !$GLOBALS['BE_USER']->getTSConfigVal('options.shortcut_onEditId_keepExistingExpanded'));
+                               }
+                       } else {
+                               $this->js .= '
+               // Warning about page editing:
+       alert('.$GLOBALS['LANG']->JScharCode(sprintf($GLOBALS['LANG']->getLL('noEditPage'), $editId)).');
+                       ';
+                       }
+               }
+       }
+
+       /**
+        * Sets the startup module from either GETvars module and mpdParams or user configuration.
+        *
+        * @return      void
+        */
+       private function setStartupModule() {
+               $startModule = preg_replace('/[^[:alnum:]_]/', '', t3lib_div::_GET('module'));
+
+               if(!$startModule)       {
+                       if ($GLOBALS['BE_USER']->uc['startModule'])     {
+                               $startModule = $GLOBALS['BE_USER']->uc['startModule'];
+                       } else if($GLOBALS['BE_USER']->uc['startInTaskCenter']) {
+                               $startModule = 'user_task';
+                       }
+               }
+
+               $moduleParameters = t3lib_div::_GET('modParams');
+               if($startModule) {
+                       $this->js .= '
+                       // start in module:
+               function startInModule(modName, cMR_flag, addGetVars)   {       //
+                       if ($(content) && top.goToModule) {
+                               top.goToModule(modName, cMR_flag, addGetVars);
+                       } else {
+                               window.setTimeout(function() { startInModuleModule(modName, cMR_flag, addGetVars); }, 500);
+                       }
+               }
+
+//             startInModule(\''.$startModule.'\', false, \''.$moduleParameters.'\');
+                       '; //TODO get start module working
+               }
+       }
+
+       /**
+        * generates the code for the TYPO3 logo, either the default TYPO3 logo or a custom one
+        *
+        * @return      string  HTML code snippet to display the TYPO3 logo
+        */
+       private function getLogo() {
+               $logo = '<a href="http://www.typo3.com/" target="_blank" onclick="'.$GLOBALS['TBE_TEMPLATE']->thisBlur().'">'.
+                               '<img'.t3lib_iconWorks::skinImg('','gfx/alt_backend_logo.gif','width="117" height="32"').' title="TYPO3 Content Management Framework" alt="" />'.
+                               '</a>';
+
+                       // overwrite with custom logo
+               if($GLOBALS['TBE_STYLES']['logo'])      {
+                       if(substr($GLOBALS['TBE_STYLES']['logo'], 0, 3) == '../')       {
+                               $imgInfo = @getimagesize(PATH_site.substr($GLOBALS['TBE_STYLES']['logo'], 3));
+                       }
+                       $logo = '<a href="http://www.typo3.com/" target="_blank" onclick="'.$GLOBALS['TBE_TEMPLATE']->thisBlur().'">'.
+                               '<img src="'.$GLOBALS['TBE_STYLES']['logo'].'" '.$imgInfo[3].' title="TYPO3 Content Management Framework" alt="" />'.
+                               '</a>';
+               }
+
+               return $logo;
+       }
+}
+
+
+// Include extension?
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/backend.php'])      {
+       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/backend.php']);
+}
+
+
+
+// document generation
+$TYPO3backend = t3lib_div::makeInstance('TYPO3backend');
+$TYPO3backend->render();
+
+?>
\ No newline at end of file
diff --git a/typo3/classes/class.modulemenu.php b/typo3/classes/class.modulemenu.php
new file mode 100644 (file)
index 0000000..7ce240d
--- /dev/null
@@ -0,0 +1,558 @@
+<?php
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2007 Ingo Renner <ingo@typo3.org>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*  A copy is found in the textfile GPL.txt and important notices to the license
+*  from the author is found in LICENSE.txt distributed with these scripts.
+*
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+
+/**
+ * class to render the TYPO3 backend menu for the modules
+ *
+ * @author     Ingo Renner <ingo@typo3.org>
+ * @package TYPO3
+ * @subpackage core
+ */
+class ModuleMenu {
+
+       /**
+        * module loading object
+        *
+        * @var t3lib_loadModules
+        */
+       protected $moduleLoader;
+
+       private $backPath;
+       private $cacheActions;
+       private $linkModules;
+       private $loadedModules;
+       private $fsMod; //TODO find a more descriptive name, left over from alt_menu_functions
+
+       /**
+        * constructor, initializes several variables
+        *
+        * @return      void
+        */
+       public function __construct() {
+
+               $this->backPath    = '';
+               $this->fsMod       = array();
+               $this->linkModules = true;
+
+                       // Loads the backend modules available for the logged in user.
+               $this->moduleLoader = t3lib_div::makeInstance('t3lib_loadModules');
+               $this->moduleLoader->observeWorkspaces = true;
+               $this->moduleLoader->load($GLOBALS['TBE_MODULES']);
+               $this->loadedModules = $this->moduleLoader->modules;
+
+                       // init cache actions
+               $this->cacheActions = array();
+               $this->initCacheActions();
+       }
+
+       /**
+        * sets the path back to /typo3/
+        *
+        * @param       string  path back to /typo3/
+        * @return      void
+        */
+       public function setBackPath($backPath) {
+               if(!is_string($backPath)) {
+                       throw new InvalidArgumentException('parameter $backPath must be of type string', 1193315266);
+               }
+
+               $this->backPath = $backPath;
+       }
+
+       /**
+        * loads the collapse states for the main modules from user's configuration (uc)
+        *
+        * @return      array           collapse states
+        */
+       private function getCollapsedStates() {
+
+               $collapsedStates = array();
+               if($GLOBALS['BE_USER']->uc['moduleData']['moduleMenu']) {
+                       $collapsedStates = $GLOBALS['BE_USER']->uc['moduleData']['moduleMenu'];
+               }
+
+               return $collapsedStates;
+       }
+
+       /**
+        * returns the loaded modules
+        *
+        * @return      array   array of loaded modules
+        */
+       public function getLoadedModules() {
+               return $this->loadedModules;
+       }
+
+       /**
+        * renders the backend menu as unordered list
+        *
+        * @return      string          menu html code to use in the backend
+        */
+       public function render() {
+               $menu    = '';
+               $onBlur  = $GLOBALS['CLIENT']['FORMSTYLE'] ? 'this.blur();' : '';
+
+               $rawModuleData = $this->getRawModuleData();
+
+               foreach($rawModuleData as $moduleKey => $moduleData) {
+
+                       $moduleLabel = $moduleData['title'];
+                       if($moduleData['link'] && $this->linkModules) {
+                               $moduleLabel = '<a href="#" onclick="top.goToModule(\''.$moduleData['name'].'\');'.$onBlur.'return false;">'.$moduleLabel.'</a>';
+                       }
+
+                       $menu .= '<li><div>'.$moduleData['icon']['html'].' '.$moduleLabel.'</div>';
+
+                               // traverse submodules
+                       if(is_array($moduleData['subitems'])) {
+                               $menu .= $this->renderSubModules($moduleData['subitems']);
+                       }
+
+                       $menu .= '</li>'."\n";
+               }
+
+               return '<ul id="typo3-menu">'."\n".$menu.'</ul>'."\n";
+       }
+
+       /**
+        * renders submodules
+        *
+        * @param       array           array of (sub)module data
+        * @return      string          (sub)module html code
+        */
+       public function renderSubModules($modules) {
+               $moduleMenu = '';
+               $onBlur     = $GLOBALS['CLIENT']['FORMSTYLE'] ? 'this.blur();' : '';
+
+               foreach($modules as $moduleKey => $moduleData) {
+                               // Setting additional JavaScript
+                       $additionalJavascript = '';
+                       if($moduleData['parentNavigationFrameScript']) {
+                               $parentModuleName     = substr($moduleData['name'], 0, strpos($moduleData['name'], '_'));
+                               $additionalJavascript = "+'&id='+top.rawurlencode(top.fsMod.recentIds['".$parentModuleName."'])";
+                       }
+
+                       if($moduleData['link'] && $this->linkModules) {
+
+                               $onClickString = htmlspecialchars('top.goToModule(\''.$moduleData['name'].'\');'.$onBlur.'return false;');
+                               $submoduleLink = '<a href="#" onclick="'.$onClickString.'" title="'.$moduleData['description'].'">'
+                                       .$moduleData['icon']['html'].' '
+                                       .'<span>'.htmlspecialchars($moduleData['title']).'</span>'
+                                       .'</a>';
+                       }
+
+                       $moduleMenu .= '<li>'.$submoduleLink.'</li>'."\n";
+               }
+
+               return '<ul>'."\n".$moduleMenu.'</ul>'."\n";
+       }
+
+       /**
+        * gets the raw module data
+        *
+        * @return      array           multi dimension array with module data
+        */
+       public function getRawModuleData() {
+               $modules = array();
+
+                       // Remove the 'doc' module?
+               if($GLOBALS['BE_USER']->getTSConfigVal('options.disableDocModuleInAB')) {
+                       unset($this->loadedModules['doc']);
+               }
+
+               foreach($this->loadedModules as $moduleName => $moduleData) {
+                       $moduleNavigationFramePrefix = $this->getNavigationFramePrefix($moduleData);
+
+                       if($moduleNavigationFramePrefix) {
+                               $this->fsMod[$moduleName] = 'fsMod.recentIds["'.$moduleName.'"]="";';
+                       }
+
+                       $moduleLink = '';
+                       if(!is_array($moduleData['sub'])) {
+                               $moduleLink = $moduleData['script'];
+                       }
+                       $moduleLink = t3lib_div::resolveBackPath($moduleLink);
+
+                       $moduleKey   = $moduleName.'_tab';
+                       $moduleCssId = 'ID_'.t3lib_div::md5int($moduleName);
+                       $moduleIcon  = $this->getModuleIcon($moduleKey);
+
+                       if($moduleLink && $moduleNavigationFramePrefix) {
+                               $moduleLink = $moduleNavigationFramePrefix.rawurlencode($moduleLink);
+                       }
+
+                       $modules[$moduleKey] = array(
+                               'name'    => $moduleName,
+                               'title'   => $GLOBALS['LANG']->moduleLabels['tabs'][$moduleKey],
+                               'onclick' => 'top.goToModule(\''.$moduleName.'\');',
+                               'cssId'   => $moduleCssId,
+                               'icon'    => $moduleIcon,
+                               'link'    => $moduleLink,
+                               'prefix'  => $moduleNavigationFramePrefix
+                       );
+
+                       if(is_array($moduleData['sub'])) {
+
+                               foreach($moduleData['sub'] as $submoduleName => $submoduleData) {
+                                       $submoduleLink = t3lib_div::resolveBackPath($submoduleData['script']);
+                                       $submoduleNavigationFramePrefix = $this->getNavigationFramePrefix($moduleData, $submoduleData);
+
+                                       $submoduleKey         = $moduleName.'_'.$submoduleName.'_tab';
+                                       $submoduleCssId       = 'ID_'.t3lib_div::md5int($moduleName.'_'.$submoduleName);
+                                       $submoduleIcon        = $this->getModuleIcon($submoduleKey);
+                                       $submoduleDescription = $GLOBALS['LANG']->moduleLabels['labels'][$submoduleKey.'label'];
+
+                                       $originalLink = $submoduleLink;
+                                       if($submoduleLink && $submoduleNavigationFramePrefix) {
+                                               $submoduleLink = $submoduleNavigationFramePrefix.rawurlencode($submoduleLink);
+                                       }
+
+                                       $modules[$moduleKey]['subitems'][$submoduleKey] = array(
+                                               'name'         => $moduleName.'_'.$submoduleName,
+                                               'title'        => $GLOBALS['LANG']->moduleLabels['tabs'][$submoduleKey],
+                                               'onclick'      => 'top.goToModule(\''.$moduleName.'_'.$submoduleName.'\');',
+                                               'cssId'        => $submoduleCssId,
+                                               'icon'         => $submoduleIcon,
+                                               'link'         => $submoduleLink,
+                                               'originalLink' => $originalLink,
+                                               'prefix'       => $submoduleNavigationFramePrefix,
+                                               'description'  => $submoduleDescription
+                                       );
+
+                                       if($moduleData['navFrameScript']) {
+                                               $modules[$moduleKey]['subitems'][$submoduleKey]['parentNavigationFrameScript'] = $moduleData['navFrameScript'];
+                                       }
+                               }
+                       }
+               }
+
+               return $modules;
+       }
+
+       /**
+        * gets the module icon and its size
+        *
+        * @param       string          module key
+        * @return      array           icon data array with 'filename', 'size', and 'html'
+        */
+       private function getModuleIcon($moduleKey) {
+               $icon             = array();
+               $iconFileRelative = $this->getModuleIconRelative($GLOBALS['LANG']->moduleLabels['tabs_images'][$moduleKey]);
+               $iconFileAbsolute = $this->getModuleIconAbsolute($GLOBALS['LANG']->moduleLabels['tabs_images'][$moduleKey]);
+               $iconSizes        = @getimagesize($iconFileAbsolute);
+               $iconTitle        = $GLOBALS['LANG']->moduleLabels['tabs'][$moduleKey];
+
+               $icon['filename'] = $iconFileRelative;
+               $icon['size']     = $iconSizes[3];
+               $icon['title']    = htmlspecialchars($iconTitle);
+               $icon['html']     = '<img src="'.$iconFileRelative.'" '.$iconSizes[3].' title="'.htmlspecialchars($iconTitle).'" alt="'.htmlspecialchars($iconTitle).'" />';
+
+               return $icon;
+       }
+
+       /**
+        * Returns the filename readable for the script from PATH_typo3.
+        * That means absolute names are just returned while relative names are
+        * prepended with the path pointing back to typo3/ dir
+        *
+        * @param       string          icon filename
+        * @return      string          icon filename with absolute path
+        * @see getModuleIconRelative()
+        */
+       private function getModuleIconAbsolute($iconFilename) {
+
+               if(!t3lib_div::isAbsPath($iconFilename))        {
+                       $iconFilename = $this->backPath.$iconFilename;
+               }
+
+               return $iconFilename;
+       }
+
+       /**
+        * Returns relative path to the icon filename for use in img-tags
+        *
+        * @param       string          icon filename
+        * @return      string          icon filename with relative path
+        * @see getModuleIconAbsolute()
+        */
+       private function getModuleIconRelative($iconFilename) {
+               if(t3lib_div::isAbsPath($iconFilename)) {
+                       $iconFilename = '../'.substr($iconFilename, strlen(PATH_site));
+               }
+
+               return $this->backPath.$iconFilename;
+       }
+
+       /**
+        * Returns a prefix used to call the navigation frame with parameters which then will call the scripts defined in the modules info array.
+        *
+        * @param       array           module data array
+        * @param       array           submodule data array
+        * @return      string          result URL string
+        */
+       private function getNavigationFramePrefix($moduleData, $subModuleData = array()) {
+               $prefix = '';
+
+               $navigationFrameScript = $moduleData['navFrameScript'];
+               if($subModuleData['navFrameScript']) {
+                       $navigationFrameScript = $subModuleData['navFrameScript'];
+               }
+
+               $navigationFrameParameter = $moduleData['navFrameScriptParam'];
+               if($subModuleData['navFrameScriptParam']) {
+                       $navigationFrameParameter = $subModuleData['navFrameScriptParam'];
+               }
+
+               if($navigationFrameScript) {
+                       $navigationFrameScript = t3lib_div::resolveBackPath($navigationFrameScript);
+                       $navigationFrameScript = $this->appendQuestionmarkToLink($navigationFrameScript);
+
+                       if($GLOBALS['BE_USER']->uc['condensedMode']) {
+                               $prefix = $navigationFrameScript.$navigationFrameParameter.'&currentSubScript=';
+                       } else {
+                               $prefix = 'alt_mod_frameset.php?'
+                                                .'fW="+top.TS.navFrameWidth+"'
+                                                .'&nav="+top.TS.PATH_typo3+"'
+                                                .rawurlencode($navigationFrameScript.$navigationFrameParameter)
+                                                .'&script=';
+                       }
+               }
+
+               return $prefix;
+       }
+
+       /**
+        * generates javascript code to switch between modules
+        *
+        * @return      string          javascript code snippet to switch modules
+        */
+       public function getGotoModuleJavascript() {
+
+               $moduleJavascriptCommands = array();
+               $rawModuleData            = $this->getRawModuleData();
+
+               foreach($rawModuleData as $mainModuleKey => $mainModuleData) {
+                       if($mainModuleData['subitems']) {
+                               foreach($mainModuleData['subitems'] as $subModuleKey => $subModuleData) {
+
+                                       $parentModuleName  = substr($subModuleData['name'], 0, strpos($subModuleData['name'], '_'));
+                                       $javascriptCommand = '';
+
+                                               // Setting additional JavaScript if frameset script:
+                                       $additionalJavascript = '';
+                                       if($subModuleData['parentNavigationFrameScript']) {
+                                               $additionalJavascript = "+'&id='+top.rawurlencode(top.fsMod.recentIds['".$parentModuleName."'])";
+                                       }
+
+                                       if($subModuleData['link'] && $this->linkModules) {
+                                                       // For condensed mode, send &cMR parameter to frameset script.
+                                               if($additionalJavascript && $GLOBALS['BE_USER']->uc['condensedMode']) {
+                                                       $additionalJavascript .= "+(cMR?'&cMR=1':'')";
+                                               }
+
+                                               $javascriptCommand = '
+                                                       top.content.location=top.getModuleUrl(top.TS.PATH_typo3+"'.$this->appendQuestionmarkToLink($subModuleData['link']).'"'.$additionalJavascript.'+additionalGetVariables);
+                                                       top.fsMod.currentMainLoaded="'.$parentModuleName.'";
+                                               ';
+
+                                               if($subModuleData['navFrameScript']) {
+                                                       $javascriptCommand .= '
+                                                               top.currentSubScript="'.$subModuleData['originalLink'].'";';
+                                               }
+
+                                               if(!$GLOBALS['BE_USER']->uc['condensedMode'] && $subModuleData['parentNavigationFrameScript']) {
+                                                       $additionalJavascript = "+'&id='+top.rawurlencode(top.fsMod.recentIds['".$parentModuleName."'])";
+
+                                                       $submoduleNavigationFrameScript = $subModuleData['navigationFrameScript'] ? $subModuleData['navigationFrameScript'] : $subModuleData['parentNavigationFrameScript'];
+                                                       $submoduleNavigationFrameScript = t3lib_div::resolveBackPath($submoduleNavigationFrameScript);
+
+                                                               // add GET parameters for sub module to the navigation script
+                                                       $submoduleNavigationFrameScript = $this->appendQuestionmarkToLink($submoduleNavigationFrameScript).$subModuleData['navigationFrameScript'];
+
+                                                       $javascriptCommand = '
+                                                               if (top.content.list_frame && top.fsMod.currentMainLoaded=="'.$parentModuleName.'") {
+                                                                       top.currentSubScript="'.$subModuleData['originalLink'].'";
+                                                                       top.content.list_frame.location=top.getModuleUrl(top.TS.PATH_typo3+"'.$this->appendQuestionmarkToLink($subModuleData['originalLink']).'"'.$additionalJavascript.'+additionalGetVariables);
+                                                                       if(top.currentSubNavScript!="'.$submoduleNavigationFrameScript.'") {
+                                                                               top.currentSubNavScript="'.$submoduleNavigationFrameScript.'";
+                                                                               top.content.nav_frame.location=top.getModuleUrl(top.TS.PATH_typo3+"'.$submoduleNavigationFrameScript.'");
+                                                                       }
+                                                               } else {
+                                                                       top.content.location=top.TS.PATH_typo3+(
+                                                                               top.nextLoadModuleUrl?
+                                                                               "'.($subModuleData['prefix'] ? $this->appendQuestionmarkToLink($subModuleData['link']).'&exScript=' : '').'listframe_loader.php":
+                                                                               "'.$this->appendQuestionmarkToLink($subModuleData['link']).'"'.$additionalJavascript.'+additionalGetVariables
+                                                                       );
+                                                                       top.fsMod.currentMainLoaded="'.$parentModuleName.'";
+                                                                       top.currentSubScript="'.$subModuleData['originalLink'].'";
+                                                               }
+                                                       ';
+                                               }
+
+                                               $javascriptCommand .= '
+                                                               top.highlightModuleMenuItem("'.$subModuleData['cssId'].'");
+                                               ';
+                                               $moduleJavascriptCommands[] = "case '".$subModuleData['name']."': \n ".$javascriptCommand." \n break;";
+                                       }
+                               }
+                       } elseif(!$mainModuleData['subitems'] && !empty($mainModuleData['link'])) {
+                               // main module has no sub modules but instead is linked itself (doc module)
+                               $javascriptCommand = '
+                                       top.content.location=top.getModuleUrl(top.TS.PATH_typo3+"'.$this->appendQuestionmarkToLink($mainModuleData['link']).'"+additionalGetVariables);
+                                       top.highlightModuleMenuItem("'.$mainModuleData['cssId'].'", 1);
+                               ';
+                               $moduleJavascriptCommands[] = "case '".$mainModuleData['name']."': \n ".$javascriptCommand." \n break;";
+                       }
+               }
+
+               $javascriptCode = '
+       /**
+        * Function used to switch switch module.
+        */
+       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) {'
+                       ."\n".implode("\n", $moduleJavascriptCommands)."\n".'
+               }
+       }';
+
+               return $javascriptCode;
+       }
+
+       /**
+        * Appends a '?' if there is none in the string already
+        *
+        * @param       string          Link URL
+        * @return      string          link URl appended with ? if there wasn't one
+        */
+       private function appendQuestionmarkToLink($link)        {
+               if(!strstr($link, '?')) {
+                       $link .= '?';
+               }
+
+               return $link;
+       }
+
+       /**
+        * renders the logout button form
+        *
+        * @return      string          html code snippet displaying the logout button
+        */
+       public function renderLogoutButton()    {
+               $buttonLabel      = $GLOBALS['BE_USER']->user['ses_backuserid'] ? 'LLL:EXT:lang/locallang_core.php:buttons.exit' : 'LLL:EXT:lang/locallang_core.php:buttons.logout';
+
+               $buttonForm = '
+               <form action="logout.php" target="_top">
+                       <input type="submit" value="'.$GLOBALS['LANG']->sL($buttonLabel, 1).'" />
+               </form>';
+
+               return $buttonForm;
+       }
+
+       /**
+        * renders the actions to clear several caches
+        *
+        * @return      string  cache actions html code snippet
+        */
+       public function renderCacheActions() {
+               $renderedCacheActions = array('<ul id="cache-actions">');
+
+               foreach($this->cacheActions as $cacheAction) {
+                       $renderedCacheActions[] = '<li><a href="'.htmlspecialchars($cacheAction['href']).'">'.$cacheAction['icon'].' '.$cacheAction['title'].'</a></li>';
+               }
+
+               $renderedCacheActions[] = '</ul>';
+
+               return implode("\n", $renderedCacheActions);
+       }
+
+       /**
+        * initializes cache actions
+        *
+        * @return      void
+        */
+       private function initCacheActions() {
+
+                       // Clearing of cache-files in typo3conf/ + menu
+               if ($GLOBALS['TYPO3_CONF_VARS']['EXT']['extCache'])     {
+                       $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.clearCache_allTypo3Conf');
+                       $this->cacheActions[] = array(
+                               'id'    => 'temp_CACHED',
+                               'title' => $title,
+                               'href'  => $this->backPath.'tce_db.php?vC='.$GLOBALS['BE_USER']->veriCode().'&redirect='.rawurlencode(t3lib_div::getIndpEnv('TYPO3_REQUEST_SCRIPT')).'&cacheCmd=temp_CACHED',
+                               'icon'  => '<img'.t3lib_iconWorks::skinImg($this->backPath, 'gfx/clear_cache_files_in_typo3c.gif', 'width="21" height="18"').' title="'.htmlspecialchars($title).'" alt="" />'
+                       );
+               }
+
+                       // Clear all page cache
+               $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.php:rm.clearCache_all');
+               $this->cacheActions[] = array(
+                       'id'    => 'all',
+                       'title' => $title,
+                       'href'  => $this->backPath.'tce_db.php?vC='.$GLOBALS['BE_USER']->veriCode().'&redirect='.rawurlencode(t3lib_div::getIndpEnv('TYPO3_REQUEST_SCRIPT')).'&cacheCmd=all',
+                       'icon'  => '<img'.t3lib_iconWorks::skinImg($this->backPath, 'gfx/clear_all_cache.gif', 'width="21" height="18"').' title="'.htmlspecialchars($title).'" alt="" />'
+               );
+       }
+
+       /**
+        * turns linking of modules on or off
+        *
+        * @param       boolean         status for linking modules with a-tags, set to false to turn lining off
+        */
+       public function setLinkModules($linkModules) {
+               if(!is_bool($linkModules)) {
+                       throw new InvalidArgumentException('parameter $$linkModules must be of type bool', 1193326558);
+               }
+
+               $this->linkModules = $linkModules;
+       }
+
+       /**
+        * gets the frameset (leftover) helper
+        *
+        * @return      array   array of javascript snippets
+        */
+       public function getFsMod() {
+               return $this->fsMod;
+       }
+}
+
+
+if (defined('TYPO3_MODE') && $TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/classes/class.modulemenu.php'])     {
+       include_once($TYPO3_CONF_VARS[TYPO3_MODE]['XCLASS']['typo3/classes/class.modulemenu.php']);
+}
+
+?>
\ No newline at end of file
index fc6b358..f4aefd0 100644 (file)
  */
 class TYPO3Logo {
 
+       private $logo;
+
+       /**
+        * constructor
+        *
+        * @return void
+        */
+       public function __construct() {
+               $this->logo = null;
+       }
+
        /**
         * renders the actual logo code
         *
         * @return      string  logo html code snippet to use in the backend
         */
        public function render() {
+
+               $logoFile = 'gfx/alt_backend_logo.gif'; // default
+               if(is_string($this->logo)) {
+                               // overwrite
+                       $logoFile = $this->logo;
+               }
+               $imgInfo = getimagesize(PATH_site.'typo3/'.$logoFile);
+
+
                $logo = '<a href="http://www.typo3.com/" target="_blank" onclick="'.$GLOBALS['TBE_TEMPLATE']->thisBlur().'">'.
-                               '<img'.t3lib_iconWorks::skinImg('','gfx/alt_backend_logo.gif','width="117" height="32"').' title="TYPO3 Content Management Framework" alt="" />'.
+                               '<img'.t3lib_iconWorks::skinImg('', $logoFile, $imgInfo[3]).' title="TYPO3 Content Management Framework" alt="" />'.
                                '</a>';
 
                        // overwrite with custom logo
@@ -61,6 +81,19 @@ class TYPO3Logo {
                return $logo;
        }
 
+       /**
+        * sets the logo
+        *
+        * @param       string          path to logo file as seen from typo3/
+        */
+       public function setLogo($logo) {
+               if(!is_string($logo)) {
+                       throw new InvalidArgumentException('parameter $logo must be of type string', 1194041104);
+               }
+
+               $this->logo = $logo;
+       }
+
 }
 
 
diff --git a/typo3/css/backend-scaffolding.css b/typo3/css/backend-scaffolding.css
new file mode 100644 (file)
index 0000000..53957ee
--- /dev/null
@@ -0,0 +1,69 @@
+/* - - - - - - - - - - - - - - - - - - - - -
+
+Title  : TYPO3 backend styles
+Author : Ingo Renner <ingo@typo3.org>
+URL    : http://typo3.org
+
+Description : styles the TYPO3 backend
+
+Created  : 2007/10/14
+Modified : 2007/10/17
+
+- - - - - - - - - - - - - - - - - - - - - */
+
+
+/* - - - - - - - - - - - - - - - - - - - - -
+
+TYPO3 backend scaffolding
+
+- - - - - - - - - - - - - - - - - - - - - */
+
+body#typo3-backend-php {
+       margin: 0px;
+       padding: 0px;
+}
+
+#typo3-backend {
+       width: 100%;
+}
+
+#typo3-logo,
+#typo3-side-menu {
+       float: left;
+       width: 130px;
+}
+
+#typo3-top-container {
+       height: 25px;
+/*     background-color: #9ba1a8; */
+}
+
+#typo3-main-container {
+       clear: both;
+}
+
+#typo3-top,
+#typo3-content {
+       margin-left: 130px;
+}
+
+#typo3-side-menu {
+       overflow: auto;
+}
+
+iframe {
+       width: 100%;
+}
+
+#typo3-content,
+#typo3-main-container,
+#typo3-main-container * iframe {
+       height: 660px;
+}
+
+
+
+
+
+
+
diff --git a/typo3/css/backend-style.css b/typo3/css/backend-style.css
new file mode 100644 (file)
index 0000000..9bad955
--- /dev/null
@@ -0,0 +1,84 @@
+/* - - - - - - - - - - - - - - - - - - - - -
+
+Title  : TYPO3 backend styles
+Author : Ingo Renner <ingo@typo3.org>
+URL    : http://typo3.org
+
+Description : styles the TYPO3 backend
+
+Created  : 2007/11/01
+Modified : 2007/11/01
+
+- - - - - - - - - - - - - - - - - - - - - */
+
+
+/* ----- Basics ----- */
+
+#typo3-backend {
+       /* background-color: #fff; */
+}
+
+#typo3-top-container {
+       background-image: url(../gfx/bar.png);
+}
+
+#typo3-logo {
+       padding: 1px 0px 0px 10px;
+}
+
+
+/* ----- Caching ----- */
+
+#cache-actions {
+       list-style: none;
+       padding: 0px;
+       margin: 15px 0px;
+}
+
+#cache-actions li {
+       padding-left: 2px;
+}
+
+#cache-actions a {
+       display: block;
+       text-decoration: none;
+       vertical-align: center;
+}
+
+
+/* ----- Logout ----- */
+
+#typo3-side-menu form,
+#login-info p {
+       text-align: center;
+}
+
+#login-info p {
+       padding-top: 5px;
+       padding-bottom: 30px;
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/typo3/css/verticalmenu.css b/typo3/css/verticalmenu.css
new file mode 100644 (file)
index 0000000..5efb162
--- /dev/null
@@ -0,0 +1,76 @@
+/* - - - - - - - - - - - - - - - - - - - - -
+
+Title  : TYPO3 backend vertical menu styles
+Author : Ingo Renner <ingo@typo3.org>
+URL    : http://typo3.org
+
+Description : styles the TYPO3 backend
+
+Created  : 2007/10/25
+Modified : 2007/10/25
+
+- - - - - - - - - - - - - - - - - - - - - */
+
+
+/* - - - - - - - - - - - - - - - - - - - - -
+
+TYPO3 backend menu - vertical
+
+- - - - - - - - - - - - - - - - - - - - - */
+
+#typo3-menu,
+#typo3-menu ul {
+       list-style: none;
+       padding: 0px;
+       margin: 0px;
+}
+
+#typo3-menu {
+       padding-top: 2px;
+       padding-left: 1px;
+}
+
+#typo3-menu li {
+       clear: both;
+}
+
+#typo3-menu li div {
+       font-weight: bold;
+       background-color: #d9d9d8;
+       border: 1px solid #9ba1a8;
+       cursor: pointer;
+       height: 14px;
+       padding: 1px;
+       vertical-align: middle;
+       width: 105px;
+       margin: 3px 0px 1px;
+}
+
+#typo3-menu li ul li {
+       font-weight: normal;
+       width: 105px;
+       border-bottom: 1px dashed #9ca1a7;
+       padding: 1px 0px 2px 2px;
+       margin-left: 1px;
+       cursor: pointer;
+}
+
+#typo3-menu li ul li a {
+       text-decoration: none;
+       display: block;
+}
+
+
+#typo3-menu li ul li a img {
+       float: left;
+}
+
+
+
+
+
+
+
+
+
+
diff --git a/typo3/gfx/bar.png b/typo3/gfx/bar.png
new file mode 100644 (file)
index 0000000..9226194
Binary files /dev/null and b/typo3/gfx/bar.png differ
diff --git a/typo3/gfx/typo3logo_mini.png b/typo3/gfx/typo3logo_mini.png
new file mode 100644 (file)
index 0000000..f84c21f
Binary files /dev/null and b/typo3/gfx/typo3logo_mini.png differ
diff --git a/typo3/js/sizemanager.js b/typo3/js/sizemanager.js
new file mode 100644 (file)
index 0000000..7dd7245
--- /dev/null
@@ -0,0 +1,59 @@
+/***************************************************************
+*  Copyright notice
+*
+*  (c) 2007 Ingo Renner <ingo@typo3.org>
+*  All rights reserved
+*
+*  This script is part of the TYPO3 project. The TYPO3 project is
+*  free software; you can redistribute it and/or modify
+*  it under the terms of the GNU General Public License as published by
+*  the Free Software Foundation; either version 2 of the License, or
+*  (at your option) any later version.
+*
+*  The GNU General Public License can be found at
+*  http://www.gnu.org/copyleft/gpl.html.
+*  A copy is found in the textfile GPL.txt and important notices to the license
+*  from the author is found in LICENSE.txt distributed with these scripts.
+*
+*
+*  This script is distributed in the hope that it will be useful,
+*  but WITHOUT ANY WARRANTY; without even the implied warranty of
+*  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+*  GNU General Public License for more details.
+*
+*  This copyright notice MUST APPEAR in all copies of the script!
+***************************************************************/
+
+
+// new div based backend classes
+var SizeManager = Class.create({
+
+       /**
+        * registers for resize event listener and execute on DOM read
+        */
+       initialize: function() {
+               Event.observe(window, 'resize', this.resizeBackend);
+               Event.observe(window, 'load', this.resizeBackend); //TODO change to prototype DOMready event
+       },
+
+       /**
+        * resizes the divs in the TYPO3 backend to fit a resized window
+        */
+       resizeBackend: function() {
+               var viewportHeight  = document.viewport.getHeight();
+               var topHeight       = $('typo3-top-container').getHeight();
+               var containerHeight = viewportHeight - topHeight;
+
+               $('typo3-main-container').setStyle({height: containerHeight+'px'});
+
+               $('typo3-side-menu').setStyle({height: containerHeight+'px'});
+
+               $('typo3-content').setStyle({height: containerHeight+'px'});
+               $('content').setStyle({height: containerHeight+'px'});
+       }
+
+});
+
+var TYPO3BackendSizeManager = new SizeManager();
+
+