Index: t3lib/class.t3lib_div.php =================================================================== --- t3lib/class.t3lib_div.php (revision 7478) +++ t3lib/class.t3lib_div.php (working copy) @@ -3419,8 +3419,8 @@ * changed, and by that re-cached by the browser. If the file does not * exist physically the original file passed to the function is * returned without the timestamp. - * - * Behaviour is influenced by the setting + * + * Behaviour is influenced by the setting * TYPO3_CONF_VARS[TYPO3_MODE][versionNumberInFilename] * = true (BE) / "embed" (FE) : modify filename * = false (BE) / "querystring" (FE) : add timestamp as parameter @@ -3465,7 +3465,7 @@ // Change the filename $name = explode('.', $lookupFile[0]); $extension = array_pop($name); - + array_push($name, filemtime($path), $extension); $fullName = implode('.', $name); // append potential query string @@ -3576,38 +3576,118 @@ * Usage: 8 * * @param mixed Variable to print - * @param mixed If the parameter is a string it will be used as header. Otherwise number of break tags to apply after (positive integer) or before (negative integer) the output. + * @param string The header. * @return void */ - public static function debug($var='',$brOrHeader=0) { + public static function debug($var = '', $header = '') { // buffer the output of debug if no buffering started before if (ob_get_level()==0) { ob_start(); } + $debug = ''; - if ($brOrHeader && !self::testInt($brOrHeader)) { - echo ' + +
'.htmlspecialchars((string)$brOrHeader).'
'; - } elseif ($brOrHeader<0) { - for($a=0;$a';} + if ($header) { + $debug .= ' + + + + + +
' . + htmlspecialchars((string) $header) . + '
'; } if (is_array($var)) { - self::print_array($var); - } elseif (is_object($var)) { - echo '|Object:
';
-			print_r($var);
-			echo '
|
'; - } elseif ((string)$var!='') { - echo '|'.htmlspecialchars((string)$var).'|'; + $debug .= self::view_array($var); + } elseif (is_object($var)) { + $debug .= '|Object:
';
+			$debug .= print_r($var, TRUE);
+			$debug .=  '
|
'; + } elseif ((string) $var !== '') { + $debug .= '|' . htmlspecialchars((string)$var) . '|'; } else { - echo '| debug |'; + $debug .= '| debug |'; } - if ($brOrHeader && !self::testInt($brOrHeader)) { - echo '
'; - } elseif ($brOrHeader>0) { - for($a=0;$a';} + if ($header) { + $debug .= ' +
'; } + + if (TYPO3_MODE === 'BE') { + $tabHeader = 'Debug'; + if ($header) { + $tabHeader .= ': ' . htmlspecialchars($header); + } + if (is_object($var)) { + $debug = str_replace( + array('"', "\n", "\r"), + array('\"', '
', ''), + $debug + ); + } else { + $debug = str_replace( + array('"', "\n", "\r"), + array('\"', '', ''), + $debug + ); + } + + $script = ' + var TYPO3ViewportInstance = null, tab; + if (top && typeof top.TYPO3.Backend === "object") { + TYPO3ViewportInstance = top.TYPO3.Backend; + } else if (typeof TYPO3.Backend === "object") { + TYPO3ViewportInstance = TYPO3.Backend; + } + + if (TYPO3ViewportInstance !== null) { + if (TYPO3ViewportInstance.DebugConsole.hidden) { + TYPO3ViewportInstance.DebugConsole.show(); + } else if (TYPO3ViewportInstance.DebugConsole.collapsed) { + TYPO3ViewportInstance.DebugConsole.expand(); + } + if (TYPO3ViewportInstance.DebugConsole.items.getCount() === 0) { + tab = TYPO3ViewportInstance.DebugConsole.add({ + title: "' . $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xml:tabs.closeAll') . '", + border: false, + closable: false, + listeners: { + activate: function() { + TYPO3ViewportInstance.DebugConsole.removeAll(); + TYPO3ViewportInstance.DebugConsole.hide(); + TYPO3ViewportInstance.DebugConsole.fireEvent("resize"); + } + } + }); + } + tab = TYPO3ViewportInstance.DebugConsole.add({ + title: "' . $tabHeader . '", + html: "' . $debug . '", + border: false, + closable: true, + autoScroll: true, + listeners: { + close: function() { + if (TYPO3ViewportInstance.DebugConsole.items.getCount() === 1) { + TYPO3ViewportInstance.DebugConsole.hide(); + } + } + } + }); + TYPO3ViewportInstance.DebugConsole.setActiveTab(tab); + TYPO3ViewportInstance.doLayout(); + } else { + document.write("' . $debug . '"); + } + '; + echo self::wrapJS($script); + } else { + echo $debug; + } } /** Index: typo3/js/extjs/backendsizemanager.js =================================================================== --- typo3/js/extjs/backendsizemanager.js (revision 7478) +++ typo3/js/extjs/backendsizemanager.js (working copy) @@ -35,16 +35,19 @@ var resizeBackend = function() { var viewportHeight = document.viewport.getHeight(); var topHeight = Ext.get('typo3-topbar').getHeight(); + var debugConsole = Ext.get('typo3-debug-console'); + var consoleHeight = debugConsole.isVisible() ? 0 : debugConsole.getHeight() + debugConsole.getHeight(); var styles = { - height: (viewportHeight - topHeight) + 'px' + height: (viewportHeight - topHeight - consoleHeight) + 'px' } Ext.get('typo3-side-menu').setStyle(styles); Ext.get('content').setStyle(styles); } - Ext.EventManager.on(window, 'resize', resizeBackend); + Ext.EventManager.onWindowResize(resizeBackend); Ext.onReady(function() { + TYPO3.Backend.addListener('resize', resizeBackend); resizeBackend(); }); }(); Index: typo3/js/extjs/viewport.js =================================================================== --- typo3/js/extjs/viewport.js (revision 7478) +++ typo3/js/extjs/viewport.js (working copy) @@ -75,6 +75,13 @@ ModuleMenuContainer: null, /** + * The debug console + * + * @var Ext.TabPanel + */ + DebugConsole: null, + + /** * Initializes the ExtJS viewport with the given configuration. * * @return void @@ -90,6 +97,24 @@ this.Topbar = Ext.ComponentMgr.get('typo3-topbar'); this.ModuleMenuContainer = Ext.ComponentMgr.get('typo3-module-menu'); + // adds the debug console and some listeners to consider the initial hiding of + // the debug console (the viewport needs to be resized if it's expand/collapse) + // -> see the TYPO3.BackendSizeManager + this.DebugConsole = Ext.ComponentMgr.get('typo3-debug-console'); + this.DebugConsole.addListener({ + 'resize': { + scope: this, + fn: function() { + this.fireEvent('resize'); + } + }, + 'collapse': { + scope: this, + fn: function() { + this.fireEvent('resize'); + } + } + }); }, /** Index: typo3/js/extjs/viewportConfiguration.js =================================================================== --- typo3/js/extjs/viewportConfiguration.js (revision 7478) +++ typo3/js/extjs/viewportConfiguration.js (working copy) @@ -73,5 +73,19 @@ anchor: '100% 100%', border: false }] + }, { + region: 'south', + xtype: 'tabpanel', + collapsible: true, + collapseMode: 'mini', + hideCollapseTool: true, + animCollapse: false, + split: true, + autoScroll: true, + hidden: true, + height: 200, + title: 'Debug-Console', + id: 'typo3-debug-console', + border: false }] }; Index: typo3/sysext/lang/locallang_core.xml =================================================================== --- typo3/sysext/lang/locallang_core.xml (revision 7478) +++ typo3/sysext/lang/locallang_core.xml (working copy) @@ -263,6 +263,7 @@ +