示例#1
0
        protected virtual NavigableTreeNode BuildUpTreeNodes(Node relativeParent, Node[] allItems, int index, int level)
        {
            var sitePath        = PortalContext.Current.Site == null ? null : PortalContext.Current.Site.Path;
            var contextNodePath = PortalContext.Current.ContextNodePath;

            if (string.IsNullOrEmpty(sitePath))
            {
                throw new InvalidOperationException("Site cannot be null.");
            }

            if (string.IsNullOrEmpty(contextNodePath))
            {
                throw new InvalidOperationException("Context node cannot be null.");
            }

            var treeNode = new NavigableTreeNode(relativeParent, sitePath, contextNodePath)
            {
                Level         = level,
                PhysicalIndex = index + 1
            };

            treeNode.Nodes =
                allItems.Where(node => ((node != null) && node.ParentId == relativeParent.Id)).ToArray().
                OrderBy(node => node.Index).
                Select((node, idx) => BuildUpTreeNodes(node, allItems, idx, level + 1)
                       ).ToArray();

            if (treeNode.Nodes.Length > 0)
            {
                treeNode.Nodes[0].IsFirst = true;
                treeNode.Nodes[treeNode.Nodes.Length - 1].IsLast = true;
            }

            return(treeNode);
        }
示例#2
0
        protected virtual NavigableTreeNode BuildUpTreeNodes(Node relativeParent, Node[] allItems, int index, int level)
        {
            var treeNode = new NavigableTreeNode(relativeParent,
                                                 PortalContext.Current.Site.Path,
                                                 PortalContext.Current.ContextNode.Path)
            {
                Level         = level,
                PhysicalIndex = index + 1
            };

            treeNode.Nodes =
                allItems.Where(node => ((node != null) && node.ParentId == relativeParent.Id)).ToArray().
                OrderBy(node => node.Index).
                Select((node, idx) => BuildUpTreeNodes(node, allItems, idx, level + 1)
                       ).ToArray();

            if (treeNode.Nodes.Length > 0)
            {
                treeNode.Nodes[0].IsFirst = true;
                treeNode.Nodes[treeNode.Nodes.Length - 1].IsLast = true;
            }

            return(treeNode);
        }
示例#3
0
        protected virtual NavigableTreeNode BuildUpTreeNodes(Node relativeParent, Node[] allItems, int index, int level)
        {
            var treeNode = new NavigableTreeNode(relativeParent, 
                PortalContext.Current.Site.Path, 
                PortalContext.Current.ContextNode.Path)
                {
                    Level = level,
                    PhysicalIndex = index + 1
                };

            treeNode.Nodes =
                allItems.Where(node => ((node != null) && node.ParentId == relativeParent.Id)).ToArray().
                    OrderBy(node => node.Index).
                    Select((node, idx) => BuildUpTreeNodes(node, allItems, idx, level + 1)
                    ).ToArray();

            if (treeNode.Nodes.Length > 0)
            {
                treeNode.Nodes[0].IsFirst = true;
                treeNode.Nodes[treeNode.Nodes.Length - 1].IsLast = true;
            }

            return treeNode;
        }