public override IEnumerable<ContentItem> AppendChildren(IEnumerable<ContentItem> previousChildren, Query query)
        {
            if(query.Interface != Interfaces.Managing)
                return previousChildren;

            return previousChildren.Union(nodes.GetChildren(query.Parent.Path));
        }
		public virtual IEnumerable<ContentItem> GetChildren(Query query)
		{
			var items = AppendChildren(NoItems, query);
			if (query.SkipAuthorization)
				return items;
			return items.Where(_security.GetAuthorizationFilter(Permission.Read));
		}
示例#3
0
		public virtual IEnumerable<ContentItem> AppendChildren(IEnumerable<ContentItem> previousChildren, Query query)
		{
			foreach (var source in Sources)
			{
				previousChildren = source.AppendChildren(previousChildren, query);
			}
			return previousChildren;
		}
		public virtual IEnumerable<ContentItem> AppendChildren(IEnumerable<ContentItem> previousChildren, Query query)
		{
			// ReSharper disable LoopCanBeConvertedToQuery
			foreach (var source in Sources)
				previousChildren = source.AppendChildren(previousChildren, query);
			foreach (var source in Sources)
				previousChildren = source.FilterChildren(previousChildren, query);
			return previousChildren;
			// ReSharper restore LoopCanBeConvertedToQuery
		}
示例#5
0
 internal static HierarchyNode<ContentItem> BuildTreeStructure(ItemFilter filter, IContentAdapterProvider adapters, ContentItem selectedItem, int maxDepth)
 {
     var structure = new TreeHierarchyBuilder(selectedItem, maxDepth)
         .Children((item) =>
         {
             var q = new N2.Persistence.Sources.Query { Parent = item, OnlyPages = true, Interface = Interfaces.Managing, Filter = filter };
             return adapters.ResolveAdapter<NodeAdapter>(item).GetChildren(q);
         })
         .Build();
     return structure;
 }
示例#6
0
 internal static HierarchyNode<ContentItem> BuildBranchStructure(ItemFilter filter, IContentAdapterProvider adapters, ContentItem selectedItem, ContentItem root)
 {
     var structure = new BranchHierarchyBuilder(selectedItem, root, true) { UseMasterVersion = false }
         .Children((item) =>
         {
             var q = new N2.Persistence.Sources.Query { Parent = item, OnlyPages = true, Interface = Interfaces.Managing, Filter = filter };
             return adapters.ResolveAdapter<NodeAdapter>(item).GetChildren(q);
         })
         .Build();
     return structure;
 }
示例#7
0
        internal static HierarchyNode <ContentItem> BuildTreeStructure(ItemFilter filter, IContentAdapterProvider adapters, ContentItem selectedItem, int maxDepth)
        {
            var structure = new TreeHierarchyBuilder(selectedItem, maxDepth)
                            .Children((item) =>
            {
                var q = new N2.Persistence.Sources.Query {
                    Parent = item, OnlyPages = true, Interface = Interfaces.Managing, Filter = filter
                };
                return(adapters.ResolveAdapter <NodeAdapter>(item).GetChildren(q));
            })
                            .Build();

            return(structure);
        }
示例#8
0
		public override IEnumerable<ContentItem> AppendChildren(IEnumerable<ContentItem> previousChildren, Query query)
		{
			IEnumerable<ContentItem> items;
			if (!query.OnlyPages.HasValue)
				items = query.Parent.Children;
			else if (query.OnlyPages.Value)
				items = query.Parent.Children.FindPages();
			else
				items = query.Parent.Children.FindParts();

			if (query.Filter != null)
				items = items.Where(query.Filter);

			return previousChildren.Union(items);
		}
示例#9
0
        internal static HierarchyNode <ContentItem> BuildBranchStructure(ItemFilter filter, IContentAdapterProvider adapters, ContentItem selectedItem, ContentItem root)
        {
            var structure = new BranchHierarchyBuilder(selectedItem, root, true)
            {
                UseMasterVersion = false
            }
            .Children((item) =>
            {
                var q = new N2.Persistence.Sources.Query {
                    Parent = item, OnlyPages = true, Interface = Interfaces.Managing, Filter = filter
                };
                return(adapters.ResolveAdapter <NodeAdapter>(item).GetChildren(q));
            })
            .Build();

            return(structure);
        }
示例#10
0
		public override bool HasChildren(Query query)
		{
			if (query.Parent.ChildState == CollectionState.IsEmpty)
				return false;

			bool onlyPages = query.OnlyPages ?? false;

			if (query.Parent.ChildState.IsAny(CollectionState.ContainsVisiblePublicPages | CollectionState.ContainsHiddenPublicPages))
				return true;
			if (!onlyPages && query.Parent.ChildState.IsAny(CollectionState.ContainsPublicParts))
				return true;
			if (query.Filter != null && query.Parent.ChildState.IsAny(CollectionState.ContainsHiddenSecuredPages | CollectionState.ContainsVisibleSecuredPages))
				return true;
			if (!onlyPages && query.Filter != null && query.Parent.ChildState.IsAny(CollectionState.ContainsSecuredParts))
				return true;

			return base.HasChildren(query);
		}
示例#11
0
		private IEnumerable<Node<TreeNode>> GetChildren(Query query, ItemFilter filter, bool expandRecursive = false)
		{
			var adapter = engine.GetContentAdapter<NodeAdapter>(Selection.SelectedItem);

			return adapter.GetChildren(query)
				.Where(filter)
				.Select(c => GetNode(c, query, filter, expandRecursive));
		}
示例#12
0
 public virtual bool HasChildren(Query query)
 {
     return GetChildren(query).Any();
 }
示例#13
0
		/// <summary>Returns true when an item has children.</summary>
		/// <param name="query">The item whose childrens existence is to be determined.</param>
		/// <returns>True when there are children.</returns>
		public virtual bool HasChildren(Query query)
		{
			return Sources.HasChildren(query);
		}
示例#14
0
        private Node<TreeNode> GetNode(ContentItem item, Query query)
        {
            var adapter = engine.GetContentAdapter<NodeAdapter>(item);
			return new Node<TreeNode>
			{
				Current = adapter.GetTreeNode(item),
				Children = new Node<TreeNode>[0],
				HasChildren = adapter.HasChildren(new Query { Parent = item, Filter = query.Filter, Interface = query.Interface, OnlyPages = query.OnlyPages }),
				Expanded = false
			};
        }
示例#15
0
		/// <summary>Gets the children of the given item for the given user interface.</summary>
		/// <param name="parent">The item whose children to get.</param>
		/// <param name="userInterface">The interface where the children are displayed.</param>
		/// <returns>An enumeration of the children.</returns>
		public virtual IEnumerable<ContentItem> GetChildren(Query query)
		{
			IEnumerable<ContentItem> children = GetNodeChildren(query);

			foreach (var child in children)
				yield return child;

			if (Interfaces.Managing == query.Interface)
			{
				foreach (var child in NodeFactory.GetChildren(query.Parent.Path))
				{
					if (query.IsMatch(child))
						yield return child;
				}
			}
		}
示例#16
0
		protected virtual IEnumerable<ContentItem> GetNodeChildren(Query query)
		{
			if (query == null) throw new ArgumentNullException("query");

			if (query.Parent is IActiveChildren)
				return ((IActiveChildren)query.Parent).GetChildren(new AccessFilter(WebContext.User, Security));

			if (!query.OnlyPages.HasValue && !Settings.DisplayDataItems)
				query.OnlyPages = true;

			var children = Sources.GetChildren(query);

			return children;
		}
示例#17
0
		protected virtual IEnumerable<ContentItem> GetNodeChildren(ContentItem parent, string userInterface)
		{
			if (parent is IActiveChildren)
				return ((IActiveChildren)parent).GetChildren(new AccessFilter(WebContext.User, Security));

			var query = new Query { Parent = parent, Interface = userInterface };
			if (!Settings.DisplayDataItems)
				query.OnlyPages = true;
			return Sources.GetChildren(query);
		}
示例#18
0
		public override IEnumerable<ContentItem> AppendChildren(IEnumerable<ContentItem> previousChildren, Query query)
		{
			throw new NotImplementedException();
			//return AppendContentChildren(previousChildren, query);
		}
示例#19
0
		private Node<TreeNode> GetNode(ContentItem item, Query query, ItemFilter filter, bool expandRecursive = false)
		{
			var adapter = engine.GetContentAdapter<NodeAdapter>(item);
			var node = new Node<TreeNode>
			{
				Current = adapter.GetTreeNode(item),
				Children = new Node<TreeNode>[0],
				HasChildren = adapter.HasChildren(new Query { Parent = item, Filter = query.Filter, Interface = query.Interface, OnlyPages = query.OnlyPages }),
				Expanded = false
			};
			if (expandRecursive)
			{
				query = query.Clone();
				query.Parent = item;
				node.Children = GetChildren(query, filter, expandRecursive).ToList();
			}
			return node;
		}
示例#20
0
			public override IEnumerable<ContentItem> AppendChildren(IEnumerable<ContentItem> previousChildren, Query query)
			{
				throw new MarkerException();
			}
 public override IEnumerable<ContentItem> AppendChildren(IEnumerable<ContentItem> previousChildren, Query query)
 {
     return previousChildren;
 }