[BUGFIX] Show icon in the page tree when page is edited by other user 33/56033/3
authorTymoteusz Motylewski <t.motylewski@gmail.com>
Wed, 7 Mar 2018 12:11:22 +0000 (13:11 +0100)
committerAndreas Fernandez <a.fernandez@scripting-base.de>
Wed, 7 Mar 2018 14:58:47 +0000 (15:58 +0100)
When a page is edited by other user it is "locked".
In this case an icon is shown in front of the page title.

Resolves: #84089
Releases: master
Change-Id: I4f3ab9266549212f66f26230e8d4bba4478878fa
Reviewed-on: https://review.typo3.org/56033
Reviewed-by: Mathias Schreiber <mathias.schreiber@typo3.com>
Tested-by: Mathias Schreiber <mathias.schreiber@typo3.com>
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>
typo3/sysext/backend/Classes/Controller/Page/TreeController.php
typo3/sysext/backend/Resources/Public/JavaScript/PageTree/PageTree.js
typo3/sysext/backend/Resources/Public/JavaScript/SvgTree.js

index d0b942c..a6db720 100644 (file)
@@ -275,10 +275,9 @@ class TreeController
         $lockInfo = BackendUtility::isRecordLocked('pages', $pageId);
         if (is_array($lockInfo)) {
             $tooltip .= ' - ' . $lockInfo['msg'];
-            $prefix = '<span class="typo3-pagetree-status">' . $this->iconFactory->getIcon('warning-in-use', Icon::SIZE_SMALL)->render() . '</span>';
         }
         if ($this->addIdAsPrefix) {
-            $prefix .= htmlspecialchars('[' . $pageId . '] ');
+            $prefix = htmlspecialchars('[' . $pageId . '] ');
         }
 
         $items = [];
@@ -295,6 +294,7 @@ class TreeController
             'alias' => htmlspecialchars($page['alias'] ?: ''),
             'prefix' => htmlspecialchars($prefix),
             'suffix' => htmlspecialchars($suffix),
+            'locked' => is_array($lockInfo),
             'overlayIcon' => $icon->getOverlayIcon() ? $icon->getOverlayIcon()->getIdentifier() : '',
             'selectable' => true,
             'expanded' => (bool)$expanded,
index 81b126f..1f15783 100644 (file)
@@ -280,11 +280,16 @@ define(['jquery',
 
       _super_.appendTextElement.call(this, node)
         .attr('dx', function(node) {
+          var position = _this.textPosition;
           if (node.stopPageTree && node.depth !== 0) {
-            return _this.textPosition + 15;
+            position += 15;
           }
 
-          return _this.textPosition;
+          if (node.locked) {
+            position += 15;
+          }
+
+          return position;
         })
         .on('click', function(node) {
           if (node.identifier !== 0) {
index f3232ee..bdeb0b6 100644 (file)
@@ -422,6 +422,9 @@ define(
           if (_this.settings.showIcons) {
             _this.fetchIcon(n.icon);
             _this.fetchIcon(n.overlayIcon);
+            if (n.locked) {
+              _this.fetchIcon('warning-in-use');
+            }
           }
         });
 
@@ -532,6 +535,12 @@ define(
           nodes
             .select('use.node-icon-overlay')
             .attr('xlink:href', this.getIconOverlayId);
+          nodes
+            .select('use.node-icon-locked')
+            .attr('xlink:href', function (node) {
+              return '#icon-' + (node.locked ? 'warning-in-use' : '');
+            });
+
         }
 
         // dispatch event
@@ -739,6 +748,12 @@ define(
             .on('click', function(node) {
               _this.clickOnIcon(node, this);
             });
+
+          nodeEnter
+            .append('use')
+            .attr('x', 27)
+            .attr('y', -7)
+            .attr('class', 'node-icon-locked');
         }
 
         this.dispatch.call('updateSvg', this, nodeEnter);
@@ -763,7 +778,9 @@ define(
 
         return node
           .append('text')
-          .attr('dx', this.textPosition)
+          .attr('dx', function (node) {
+            return _this.textPosition + (node.locked ? 15 : 0);
+          })
           .attr('dy', 5)
           .attr('class', 'node-name')
           .on('click', function(node) {