[BUGFIX] JavaScript error when switching to workspace 89/34889/6
authorWouter Wolters <typo3@wouterwolters.nl>
Mon, 1 Dec 2014 20:03:48 +0000 (21:03 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Tue, 2 Dec 2014 13:09:41 +0000 (14:09 +0100)
Fix a JS error if switching workspaces in toolbar item
if a backend module without pagetree is currently shown.

Resolves: #63492
Releases: master
Change-Id: I65cbc4979bad4b0b3dcee94b72ffdebc9d8b9aff
Reviewed-on: http://review.typo3.org/34889
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Stefan Neufeind <typo3.neufeind@speedpartner.de>
Reviewed-by: Alexander Opitz <opitz.alexander@googlemail.com>
Tested-by: Alexander Opitz <opitz.alexander@googlemail.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/workspaces/Resources/Public/JavaScript/Toolbar/WorkspacesMenu.js

index c195d93..cc15fb3 100644 (file)
@@ -70,16 +70,18 @@ define('TYPO3/CMS/Workspaces/Toolbar/WorkspacesMenu', ['jquery'], function($) {
                                        fsMod.recentIds['web'] = response.pageId;
                                        var url = TYPO3.Backend.ContentContainer.getUrl();
                                        url += (url.indexOf('?') == -1 ? '?' : '&') + '&id=' + response.pageId;
-                                       TYPO3.Backend.NavigationContainer.PageTree.refreshTree();
+                                       if (TYPO3.Backend.NavigationContainer.PageTree) {
+                                               TYPO3.Backend.NavigationContainer.PageTree.refreshTree();
+                                       }
                                        TYPO3.Backend.ContentContainer.setUrl(url);
 
                                // when in web module reload, otherwise send the user to the web module
                                } else if (currentModuleLoaded.indexOf('web_') === 0) {
-                                       TYPO3.Backend.NavigationContainer.PageTree.refreshTree();
+                                       if (TYPO3.Backend.NavigationContainer.PageTree) {
+                                               TYPO3.Backend.NavigationContainer.PageTree.refreshTree();
+                                       }
                                        TYPO3.ModuleMenu.App.reloadFrames();
-
                                } else if (TYPO3.configuration.pageModule) {
-                                       TYPO3.Backend.NavigationContainer.PageTree.refreshTree();
                                        TYPO3.ModuleMenu.App.showModule(TYPO3.configuration.pageModule);
                                }
 
@@ -158,4 +160,4 @@ define('TYPO3/CMS/Workspaces/Toolbar/WorkspacesMenu', ['jquery'], function($) {
                TYPO3.WorkspacesMenu = WorkspacesMenu;
                return WorkspacesMenu;
        }();
-});
\ No newline at end of file
+});