[!!!][BUGFIX] Load popup configuration in case backend submodules are opened in a... 76/48276/7
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Tue, 24 May 2016 13:11:57 +0000 (15:11 +0200)
committerFrank Naegler <frank.naegler@typo3.org>
Fri, 27 May 2016 09:17:00 +0000 (11:17 +0200)
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>
typo3/sysext/backend/Classes/Controller/BackendController.php
typo3/sysext/backend/Classes/Controller/EditDocumentController.php
typo3/sysext/backend/Classes/Form/FormResultCompiler.php
typo3/sysext/backend/Resources/Public/JavaScript/ContextHelp.js
typo3/sysext/backend/Resources/Public/JavaScript/FormEngine.js
typo3/sysext/core/Documentation/Changelog/master/Breaking-76285-PopupConfigurationIsMovedToTYPO3settings.rst [new file with mode: 0644]
typo3/sysext/rtehtmlarea/Resources/Public/JavaScript/Plugins/TYPO3Image.js
typo3/sysext/rtehtmlarea/Resources/Public/JavaScript/Plugins/TYPO3Link.js

index 89d546e..37f9cf0 100644 (file)
@@ -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 .= '
index 36de73c..dd31b09 100644 (file)
@@ -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 = '
index 3e45671..589cb6e 100644 (file)
@@ -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)
index b1af70c..ba41c0f 100644 (file)
@@ -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 +
index 24ec5d1..d8152d9 100644 (file)
@@ -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 (file)
index 0000000..7297c18
--- /dev/null
@@ -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
index ad8fdb2..a67be7d 100644 (file)
@@ -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
                                ),
index 54a9690..0ad8427 100644 (file)
@@ -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
                                        ),