本文整理汇总了C#中CMSNode.IsDocument方法的典型用法代码示例。如果您正苦于以下问题:C# CMSNode.IsDocument方法的具体用法?C# CMSNode.IsDocument怎么用?C# CMSNode.IsDocument使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CMSNode
的用法示例。
在下文中一共展示了CMSNode.IsDocument方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Run
public void Run(IWorkflowInstance workflowInstance, IWorkflowRuntime runtime)
{
// Cast to Umbraco worklow instance.
var umbracoWorkflowInstance = (UmbracoWorkflowInstance) workflowInstance;
var count = 0;
var newCmsNodes = new List<int>();
foreach(var nodeId in umbracoWorkflowInstance.CmsNodes)
{
var n = new CMSNode(nodeId);
if(!n.IsDocument()) continue;
var d = new Document(nodeId);
if (!DocumentTypes.Contains(d.ContentType.Id)) continue;
newCmsNodes.Add(nodeId);
count++;
}
umbracoWorkflowInstance.CmsNodes = newCmsNodes;
var transition = (count > 0) ? "contains_docs" : "does_not_contain_docs";
runtime.Transition(workflowInstance, this, transition);
}
示例2: Run
public void Run(IWorkflowInstance workflowInstance, IWorkflowRuntime runtime)
{
// Cast to Umbraco worklow instance.
var umbracoWorkflowInstance = (UmbracoWorkflowInstance) workflowInstance;
foreach(var nodeId in umbracoWorkflowInstance.CmsNodes)
{
var n = new CMSNode(nodeId);
if(!n.IsDocument()) continue;
var d = new Document(nodeId);
d.Publish(User.GetUser(0));
umbraco.library.UpdateDocumentCache(d.Id);
}
runtime.Transition(workflowInstance, this, "done");
}
示例3: GetAttachmentLinks
public virtual string GetAttachmentLinks(IEnumerable<int> attachedNodes)
{
var s = new StringBuilder();
s.Append("<br/><br/>");
var host = HttpContext.Current.Request.Url.Host;
if (HttpContext.Current.Request.Url.Port != 80) host += ":" + HttpContext.Current.Request.Url.Port;
foreach(var nodeId in attachedNodes)
{
var node = new CMSNode(nodeId);
if(node.IsDocument())
{
s.Append(string.Format("{2} ({1}): <a href='http://{0}/umbraco/dialogs/preview.aspx?id={1}'>[" + GlobalisationService.Instance.GetString("preview") + "]</a> ", host, nodeId, node.Text) + Environment.NewLine);
s.Append(string.Format("<a href='http://{0}/umbraco/actions/editContent.aspx?id={1}'>[" + GlobalisationService.Instance.GetString("edit") + "]</a><br/>", host, nodeId) + Environment.NewLine);
} else if(node.IsMedia())
{
s.Append(string.Format("{2} ({1}): <a href='http://{0}/umbraco/dialogs/preview.aspx?id={1}'>{2}</a> ", host, nodeId, node.Text) + Environment.NewLine);
} else
{
s.Append(node.Text + "<br/>" + Environment.NewLine);
}
}
return s.ToString();
}