[TASK] Rename classes with the same name 72/27572/5
authorTymoteusz Motylewski <t.motylewski@gmail.com>
Wed, 12 Feb 2014 11:27:30 +0000 (12:27 +0100)
committerStefan Neufeind <typo3.neufeind@speedpartner.de>
Mon, 17 Feb 2014 12:21:36 +0000 (13:21 +0100)
We have 3 implementations of the \localPageTree
class in the global namespace:
- db_new.php
- move_el.php
- class.browse_links.php

This patch renames classes from db_new and move_el files.
It should not break non core scripts, as both db_new.php
and move_el.php are entry points, so classes defined
there should only be used in the entry point scope.

The class 'localPageTree' from the class.browse_links.php
will keep its name, so it can be added to autoload now.

Resolves: #55876
Releases: 6.2
Change-Id: I2e084349b93af212aec85b368e7e3468a76c7a82
Reviewed-on: https://review.typo3.org/27572
Reviewed-by: Markus Klein
Reviewed-by: Alexander Opitz
Tested-by: Alexander Opitz
Reviewed-by: Stefan Neufeind
Tested-by: Stefan Neufeind
typo3/db_new.php
typo3/move_el.php
typo3/sysext/backend/Classes/Controller/NewRecordController.php
typo3/sysext/backend/Classes/Tree/View/PagePositionMap.php
typo3/sysext/core/ext_autoload.php

index 2c36269..d0c8488 100644 (file)
@@ -40,7 +40,7 @@ require __DIR__ . '/init.php';
  *
  * @author Kasper Skårhøj <kasperYYYY@typo3.com>
  */
-class localPageTree extends \TYPO3\CMS\Backend\Tree\View\PageTreeView {
+class newRecordLocalPageTree extends \TYPO3\CMS\Backend\Tree\View\PageTreeView {
 
        /**
         * Inserting uid-information in title-text for an icon
index c8e3fdf..f0a61f3 100644 (file)
@@ -38,7 +38,7 @@ require __DIR__ . '/init.php';
  *
  * @author Kasper Skårhøj <kasperYYYY@typo3.com>
  */
-class localPageTree extends \TYPO3\CMS\Backend\Tree\View\PageTreeView {
+class moveElementLocalPageTree extends \TYPO3\CMS\Backend\Tree\View\PageTreeView {
 
        /**
         * Inserting uid-information in title-text for an icon
@@ -67,6 +67,13 @@ class ext_posMap_pages extends \TYPO3\CMS\Backend\Tree\View\PagePositionMap {
        public $l_insertNewPageHere = 'movePageToHere';
 
        /**
+        * Page tree implementation class name
+        *
+        * @var string
+        */
+       protected $pageTreeClassName = 'moveElementLocalPageTree';
+
+       /**
         * Creates the onclick event for the insert-icons.
         *
         * @param integer $pid The pid.
@@ -119,6 +126,13 @@ class ext_posMap_tt_content extends \TYPO3\CMS\Backend\Tree\View\PagePositionMap
        public $dontPrintPageInsertIcons = 1;
 
        /**
+        * Page tree implementation class name
+        *
+        * @var string
+        */
+       protected $pageTreeClassName = 'moveElementLocalPageTree';
+
+       /**
         * Wrapping page title.
         *
         * @param string $str Page title.
index e943b49..fd31404 100644 (file)
@@ -330,7 +330,7 @@ class NewRecordController {
                        $this->code .= '
                                <h3>' . htmlspecialchars($GLOBALS['LANG']->getLL('selectPosition')) . ':</h3>
                        ';
-                       $positionMap = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Tree\\View\\PagePositionMap');
+                       $positionMap = GeneralUtility::makeInstance('TYPO3\\CMS\\Backend\\Tree\\View\\PagePositionMap', 'newRecordLocalPageTree');
                        /** @var $positionMap \TYPO3\CMS\Backend\Tree\View\PagePositionMap */
                        $this->code .= $positionMap->positionTree($this->id, $this->pageinfo, $this->perms_clause, $this->R_URI);
                } else {
index 5693397..43f3773 100644 (file)
@@ -114,6 +114,24 @@ class PagePositionMap {
         */
        public $modConfigStr = 'mod.web_list.newPageWiz';
 
+       /**
+        * Page tree implementation class name
+        *
+        * @var string
+        */
+       protected $pageTreeClassName = 'localPageTree';
+
+       /**
+        * Constructor allowing to set pageTreeImplementation
+        *
+        * @param string $pageTreeClassName
+        */
+       public function __construct($pageTreeClassName = NULL) {
+               if ($pageTreeClassName !== NULL) {
+                       $this->pageTreeClassName = $pageTreeClassName;
+               }
+       }
+
        /*************************************
         *
         * Page position map:
@@ -121,8 +139,6 @@ class PagePositionMap {
         **************************************/
        /**
         * Creates a "position tree" based on the page tree.
-        * Notice: A class, "localPageTree" must exist and probably it is an extension class of the
-        * \TYPO3\CMS\Backend\Tree\View\PageTreeView class. See "db_new.php" in the core for an example.
         *
         * @param integer $id Current page id
         * @param array $pageinfo Current page record.
@@ -134,8 +150,8 @@ class PagePositionMap {
        public function positionTree($id, $pageinfo, $perms_clause, $R_URI) {
                $code = '';
                // Make page tree object:
-               /** @var $t3lib_pageTree localPageTree */
-               $t3lib_pageTree = GeneralUtility::makeInstance('localPageTree');
+               /** @var \TYPO3\CMS\Backend\Tree\View\PageTreeView localPageTree */
+               $t3lib_pageTree = GeneralUtility::makeInstance($this->pageTreeClassName);
                $t3lib_pageTree->init(' AND ' . $perms_clause);
                $t3lib_pageTree->addField('pid');
                // Initialize variables:
index dc223a5..cf4b34e 100644 (file)
@@ -4,11 +4,14 @@
 $typo3Classes = array(
        'ext_posmap_pages' => PATH_typo3 . 'move_el.php',
        'ext_posmap_tt_content' => PATH_typo3 . 'move_el.php',
+       'moveelementlocalpagetree' => PATH_typo3 . 'move_el.php',
+       'newrecordlocalpagetree' => PATH_typo3 . 'db_new.php',
        'localfoldertree' => PATH_typo3 . 'class.browse_links.php',
        'rtefoldertree' => PATH_typo3 . 'class.browse_links.php',
        'rtepagetree' => PATH_typo3 . 'class.browse_links.php',
        'tbe_foldertree' => PATH_typo3 . 'class.browse_links.php',
        'tbe_pagetree' => PATH_typo3 . 'class.browse_links.php',
+       'localpagetree' => PATH_typo3 . 'class.browse_links.php',
        'transferdata' => PATH_typo3 . 'show_item.php',
        'Psr\\Log\\LoggerInterface' => PATH_typo3 . 'contrib/Psr/Log/LoggerInterface.php',
        'Psr\\Log\\InvalidArgumentException' => PATH_typo3 . 'contrib/Psr/Log/InvalidArgumentException.php',