mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Adding an import method to the content manager.
--HG-- branch : dev
This commit is contained in:
@@ -6,7 +6,10 @@ using Orchard.Recipes.Services;
|
|||||||
|
|
||||||
namespace Orchard.ImportExport.RecipeHandlers {
|
namespace Orchard.ImportExport.RecipeHandlers {
|
||||||
public class DataRecipeHandler : IRecipeHandler {
|
public class DataRecipeHandler : IRecipeHandler {
|
||||||
public DataRecipeHandler() {
|
private readonly IOrchardServices _orchardServices;
|
||||||
|
|
||||||
|
public DataRecipeHandler(IOrchardServices orchardServices) {
|
||||||
|
_orchardServices = orchardServices;
|
||||||
Logger = NullLogger.Instance;
|
Logger = NullLogger.Instance;
|
||||||
T = NullLocalizer.Instance;
|
T = NullLocalizer.Instance;
|
||||||
}
|
}
|
||||||
@@ -21,6 +24,10 @@ namespace Orchard.ImportExport.RecipeHandlers {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (var element in recipeContext.RecipeStep.Step.Elements()) {
|
||||||
|
_orchardServices.ContentManager.Import(element);
|
||||||
|
}
|
||||||
|
|
||||||
recipeContext.Executed = true;
|
recipeContext.Executed = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -5,7 +5,6 @@ using System.Xml.Linq;
|
|||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Orchard.ContentManagement;
|
using Orchard.ContentManagement;
|
||||||
using Orchard.ContentManagement.MetaData;
|
using Orchard.ContentManagement.MetaData;
|
||||||
using Orchard.Core.Common.Models;
|
|
||||||
using Orchard.Environment.Descriptor;
|
using Orchard.Environment.Descriptor;
|
||||||
using Orchard.FileSystems.AppData;
|
using Orchard.FileSystems.AppData;
|
||||||
using Orchard.ImportExport.Models;
|
using Orchard.ImportExport.Models;
|
||||||
@@ -159,9 +158,7 @@ namespace Orchard.ImportExport.Services {
|
|||||||
|
|
||||||
private XElement ExportContentItem(ContentItem contentItem) {
|
private XElement ExportContentItem(ContentItem contentItem) {
|
||||||
// Call export handler for the item.
|
// Call export handler for the item.
|
||||||
var element = _orchardServices.ContentManager.Export(contentItem);
|
return _orchardServices.ContentManager.Export(contentItem);
|
||||||
|
|
||||||
return element;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static VersionOptions GetContentExportVersionOptions(VersionHistoryOptions versionHistoryOptions) {
|
private static VersionOptions GetContentExportVersionOptions(VersionHistoryOptions versionHistoryOptions) {
|
||||||
|
@@ -414,6 +414,9 @@ namespace Orchard.ContentManagement {
|
|||||||
return context.Data;
|
return context.Data;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void Import(XElement element) {
|
||||||
|
}
|
||||||
|
|
||||||
public void Flush() {
|
public void Flush() {
|
||||||
_contentItemRepository.Flush();
|
_contentItemRepository.Flush();
|
||||||
}
|
}
|
||||||
|
@@ -22,6 +22,7 @@ namespace Orchard.ContentManagement {
|
|||||||
void Index(ContentItem contentItem, IDocumentIndex documentIndex);
|
void Index(ContentItem contentItem, IDocumentIndex documentIndex);
|
||||||
|
|
||||||
XElement Export(ContentItem contentItem);
|
XElement Export(ContentItem contentItem);
|
||||||
|
void Import(XElement element);
|
||||||
|
|
||||||
void Flush();
|
void Flush();
|
||||||
IContentQuery<ContentItem> Query();
|
IContentQuery<ContentItem> Query();
|
||||||
|
Reference in New Issue
Block a user