[BUGFIX] Page module: Respect connected mode during drag & drop 53/55453/5
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 11:17:46 +0000 (12:17 +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/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>
typo3/sysext/backend/Classes/View/PageLayoutView.php
typo3/sysext/backend/Resources/Public/JavaScript/LayoutModule/DragDrop.js

index 034b482..bf4cc23 100644 (file)
@@ -2013,9 +2013,6 @@ class PageLayoutView implements LoggerAwareInterface
         }
         $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 @@ class PageLayoutView implements LoggerAwareInterface
      */
     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;
         }
index 43dfd42..90036f2 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,
@@ -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