[TASK] Streamline usage of DebugConsole 03/44303/3
authorOliver Hader <oliver@typo3.org>
Mon, 26 Oct 2015 21:27:21 +0000 (22:27 +0100)
committerOliver Hader <oliver.hader@typo3.org>
Thu, 29 Oct 2015 11:04:10 +0000 (12:04 +0100)
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>
typo3/sysext/backend/Classes/Controller/BackendController.php
typo3/sysext/backend/Classes/Template/DocumentTemplate.php
typo3/sysext/backend/Resources/Public/JavaScript/extjs/viewport.js
typo3/sysext/core/Classes/Page/PageRenderer.php
typo3/sysext/core/Classes/Utility/DebugUtility.php
typo3/sysext/rtehtmlarea/Resources/Public/JavaScript/HTMLArea/HTMLArea.js

index 4315d38..e98d37c 100644 (file)
@@ -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;
index ec9192f..d87497f 100644 (file)
@@ -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);
index d4fdf68..fd0c74d 100644 (file)
@@ -123,13 +123,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.
         *
         * @return void
index 181d050..e627294 100644 (file)
@@ -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 {
index 93b10e8..0580b71 100644 (file)
@@ -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);
                                }
                        })();
                ';
index 76c2567..1398ace 100644 (file)
@@ -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);
                                }
                        }
                };