本文整理汇总了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);
}
}
}
示例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);
}
}
}
示例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);
}
}
}