Skip to content

Commit

Permalink
[BUGFIX] Page module: Respect connected mode during drag & drop
Browse files Browse the repository at this point in the history
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 <no-reply@typo3.com>
Reviewed-by: Armin Vieweg <armin@v.ieweg.de>
Tested-by: Armin Vieweg <armin@v.ieweg.de>
Reviewed-by: Reiner Teubner <rteubner@me.com>
Tested-by: Reiner Teubner <rteubner@me.com>
Reviewed-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Tested-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Reviewed-by: Michael Oehlhof <typo3@oehlhof.de>
Tested-by: Michael Oehlhof <typo3@oehlhof.de>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
  • Loading branch information
andreaskienast authored and susannemoog committed Feb 5, 2018
1 parent 79a58ed commit 42d45e6
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 15 deletions.
14 changes: 7 additions & 7 deletions typo3/sysext/backend/Classes/View/PageLayoutView.php
Expand Up @@ -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:
Expand Down Expand Up @@ -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;
}
Expand Down
Expand Up @@ -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,
Expand Down Expand Up @@ -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();
}
});
};
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 42d45e6

Please sign in to comment.