Beispiel #1
0
        protected override void CreateChildControls()
        {
            ItemFilter[] filters = GetFilters();
            Web.Tree     t       = N2.Web.Tree.From(RootItem)
                                   .OpenTo(CurrentItem).Filters(filters)
                                   .LinkWriter((n, w) => BuildLink(n.Current, CurrentItem, Target).WriteTo(w));
            Control ul = t.ToControl();

            Controls.Add(ul);

            for (int i = 0; i < icons.Count; i++)
            {
                Page.ClientScript.RegisterArrayDeclaration("icons", string.Format("'{0}'", icons[i]));
            }

            base.CreateChildControls();
        }
        private static void ClassifyAnchors(ContentItem startsFrom, ContentItem current, bool parallelRoot, Web.Tree tree)
        {
            var ancestors = N2.Find.ListParents(current, startsFrom, true);

            if (parallelRoot && ancestors.Contains(startsFrom))
            {
                ancestors.Remove(startsFrom);
            }

            tree.LinkWriter((n, w) => n.Current.Link().Class(n.Current == current ? "current" : ancestors.Contains(n.Current) ? "trail" : "").WriteTo(w));
        }