mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Refactoring ImportExportService:Export
--HG-- branch : dev
This commit is contained in:
@@ -69,12 +69,12 @@ namespace Orchard.ImportExport.Controllers {
|
|||||||
try {
|
try {
|
||||||
UpdateModel(viewModel);
|
UpdateModel(viewModel);
|
||||||
var contentTypesToExport = viewModel.ContentTypes.Where(c => c.IsChecked).Select(c => c.ContentTypeName);
|
var contentTypesToExport = viewModel.ContentTypes.Where(c => c.IsChecked).Select(c => c.ContentTypeName);
|
||||||
var dataExportOptions = new DataExportOptions();
|
var exportOptions = new ExportOptions { ExportMetadata = viewModel.Metadata, ExportSiteSettings = viewModel.SiteSettings };
|
||||||
if (viewModel.Data) {
|
if (viewModel.Data) {
|
||||||
dataExportOptions.ExportData = true;
|
exportOptions.ExportData = true;
|
||||||
dataExportOptions.VersionHistoryOptions = (VersionHistoryOptions)Enum.Parse(typeof(VersionHistoryOptions), viewModel.DataImportChoice, true);
|
exportOptions.VersionHistoryOptions = (VersionHistoryOptions)Enum.Parse(typeof(VersionHistoryOptions), viewModel.DataImportChoice, true);
|
||||||
}
|
}
|
||||||
var exportFile = _importExportService.Export(contentTypesToExport, dataExportOptions, viewModel.Metadata, viewModel.SiteSettings);
|
var exportFile = _importExportService.Export(contentTypesToExport, exportOptions);
|
||||||
Services.Notifier.Information(T("Your export file has been created at <a href=\"{0}\" />", exportFile));
|
Services.Notifier.Information(T("Your export file has been created at <a href=\"{0}\" />", exportFile));
|
||||||
|
|
||||||
return RedirectToAction("Export");
|
return RedirectToAction("Export");
|
||||||
|
|||||||
@@ -1,7 +1,9 @@
|
|||||||
namespace Orchard.ImportExport.Models {
|
namespace Orchard.ImportExport.Models {
|
||||||
public class DataExportOptions {
|
public class ExportOptions {
|
||||||
|
public bool ExportMetadata { get; set; }
|
||||||
public bool ExportData { get; set; }
|
public bool ExportData { get; set; }
|
||||||
public VersionHistoryOptions VersionHistoryOptions { get; set; }
|
public VersionHistoryOptions VersionHistoryOptions { get; set; }
|
||||||
|
public bool ExportSiteSettings { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum VersionHistoryOptions {
|
public enum VersionHistoryOptions {
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="AdminMenu.cs" />
|
<Compile Include="AdminMenu.cs" />
|
||||||
<Compile Include="Controllers\AdminController.cs" />
|
<Compile Include="Controllers\AdminController.cs" />
|
||||||
<Compile Include="Models\DataExportOptions.cs" />
|
<Compile Include="Models\ExportOptions.cs" />
|
||||||
<Compile Include="Permissions.cs" />
|
<Compile Include="Permissions.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
<Compile Include="Services\IImportExportService.cs" />
|
<Compile Include="Services\IImportExportService.cs" />
|
||||||
|
|||||||
@@ -4,7 +4,7 @@ using Orchard.ImportExport.Models;
|
|||||||
namespace Orchard.ImportExport.Services {
|
namespace Orchard.ImportExport.Services {
|
||||||
public interface IImportExportService : IDependency {
|
public interface IImportExportService : IDependency {
|
||||||
void Import(string recipeText);
|
void Import(string recipeText);
|
||||||
string Export(IEnumerable<string> contentTypes, DataExportOptions dataExportOptions, bool exportMetadata, bool exportSettings);
|
string Export(IEnumerable<string> contentTypes, ExportOptions exportOptions);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -33,7 +33,7 @@ namespace Orchard.ImportExport.Services {
|
|||||||
UpdateShell();
|
UpdateShell();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Export(IEnumerable<string> contentTypes, DataExportOptions dataExportOptions, bool exportMetadata, bool exportSettings) {
|
public string Export(IEnumerable<string> contentTypes, ExportOptions exportOptions) {
|
||||||
return String.Empty;
|
return String.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user