Commit cbbf6b67 authored by Benni Mack's avatar Benni Mack Committed by Tymoteusz Motylewski
Browse files

[!!!][TASK] Move non-namespaced classes into correct places

There are a few leftover classes inside typo3/ which
haven't been moved or migrated yet into the according
places.

1. typo3/move_el.php. The extension classes
to PagePositionMap are now moved to
EXT:backend/Classes/Tree/View with according
names.

2. typo3/class.browse_links.php - several extensions
to the PageTreeView and the FolderTreeView.

3. typo3/db_new.php - an extension to the PageTreeView
is now located in EXT:backend/Tree/View/NewRecordPageTreeView

The base classes (localPageTree and localFolderTree)
have been moved to
EXT:backend/Classes/Tree/View/ElementBrowser*.

The subclasses for recordlist (regular record picker)
are moved into EXT:recordlist.

The subclasses used in RTEhtmlarea are adopted to
use the new naming scheme.

All calls within the core have been adopted. As
backwards compatibility, the old class names are
added to EXT:compatibility6.

3. The ext_autoload.php inside EXT:core is therefore
not needed anymore, the call inside Bootstrap is
not needed anymore.

Resolves: #64516
Releases: master
Change-Id: I926baace282d6e95d73607f974cd91296d2df890
Reviewed-on: http://review.typo3.org/36276

Reviewed-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Tested-by: Anja Leichsenring's avatarAnja Leichsenring <aleichsenring@ab-softlab.de>
Reviewed-by: Tymoteusz Motylewski's avatarTymoteusz Motylewski <t.motylewski@gmail.com>
Tested-by: Tymoteusz Motylewski's avatarTymoteusz Motylewski <t.motylewski@gmail.com>
parent ab574d02
......@@ -22,36 +22,6 @@
*/
require __DIR__ . '/init.php';
/**
* Extension for the tree class that generates the tree of pages in the page-wizard mode
*
* @author Kasper Skårhøj <kasperYYYY@typo3.com>
*/
class newRecordLocalPageTree extends \TYPO3\CMS\Backend\Tree\View\PageTreeView {
/**
* Inserting uid-information in title-text for an icon
*
* @param string $icon Icon image
* @param array $row Item row
* @return string Wrapping icon image.
*/
public function wrapIcon($icon, $row) {
return $this->addTagAttributes($icon, ' title="id=' . htmlspecialchars($row['uid']) . '"');
}
/**
* Determines whether to expand a branch or not.
* Here the branch is expanded if the current id matches the global id for the listing/new
*
* @param int $id The ID (page id) of the element
* @return bool Returns TRUE if the IDs matches
*/
public function expandNext($id) {
return $id == $GLOBALS['SOBE']->id ? 1 : 0;
}
}
$newRecordController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Controller\NewRecordController::class);
$newRecordController->main();
$newRecordController->printContent();
......@@ -20,128 +20,6 @@
*/
require __DIR__ . '/init.php';
/**
* Local extension of the page tree class
*
* @author Kasper Skårhøj <kasperYYYY@typo3.com>
*/
class moveElementLocalPageTree extends \TYPO3\CMS\Backend\Tree\View\PageTreeView {
/**
* Inserting uid-information in title-text for an icon
*
* @param string $icon Icon image
* @param array $row Item row
* @return string Wrapping icon image.
*/
public function wrapIcon($icon, $row) {
return $this->addTagAttributes($icon, ' title="id=' . htmlspecialchars($row['uid']) . '"');
}
}
/**
* Extension of position map for pages
*
* @author Kasper Skårhøj <kasperYYYY@typo3.com>
*/
class ext_posMap_pages extends \TYPO3\CMS\Backend\Tree\View\PagePositionMap {
/**
* @var string
*/
public $l_insertNewPageHere = 'movePageToHere';
/**
* Page tree implementation class name
*
* @var string
*/
protected $pageTreeClassName = 'moveElementLocalPageTree';
/**
* Creates the onclick event for the insert-icons.
*
* @param int $pid The pid.
* @param int $newPagePID New page id.
* @return string Onclick attribute content
*/
public function onClickEvent($pid, $newPagePID) {
return 'window.location.href=\'tce_db.php?cmd[pages][' . $GLOBALS['SOBE']->moveUid . '][' . $this->moveOrCopy . ']=' . $pid . '&redirect=' . rawurlencode($this->R_URI) . '&prErr=1&uPT=1&vC=' . $GLOBALS['BE_USER']->veriCode() . \TYPO3\CMS\Backend\Utility\BackendUtility::getUrlToken('tceAction') . '\';return false;';
}
/**
* Wrapping page title.
*
* @param string $str Page title.
* @param array $rec Page record (?)
* @return string Wrapped title.
*/
public function linkPageTitle($str, $rec) {
$url = \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('uid' => (int)$rec['uid'], 'moveUid' => $GLOBALS['SOBE']->moveUid));
return '<a href="' . htmlspecialchars($url) . '">' . $str . '</a>';
}
/**
* Wrap $t_code in bold IF the $dat uid matches $id
*
* @param string $t_code Title string
* @param array $dat Information array with record array inside.
* @param int $id The current id.
* @return string The title string.
*/
public function boldTitle($t_code, $dat, $id) {
return parent::boldTitle($t_code, $dat, $GLOBALS['SOBE']->moveUid);
}
}
/**
* Extension of position map for content elements
*
* @author Kasper Skårhøj <kasperYYYY@typo3.com>
*/
class ext_posMap_tt_content extends \TYPO3\CMS\Backend\Tree\View\PagePositionMap {
/**
* @var int
*/
public $dontPrintPageInsertIcons = 1;
/**
* Page tree implementation class name
*
* @var string
*/
protected $pageTreeClassName = 'moveElementLocalPageTree';
/**
* Wrapping page title.
*
* @param string $str Page title.
* @param array $rec Page record (?)
* @return string Wrapped title.
*/
public function linkPageTitle($str, $rec) {
$url = \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('uid' => (int)$rec['uid'], 'moveUid' => $GLOBALS['SOBE']->moveUid));
return '<a href="' . htmlspecialchars($url) . '">' . $str . '</a>';
}
/**
* Wrapping the title of the record.
*
* @param string $str The title value.
* @param array $row The record row.
* @return string Wrapped title string.
*/
public function wrapRecordTitle($str, $row) {
if ($GLOBALS['SOBE']->moveUid == $row['uid']) {
$str = '<strong>' . $str . '</strong>';
}
return parent::wrapRecordTitle($str, $row);
}
}
$moveElementController = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Controller\ContentElement\MoveElementController::class);
$moveElementController->main();
$moveElementController->printContent();
......@@ -144,7 +144,7 @@ class MoveElementController {
$pageinfo = BackendUtility::readPageAccess($this->page_id, $this->perms_clause);
if (is_array($pageinfo) && $GLOBALS['BE_USER']->isInWebMount($pageinfo['pid'], $this->perms_clause)) {
// Initialize the position map:
$posMap = GeneralUtility::makeInstance(\ext_posMap_pages::class);
$posMap = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Tree\View\PageMovingPagePositionMap::class);
$posMap->moveOrCopy = $this->makeCopy ? 'copy' : 'move';
// Print a "go-up" link IF there is a real parent page (and if the user has read-access to that page).
if ($pageinfo['pid']) {
......@@ -173,7 +173,7 @@ class MoveElementController {
$pageinfo = BackendUtility::readPageAccess($this->page_id, $this->perms_clause);
if (is_array($pageinfo) && $GLOBALS['BE_USER']->isInWebMount($pageinfo['pid'], $this->perms_clause)) {
// Initialize the position map:
$posMap = GeneralUtility::makeInstance(\ext_posMap_tt_content::class);
$posMap = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Tree\View\ContentMovingPagePositionMap::class);
$posMap->moveOrCopy = $this->makeCopy ? 'copy' : 'move';
$posMap->cur_sys_language = $this->sys_language;
// Headerline for the parent page: Icon, record title:
......
......@@ -313,7 +313,7 @@ class NewRecordController {
$this->code .= '
<h3>' . htmlspecialchars($GLOBALS['LANG']->getLL('selectPosition')) . ':</h3>
';
$positionMap = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Tree\View\PagePositionMap::class, 'newRecordLocalPageTree');
$positionMap = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Tree\View\PagePositionMap::class, \TYPO3\CMS\Backend\Tree\View\NewRecordPageTreeView::class);
/** @var $positionMap \TYPO3\CMS\Backend\Tree\View\PagePositionMap */
$this->code .= $positionMap->positionTree($this->id, $this->pageinfo, $this->perms_clause, $this->R_URI);
} else {
......
<?php
namespace TYPO3\CMS\Backend\Tree\View;
/*
* 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!
*/
/**
* Position map class for moving content elements,
* previously resided in typo3/move_el.php
*
* @author Kasper Skårhøj <kasperYYYY@typo3.com>
*/
class ContentMovingPagePositionMap extends PagePositionMap {
/**
* @var int
*/
public $dontPrintPageInsertIcons = 1;
/**
* Page tree implementation class name
*
* @var string
*/
protected $pageTreeClassName = MoveElementPageTreeView::class;
/**
* Wrapping page title.
*
* @param string $str Page title.
* @param array $rec Page record (?)
* @return string Wrapped title.
*/
public function linkPageTitle($str, $rec) {
$url = \TYPO3\CMS\Core\Utility\GeneralUtility::linkThisScript(array('uid' => (int)$rec['uid'], 'moveUid' => $GLOBALS['SOBE']->moveUid));
return '<a href="' . htmlspecialchars($url) . '">' . $str . '</a>';
}
/**
* Wrapping the title of the record.
*
* @param string $str The title value.
* @param array $row The record row.
* @return string Wrapped title string.
*/
public function wrapRecordTitle($str, $row) {
if ($GLOBALS['SOBE']->moveUid == $row['uid']) {
$str = '<strong>' . $str . '</strong>';
}
return parent::wrapRecordTitle($str, $row);
}
}
<?php
namespace TYPO3\CMS\Backend\Tree\View;
/*
* 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!
*/
/**
* Base extension class which generates the folder tree.
* Used directly by the RTE.
* also used for the linkpicker on files
*
* Browsable folder tree, used in Element Browser and RTE (for which it will be extended)
* previously located inside typo3/class.browse_links.php
*/
class ElementBrowserFolderTreeView extends FolderTreeView {
/**
* @var int
*/
public $ext_IconMode = 1;
/**
* Initializes the script path
*/
public function __construct() {
$this->determineScriptUrl();
parent::__construct();
}
/**
* Wrapping the title in a link, if applicable.
*
* @param string $title Title, ready for output.
* @param \TYPO3\CMS\Core\Resource\Folder $folderObject The "record
* @return string Wrapping title string.
*/
public function wrapTitle($title, \TYPO3\CMS\Core\Resource\Folder $folderObject) {
if ($this->ext_isLinkable($folderObject)) {
$aOnClick = 'return jumpToUrl(' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($this->getThisScript() . 'act=' . $GLOBALS['SOBE']->browser->act . '&mode=' . $GLOBALS['SOBE']->browser->mode . '&expandFolder=' . rawurlencode($folderObject->getCombinedIdentifier())) . ');';
return '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . $title . '</a>';
} else {
return '<span class="typo3-dimmed">' . $title . '</span>';
}
}
/**
* Returns TRUE if the input "record" contains a folder which can be linked.
*
* @param \TYPO3\CMS\Core\Resource\Folder $folderObject Object with information about the folder element. Contains keys like title, uid, path, _title
* @return bool TRUE is returned if the path is found in the web-part of the server and is NOT a recycler or temp folder
*/
public function ext_isLinkable(\TYPO3\CMS\Core\Resource\Folder $folderObject) {
if (strstr($folderObject->getIdentifier(), '_recycler_') || strstr($folderObject->getIdentifier(), '_temp_')) {
return FALSE;
} else {
return TRUE;
}
}
/**
* Wrap the plus/minus icon in a link
*
* @param string $icon HTML string to wrap, probably an image tag.
* @param string $cmd Command for 'PM' get var
* @param bool $bMark If set, the link will have a anchor point (=$bMark) and a name attribute (=$bMark)
* @return string Link-wrapped input string
* @access private
*/
public function PM_ATagWrap($icon, $cmd, $bMark = '') {
$name = $anchor = '';
if ($bMark) {
$anchor = '#' . $bMark;
$name = ' name="' . $bMark . '"';
}
$aOnClick = 'return jumpToUrl(' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($this->getThisScript() . 'PM=' . $cmd) . ',' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($anchor) . ');';
return '<a href="#"' . htmlspecialchars($name) . ' onclick="' . htmlspecialchars($aOnClick) . '">' . $icon . '</a>';
}
}
<?php
namespace TYPO3\CMS\Backend\Tree\View;
/*
* 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!
*/
/**
* Class which generates the page tree
*
* @author Kasper Skårhøj <kasperYYYY@typo3.com>
* Browsable tree, used in PagePositionMaps (move elements), Element Browser and RTE (for which it will be extended)
* previously located inside typo3/class.browse_links.php
*/
class localPageTree extends \TYPO3\CMS\Backend\Tree\View\BrowseTreeView {
class ElementBrowserPageTreeView extends BrowseTreeView {
/**
* whether the page ID should be shown next to the title, activate through
......@@ -128,160 +144,3 @@ class localPageTree extends \TYPO3\CMS\Backend\Tree\View\BrowseTreeView {
}
}
/**
* For TBE record browser
*
* @author Kasper Skårhøj <kasperYYYY@typo3.com>
*/
class TBE_PageTree extends localPageTree {
/**
* Returns TRUE if a doktype can be linked (which is always the case here).
*
* @param int $doktype Doktype value to test
* @param int $uid uid to test.
* @return bool
*/
public function ext_isLinkable($doktype, $uid) {
return TRUE;
}
/**
* Wrapping the title in a link, if applicable.
*
* @param string $title Title, ready for output.
* @param array $v The record
* @param bool $ext_pArrPages If set, pages clicked will return immediately, otherwise reload page.
* @return string Wrapping title string.
*/
public function wrapTitle($title, $v, $ext_pArrPages) {
if ($ext_pArrPages) {
$ficon = \TYPO3\CMS\Backend\Utility\IconUtility::getIcon('pages', $v);
$onClick = 'return insertElement(\'pages\', \'' . $v['uid'] . '\', \'db\', ' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($v['title']) . ', \'\', \'\', \'' . $ficon . '\',\'\',1);';
} else {
$onClick = 'return jumpToUrl(' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($this->getThisScript() . 'act=' . $GLOBALS['SOBE']->browser->act . '&mode=' . $GLOBALS['SOBE']->browser->mode . '&expandPage=' . $v['uid']) . ');';
}
return '<a href="#" onclick="' . htmlspecialchars($onClick) . '">' . $title . '</a>';
}
}
/**
* Base extension class which generates the folder tree.
* Used directly by the RTE.
* also used for the linkpicker on files
*
* @author Kasper Skårhøj <kasperYYYY@typo3.com>
*/
class localFolderTree extends \TYPO3\CMS\Backend\Tree\View\FolderTreeView {
/**
* @var int
*/
public $ext_IconMode = 1;
/**
* Initializes the script path
*/
public function __construct() {
$this->determineScriptUrl();
parent::__construct();
}
/**
* Wrapping the title in a link, if applicable.
*
* @param string $title Title, ready for output.
* @param \TYPO3\CMS\Core\Resource\Folder $folderObject The "record
* @return string Wrapping title string.
*/
public function wrapTitle($title, \TYPO3\CMS\Core\Resource\Folder $folderObject) {
if ($this->ext_isLinkable($folderObject)) {
$aOnClick = 'return jumpToUrl(' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($this->getThisScript() . 'act=' . $GLOBALS['SOBE']->browser->act . '&mode=' . $GLOBALS['SOBE']->browser->mode . '&expandFolder=' . rawurlencode($folderObject->getCombinedIdentifier())) . ');';
return '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . $title . '</a>';
} else {
return '<span class="typo3-dimmed">' . $title . '</span>';
}
}
/**
* Returns TRUE if the input "record" contains a folder which can be linked.
*
* @param \TYPO3\CMS\Core\Resource\Folder $folderObject Object with information about the folder element. Contains keys like title, uid, path, _title
* @return bool TRUE is returned if the path is found in the web-part of the server and is NOT a recycler or temp folder
*/
public function ext_isLinkable(\TYPO3\CMS\Core\Resource\Folder $folderObject) {
if (strstr($folderObject->getIdentifier(), '_recycler_') || strstr($folderObject->getIdentifier(), '_temp_')) {
return FALSE;
} else {
return TRUE;
}
}
/**
* Wrap the plus/minus icon in a link
*
* @param string $icon HTML string to wrap, probably an image tag.
* @param string $cmd Command for 'PM' get var
* @param bool $bMark If set, the link will have a anchor point (=$bMark) and a name attribute (=$bMark)
* @return string Link-wrapped input string
* @access private
*/
public function PM_ATagWrap($icon, $cmd, $bMark = '') {
$name = $anchor = '';
if ($bMark) {
$anchor = '#' . $bMark;
$name = ' name="' . $bMark . '"';
}
$aOnClick = 'return jumpToUrl(' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($this->getThisScript() . 'PM=' . $cmd) . ',' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($anchor) . ');';
return '<a href="#"' . htmlspecialchars($name) . ' onclick="' . htmlspecialchars($aOnClick) . '">' . $icon . '</a>';
}
}
/**
* For TBE File Browser
*
* @author Kasper Skårhøj <kasperYYYY@typo3.com>
*/
class TBE_FolderTree extends localFolderTree {
/**
* If file-drag mode is set, temp and recycler folders are filtered out.
*
* @var int
*/
public $ext_noTempRecyclerDirs = 0;
/**
* Returns TRUE if the input "record" contains a folder which can be linked.
*
* @param \TYPO3\CMS\Core\Resource\Folder $folderObject object with information about the folder element. Contains keys like title, uid, path, _title
* @return bool TRUE is returned if the path is NOT a recycler or temp folder AND if ->ext_noTempRecyclerDirs is not set.
*/
public function ext_isLinkable($folderObject) {
if ($this->ext_noTempRecyclerDirs && (substr($folderObject->getIdentifier(), -7) == '_temp_/' || substr($folderObject->getIdentifier(), -11) == '_recycler_/')) {
return FALSE;
} else {
return TRUE;
}
}
/**
* Wrapping the title in a link, if applicable.
*
* @param string $title Title, ready for output.
* @param \TYPO3\CMS\Core\Resource\Folder $folderObject The folderObject 'record'
* @return string Wrapping title string.
*/
public function wrapTitle($title, $folderObject) {
if ($this->ext_isLinkable($folderObject)) {
$aOnClick = 'return jumpToUrl(' . \TYPO3\CMS\Core\Utility\GeneralUtility::quoteJSvalue($this->getThisScript() . 'act=' . $GLOBALS['SOBE']->browser->act . '&mode=' . $GLOBALS['SOBE']->browser->mode . '&expandFolder=' . rawurlencode($folderObject->getCombinedIdentifier())) . ');';
return '<a href="#" onclick="' . htmlspecialchars($aOnClick) . '">' . $title . '</a>';
} else {
return '<span class="typo3-dimmed">' . $title . '</span>';
}
}
}
<?php
namespace TYPO3\CMS\Backend\Tree\View;
/*
* 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!
*/
/**
* Local extension of the page tree class used inside MoveElementController / move_el.php
*
*/
class MoveElementPageTreeView extends PageTreeView {
/**
* Inserting uid-information in title-text for an icon
*
* @param string $icon Icon image
* @param array $row Item row
* @return string Wrapping icon image.
*/
public function wrapIcon($icon, $row) {
return $this->addTagAttributes($icon, ' title="id=' . htmlspecialchars($row['uid']) . '"');
}
}
<?php
namespace TYPO3\CMS\Backend\Tree\View;
/*
* 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!
*/
/**
* Extension for the tree class that generates the tree of pages in the page-wizard mode
* see typo3/db_new.php