本文整理汇总了C#中ContentItem.GetChildren方法的典型用法代码示例。如果您正苦于以下问题:C# ContentItem.GetChildren方法的具体用法?C# ContentItem.GetChildren怎么用?C# ContentItem.GetChildren使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContentItem
的用法示例。
在下文中一共展示了ContentItem.GetChildren方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetItemsInZone
public override ItemList GetItemsInZone(ContentItem parentItem, string zoneName)
{
if(zoneName.EndsWith("None"))
return new ItemList();
if (zoneName.EndsWith("All"))
return parentItem.GetChildren(new DelegateFilter(ci => ci.ZoneName != null));
return parentItem.GetChildren(zoneName);
}
示例2: GetParts
public override System.Collections.Generic.IEnumerable<ContentItem> GetParts(ContentItem belowParentItem, string inZoneNamed, string filteredForInterface)
{
if(inZoneNamed.EndsWith("None"))
return new ItemList();
if (inZoneNamed.EndsWith("All"))
return belowParentItem.GetChildren(new DelegateFilter(ci => ci.ZoneName != null));
return belowParentItem.GetChildren(inZoneNamed);
}
示例3: GetChildren
protected virtual IEnumerable<ContentItem> GetChildren(ContentItem currentItem)
{
IEnumerable<ContentItem> children = currentItem.GetChildren();
if (Filter != null)
children = Filter(children);
return children;
}
示例4: GetChildren
private static N2.Collections.ItemList GetChildren(ContentItem parentItem)
{
N2.Collections.ItemFilter trashFilter = new N2.Collections.TypeFilter(true, typeof(N2.Edit.Trash.TrashContainerItem));
N2.Collections.ItemFilter folderFilter = new N2.Collections.TypeFilter(true, typeof(FolderItem));
N2.Collections.ItemFilter imageFilter = new N2.Collections.TypeFilter(true, typeof(ImageItem));
return parentItem.GetChildren(trashFilter, folderFilter, imageFilter);
}
示例5: AddReferencesRecursive
protected void AddReferencesRecursive(ContentItem current, ItemList referrers)
{
referrers.AddRange(Find.Items.Where.Detail().Eq(Item).Select());
foreach (ContentItem child in current.GetChildren())
{
AddReferencesRecursive(child, referrers);
}
}
示例6: AddReferencesRecursive
protected void AddReferencesRecursive(ContentItem current, ItemList referrers)
{
referrers.AddRange(Content.Search.Repository.Find(Parameter.Equal(null, Item).Detail()));
//Find.Items.Where.Detail().Eq(Item).Select());
foreach (ContentItem child in current.GetChildren())
{
AddReferencesRecursive(child, referrers);
}
}
示例7: UpdateEditor
public override void UpdateEditor(ContentItem item, Control editor)
{
TextBox tb = (TextBox)editor;
tb.Text = string.Empty;
foreach (ContentItem child in item.GetChildren())
{
tb.Text += child.Title + Environment.NewLine;
}
}
示例8: GetChildren
/// <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(ContentItem parent, string userInterface)
{
foreach (var child in parent.GetChildren(new AccessFilter(WebContext.User, Security)))
{
yield return child;
}
if (Interfaces.Managing == userInterface)
{
foreach (var child in NodeFactory.GetChildren(parent.Path))
{
yield return child;
}
}
}
示例9: GetFiles
private static IEnumerable GetFiles(ContentItem contentItem, FileType fileType)
{
IEnumerable<ContentItem> files = contentItem.GetChildren().Pages().Published().Authorized(Operations.Read);
switch (fileType)
{
case FileType.Image :
files = files.Where(f => f is FileSystem.Images.Image);
break;
}
return files.Select(ci => new
{
name = ci.Title,
url = GetUrl(fileType, ci),
imageUrl = GetImageUrl(ci)
});
}
示例10: HasChildren
/// <summary>Returns true when an item has children.</summary>
/// <param name="filter">The filter to apply.</param>
/// <param name="parent">The item whose childrens existence is to be determined.</param>
/// <returns>True when there are children.</returns>
public virtual bool HasChildren(ContentItem parent, ItemFilter filter)
{
return parent.GetChildren(filter).Count > 0;
}
示例11: RecurseTree
/// <summary>
/// Builds up the entire site tree recursively, adding items to the list
/// </summary>
/// <param name="list">This should be an empty list</param>
/// <param name="parent">This should be called using the root item</param>
private void RecurseTree(IList<ContentItem> list, ContentItem parent)
{
// TODO: add caching?
foreach (var item in parent.GetChildren())
{
if (item.Visible && item.IsPage) // TODO make this a setting
{
list.Add(item);
RecurseTree(list, item);
}
}
}
示例12: ApplyRulesRecursive
private void ApplyRulesRecursive(ContentItem item, IEnumerable<string> allowedOperations)
{
// Only apply the rules if the current user has permission to administer this item.
if (Engine.SecurityManager.IsAuthorized(item, User, Operations.Administer))
ApplyRules(item, allowedOperations);
// Apply recursively.
ContentItem[] children = item.GetChildren().ToArray();
foreach (ContentItem child in children)
ApplyRulesRecursive(child, allowedOperations);
}
示例13: RecurseTree
/// <summary>
/// Builds up the entire site tree recursively, adding items to the list
/// </summary>
/// <param name="list">This should be an empty list</param>
/// <param name="parent">This should be called using the root item</param>
private static void RecurseTree(IList<ContentItem> list, ContentItem parent)
{
// TODO: add caching?
foreach (var item in parent.GetChildren().Visible().Pages())
{
list.Add(item);
RecurseTree(list, item);
}
}
示例14: GetTranslations
private static IEnumerable<StartPage> GetTranslations(ContentItem currentPage)
{
return currentPage.GetChildren().OfType<StartPage>();
}
示例15: AddReferencesRecursive
protected void AddReferencesRecursive(ContentItem current, List<ContentItem> referrers)
{
referrers.AddRange(Context.Finder.QueryItems().Where(ci => ci.Details.OfType<LinkProperty>().Any(ld => ld.LinkedItem == current)));
foreach (ContentItem child in current.GetChildren())
AddReferencesRecursive(child, referrers);
}