[BUGFIX] CSH on popup window - more link leads to non-existent page 65/53065/4
authorOliver Hader <oliver@typo3.org>
Fri, 2 Jun 2017 21:13:38 +0000 (23:13 +0200)
committerSusanne Moog <susanne.moog@typo3.org>
Sat, 3 Jun 2017 09:18:02 +0000 (11:18 +0200)
Opening CSH help popups from another popup (e.g. add/edit wizard) fails
since the resolved CSH URI is not valid.

Resolves: #80665
Releases: master, 8.7
Change-Id: I16f4dcd037cdb7ab210c083272d0941c979da205
Reviewed-on: https://review.typo3.org/53065
Tested-by: Mona Muzaffar <mona.muzaffar@gmx.de>
Tested-by: Riccardo De Contardi <erredeco@gmail.com>
Tested-by: TYPO3com <no-reply@typo3.com>
Tested-by: Jasmina LieƟmann <code@frauliessmann.de>
Reviewed-by: Mona Muzaffar <mona.muzaffar@gmx.de>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
typo3/sysext/backend/Resources/Public/JavaScript/ContextHelp.js

index 109fbaa..4019d95 100644 (file)
@@ -36,17 +36,20 @@ define(['jquery', 'TYPO3/CMS/Backend/Popover', 'bootstrap'], function($, Popover
         * Initialize context help trigger
         */
        ContextHelp.initialize = function() {
-               ContextHelp.helpModuleUrl = (typeof top.TYPO3.settings.ContextHelp !== 'undefined') ? top.TYPO3.settings.ContextHelp.moduleUrl : null;
-               if (TYPO3.ShortcutMenu === undefined && top.TYPO3.ShortcutMenu === undefined) {
+               var backendWindow = ContextHelp.resolveBackend();
+               ContextHelp.helpModuleUrl = null;
+               if (typeof backendWindow.TYPO3.settings.ContextHelp !== 'undefined') {
+                       ContextHelp.helpModuleUrl = backendWindow.TYPO3.settings.ContextHelp.moduleUrl;
+               }
+
+               if (TYPO3.ShortcutMenu === undefined && backendWindow.TYPO3.ShortcutMenu === undefined) {
                        // @FIXME: if we are in the popup... remove the bookmark / shortcut button
                        // @TODO: make it possible to use the bookmark button also in popup mode
                        $('.icon-actions-system-shortcut-new').closest('.btn').hide();
                }
                var title = '&nbsp;';
-               if (typeof top.TYPO3.LLL !== 'undefined') {
-                       title = top.TYPO3.LLL.core.csh_tooltip_loading;
-               } else if (opener && typeof opener.top.TYPO3.LLL !== 'undefined') {
-                       title = opener.top.TYPO3.LLL.core.csh_tooltip_loading;
+               if (typeof backendWindow.TYPO3.LLL !== 'undefined') {
+                       title = backendWindow.TYPO3.LLL.core.csh_tooltip_loading;
                }
                var $element = $(this.selector);
                $element
@@ -156,6 +159,19 @@ define(['jquery', 'TYPO3/CMS/Backend/Popover', 'bootstrap'], function($, Popover
                }
        };
 
+       /**
+        * @return {Window}
+        */
+       ContextHelp.resolveBackend = function () {
+               var windowReference;
+               if (typeof window.opener !== 'undefined' && window.opener !== null) {
+                       windowReference = window.opener.top;
+               } else {
+                       windowReference = top;
+               }
+               return windowReference;
+       };
+
        ContextHelp.initialize();
        TYPO3.ContextHelp = ContextHelp;
        return ContextHelp;