[TASK] Make browser.php dispatched 32/37432/2
authorWouter Wolters <typo3@wouterwolters.nl>
Sun, 1 Mar 2015 19:56:05 +0000 (20:56 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Sun, 1 Mar 2015 20:34:13 +0000 (21:34 +0100)
Use dispatching for browser.php

Resolves: #65289
Releases: master
Change-Id: I8edb2fb1182af39d5a87e8291e8b208067a70a9c
Reviewed-on: http://review.typo3.org/37432
Reviewed-by: Benjamin Mack <benni@typo3.org>
Tested-by: Benjamin Mack <benni@typo3.org>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/browser.php
typo3/sysext/backend/Classes/Form/FormEngine.php
typo3/sysext/backend/Modules/Browser/conf.php [new file with mode: 0644]
typo3/sysext/backend/Modules/Browser/index.php [new file with mode: 0644]
typo3/sysext/backend/Resources/Public/JavaScript/FormEngine.js
typo3/sysext/backend/ext_tables.php
typo3/sysext/core/Documentation/Changelog/master/Deprecation-65289-DeprecateBrowserEntryPoint.rst [new file with mode: 0644]

index 04f1018..a10edc4 100644 (file)
  */
 require __DIR__ . '/init.php';
 
+\TYPO3\CMS\Core\Utility\GeneralUtility::deprecationLog(
+       'The entry point to the file/record browser window was moved to an own module. Please use BackendUtility::getModuleUrl(\'browser\') to link to browser.php. This script will be removed in TYPO3 CMS 8.'
+);
+
 $elementBrowserFramesetController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Recordlist\Controller\ElementBrowserFramesetController::class);
 $elementBrowserFramesetController->main();
 $elementBrowserFramesetController->printContent();
index 2057944..d081f01 100644 (file)
@@ -1941,7 +1941,9 @@ class FormEngine {
                        }
                        $pageRenderer = $this->getPageRenderer();
                        // load the main module for FormEngine with all important JS functions
-                       $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/FormEngine');
+                       $pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/FormEngine', 'function(FormEngine) {
+                               FormEngine.setBrowserUrl(' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('browser')) . ');
+                       }');
                        $pageRenderer->loadPrototype();
                        $pageRenderer->loadJquery();
                        $pageRenderer->loadExtJS();
diff --git a/typo3/sysext/backend/Modules/Browser/conf.php b/typo3/sysext/backend/Modules/Browser/conf.php
new file mode 100644 (file)
index 0000000..60d7df1
--- /dev/null
@@ -0,0 +1,4 @@
+<?php
+// Required for mod.php
+$MCONF['name'] = 'browser';
+$MCONF['script'] = '_DISPATCH';
\ No newline at end of file
diff --git a/typo3/sysext/backend/Modules/Browser/index.php b/typo3/sysext/backend/Modules/Browser/index.php
new file mode 100644 (file)
index 0000000..fda8c38
--- /dev/null
@@ -0,0 +1,25 @@
+<?php
+/*
+ * This file is part of the TYPO3 CMS project.
+ *
+ * It is free software; you can redistribute it and/or modify it under
+ * the terms of the GNU General Public License, either version 2
+ * of the License, or any later version.
+ *
+ * For the full copyright and license information, please read the
+ * LICENSE.txt file that was distributed with this source code.
+ *
+ * The TYPO3 project - inspiring people to share!
+ */
+
+/**
+ * This is the frameset to the file/record browser window
+ *
+ * @author Kasper Skårhøj <kasperYYYY@typo3.com>
+ */
+
+$elementBrowserFramesetController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
+       \TYPO3\CMS\Recordlist\Controller\ElementBrowserFramesetController::class
+);
+$elementBrowserFramesetController->main();
+$elementBrowserFramesetController->printContent();
\ No newline at end of file
index 9355d2b..b9e4c80 100644 (file)
@@ -36,8 +36,12 @@ define('TYPO3/CMS/Backend/FormEngine', ['jquery'], function ($) {
                ,backPath: TYPO3.settings.FormEngine.backPath
                ,openedPopupWindow: null
                ,legacyFieldChangedCb: function() { !$.isFunction(TYPO3.settings.FormEngine.legacyFieldChangedCb) || TYPO3.settings.FormEngine.legacyFieldChangedCb(); }
+               ,browserUrl: ''
        };
 
+       FormEngine.setBrowserUrl = function(browserUrl) {
+               FormEngine.browserUrl = browserUrl;
+       };
 
        // functions to connect the db/file browser with this document and the formfields on it!
 
@@ -50,7 +54,7 @@ define('TYPO3/CMS/Backend/FormEngine', ['jquery'], function ($) {
         * @param height height of the window
         */
        FormEngine.openPopupWindow = setFormValueOpenBrowser = function(mode, params, width, height) {
-               var url = FormEngine.backPath + 'browser.php?mode=' + mode + '&bparams=' + params;
+               var url = FormEngine.backPath + FormEngine.browserUrl + '&mode=' + mode + '&bparams=' + params;
                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');
index 52d48b9..cb5cf2a 100644 (file)
@@ -133,4 +133,10 @@ if (TYPO3_MODE === 'BE') {
                'show_item',
                \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Modules/ShowItem/'
        );
+
+       // Register browser
+       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModulePath(
+               'browser',
+               \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Modules/Browser/'
+       );
 }
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-65289-DeprecateBrowserEntryPoint.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-65289-DeprecateBrowserEntryPoint.rst
new file mode 100644 (file)
index 0000000..69ecf6c
--- /dev/null
@@ -0,0 +1,25 @@
+===================================================
+Deprecation: #65289 - Deprecate browser entry point
+===================================================
+
+Description
+===========
+
+The following entry point has been marked as deprecated:
+
+* typo3/browser.php
+
+
+Impact
+======
+
+Using this entry points in a backend module will throw a deprecation message.
+
+
+Migration
+=========
+
+Use ``\TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl()`` instead with the according module name.
+
+typo3/browser.php
+``\TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('browser')``
\ No newline at end of file