mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-12-02 19:44:02 +08:00
Backed out changeset: 48ce2450dca2
--HG-- branch : 1.x
This commit is contained in:
@@ -351,9 +351,7 @@ namespace Orchard.ContentManagement {
|
|||||||
return criteria.GetCriteriaByPath(segment) ?? criteria.CreateCriteria(segment, JoinType.LeftOuterJoin);
|
return criteria.GetCriteriaByPath(segment) ?? criteria.CreateCriteria(segment, JoinType.LeftOuterJoin);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Publish(IContent content) {
|
public virtual void Publish(ContentItem contentItem) {
|
||||||
var contentItem = content.ContentItem;
|
|
||||||
|
|
||||||
if (contentItem.VersionRecord.Published) {
|
if (contentItem.VersionRecord.Published) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -376,8 +374,7 @@ namespace Orchard.ContentManagement {
|
|||||||
Handlers.Invoke(handler => handler.Published(context), Logger);
|
Handlers.Invoke(handler => handler.Published(context), Logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Unpublish(IContent content) {
|
public virtual void Unpublish(ContentItem contentItem) {
|
||||||
var contentItem = content.ContentItem;
|
|
||||||
ContentItem publishedItem;
|
ContentItem publishedItem;
|
||||||
if (contentItem.VersionRecord.Published) {
|
if (contentItem.VersionRecord.Published) {
|
||||||
// the version passed in is the published one
|
// the version passed in is the published one
|
||||||
@@ -385,7 +382,7 @@ namespace Orchard.ContentManagement {
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// try to locate the published version of this item
|
// try to locate the published version of this item
|
||||||
publishedItem = Get(content.Id, VersionOptions.Published);
|
publishedItem = Get(contentItem.Id, VersionOptions.Published);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (publishedItem == null) {
|
if (publishedItem == null) {
|
||||||
@@ -407,9 +404,9 @@ namespace Orchard.ContentManagement {
|
|||||||
Handlers.Invoke(handler => handler.Unpublished(context), Logger);
|
Handlers.Invoke(handler => handler.Unpublished(context), Logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Remove(IContent content) {
|
public virtual void Remove(ContentItem contentItem) {
|
||||||
var activeVersions = _contentItemVersionRepository.Fetch(x => x.ContentItemRecord == content.ContentItem.Record && (x.Published || x.Latest));
|
var activeVersions = _contentItemVersionRepository.Fetch(x => x.ContentItemRecord == contentItem.Record && (x.Published || x.Latest));
|
||||||
var context = new RemoveContentContext(content.ContentItem);
|
var context = new RemoveContentContext(contentItem);
|
||||||
|
|
||||||
Handlers.Invoke(handler => handler.Removing(context), Logger);
|
Handlers.Invoke(handler => handler.Removing(context), Logger);
|
||||||
|
|
||||||
@@ -425,8 +422,7 @@ namespace Orchard.ContentManagement {
|
|||||||
Handlers.Invoke(handler => handler.Removed(context), Logger);
|
Handlers.Invoke(handler => handler.Removed(context), Logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual ContentItem BuildNewVersion(IContent existingContent) {
|
protected virtual ContentItem BuildNewVersion(ContentItem existingContentItem) {
|
||||||
var existingContentItem = existingContent.ContentItem;
|
|
||||||
var contentItemRecord = existingContentItem.Record;
|
var contentItemRecord = existingContentItem.Record;
|
||||||
|
|
||||||
// locate the existing and the current latest versions, allocate building version
|
// locate the existing and the current latest versions, allocate building version
|
||||||
@@ -470,13 +466,11 @@ namespace Orchard.ContentManagement {
|
|||||||
return context.BuildingContentItem;
|
return context.BuildingContentItem;
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Create(IContent content) {
|
public virtual void Create(ContentItem contentItem) {
|
||||||
Create(content, VersionOptions.Published);
|
Create(contentItem, VersionOptions.Published);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void Create(IContent content, VersionOptions options) {
|
public virtual void Create(ContentItem contentItem, VersionOptions options) {
|
||||||
var contentItem = content.ContentItem;
|
|
||||||
|
|
||||||
if (contentItem.VersionRecord == null) {
|
if (contentItem.VersionRecord == null) {
|
||||||
// produce root record to determine the model id
|
// produce root record to determine the model id
|
||||||
contentItem.VersionRecord = new ContentItemVersionRecord {
|
contentItem.VersionRecord = new ContentItemVersionRecord {
|
||||||
@@ -698,8 +692,8 @@ namespace Orchard.ContentManagement {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public XElement Export(IContent content) {
|
public XElement Export(ContentItem contentItem) {
|
||||||
var context = new ExportContentContext(content.ContentItem, new XElement(XmlConvert.EncodeLocalName(content.ContentItem.ContentType)));
|
var context = new ExportContentContext(contentItem, new XElement(XmlConvert.EncodeLocalName(contentItem.ContentType)));
|
||||||
|
|
||||||
foreach (var contentHandler in Handlers) {
|
foreach (var contentHandler in Handlers) {
|
||||||
contentHandler.Exporting(context);
|
contentHandler.Exporting(context);
|
||||||
@@ -709,8 +703,8 @@ namespace Orchard.ContentManagement {
|
|||||||
contentHandler.Exported(context);
|
contentHandler.Exported(context);
|
||||||
}
|
}
|
||||||
|
|
||||||
context.Data.SetAttributeValue("Id", GetItemMetadata(content).Identity.ToString());
|
context.Data.SetAttributeValue("Id", GetItemMetadata(contentItem).Identity.ToString());
|
||||||
if (content.IsPublished()) {
|
if (contentItem.IsPublished()) {
|
||||||
context.Data.SetAttributeValue("Status", Published);
|
context.Data.SetAttributeValue("Status", Published);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@@ -736,8 +730,8 @@ namespace Orchard.ContentManagement {
|
|||||||
return _contentTypeRepository.Get(contentTypeId);
|
return _contentTypeRepository.Get(contentTypeId);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Index(IContent content, IDocumentIndex documentIndex) {
|
public void Index(ContentItem contentItem, IDocumentIndex documentIndex) {
|
||||||
var indexContentContext = new IndexContentContext(content.ContentItem, documentIndex);
|
var indexContentContext = new IndexContentContext(contentItem, documentIndex);
|
||||||
|
|
||||||
// dispatch to handlers to retrieve index information
|
// dispatch to handlers to retrieve index information
|
||||||
Handlers.Invoke(handler => handler.Indexing(indexContentContext), Logger);
|
Handlers.Invoke(handler => handler.Indexing(indexContentContext), Logger);
|
||||||
|
|||||||
@@ -24,14 +24,14 @@ namespace Orchard.ContentManagement {
|
|||||||
/// Creates (persists) a new content item
|
/// Creates (persists) a new content item
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="content">The content instance filled with all necessary data</param>
|
/// <param name="content">The content instance filled with all necessary data</param>
|
||||||
void Create(IContent content);
|
void Create(ContentItem contentItem);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates (persists) a new content item with the specified version
|
/// Creates (persists) a new content item with the specified version
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="content">The content instance filled with all necessary data</param>
|
/// <param name="content">The content instance filled with all necessary data</param>
|
||||||
/// <param name="options">The version to create the item with</param>
|
/// <param name="options">The version to create the item with</param>
|
||||||
void Create(IContent content, VersionOptions options);
|
void Create(ContentItem contentItem, VersionOptions options);
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -65,12 +65,12 @@ namespace Orchard.ContentManagement {
|
|||||||
IEnumerable<T> GetManyByVersionId<T>(IEnumerable<int> versionRecordIds, QueryHints hints) where T : class, IContent;
|
IEnumerable<T> GetManyByVersionId<T>(IEnumerable<int> versionRecordIds, QueryHints hints) where T : class, IContent;
|
||||||
IEnumerable<ContentItem> GetManyByVersionId(IEnumerable<int> versionRecordIds, QueryHints hints);
|
IEnumerable<ContentItem> GetManyByVersionId(IEnumerable<int> versionRecordIds, QueryHints hints);
|
||||||
|
|
||||||
void Publish(IContent content);
|
void Publish(ContentItem contentItem);
|
||||||
void Unpublish(IContent content);
|
void Unpublish(ContentItem contentItem);
|
||||||
void Remove(IContent content);
|
void Remove(ContentItem contentItem);
|
||||||
void Index(IContent content, IDocumentIndex documentIndex);
|
void Index(ContentItem contentItem, IDocumentIndex documentIndex);
|
||||||
|
|
||||||
XElement Export(IContent content);
|
XElement Export(ContentItem contentItem);
|
||||||
void Import(XElement element, ImportContentSession importContentSession);
|
void Import(XElement element, ImportContentSession importContentSession);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -84,11 +84,11 @@ namespace Orchard.ContentManagement {
|
|||||||
IContentQuery<ContentItem> Query();
|
IContentQuery<ContentItem> Query();
|
||||||
IHqlQuery HqlQuery();
|
IHqlQuery HqlQuery();
|
||||||
|
|
||||||
ContentItemMetadata GetItemMetadata(IContent content);
|
ContentItemMetadata GetItemMetadata(IContent contentItem);
|
||||||
IEnumerable<GroupInfo> GetEditorGroupInfos(IContent content);
|
IEnumerable<GroupInfo> GetEditorGroupInfos(IContent contentItem);
|
||||||
IEnumerable<GroupInfo> GetDisplayGroupInfos(IContent content);
|
IEnumerable<GroupInfo> GetDisplayGroupInfos(IContent contentItem);
|
||||||
GroupInfo GetEditorGroupInfo(IContent content, string groupInfoId);
|
GroupInfo GetEditorGroupInfo(IContent contentItem, string groupInfoId);
|
||||||
GroupInfo GetDisplayGroupInfo(IContent content, string groupInfoId);
|
GroupInfo GetDisplayGroupInfo(IContent contentItem, string groupInfoId);
|
||||||
|
|
||||||
ContentItem ResolveIdentity(ContentIdentity contentIdentity);
|
ContentItem ResolveIdentity(ContentIdentity contentIdentity);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user