From: Oliver Hader Date: Fri, 2 Jun 2017 21:13:38 +0000 (+0200) Subject: [BUGFIX] CSH on popup window - more link leads to non-existent page X-Git-Tag: v9.0.0~950 X-Git-Url: http://git.typo3.org/Packages/TYPO3.CMS.git/commitdiff_plain/18027bd7c4a74902625b9b1f90bc745f940fffcc?ds=sidebyside [BUGFIX] CSH on popup window - more link leads to non-existent page 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 Tested-by: Riccardo De Contardi Tested-by: TYPO3com Tested-by: Jasmina Ließmann Reviewed-by: Mona Muzaffar Reviewed-by: Susanne Moog Tested-by: Susanne Moog --- diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/ContextHelp.js b/typo3/sysext/backend/Resources/Public/JavaScript/ContextHelp.js index 109fbaa1dba8..4019d95b5b75 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/ContextHelp.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/ContextHelp.js @@ -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 = ' '; - 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;