diff --git a/typo3/sysext/backend/Classes/Form/FormDataProvider/TcaSelectTreeItems.php b/typo3/sysext/backend/Classes/Form/FormDataProvider/TcaSelectTreeItems.php index 3ec43b6b399b57f9937481c97bf26ce8d4b32265..1da6d7af56d2cd985930b18734991f6fd457b078 100644 --- a/typo3/sysext/backend/Classes/Form/FormDataProvider/TcaSelectTreeItems.php +++ b/typo3/sysext/backend/Classes/Form/FormDataProvider/TcaSelectTreeItems.php @@ -17,7 +17,7 @@ namespace TYPO3\CMS\Backend\Form\FormDataProvider; use TYPO3\CMS\Backend\Form\FormDataProviderInterface; use TYPO3\CMS\Core\Imaging\Icon; use TYPO3\CMS\Core\Imaging\IconFactory; -use TYPO3\CMS\Core\Tree\TableConfiguration\ExtJsArrayTreeRenderer; +use TYPO3\CMS\Core\Tree\TableConfiguration\ArrayTreeRenderer; use TYPO3\CMS\Core\Tree\TableConfiguration\TableConfigurationTree; use TYPO3\CMS\Core\Tree\TableConfiguration\TreeDataProviderFactory; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -174,7 +174,7 @@ class TcaSelectTreeItems extends AbstractItemProvider implements FormDataProvide // tree representing the nested tree, just to collapse all that to a flat array again. Yay ... $treeDataProvider->setItemWhiteList($uidListOfAllDynamicItems); $treeDataProvider->initializeTreeData(); - $treeRenderer = GeneralUtility::makeInstance(ExtJsArrayTreeRenderer::class); + $treeRenderer = GeneralUtility::makeInstance(ArrayTreeRenderer::class); $tree = GeneralUtility::makeInstance(TableConfigurationTree::class); $tree->setDataProvider($treeDataProvider); $tree->setNodeRenderer($treeRenderer); diff --git a/typo3/sysext/backend/Classes/Tree/DraggableAndDropableNodeInterface.php b/typo3/sysext/backend/Classes/Tree/DraggableAndDropableNodeInterface.php deleted file mode 100644 index 163f7eb8e59a167a64efa0a65f5502ac688f7b3e..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Classes/Tree/DraggableAndDropableNodeInterface.php +++ /dev/null @@ -1,54 +0,0 @@ -<?php -namespace TYPO3\CMS\Backend\Tree; - -/* - * 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! - */ - -/** - * Describes necessary methods if the nodes are draggable and dropable - * within the tree. - */ -interface DraggableAndDropableNodeInterface -{ - /** - * Moves given node inside a destination node - * - * @param \TYPO3\CMS\Backend\Tree\TreeNode $node - * @param \TYPO3\CMS\Backend\Tree\TreeNode $destination - */ - public function moveNodeInDestinationNode($node, $destination); - - /** - * Moves given node after a destination node - * - * @param \TYPO3\CMS\Backend\Tree\TreeNode $node - * @param \TYPO3\CMS\Backend\Tree\TreeNode $destination - */ - public function moveNodeAfterDestinationNode($node, $destination); - - /** - * Copies given node inside a destination node - * - * @param \TYPO3\CMS\Backend\Tree\TreeNode $node - * @param \TYPO3\CMS\Backend\Tree\TreeNode $destination - */ - public function copyNodeInDestinationNode($node, $destination); - - /** - * Copies given node after a destination node - * - * @param \TYPO3\CMS\Backend\Tree\TreeNode $node - * @param \TYPO3\CMS\Backend\Tree\TreeNode $destination - */ - public function copyNodeAfterDestinationNode($node, $destination); -} diff --git a/typo3/sysext/backend/Classes/Tree/EditableNodeLabelInterface.php b/typo3/sysext/backend/Classes/Tree/EditableNodeLabelInterface.php deleted file mode 100644 index 32754815addebf8f1a68c6e3981078ac4697ace9..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Classes/Tree/EditableNodeLabelInterface.php +++ /dev/null @@ -1,29 +0,0 @@ -<?php -namespace TYPO3\CMS\Backend\Tree; - -/* - * 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! - */ - -/** - * Describes necessary methods if the node label should be editable - * within the tree. - */ -interface EditableNodeLabelInterface -{ - /** - * Sets the new label - * - * @param string $label - */ - public function setLabel($label); -} diff --git a/typo3/sysext/backend/Classes/Tree/ExtDirectNode.php b/typo3/sysext/backend/Classes/Tree/ExtDirectNode.php deleted file mode 100644 index 6bb8e918e6f75a74b920d9056abcaff7b5437c8e..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Classes/Tree/ExtDirectNode.php +++ /dev/null @@ -1,687 +0,0 @@ -<?php -namespace TYPO3\CMS\Backend\Tree; - -/* - * 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\Imaging\Icon; - -/** - * Node for the usage with ExtDirect and ExtJS - */ -class ExtDirectNode extends \TYPO3\CMS\Backend\Tree\TreeNode -{ - /** - * Node type - * - * @var string - */ - protected $type = ''; - - /** - * Leaf Node Indicator - * - * @var bool - */ - protected $leaf = true; - - /** - * Indicator if the node is expanded - * - * @var bool - */ - protected $expanded = false; - - /** - * Indicator if the node can be expanded - * - * @var bool - */ - protected $expandable = false; - - /** - * Indicator if the node is draggable - * - * @var bool - */ - protected $draggable = true; - - /** - * Indicator if the node is allowed as a drop target - * - * @var bool - */ - protected $isDropTarget = true; - - /** - * Label - * - * @var string - */ - protected $text = ''; - - /** - * Editable Label text - * - * @var string - */ - protected $editableText = ''; - - /** - * Prefix text of the label - * - * @var string - */ - protected $prefix = ''; - - /** - * Suffix text of the label - * - * @var string - */ - protected $suffix = ''; - - /** - * CSS Class - * - * @var string - */ - protected $cls = ''; - - /** - * Quick Tip - * - * @var string - */ - protected $qtip = ''; - - /** - * Sprite Icon HTML - * - * @var string - */ - protected $spriteIconCode = ''; - - /** - * Icon - * - * @var Icon - */ - protected $icon; - - /** - * Text source field (title, nav_title, ...) - * - * @var string - */ - protected $t3TextSourceField = ''; - - /** - * Indicator if the copy mode is activated - * - * @var bool - */ - protected $t3InCopyMode = false; - - /** - * Indicator if the cut mode is activated - * - * @var bool - */ - protected $t3InCutMode = false; - - /** - * Database record (not serialized or merged into the result array!) - * - * @var array - */ - protected $record = []; - - /** - * Context Info - * - * @var array - */ - protected $contextInfo = []; - - /** - * Indicator if the label is editable - * - * @var bool - */ - protected $labelIsEditable = true; - - /** - * Indicator if the node can have children's - * - * @var bool - */ - protected $allowChildren = true; - - /** - * Page URL Alias - * - * @var string - */ - protected $alias = ''; - - /** - * Set's the node type - * - * @param string $type - */ - public function setType($type) - { - $this->type = $type; - } - - /** - * Returns the node type - * - * @return string - */ - public function getType() - { - return $this->type; - } - - /** - * Sets the leaf node indicator - * - * @param bool $isLeaf - */ - public function setLeaf($isLeaf) - { - $this->leaf = $isLeaf == true; - } - - /** - * Returns if the node is a leaf node - * - * @return bool - */ - public function isLeafNode() - { - return $this->leaf; - } - - /** - * Sets the expandable indicator - * - * @param bool $expandable - */ - public function setExpandable($expandable) - { - $this->expandable = $expandable == true; - } - - /** - * Returns the expandable indicator - * - * @return bool - */ - public function isExpandable() - { - return $this->expandable; - } - - /** - * Sets the expanded indicator - * - * @param bool $expanded - */ - public function setExpanded($expanded) - { - $this->expanded = $expanded == true; - } - - /** - * Returns the expanded indicator - * - * @return bool - */ - public function isExpanded() - { - if ($this->isLeafNode()) { - return true; - } - return $this->expanded; - } - - /** - * Sets the draggable indicator - * - * @param bool $draggable - */ - public function setDraggable($draggable) - { - $this->draggable = $draggable == true; - } - - /** - * Returns the draggable indicator - * - * @return bool - */ - public function isDraggable() - { - return $this->draggable; - } - - /** - * Sets the indicator if the node can be a drop target - * - * @param bool $isDropTarget - */ - public function setIsDropTarget($isDropTarget) - { - $this->isDropTarget = $isDropTarget == true; - } - - /** - * Returns the indicator if the node is a drop target - * - * @return bool - */ - public function isDropTarget() - { - return $this->isDropTarget; - } - - /** - * Sets the label of the node with the source field and the prefix - * - * @param string $text - * @param string $textSourceField - * @param string $prefix - * @param string $suffix - */ - public function setText($text, $textSourceField = 'title', $prefix = '', $suffix = '') - { - $this->text = $text; - $this->t3TextSourceField = $textSourceField; - $this->prefix = $prefix; - $this->suffix = $suffix; - } - - /** - * Returns the label - * - * @return string - */ - public function getText() - { - return $this->text; - } - - /** - * Sets the editable text - * - * @param string $editableText - */ - public function setEditableText($editableText) - { - $this->editableText = $editableText; - } - - /** - * Returns the editable text - * - * @return string - */ - public function getEditableText() - { - return $this->editableText; - } - - /** - * Returns the source field of the label - * - * @return string - */ - public function getTextSourceField() - { - return $this->t3TextSourceField; - } - - /** - * Sets the paste copy indicator - * - * @param bool $inCopyMode - */ - public function setInCopyMode($inCopyMode) - { - $this->t3InCopyMode = $inCopyMode == true; - } - - /** - * Returns the copy mode indicator - * - * @return bool - */ - public function isInCopyMode() - { - return $this->t3InCopyMode; - } - - /** - * Sets the paste cut indicator - * - * @param bool $inCutMode - */ - public function setInCutMode($inCutMode) - { - $this->t3InCutMode = $inCutMode == true; - } - - /** - * Returns the cut mode indicator - * - * @return bool - */ - public function isInCutMode() - { - return $this->t3InCutMode; - } - - /** - * Returns the prefix text of the label - * - * @return string - */ - public function getPrefix() - { - return $this->prefix; - } - - /** - * Returns the suffix text of the label - * - * @return string - */ - public function getSuffix() - { - return $this->suffix; - } - - /** - * Sets the css class(es) - * - * @param string $class - */ - public function setCls($class) - { - $this->cls = $class; - } - - /** - * Returns the css class(es) - * - * @return string - */ - public function getCls() - { - return $this->cls; - } - - /** - * Sets the quick tip - * - * @param string $qtip - */ - public function setQTip($qtip) - { - $this->qtip = $qtip; - } - - /** - * Returns the quick tip - * - * @return string - */ - public function getQTip() - { - return $this->qtip; - } - - /** - * Sets the sprite icon code - * - * @param string $spriteIcon - */ - public function setSpriteIconCode($spriteIcon) - { - $this->spriteIconCode = $spriteIcon; - } - - /** - * Returns the sprite icon code - * - * @return string - */ - public function getSpriteIconCode() - { - return $this->spriteIconCode; - } - - /** - * Sets the node icon - * - * @param Icon $icon - */ - public function setIcon(Icon $icon) - { - $this->icon = $icon; - } - - /** - * Returns the icon - * - * @return Icon - */ - public function getIcon() - { - return $this->icon; - } - - /** - * Sets the indicator if the label is editable - * - * @param bool $labelIsEditable - */ - public function setLabelIsEditable($labelIsEditable) - { - $this->labelIsEditable = $labelIsEditable == true; - } - - /** - * Returns the editable label indicator - * - * @return bool - */ - public function isLabelEditable() - { - return $this->labelIsEditable; - } - - /** - * Sets the database record array - * - * @param array $record - */ - public function setRecord($record) - { - $this->record = (array)$record; - } - - /** - * Returns the database record array - * - * @return array - */ - public function getRecord() - { - return $this->record; - } - - /** - * Sets the context info - * - * @param array $contextInfo - */ - public function setContextInfo($contextInfo) - { - $this->contextInfo = (array)$contextInfo; - } - - /** - * Returns the context info - * - * @return array - */ - public function getContextInfo() - { - return (array)$this->contextInfo; - } - - /** - * Sets the child nodes collection - * - * @param \TYPO3\CMS\Backend\Tree\TreeNodeCollection $childNodes - */ - public function setChildNodes(\TYPO3\CMS\Backend\Tree\TreeNodeCollection $childNodes) - { - parent::setChildNodes($childNodes); - if ($childNodes->count()) { - $this->setLeaf(false); - } - } - - /** - * Sets the indicator if the node can have child nodes - * - * @param bool $allowChildren - */ - public function setAllowChildren($allowChildren) - { - $this->allowChildren = $allowChildren == true; - } - - /** - * Checks if the node can have child nodes - * - * @return bool - */ - public function canHaveChildren() - { - return $this->allowChildren; - } - - /** - * Returns alias - * - * @return string - */ - public function getAlias() - { - return $this->alias; - } - - /** - * Sets alias - * - * @param string $alias - */ - public function setAlias(string $alias) - { - $this->alias = $alias; - } - - /** - * Returns the node in an array representation that can be used for serialization - * - * @param bool $addChildNodes - * @return array - */ - public function toArray($addChildNodes = true) - { - $arrayRepresentation = [ - 'serializeClassName' => static::class, - 'id' => $this->getId(), - 'type' => $this->getType(), - 'editableText' => $this->getEditableText(), - 'text' => $this->getPrefix() . $this->getText() . $this->getSuffix(), - 'alias' => $this->getAlias(), - 'cls' => $this->getCls(), - 'prefix' => $this->getPrefix(), - 'suffix' => $this->getSuffix(), - 'qtip' => $this->getQTip(), - 'expanded' => $this->isExpanded(), - 'expandable' => $this->isExpandable(), - 'draggable' => $this->isDraggable(), - 'isTarget' => $this->isDropTarget(), - 'spriteIconCode' => $this->getSpriteIconCode(), - 'icon' => $this->getIcon()->getIdentifier(), - 'overlayIcon' => $this->getIcon()->getOverlayIcon() ? $this->getIcon()->getOverlayIcon()->getIdentifier() : '', - 't3TextSourceField' => $this->getTextSourceField(), - 't3InCopyMode' => $this->isInCopyMode(), - 't3InCutMode' => $this->isInCutMode(), - 't3ContextInfo' => $this->getContextInfo(), - 'editable' => $this->isLabelEditable(), - 'allowChildren' => $this->canHaveChildren() - ]; - // only set the leaf attribute if the node has children's, - // otherwise you cannot add child's to real leaf nodes - if (!$this->isLeafNode()) { - $arrayRepresentation['leaf'] = false; - } - // Some strange environment thingy prevents - // the direct copy of an array into an index of the same array - $copy = $arrayRepresentation; - $arrayRepresentation['nodeData'] = $copy; - if ($this->hasChildNodes()) { - $arrayRepresentation['children'] = $this->childNodes->toArray(); - } - return $arrayRepresentation; - } - - /** - * Sets data of the node by a given data array - * - * @param array $data - */ - public function dataFromArray($data) - { - parent::dataFromArray($data); - $this->setType($data['type']); - $this->setText($data['label'], $data['t3TextSourceField'], $data['prefix'], $data['suffix']); - $this->setEditableText($data['editableText']); - $this->setCls($data['cls']); - $this->setQTip($data['qtip']); - $this->setExpanded($data['expanded']); - $this->setExpandable($data['expandable']); - $this->setDraggable($data['draggable']); - $this->setIsDropTarget($data['isTarget']); - $this->setSpriteIconCode($data['spriteIconCode']); - $this->setInCopyMode($data['t3InCopyMode']); - $this->setInCutMode($data['t3InCutMode']); - $this->setContextInfo($data['t3ContextInfo']); - $this->setLabelIsEditable($data['editable']); - $this->setAllowChildren($data['allowChildren']); - // only set the leaf attribute if it's applied - // otherwise you cannot insert nodes into this one - if (isset($data['leaf'])) { - $this->setLeaf(false); - } - } -} diff --git a/typo3/sysext/backend/Classes/Tree/Pagetree/CollectionProcessorInterface.php b/typo3/sysext/backend/Classes/Tree/Pagetree/CollectionProcessorInterface.php deleted file mode 100644 index 0a55bbc58af6a1a49e5d581acadd9ee85787c238..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Classes/Tree/Pagetree/CollectionProcessorInterface.php +++ /dev/null @@ -1,49 +0,0 @@ -<?php -namespace TYPO3\CMS\Backend\Tree\Pagetree; - -/* - * 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! - */ - -/** - * Interface for classes which perform pre or post processing - */ -interface CollectionProcessorInterface -{ - /** - * Post process the subelement collection of a specific node - * - * @param \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode $node - * @param int $mountPoint - * @param int $level - * @param \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNodeCollection $nodeCollection - */ - public function postProcessGetNodes($node, $mountPoint, $level, $nodeCollection); - - /** - * Post process the subelement collection of a specific node-filter combination - * - * @param \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode $node - * @param string $searchFilter - * @param int $mountPoint - * @param \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNodeCollection $nodeCollection - */ - public function postProcessFilteredNodes($node, $searchFilter, $mountPoint, $nodeCollection); - - /** - * Post process the collection of tree mounts - * - * @param string $searchFilter - * @param \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNodeCollection $nodeCollection - */ - public function postProcessGetTreeMounts($searchFilter, $nodeCollection); -} diff --git a/typo3/sysext/backend/Classes/Tree/Pagetree/Commands.php b/typo3/sysext/backend/Classes/Tree/Pagetree/Commands.php deleted file mode 100644 index f0e97dea64f871aa9ac24fad69ae36398f27cd6e..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Classes/Tree/Pagetree/Commands.php +++ /dev/null @@ -1,373 +0,0 @@ -<?php -namespace TYPO3\CMS\Backend\Tree\Pagetree; - -/* - * 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\Backend\Utility\BackendUtility; -use TYPO3\CMS\Core\Database\ConnectionPool; -use TYPO3\CMS\Core\Imaging\Icon; -use TYPO3\CMS\Core\Imaging\IconFactory; -use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Core\Utility\MathUtility; -use TYPO3\CMS\Core\Versioning\VersionState; - -/** - * Page Tree and Context Menu Commands - */ -class Commands -{ - /** - * @var bool|null - */ - protected static $useNavTitle = null; - - /** - * @var bool|null - */ - protected static $addIdAsPrefix = null; - - /** - * @var bool|null - */ - protected static $addDomainName = null; - - /** - * @var array|null - */ - protected static $backgroundColors = null; - - /** - * @var int|null - */ - protected static $titleLength = null; - - /** - * Visibly the page - * - * @param \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode $node - */ - public static function visiblyNode(\TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode $node) - { - $data['pages'][$node->getWorkspaceId()]['hidden'] = 0; - self::processTceCmdAndDataMap([], $data); - } - - /** - * Hide the page - * - * @param \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode $node - */ - public static function disableNode(\TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode $node) - { - $data['pages'][$node->getWorkspaceId()]['hidden'] = 1; - self::processTceCmdAndDataMap([], $data); - } - - /** - * Delete the page - * - * @param \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode $node - */ - public static function deleteNode(\TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode $node) - { - $cmd['pages'][$node->getId()]['delete'] = 1; - self::processTceCmdAndDataMap($cmd); - } - - /** - * Restore the page - * - * @param \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode $node - * @param int $targetId - */ - public static function restoreNode(\TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode $node, $targetId) - { - $cmd['pages'][$node->getId()]['undelete'] = 1; - self::processTceCmdAndDataMap($cmd); - if ($node->getId() !== $targetId) { - self::moveNode($node, $targetId); - } - } - - /** - * Updates the node label - * - * @param \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode $node - * @param string $updatedLabel - */ - public static function updateNodeLabel(\TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode $node, $updatedLabel) - { - if ($GLOBALS['BE_USER']->checkLanguageAccess(0)) { - $data['pages'][$node->getWorkspaceId()][$node->getTextSourceField()] = $updatedLabel; - self::processTceCmdAndDataMap([], $data); - } else { - throw new \RuntimeException(implode(LF, ['Editing title of page id \'' . $node->getWorkspaceId() . '\' failed. Editing default language is not allowed.']), 1365513336); - } - } - - /** - * Copies a page and returns the id of the new page - * - * Node: Use a negative target id to specify a sibling target else the parent is used - * - * @param \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode $sourceNode - * @param int $targetId - * @return int - */ - public static function copyNode(\TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode $sourceNode, $targetId) - { - $cmd['pages'][$sourceNode->getId()]['copy'] = $targetId; - $returnValue = self::processTceCmdAndDataMap($cmd); - return $returnValue['pages'][$sourceNode->getId()]; - } - - /** - * Moves a page - * - * Node: Use a negative target id to specify a sibling target else the parent is used - * - * @param \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode $sourceNode - * @param int $targetId - */ - public static function moveNode(\TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode $sourceNode, $targetId) - { - $cmd['pages'][$sourceNode->getId()]['move'] = $targetId; - self::processTceCmdAndDataMap($cmd); - } - - /** - * Creates a page of the given doktype and returns the id of the created page - * - * @param \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode $parentNode - * @param int $targetId - * @param int $pageType - * @return int - */ - public static function createNode(\TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode $parentNode, $targetId, $pageType) - { - $placeholder = 'NEW12345'; - $pid = (int)$parentNode->getWorkspaceId(); - $targetId = (int)$targetId; - - // Use page TsConfig as default page initialization - $pageTs = BackendUtility::getPagesTSconfig($pid); - if (array_key_exists('TCAdefaults.', $pageTs) && array_key_exists('pages.', $pageTs['TCAdefaults.'])) { - $data['pages'][$placeholder] = $pageTs['TCAdefaults.']['pages.']; - } else { - $data['pages'][$placeholder] = []; - } - - $data['pages'][$placeholder]['pid'] = $pid; - $data['pages'][$placeholder]['doktype'] = $pageType; - $data['pages'][$placeholder]['title'] = htmlspecialchars($GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:tree.defaultPageTitle')); - $newPageId = self::processTceCmdAndDataMap([], $data); - $node = self::getNode($newPageId[$placeholder]); - if ($pid !== $targetId) { - self::moveNode($node, $targetId); - } - - return $newPageId[$placeholder]; - } - - /** - * Process DataHandler commands and data maps - * - * Command Map: - * Used for moving, recover, remove and some more operations. - * - * Data Map: - * Used for creating and updating records, - * - * This API contains all necessary access checks. - * - * @param array $cmd - * @param array $data - * @return array - * @throws \RuntimeException if an error happened while the TCE processing - */ - protected static function processTceCmdAndDataMap(array $cmd, array $data = []) - { - /** @var $tce \TYPO3\CMS\Core\DataHandling\DataHandler */ - $tce = GeneralUtility::makeInstance(\TYPO3\CMS\Core\DataHandling\DataHandler::class); - $tce->start($data, $cmd); - $tce->copyTree = MathUtility::forceIntegerInRange($GLOBALS['BE_USER']->uc['copyLevels'], 0, 100); - if (!empty($cmd)) { - $tce->process_cmdmap(); - $returnValues = $tce->copyMappingArray_merged; - } elseif (!empty($data)) { - $tce->process_datamap(); - $returnValues = $tce->substNEWwithIDs; - } else { - $returnValues = []; - } - // check errors - if (!empty($tce->errorLog)) { - throw new \RuntimeException(implode(LF, $tce->errorLog), 1333754629); - } - return $returnValues; - } - - /** - * Returns a node from the given node id - * - * @param int $nodeId - * @param bool $unsetMovePointers - * @return \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode - */ - public static function getNode($nodeId, $unsetMovePointers = true) - { - $record = BackendUtility::getRecordWSOL('pages', $nodeId, '*', '', true, $unsetMovePointers); - return self::getNewNode($record); - } - - /** - * Returns the mount point path for a temporary mount or the given id - * - * @param int $uid - * @return string - */ - public static function getMountPointPath($uid = -1) - { - if ($uid === -1) { - $uid = (int)$GLOBALS['BE_USER']->uc['pageTree_temporaryMountPoint']; - } - if ($uid <= 0) { - return ''; - } - if (self::$useNavTitle === null) { - self::$useNavTitle = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showNavTitle'); - } - $rootline = array_reverse(BackendUtility::BEgetRootLine($uid)); - array_shift($rootline); - $path = []; - foreach ($rootline as $rootlineElement) { - $record = BackendUtility::getRecordWSOL('pages', $rootlineElement['uid'], 'title, nav_title', '', true, true); - $text = $record['title']; - if (self::$useNavTitle && trim($record['nav_title']) !== '') { - $text = $record['nav_title']; - } - $path[] = htmlspecialchars($text); - } - return '/' . implode('/', $path); - } - - /** - * Returns the first configured domain name for a page - * - * @param int $uid - * @return string - */ - public static function getDomainName($uid) - { - $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class) - ->getQueryBuilderForTable('sys_domain'); - $domain = $queryBuilder - ->select('domainName') - ->from('sys_domain') - ->where($queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter($uid, \PDO::PARAM_INT))) - ->setMaxResults(1) - ->orderBy('sorting') - ->execute() - ->fetch(); - return is_array($domain) ? htmlspecialchars($domain['domainName']) : ''; - } - - /** - * Creates a node with the given record information - * - * @param array $record - * @param int $mountPoint - * @return \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode - */ - public static function getNewNode($record, $mountPoint = 0) - { - $iconFactory = GeneralUtility::makeInstance(IconFactory::class); - if (self::$titleLength === null) { - self::$useNavTitle = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showNavTitle'); - self::$addIdAsPrefix = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showPageIdWithTitle'); - self::$addDomainName = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showDomainNameWithTitle'); - self::$backgroundColors = $GLOBALS['BE_USER']->getTSConfigProp('options.pageTree.backgroundColor'); - self::$titleLength = (int)$GLOBALS['BE_USER']->uc['titleLen']; - } - /** @var $subNode \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode */ - $subNode = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode::class); - $subNode->setRecord($record); - $subNode->setCls($record['_CSSCLASS']); - $subNode->setType('pages'); - $subNode->setId($record['uid']); - $subNode->setStopPageTree($record['php_tree_stop']); - $subNode->setMountPoint($mountPoint); - $subNode->setWorkspaceId($record['_ORIG_uid'] ?: $record['uid']); - $subNode->setBackgroundColor(self::$backgroundColors[$record['uid']]); - $subNode->setAlias($record['alias'] ?? ''); - $field = 'title'; - $text = $record['title']; - if (self::$useNavTitle && trim($record['nav_title']) !== '') { - $field = 'nav_title'; - $text = $record['nav_title']; - } - if (trim($text) === '') { - $visibleText = '[' . htmlspecialchars($GLOBALS['LANG']->sL('LLL:EXT:lang/Resources/Private/Language/locallang_core.xlf:labels.no_title')) . ']'; - } else { - $visibleText = $text; - } - $visibleText = GeneralUtility::fixed_lgd_cs($visibleText, self::$titleLength); - $suffix = ''; - if (self::$addDomainName) { - $domain = self::getDomainName($record['uid']); - $suffix = $domain !== '' ? ' [' . $domain . ']' : ''; - } - $qtip = str_replace(' - ', PHP_EOL, htmlspecialchars(BackendUtility::titleAttribForPages($record, '', false))); - $prefix = ''; - $lockInfo = BackendUtility::isRecordLocked('pages', $record['uid']); - if (is_array($lockInfo)) { - $qtip .= PHP_EOL . htmlspecialchars($lockInfo['msg']); - $prefix .= '<span class="typo3-pagetree-status">' . $iconFactory->getIcon('warning-in-use', Icon::SIZE_SMALL)->render() . '</span>'; - } - // Call stats information hook - $stat = ''; - - $_params = ['pages', $record['uid']]; - $fakeThis = null; - foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['GLOBAL']['recStatInfoHooks'] ?? [] as $_funcRef) { - $stat .= GeneralUtility::callUserFunction($_funcRef, $_params, $fakeThis); - } - - $prefix .= htmlspecialchars(self::$addIdAsPrefix ? '[' . $record['uid'] . '] ' : ''); - $subNode->setEditableText($text); - $subNode->setText(htmlspecialchars($visibleText), $field, $prefix, htmlspecialchars($suffix) . $stat); - $subNode->setQTip($qtip); - if ((int)$record['uid'] !== 0) { - $icon = $iconFactory->getIconForRecord('pages', $record, Icon::SIZE_SMALL); - } else { - $icon = $iconFactory->getIcon('apps-pagetree-root', Icon::SIZE_SMALL); - } - $subNode->setIcon($icon); - $subNode->setSpriteIconCode($icon->render()); - if ( - !$subNode->canCreateNewPages() - || VersionState::cast($record['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER) - ) { - $subNode->setIsDropTarget(false); - } - if ( - !$subNode->canBeEdited() - || !$subNode->canBeRemoved() - || VersionState::cast($record['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER) - ) { - $subNode->setDraggable(false); - } - return $subNode; - } -} diff --git a/typo3/sysext/backend/Classes/Tree/Pagetree/DataProvider.php b/typo3/sysext/backend/Classes/Tree/Pagetree/DataProvider.php deleted file mode 100644 index 3a3094fe7795789811e13a81b3b8f1d4a55db437..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Classes/Tree/Pagetree/DataProvider.php +++ /dev/null @@ -1,564 +0,0 @@ -<?php -namespace TYPO3\CMS\Backend\Tree\Pagetree; - -/* - * 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\Backend\Utility\BackendUtility; -use TYPO3\CMS\Core\Database\ConnectionPool; -use TYPO3\CMS\Core\Database\Query\QueryBuilder; -use TYPO3\CMS\Core\Database\Query\QueryHelper; -use TYPO3\CMS\Core\Database\Query\Restriction\BackendWorkspaceRestriction; -use TYPO3\CMS\Core\Database\Query\Restriction\DeletedRestriction; -use TYPO3\CMS\Core\Utility\GeneralUtility; - -/** - * Page tree data provider. - */ -class DataProvider extends \TYPO3\CMS\Backend\Tree\AbstractTreeDataProvider -{ - /** - * Node limit that should be loaded for this request per mount - * - * @var int - */ - protected $nodeLimit = 0; - - /** - * Current amount of nodes - * - * @var int - */ - protected $nodeCounter = 0; - - /** - * TRUE to show the path of each mountpoint in the tree - * - * @var bool - */ - protected $showRootlineAboveMounts = false; - - /** - * Hidden Records - * - * @var array<string> - */ - protected $hiddenRecords = []; - - /** - * Process collection hook objects - * - * @var array<\TYPO3\CMS\Backend\Tree\Pagetree\CollectionProcessorInterface> - */ - protected $processCollectionHookObjects = []; - - /** - * Constructor - * - * @param int $nodeLimit (optional) - */ - public function __construct($nodeLimit = null) - { - $nodeLimit = $nodeLimit ?? $GLOBALS['TYPO3_CONF_VARS']['BE']['pageTree']['preloadLimit']; - $this->nodeLimit = abs((int)$nodeLimit); - - $this->showRootlineAboveMounts = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showPathAboveMounts'); - - $this->hiddenRecords = GeneralUtility::trimExplode(',', $GLOBALS['BE_USER']->getTSConfigVal('options.hideRecords.pages')); - foreach ($GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/tree/pagetree/class.t3lib_tree_pagetree_dataprovider.php']['postProcessCollections'] ?? [] as $className) { - /** @var $hookObject \TYPO3\CMS\Backend\Tree\Pagetree\CollectionProcessorInterface */ - $hookObject = GeneralUtility::makeInstance($className); - if ($hookObject instanceof \TYPO3\CMS\Backend\Tree\Pagetree\CollectionProcessorInterface) { - $this->processCollectionHookObjects[] = $hookObject; - } - } - } - - /** - * Returns the root node. - * - * @return \TYPO3\CMS\Backend\Tree\TreeNode the root node - */ - public function getRoot() - { - /** @var $node \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode */ - $node = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode::class); - $node->setId('root'); - $node->setExpanded(true); - return $node; - } - - /** - * Fetches the sub-nodes of the given node - * - * @param \TYPO3\CMS\Backend\Tree\TreeNode $node - * @param int $mountPoint - * @param int $level internally used variable as a recursion limiter - * @return \TYPO3\CMS\Backend\Tree\TreeNodeCollection - */ - public function getNodes(\TYPO3\CMS\Backend\Tree\TreeNode $node, $mountPoint = 0, $level = 0) - { - /** @var $nodeCollection \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNodeCollection */ - $nodeCollection = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNodeCollection::class); - if ($level >= 99 || ($node->getStopPageTree() && $node->getId() !== $mountPoint)) { - return $nodeCollection; - } - $isVirtualRootNode = false; - $subpages = $this->getSubpages($node->getId()); - // check if fetching subpages the "root"-page - // and in case of a virtual root return the mountpoints as virtual "subpages" - if ((int)$node->getId() === 0) { - // check no temporary mountpoint is used - if (!(int)$GLOBALS['BE_USER']->uc['pageTree_temporaryMountPoint']) { - $mountPoints = array_map('intval', $GLOBALS['BE_USER']->returnWebmounts()); - $mountPoints = array_unique($mountPoints); - if (!in_array(0, $mountPoints, true)) { - // using a virtual root node - // so then return the mount points here as "subpages" of the first node - $isVirtualRootNode = true; - $subpages = []; - foreach ($mountPoints as $webMountPoint) { - $subpage = BackendUtility::getRecordWSOL('pages', $webMountPoint, '*', '', true, true); - $subpage['isMountPoint'] = true; - $subpages[] = $subpage; - } - } - } - } - if (is_array($subpages) && !empty($subpages)) { - $lastRootline = []; - foreach ($subpages as $subpage) { - if (in_array($subpage['t3ver_oid'] ?: $subpage['uid'], $this->hiddenRecords)) { - continue; - } - // must be calculated before getRecordWSOL(), - // because the information is lost otherwise - $isMountPoint = $subpage['isMountPoint'] === true; - if ($isVirtualRootNode) { - $mountPoint = (int)$subpage['t3ver_oid'] ?: $subpage['uid']; - } - $subNode = Commands::getNewNode($subpage, $mountPoint); - $subNode->setIsMountPoint($isMountPoint); - if ($isMountPoint && $this->showRootlineAboveMounts) { - if ($subpage['pid'] > 0) { - $rootline = Commands::getMountPointPath($subpage['pid']); - } else { - $rootline = Commands::getMountPointPath($subpage['uid']); - } - if ($lastRootline !== $rootline) { - $subNode->setReadableRootline($rootline); - } - $lastRootline = $rootline; - } - if ($this->nodeCounter < $this->nodeLimit) { - $childNodes = $this->getNodes($subNode, $mountPoint, $level + 1); - $subNode->setChildNodes($childNodes); - $this->nodeCounter += $childNodes->count(); - } else { - $subNode->setLeaf(!$this->hasNodeSubPages((int)$subNode->getId())); - } - if (!$GLOBALS['BE_USER']->isAdmin() && (int)$subpage['editlock'] === 1) { - $subNode->setLabelIsEditable(false); - } - $nodeCollection->append($subNode); - } - } - foreach ($this->processCollectionHookObjects as $hookObject) { - /** @var $hookObject \TYPO3\CMS\Backend\Tree\Pagetree\CollectionProcessorInterface */ - $hookObject->postProcessGetNodes($node, $mountPoint, $level, $nodeCollection); - } - return $nodeCollection; - } - - /** - * Returns a node collection of filtered nodes - * - * @param \TYPO3\CMS\Backend\Tree\TreeNode $node - * @param string $searchFilter - * @param int $mountPoint - * @return \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNodeCollection the filtered nodes - */ - public function getFilteredNodes(\TYPO3\CMS\Backend\Tree\TreeNode $node, $searchFilter, $mountPoint = 0) - { - /** @var $nodeCollection \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNodeCollection */ - $nodeCollection = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNodeCollection::class); - $records = $this->getPagesByQuery($searchFilter); - if (!is_array($records) || empty($records)) { - return $nodeCollection; - } - if (count($records) > 500) { - return $nodeCollection; - } - // check no temporary mountpoint is used - $mountPoints = (int)$GLOBALS['BE_USER']->uc['pageTree_temporaryMountPoint']; - if (!$mountPoints) { - $mountPoints = array_map('intval', $GLOBALS['BE_USER']->returnWebmounts()); - $mountPoints = array_unique($mountPoints); - } else { - $mountPoints = [$mountPoints]; - } - $isNumericSearchFilter = is_numeric($searchFilter) && $searchFilter > 0; - $searchFilterQuoted = preg_quote($searchFilter, '/'); - $nodeId = (int)$node->getId(); - $processedRecordIds = []; - foreach ($records as $record) { - $uid = (int)$record['t3ver_oid'] ?: $record['uid']; - if (in_array($uid, $this->hiddenRecords) || in_array($uid, $processedRecordIds, true) - || ( - (int)$record['pid'] === -1 && ( - (int)$record['t3ver_wsid'] === 0 - || (int)$record['t3ver_wsid'] !== (int)$GLOBALS['BE_USER']->workspace - ) - ) - ) { - continue; - } - $processedRecordIds[] = $uid; - - $rootline = BackendUtility::BEgetRootLine( - $uid, - '', - $GLOBALS['BE_USER']->workspace != 0, - [ - 'hidden', - 'starttime', - 'endtime', - ] - ); - $rootline = array_reverse($rootline); - if (!in_array(0, $mountPoints, true)) { - $isInsideMountPoints = false; - foreach ($rootline as $rootlineElement) { - if (in_array((int)$rootlineElement['uid'], $mountPoints, true)) { - $isInsideMountPoints = true; - break; - } - } - if (!$isInsideMountPoints) { - continue; - } - } - $reference = $nodeCollection; - $inFilteredRootline = false; - $amountOfRootlineElements = count($rootline); - // render the root line elements up to the search result - for ($i = 0; $i < $amountOfRootlineElements; ++$i) { - $rootlineElement = $rootline[$i]; - $rootlineElement['uid'] = (int)$rootlineElement['uid']; - $isInWebMount = (int)$GLOBALS['BE_USER']->isInWebMount($rootlineElement['uid']); - if (!$isInWebMount - || ($rootlineElement['uid'] === (int)$mountPoints[0] - && $rootlineElement['uid'] !== $isInWebMount) - ) { - continue; - } - if ((int)$rootlineElement['pid'] === $nodeId - || $rootlineElement['uid'] === $nodeId - || ($rootlineElement['uid'] === $isInWebMount - && in_array($rootlineElement['uid'], $mountPoints, true)) - ) { - $inFilteredRootline = true; - } - if (!$inFilteredRootline || $rootlineElement['uid'] === $mountPoint) { - continue; - } - $ident = (int)$rootlineElement['sorting'] . (int)$rootlineElement['uid']; - if ($reference && $reference->offsetExists($ident)) { - /** @var $refNode \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode */ - $refNode = $reference->offsetGet($ident); - $refNode->setExpanded(true); - $refNode->setLeaf(false); - $reference = $refNode->getChildNodes(); - if ($reference == null) { - $reference = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNodeCollection::class); - $refNode->setChildNodes($reference); - } - } else { - $refNode = Commands::getNewNode($rootlineElement, $mountPoint); - $replacement = '<span class="typo3-pagetree-filteringTree-highlight">$1</span>'; - if ($isNumericSearchFilter && (int)$rootlineElement['uid'] === (int)$searchFilter) { - $text = str_replace('$1', $refNode->getText(), $replacement); - } else { - $text = preg_replace('/(' . $searchFilterQuoted . ')/iu', $replacement, $refNode->getText()); - } - $refNode->setText($text, $refNode->getTextSourceField(), $refNode->getPrefix(), $refNode->getSuffix()); - /** @var $childCollection \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNodeCollection */ - $childCollection = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNodeCollection::class); - if ($i + 1 >= $amountOfRootlineElements) { - $childNodes = $this->getNodes($refNode, $mountPoint); - foreach ($childNodes as $childNode) { - /** @var $childNode \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode */ - $childRecord = $childNode->getRecord(); - $childIdent = (int)$childRecord['sorting'] . (int)$childRecord['uid']; - $childCollection->offsetSet($childIdent, $childNode); - } - $refNode->setChildNodes($childNodes); - } - $refNode->setChildNodes($childCollection); - $reference->offsetSet($ident, $refNode); - $reference->ksort(); - $reference = $childCollection; - } - } - } - foreach ($this->processCollectionHookObjects as $hookObject) { - /** @var $hookObject \TYPO3\CMS\Backend\Tree\Pagetree\CollectionProcessorInterface */ - $hookObject->postProcessFilteredNodes($node, $searchFilter, $mountPoint, $nodeCollection); - } - return $nodeCollection; - } - - /** - * Returns the page tree mounts for the current user - * - * Note: If you add the search filter parameter, the nodes will be filtered by this string. - * - * @param string $searchFilter - * @return \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNodeCollection - */ - public function getTreeMounts($searchFilter = '') - { - /** @var $nodeCollection \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNodeCollection */ - $nodeCollection = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNodeCollection::class); - $isTemporaryMountPoint = false; - $rootNodeIsVirtual = false; - $mountPoints = (int)$GLOBALS['BE_USER']->uc['pageTree_temporaryMountPoint']; - if (!$mountPoints) { - $mountPoints = array_map('intval', $GLOBALS['BE_USER']->returnWebmounts()); - $mountPoints = array_unique($mountPoints); - if (!in_array(0, $mountPoints, true)) { - $rootNodeIsVirtual = true; - // use a virtual root - // the real mountpoints will be fetched in getNodes() then - // since those will be the "subpages" of the virtual root - $mountPoints = [0]; - } - } else { - $isTemporaryMountPoint = true; - $mountPoints = [$mountPoints]; - } - if (empty($mountPoints)) { - return $nodeCollection; - } - - foreach ($mountPoints as $mountPoint) { - if ($mountPoint === 0) { - $record = [ - 'uid' => 0, - 'title' => $GLOBALS['TYPO3_CONF_VARS']['SYS']['sitename'] ?: 'TYPO3' - ]; - $subNode = Commands::getNewNode($record); - $subNode->setLabelIsEditable(false); - if ($rootNodeIsVirtual) { - $subNode->setType('virtual_root'); - $subNode->setIsDropTarget(false); - } else { - $subNode->setType('pages_root'); - $subNode->setIsDropTarget(true); - } - } else { - if (in_array($mountPoint, $this->hiddenRecords)) { - continue; - } - $record = BackendUtility::getRecordWSOL('pages', $mountPoint); - if (!$record) { - continue; - } - $subNode = Commands::getNewNode($record, $mountPoint); - if ($this->showRootlineAboveMounts && !$isTemporaryMountPoint) { - $rootline = Commands::getMountPointPath($record['uid']); - $subNode->setReadableRootline($rootline); - } - } - if (count($mountPoints) <= 1) { - $subNode->setExpanded(true); - $subNode->setCls('typo3-pagetree-node-notExpandable'); - } - $subNode->setIsMountPoint(true); - $subNode->setDraggable(false); - if ($searchFilter === '') { - $childNodes = $this->getNodes($subNode, $mountPoint); - } else { - $childNodes = $this->getFilteredNodes($subNode, $searchFilter, $mountPoint); - $subNode->setExpanded(true); - } - $subNode->setChildNodes($childNodes); - $nodeCollection->append($subNode); - } - foreach ($this->processCollectionHookObjects as $hookObject) { - /** @var $hookObject \TYPO3\CMS\Backend\Tree\Pagetree\CollectionProcessorInterface */ - $hookObject->postProcessGetTreeMounts($searchFilter, $nodeCollection); - } - return $nodeCollection; - } - - /** - * Sets the Doctrine where clause for fetching pages - * - * @param QueryBuilder $queryBuilder - * @param string $searchFilter - * @return QueryBuilder - */ - protected function setWhereClause(QueryBuilder $queryBuilder, $searchFilter = ''): QueryBuilder - { - $expressionBuilder = $queryBuilder->expr(); - $queryBuilder->where( - QueryHelper::stripLogicalOperatorPrefix($GLOBALS['BE_USER']->getPagePermsClause(1)), - // Only show records in default language - $expressionBuilder->eq('sys_language_uid', $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT)) - ); - - if ($searchFilter !== '') { - $searchParts = $expressionBuilder->orX(); - if (is_numeric($searchFilter) && $searchFilter > 0) { - $searchParts->add( - $expressionBuilder->eq('uid', $queryBuilder->createNamedParameter($searchFilter, \PDO::PARAM_INT)) - ); - } - $searchFilter = '%' . $queryBuilder->escapeLikeWildcards($searchFilter) . '%'; - $useNavTitle = $GLOBALS['BE_USER']->getTSConfigVal('options.pageTree.showNavTitle'); - - if ($useNavTitle) { - $searchWhereAlias = $expressionBuilder->orX( - $expressionBuilder->like( - 'nav_title', - $queryBuilder->createNamedParameter($searchFilter, \PDO::PARAM_STR) - ), - $expressionBuilder->andX( - $expressionBuilder->eq( - 'nav_title', - $queryBuilder->createNamedParameter('', \PDO::PARAM_STR) - ), - $expressionBuilder->like( - 'title', - $queryBuilder->createNamedParameter($searchFilter, \PDO::PARAM_STR) - ) - ) - ); - $searchParts->add($searchWhereAlias); - } else { - $searchParts->add( - $expressionBuilder->like( - 'title', - $queryBuilder->createNamedParameter($searchFilter, \PDO::PARAM_STR) - ) - ); - } - - // Also search for the alias - $searchParts->add( - $expressionBuilder->like( - 'alias', - $queryBuilder->createNamedParameter($searchFilter, \PDO::PARAM_STR) - ) - ); - $queryBuilder->andWhere($searchParts); - } - return $queryBuilder; - } - - /** - * Returns all sub-pages of a given ID - * - * @param int $id - * @return array - */ - protected function getSubpages(int $id): array - { - $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages'); - $queryBuilder->getRestrictions() - ->removeAll() - ->add(GeneralUtility::makeInstance(DeletedRestriction::class)) - ->add(GeneralUtility::makeInstance(BackendWorkspaceRestriction::class)); - $result = []; - $queryBuilder->select('*') - ->from('pages') - ->where( - QueryHelper::stripLogicalOperatorPrefix($GLOBALS['BE_USER']->getPagePermsClause(1)), - // Only show records in default language - $queryBuilder->expr()->eq('sys_language_uid', $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT)) - ) - ->orderBy('sorting'); - if ((int)$id >= 0) { - $queryBuilder->andWhere( - $queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter($id, \PDO::PARAM_INT)) - ); - } - $queryResult = $queryBuilder->execute(); - while ($row = $queryResult->fetch()) { - BackendUtility::workspaceOL('pages', $row, -99, true); - if ($row) { - $result[] = $row; - } - } - return $result; - } - - /** - * Returns all pages with a query. - * - * @param string $searchFilter - * @return array - */ - protected function getPagesByQuery(string $searchFilter = ''): array - { - $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages'); - $queryBuilder->getRestrictions() - ->removeAll() - ->add(GeneralUtility::makeInstance(DeletedRestriction::class)) - ->add(GeneralUtility::makeInstance(BackendWorkspaceRestriction::class)); - $result = []; - $queryBuilder = $this->setWhereClause($queryBuilder, $searchFilter); - $queryResult = $queryBuilder->select('*') - ->from('pages') - ->orderBy('sorting') - ->execute(); - while ($row = $queryResult->fetch()) { - BackendUtility::workspaceOL('pages', $row, -99, true); - if ($row) { - $result[] = $row; - } - } - return $result; - } - - /** - * Returns true if the node has children. - * - * @param int $id - * @return bool - */ - protected function hasNodeSubPages(int $id): bool - { - $queryBuilder = GeneralUtility::makeInstance(ConnectionPool::class)->getQueryBuilderForTable('pages'); - $queryBuilder->getRestrictions() - ->removeAll() - ->add(GeneralUtility::makeInstance(DeletedRestriction::class)) - ->add(GeneralUtility::makeInstance(BackendWorkspaceRestriction::class)); - $queryBuilder->count('uid') - ->from('pages') - ->where( - QueryHelper::stripLogicalOperatorPrefix($GLOBALS['BE_USER']->getPagePermsClause(1)), - // Only show records in default language - $queryBuilder->expr()->eq('sys_language_uid', $queryBuilder->createNamedParameter(0, \PDO::PARAM_INT)) - ); - if ((int)$id >= 0) { - $queryBuilder->andWhere( - $queryBuilder->expr()->eq('pid', $queryBuilder->createNamedParameter($id, \PDO::PARAM_INT)) - ); - } - $count = $queryBuilder->execute() - ->fetchColumn(0); - return (bool)$count; - } -} diff --git a/typo3/sysext/backend/Classes/Tree/Pagetree/ExtdirectTreeDataProvider.php b/typo3/sysext/backend/Classes/Tree/Pagetree/ExtdirectTreeDataProvider.php deleted file mode 100644 index 6455f2ec567c80c87358f9b8228584f2c4f1a37f..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Classes/Tree/Pagetree/ExtdirectTreeDataProvider.php +++ /dev/null @@ -1,110 +0,0 @@ -<?php -namespace TYPO3\CMS\Backend\Tree\Pagetree; - -/* - * 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\Imaging\IconFactory; -use TYPO3\CMS\Core\Utility\GeneralUtility; - -/** - * Data Provider of the Page Tree - */ -class ExtdirectTreeDataProvider extends \TYPO3\CMS\Backend\Tree\AbstractTree -{ - /** - * Data Provider - * - * @var \TYPO3\CMS\Backend\Tree\Pagetree\DataProvider - */ - protected $dataProvider = null; - - /** - * @var IconFactory - */ - protected $iconFactory; - - /** - * Constructor - */ - public function __construct() - { - $this->iconFactory = GeneralUtility::makeInstance(IconFactory::class); - } - - /** - * Sets the data provider - */ - protected function initDataProvider() - { - /** @var $dataProvider \TYPO3\CMS\Backend\Tree\Pagetree\DataProvider */ - $dataProvider = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Tree\Pagetree\DataProvider::class); - $this->setDataProvider($dataProvider); - } - - /** - * Returns the root node of the tree - * - * @return array - */ - public function getRoot() - { - $this->initDataProvider(); - $node = $this->dataProvider->getRoot(); - return $node->toArray(); - } - - /** - * Fetches the next tree level - * - * @param int $nodeId - * @param \stdClass $nodeData - * @return array - */ - public function getNextTreeLevel($nodeId, $nodeData) - { - $this->initDataProvider(); - /** @var $node \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode */ - $node = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode::class, (array)$nodeData); - if ($nodeId === 'root') { - $nodeCollection = $this->dataProvider->getTreeMounts(); - } else { - $nodeCollection = $this->dataProvider->getNodes($node, $node->getMountPoint()); - } - return $nodeCollection->toArray(); - } - - /** - * Returns a tree that only contains elements that match the given search string - * - * @param int $nodeId - * @param \stdClass $nodeData - * @param string $searchFilter - * @return array - */ - public function getFilteredTree($nodeId, $nodeData, $searchFilter) - { - if (strval($searchFilter) === '') { - return []; - } - /** @var $node \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode */ - $node = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode::class, (array)$nodeData); - $this->initDataProvider(); - if ($nodeId === 'root') { - $nodeCollection = $this->dataProvider->getTreeMounts($searchFilter); - } else { - $nodeCollection = $this->dataProvider->getFilteredNodes($node, $searchFilter, $node->getMountPoint()); - } - return $nodeCollection->toArray(); - } -} diff --git a/typo3/sysext/backend/Classes/Tree/Pagetree/PagetreeNode.php b/typo3/sysext/backend/Classes/Tree/Pagetree/PagetreeNode.php deleted file mode 100644 index 71abfbe45886378674f497b79938aea5f3a71373..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Classes/Tree/Pagetree/PagetreeNode.php +++ /dev/null @@ -1,446 +0,0 @@ -<?php -namespace TYPO3\CMS\Backend\Tree\Pagetree; - -/* - * 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\Versioning\VersionState; - - /** - * Node designated for the page tree - */ -class PagetreeNode extends \TYPO3\CMS\Backend\Tree\ExtDirectNode -{ - /** - * Cached access rights to save some performance - * - * @var array - */ - protected $cachedAccessRights = []; - - /** - * Workspace Overlay Id - * - * @var int - */ - protected $workspaceId = 0; - - /** - * Mount Point Id - * - * @var int - */ - protected $mountPoint = 0; - - /** - * Readable Rootline - * - * @var string - */ - protected $readableRootline = ''; - - /** - * Indicator if the node is a mount point - * - * @var bool - */ - protected $isMountPoint = false; - - /** - * Indicator if the page tree should stop here - * - * @var bool - */ - protected $stopPageTree = false; - - /** - * Background color for the node - * - * @var string - */ - protected $backgroundColor = ''; - - /** - * Sets the background color - * - * @param string $backgroundColor - */ - public function setBackgroundColor($backgroundColor) - { - $this->backgroundColor = $backgroundColor; - } - - /** - * Returns the background color - * - * @return string - */ - public function getBackgroundColor() - { - return $this->backgroundColor; - } - - /** - * Set's the original id of the element - * - * @param int $workspaceId - */ - public function setWorkspaceId($workspaceId) - { - $this->workspaceId = (int)$workspaceId; - } - - /** - * Returns the original id of the element - * - * @return int - */ - public function getWorkspaceId() - { - return $this->workspaceId; - } - - /** - * Sets if the pagetree should stop here - * - * @param bool $stopPageTree - */ - public function setStopPageTree($stopPageTree) - { - $this->stopPageTree = (bool)$stopPageTree; - } - - /** - * Returns if the pagetree should stop here - * - * @return int - */ - public function getStopPageTree() - { - return $this->stopPageTree; - } - - /** - * Sets the mount point id - * - * @param int $mountPoint - */ - public function setMountPoint($mountPoint) - { - $this->mountPoint = (int)$mountPoint; - } - - /** - * Returns the mount point id - * - * @return int - */ - public function getMountPoint() - { - return $this->mountPoint; - } - - /** - * Sets the indicator if the node is a mount point - * - * @param bool $isMountPoint - */ - public function setIsMountPoint($isMountPoint) - { - $this->isMountPoint = $isMountPoint == true; - } - - /** - * Returns TRUE if the node is a mount point - * - * @return bool - */ - public function isMountPoint() - { - return $this->isMountPoint; - } - - /** - * Sets the readable rootline - * - * @param string $rootline - */ - public function setReadableRootline($rootline) - { - $this->readableRootline = $rootline; - } - - /** - * Returns the readable rootline - * - * @return string - */ - public function getReadableRootline() - { - return $this->readableRootline; - } - - /** - * Checks if the user may create pages below the given page - * - * @return bool - */ - protected function canCreate() - { - if (!isset($this->cachedAccessRights['create'])) { - $this->cachedAccessRights['create'] = $GLOBALS['BE_USER']->doesUserHaveAccess($this->record, 8); - } - return $this->cachedAccessRights['create']; - } - - /** - * Checks if the user has editing rights - * - * @return bool - */ - protected function canEdit() - { - if (!isset($this->cachedAccessRights['edit'])) { - $this->cachedAccessRights['edit'] = - $GLOBALS['BE_USER']->isAdmin() - || ( - (int)$this->record['editlock'] === 0 - && $GLOBALS['BE_USER']->doesUserHaveAccess($this->record, 2) - ); - } - return $this->cachedAccessRights['edit']; - } - - /** - * Checks if the user has the right to delete the page - * - * @return bool - */ - protected function canRemove() - { - if (!isset($this->cachedAccessRights['remove'])) { - $this->cachedAccessRights['remove'] = - $GLOBALS['BE_USER']->isAdmin() - || ( - (int)$this->record['editlock'] === 0 - && $GLOBALS['BE_USER']->doesUserHaveAccess($this->record, 4) - ); - if (!$this->isLeafNode() && !$GLOBALS['BE_USER']->uc['recursiveDelete']) { - $this->cachedAccessRights['remove'] = false; - } - } - return $this->cachedAccessRights['remove']; - } - - /** - * Checks if the page can be disabled - * - * @return bool - */ - public function canBeDisabledAndEnabled() - { - return $this->canEdit() && $GLOBALS['BE_USER']->checkLanguageAccess(0); - } - - /** - * Checks if the page is allowed to can be cut - * - * @return bool - */ - public function canBeCut() - { - return - $this->canEdit() - && !VersionState::cast($this->record['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER) - && $GLOBALS['BE_USER']->checkLanguageAccess(0) - ; - } - - /** - * Checks if the page is allowed to be edited - * - * @return bool - */ - public function canBeEdited() - { - return $this->canEdit() && $GLOBALS['BE_USER']->checkLanguageAccess(0); - } - - /** - * Checks if the page is allowed to be copied - * - * @return bool - */ - public function canBeCopied() - { - return - $GLOBALS['BE_USER']->doesUserHaveAccess($this->record, 1) - && !VersionState::cast($this->record['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER) - && $GLOBALS['BE_USER']->checkLanguageAccess(0) - ; - } - - /** - * Checks if there can be new pages created - * - * @return bool - */ - public function canCreateNewPages() - { - return $this->canCreate() && $GLOBALS['BE_USER']->checkLanguageAccess(0); - } - - /** - * Checks if the page is allowed to be removed - * - * @return bool - */ - public function canBeRemoved() - { - return - $this->canRemove() - && !VersionState::cast($this->record['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER) - && $GLOBALS['BE_USER']->checkLanguageAccess(0) - ; - } - - /** - * Checks if something can be pasted into the node - * - * @return bool - */ - public function canBePastedInto() - { - return - $this->canCreate() - && !VersionState::cast($this->record['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER) - && $GLOBALS['BE_USER']->checkLanguageAccess(0) - ; - } - - /** - * Checks if something can be pasted after the node - * - * @return bool - */ - public function canBePastedAfter() - { - return - $this->canCreate() - && !VersionState::cast($this->record['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER) - && $GLOBALS['BE_USER']->checkLanguageAccess(0) - ; - } - - /** - * Checks if the page is allowed to show history - * - * @return bool - */ - public function canShowHistory() - { - return $GLOBALS['BE_USER']->checkLanguageAccess(0); - } - - /** - * Checks if the page is allowed to be viewed - * - * @return bool - */ - public function canBeViewed() - { - return !$this->isDeleted(); - } - - /** - * Checks if the page is allowed to show info - * - * @return bool - */ - public function canShowInfo() - { - return true; - } - - /** - * Checks if the page is allowed to be a temporary mount point - * - * @return bool - */ - public function canBeTemporaryMountPoint() - { - return true; - } - - /** - * Determines whether this node is deleted. - * - * @return bool - */ - public function isDeleted() - { - return - !empty($this->record['deleted']) - || VersionState::cast($this->record['t3ver_state'])->equals(VersionState::DELETE_PLACEHOLDER) - ; - } - - /** - * Returns the calculated id representation of this node - * - * @param string $prefix Defaults to 'p' - * @return string - */ - public function calculateNodeId($prefix = 'p') - { - return $prefix . dechex($this->getId()) . ($this->getMountPoint() ? '-' . dechex($this->getMountPoint()) : ''); - } - - /** - * Returns the node in an array representation that can be used for serialization - * - * @param bool $addChildNodes - * @return array - */ - public function toArray($addChildNodes = true) - { - $arrayRepresentation = parent::toArray(); - $arrayRepresentation['id'] = $this->calculateNodeId(); - $arrayRepresentation['realId'] = $this->getId(); - $arrayRepresentation['nodeData']['id'] = $this->getId(); - $arrayRepresentation['readableRootline'] = $this->getReadableRootline(); - $arrayRepresentation['nodeData']['readableRootline'] = $this->getReadableRootline(); - $arrayRepresentation['nodeData']['mountPoint'] = $this->getMountPoint(); - $arrayRepresentation['nodeData']['workspaceId'] = $this->getWorkspaceId(); - $arrayRepresentation['nodeData']['isMountPoint'] = $this->isMountPoint(); - $arrayRepresentation['nodeData']['backgroundColor'] = htmlspecialchars($this->getBackgroundColor()); - $arrayRepresentation['nodeData']['stopPageTree'] = $this->getStopPageTree(); - $arrayRepresentation['nodeData']['serializeClassName'] = static::class; - return $arrayRepresentation; - } - - /** - * Sets data of the node by a given data array - * - * @param array $data - */ - public function dataFromArray($data) - { - parent::dataFromArray($data); - $this->setWorkspaceId($data['workspaceId']); - $this->setMountPoint($data['mountPoint']); - $this->setReadableRootline($data['readableRootline']); - $this->setIsMountPoint($data['isMountPoint']); - $this->setBackgroundColor($data['backgroundColor']); - } -} diff --git a/typo3/sysext/backend/Classes/Tree/Pagetree/PagetreeNodeCollection.php b/typo3/sysext/backend/Classes/Tree/Pagetree/PagetreeNodeCollection.php deleted file mode 100644 index 8a5197c258a60b7336461e2a15137ca0430627f3..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Classes/Tree/Pagetree/PagetreeNodeCollection.php +++ /dev/null @@ -1,33 +0,0 @@ -<?php -namespace TYPO3\CMS\Backend\Tree\Pagetree; - -/* - * 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! - */ - -/** - * Tree Node Collection - */ -class PagetreeNodeCollection extends \TYPO3\CMS\Backend\Tree\TreeNodeCollection -{ - /** - * Returns the collection in an array representation for e.g. serialization - * - * @return array - */ - public function toArray() - { - $arrayRepresentation = parent::toArray(); - unset($arrayRepresentation['serializeClassName']); - return $arrayRepresentation; - } -} diff --git a/typo3/sysext/backend/Classes/Tree/View/AbstractTreeView.php b/typo3/sysext/backend/Classes/Tree/View/AbstractTreeView.php index 2b2b4ff30ca450f122a6c08377d415342e1f139a..51b6c4e060da5b446cfa6a7b65286c7fe43bcbc0 100644 --- a/typo3/sysext/backend/Classes/Tree/View/AbstractTreeView.php +++ b/typo3/sysext/backend/Classes/Tree/View/AbstractTreeView.php @@ -15,7 +15,6 @@ namespace TYPO3\CMS\Backend\Tree\View; */ use TYPO3\CMS\Backend\Routing\UriBuilder; -use TYPO3\CMS\Backend\Tree\Pagetree\Commands; use TYPO3\CMS\Backend\Utility\BackendUtility; use TYPO3\CMS\Core\Authentication\BackendUserAuthentication; use TYPO3\CMS\Core\Database\ConnectionPool; @@ -397,7 +396,7 @@ abstract class AbstractTreeView if ($this->ext_showPathAboveMounts) { $mountPointPid = $rootRec['pid']; if ($lastMountPointPid !== $mountPointPid) { - $title = Commands::getMountPointPath($mountPointPid); + $title = $this->getMountPointPath((int)$mountPointPid); $this->tree[] = ['isMountPointPath' => true, 'title' => $title]; } $lastMountPointPid = $mountPointPid; @@ -1030,6 +1029,31 @@ abstract class AbstractTreeView $this->dataLookup = &$treeLookupArr; } + /** + * Returns the mount point path for a temporary mount or the given id + * + * @param int $uid + * @return string + */ + protected function getMountPointPath(int $uid): string + { + if ($uid <= 0) { + return ''; + } + $rootline = array_reverse(BackendUtility::BEgetRootLine($uid)); + array_shift($rootline); + $path = []; + foreach ($rootline as $rootlineElement) { + $record = BackendUtility::getRecordWSOL('pages', $rootlineElement['uid'], 'title, nav_title', '', true, true); + $text = $record['title']; + if ((bool)$this->getBackendUser()->getTSConfigVal('options.pageTree.showNavTitle') && trim($record['nav_title'] ?? '') !== '') { + $text = $record['nav_title']; + } + $path[] = htmlspecialchars($text); + } + return '/' . implode('/', $path); + } + /** * @return LanguageService */ diff --git a/typo3/sysext/backend/Tests/Unit/Tree/Pagetree/DataProviderTest.php b/typo3/sysext/backend/Tests/Unit/Tree/Pagetree/DataProviderTest.php deleted file mode 100644 index bda36513b42d1336e2b26d438c7ec7b68feadf71..0000000000000000000000000000000000000000 --- a/typo3/sysext/backend/Tests/Unit/Tree/Pagetree/DataProviderTest.php +++ /dev/null @@ -1,54 +0,0 @@ -<?php -namespace TYPO3\CMS\Backend\Tests\Unit\Tree\Pagetree; - -/* - * 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! - */ - -/** - * Test case - * @TODO: Refactor the subject class and make it better testable, especially getNodes() - */ -class DataProviderTest extends \TYPO3\TestingFramework\Core\Unit\UnitTestCase -{ - /** - * @var \TYPO3\CMS\Backend\Tree\Pagetree\DataProvider|\PHPUnit_Framework_MockObject_MockObject - */ - protected $subject = null; - - protected function setUp() - { - $GLOBALS['TYPO3_CONF_VARS']['BE']['pageTree']['preloadLimit'] = 0; - $GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/tree/pagetree/class.t3lib_tree_pagetree_dataprovider.php']['postProcessCollections'] = []; - /** @var $backendUserMock \TYPO3\CMS\Core\Authentication\BackendUserAuthentication|\PHPUnit_Framework_MockObject_MockObject */ - $backendUserMock = $this->createMock(\TYPO3\CMS\Core\Authentication\BackendUserAuthentication::class); - $GLOBALS['BE_USER'] = $backendUserMock; - - $this->subject = new \TYPO3\CMS\Backend\Tree\Pagetree\DataProvider(); - } - - /** - * @test - */ - public function getRootNodeReturnsNodeWithRootId() - { - $this->assertSame('root', $this->subject->getRoot()->getId()); - } - - /** - * @test - */ - public function getRootNodeReturnsExpandedNode() - { - $this->assertTrue($this->subject->getRoot()->isExpanded()); - } -} diff --git a/typo3/sysext/backend/Classes/Tree/Renderer/ExtJsJsonTreeRenderer.php b/typo3/sysext/core/Classes/Tree/TableConfiguration/ArrayTreeRenderer.php similarity index 91% rename from typo3/sysext/backend/Classes/Tree/Renderer/ExtJsJsonTreeRenderer.php rename to typo3/sysext/core/Classes/Tree/TableConfiguration/ArrayTreeRenderer.php index 7ec8defd9e4c909b87e0d96004c64dbfe122d2ed..bf35e3f94dfc805301714538794c6d73c43788ec 100644 --- a/typo3/sysext/backend/Classes/Tree/Renderer/ExtJsJsonTreeRenderer.php +++ b/typo3/sysext/core/Classes/Tree/TableConfiguration/ArrayTreeRenderer.php @@ -1,5 +1,5 @@ <?php -namespace TYPO3\CMS\Backend\Tree\Renderer; +namespace TYPO3\CMS\Core\Tree\TableConfiguration; /* * This file is part of the TYPO3 CMS project. @@ -13,13 +13,13 @@ namespace TYPO3\CMS\Backend\Tree\Renderer; * * The TYPO3 project - inspiring people to share! */ + use TYPO3\CMS\Backend\Tree\TreeNodeCollection; -use TYPO3\CMS\Core\Tree\TableConfiguration\DatabaseTreeNode; /** - * Renderer for unordered lists + * Renders a tca tree array for ExtJS */ -class ExtJsJsonTreeRenderer extends \TYPO3\CMS\Backend\Tree\Renderer\AbstractTreeRenderer +class ArrayTreeRenderer extends \TYPO3\CMS\Backend\Tree\Renderer\AbstractTreeRenderer { /** * recursion level @@ -92,13 +92,12 @@ class ExtJsJsonTreeRenderer extends \TYPO3\CMS\Backend\Tree\Renderer\AbstractTre * * @param \TYPO3\CMS\Backend\Tree\AbstractTree $tree * @param bool $recursive - * @return string + * @return array */ public function renderTree(\TYPO3\CMS\Backend\Tree\AbstractTree $tree, $recursive = true) { $this->recursionLevel = 0; - $children = $this->renderNode($tree->getRoot(), $recursive); - return json_encode($children); + return $this->renderNode($tree->getRoot(), $recursive); } /** diff --git a/typo3/sysext/core/Classes/Tree/TableConfiguration/ExtJsArrayTreeRenderer.php b/typo3/sysext/core/Classes/Tree/TableConfiguration/ExtJsArrayTreeRenderer.php deleted file mode 100644 index e7eaa351cb5a4796eb23d3bcae969c045974fa96..0000000000000000000000000000000000000000 --- a/typo3/sysext/core/Classes/Tree/TableConfiguration/ExtJsArrayTreeRenderer.php +++ /dev/null @@ -1,34 +0,0 @@ -<?php -namespace TYPO3\CMS\Core\Tree\TableConfiguration; - -/* - * 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! - */ - -/** - * Renders a tca tree array for ExtJS - */ -class ExtJsArrayTreeRenderer extends \TYPO3\CMS\Backend\Tree\Renderer\ExtJsJsonTreeRenderer -{ - /** - * Renders a node collection recursive or just a single instance - * - * @param \TYPO3\CMS\Backend\Tree\AbstractTree $tree - * @param bool $recursive - * @return array - */ - public function renderTree(\TYPO3\CMS\Backend\Tree\AbstractTree $tree, $recursive = true) - { - $this->recursionLevel = 0; - return $this->renderNode($tree->getRoot(), $recursive); - } -} diff --git a/typo3/sysext/core/Configuration/DefaultConfiguration.php b/typo3/sysext/core/Configuration/DefaultConfiguration.php index 919a20d5ee68b5cc2053243e406a0e59de3f5529..8a5cc4279d03ec2db01c87cf297b77928afcaf45 100644 --- a/typo3/sysext/core/Configuration/DefaultConfiguration.php +++ b/typo3/sysext/core/Configuration/DefaultConfiguration.php @@ -853,9 +853,6 @@ return [ 'installToolPassword' => '', 'checkStoredRecords' => true, 'checkStoredRecordsLoose' => true, - 'pageTree' => [ - 'preloadLimit' => 99999999 - ], 'defaultUserTSconfig' => 'options.enableBookmarks=1 options.file_list.enableDisplayBigControlPanel=selectable options.file_list.enableDisplayThumbnails=selectable diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-82426-ExtJSAndExtDirectRemoval.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-82426-ExtJSAndExtDirectRemoval.rst index e448597c205b654000f3ae540100f36ef296577f..dd469ac771da247af4b88a215fa4d145bcebcfd8 100644 --- a/typo3/sysext/core/Documentation/Changelog/master/Breaking-82426-ExtJSAndExtDirectRemoval.rst +++ b/typo3/sysext/core/Documentation/Changelog/master/Breaking-82426-ExtJSAndExtDirectRemoval.rst @@ -17,9 +17,17 @@ ExtDirect classes were removed without substitution. Removed classes: ---------------- +* :php:`TYPO3\CMS\Backend\Tree\ExtDirectNode` +* :php:`TYPO3\CMS\Backend\Tree\Pagetree\Commands` +* :php:`TYPO3\CMS\Backend\Tree\Pagetree\DataProvider` * :php:`TYPO3\CMS\Backend\Tree\Pagetree\ExtdirectTreeCommands` +* :php:`TYPO3\CMS\Backend\Tree\Pagetree\ExtdirectTreeDataProvider` +* :php:`TYPO3\CMS\Backend\Tree\Renderer\ExtJsJsonTreeRenderer` +* :php:`TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode` +* :php:`TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNodeCollection` * :php:`TYPO3\CMS\Core\ExtDirect\ExtDirectApi` * :php:`TYPO3\CMS\Core\ExtDirect\ExtDirectRouter` +* :php:`TYPO3\CMS\Workspaces\Hooks\PagetreeCollectionsProcessor` Removed methods: @@ -35,6 +43,13 @@ Removed methods: * :php:`TYPO3\CMS\Core\Page\PageRenderer->enableExtJsDebug()` +Removed interfaces: +------------------- + +* :php:`TYPO3\CMS\Backend\Tree\Pagetree\CollectionProcessorInterface` +* :php:`TYPO3\CMS\Backend\Tree\EditableNodeLabelInterface` +* :php:`TYPO3\CMS\Backend\Tree\DraggableAndDropableNodeInterface` + Impact ====== diff --git a/typo3/sysext/core/Migrations/Code/ClassAliasMap.php b/typo3/sysext/core/Migrations/Code/ClassAliasMap.php index cf0a15d26722c7d5242111e4e2daa18bafb0e54c..92bbf1041fd81988a75f194b8de24330c3d8f8cb 100644 --- a/typo3/sysext/core/Migrations/Code/ClassAliasMap.php +++ b/typo3/sysext/core/Migrations/Code/ClassAliasMap.php @@ -3,5 +3,6 @@ return [ 'TYPO3\\CMS\\Lang\\LanguageService' => \TYPO3\CMS\Core\Localization\LanguageService::class, 'TYPO3\\CMS\\ContextHelp\\Controller\\ContextHelpAjaxController' => \TYPO3\CMS\Backend\Controller\ContextHelpAjaxController::class, 'TYPO3\\CMS\\Sv\\AbstractAuthenticationService' => \TYPO3\CMS\Core\Authentication\AbstractAuthenticationService::class, - 'TYPO3\\CMS\\Sv\\AuthenticationService' => \TYPO3\CMS\Core\Authentication\AuthenticationService::class + 'TYPO3\\CMS\\Sv\\AuthenticationService' => \TYPO3\CMS\Core\Authentication\AuthenticationService::class, + 'TYPO3\\CMS\\Core\\Tree\\TableConfiguration\\ExtJsArrayTreeRenderer' => \TYPO3\CMS\Core\Tree\TableConfiguration\ArrayTreeRenderer::class ]; diff --git a/typo3/sysext/install/Configuration/ExtensionScanner/Php/ClassNameMatcher.php b/typo3/sysext/install/Configuration/ExtensionScanner/Php/ClassNameMatcher.php index ed00e46c5384bff75935c6df3df2656c34fd39e7..06c4d741f6d3fa23319327263c1b872d21e124a8 100644 --- a/typo3/sysext/install/Configuration/ExtensionScanner/Php/ClassNameMatcher.php +++ b/typo3/sysext/install/Configuration/ExtensionScanner/Php/ClassNameMatcher.php @@ -462,6 +462,46 @@ return [ 'Breaking-82426-ExtJSAndExtDirectRemoval.rst', ], ], + 'TYPO3\CMS\Backend\Tree\ExtDirectNode' => [ + 'restFiles' => [ + 'Breaking-82426-ExtJSAndExtDirectRemoval.rst', + ], + ], + 'TYPO3\CMS\Backend\Tree\Pagetree\Commands' => [ + 'restFiles' => [ + 'Breaking-82426-ExtJSAndExtDirectRemoval.rst', + ], + ], + 'TYPO3\CMS\Backend\Tree\Pagetree\DataProvider' => [ + 'restFiles' => [ + 'Breaking-82426-ExtJSAndExtDirectRemoval.rst', + ], + ], + 'TYPO3\CMS\Backend\Tree\Pagetree\ExtdirectTreeDataProvider' => [ + 'restFiles' => [ + 'Breaking-82426-ExtJSAndExtDirectRemoval.rst', + ], + ], + 'TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode' => [ + 'restFiles' => [ + 'Breaking-82426-ExtJSAndExtDirectRemoval.rst', + ], + ], + 'TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNodeCollection' => [ + 'restFiles' => [ + 'Breaking-82426-ExtJSAndExtDirectRemoval.rst', + ], + ], + 'TYPO3\CMS\Backend\Tree\Renderer\ExtJsJsonTreeRenderer' => [ + 'restFiles' => [ + 'Breaking-82426-ExtJSAndExtDirectRemoval.rst', + ], + ], + 'TYPO3\CMS\Workspaces\Hooks\PagetreeCollectionsProcessor' => [ + 'restFiles' => [ + 'Breaking-82426-ExtJSAndExtDirectRemoval.rst', + ], + ], // Removed interfaces 'TYPO3\CMS\Backend\Form\DatabaseFileIconsHookInterface' => [ @@ -469,4 +509,19 @@ return [ 'Breaking-80700-DeprecatedFunctionalityRemoved.rst', ], ], + 'TYPO3\CMS\Backend\Tree\Pagetree\CollectionProcessorInterface' => [ + 'restFiles' => [ + 'Breaking-82426-ExtJSAndExtDirectRemoval.rst', + ], + ], + 'TYPO3\CMS\Backend\Tree\EditableNodeLabelInterface' => [ + 'restFiles' => [ + 'Breaking-82426-ExtJSAndExtDirectRemoval.rst', + ], + ], + 'TYPO3\CMS\Backend\Tree\DraggableAndDropableNodeInterface' => [ + 'restFiles' => [ + 'Breaking-82426-ExtJSAndExtDirectRemoval.rst', + ], + ], ]; diff --git a/typo3/sysext/workspaces/Classes/Hooks/PagetreeCollectionsProcessor.php b/typo3/sysext/workspaces/Classes/Hooks/PagetreeCollectionsProcessor.php deleted file mode 100644 index 6a51d4d7be2aa58ff272b3ae7ae1465861cc0ba9..0000000000000000000000000000000000000000 --- a/typo3/sysext/workspaces/Classes/Hooks/PagetreeCollectionsProcessor.php +++ /dev/null @@ -1,94 +0,0 @@ -<?php -namespace TYPO3\CMS\Workspaces\Hooks; - -/* - * 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; -use TYPO3\CMS\Workspaces\Service\WorkspaceService; - -/** - * Interface for classes which perform pre or post processing - */ -class PagetreeCollectionsProcessor implements \TYPO3\CMS\Backend\Tree\Pagetree\CollectionProcessorInterface -{ - /** - * @var WorkspaceService - */ - protected $workspaceService = null; - - /** - * @param \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode $node - * @param int $mountPoint - * @param int $level - * @param \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNodeCollection $nodeCollection - */ - public function postProcessGetNodes($node, $mountPoint, $level, $nodeCollection) - { - foreach ($nodeCollection as $node) { - /** @var $node \TYPO3\CMS\Backend\Tree\TreeNode */ - $this->highlightVersionizedElements($node); - } - } - - /** - * @param \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNode $node - * @param string $searchFilter - * @param int $mountPoint - * @param \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNodeCollection $nodeCollection - */ - public function postProcessFilteredNodes($node, $searchFilter, $mountPoint, $nodeCollection) - { - foreach ($nodeCollection as $node) { - /** @var $node \TYPO3\CMS\Backend\Tree\TreeNode */ - $this->highlightVersionizedElements($node); - } - } - - /** - * @param string $searchFilter - * @param \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNodeCollection $nodeCollection - */ - public function postProcessGetTreeMounts($searchFilter, $nodeCollection) - { - foreach ($nodeCollection as $node) { - /** @var $node \TYPO3\CMS\Backend\Tree\TreeNode */ - $this->highlightVersionizedElements($node); - } - } - - /** - * Sets the CSS Class on all pages which have versioned records - * in the current workspace - * - * @param \TYPO3\CMS\Backend\Tree\TreeNode $node - */ - protected function highlightVersionizedElements(\TYPO3\CMS\Backend\Tree\TreeNode $node) - { - if (!$node->getCls() && $this->getWorkspaceService()->hasPageRecordVersions($GLOBALS['BE_USER']->workspace, $node->getId())) { - $node->setCls('ver-versions'); - } - } - - /** - * @return WorkspaceService - */ - protected function getWorkspaceService() - { - if ($this->workspaceService === null) { - $this->workspaceService = GeneralUtility::makeInstance(WorkspaceService::class); - } - - return $this->workspaceService; - } -} diff --git a/typo3/sysext/workspaces/ext_localconf.php b/typo3/sysext/workspaces/ext_localconf.php index f1b9819a18a1f6011baab59e9d658b2db20466ad..95a0a89f65054b148d57f4c0345e60a11ae6872a 100644 --- a/typo3/sysext/workspaces/ext_localconf.php +++ b/typo3/sysext/workspaces/ext_localconf.php @@ -42,8 +42,6 @@ if (!is_array($GLOBALS['TYPO3_CONF_VARS']['SYS']['caching']['cacheConfigurations ]; } -$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['t3lib/tree/pagetree/class.t3lib_tree_pagetree_dataprovider.php']['postProcessCollections'][] = \TYPO3\CMS\Workspaces\Hooks\PagetreeCollectionsProcessor::class; - $GLOBALS['TYPO3_CONF_VARS']['BE']['toolbarItems'][1435433114] = \TYPO3\CMS\Workspaces\Backend\ToolbarItems\WorkspaceSelectorToolbarItem::class; // Registers preview link icon