本文整理汇总了C#中umbraco.cms.businesslogic.web.Document.HasPublishedVersion方法的典型用法代码示例。如果您正苦于以下问题:C# Document.HasPublishedVersion方法的具体用法?C# Document.HasPublishedVersion怎么用?C# Document.HasPublishedVersion使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类umbraco.cms.businesslogic.web.Document
的用法示例。
在下文中一共展示了Document.HasPublishedVersion方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateNode
/// <summary>
/// Creates an XmlTreeNode based on the passed in Document
/// </summary>
/// <param name="dd"></param>
/// <param name="allowedUserOptions"></param>
/// <returns></returns>
protected XmlTreeNode CreateNode(Document dd, List<IAction> allowedUserOptions)
{
XmlTreeNode node = XmlTreeNode.Create(this);
SetMenuAttribute(ref node, allowedUserOptions);
node.NodeID = dd.Id.ToString();
node.Text = dd.Text;
SetNonPublishedAttribute(ref node, dd);
SetProtectedAttribute(ref node, dd);
SetActionAttribute(ref node, dd);
SetSourcesAttributes(ref node, dd);
if (dd.ContentTypeIcon != null)
{
node.Icon = dd.ContentTypeIcon;
node.OpenIcon = dd.ContentTypeIcon;
}
if (dd.HasPublishedVersion() == false)
node.Style.DimNode();
if (dd.HasPendingChanges())
node.Style.HighlightNode();
return node;
}
示例2: OnInit
override protected void OnInit(EventArgs e)
{
base.OnInit(e);
//validate!
int id;
if (int.TryParse(Request.QueryString["id"], out id) == false)
{
//if this is invalid show an error
this.DisplayFatalError("Invalid query string");
return;
}
_contentId = id;
_unPublish.Click += UnPublishDo;
//Loading Content via new public service to ensure that the Properties are loaded correct
var content = ApplicationContext.Current.Services.ContentService.GetById(id);
_document = new Document(content);
//check if the doc exists
if (string.IsNullOrEmpty(_document.Path))
{
//if this is invalid show an error
this.DisplayFatalError("No document found with id " + _contentId);
//reset the content id to null so processing doesn't continue on OnLoad
_contentId = null;
return;
}
// we need to check if there's a published version of this document
_documentHasPublishedVersion = _document.HasPublishedVersion();
// Check publishing permissions
if (base.getUser().GetPermissions(_document.Path).Contains(ActionPublish.Instance.Letter.ToString()) == false)
{
// Check to see if the user has send to publish permissions
if (!base.getUser().GetPermissions(_document.Path).Contains(ActionToPublish.Instance.Letter.ToString()))
{
//If no send to publish permission then revert to NoPublish mode
_canPublish = controls.ContentControl.publishModes.NoPublish;
}
else
{
_canPublish = controls.ContentControl.publishModes.SendToPublish;
}
}
_cControl = new controls.ContentControl(_document, _canPublish, "TabView1");
_cControl.ID = "TabView1";
_cControl.Width = Unit.Pixel(666);
_cControl.Height = Unit.Pixel(666);
// Add preview button
foreach (uicontrols.TabPage tp in _cControl.GetPanels())
{
AddPreviewButton(tp.Menu, _document.Id);
}
plc.Controls.Add(_cControl);
var publishStatus = new PlaceHolder();
if (_documentHasPublishedVersion)
{
_littPublishStatus.Text = ui.Text("content", "lastPublished", base.getUser()) + ": " + _document.VersionDate.ToShortDateString() + " ";
publishStatus.Controls.Add(_littPublishStatus);
if (getUser().GetPermissions(_document.Path).IndexOf("U") > -1)
_unPublish.Visible = true;
else
_unPublish.Visible = false;
}
else
{
_littPublishStatus.Text = ui.Text("content", "itemNotPublished", base.getUser());
publishStatus.Controls.Add(_littPublishStatus);
_unPublish.Visible = false;
}
_unPublish.Text = ui.Text("content", "unPublish", base.getUser());
_unPublish.ID = "UnPublishButton";
_unPublish.Attributes.Add("onClick", "if (!confirm('" + ui.Text("defaultdialogs", "confirmSure", base.getUser()) + "')) return false; ");
publishStatus.Controls.Add(_unPublish);
_publishProps.addProperty(ui.Text("content", "publishStatus", base.getUser()), publishStatus);
// Template
var template = new PlaceHolder();
var DocumentType = new DocumentType(_document.ContentType.Id);
_cControl.PropertiesPane.addProperty(ui.Text("documentType"), new LiteralControl(DocumentType.Text));
//template picker
_cControl.PropertiesPane.addProperty(ui.Text("template"), template);
int defaultTemplate;
//.........这里部分代码省略.........