[BUGFIX] Page module: Respect connected mode during drag & drop 61/55561/2
authorAndreas Fernandez <a.fernandez@scripting-base.de>
Thu, 25 Jan 2018 09:20:11 +0000 (10:20 +0100)
committerSusanne Moog <susanne.moog@typo3.org>
Mon, 5 Feb 2018 12:12:17 +0000 (13:12 +0100)
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/55561
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
typo3/sysext/backend/Classes/View/PageLayoutView.php
typo3/sysext/backend/Resources/Public/JavaScript/LayoutModule/DragDrop.js

index 8e1b4f2..5494293 100644 (file)
@@ -1659,9 +1659,6 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
         }
         $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:
@@ -1693,10 +1690,13 @@ class PageLayoutView extends \TYPO3\CMS\Recordlist\RecordList\AbstractDatabaseRe
      */
     protected function isDragAndDropAllowed(array $row)
     {
-        if ($this->getBackendUser()->user['admin']
-            || ((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;
         }
index 7af756f..213fcc3 100644 (file)
@@ -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,
@@ -92,12 +92,11 @@ define(['jquery', 'jquery-ui/droppable'], function ($) {
 
                // make the drop zones visible
                $(DragDrop.dropZoneIdentifier).each(function () {
-                       if (
-                               $(this).parent().find('.icon-actions-document-new').length
-                       ) {
-                               $(this).addClass(DragDrop.validDropZoneClass);
+                       var $me = $(this);
+                       if ($me.parent().find('.icon-actions-document-new').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 +219,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