[FEATURE] Configurable width of the Element Browser Popups 18/29618/6
authorGeorg Ringer <georg.ringer@gmail.com>
Fri, 18 Apr 2014 03:24:41 +0000 (05:24 +0200)
committerJigal van Hemert <jigal.van.hemert@typo3.org>
Sun, 21 Dec 2014 22:15:33 +0000 (23:15 +0100)
The width of the element browser is sadly hardcoded to 600 and 650.

In many situations the element browser would need more place and
with this tiny change it would be easily possible to change
that behaviour without overloading the whole file.

The patch allows to set dimensions on a per-user basis via
userTSconfig.

Resolves: #58031
Resolves: #20929
Resolves: #22976
Releases: master
Change-Id: Ida3d01c7fd0457b4a88a33a10b0c19792ba9751a
Reviewed-on: http://review.typo3.org/29618
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Alexander Opitz <opitz.alexander@googlemail.com>
Reviewed-by: Jigal van Hemert <jigal.van.hemert@typo3.org>
Tested-by: Jigal van Hemert <jigal.van.hemert@typo3.org>
typo3/sysext/backend/Classes/Controller/BackendController.php
typo3/sysext/backend/Resources/Public/JavaScript/FormEngine.js
typo3/sysext/core/Documentation/Changelog/master/Feature-58031-ConfigurableWidthOfElementBrowser.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 f0bfcbf..0d98dd3 100644 (file)
@@ -471,6 +471,21 @@ class BackendController {
                // Needed for tceform 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.
+               $popupWindowSize = trim($GLOBALS['BE_USER']->getTSConfigVal('options.popupWindowSize'));
+               if (!empty($popupWindowSize)) {
+                       list($popupWindowWidth, $popupWindowHeight) = GeneralUtility::trimExplode('x', $popupWindowSize);
+               }
+               $popupWindowWidth  = !empty($popupWindowWidth) ? (int)$popupWindowWidth : 700;
+               $popupWindowHeight = !empty($popupWindowHeight) ? (int)$popupWindowHeight : 750;
+
+               // define the window size of the popups within the RTE
+               $rtePopupWindowSize = trim($GLOBALS['BE_USER']->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);
 
                $pathTYPO3 = GeneralUtility::dirname(GeneralUtility::getIndpEnv('SCRIPT_NAME')) . '/';
                // If another page module was specified, replace the default Page module with the new one
@@ -507,6 +522,14 @@ class BackendController {
                                'width' => 600,
                                'height' => 400
                        ),
+                       'PopupWindow' => array(
+                               'width' => $popupWindowWidth,
+                               'height' => $popupWindowHeight
+                       ),
+                       'RTEPopupWindow' => array(
+                               'width' => $rtePopupWindowWidth,
+                               'height' => $rtePopupWindowHeight
+                       )
                );
                $this->js .= '
        TYPO3.configuration = ' . json_encode($t3Configuration) . ';
@@ -771,4 +794,4 @@ class BackendController {
                return $view;
        }
 
-}
+}
\ No newline at end of file
index 53e24b5..ae11796 100644 (file)
@@ -46,10 +46,14 @@ define('TYPO3/CMS/Backend/FormEngine', ['jquery'], function ($) {
         *
         * @param mode can be "db" or "file"
         * @param params additional params for the browser window
+        * @param width width of the window
+        * @param height height of the window
         */
-       FormEngine.openPopupWindow = setFormValueOpenBrowser = function(mode, params) {
+       FormEngine.openPopupWindow = setFormValueOpenBrowser = function(mode, params, width, height) {
                var url = FormEngine.backPath + 'browser.php?mode=' + mode + '&bparams=' + params;
-               FormEngine.openedPopupWindow = window.open(url, 'Typo3WinBrowser', 'height=650,width=' + (mode == 'db' ? 650 : 600) + ',status=0,menubar=0,resizable=1,scrollbars=1');
+               width = width ? width : top.TYPO3.configuration.PopupWindow.width;
+               height = height ? height : top.TYPO3.configuration.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/Feature-58031-ConfigurableWidthOfElementBrowser.rst b/typo3/sysext/core/Documentation/Changelog/master/Feature-58031-ConfigurableWidthOfElementBrowser.rst
new file mode 100644 (file)
index 0000000..389ac46
--- /dev/null
@@ -0,0 +1,19 @@
+===========================================================
+Feature: #50039 - Configurable width of the Element Browser
+===========================================================
+
+Description
+===========
+
+It is now possible to set the width and height of the element browser on a per-user basis via UserTSConfig.
+
+Usage:
+
+::
+       options.popupWindowSize = 400x900
+       options.RTE.popupWindowSize = 200x200
+
+Impact
+======
+
+The Element Browser width and height can be set for better usability and user experience.
index 4bff4a0..b365288 100644 (file)
@@ -89,8 +89,8 @@ define('TYPO3/CMS/Rtehtmlarea/Plugins/TYPO3Image',
                                this.getButton(buttonId).tooltip,
                                this.getWindowDimensions(
                                        {
-                                               width:  650,
-                                               height: 500
+                                               width:  top.TYPO3.configuration.RTEPopupWindow.width,
+                                               height: top.TYPO3.configuration.RTEPopupWindow.height
                                        },
                                        buttonId
                                ),
index 7b83071..0f78163 100644 (file)
@@ -164,8 +164,8 @@ define('TYPO3/CMS/Rtehtmlarea/Plugins/TYPO3Link',
                                        this.getButton(buttonId).tooltip,
                                        this.getWindowDimensions(
                                                {
-                                                       width:  550,
-                                                       height: 500
+                                                       width:  top.TYPO3.configuration.RTEPopupWindow.width,
+                                                       height: top.TYPO3.configuration.RTEPopupWindow.height
                                                },
                                                buttonId
                                        ),