From 111c29f9d0f55ec86c713d75085bdd90db5cbf99 Mon Sep 17 00:00:00 2001 From: Georg Ringer Date: Thu, 15 Feb 2018 13:42:40 +0100 Subject: [PATCH] [TASK] Move HTML generation in RemoveUserViewHelper to the view Instead of creating the HTML in the ViewHelper it should be done in the template. Resolves: #83918 Releases: master Change-Id: I8e9aaf51f23cd8808cc2910d6e8668f27671cf66 Reviewed-on: https://review.typo3.org/55733 Tested-by: TYPO3com Reviewed-by: Benni Mack Tested-by: Benni Mack Reviewed-by: Mathias Schreiber Tested-by: Mathias Schreiber Reviewed-by: Christian Kuhn Tested-by: Christian Kuhn --- .../Controller/BackendUserController.php | 1 + .../ViewHelpers/RemoveUserViewHelper.php | 37 ++----------------- .../Partials/BackendUser/IndexListRow.html | 16 +++++++- .../BackendUser/PaginatedListWidget.html | 2 +- .../BackendUser/PaginatedListWidgetBody.html | 4 +- .../PaginatedListWidgetBody.html | 4 +- .../Private/Templates/BackendUser/Index.html | 1 - 7 files changed, 25 insertions(+), 40 deletions(-) diff --git a/typo3/sysext/beuser/Classes/Controller/BackendUserController.php b/typo3/sysext/beuser/Classes/Controller/BackendUserController.php index 1e3a237fb808..b3e342536fa8 100644 --- a/typo3/sysext/beuser/Classes/Controller/BackendUserController.php +++ b/typo3/sysext/beuser/Classes/Controller/BackendUserController.php @@ -166,6 +166,7 @@ public function indexAction(\TYPO3\CMS\Beuser\Domain\Model\Demand $demand = null $this->view->assign('compareUserUidList', array_map(function ($item) { return true; }, array_flip((array)$compareUserList))); + $this->view->assign('currentUserUid', $this->getBackendUserAuthentication()->user['uid']); $this->view->assign('compareUserList', !empty($compareUserList) ? $this->backendUserRepository->findByUidList($compareUserList) : ''); } diff --git a/typo3/sysext/beuser/Classes/ViewHelpers/RemoveUserViewHelper.php b/typo3/sysext/beuser/Classes/ViewHelpers/RemoveUserViewHelper.php index 13370652b7b7..254d030a595e 100644 --- a/typo3/sysext/beuser/Classes/ViewHelpers/RemoveUserViewHelper.php +++ b/typo3/sysext/beuser/Classes/ViewHelpers/RemoveUserViewHelper.php @@ -16,17 +16,13 @@ use TYPO3\CMS\Backend\Routing\UriBuilder; use TYPO3\CMS\Beuser\Domain\Model\BackendUser; -use TYPO3\CMS\Core\Authentication\BackendUserAuthentication; -use TYPO3\CMS\Core\Imaging\Icon; -use TYPO3\CMS\Core\Imaging\IconFactory; use TYPO3\CMS\Core\Utility\GeneralUtility; -use TYPO3\CMS\Extbase\Utility\LocalizationUtility; use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface; use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper; use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic; /** - * Displays 'Delete user' link with sprite icon to remove user + * Renders 'Delete user' link * * @internal */ @@ -34,13 +30,6 @@ class RemoveUserViewHelper extends AbstractViewHelper { use CompileWithRenderStatic; - /** - * As this ViewHelper renders HTML, the output must not be escaped. - * - * @var bool - */ - protected $escapeOutput = false; - /** * Initializes the arguments */ @@ -50,7 +39,7 @@ public function initializeArguments() } /** - * Render link with sprite icon to remove user + * Renders the URL to remove a user. * * @param array $arguments * @param \Closure $renderChildrenClosure @@ -60,29 +49,11 @@ public function initializeArguments() */ public static function renderStatic(array $arguments, \Closure $renderChildrenClosure, RenderingContextInterface $renderingContext) { - /** @var \TYPO3\CMS\Beuser\Domain\Model\BackendUser $backendUser */ - $backendUser = $arguments['backendUser']; - /** @var BackendUserAuthentication $beUser */ - $beUser = $GLOBALS['BE_USER']; - /** @var IconFactory $iconFactory */ - $iconFactory = GeneralUtility::makeInstance(IconFactory::class); - if ($backendUser->getUid() === (int)$beUser->user['uid']) { - return '' . $iconFactory->getIcon('empty-empty', Icon::SIZE_SMALL)->render() . ''; - } - $urlParameters = [ - 'cmd[be_users][' . $backendUser->getUid() . '][delete]' => 1, + 'cmd[be_users][' . $arguments['backendUser']->getUid() . '][delete]' => 1, 'redirect' => GeneralUtility::getIndpEnv('REQUEST_URI') ]; $uriBuilder = GeneralUtility::makeInstance(UriBuilder::class); - $url = (string)$uriBuilder->buildUriFromRoute('tce_db', $urlParameters); - - return '' . $iconFactory->getIcon('actions-edit-delete', Icon::SIZE_SMALL)->render() . ''; + return (string)$uriBuilder->buildUriFromRoute('tce_db', $urlParameters); } } diff --git a/typo3/sysext/beuser/Resources/Private/Partials/BackendUser/IndexListRow.html b/typo3/sysext/beuser/Resources/Private/Partials/BackendUser/IndexListRow.html index a33f43be5dc1..fec20abc7655 100644 --- a/typo3/sysext/beuser/Resources/Private/Partials/BackendUser/IndexListRow.html +++ b/typo3/sysext/beuser/Resources/Private/Partials/BackendUser/IndexListRow.html @@ -45,7 +45,21 @@ - + + + + + + + + + +
diff --git a/typo3/sysext/beuser/Resources/Private/Partials/BackendUser/PaginatedListWidget.html b/typo3/sysext/beuser/Resources/Private/Partials/BackendUser/PaginatedListWidget.html index 598ecaa782e8..a5f11ea5b938 100644 --- a/typo3/sysext/beuser/Resources/Private/Partials/BackendUser/PaginatedListWidget.html +++ b/typo3/sysext/beuser/Resources/Private/Partials/BackendUser/PaginatedListWidget.html @@ -1,3 +1,3 @@ - \ No newline at end of file + diff --git a/typo3/sysext/beuser/Resources/Private/Partials/BackendUser/PaginatedListWidgetBody.html b/typo3/sysext/beuser/Resources/Private/Partials/BackendUser/PaginatedListWidgetBody.html index e16b5d97b30a..d1d812f6bd61 100644 --- a/typo3/sysext/beuser/Resources/Private/Partials/BackendUser/PaginatedListWidgetBody.html +++ b/typo3/sysext/beuser/Resources/Private/Partials/BackendUser/PaginatedListWidgetBody.html @@ -10,7 +10,7 @@ - + Footer row: no officially defined style yet @@ -24,4 +24,4 @@ -
\ No newline at end of file + diff --git a/typo3/sysext/beuser/Resources/Private/Partials/BackendUserGroup/PaginatedListWidgetBody.html b/typo3/sysext/beuser/Resources/Private/Partials/BackendUserGroup/PaginatedListWidgetBody.html index 2982a438ee64..476d660da57c 100644 --- a/typo3/sysext/beuser/Resources/Private/Partials/BackendUserGroup/PaginatedListWidgetBody.html +++ b/typo3/sysext/beuser/Resources/Private/Partials/BackendUserGroup/PaginatedListWidgetBody.html @@ -10,7 +10,7 @@ - + Footer row: no officially defined style yet @@ -22,4 +22,4 @@ - \ No newline at end of file + diff --git a/typo3/sysext/beuser/Resources/Private/Templates/BackendUser/Index.html b/typo3/sysext/beuser/Resources/Private/Templates/BackendUser/Index.html index 279f2e881ac2..6adad084c113 100644 --- a/typo3/sysext/beuser/Resources/Private/Templates/BackendUser/Index.html +++ b/typo3/sysext/beuser/Resources/Private/Templates/BackendUser/Index.html @@ -8,7 +8,6 @@

- Listing of users on compare list