public override SiteMapNodeCollection GetChildNodes(SiteMapNode node)
        {
            SiteMapNodeCollection nodes = new SiteMapNodeCollection();

            if (Directory.Exists(node.Key))
            {
                foreach (string path in Directory.GetDirectories(node.Key))
                {
                    if (filter.ShowDirectory(path))
                    {
                        nodes.Add(directoryFactory.CreateNodeFromPath(path));
                    }
                }

                foreach (string path in Directory.GetFiles(node.Key))
                {
                    if (filter.ShowFile(path))
                    {
                        nodes.Add(fileFactory.CreateNodeFromPath(path));
                    }
                }
            }

            return(nodes);
        }
        public SiteMapNodeCollection ObtenerPrimerGeneracion(SiteMapNode nodoPadre)
        {
            var hijos      = nodoPadre.ChildNodes;
            var listaHijos = new SiteMapNodeCollection();

            foreach (var hijoObj in hijos)
            {
                var hijo = (SiteMapNode)hijoObj;
                if (hijo.ParentNode != nodoPadre)
                {
                    continue;
                }
                if (!hijo.Url.Contains("javascript"))
                {
                    var url         = hijo.Url.Split('/');
                    var accion      = url[2];
                    var controlador = url[1];
                    if (SesionUsuario.PermitirMenu(accion, controlador))
                    {
                        listaHijos.Add(hijo);
                    }
                }
                else
                {
                    listaHijos.Add(hijo);
                }
            }
            return(listaHijos);
        }
        //Get the existing collection of site nodes
        public override SiteMapNodeCollection GetChildNodes(SiteMapNode node)
        {
            //Store the node passed to the method and the current node and PortalSiteMapNodes
            PortalSiteMapNode pNode       = node as PortalSiteMapNode;
            PortalSiteMapNode currentNode = CurrentNode as PortalSiteMapNode;

            if ((pNode != null) && (currentNode != null))
            {
                //Check that we the node passed in is a SharePoint Site (SPWeb)
                if (pNode.Type == NodeTypes.Area)
                {
                    //Get the site's node collection
                    SiteMapNodeCollection nodeCollection = base.GetChildNodes(pNode);
                    //Create two new nodes
                    PortalSiteMapNode newChildNode1 = new PortalSiteMapNode(currentNode.WebNode, "customnodemsdn", NodeTypes.Custom, "http://msdn.microsoft.com", "MSDN", "Microsoft Solution Developer Network");
                    PortalSiteMapNode newChildNode2 = new PortalSiteMapNode(currentNode.WebNode, "customnodetechnet", NodeTypes.Custom, "http://technet.microsoft.com", "TechNet", "Microsoft IT Pro documentation");
                    //Add them
                    nodeCollection.Add(newChildNode1);
                    nodeCollection.Add(newChildNode2);
                    //Return the collection
                    return(nodeCollection);
                }
                else
                {
                    //The node passed into this method is not a SharePoint site so we take no action
                    return(base.GetChildNodes(pNode));
                }
            }
            else
            {
                //Couldn't find either the node passed in or the current node. Return an empty collection
                return(new SiteMapNodeCollection());
            }
        }
Exemple #4
0
        public override SiteMapNodeCollection GetChildNodes(SiteMapNode node)
        {
            PortalSiteMapNode pNode = node as PortalSiteMapNode;

            if (pNode != null)
            {
                if (pNode.Type == NodeTypes.Area && pNode.WebId == SPContext.Current.Site.RootWeb.ID)
                {
                    SiteMapNodeCollection nodeColl  = base.GetChildNodes(pNode);
                    SiteMapNode           childNode = new SiteMapNode(this,
                                                                      "<http://www.google.com>", "http://www.google.com",
                                                                      "Google");

                    SiteMapNode childNode1 = new SiteMapNode(this,
                                                             "<http://www.bing.com>",
                                                             "http://www.bing.com", "Bing");
                    SiteMapNode childNode2 = new SiteMapNode(this,
                                                             "<http://www.hardocp.com>",
                                                             "http://www.hardocp.com", "hardocp");

                    nodeColl.Add(childNode);

                    SiteMapNodeCollection test = new SiteMapNodeCollection();
                    test.Add(childNode1);
                    test.Add(childNode2);
                    childNode.ChildNodes = test;



                    return(nodeColl);
                }
                return(base.GetChildNodes(pNode));
            }
            return(new SiteMapNodeCollection());
        }
Exemple #5
0
        public override SiteMapNodeCollection GetChildNodes(SiteMapNode node)
        {
            SiteMapNodeCollection siteMapNodes = new SiteMapNodeCollection();
            // cast from .net node to portalnode
            PortalSiteMapNode portalNode = node as PortalSiteMapNode;

            // check it
            if (portalNode == null)
            {
                return(siteMapNodes);
            }
            TaxonomySession taxonomySession = new TaxonomySession(SPContext.Current.Site);
            TermStore       termStore       = taxonomySession.TermStores[0];
            Group           termGroup       = termStore.Groups["BeckyTermGroup"];
            TermSet         termSet         = termGroup.TermSets["BeckyTermSet"];

            // root
            if (node.Key.ToLower() == SPContext.Current.Web.ServerRelativeUrl.ToLower())
            {
                foreach (var term in termSet.Terms)
                {
                    siteMapNodes.Add(SetNavNode(portalNode, term));
                }
            }
            else
            {
                var subTerm = termSet.GetTerm(new Guid(node.Key));
                foreach (var term in subTerm.Terms)
                {
                    siteMapNodes.Add(SetNavNode(portalNode, term));
                }
            }

            return(siteMapNodes);
        }
Exemple #6
0
        private void LoadBreadCrumb()
        {
            SiteMapProvider       siteMapProvider = SiteMap.Providers["cms"];
            SiteMapNodeCollection collection      = new SiteMapNodeCollection();
            string stt2s = siteMapProvider.RootNode.Title;

            SiteMapNode currentNode = siteMapProvider.CurrentNode;

            if (currentNode == null)
            {
                currentNode = siteMapProvider.RootNode;
            }

            string stts  = currentNode.Url;
            string stt1s = Page.Request.Url.AbsolutePath;

            if (string.Compare(currentNode.Url, Page.Request.Url.AbsolutePath, true) == 0)
            {
                collection.Add(currentNode);
            }

            while (currentNode.ParentNode != null)
            {
                currentNode = currentNode.ParentNode;
                collection.Add(currentNode);
            }

            StringBuilder html = new StringBuilder();

            html.Append("<ul class='page-breadcrumb breadcrumb'>");

            for (int count = collection.Count - 1; count > -1; count--)
            {
                string title = collection[count].Title;

                if (count == 0)
                {
                    if ((collection[count].Url == "/Admin/UserRoles.aspx"))
                    {
                        html.AppendFormat("<li>{1}</li>", collection[count].Url, title);
                    }
                    else
                    {
                        html.AppendFormat("<li><a href=\"{0}\">{1}</a></li>", collection[count].Url, title);
                    }
                }
                else if (count == collection.Count - 1)
                {
                    html.AppendFormat("<li><i class=\"icon-home\"></i><a href=\"{0}\">Home</a> <i class='fa fa-angle-right'></i></li>", collection[count].Url);
                }
                else
                {
                    html.AppendFormat("<li><a href=\"{0}\">{1}</a><i class='fa fa-angle-right'></i></li>", collection[count].Url, title);
                }
            }

            html.Append("</ul>");
            this.ltrlBreadCrumb.Text = html.ToString();
        }
        // Implement the GetChildNodes method.
        public override SiteMapNodeCollection GetChildNodes(SiteMapNode node)
        {
            SiteMapNodeCollection children = new SiteMapNodeCollection();

            // Iterate through the ArrayList and find all nodes that have the specified node as a parent.
            lock (this)
            {
                for (int i = 0; i < childParentRelationship.Count; i++)
                {
                    string nodeUrl = ((DictionaryEntry)childParentRelationship[i]).Key as string;

                    SiteMapNode parent = GetNode(childParentRelationship, nodeUrl);

                    if (parent != null && node.Url == parent.Url)
                    {
                        // The SiteMapNode with the Url that corresponds to nodeUrl
                        // is a child of the specified node. Get the SiteMapNode for
                        // the nodeUrl.
                        SiteMapNode child = FindSiteMapNode(nodeUrl);
                        if (child != null)
                        {
                            children.Add(child as SiteMapNode);
                        }
                        else
                        {
                            throw new Exception("ArrayLists not in sync.");
                        }
                    }
                }
            }
            return(children);
        }
        /// <exclude />
        public override SiteMapNodeCollection GetChildNodes(SiteMapNode node)
        {
            Verify.ArgumentNotNull(node, "node");

            SiteMapNodeCollection childNodes;
            var culture   = ((CompositeC1SiteMapNode)node).Culture;
            var container = GetContainer(culture);

            container.ChildCollectionsMap.TryGetValue(node.Key, out childNodes);

            if (childNodes == null)
            {
                return(SiteMapNodeCollection.ReadOnly(new SiteMapNodeCollection()));
            }

            if (!SecurityTrimmingEnabled)
            {
                return(SiteMapNodeCollection.ReadOnly(childNodes));
            }

            var context    = HttpContext.Current;
            var returnList = new SiteMapNodeCollection(childNodes.Count);

            foreach (SiteMapNode child in childNodes)
            {
                if (child.IsAccessibleToUser(context))
                {
                    returnList.Add(child);
                }
            }

            return(SiteMapNodeCollection.ReadOnly(returnList));
        }
        public override SiteMapNodeCollection GetChildNodes(SiteMapNode node)
        {
            TraceInfo("GetChildNodes({0})", node.Key);

            var children = new SiteMapNodeCollection();

            var entityNode = node as CrmSiteMapNode;

            if (entityNode == null || !entityNode.HasCrmEntityName("adx_webpage"))
            {
                return(children);
            }

            var portal  = PortalContext;
            var context = portal.ServiceContext;
            var website = portal.Website;

            var entity = context.MergeClone(entityNode.Entity);

            var blogs = FindBlogs(context, website, entity);

            foreach (var blog in blogs)
            {
                var blogNode = GetBlogNode(context, blog);

                if (ChildNodeValidator.Validate(context, blogNode))
                {
                    children.Add(blogNode);
                }
            }

            return(children);
        }
Exemple #10
0
        /// <summary>
        /// When overridden in a derived class, retrieves the child nodes of a specific <see cref="T:System.Web.SiteMapNode"></see>.
        /// </summary>
        /// <param name="node">The <see cref="T:System.Web.SiteMapNode"></see> for which to retrieve all child nodes.</param>
        /// <returns>
        /// A read-only <see cref="T:System.Web.SiteMapNodeCollection"></see> that contains the immediate child nodes of the specified <see cref="T:System.Web.SiteMapNode"></see>; otherwise, null or an empty collection, if no child nodes exist.
        /// </returns>
        public override SiteMapNodeCollection GetChildNodes(SiteMapNode node)
        {
            SiteMapNodeCollection col = new SiteMapNodeCollection();

            if (node != null)
            {
                lock (_lock)
                {
                    DataTable dt = GetDataSource();
                    DataView  dv = dt.DefaultView;

                    dv.RowFilter = String.Format("MenuItemId = {0}", node.Key);
                    if (dv.Count > 0)
                    {
                        int    outlineLevel = (int)dv[0]["OutlineLevel"];
                        string outline      = (string)dv[0]["Outline"] + node.Key + ".";
                        dv.RowFilter = String.Format("OutlineLevel = {0} AND Outline LIKE '{1}%' AND IsRoot = 0", outlineLevel + 1, outline);
                        for (int i = 0; i < dv.Count; i++)
                        {
                            col.Add(CreateSiteMapNode(dv[i]));
                        }
                    }
                }
            }

            return(col);
        }
    private void Page_Load(object sender, System.EventArgs e)
    {
// <snippet1>
        // The LoadSiteMapData() method loads site navigation
        // data from persistent storage into a DataTable.
        DataTable siteMap = LoadSiteMapData();

        // Create a SiteMapNodeCollection.
        SiteMapNodeCollection nodes = new SiteMapNodeCollection();

        // Create a SiteMapNode and add it to the collection.
        SiteMapNode tempNode;
        DataRow     row;
        int         index = 0;

        while (index < siteMap.Rows.Count)
        {
            row = siteMap.Rows[index];

            // Create a node based on the data in the DataRow.
            tempNode = new SiteMapNode(SiteMap.Provider,
                                       row["Key"].ToString(),
                                       row["Url"].ToString());

            // Add the node to the collection.
            nodes.Add(tempNode);
            ++index;
        }
// </snippet1>
    }
Exemple #12
0
        public override SiteMapNodeCollection GetChildNodes(System.Web.SiteMapNode
                                                            node)
        {
            PortalSiteMapNode pNode = node as PortalSiteMapNode;

            if (pNode != null)
            {
                if (pNode.Type == NodeTypes.Area)
                {
                    SiteMapNodeCollection nodeColl  = base.GetChildNodes(pNode);
                    SiteMapNode           childNode = new SiteMapNode(this,
                                                                      "<http://www.microsoft.com>", "<http://www.microsoft.com>", "Microsoft");

                    SiteMapNode childNode1 = new SiteMapNode(this,
                                                             "<http://support.microsoft.com>", "<http://support.microsoft.com>", "Support");

                    nodeColl.Add(childNode);

                    SiteMapNodeCollection test = new SiteMapNodeCollection();
                    test.Add(childNode1);
                    childNode.ChildNodes = test;

                    return(nodeColl);
                }
                else
                {
                    return(base.GetChildNodes(pNode));
                }
            }
            else
            {
                return(new SiteMapNodeCollection());
            }
        }
Exemple #13
0
        public override SiteMapNodeCollection GetChildNodes(System.Web.SiteMapNode node)
        {
            PortalSiteMapNode pNode = node as PortalSiteMapNode;

            if (pNode != null)
            {
                if (pNode.Type == NodeTypes.Area)
                {
                    SiteMapNodeCollection nodeColl = new SiteMapNodeCollection();

                    //get and add each node
                    List <MenuItem> menuItems = GetMenuItemsForCurrentUser();
                    //get the top level nodes
                    var topNodes = from m in menuItems where String.IsNullOrEmpty(m.ParentItem) orderby m.SortOrder ascending select m;
                    //add topNodes
                    foreach (MenuItem menu in topNodes)
                    {
                        SiteMapNode cNode = new SiteMapNode(this, menu.Name, menu.URL, menu.Name);
                        cNode.ChildNodes = GetSubNodes(menuItems, menu);
                        nodeColl.Add(cNode);
                    }
                    return(nodeColl);
                }
                else
                {
                    return(base.GetChildNodes(pNode));
                }
            }
            else
            {
                return(new SiteMapNodeCollection());
            }
        }
        public override SiteMapNodeCollection GetChildNodes(SiteMapNode node)
        {
            if (node.Title == "Quick launch" || node.Title == "Top Nav")
            {
                List <int>            appGlobalNodeIds = null;
                SiteMapNodeCollection result           = new SiteMapNodeCollection();
                SiteMapNodeCollection childNodes       = base.GetChildNodes(node);

                //if (HttpContext.Current.Request.Cookies["CurrentAppId_" + _webId.ToString("N")] != null)
                //{
                //    HttpCookie cookieAppId = HttpContext.Current.Request.Cookies["CurrentAppId_" + _webId.ToString("N")];
                //    int id = -1;
                //    try
                //    {
                //        id = int.Parse(cookieAppId.Value);
                //    }
                //    catch { }
                //    if (id != -1)
                //    {
                //        appHelper.CurrentAppId = id;
                //        appHelper.VerifyCookieId();
                //    }

                //}
                //else
                //{
                //    appHelper.GetMyCurrentAppId();
                //}

                appHelper.GetMyCurrentAppId();

                if (appHelper.CurrentAppId != -1)
                {
                    appGlobalNodeIds = appHelper.TryGetMyAppGlobalNodes();

                    if (appGlobalNodeIds != null && appGlobalNodeIds.Count > 0)
                    {
                        foreach (SiteMapNode childNode in childNodes)
                        {
                            if (CanShowChildNode(childNode, appGlobalNodeIds))
                            {
                                result.Add(childNode);
                            }
                        }
                    }

                    return(result);
                }
                else
                {
                    return(base.GetChildNodes(node));
                }
            }
            else
            {
                return(base.GetChildNodes(node));
            }
        }
Exemple #15
0
        private SiteMapNodeCollection FindChildNodes(SiteMapNode node)
        {
            var nodes = new SiteMapNodeCollection();

            PopulateCommunityLinks();

            if (node.Title.Equals("Quick launch"))
            {
                foreach (var community in _communityLinks.OrderBy(c => c.Key))
                {
                    string title = community.Key;
                    if (title.Contains(";"))
                    {
                        title = title.Split(';')[1];
                    }

                    nodes.Add(new SiteMapNode(this, community.Key)
                    {
                        Title = title
                    });
                }

                var orderedNodes = nodes.Cast <SiteMapNode>().OrderBy(n => n.Title);

                var collection = new SiteMapNodeCollection(orderedNodes.ToArray());

                return(nodes);
            }

            if (!_communityLinks.ContainsKey(node.Key))
            {
                return(base.GetChildNodes(node));
            }

            foreach (string nodeKey in _communityLinks[node.Key])
            {
                try
                {
                    nodes.Add(_linkNodes[nodeKey]);
                }
                catch { }
            }

            return(nodes);
        }
Exemple #16
0
        // Implement the GetChildNodes method.
        public override SiteMapNodeCollection GetChildNodes(SiteMapNode node)
        {
            // pid
            string pid = node.Key;

            SiteMapNodeCollection children = new SiteMapNodeCollection();

            if (PortalConfiguration.Site.Pages.ContainsKey(pid))
            {
                // fill collection
                foreach (PortalPage page in PortalConfiguration.Site.Pages[pid].Pages)
                {
                    if (page.Hidden)
                    {
                        continue;
                    }

                    SiteMapNode childNode = CreateNodeFromPage(page);
                    if (childNode != null)
                    {
                        children.Add(childNode);
                    }
                }
            }
            else
            {
                // check if this is a root node
                if (node.Key == ROOT_NODE_KEY)
                {
                    foreach (PortalPage page in PortalConfiguration.Site.Pages.Values)
                    {
                        if (page.ParentPage == null && !page.Hidden)
                        {
                            SiteMapNode childNode = CreateNodeFromPage(page);
                            if (childNode != null)
                            {
                                children.Add(childNode);
                            }
                        }
                    }
                }
            }
            return(children);
        }
        public override SiteMapNodeCollection GetChildNodes(SiteMapNode node)
        {
            SiteMapNodeCollection nodes = new SiteMapNodeCollection();

            foreach (string topic in DocSiteNavigator.GetSubTopics(node.Key))
            {
                nodes.Add(CreateSiteMapNode(topic));
            }

            return(nodes);
        }
Exemple #18
0
        /// <summary>
        /// When overridden in a derived class, retrieves the child nodes of a specific <see cref="T:System.Web.SiteMapNode"></see>.
        /// </summary>
        /// <param name="node">
        /// The <see cref="T:System.Web.SiteMapNode"></see> for which to retrieve all child nodes.
        /// </param>
        /// <returns>
        /// A read-only <see cref="T:System.Web.SiteMapNodeCollection"></see> that contains the immediate child nodes of the specified <see cref="T:System.Web.SiteMapNode"></see>; otherwise, null or an empty collection, if no child nodes exist.
        /// </returns>
        public override SiteMapNodeCollection GetChildNodes(SiteMapNode node)
        {
            var col = new SiteMapNodeCollection();
            var id  = new Guid(node.Key);

            foreach (var page in Page.Pages.Where(page => page.IsVisible && page.Parent == id && page.ShowInList))
            {
                col.Add(new SiteMapNode(this, page.Id.ToString(), page.RelativeLink, page.Title, page.Description));
            }

            return(col);
        }
Exemple #19
0
            protected override HierarchicalDataSourceView GetHierarchicalView(string viewPath)
            {
                SiteMapNode root    = Provider.RootNode;
                SiteMapNode newRoot = root.Clone();

                newRoot.ChildNodes = new SiteMapNodeCollection();
                SiteMapNodeCollection collection = new SiteMapNodeCollection();

                collection.Add(newRoot);
                collection.AddRange(root.ChildNodes);

                return(new SiteMapHierarchicalDataSourceView(collection));
            }
Exemple #20
0
        public SiteMapNodeCollection GetSubNodes(List <MenuItem> menuItems, MenuItem currentMenu)
        {
            //add child nodes
            var subNodes = from m in menuItems where String.Compare(m.ParentItem.Trim(), currentMenu.Name.Trim(), false) == 0 orderby m.SortOrder ascending select m;
            SiteMapNodeCollection childNodecollection = new SiteMapNodeCollection();

            foreach (MenuItem menu in subNodes)
            {
                SiteMapNode subNodeItem = new SiteMapNode(this, menu.Name, menu.URL, menu.Name);
                subNodeItem.ChildNodes = GetSubNodes(menuItems, menu);
                childNodecollection.Add(subNodeItem);
            }
            return(childNodecollection);
        }
Exemple #21
0
        /// <summary>
        /// EPML-4667 : used to change the url of child node based on viewpermission settings.
        /// </summary>
        /// <param name="spWeb">spWeb</param>
        /// <param name="node">node</param>
        /// <returns>SiteMapNodeCollection</returns>
        private SiteMapNodeCollection ChangeChildNodeLink(SPWeb spWeb, SiteMapNode node)
        {
            SiteMapNodeCollection spChildNavCol = base.GetChildNodes(node);
            SiteMapNodeCollection nodeCol       = new SiteMapNodeCollection();

            foreach (SiteMapNode cnode in spChildNavCol)
            {
                SiteMapNode currNode = FindSiteMapNodeFromKey(cnode.Key);

                currNode = ChangeNodeLink(spWeb, cnode);
                nodeCol.Add(currNode);
            }
            return(nodeCol);
        }
Exemple #22
0
        /// <summary>
        /// Render the HTML for the contents of the this.Control.
        /// </summary>
        /// <param name="writer">Containing methods to build and render the device-specific output.</param>
        protected override void RenderContents(HtmlTextWriter writer)
        {
            writer.Indent++;
            SiteMapPath item = (SiteMapPath)Control;

            SiteMapProvider       provider   = ((System.Web.UI.WebControls.SiteMapPath)Control).Provider;
            SiteMapNodeCollection collection = new SiteMapNodeCollection();
            SiteMapNode           node       = provider.CurrentNode;

            if (node != null)
            {
                collection.Add(node);
                while (node != provider.CurrentNode.RootNode)
                {
                    node = node.ParentNode;
                    collection.Add(node);
                }
            }

            this.BuildItems(collection, true, writer);

            writer.Indent--;
            writer.WriteLine();
        }
        /// <summary>
        /// When overridden in a derived class, retrieves the child nodes of a specific <see cref="T:System.Web.SiteMapNode"></see>.
        /// </summary>
        /// <param name="node">The <see cref="T:System.Web.SiteMapNode"></see> for which to retrieve all child nodes.</param>
        /// <returns>
        /// A read-only <see cref="T:System.Web.SiteMapNodeCollection"></see> that contains the immediate child nodes of the specified <see cref="T:System.Web.SiteMapNode"></see>; otherwise, null or an empty collection, if no child nodes exist.
        /// </returns>
        public override SiteMapNodeCollection GetChildNodes(SiteMapNode node)
        {
            lock (this)
            {
                SiteMapNodeCollection col = new SiteMapNodeCollection();

                if (node == _RootNode)// root node
                {
                    CatalogNodes nodes = CatalogContext.Current.GetCatalogNodes(CatalogName);
                    if (nodes.CatalogNode != null && nodes.CatalogNode.Length > 0)
                    {
                        foreach (CatalogNode row in nodes.CatalogNode)
                        {
                            col.Add(CreateSiteMapNode(row));
                        }
                    }
                }
                else if (node.Key.IndexOf("c_", 0) == 0)
                {
                    string[] keys          = node.Key.Substring("c_".Length).Split('_');
                    int      catalogNodeId = Int32.Parse(keys[0]);
                    int      parentNodeId  = Int32.Parse(keys[1]);
                    int      catalogId     = Int32.Parse(keys[2]);

                    CatalogNodes nodes = CatalogContext.Current.GetCatalogNodes(catalogId, catalogNodeId);
                    if (nodes.CatalogNode != null && nodes.CatalogNode.Length > 0)
                    {
                        foreach (CatalogNode row in nodes.CatalogNode)
                        {
                            col.Add(CreateSiteMapNode(row));
                        }
                    }
                }
                return(col);
            }
        }
Exemple #24
0
        /// <summary>
        /// When overridden in a derived class, retrieves the child nodes of a specific <see cref="T:System.Web.SiteMapNode"></see>.
        /// </summary>
        /// <param name="node">The <see cref="T:System.Web.SiteMapNode"></see> for which to retrieve all child nodes.</param>
        /// <returns>
        /// A read-only <see cref="T:System.Web.SiteMapNodeCollection"></see> that contains the immediate child nodes of the specified <see cref="T:System.Web.SiteMapNode"></see>; otherwise, null or an empty collection, if no child nodes exist.
        /// </returns>
        public override SiteMapNodeCollection GetChildNodes(SiteMapNode node)
        {
            SiteMapNodeCollection col = new SiteMapNodeCollection();
            Guid id = new Guid(node.Key);

            foreach (Page page in Page.Pages)
            {
                if ((page.IsVisible) && page.Parent == id && page.ShowInList)
                {
                    col.Add(new SiteMapNode(this, page.Id.ToString(), page.RelativeLink.ToString(), page.Title, page.Description));
                }
            }

            return(col);
        }
        public override SiteMapNodeCollection GetChildNodes(SiteMapNode node)
        {
            SiteMapNodeCollection nodes = new SiteMapNodeCollection();
            ContentItem           item  = (node != null) ? Context.Persister.Get(int.Parse(node.Key)) : null;

            // Add published nodes that are pages
            if (item != null)
            {
                foreach (ContentItem child in item.GetChildPagesUnfiltered().Where(GetFilter()))
                {
                    nodes.Add(Convert(child));
                }
            }

            return(nodes);
        }
        public override SiteMapNodeCollection GetChildNodes(SiteMapNode node)
        {
            var q = list.Where(m => m.ParentId.ToString() == node.Key);

            if (q == null || q.Count() == 0)
            {
                return(null);
            }
            SiteMapNodeCollection smnc = new SiteMapNodeCollection();

            foreach (var item in q)
            {
                smnc.Add(new SiteMapNode(this, item.Id.ToString(), item.Url, item.Title, item.Descr));
            }

            return(smnc);
        }
Exemple #27
0
        public override SiteMapNodeCollection GetChildNodes(SiteMapNode node)
        {
            SiteMapNodeCollection nodeCollection = new SiteMapNodeCollection();

            foreach (KeyValuePair <string, SiteMapNode> smNode in siteMapTable)
            {
                // Exclude root node
                if (smNode.Value.ParentNode != null)
                {
                    if (smNode.Value.ParentNode == node)
                    {
                        nodeCollection.Add(smNode.Value);
                    }
                }
            }
            return(nodeCollection);
        }
Exemple #28
0
        public override SiteMapNodeCollection GetChildNodes(SiteMapNode node)
        {
            var col  = new SiteMapNodeCollection();
            var id   = int.Parse(node.Key);
            var list = AdminUserController.GetCurrentAdminUser().Pages;

            if (list != null)
            {
                foreach (AdminPageInfo page in list)
                {
                    if (page.Visible && page.ParentID == id)
                    {
                        col.Add(new SiteMapNode(this, page.AdminPageID.ToString(), (page.Source == Null.NullString ? "" : ("~" + page.Link)), page.Name));
                    }
                }
            }
            return(col);
        }
        public override SiteMapNodeCollection GetChildNodes(SiteMapNode node)
        {
            ULSLog2013.LogMessage("Child Nodes was called");



            SiteMapNodeCollection test = new SiteMapNodeCollection();

            SPSecurity.RunWithElevatedPrivileges(delegate()
            {
                try
                {
                    using (SPSite site = new SPSite(SPContext.Current.Site.ID))
                    {
                        using (SPWeb web = site.RootWeb)
                        {
                            SPList nav = web.Lists["Navigation"];

                            ULSLog2013.LogMessage("Found our list:" + nav.Title);
                            SPQuery sPQuery            = new SPQuery();
                            sPQuery.Query              = "<OrderBy><FieldRef Name='LinkOrder' Ascending='True' /><FieldRef Name='Title' Ascending='True' /></OrderBy><Where><IsNull><FieldRef Name='ParentKey' /></IsNull></Where>";
                            SPListItemCollection items = nav.GetItems(sPQuery);

                            foreach (SPListItem item in items)
                            {
                                SiteMapNode smNode = new SiteMapNode(this, item["Key"].ToString(), item["LinkURL"].ToString(), item["Title"].ToString());
                                test.Add(smNode);

                                string str = item["Key"].ToString();
                                SetChildNodes(str, smNode, nav);
                            }
                            ULSLog2013.LogMessage("We got this many items:" + items.Count.ToString());
                        }
                    }
                }
                catch (Exception ex)
                {
                    ULSLog2013.LogError(ex, "finding list");
                }
            });

            return(test);
        }
        public override SiteMapNodeCollection GetChildNodes(SiteMapNode node)
        {
            //SPListItem item = siteMap.Items[new Guid(node.Key)];
            WebSiteNode websitenode = (WebSiteNode)nodes[node.Key];

            if (websitenode != null && websitenode.HasChildren())
            {
                SiteMapNodeCollection childeren = new SiteMapNodeCollection();
                foreach (WebSiteNode childNode in websitenode.Children)
                {
                    childeren.Add(new SiteMapNode(this, childNode.Key, childNode.Url, childNode.Title, childNode.Description));
                }
                return(childeren);
            }
            else
            {
                return(null);
            }
        }
    protected override void RenderContents(HtmlTextWriter writer)
    {
        SiteMapPath path = Control as SiteMapPath;
        SiteMapProvider Provider = ((SiteMapPath)(Control)).Provider;

        SiteMapNodeCollection collection = new SiteMapNodeCollection();
        SiteMapNode node = Provider.CurrentNode;
        while(node != null && node != Provider.RootNode)
        {
            collection.Add(node);
            node = node.ParentNode;
        }

        for (int i = collection.Count - 1; i > 0; i--)
        {
            RenderSiteMapNode(writer, path, collection[i]);
            writer.Write(" " + path.PathSeparator + " ");
        }
        if (collection.Count > 0)
        {
            RenderSiteMapNode(writer, path, collection[0]);
        }
    }
Exemple #32
0
    // Implement the GetChildNodes method.
    public override SiteMapNodeCollection GetChildNodes(SiteMapNode node)
    {
        SiteMapNodeCollection children = new SiteMapNodeCollection();
        int nodeID = int.Parse(node.Key);

        // Iterate through the ArrayList and find all nodes that have the specified node as a parent.
        lock (this)
        {
            if (nodeID > 0)
            {
                for (int i = 0; i < childParentRelationship.Count; i++)
                {
                    DictionaryEntry item = (DictionaryEntry)childParentRelationship[i];
                    int pid = (int)item.Value;
                    if (pid == nodeID)
                    {
                        // The SiteMapNode with the Url that corresponds to nodeUrl
                        // is a child of the specified node. Get the SiteMapNode for
                        // the nodeUrl.
                        int cid = (int)item.Key;
                        SiteMapNode child = GetNodeByID(cid);
                        if (child != null)
                        {
                            children.Add(child as SiteMapNode);
                        }
                        else
                        {
                            throw new Exception("ArrayLists not in sync.");
                        }
                    }
                }
            }
        }
        return children;
    }