Commit 9738f3d0 authored by Christian Kuhn's avatar Christian Kuhn Committed by Benni Mack
Browse files

[!!!][TASK] Drop workspace additional services

Back in 6.2 at ExtJS times, a feature has been introduced
to the workspace module to extend the shown 'data grid'
with custom columns. This implementation has been done for
one specific customer who nowadays does not use the feature
anymore.
The feature broke when the transition to a native JavaScript
implementation has been done in v8. There is not a single bug
report this feature broke in forge, and it is hard to resurrect
it with the new client side implementation.
The patch drops related code from the extension. This gives
core development more freedom to improve the workspace module
with other patches.

Change-Id: Ie66b172484cdd08de06e019aa004055975948e85
Resolves: #92838
Releases: master
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/66632


Tested-by: default avatarTYPO3com <noreply@typo3.com>
Tested-by: Daniel Haupt's avatarDaniel Haupt <mail@danielhaupt.de>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Daniel Haupt's avatarDaniel Haupt <mail@danielhaupt.de>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
parent 337e8f9c
.. include:: ../../Includes.txt
========================================================
Breaking: #92838 - Additional workspace services dropped
========================================================
See :issue:`92838`
Description
===========
Back in the ExtJS era, the workspace backend module had two PHP classes designed
for extensions to add additional columns and JavaScript handling to the module.
With the transition to a native JavaScript implementation of the workspace module
in core v8, this stopped working. Related classes have now been removed.
Impact
======
There was one specific customer this feature has been implemented for. It does
not use it anymore. Considering the fact the feature has been broken since years,
there should be little to no impact for any instance.
The following classes and interfaces have been removed:
* :php:`TYPO3\CMS\Workspaces\ColumnDataProviderInterface`
* :php:`TYPO3\CMS\Workspaces\Service\AdditionalColumnService`
* :php:`TYPO3\CMS\Workspaces\Service\AdditionalResourceService`
Affected Installations
======================
Instances with extensions using above classes or interfaces. The extension
scanner will find usages with a strong match.
Migration
=========
No migration available.
.. index:: Backend, JavaScript, PHP-API, FullyScanned, ext:workspaces
......@@ -1599,4 +1599,19 @@ return [
'Deprecation-92080-DeprecatedQueryGeneratorAndQueryView.rst'
],
],
'TYPO3\CMS\Workspaces\ColumnDataProviderInterface' => [
'restFiles' => [
'Breaking-92838-AdditionalWorkspaceServicesDropped.rst'
],
],
'TYPO3\CMS\Workspaces\Service\AdditionalColumnService' => [
'restFiles' => [
'Breaking-92838-AdditionalWorkspaceServicesDropped.rst'
],
],
'TYPO3\CMS\Workspaces\Service\AdditionalResourceService' => [
'restFiles' => [
'Breaking-92838-AdditionalWorkspaceServicesDropped.rst'
],
],
];
<?php
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Workspaces;
use TYPO3\CMS\Workspaces\Domain\Model\CombinedRecord;
/**
* Interface for (additional) columns.
*/
interface ColumnDataProviderInterface
{
/**
* @return array
*/
public function getDefinition();
/**
* @param Domain\Model\CombinedRecord $combinedRecord
* @return string|int|array
*/
public function getData(CombinedRecord $combinedRecord);
}
......@@ -30,8 +30,6 @@ use TYPO3\CMS\Core\Page\PageRenderer;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Versioning\VersionState;
use TYPO3\CMS\Fluid\View\StandaloneView;
use TYPO3\CMS\Workspaces\Service\AdditionalColumnService;
use TYPO3\CMS\Workspaces\Service\AdditionalResourceService;
use TYPO3\CMS\Workspaces\Service\WorkspaceService;
/**
......@@ -105,16 +103,11 @@ class ReviewController
$states = $this->getBackendUser()->uc['moduleData']['Workspaces']['States'];
$this->pageRenderer->addInlineSetting('Workspaces', 'States', $states);
foreach ($this->getAdditionalResourceService()->getLocalizationResources() as $localizationResource) {
$this->pageRenderer->addInlineLanguageLabelFile($localizationResource);
}
$uriBuilder = GeneralUtility::makeInstance(UriBuilder::class);
$this->pageRenderer->loadRequireJsModule('TYPO3/CMS/Workspaces/Backend');
$this->pageRenderer->addInlineSetting('FormEngine', 'moduleUrl', (string)$uriBuilder->buildUriFromRoute('record_edit'));
$this->pageRenderer->addInlineSetting('RecordHistory', 'moduleUrl', (string)$uriBuilder->buildUriFromRoute('record_history'));
$this->pageRenderer->addInlineSetting('Workspaces', 'id', $this->pageId);
$this->assignExtensionSettings();
}
/**
......@@ -254,23 +247,6 @@ class ReviewController
return (string)$uriBuilder->buildUriFromRoute('web_WorkspacesWorkspaces', $parameters);
}
/**
* Assigns additional Workspace settings to TYPO3.settings.Workspaces.extension
*/
protected function assignExtensionSettings()
{
$extension = [
'AdditionalColumn' => [
'Definition' => [],
'Handler' => [],
],
];
$extension['AdditionalColumn']['Definition'] = $this->getAdditionalColumnService()->getDefinition();
$extension['AdditionalColumn']['Handler'] = $this->getAdditionalColumnService()->getHandler();
$this->pageRenderer->addInlineSetting('Workspaces', 'extension', $extension);
}
/**
* Determine whether this page for the current
*
......@@ -322,22 +298,6 @@ class ReviewController
return false;
}
/**
* @return AdditionalColumnService
*/
protected function getAdditionalColumnService(): AdditionalColumnService
{
return GeneralUtility::makeInstance(AdditionalColumnService::class);
}
/**
* @return AdditionalResourceService
*/
protected function getAdditionalResourceService(): AdditionalResourceService
{
return GeneralUtility::makeInstance(AdditionalResourceService::class);
}
/**
* @return PageRenderer
*/
......
<?php
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Workspaces\Service;
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Workspaces\ColumnDataProviderInterface;
use TYPO3\CMS\Workspaces\Domain\Model\CombinedRecord;
/**
* Service for additional columns in GridPanel
*/
class AdditionalColumnService implements SingletonInterface
{
/**
* @var array|ColumnDataProviderInterface[]
*/
protected $columns = [];
/**
* @return AdditionalColumnService
*/
public static function getInstance()
{
return GeneralUtility::makeInstance(AdditionalColumnService::class);
}
/**
* Registers data provider for a particular column name.
*
* @param string $columnName
* @param string|object $dataProviderClassOrObject
* @throws \RuntimeException
*/
public function register($columnName, $dataProviderClassOrObject)
{
if (is_object($dataProviderClassOrObject)) {
$dataProvider = $dataProviderClassOrObject;
} else {
$dataProvider = GeneralUtility::makeInstance($dataProviderClassOrObject);
}
if (!$dataProvider instanceof ColumnDataProviderInterface) {
throw new \RuntimeException('Data provider needs to implement ColumnDataProviderInterface', 1374309323);
}
$this->columns[$columnName] = $dataProvider;
}
/**
* Gets definition for JavaScript settings.
*
* @return array Column settings
*/
public function getDefinition()
{
$columnSettings = [];
foreach ($this->columns as $columnName => $dataProvider) {
$definition = $dataProvider->getDefinition();
if (!is_array($definition)) {
$definition = [];
}
$definition['name'] = $columnName;
$columnSettings[] = $definition;
}
return $columnSettings;
}
/**
* Gets JavaScript handler object, e.g.
* TYPO3.Workspaces.Configuration.AdditionalColumn.extension.MyCustomField
*
* @return array Column settings
*/
public function getHandler()
{
$columnSettings = [];
foreach ($this->columns as $columnName => $_) {
$columnSettings[] = 'TYPO3.Workspaces.extension.AdditionalColumn.' . $columnName;
}
return $columnSettings;
}
/**
* Gets data for grid data.
*
* @param CombinedRecord $combinedRecord
* @return array Record data
*/
public function getData(CombinedRecord $combinedRecord)
{
$recordData = [];
foreach ($this->columns as $columnName => $dataProvider) {
$data = $dataProvider->getData($combinedRecord);
if ($data !== null) {
$recordData[$columnName] = $data;
}
}
return $recordData;
}
}
<?php
/*
* This file is part of the TYPO3 CMS project.
*
* It is free software; you can redistribute it and/or modify it under
* the terms of the GNU General Public License, either version 2
* of the License, or any later version.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* The TYPO3 project - inspiring people to share!
*/
namespace TYPO3\CMS\Workspaces\Service;
use TYPO3\CMS\Core\SingletonInterface;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\PathUtility;
/**
* Service for additional columns in GridPanel
*/
class AdditionalResourceService implements SingletonInterface
{
/**
* @var array
*/
protected $javaScriptResources = [];
/**
* @var array
*/
protected $stylesheetResources = [];
/**
* @var array
*/
protected $localizationResources = [];
/**
* @return AdditionalResourceService
*/
public static function getInstance()
{
return GeneralUtility::makeInstance(AdditionalResourceService::class);
}
/**
* @param string $name
* @param string $resourcePath
*/
public function addJavaScriptResource($name, $resourcePath)
{
$this->javaScriptResources[$name] = $this->resolvePath($resourcePath);
}
/**
* @param string $name
* @param string $resourcePath
*/
public function addStylesheetResource($name, $resourcePath)
{
$this->stylesheetResources[$name] = $this->resolvePath($resourcePath);
}
/**
* @param string $resourcePath
*/
public function addLocalizationResource($resourcePath)
{
$absoluteResourcePath = GeneralUtility::getFileAbsFileName($resourcePath);
$this->localizationResources[$absoluteResourcePath] = $absoluteResourcePath;
}
/**
* @return array
*/
public function getJavaScriptResources()
{
return $this->javaScriptResources;
}
/**
* @return array
*/
public function getStyleSheetResources()
{
return $this->stylesheetResources;
}
/**
* @return array
*/
public function getLocalizationResources()
{
return $this->localizationResources;
}
/**
* Resolve path
*
* @param string $resourcePath
* @return string|null
*/
protected function resolvePath($resourcePath)
{
$absoluteFilePath = GeneralUtility::getFileAbsFileName($resourcePath);
$absolutePath = PathUtility::dirname($absoluteFilePath);
$fileName = PathUtility::basename($absoluteFilePath);
return PathUtility::getRelativePathTo($absolutePath) . $fileName;
}
}
......@@ -229,11 +229,6 @@ class GridDataService implements LoggerAwareInterface
$versionArray['allowedAction_editVersionedPage'] = $isRecordTypeAllowedToModify && !$isDeletedPage;
$versionArray['state_Workspace'] = $recordState;
$versionArray = array_merge(
$versionArray,
$this->getAdditionalColumnService()->getData($combinedRecord)
);
if ($filterTxt == '' || $this->isFilterTextInVisibleColumns($filterTxt, $versionArray)) {
$versionIdentifier = $versionArray['id'];
$this->dataArray[$versionIdentifier] = $versionArray;
......@@ -675,14 +670,6 @@ class GridDataService implements LoggerAwareInterface
return GeneralUtility::makeInstance(CollectionService::class);
}
/**
* @return AdditionalColumnService
*/
protected function getAdditionalColumnService()
{
return GeneralUtility::makeInstance(AdditionalColumnService::class);
}
/**
* @return BackendUserAuthentication
*/
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment