From f00036d9c5c06c531208648c12e45210fa78dfaa Mon Sep 17 00:00:00 2001 From: Oliver Hader <oliver@typo3.org> Date: Mon, 26 Oct 2015 22:27:21 +0100 Subject: [PATCH] [TASK] Streamline usage of DebugConsole Since the backend DebugConsole has been rewritten in jQuery, references to the old ExtJS variant can either be removed or adjusted to work with the new DebugConsole. Resolves: #71055 Releases: master Change-Id: Ic4eddafdf1a767101e921d5ca5a85f87a66a9983 Reviewed-on: https://review.typo3.org/44303 Reviewed-by: Andreas Fernandez <typo3@scripting-base.de> Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de> Reviewed-by: Oliver Hader <oliver.hader@typo3.org> Tested-by: Oliver Hader <oliver.hader@typo3.org> --- .../Classes/Controller/BackendController.php | 5 +---- .../Classes/Template/DocumentTemplate.php | 18 ------------------ .../Public/JavaScript/extjs/viewport.js | 7 ------- .../sysext/core/Classes/Page/PageRenderer.php | 14 +++++++------- .../core/Classes/Utility/DebugUtility.php | 18 ++++++++---------- .../Public/JavaScript/HTMLArea/HTMLArea.js | 13 +++---------- 6 files changed, 19 insertions(+), 56 deletions(-) diff --git a/typo3/sysext/backend/Classes/Controller/BackendController.php b/typo3/sysext/backend/Classes/Controller/BackendController.php index 4315d38aa0f3..e98d37c2706d 100644 --- a/typo3/sysext/backend/Classes/Controller/BackendController.php +++ b/typo3/sysext/backend/Classes/Controller/BackendController.php @@ -329,10 +329,7 @@ class BackendController } $extOnReadyCode .= ' - TYPO3.Backend = new TYPO3.Viewport(TYPO3.Viewport.configuration); - if (typeof console === "undefined") { - console = TYPO3.Backend.DebugConsole; - }'; + TYPO3.Backend = new TYPO3.Viewport(TYPO3.Viewport.configuration)'; $this->pageRenderer->addExtOnReadyCode($extOnReadyCode); // Set document title: $title = $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] ? $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] . ' [TYPO3 CMS ' . TYPO3_version . ']' : 'TYPO3 CMS ' . TYPO3_version; diff --git a/typo3/sysext/backend/Classes/Template/DocumentTemplate.php b/typo3/sysext/backend/Classes/Template/DocumentTemplate.php index ec9192fdaabb..d87497fa09f0 100644 --- a/typo3/sysext/backend/Classes/Template/DocumentTemplate.php +++ b/typo3/sysext/backend/Classes/Template/DocumentTemplate.php @@ -838,24 +838,6 @@ function jumpToUrl(URL) { if ($this->extDirectStateProvider) { $this->pageRenderer->addJsFile('sysext/backend/Resources/Public/JavaScript/ExtDirect.StateProvider.js'); } - // Add jsCode for overriding the console with a debug panel connection - $this->pageRenderer->addJsInlineCode('consoleOverrideWithDebugPanel', 'if (typeof top.Ext === "object") { - top.Ext.onReady(function() { - if (typeof console === "undefined") { - if (top && top.TYPO3 && top.TYPO3.Backend && top.TYPO3.Backend.DebugConsole) { - console = top.TYPO3.Backend.DebugConsole; - } else { - console = { - log: Ext.log, - info: Ext.log, - warn: Ext.log, - error: Ext.log - }; - } - } - }); - } - ', false); $this->pageRenderer->addHeaderData($this->JScode); foreach ($this->JScodeArray as $name => $code) { $this->pageRenderer->addJsInlineCode($name, $code, false); diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/extjs/viewport.js b/typo3/sysext/backend/Resources/Public/JavaScript/extjs/viewport.js index d4fdf6801304..fd0c74d530aa 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/extjs/viewport.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/extjs/viewport.js @@ -122,13 +122,6 @@ TYPO3.Viewport = Ext.extend(Ext.Viewport, { */ ModuleMenuContainer: null, - /** - * The debug console - * - * @var Ext.TabPanel - */ - DebugConsole: null, - /** * Initializes the ExtJS viewport with the given configuration. * diff --git a/typo3/sysext/core/Classes/Page/PageRenderer.php b/typo3/sysext/core/Classes/Page/PageRenderer.php index 181d050cd4b2..e6272940725b 100644 --- a/typo3/sysext/core/Classes/Page/PageRenderer.php +++ b/typo3/sysext/core/Classes/Page/PageRenderer.php @@ -1362,16 +1362,16 @@ class PageRenderer implements \TYPO3\CMS\Core\SingletonInterface })(); var extDirectDebug = function(message, header, group) { - var TYPO3ViewportInstance = null; + var DebugConsole = null; - if (top && top.TYPO3 && typeof top.TYPO3.Backend === "object") { - TYPO3ViewportInstance = top.TYPO3.Backend; - } else if (typeof TYPO3 === "object" && typeof TYPO3.Backend === "object") { - TYPO3ViewportInstance = TYPO3.Backend; + if (top && top.TYPO3 && typeof top.TYPO3.DebugConsole === "object") { + DebugConsole = top.TYPO3.DebugConsole; + } else if (typeof TYPO3 === "object" && typeof TYPO3.DebugConsole === "object") { + DebugConsole = TYPO3.DebugConsole; } - if (TYPO3ViewportInstance !== null) { - TYPO3ViewportInstance.DebugConsole.addTab(message, header, group); + if (DebugConsole !== null) { + DebugConsole.add(message, header, group); } else if (typeof console === "object") { console.log(message); } else { diff --git a/typo3/sysext/core/Classes/Utility/DebugUtility.php b/typo3/sysext/core/Classes/Utility/DebugUtility.php index 93b10e896638..0580b71d29e8 100644 --- a/typo3/sysext/core/Classes/Utility/DebugUtility.php +++ b/typo3/sysext/core/Classes/Utility/DebugUtility.php @@ -109,18 +109,16 @@ class DebugUtility + "</body></html>" ); } - } + }; - if (!top.Ext) { - browserWindow(debugMessage, header, group); + if (top && typeof top.TYPO3 !== "undefined" && typeof top.TYPO3.Modal !== "undefined") { + top.TYPO3.Modal.show( + "Debug: " + header + " (" + group + ")", + debugMessage, + top.TYPO3.Severity.notice + ); } else { - top.Ext.onReady(function() { - if (top && top.TYPO3 && top.TYPO3.Backend) { - top.TYPO3.Backend.DebugConsole.openBrowserWindow(header, debugMessage, group); - } else { - browserWindow(debugMessage, header, group); - } - }); + browserWindow(debugMessage, header, group); } })(); '; diff --git a/typo3/sysext/rtehtmlarea/Resources/Public/JavaScript/HTMLArea/HTMLArea.js b/typo3/sysext/rtehtmlarea/Resources/Public/JavaScript/HTMLArea/HTMLArea.js index 76c256754572..1398ace3c4ec 100644 --- a/typo3/sysext/rtehtmlarea/Resources/Public/JavaScript/HTMLArea/HTMLArea.js +++ b/typo3/sysext/rtehtmlarea/Resources/Public/JavaScript/HTMLArea/HTMLArea.js @@ -115,16 +115,9 @@ define(['TYPO3/CMS/Rtehtmlarea/HTMLArea/UserAgent/UserAgent', if (typeof type === 'undefined') { var type = 'info'; } - if (typeof console === 'object' && console !== null) { - // If console is TYPO3.Backend.DebugConsole, write only error messages - if (typeof console.addTab === 'function') { - if (type === 'error') { - console[type](str); - } - // IE may not have any console - } else if (typeof console[type] !== 'undefined') { - console[type](str); - } + // IE may not have any console + if (typeof console === 'object' && console !== null && typeof console[type] !== 'undefined') { + console[type](str); } } }; -- GitLab