当前位置: 首页>>代码示例>>C#>>正文


C# Document.GetNodesForPreview方法代码示例

本文整理汇总了C#中umbraco.cms.businesslogic.web.Document.GetNodesForPreview方法的典型用法代码示例。如果您正苦于以下问题:C# Document.GetNodesForPreview方法的具体用法?C# Document.GetNodesForPreview怎么用?C# Document.GetNodesForPreview使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在umbraco.cms.businesslogic.web.Document的用法示例。


在下文中一共展示了Document.GetNodesForPreview方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: PrepareDocument

        public void PrepareDocument(User user, Document documentObject, bool includeSubs)
        {
            _userId = user.Id;

            // clone xml
            XmlContent = (XmlDocument)content.Instance.XmlContent.Clone();

            // inject current document xml
            int parentId = documentObject.Level == 1 ? -1 : documentObject.Parent.Id;
            XmlContent = content.AppendDocumentXml(documentObject.Id, documentObject.Level, parentId, documentObject.ToPreviewXml(XmlContent), XmlContent);

            if (includeSubs)
            {
                foreach (CMSPreviewNode prevNode in documentObject.GetNodesForPreview(true))
                {
                    XmlContent = content.AppendDocumentXml(prevNode.NodeId, prevNode.Level, prevNode.ParentId, XmlContent.ReadNode(XmlReader.Create(new StringReader(prevNode.Xml))), XmlContent);
                }
            }

        }
开发者ID:elrute,项目名称:Triphulcas,代码行数:20,代码来源:PreviewContent.cs

示例2: PrepareDocument

        public void PrepareDocument(User user, Document documentObject, bool includeSubs)
        {
            _userId = user.Id;

            // clone xml
            XmlContent = (XmlDocument)content.Instance.XmlContent.Clone();

            var previewNodes = new List<Document>();

            var parentId = documentObject.Level == 1 ? -1 : documentObject.Parent.Id;

            while (parentId > 0 && XmlContent.GetElementById(parentId.ToString(CultureInfo.InvariantCulture)) == null)
            {
                var document = new Document(parentId);
                previewNodes.Insert(0, document);
                parentId = document.ParentId;
            }

            previewNodes.Add(documentObject);

            foreach (var document in previewNodes)
            {
                //Inject preview xml
                parentId = document.Level == 1 ? -1 : document.Parent.Id;
                var previewXml = document.ToPreviewXml(XmlContent);
                content.AppendDocumentXml(document.Id, document.Level, parentId, previewXml, XmlContent);
            }

            if (includeSubs)
            {
                foreach (var prevNode in documentObject.GetNodesForPreview(true))
                {
                    XmlContent = content.AppendDocumentXml(prevNode.NodeId, prevNode.Level, prevNode.ParentId, XmlContent.ReadNode(XmlReader.Create(new StringReader(prevNode.Xml))), XmlContent);
                }
            }

        }
开发者ID:Jeavon,项目名称:Umbraco-CMS,代码行数:37,代码来源:PreviewContent.cs

示例3: PrepareDocument

        public void PrepareDocument(User user, Document documentObject, bool includeSubs)
        {
            _userId = user.Id;

            // clone xml
            XmlContent = (XmlDocument)content.Instance.XmlContent.Clone();

            var previewNodes = new List<Document>();

            var parentId = documentObject.Level == 1 ? -1 : documentObject.Parent.Id;

            while (parentId > 0 && XmlContent.GetElementById(parentId.ToString(CultureInfo.InvariantCulture)) == null)
            {
                var document = new Document(parentId);
                previewNodes.Insert(0, document);
                parentId = document.ParentId;
            }

            previewNodes.Add(documentObject);

            foreach (var document in previewNodes)
            {
                //Inject preview xml
                parentId = document.Level == 1 ? -1 : document.Parent.Id;
                var previewXml = document.ToPreviewXml(XmlContent);
                if (document.Content.Published == false 
                    && ApplicationContext.Current.Services.ContentService.HasPublishedVersion(document.Id))
                    previewXml.Attributes.Append(XmlContent.CreateAttribute("isDraft"));
                content.AppendDocumentXml(document.Id, document.Level, parentId, previewXml, XmlContent);
            }

            if (includeSubs)
            {
                foreach (var prevNode in documentObject.GetNodesForPreview(true))
                {
                    var previewXml = XmlContent.ReadNode(XmlReader.Create(new StringReader(prevNode.Xml)));
                    if (prevNode.IsDraft)
                        previewXml.Attributes.Append(XmlContent.CreateAttribute("isDraft"));
                    XmlContent = content.AppendDocumentXml(prevNode.NodeId, prevNode.Level, prevNode.ParentId, previewXml, XmlContent);
                }
            }

        }
开发者ID:saciervo,项目名称:Umbraco-CMS,代码行数:43,代码来源:PreviewContent.cs


注:本文中的umbraco.cms.businesslogic.web.Document.GetNodesForPreview方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。