From 42d45e6f6138965a078c5aa3b15682f4d126cd15 Mon Sep 17 00:00:00 2001 From: Andreas Fernandez Date: Thu, 25 Jan 2018 10:20:11 +0100 Subject: [PATCH] [BUGFIX] Page module: Respect connected mode during drag & drop This patch adjusts the drag and drop handling on the page module. Localized content element can't get moved anymore when they are in connected mode. Languages without a `l18n_parent` may be freely moved. Resolves: #83470 Related: #66540 Releases: master, 8.7 Change-Id: I7dcb61279d4bfeb094dcb0e2fbffd416da9c787b Reviewed-on: https://review.typo3.org/55453 Tested-by: TYPO3com Reviewed-by: Armin Vieweg Tested-by: Armin Vieweg Reviewed-by: Reiner Teubner Tested-by: Reiner Teubner Reviewed-by: Mathias Schreiber Tested-by: Mathias Schreiber Reviewed-by: Michael Oehlhof Tested-by: Michael Oehlhof Reviewed-by: Susanne Moog Tested-by: Susanne Moog --- .../sysext/backend/Classes/View/PageLayoutView.php | 14 +++++++------- .../Public/JavaScript/LayoutModule/DragDrop.js | 14 ++++++-------- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/typo3/sysext/backend/Classes/View/PageLayoutView.php b/typo3/sysext/backend/Classes/View/PageLayoutView.php index 034b4828a459..bf4cc23178a4 100644 --- a/typo3/sysext/backend/Classes/View/PageLayoutView.php +++ b/typo3/sysext/backend/Classes/View/PageLayoutView.php @@ -2013,9 +2013,6 @@ public function tt_content_drawHeader($row, $space = 0, $disableMoveAndNewButton } $allowDragAndDrop = $this->isDragAndDropAllowed($row); $additionalIcons = []; - if ($row['sys_language_uid'] > 0 && $this->checkIfTranslationsExistInLanguage([], (int)$row['sys_language_uid'])) { - $allowDragAndDrop = false; - } $additionalIcons[] = $this->getIcon('tt_content', $row) . ' '; $additionalIcons[] = $langMode ? $this->languageFlag($row['sys_language_uid'], false) : ''; // Get record locking status: @@ -2046,10 +2043,13 @@ public function tt_content_drawHeader($row, $space = 0, $disableMoveAndNewButton */ protected function isDragAndDropAllowed(array $row) { - if ($this->getBackendUser()->isAdmin() - || ((int)$row['editlock'] === 0 && (int)$this->pageinfo['editlock'] === 0) - && $this->getBackendUser()->doesUserHaveAccess($this->pageinfo, Permission::CONTENT_EDIT) - && $this->getBackendUser()->checkAuthMode('tt_content', 'CType', $row['CType'], $GLOBALS['TYPO3_CONF_VARS']['BE']['explicitADmode']) + if ((int)$row['l18n_parent'] === 0 && + ( + $this->getBackendUser()->isAdmin() + || ((int)$row['editlock'] === 0 && (int)$this->pageinfo['editlock'] === 0) + && $this->getBackendUser()->doesUserHaveAccess($this->pageinfo, Permission::CONTENT_EDIT) + && $this->getBackendUser()->checkAuthMode('tt_content', 'CType', $row['CType'], $GLOBALS['TYPO3_CONF_VARS']['BE']['explicitADmode']) + ) ) { return true; } diff --git a/typo3/sysext/backend/Resources/Public/JavaScript/LayoutModule/DragDrop.js b/typo3/sysext/backend/Resources/Public/JavaScript/LayoutModule/DragDrop.js index 43dfd4234b6d..90036f2bb9ed 100644 --- a/typo3/sysext/backend/Resources/Public/JavaScript/LayoutModule/DragDrop.js +++ b/typo3/sysext/backend/Resources/Public/JavaScript/LayoutModule/DragDrop.js @@ -42,7 +42,7 @@ define(['jquery', 'jquery-ui/droppable'], function ($) { */ DragDrop.initialize = function () { $(DragDrop.contentIdentifier).draggable({ - handle: this.dragHeaderIdentifier, + handle: DragDrop.dragHeaderIdentifier, scope: 'tt_content', cursor: 'move', distance: 20, @@ -90,14 +90,12 @@ define(['jquery', 'jquery-ui/droppable'], function ($) { $element.parents(DragDrop.columnHolderIdentifier).find(DragDrop.addContentIdentifier).hide(); $element.find(DragDrop.dropZoneIdentifier).hide(); - // make the drop zones visible $(DragDrop.dropZoneIdentifier).each(function () { - if ( - $(this).parent().find('.icon-actions-add').length - ) { - $(this).addClass(DragDrop.validDropZoneClass); + var $me = $(this); + if ($me.parent().find('.icon-actions-add').length) { + $me.addClass(DragDrop.validDropZoneClass); } else { - $(this).closest(DragDrop.contentIdentifier).find('> ' + DragDrop.addContentIdentifier + ', > > ' + DragDrop.addContentIdentifier).show(); + $me.closest(DragDrop.contentIdentifier).find('> ' + DragDrop.addContentIdentifier + ', > > ' + DragDrop.addContentIdentifier).show(); } }); }; @@ -220,7 +218,7 @@ define(['jquery', 'jquery-ui/droppable'], function ($) { }; /** - * this method does the actual AJAX request for both, the move and the copy action. + * this method does the actual AJAX request for both, the move and the copy action. * * @param $droppableElement * @param $draggableElement