From 918ef519e97e98d5d6886d4815ef6feecb2b39ea Mon Sep 17 00:00:00 2001 From: Andreas Fernandez <a.fernandez@scripting-base.de> Date: Tue, 24 May 2016 15:11:57 +0200 Subject: [PATCH] [!!!][BUGFIX] Load popup configuration in case backend submodules are opened in a new tab It's possible to open some backend modules (e.g. RTE or EditDocumentController) in a new tab. However, the configuration for popups is missing in such case, causing e.g. opening the "Insert image" wizard of RTE is not possible anymore. Place configuration inline in TYPO3.settings to not have this problem of missing configuration. Resolves: #76285 Releases: master Change-Id: I1405dd90e4e00fc709d504af2ed0a936a6374fce Reviewed-on: https://review.typo3.org/48276 Reviewed-by: Andreas Fernandez <typo3@scripting-base.de> Tested-by: Andreas Fernandez <typo3@scripting-base.de> Reviewed-by: Frank Naegler <frank.naegler@typo3.org> Tested-by: Frank Naegler <frank.naegler@typo3.org> --- .../Classes/Controller/BackendController.php | 23 ----------- .../Controller/EditDocumentController.php | 26 +----------- .../Classes/Form/FormResultCompiler.php | 31 +++++++++++++- .../Public/JavaScript/ContextHelp.js | 2 +- .../Resources/Public/JavaScript/FormEngine.js | 4 +- ...pupConfigurationIsMovedToTYPO3settings.rst | 41 +++++++++++++++++++ .../Public/JavaScript/Plugins/TYPO3Image.js | 4 +- .../Public/JavaScript/Plugins/TYPO3Link.js | 4 +- 8 files changed, 79 insertions(+), 56 deletions(-) create mode 100644 typo3/sysext/core/Documentation/Changelog/master/Breaking-76285-PopupConfigurationIsMovedToTYPO3settings.rst diff --git a/typo3/sysext/backend/Classes/Controller/BackendController.php b/typo3/sysext/backend/Classes/Controller/BackendController.php index 89d546ee416d..37f9cf00ff0c 100644 --- a/typo3/sysext/backend/Classes/Controller/BackendController.php +++ b/typo3/sysext/backend/Classes/Controller/BackendController.php @@ -577,21 +577,6 @@ class BackendController // Needed for FormEngine manipulation (date picker) $dateFormat = ($GLOBALS['TYPO3_CONF_VARS']['SYS']['USdateFormat'] ? array('MM-DD-YYYY', 'HH:mm MM-DD-YYYY') : array('DD-MM-YYYY', 'HH:mm DD-MM-YYYY')); $this->pageRenderer->addInlineSetting('DateTimePicker', 'DateFormat', $dateFormat); - // define the window size of the element browser etc. - $popupWindowWidth = 700; - $popupWindowHeight = 750; - $popupWindowSize = trim($beUser->getTSConfigVal('options.popupWindowSize')); - if (!empty($popupWindowSize)) { - list($popupWindowWidth, $popupWindowHeight) = GeneralUtility::intExplode('x', $popupWindowSize); - } - - // define the window size of the popups within the RTE - $rtePopupWindowSize = trim($beUser->getTSConfigVal('options.rte.popupWindowSize')); - if (!empty($rtePopupWindowSize)) { - list($rtePopupWindowWidth, $rtePopupWindowHeight) = GeneralUtility::trimExplode('x', $rtePopupWindowSize); - } - $rtePopupWindowWidth = !empty($rtePopupWindowWidth) ? (int)$rtePopupWindowWidth : ($popupWindowWidth-100); - $rtePopupWindowHeight = !empty($rtePopupWindowHeight) ? (int)$rtePopupWindowHeight : ($popupWindowHeight-150); // If another page module was specified, replace the default Page module with the new one $newPageModule = trim($beUser->getTSConfigVal('options.overridePageModule')); @@ -613,14 +598,6 @@ class BackendController 'ContextHelpWindows' => array( 'width' => 600, 'height' => 400 - ), - 'PopupWindow' => array( - 'width' => $popupWindowWidth, - 'height' => $popupWindowHeight - ), - 'RTEPopupWindow' => array( - 'width' => $rtePopupWindowWidth, - 'height' => $rtePopupWindowHeight ) ); $this->js .= ' diff --git a/typo3/sysext/backend/Classes/Controller/EditDocumentController.php b/typo3/sysext/backend/Classes/Controller/EditDocumentController.php index 36de73c006ae..dd31b09dea1d 100644 --- a/typo3/sysext/backend/Classes/Controller/EditDocumentController.php +++ b/typo3/sysext/backend/Classes/Controller/EditDocumentController.php @@ -734,19 +734,7 @@ class EditDocumentController extends AbstractModule } ' ); - // define the window size of the element browser - $popupWindowWidth = 700; - $popupWindowHeight = 750; - $popupWindowSize = trim($beUser->getTSConfigVal('options.popupWindowSize')); - if (!empty($popupWindowSize)) { - list($popupWindowWidth, $popupWindowHeight) = GeneralUtility::intExplode('x', $popupWindowSize); - } - $t3Configuration = array( - 'PopupWindow' => array( - 'width' => $popupWindowWidth, - 'height' => $popupWindowHeight - ) - ); + $t3Configuration = array(); if (ExtensionManagementUtility::isLoaded('feedit') && (int)GeneralUtility::_GP('feEdit') === 1) { // We have to load some locallang strings and push them into TYPO3.LLL if this request was @@ -768,18 +756,6 @@ class EditDocumentController extends AbstractModule } } $pageRenderer->addJsFile('../' . $filePath); - - // define the window size of the popups within the RTE - $rtePopupWindowSize = trim($beUser->getTSConfigVal('options.rte.popupWindowSize')); - if (!empty($rtePopupWindowSize)) { - list($rtePopupWindowWidth, $rtePopupWindowHeight) = GeneralUtility::trimExplode('x', $rtePopupWindowSize); - } - $rtePopupWindowWidth = !empty($rtePopupWindowWidth) ? (int)$rtePopupWindowWidth : ($popupWindowWidth-200); - $rtePopupWindowHeight = !empty($rtePopupWindowHeight) ? (int)$rtePopupWindowHeight : ($popupWindowHeight-250); - $t3Configuration['RTEPopupWindow'] = [ - 'width' => $rtePopupWindowWidth, - 'height' => $rtePopupWindowHeight - ]; } $javascript = ' diff --git a/typo3/sysext/backend/Classes/Form/FormResultCompiler.php b/typo3/sysext/backend/Classes/Form/FormResultCompiler.php index 3e45671076bf..589cb6e9ffe7 100644 --- a/typo3/sysext/backend/Classes/Form/FormResultCompiler.php +++ b/typo3/sysext/backend/Classes/Form/FormResultCompiler.php @@ -242,12 +242,41 @@ class FormResultCompiler } $beUserAuth = $this->getBackendUserAuthentication(); + + // define the window size of the element browser etc. + $popupWindowWidth = 700; + $popupWindowHeight = 750; + $popupWindowSize = trim($beUserAuth->getTSConfigVal('options.popupWindowSize')); + if (!empty($popupWindowSize)) { + list($popupWindowWidth, $popupWindowHeight) = GeneralUtility::intExplode('x', $popupWindowSize); + } + + // define the window size of the popups within the RTE + $rtePopupWindowSize = trim($beUserAuth->getTSConfigVal('options.rte.popupWindowSize')); + if (!empty($rtePopupWindowSize)) { + list($rtePopupWindowWidth, $rtePopupWindowHeight) = GeneralUtility::trimExplode('x', $rtePopupWindowSize); + } + $rtePopupWindowWidth = !empty($rtePopupWindowWidth) ? (int)$rtePopupWindowWidth : ($popupWindowWidth-100); + $rtePopupWindowHeight = !empty($rtePopupWindowHeight) ? (int)$rtePopupWindowHeight : ($popupWindowHeight-150); + // Make textareas resizable and flexible ("autogrow" in height) $textareaSettings = array( - 'autosize' => (bool)$beUserAuth->uc['resizeTextareas_Flexible'] + 'autosize' => (bool)$beUserAuth->uc['resizeTextareas_Flexible'], + 'RTEPopupWindow' => array( + 'width' => $rtePopupWindowWidth, + 'height' => $rtePopupWindowHeight + ) ); $pageRenderer->addInlineSettingArray('Textarea', $textareaSettings); + $popupSettings = array( + 'PopupWindow' => array( + 'width' => $popupWindowWidth, + 'height' => $popupWindowHeight + ) + ); + $pageRenderer->addInlineSettingArray('Popup', $popupSettings); + $this->loadJavascriptLib($backendRelPath . 'Resources/Public/JavaScript/jsfunc.tbe_editor.js'); $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/ValueSlider'); // Needed for FormEngine manipulation (date picker) diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/ContextHelp.js b/typo3/sysext/backend/Resources/Public/JavaScript/ContextHelp.js index b1af70c004f7..ba41c0feffaf 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/ContextHelp.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/ContextHelp.js @@ -106,7 +106,7 @@ define(['jquery', 'TYPO3/CMS/Backend/Popover', 'bootstrap'], function($) { * @param {Object} $trigger */ ContextHelp.showHelpPopup = function($trigger) { - var configuration = top.TYPO3.configuration.ContextHelpWindows || top.TYPO3.configuration.PopupWindow; + var configuration = top.TYPO3.configuration.ContextHelpWindows; try { var cshWindow = window.open( ContextHelp.helpModuleUrl + diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine.js b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine.js index 24ec5d1b661c..d8152d96cd57 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/FormEngine.js @@ -68,8 +68,8 @@ define(['jquery', */ FormEngine.openPopupWindow = setFormValueOpenBrowser = function(mode, params, width, height) { var url = FormEngine.browserUrl + '&mode=' + mode + '&bparams=' + params; - width = width ? width : top.TYPO3.configuration.PopupWindow.width; - height = height ? height : top.TYPO3.configuration.PopupWindow.height; + width = width ? width : TYPO3.settings.Popup.PopupWindow.width; + height = height ? height : TYPO3.settings.Popup.PopupWindow.height; FormEngine.openedPopupWindow = window.open(url, 'Typo3WinBrowser', 'height=' + height + ',width=' + width + ',status=0,menubar=0,resizable=1,scrollbars=1'); FormEngine.openedPopupWindow.focus(); }; diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-76285-PopupConfigurationIsMovedToTYPO3settings.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-76285-PopupConfigurationIsMovedToTYPO3settings.rst new file mode 100644 index 000000000000..7297c182eeca --- /dev/null +++ b/typo3/sysext/core/Documentation/Changelog/master/Breaking-76285-PopupConfigurationIsMovedToTYPO3settings.rst @@ -0,0 +1,41 @@ +================================================================= +Breaking: #76285 - Popup configuration is moved to TYPO3.settings +================================================================= + +Description +=========== + +The popup window configuration is moved to TYPO3.settings. + +The following configuration options are not working anymore. + +:js:`top.TYPO3.configuration.RTEPopupWindow.width` +:js:`top.TYPO3.configuration.RTEPopupWindow.height` +:js:`top.TYPO3.configuration.PopupWindow.width` +:js:`top.TYPO3.configuration.PopupWindow.height` + + +Impact +====== + +Width and height are not set correctly anymore in JavaScript context. + + +Affected Installations +====================== + +Extensions that use one of the mentioned configurations. + + +Migration +========= + +The migration can be done with the following replacements. + +:js:`top.TYPO3.configuration.RTEPopupWindow.width` to :js:`TYPO3.settings.Textarea.RTEPopupWindow.width` + +:js:`top.TYPO3.configuration.RTEPopupWindow.height` to :js:`TYPO3.settings.Textarea.RTEPopupWindow.height` + +:js:`top.TYPO3.configuration.PopupWindow.width` to :js:`TYPO3.settings.Popup.PopupWindow.width` + +:js:`top.TYPO3.configuration.PopupWindow.height` to :js:`TYPO3.settings.Popup.PopupWindow.height` \ No newline at end of file diff --git a/typo3/sysext/rtehtmlarea/Resources/Public/JavaScript/Plugins/TYPO3Image.js b/typo3/sysext/rtehtmlarea/Resources/Public/JavaScript/Plugins/TYPO3Image.js index ad8fdb267adb..a67be7da352c 100644 --- a/typo3/sysext/rtehtmlarea/Resources/Public/JavaScript/Plugins/TYPO3Image.js +++ b/typo3/sysext/rtehtmlarea/Resources/Public/JavaScript/Plugins/TYPO3Image.js @@ -87,8 +87,8 @@ define(['TYPO3/CMS/Rtehtmlarea/HTMLArea/Plugin/Plugin', this.getButton(buttonId).tooltip, this.getWindowDimensions( { - width: top.TYPO3.configuration.RTEPopupWindow.width, - height: top.TYPO3.configuration.RTEPopupWindow.height + width: TYPO3.settings.Textarea.RTEPopupWindow.width, + height: TYPO3.settings.Textarea.RTEPopupWindow.height }, buttonId ), diff --git a/typo3/sysext/rtehtmlarea/Resources/Public/JavaScript/Plugins/TYPO3Link.js b/typo3/sysext/rtehtmlarea/Resources/Public/JavaScript/Plugins/TYPO3Link.js index 54a9690c9d19..0ad84275493a 100644 --- a/typo3/sysext/rtehtmlarea/Resources/Public/JavaScript/Plugins/TYPO3Link.js +++ b/typo3/sysext/rtehtmlarea/Resources/Public/JavaScript/Plugins/TYPO3Link.js @@ -162,8 +162,8 @@ define(['TYPO3/CMS/Rtehtmlarea/HTMLArea/Plugin/Plugin', this.getButton(buttonId).tooltip, this.getWindowDimensions( { - width: top.TYPO3.configuration.RTEPopupWindow.width, - height: top.TYPO3.configuration.RTEPopupWindow.height + width: TYPO3.settings.Textarea.RTEPopupWindow.width, + height: TYPO3.settings.Textarea.RTEPopupWindow.height }, buttonId ), -- GitLab