コード例 #1
0
        public TemplateUsageResult(
            CmsTreeNode page,
            IEnumerable <CmsSite> sites
            )
        {
            SiteName = sites
                       .FirstOrDefault(site => site.SiteId == page.NodeSiteID)
                       .SiteName;

            DocumentName           = page.DocumentName;
            NodeID                 = page.NodeID;
            NodeAliasPath          = page.NodeAliasPath;
            DocumentCulture        = page.DocumentCulture;
            NodeSiteID             = page.NodeSiteID;
            DocumentPageTemplateID = page.DocumentPageTemplateID;
        }
コード例 #2
0
ファイル: CmsTreeService.cs プロジェクト: Q42/DynamicDataCMS
        public async Task <CmsTreeNode> CreateOrUpdateCmsTreeNodeForSlug(string cmsTreeType, string slug, CmsTreeNode node, string?lang, string?currentUser)
        {
            var document = await GetCmsTreeItem(cmsTreeType, lang).ConfigureAwait(false);

            List <string> slugParts = GetSlugList(slug);

            var all = document.Nodes;

            // Add empty nodes to support full structure
            List <Guid?> nodeTreeIds = new List <Guid?>();

            foreach (var part in slugParts)
            {
                var lastNode = nodeTreeIds.LastOrDefault();

                var current = all.FirstOrDefault(x => x.Name == part && x.ParentId == lastNode);
                if (current == null)
                {
                    current = new CmsTreeNode
                    {
                        Name     = part,
                        ParentId = lastNode
                    };
                    all.Add(current);
                }

                nodeTreeIds.Add(current.NodeId);
            }


            var existing = all.Where(x => x.GetSlug(all) == slug).FirstOrDefault();

            if (existing != null)
            {
                document.Nodes.Remove(existing);
            }

            if (nodeTreeIds.Count > 1)
            {
                node.ParentId = nodeTreeIds[^ 2];
コード例 #3
0
 public ListTreeItemViewModel(CmsTreeNode node, ListTreeViewModel pageModel, bool hideChildNodes = false)
 {
     Node           = node;
     PageModel      = pageModel;
     HideChildNodes = hideChildNodes;
 }