[TASK] Make show_item.php dispatched 86/37186/8
authorWouter Wolters <typo3@wouterwolters.nl>
Tue, 24 Feb 2015 20:29:26 +0000 (21:29 +0100)
committerAnja Leichsenring <aleichsenring@ab-softlab.de>
Sun, 1 Mar 2015 10:49:32 +0000 (11:49 +0100)
Use dispatching for show_item.php

Resolves: #65283
Releases: master
Change-Id: If70f513ecc50445ea67b7e68bf7cd1df44cbf013
Reviewed-on: http://review.typo3.org/37186
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
typo3/show_item.php
typo3/sysext/backend/Classes/Controller/BackendController.php
typo3/sysext/backend/Classes/Controller/EditDocumentController.php
typo3/sysext/backend/Modules/ShowItem/conf.php [new file with mode: 0644]
typo3/sysext/backend/Modules/ShowItem/index.php [new file with mode: 0644]
typo3/sysext/backend/Resources/Public/JavaScript/backend.js
typo3/sysext/backend/ext_tables.php
typo3/sysext/core/Documentation/Changelog/master/Deprecation-65283-DeprecateShowItemEntryPoint.rst [new file with mode: 0644]
typo3/sysext/recordlist/Classes/Browser/ElementBrowser.php
typo3/sysext/rtehtmlarea/Classes/BrowseLinks.php

index 4c8a4b5..cb48e14 100644 (file)
 
 require __DIR__ . '/init.php';
 
+\TYPO3\CMS\Core\Utility\GeneralUtility::deprecationLog(
+       'The entry point to show_item was moved to an own module. Please use BackendUtility::getModuleUrl(\'show_item\') to link to show_item.php. This script will be removed in TYPO3 CMS 8.'
+);
+
 $elementInformationController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
        \TYPO3\CMS\Backend\Controller\ContentElement\ElementInformationController::class
 );
index afe7eeb..c34cdd3 100644 (file)
@@ -146,6 +146,9 @@ class BackendController {
                $this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Backend/Storage', 'function(Storage) {
                        Storage.Persistent.load(' . json_encode($GLOBALS['BE_USER']->uc) . ');
                }');
+
+               $this->pageRenderer->addInlineSetting('ShowItem', 'moduleUrl', BackendUtility::getModuleUrl('show_item'));
+
                $this->css = '';
 
                $this->initializeToolbarItems();
index cf69f65..08a5f88 100644 (file)
@@ -690,7 +690,7 @@ class EditDocumentController {
                        function launchView(table,uid,bP) {     //
                                var backPath= bP ? bP : "";
                                var thePreviewWindow="";
-                               thePreviewWindow = window.open(backPath+"show_item.php?table="+encodeURIComponent(table)+"&uid="+encodeURIComponent(uid),"ShowItem"+TS.uniqueID,"height=300,width=410,status=0,menubar=0,resizable=0,location=0,directories=0,scrollbars=1,toolbar=0");
+                               thePreviewWindow = window.open(backPath+' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('show_item', array(), '') . '&table=') . '+encodeURIComponent(table)+"&uid="+encodeURIComponent(uid),"ShowItem"+TS.uniqueID,"height=300,width=410,status=0,menubar=0,resizable=0,location=0,directories=0,scrollbars=1,toolbar=0");
                                if (thePreviewWindow && thePreviewWindow.focus) {
                                        thePreviewWindow.focus();
                                }
diff --git a/typo3/sysext/backend/Modules/ShowItem/conf.php b/typo3/sysext/backend/Modules/ShowItem/conf.php
new file mode 100644 (file)
index 0000000..1ab6802
--- /dev/null
@@ -0,0 +1,4 @@
+<?php
+// required for mod.php
+$MCONF['name'] = 'show_item';
+$MCONF['script'] = '_DISPATCH';
\ No newline at end of file
diff --git a/typo3/sysext/backend/Modules/ShowItem/index.php b/typo3/sysext/backend/Modules/ShowItem/index.php
new file mode 100644 (file)
index 0000000..9df789e
--- /dev/null
@@ -0,0 +1,19 @@
+<?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!
+ */
+
+$elementInformationController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(
+       \TYPO3\CMS\Backend\Controller\ContentElement\ElementInformationController::class
+);
+$elementInformationController->main();
+$elementInformationController->printContent();
\ No newline at end of file
index 7530d4b..2f38548 100644 (file)
@@ -133,9 +133,8 @@ function str_replace(match,replace,string)  {       //
  * Launcing information window for records/files (fileref as "table" argument)
  */
 function launchView(table, uid, bP) {
-       var backPath = bP ? bP : "";
        var thePreviewWindow = "";
-       thePreviewWindow = window.open(TS.PATH_typo3 + "show_item.php?table=" + encodeURIComponent(table) + "&uid=" + encodeURIComponent(uid),
+       thePreviewWindow = window.open(TS.PATH_typo3 + TYPO3.settings.ShowItem.moduleUrl + '&table=' + encodeURIComponent(table) + "&uid=" + encodeURIComponent(uid),
                        "ShowItem" + TS.uniqueID,
                        "width=650,height=600,status=0,menubar=0,resizable=0,location=0,directories=0,scrollbars=1,toolbar=0");
        if (thePreviewWindow && thePreviewWindow.focus) {
index 3dbf337..98b0c57 100644 (file)
@@ -121,4 +121,10 @@ if (TYPO3_MODE === 'BE') {
                'move_element',
                \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Modules/MoveElement/'
        );
+
+       // Register show item module
+       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::addModulePath(
+               'show_item',
+               \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::extPath($_EXTKEY) . 'Modules/ShowItem/'
+       );
 }
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-65283-DeprecateShowItemEntryPoint.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-65283-DeprecateShowItemEntryPoint.rst
new file mode 100644 (file)
index 0000000..5e20db9
--- /dev/null
@@ -0,0 +1,25 @@
+=====================================================
+Deprecation: #65283 - Deprecate show item entry point
+=====================================================
+
+Description
+===========
+
+The following entry point has been marked as deprecated:
+
+* typo3/show_item.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/show_item.php
+``\TYPO3\CMS\Backend\Utility\BackendUtility::getModuleUrl('show_item')``
\ No newline at end of file
index dd29d0b..bd858ae 100644 (file)
@@ -743,7 +743,7 @@ class ElementBrowser {
 
                        function launchView(url) {      //
                                var thePreviewWindow="";
-                               thePreviewWindow = window.open("' . $GLOBALS['BACK_PATH'] . 'show_item.php?table="+url,"ShowItem",'
+                               thePreviewWindow = window.open(' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('show_item') . '&table=') . '+url,"ShowItem",'
                                . '"height=300,width=410,status=0,menubar=0,resizable=0,location=0,directories=0,scrollbars=1,toolbar=0");
                                if (thePreviewWindow && thePreviewWindow.focus) {
                                        thePreviewWindow.focus();
index d055e68..af31e85 100644 (file)
@@ -403,7 +403,7 @@ class BrowseLinks extends \TYPO3\CMS\Recordlist\Browser\ElementBrowser {
                        }
                        function launchView(url) {
                                var thePreviewWindow="";
-                               thePreviewWindow = window.open("' . $GLOBALS['BACK_PATH'] . 'show_item.php?table="+url,"ShowItem","height=300,width=410,status=0,menubar=0,resizable=0,location=0,directories=0,scrollbars=1,toolbar=0");
+                               thePreviewWindow = window.open(' . GeneralUtility::quoteJSvalue(BackendUtility::getModuleUrl('show_item') . '&table=') . '+url,"ShowItem","height=300,width=410,status=0,menubar=0,resizable=0,location=0,directories=0,scrollbars=1,toolbar=0");
                                if (thePreviewWindow && thePreviewWindow.focus) {
                                        thePreviewWindow.focus();
                                }