[BUGFIX] Show "stop page tree" in ExtJS Page tree 96/41496/6
authorBenjamin Mack <benni@typo3.org>
Thu, 16 Jul 2015 17:50:04 +0000 (19:50 +0200)
committerBenni Mack <benni@typo3.org>
Fri, 13 Nov 2015 22:00:14 +0000 (23:00 +0100)
Resolves: #61812
Resolves: #66312
Resolves: #24556
Releases: master, 6.2
Change-Id: Ieafb03dca4c05f07033e309202bb49f1db58aeb6
Reviewed-on: https://review.typo3.org/41496
Reviewed-by: Markus Klein <markus.klein@typo3.org>
Reviewed-by: Oliver Hader <oliver.hader@typo3.org>
Reviewed-by: Oliver Eglseder <oliver.eglseder@in2code.de>
Tested-by: Oliver Eglseder <oliver.eglseder@in2code.de>
Reviewed-by: Michael Oehlhof <typo3@oehlhof.de>
Tested-by: Michael Oehlhof <typo3@oehlhof.de>
Reviewed-by: Benni Mack <benni@typo3.org>
Tested-by: Benni Mack <benni@typo3.org>
typo3/sysext/backend/Classes/Tree/Pagetree/Commands.php
typo3/sysext/backend/Classes/Tree/Pagetree/DataProvider.php
typo3/sysext/backend/Classes/Tree/Pagetree/PagetreeNode.php
typo3/sysext/backend/Resources/Public/JavaScript/extjs/components/pagetree/javascript/nodeui.js

index 6ddf333..951d3dd 100644 (file)
@@ -317,6 +317,7 @@ class Commands
         $subNode->setCls($record['_CSSCLASS']);
         $subNode->setType('pages');
         $subNode->setId($record['uid']);
+        $subNode->setStopPageTree($record['php_tree_stop']);
         $subNode->setMountPoint($mountPoint);
         $subNode->setWorkspaceId($record['_ORIG_uid'] ?: $record['uid']);
         $subNode->setBackgroundColor(self::$backgroundColors[$record['uid']]);
index 55dde87..75de65c 100644 (file)
@@ -110,7 +110,7 @@ class DataProvider extends \TYPO3\CMS\Backend\Tree\AbstractTreeDataProvider
     {
         /** @var $nodeCollection \TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNodeCollection */
         $nodeCollection = GeneralUtility::makeInstance(\TYPO3\CMS\Backend\Tree\Pagetree\PagetreeNodeCollection::class);
-        if ($level >= 99) {
+        if ($level >= 99 || $node->getStopPageTree()) {
             return $nodeCollection;
         }
         $isVirtualRootNode = false;
index 6069210..ccd7649 100644 (file)
@@ -57,6 +57,14 @@ class PagetreeNode extends \TYPO3\CMS\Backend\Tree\ExtDirectNode
     protected $isMountPoint = false;
 
     /**
+     * Indicator if the page tree should stop here
+     *
+     * @var bool
+     */
+    protected $stopPageTree = false;
+
+
+    /**
      * Background color for the node
      *
      * @var string
@@ -106,6 +114,26 @@ class PagetreeNode extends \TYPO3\CMS\Backend\Tree\ExtDirectNode
     }
 
     /**
+     * Sets if the pagetree should stop here
+     *
+     * @param bool $stopPageTree
+     */
+    public function setStopPageTree($stopPageTree)
+    {
+        $this->stopPageTree = (bool)$stopPageTree;
+    }
+
+    /**
+     * Returns if the pagetree should stop here
+     *
+     * @return int
+     */
+    public function getStopPageTree()
+    {
+        return $this->stopPageTree;
+    }
+
+    /**
      * Sets the mount point id
      *
      * @param int $mountPoint
@@ -402,6 +430,7 @@ class PagetreeNode extends \TYPO3\CMS\Backend\Tree\ExtDirectNode
         $arrayRepresentation['nodeData']['workspaceId'] = $this->getWorkspaceId();
         $arrayRepresentation['nodeData']['isMountPoint'] = $this->isMountPoint();
         $arrayRepresentation['nodeData']['backgroundColor'] = htmlspecialchars($this->getBackgroundColor());
+        $arrayRepresentation['nodeData']['stopPageTree'] = $this->getStopPageTree();
         $arrayRepresentation['nodeData']['serializeClassName'] = get_class($this);
         return $arrayRepresentation;
     }
index 2d60937..cd31728 100644 (file)
@@ -32,11 +32,11 @@ TYPO3.Components.PageTree.PageTreeNodeUI = Ext.extend(Ext.tree.TreeNodeUI, {
         */
        renderElements : function(n, a, targetNode, bulkRender) {
                // add some indent caching, this helps performance when rendering a large tree
-        this.indentMarkup = n.parentNode ? n.parentNode.ui.getChildIndent() : '';
+               this.indentMarkup = n.parentNode ? n.parentNode.ui.getChildIndent() : '';
 
-        var cb = Ext.isBoolean(a.checked),
-            nel,
-            href = this.getHref(a.href),
+               var cb = Ext.isBoolean(a.checked),
+                       nel,
+                       href = this.getHref(a.href),
                        nodeStyles = '',
                        rootline = '';
 
@@ -49,39 +49,43 @@ TYPO3.Components.PageTree.PageTreeNodeUI = Ext.extend(Ext.tree.TreeNodeUI, {
                        nodeStyles = 'style="background-color: ' + a.nodeData.backgroundColor + '"';
                }
 
-               var buf = [rootline,'<li class="x-tree-node" ' + nodeStyles + '><div ext:tree-node-id="',n.id,'" class="x-tree-node-el x-tree-node-leaf x-unselectable ', a.cls,'" unselectable="on">',
-            '<span class="x-tree-node-indent">',this.indentMarkup,"</span>",
-            '<img alt="" src="', this.emptyIcon, '" class="x-tree-ec-icon x-tree-elbow" />',
+               var buf = [
+                       rootline,
+                       '<li class="x-tree-node" ' + nodeStyles + '><div ext:tree-node-id="', n.id, '" class="x-tree-node-el x-tree-node-leaf x-unselectable ', a.cls, '" unselectable="on">',
+                       '<span class="x-tree-node-indent">', this.indentMarkup, "</span>",
+                       '<img alt="" src="', this.emptyIcon, '" class="x-tree-ec-icon x-tree-elbow" />',
 //            '<img alt="" src="', a.icon || this.emptyIcon, '" class="x-tree-node-icon',(a.icon ? " x-tree-node-inline-icon" : ""),(a.iconCls ? " "+a.iconCls : ""),'" unselectable="on" />',
                        a.spriteIconCode, // TYPO3: add sprite icon code
-            cb ? ('<input class="x-tree-node-cb" type="checkbox" ' + (a.checked ? 'checked="checked" />' : '/>')) : '',
-            '<a hidefocus="on" class="x-tree-node-anchor" href="',href,'" tabIndex="1" ',
-             a.hrefTarget ? ' target="'+a.hrefTarget+'"' : "", '><span unselectable="on">',n.text,"</span></a></div>",
-            '<ul class="x-tree-node-ct" style="display:none;"></ul>',
-            "</li>"].join('');
+                       (a.nodeData.stopPageTree ? '<span class="text-danger">+</span>' : ''),
+                       cb ? ('<input class="x-tree-node-cb" type="checkbox" ' + (a.checked ? 'checked="checked" />' : '/>')) : '',
+                       '<a hidefocus="on" class="x-tree-node-anchor" href="',href,'" tabIndex="1" ',
+                        a.hrefTarget ? ' target="'+a.hrefTarget+'"' : "", '><span unselectable="on">',n.text,"</span></a></div>",
+                       '<ul class="x-tree-node-ct" style="display:none;"></ul>',
+                       "</li>"
+               ].join('');
 
-        if(bulkRender !== true && n.nextSibling && (nel = n.nextSibling.ui.getEl())){
-            this.wrap = Ext.DomHelper.insertHtml("beforeBegin", nel, buf);
-        }else{
-            this.wrap = Ext.DomHelper.insertHtml("beforeEnd", targetNode, buf);
-        }
+               if(bulkRender !== true && n.nextSibling && (nel = n.nextSibling.ui.getEl())){
+                       this.wrap = Ext.DomHelper.insertHtml("beforeBegin", nel, buf);
+               }else{
+                       this.wrap = Ext.DomHelper.insertHtml("beforeEnd", targetNode, buf);
+               }
 
-        this.elNode = this.wrap.childNodes[0];
-        this.ctNode = this.wrap.childNodes[1];
-        var cs = this.elNode.childNodes;
-        this.indentNode = cs[0];
-        this.ecNode = cs[1];
+               this.elNode = this.wrap.childNodes[0];
+               this.ctNode = this.wrap.childNodes[1];
+               var cs = this.elNode.childNodes;
+               this.indentNode = cs[0];
+               this.ecNode = cs[1];
 //        this.iconNode = cs[2];
                this.iconNode = (cs[2].firstChild.tagName === 'SPAN' ? cs[2].firstChild : cs[2]); // TYPO3: get possible overlay icon
-        var index = 3; // TYPO3: index 4?
-        if(cb){
-            this.checkbox = cs[3];
-            // fix for IE6
-            this.checkbox.defaultChecked = this.checkbox.checked;
-            index++;
-        }
-        this.anchor = cs[index];
-        this.textNode = cs[index].firstChild;
+               var index = 3; // TYPO3: index 4?
+               if(cb){
+                       this.checkbox = cs[3];
+                       // fix for IE6
+                       this.checkbox.defaultChecked = this.checkbox.checked;
+                       index++;
+               }
+               this.anchor = cs[index];
+               this.textNode = cs[index].firstChild;
 
                        // TYPO3: call the context menu on a single click (Beware of drag&drop!)
                if (!TYPO3.Components.PageTree.Configuration.disableIconLinkToContextmenu