[!!!][TASK] Clean up OpendocsToolbarItem references 09/34409/4
authorChristian Kuhn <lolli@schwarzbu.ch>
Thu, 20 Nov 2014 20:12:48 +0000 (21:12 +0100)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 20 Nov 2014 21:06:17 +0000 (22:06 +0100)
With toolbar refactoring, OpendocsController was renamed
to OpendocsToolbarItem and a class alias was introduced to
cope with core internal usages of the old class names. This
is cleaned up with this patch.

The class was still referenced in alt_doc_nodoc.php entry
point through EditDocumentController. This ancient code is
obsolete since around 4.3 but was never removed. The patch
now removes this entry point and redirects to dummy.php in
EditDocumentController just in case this code snippet is
still triggered somehow - which is unlikely, but can not be
overseen currently.

Furthermore, the alias OpendocsController is removed: The
new class implements a different interface now, so this
would break anyway - which is also unlikely to be used by
third party code.

Change-Id: Iaa5a7be7ef0e50c1ca1aca245c163e7bc5790410
Resolves: #63110
Related: #62928
Releases: master
Reviewed-on: http://review.typo3.org/34409
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Tested-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Markus Klein <klein.t3@reelworx.at>
Tested-by: Markus Klein <klein.t3@reelworx.at>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/alt_doc_nodoc.php [deleted file]
typo3/sysext/backend/Classes/Controller/EditDocumentController.php
typo3/sysext/backend/Classes/Controller/NoDocumentsOpenController.php [deleted file]
typo3/sysext/compatibility6/Migrations/Code/ClassAliasMap.php
typo3/sysext/compatibility6/Migrations/Code/LegacyClassesForIde.php
typo3/sysext/core/Documentation/Changelog/master/Breaking-63110-AltDocNoDoc-Removed.rst [new file with mode: 0644]
typo3/sysext/opendocs/Classes/Backend/ToolbarItems/OpendocsToolbarItem.php
typo3/sysext/opendocs/Migrations/Code/ClassAliasMap.php [deleted file]
typo3/sysext/opendocs/ext_tables.php
typo3/sysext/t3skin/Resources/Private/Styles/TYPO3/structure/_element_recent_edited.less [deleted file]
typo3/sysext/t3skin/Resources/Public/Css/visual/t3skin.css

diff --git a/typo3/alt_doc_nodoc.php b/typo3/alt_doc_nodoc.php
deleted file mode 100644 (file)
index 739ce25..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-<?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!
- */
-
-/**
- * No-document script
- * This is used by eg. the Doc module if no documents is registered as "open"
- * (a concept which is better known from the "classic backend"...)
- *
- * @author Kasper Skårhøj <kasperYYYY@typo3.com>
- */
-require __DIR__ . '/init.php';
-
-$noDocumentsOpenController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Controller\NoDocumentsOpenController::class);
-$noDocumentsOpenController->main();
-$noDocumentsOpenController->printContent();
index c48fa73..cd17f88 100644 (file)
@@ -1495,8 +1495,8 @@ class EditDocumentController {
         * @param string $retUrl Alternative/Default retUrl
         * @return void
         */
-       public function setDocument($currentDocFromHandlerMD5 = '', $retUrl = 'alt_doc_nodoc.php') {
-               if ($retUrl === 'alt_doc_nodoc.php') {
+       public function setDocument($currentDocFromHandlerMD5 = '', $retUrl = 'dummy.php') {
+               if ($retUrl === 'dummy.php') {
                        return;
                }
                if (!$this->modTSconfig['properties']['disableDocSelector'] && is_array($this->docHandler) && count($this->docHandler)) {
diff --git a/typo3/sysext/backend/Classes/Controller/NoDocumentsOpenController.php b/typo3/sysext/backend/Classes/Controller/NoDocumentsOpenController.php
deleted file mode 100644 (file)
index a72f3e0..0000000
+++ /dev/null
@@ -1,145 +0,0 @@
-<?php
-namespace TYPO3\CMS\Backend\Controller;
-
-/**
- * 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!
- */
-
-use TYPO3\CMS\Core\Utility\GeneralUtility;
-
-/**
- * Script Class for the "No-doc" display; This shows most recently edited records.
- *
- * @author Kasper Skårhøj <kasperYYYY@typo3.com>
- */
-class NoDocumentsOpenController {
-
-       /**
-        * @var string
-        */
-       public $content;
-
-       /**
-        * Document template object
-        *
-        * @var \TYPO3\CMS\Backend\Template\DocumentTemplate
-        */
-       public $doc;
-
-       /**
-        * Object for backend modules.
-        *
-        * @var \TYPO3\CMS\Backend\Module\ModuleLoader
-        */
-       public $loadModules;
-
-       /**
-        * Constructor
-        */
-       public function __construct() {
-               $GLOBALS['SOBE'] = $this;
-               $GLOBALS['LANG']->includeLLFile('EXT:lang/locallang_alt_doc.xml');
-
-               $this->init();
-       }
-
-       /**
-        * Initialize.
-        *
-        * @return void
-        */
-       protected function init() {
-               // Start the template object:
-               $this->doc = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Template\DocumentTemplate::class);
-               $this->doc->bodyTagMargins['x'] = 5;
-               $this->doc->bodyTagMargins['y'] = 5;
-               $this->doc->backPath = $GLOBALS['BACK_PATH'];
-               // Add JS
-               $this->doc->JScode = $this->doc->wrapScriptTags('
-               function jump(url, modName, mainModName) {
-                               // clear information about which entry in nav. tree that might have been highlighted.
-                       top.fsMod.navFrameHighlightedID = [];
-
-                       if (top.content && top.content.nav_frame && top.content.nav_frame.refresh_nav) {
-                               top.content.nav_frame.refresh_nav();
-                       }
-
-                       top.nextLoadModuleUrl = url;
-                       top.goToModule(modName);
-               }
-               ');
-               // Start the page:
-               $this->content = '';
-               $this->content .= $this->doc->startPage('TYPO3 Edit Document');
-               // Loads the backend modules available for the logged in user.
-               $this->loadModules = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Module\ModuleLoader::class);
-               $this->loadModules->load($GLOBALS['TBE_MODULES']);
-       }
-
-       /**
-        * Rendering the content.
-        *
-        * @return void
-        */
-       public function main() {
-               $msg = array();
-               // Add a message, telling that no documents were open...
-               $msg[] = '<p>' . $GLOBALS['LANG']->getLL('noDocuments_msg', TRUE) . '</p><br />';
-               // If another page module was specified, replace the default Page module with the new one
-               $newPageModule = trim($GLOBALS['BE_USER']->getTSConfigVal('options.overridePageModule'));
-               $pageModule = \TYPO3\CMS\Backend\Utility\BackendUtility::isModuleSetInTBE_MODULES($newPageModule) ? $newPageModule : 'web_layout';
-               // Perform some access checks:
-               $a_wl = $GLOBALS['BE_USER']->check('modules', 'web_list');
-               $a_wp = $GLOBALS['BE_USER']->check('modules', $pageModule);
-               // Finding module images: PAGE
-               $imgFile = $GLOBALS['LANG']->moduleLabels['tabs_images']['web_layout_tab'];
-               $imgInfo = @getimagesize($imgFile);
-               $img_web_layout = is_array($imgInfo) ? '<img src="../' . \TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix($imgFile) . '" ' . $imgInfo[3] . ' alt="" />' : '';
-               // Finding module images: LIST
-               $imgFile = $GLOBALS['LANG']->moduleLabels['tabs_images']['web_list_tab'];
-               $imgInfo = @getimagesize($imgFile);
-               $img_web_list = is_array($imgInfo) ? '<img src="../' . \TYPO3\CMS\Core\Utility\PathUtility::stripPathSitePrefix($imgFile) . '" ' . $imgInfo[3] . ' alt="" />' : '';
-               // If either the Web>List OR Web>Page module are active, show the little message with links to those modules:
-               if ($a_wl || $a_wp) {
-                       $msg_2 = array();
-                       // Web>Page:
-                       if ($a_wp) {
-                               $msg_2[] = '<strong><a href="#" onclick="top.goToModule(\'' . $pageModule . '\'); return false;">' . $GLOBALS['LANG']->getLL('noDocuments_pagemodule', TRUE) . $img_web_layout . '</a></strong>';
-                               if ($a_wl) {
-                                       $msg_2[] = $GLOBALS['LANG']->getLL('noDocuments_OR');
-                               }
-                       }
-                       // Web>List
-                       if ($a_wl) {
-                               $msg_2[] = '<strong><a href="#" onclick="top.goToModule(\'web_list\'); return false;">' . $GLOBALS['LANG']->getLL('noDocuments_listmodule', TRUE) . $img_web_list . '</a></strong>';
-                       }
-                       $msg[] = '<p>' . sprintf($GLOBALS['LANG']->getLL('noDocuments_msg2', 1), implode(' ', $msg_2)) . '</p><br />';
-               }
-               // Display the list of the most recently edited documents:
-               $modObj = GeneralUtility::makeInstance(\TYPO3\CMS\Opendocs\Controller\OpendocsController::class);
-               $msg[] = '<p>' . $GLOBALS['LANG']->getLL('noDocuments_msg3', TRUE) . '</p><br />' . $modObj->renderMenu();
-               // Adding the content:
-               $this->content .= $this->doc->section($GLOBALS['LANG']->getLL('noDocuments'), implode(' ', $msg), 0, 1);
-       }
-
-       /**
-        * Printing the content.
-        *
-        * @return void
-        */
-       public function printContent() {
-               $this->content .= $this->doc->endPage();
-               $this->content = $this->doc->insertStylesAndJS($this->content);
-               echo $this->content;
-       }
-
-}
index 5e7e59b..de085e2 100644 (file)
@@ -29,7 +29,6 @@ return array(
        'SC_move_el' => 'TYPO3\\CMS\\Backend\\Controller\\ContentElement\\MoveElementController',
        'SC_dummy' => 'TYPO3\\CMS\\Backend\\Controller\\DummyController',
        'SC_alt_doc' => 'TYPO3\\CMS\\Backend\\Controller\\EditDocumentController',
-       'SC_alt_doc_nodoc' => 'TYPO3\\CMS\\Backend\\Controller\\NoDocumentsOpenController',
        'SC_file_newfolder' => 'TYPO3\\CMS\\Backend\\Controller\\File\\CreateFolderController',
        'SC_file_edit' => 'TYPO3\\CMS\\Backend\\Controller\\File\\EditFileController',
        'TYPO3_tcefile' => 'TYPO3\\CMS\\Backend\\Controller\\File\\FileController',
@@ -1109,7 +1108,6 @@ return array(
        't3lib_arrayBrowser' => 'TYPO3\\CMS\\Lowlevel\\Utility\\ArrayBrowser',
        'SC_mod_tools_config_index' => 'TYPO3\\CMS\\Lowlevel\\View\\ConfigurationView',
        'SC_mod_tools_dbint_index' => 'TYPO3\\CMS\\Lowlevel\\View\\DatabaseIntegrityView',
-       'tx_opendocs' => 'TYPO3\\CMS\\Opendocs\\Controller\\OpendocsController',
        'tx_openid_eID' => 'TYPO3\\CMS\\Openid\\OpenidEid',
        'tx_openid_mod_setup' => 'TYPO3\\CMS\\Openid\\OpenidModuleSetup',
        'tx_openid_return' => 'TYPO3\\CMS\\Openid\\OpenidReturn',
index 3a316e7..d6643e3 100644 (file)
@@ -59,8 +59,6 @@ class SC_dummy extends \TYPO3\CMS\Backend\Controller\DummyController {}
 
 class SC_alt_doc extends \TYPO3\CMS\Backend\Controller\EditDocumentController {}
 
-class SC_alt_doc_nodoc extends \TYPO3\CMS\Backend\Controller\NoDocumentsOpenController {}
-
 class SC_file_newfolder extends \TYPO3\CMS\Backend\Controller\File\CreateFolderController {}
 
 class SC_file_edit extends \TYPO3\CMS\Backend\Controller\File\EditFileController {}
@@ -2155,8 +2153,6 @@ class SC_mod_tools_config_index extends \TYPO3\CMS\Lowlevel\View\ConfigurationVi
 
 class SC_mod_tools_dbint_index extends \TYPO3\CMS\Lowlevel\View\DatabaseIntegrityView {}
 
-class tx_opendocs extends \TYPO3\CMS\Opendocs\Controller\OpendocsController {}
-
 class tx_openid_eID extends \TYPO3\CMS\Openid\OpenidEid {}
 
 class tx_openid_mod_setup extends \TYPO3\CMS\Openid\OpenidModuleSetup {}
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-63110-AltDocNoDoc-Removed.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-63110-AltDocNoDoc-Removed.rst
new file mode 100644 (file)
index 0000000..5978d53
--- /dev/null
@@ -0,0 +1,23 @@
+============================================
+Breaking: #63110 - alt_doc_nodoc.php removed
+============================================
+
+Description
+===========
+
+Script entry point typo3/alt_doc_nodoc.php and NoDocumentsOpenController class are removed without substitution.
+
+Impact
+======
+
+A script pointing to this file resource will trigger a 404 server response and a script instantiating the class will fatal.
+
+Affected installations
+======================
+
+An extension needs to be adapted in the unlikely case that it uses this code.
+
+Migration
+=========
+
+Maybe redirecting to typo3/dummy.php instead is be a feasible solution.
\ No newline at end of file
index bdacab2..b9284eb 100644 (file)
@@ -147,7 +147,7 @@ class OpendocsToolbarItem implements ToolbarItemInterface {
                        $firstRow = ' first-row';
                }
                if (!$isRecentDoc) {
-                       $title = $GLOBALS['LANG']->sL('LLL:EXT:lang/locallang_core.xlf:rm.closeDoc', TRUE);
+                       $title = $this->getLanguageService()->sL('LLL:EXT:lang/locallang_core.xlf:rm.closeDoc', TRUE);
                        // Open document
                        $closeIcon = \TYPO3\CMS\Backend\Utility\IconUtility::getSpriteIcon('actions-document-close');
                        $entry = '
@@ -215,7 +215,8 @@ class OpendocsToolbarItem implements ToolbarItemInterface {
         * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj Object of type AjaxRequestHandler
         * @return string List item HTML attributes
         */
-       public function closeDocument($params = array(), \TYPO3\CMS\Core\Http\AjaxRequestHandler &$ajaxObj = NULL) {
+       public function closeDocument($params = array(), \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj = NULL) {
+               $backendUser = $this->getBackendUser();
                $md5sum = \TYPO3\CMS\Core\Utility\GeneralUtility::_GP('md5sum');
                if ($md5sum && isset($this->openDocs[$md5sum])) {
                        // Add the document to be closed to the recent documents
@@ -226,9 +227,9 @@ class OpendocsToolbarItem implements ToolbarItemInterface {
                        }
                        // Remove it from the list of the open documents, and store the status
                        unset($this->openDocs[$md5sum]);
-                       list(, $docDat) = $GLOBALS['BE_USER']->getModuleData('alt_doc.php', 'ses');
-                       $GLOBALS['BE_USER']->pushModuleData('alt_doc.php', array($this->openDocs, $docDat));
-                       $GLOBALS['BE_USER']->pushModuleData('opendocs::recent', $this->recentDocs);
+                       list(, $docDat) = $backendUser->getModuleData('alt_doc.php', 'ses');
+                       $backendUser->pushModuleData('alt_doc.php', array($this->openDocs, $docDat));
+                       $backendUser->pushModuleData('opendocs::recent', $this->recentDocs);
                }
                $this->renderAjax($params, $ajaxObj);
        }
@@ -240,7 +241,7 @@ class OpendocsToolbarItem implements ToolbarItemInterface {
         * @param \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj Object of type AjaxRequestHandler
         * @return void
         */
-       public function renderAjax($params = array(), \TYPO3\CMS\Core\Http\AjaxRequestHandler &$ajaxObj = NULL) {
+       public function renderAjax($params = array(), \TYPO3\CMS\Core\Http\AjaxRequestHandler $ajaxObj = NULL) {
                $ajaxObj->addContent('opendocsMenu', $this->getDropDown());
        }
 
diff --git a/typo3/sysext/opendocs/Migrations/Code/ClassAliasMap.php b/typo3/sysext/opendocs/Migrations/Code/ClassAliasMap.php
deleted file mode 100644 (file)
index b4f21ff..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-<?php
-return array(
-       // @TODO: Migrate old class name usages to the new one
-       'TYPO3\\CMS\\Opendocs\\Controller\\OpendocsController' => 'TYPO3\\CMS\\Opendocs\\Backend\\ToolbarItems\\OpendocsToolbarItem',
-);
\ No newline at end of file
index da9f04a..7d88cfc 100644 (file)
@@ -3,8 +3,8 @@ defined('TYPO3_MODE') or die();
 
 if (TYPO3_MODE === 'BE') {
        // Register AJAX calls
-       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::registerAjaxHandler('TxOpendocs::renderMenu', 'TYPO3\\CMS\\Opendocs\\Controller\\OpendocsController->renderAjax');
-       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::registerAjaxHandler('TxOpendocs::closeDocument', 'TYPO3\\CMS\\Opendocs\\Controller\\OpendocsController->closeDocument');
+       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::registerAjaxHandler('TxOpendocs::renderMenu', 'TYPO3\\CMS\\Opendocs\\Backend\\ToolbarItems\\OpendocsToolbarItem->renderAjax');
+       \TYPO3\CMS\Core\Utility\ExtensionManagementUtility::registerAjaxHandler('TxOpendocs::closeDocument', 'TYPO3\\CMS\\Opendocs\\Backend\\ToolbarItems\\OpendocsToolbarItem->closeDocument');
        // Register update signal to update the number of open documents
-       $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['updateSignalHook']['OpendocsController::updateNumber'] = 'TYPO3\\CMS\\Opendocs\\Controller\\OpendocsController->updateNumberOfOpenDocsHook';
+       $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/class.t3lib_befunc.php']['updateSignalHook']['OpendocsController::updateNumber'] = 'TYPO3\\CMS\\Opendocs\\Backend\\ToolbarItems\\OpendocsToolbarItem->updateNumberOfOpenDocsHook';
 }
diff --git a/typo3/sysext/t3skin/Resources/Private/Styles/TYPO3/structure/_element_recent_edited.less b/typo3/sysext/t3skin/Resources/Private/Styles/TYPO3/structure/_element_recent_edited.less
deleted file mode 100644 (file)
index 1695473..0000000
+++ /dev/null
@@ -1,35 +0,0 @@
-/**
- * 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!
- */
-
-/* - - - - - - - - - - - - - - - - - - - - -
-Document, listing recently edited records if no records were open
-(alt_doc_nodoc.php) - this is effectively the Doc module
-- - - - - - - - - - - - - - - - - - - - - */
-
-table.typo3-recent-edited {
-       width: 100%;
-}
-
-table.typo3-recent-edited img.c-recicon {
-       margin-right: 5px;
-       vertical-align: middle;
-}
-
-body#typo3-alt-doc-nodoc-php p img {
-       margin-left: 5px;
-       vertical-align: middle;
-}
-
-body#typo3-alt-doc-nodoc-php {
-       margin-left: 5px;
-}
\ No newline at end of file
index 5617d79..a4b6ceb 100644 (file)
@@ -11746,36 +11746,6 @@ body#typo3-move-el-php label.t3-label-valign-top {
  * The TYPO3 project - inspiring people to share!
  */
 /* - - - - - - - - - - - - - - - - - - - - -
-Document, listing recently edited records if no records were open
-(alt_doc_nodoc.php) - this is effectively the Doc module
-- - - - - - - - - - - - - - - - - - - - - */
-table.typo3-recent-edited {
-  width: 100%;
-}
-table.typo3-recent-edited img.c-recicon {
-  margin-right: 5px;
-  vertical-align: middle;
-}
-body#typo3-alt-doc-nodoc-php p img {
-  margin-left: 5px;
-  vertical-align: middle;
-}
-body#typo3-alt-doc-nodoc-php {
-  margin-left: 5px;
-}
-/**
- * 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!
- */
-/* - - - - - - - - - - - - - - - - - - - - -
 Workspace
 - - - - - - - - - - - - - - - - - - - - - */
 div.workspace-info {