protected virtual SPNavigationNode LookupNavigationNode(SPNavigationNodeCollection nodes, NavigationNodeDefinitionBase definition)
        {
            var currentNode = nodes
                              .OfType <SPNavigationNode>()
                              .FirstOrDefault(n => !string.IsNullOrEmpty(n.Title) && (n.Title.ToUpper() == definition.Title.ToUpper()));

            if (currentNode == null)
            {
                currentNode = nodes
                              .OfType <SPNavigationNode>()
                              .FirstOrDefault(n => !string.IsNullOrEmpty(n.Url) && (n.Url.ToUpper().EndsWith(definition.Url.ToUpper())));
            }

            return(currentNode);
        }
        public ArrayInstance ToArray()
        {
            var result = Engine.Array.Construct();

            foreach (var navigationNode in m_navigationNodeCollection.OfType <SPNavigationNode>())
            {
                ArrayInstance.Push(result, new SPNavigationNodeInstance(Engine.Object.InstancePrototype, navigationNode));
            }
            return(result);
        }
예제 #3
0
        protected virtual SPNavigationNode LookupNavigationNode(SPNavigationNodeCollection nodes, NavigationNodeDefinitionBase definition)
        {
            var currentNode = nodes
                              .OfType <SPNavigationNode>()
                              .FirstOrDefault(n => !string.IsNullOrEmpty(n.Title) && (n.Title.ToUpper() == definition.Title.ToUpper()));

            if (currentNode == null)
            {
                var url = ResolveTokenizedUrl(CurrentWebModelHost, definition);

                url = HttpUtility.UrlDecode(url);

                currentNode = nodes
                              .OfType <SPNavigationNode>()
                              .FirstOrDefault(n => !string.IsNullOrEmpty(n.Url) && (n.Url.ToUpper().EndsWith(url.ToUpper())));
            }

            return(currentNode);
        }
        public virtual void DeleteNodesByMatch(DeleteNavigationNodesDefinitionBase typedDefinition,
                                               SPNavigationNodeCollection nodesCollection,
                                               Func <string, string> resolveTokenizedUrlAction)
        {
            var allNodes = nodesCollection.OfType <SPNavigationNode>()
                           .ToArray();

            var nodesToDelete = FindMatches(allNodes, typedDefinition, resolveTokenizedUrlAction);

            if (nodesToDelete.Any())
            {
                foreach (var node in nodesToDelete.ToArray())
                {
                    node.Delete();
                }
            }
        }
        public virtual void DeleteNodesByMatch(DeleteNavigationNodesDefinitionBase typedDefinition,
            SPNavigationNodeCollection nodesCollection,
            Func<string, string> resolveTokenizedUrlAction)
        {
            var allNodes = nodesCollection.OfType<SPNavigationNode>()
                                             .ToArray();

            var nodesToDelete = FindMatches(allNodes, typedDefinition, resolveTokenizedUrlAction);

            if (nodesToDelete.Any())
            {
                foreach (var node in nodesToDelete.ToArray())
                {
                    node.Delete();
                }
            }
        }