mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Merge from dev.
This commit is contained in:
@@ -1,4 +1,8 @@
|
|||||||
FOR %%b in (
|
FOR %%b in (
|
||||||
|
"%VS140COMNTOOLS%..\..\VC\vcvarsall.bat"
|
||||||
|
"%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
|
||||||
|
"%ProgramFiles%\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
|
||||||
|
|
||||||
"%VS120COMNTOOLS%..\..\VC\vcvarsall.bat"
|
"%VS120COMNTOOLS%..\..\VC\vcvarsall.bat"
|
||||||
"%ProgramFiles(x86)%\Microsoft Visual Studio 12.0\VC\vcvarsall.bat"
|
"%ProgramFiles(x86)%\Microsoft Visual Studio 12.0\VC\vcvarsall.bat"
|
||||||
"%ProgramFiles%\Microsoft Visual Studio 12.0\VC\vcvarsall.bat"
|
"%ProgramFiles%\Microsoft Visual Studio 12.0\VC\vcvarsall.bat"
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
var isLatest = contentItem.VersionRecord.Number == eventVersionNumber;
|
var isLatest = contentItem.VersionRecord.Number == eventVersionNumber;
|
||||||
var isRemoved = !contentItem.VersionRecord.Latest && !contentItem.VersionRecord.Published;
|
var isRemoved = !contentItem.VersionRecord.Latest && !contentItem.VersionRecord.Published;
|
||||||
if (isPublishedEvent || isLatest) {
|
if (isPublishedEvent || isLatest) {
|
||||||
@T("{0} of the {1} {2} was {3}.", Html.ActionLink(T("Version {0}", eventVersionNumber).Text, "Detail", "Content", new { area = "Orchard.AuditTrail", id = contentItemId, version = eventVersionNumber }, null), contentType.ToLower(), isRemoved ? "<strong>" + title + "</strong>" : Html.ItemEditLink(title, contentItemId).ToString(), eventPastTense)
|
@T("{0} of the {1} {2} was {3}.", Html.ActionLink(T("Version {0}", eventVersionNumber).Text, "Detail", "Content", new { area = "Orchard.AuditTrail", id = contentItemId, version = eventVersionNumber }, null), contentType.ToLower(), isRemoved ? Html.Raw("<strong>" + title + "</strong>") : Html.ItemEditLink(title, contentItemId), eventPastTense)
|
||||||
}
|
}
|
||||||
else if (isRemoved) {
|
else if (isRemoved) {
|
||||||
@T("The {0} <strong>{1}</strong> was {2}.", contentType.ToLower(), title, eventPastTense)
|
@T("The {0} <strong>{1}</strong> was {2}.", contentType.ToLower(), title, eventPastTense)
|
||||||
|
|||||||
@@ -3,22 +3,22 @@
|
|||||||
|
|
||||||
<configSections>
|
<configSections>
|
||||||
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
||||||
<remove name="host" />
|
<remove name="host"/>
|
||||||
<remove name="pages" />
|
<remove name="pages"/>
|
||||||
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
|
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false"/>
|
||||||
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" />
|
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false"/>
|
||||||
</sectionGroup>
|
</sectionGroup>
|
||||||
</configSections>
|
</configSections>
|
||||||
|
|
||||||
<system.web.webPages.razor>
|
<system.web.webPages.razor>
|
||||||
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=5.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||||
<pages pageBaseType="Orchard.Mvc.ViewEngines.Razor.WebViewPage">
|
<pages pageBaseType="Orchard.Mvc.ViewEngines.Razor.WebViewPage">
|
||||||
<namespaces>
|
<namespaces>
|
||||||
<add namespace="System.Web.Mvc" />
|
<add namespace="System.Web.Mvc"/>
|
||||||
<add namespace="System.Web.Mvc.Ajax" />
|
<add namespace="System.Web.Mvc.Ajax"/>
|
||||||
<add namespace="System.Web.Mvc.Html" />
|
<add namespace="System.Web.Mvc.Html"/>
|
||||||
<add namespace="System.Web.Routing" />
|
<add namespace="System.Web.Routing"/>
|
||||||
<add namespace="System.Web.WebPages" />
|
<add namespace="System.Web.WebPages"/>
|
||||||
<add namespace="System.Linq"/>
|
<add namespace="System.Linq"/>
|
||||||
<add namespace="System.Collections.Generic"/>
|
<add namespace="System.Collections.Generic"/>
|
||||||
<add namespace="Orchard.Mvc.Html"/>
|
<add namespace="Orchard.Mvc.Html"/>
|
||||||
@@ -32,7 +32,7 @@
|
|||||||
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||||
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||||
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
|
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
|
||||||
<add assembly="System.Web.Mvc, Version=5.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
<add assembly="System.Web.Mvc, Version=5.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||||
<add assembly="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
<add assembly="System.Web.WebPages, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
|
||||||
<add assembly="Orchard.Framework"/>
|
<add assembly="Orchard.Framework"/>
|
||||||
<add assembly="Orchard.Core"/>
|
<add assembly="Orchard.Core"/>
|
||||||
@@ -41,4 +41,20 @@
|
|||||||
</compilation>
|
</compilation>
|
||||||
</system.web>
|
</system.web>
|
||||||
|
|
||||||
|
<runtime>
|
||||||
|
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="NHibernate" publicKeyToken="AA95F207798DFDB4" culture="neutral"/>
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.0.4000" newVersion="4.0.0.4000"/>
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Iesi.Collections" publicKeyToken="AA95F207798DFDB4" culture="neutral"/>
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-4.0.0.0" newVersion="4.0.0.0"/>
|
||||||
|
</dependentAssembly>
|
||||||
|
<dependentAssembly>
|
||||||
|
<assemblyIdentity name="Autofac" publicKeyToken="17863AF14B0044DA" culture="neutral"/>
|
||||||
|
<bindingRedirect oldVersion="0.0.0.0-3.5.0.0" newVersion="3.5.0.0"/>
|
||||||
|
</dependentAssembly>
|
||||||
|
</assemblyBinding>
|
||||||
|
</runtime>
|
||||||
</configuration>
|
</configuration>
|
||||||
|
|||||||
@@ -82,7 +82,7 @@ namespace Orchard.ImportExport.Controllers {
|
|||||||
};
|
};
|
||||||
|
|
||||||
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).ToList();
|
||||||
var customSteps = viewModel.CustomSteps.Where(c => c.IsChecked).Select(c => c.CustomStep);
|
var customSteps = viewModel.CustomSteps.Where(c => c.IsChecked).Select(c => c.CustomStep);
|
||||||
|
|
||||||
var exportOptions = new ExportOptions {
|
var exportOptions = new ExportOptions {
|
||||||
|
|||||||
@@ -109,9 +109,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Views\Admin\Export.cshtml" />
|
<Content Include="Views\Admin\Export.cshtml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
|
||||||
<Folder Include="RecipeHandlers\" />
|
|
||||||
</ItemGroup>
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
||||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||||
@@ -137,11 +135,11 @@
|
|||||||
</FlavorProperties>
|
</FlavorProperties>
|
||||||
</VisualStudio>
|
</VisualStudio>
|
||||||
</ProjectExtensions>
|
</ProjectExtensions>
|
||||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||||
Other similar extension points exist, see Microsoft.Common.targets.
|
Other similar extension points exist, see Microsoft.Common.targets.
|
||||||
<Target Name="BeforeBuild">
|
<Target Name="BeforeBuild">
|
||||||
</Target>
|
</Target>
|
||||||
<Target Name="AfterBuild">
|
<Target Name="AfterBuild">
|
||||||
</Target>
|
</Target>
|
||||||
-->
|
-->
|
||||||
</Project>
|
</Project>
|
||||||
@@ -4,17 +4,15 @@ using System.Linq;
|
|||||||
using System.Xml;
|
using System.Xml;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
using Orchard.ContentManagement;
|
using Orchard.ContentManagement;
|
||||||
using Orchard.ContentManagement.Handlers;
|
|
||||||
using Orchard.ContentManagement.MetaData;
|
using Orchard.ContentManagement.MetaData;
|
||||||
|
using Orchard.ContentManagement.MetaData.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;
|
||||||
using Orchard.Localization;
|
using Orchard.Localization;
|
||||||
using Orchard.Logging;
|
using Orchard.Logging;
|
||||||
using Orchard.Recipes.Models;
|
|
||||||
using Orchard.Recipes.Services;
|
using Orchard.Recipes.Services;
|
||||||
using Orchard.Services;
|
using Orchard.Services;
|
||||||
using VersionOptions = Orchard.ContentManagement.VersionOptions;
|
|
||||||
|
|
||||||
namespace Orchard.ImportExport.Services {
|
namespace Orchard.ImportExport.Services {
|
||||||
public class ImportExportService : IImportExportService {
|
public class ImportExportService : IImportExportService {
|
||||||
@@ -39,6 +37,7 @@ namespace Orchard.ImportExport.Services {
|
|||||||
IShellDescriptorManager shellDescriptorManager,
|
IShellDescriptorManager shellDescriptorManager,
|
||||||
IClock clock,
|
IClock clock,
|
||||||
IEnumerable<IExportEventHandler> exportEventHandlers) {
|
IEnumerable<IExportEventHandler> exportEventHandlers) {
|
||||||
|
|
||||||
_orchardServices = orchardServices;
|
_orchardServices = orchardServices;
|
||||||
_contentDefinitionManager = contentDefinitionManager;
|
_contentDefinitionManager = contentDefinitionManager;
|
||||||
_contentDefinitionWriter = contentDefinitionWriter;
|
_contentDefinitionWriter = contentDefinitionWriter;
|
||||||
@@ -66,7 +65,7 @@ namespace Orchard.ImportExport.Services {
|
|||||||
//items need to be retrieved
|
//items need to be retrieved
|
||||||
IEnumerable<ContentItem> contentItems = null;
|
IEnumerable<ContentItem> contentItems = null;
|
||||||
if (exportOptions.ExportData) {
|
if (exportOptions.ExportData) {
|
||||||
contentItems = _orchardServices.ContentManager.Query(GetContentExportVersionOptions(exportOptions.VersionHistoryOptions), contentTypes.ToArray()).List();
|
contentItems = _orchardServices.ContentManager.Query(GetContentExportVersionOptions(exportOptions.VersionHistoryOptions), contentTypes.ToArray()).List().ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
return Export(contentTypes, contentItems, exportOptions);
|
return Export(contentTypes, contentItems, exportOptions);
|
||||||
@@ -121,19 +120,22 @@ namespace Orchard.ImportExport.Services {
|
|||||||
var typesToExport = _contentDefinitionManager.ListTypeDefinitions()
|
var typesToExport = _contentDefinitionManager.ListTypeDefinitions()
|
||||||
.Where(typeDefinition => contentTypes.Contains(typeDefinition.Name))
|
.Where(typeDefinition => contentTypes.Contains(typeDefinition.Name))
|
||||||
.ToList();
|
.ToList();
|
||||||
var partsToExport = new List<string>();
|
var partsToExport = new Dictionary<string, ContentPartDefinition>();
|
||||||
|
|
||||||
foreach (var contentTypeDefinition in typesToExport) {
|
foreach (var contentTypeDefinition in typesToExport.OrderBy(x => x.Name)) {
|
||||||
foreach (var contentPartDefinition in contentTypeDefinition.Parts) {
|
foreach (var contentPartDefinition in contentTypeDefinition.Parts) {
|
||||||
if (partsToExport.Contains(contentPartDefinition.PartDefinition.Name)) {
|
if (partsToExport.ContainsKey(contentPartDefinition.PartDefinition.Name)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
partsToExport.Add(contentPartDefinition.PartDefinition.Name);
|
partsToExport.Add(contentPartDefinition.PartDefinition.Name, contentPartDefinition.PartDefinition);
|
||||||
partsElement.Add(_contentDefinitionWriter.Export(contentPartDefinition.PartDefinition));
|
|
||||||
}
|
}
|
||||||
typesElement.Add(_contentDefinitionWriter.Export(contentTypeDefinition));
|
typesElement.Add(_contentDefinitionWriter.Export(contentTypeDefinition));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
foreach (var part in partsToExport.Values.OrderBy(x => x.Name)) {
|
||||||
|
partsElement.Add(_contentDefinitionWriter.Export(part));
|
||||||
|
}
|
||||||
|
|
||||||
return new XElement("Metadata", typesElement, partsElement);
|
return new XElement("Metadata", typesElement, partsElement);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -141,7 +143,7 @@ namespace Orchard.ImportExport.Services {
|
|||||||
var siteContentItem = _orchardServices.WorkContext.CurrentSite.ContentItem;
|
var siteContentItem = _orchardServices.WorkContext.CurrentSite.ContentItem;
|
||||||
var exportedElements = ExportContentItem(siteContentItem).Elements().ToList();
|
var exportedElements = ExportContentItem(siteContentItem).Elements().ToList();
|
||||||
|
|
||||||
foreach (var contentPart in siteContentItem.Parts) {
|
foreach (var contentPart in siteContentItem.Parts.OrderBy(x => x.PartDefinition.Name)) {
|
||||||
var exportedElement = exportedElements.FirstOrDefault(element => element.Name == contentPart.PartDefinition.Name);
|
var exportedElement = exportedElements.FirstOrDefault(element => element.Name == contentPart.PartDefinition.Name);
|
||||||
|
|
||||||
//Get all simple attributes if exported element is null
|
//Get all simple attributes if exported element is null
|
||||||
@@ -149,6 +151,7 @@ namespace Orchard.ImportExport.Services {
|
|||||||
var simpleAttributes =
|
var simpleAttributes =
|
||||||
ExportSettingsPartAttributes(contentPart)
|
ExportSettingsPartAttributes(contentPart)
|
||||||
.Where(attribute => exportedElement == null || exportedElement.Attributes().All(xAttribute => xAttribute.Name != attribute.Name))
|
.Where(attribute => exportedElement == null || exportedElement.Attributes().All(xAttribute => xAttribute.Name != attribute.Name))
|
||||||
|
.OrderBy(x => x.Name.LocalName)
|
||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
if (simpleAttributes.Any()) {
|
if (simpleAttributes.Any()) {
|
||||||
@@ -161,11 +164,12 @@ namespace Orchard.ImportExport.Services {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exportedElements = exportedElements.OrderBy(x => x.Name.LocalName).ToList();
|
||||||
return new XElement("Settings", exportedElements);
|
return new XElement("Settings", exportedElements);
|
||||||
}
|
}
|
||||||
|
|
||||||
private IEnumerable<XAttribute> ExportSettingsPartAttributes(ContentPart sitePart) {
|
private IEnumerable<XAttribute> ExportSettingsPartAttributes(ContentPart sitePart) {
|
||||||
foreach (var property in sitePart.GetType().GetProperties()) {
|
foreach (var property in sitePart.GetType().GetProperties().OrderBy(x => x.Name)) {
|
||||||
var propertyType = property.PropertyType;
|
var propertyType = property.PropertyType;
|
||||||
|
|
||||||
// Supported types (we also know they are not indexed properties).
|
// Supported types (we also know they are not indexed properties).
|
||||||
@@ -188,9 +192,17 @@ namespace Orchard.ImportExport.Services {
|
|||||||
if (batchSize.HasValue && batchSize.Value > 0)
|
if (batchSize.HasValue && batchSize.Value > 0)
|
||||||
data.SetAttributeValue("BatchSize", batchSize);
|
data.SetAttributeValue("BatchSize", batchSize);
|
||||||
|
|
||||||
foreach (var contentType in contentTypes) {
|
var orderedContentItemsQuery =
|
||||||
|
from contentItem in contentItems
|
||||||
|
let identity = _orchardServices.ContentManager.GetItemMetadata(contentItem).Identity.ToString()
|
||||||
|
orderby identity
|
||||||
|
select contentItem;
|
||||||
|
|
||||||
|
var orderedContentItems = orderedContentItemsQuery.ToList();
|
||||||
|
|
||||||
|
foreach (var contentType in contentTypes.OrderBy(x => x)) {
|
||||||
var type = contentType;
|
var type = contentType;
|
||||||
var items = contentItems.Where(i => i.ContentType == type);
|
var items = orderedContentItems.Where(i => i.ContentType == type);
|
||||||
foreach (var contentItem in items) {
|
foreach (var contentItem in items) {
|
||||||
var contentItemElement = ExportContentItem(contentItem);
|
var contentItemElement = ExportContentItem(contentItem);
|
||||||
if (contentItemElement != null)
|
if (contentItemElement != null)
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ namespace Orchard.Layouts.ImportExport {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var elements = _repository.Table.ToList();
|
var elements = _repository.Table.OrderBy(x => x.ElementTypeName).ToList();
|
||||||
|
|
||||||
if (!elements.Any()) {
|
if (!elements.Any()) {
|
||||||
return;
|
return;
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ using Orchard.MediaLibrary.Models;
|
|||||||
|
|
||||||
namespace Orchard.MediaLibrary.Fields {
|
namespace Orchard.MediaLibrary.Fields {
|
||||||
public class MediaLibraryPickerField : ContentField {
|
public class MediaLibraryPickerField : ContentField {
|
||||||
private static readonly char[] separator = new [] {'{', '}', ','};
|
private static readonly char[] separator = {'{', '}', ','};
|
||||||
internal Lazy<IEnumerable<MediaPart>> _contentItems;
|
internal Lazy<IEnumerable<MediaPart>> _contentItems;
|
||||||
|
|
||||||
public int[] Ids {
|
public int[] Ids {
|
||||||
@@ -17,7 +17,7 @@ namespace Orchard.MediaLibrary.Fields {
|
|||||||
|
|
||||||
public IEnumerable<MediaPart> MediaParts {
|
public IEnumerable<MediaPart> MediaParts {
|
||||||
get {
|
get {
|
||||||
return _contentItems.Value;
|
return _contentItems != null ? _contentItems.Value : Enumerable.Empty<MediaPart>();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,39 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Xml.Linq;
|
||||||
|
using Orchard.Environment.Features;
|
||||||
|
using Orchard.Events;
|
||||||
|
|
||||||
|
namespace Orchard.Modules.ImportExport {
|
||||||
|
public interface IExportEventHandler : IEventHandler {
|
||||||
|
void Exporting(dynamic context);
|
||||||
|
void Exported(dynamic context);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class FeaturesExportHandler : IExportEventHandler {
|
||||||
|
private readonly IFeatureManager _featureManager;
|
||||||
|
|
||||||
|
public FeaturesExportHandler(IFeatureManager featureManager) {
|
||||||
|
_featureManager = featureManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Exporting(dynamic context) {
|
||||||
|
if (!((IEnumerable<string>)context.ExportOptions.CustomSteps).Contains("Features")) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
var enabledFeatures = _featureManager.GetEnabledFeatures();
|
||||||
|
|
||||||
|
var root = new XElement("Feature", new XAttribute("enable", String.Join(", ", enabledFeatures.Select(x => x.Id).OrderBy(x => x))));
|
||||||
|
context.Document.Element("Orchard").Add(root);
|
||||||
|
|
||||||
|
// Add the Migration element to force migrations run immediately after the features have been synced.
|
||||||
|
context.Document.Element("Orchard").Add(new XElement("Migration", new XAttribute("features", "*")));
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Exported(dynamic context) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using Orchard.Events;
|
||||||
|
|
||||||
|
namespace Orchard.Modules.ImportExport {
|
||||||
|
public interface ICustomExportStep : IEventHandler {
|
||||||
|
void Register(IList<string> steps);
|
||||||
|
}
|
||||||
|
|
||||||
|
public class FeaturesStep : ICustomExportStep {
|
||||||
|
public void Register(IList<string> steps) {
|
||||||
|
steps.Add("Features");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,3 +7,13 @@ OrchardVersion: 1.9
|
|||||||
Description: The Modules module enables the administrator of the site to manage the installed modules as well as activate and de-activate features.
|
Description: The Modules module enables the administrator of the site to manage the installed modules as well as activate and de-activate features.
|
||||||
FeatureDescription: Standard module and feature management.
|
FeatureDescription: Standard module and feature management.
|
||||||
Category: Core
|
Category: Core
|
||||||
|
Features:
|
||||||
|
Orchard.Modules:
|
||||||
|
Description: Standard module and feature management.
|
||||||
|
Dependencies: Orchard.jQuery
|
||||||
|
Category: Core
|
||||||
|
Orchard.Modules.ExportFeatures:
|
||||||
|
Name: Export Features
|
||||||
|
Description: Provides feature export capability.
|
||||||
|
Category: Deployment
|
||||||
|
Dependencies: Orchard.ImportExport
|
||||||
|
|||||||
@@ -25,6 +25,7 @@
|
|||||||
<IISExpressAnonymousAuthentication />
|
<IISExpressAnonymousAuthentication />
|
||||||
<IISExpressWindowsAuthentication />
|
<IISExpressWindowsAuthentication />
|
||||||
<IISExpressUseClassicPipelineMode />
|
<IISExpressUseClassicPipelineMode />
|
||||||
|
<UseGlobalApplicationHostFile />
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||||
<DebugSymbols>true</DebugSymbols>
|
<DebugSymbols>true</DebugSymbols>
|
||||||
@@ -64,12 +65,15 @@
|
|||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
|
<HintPath>..\..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="System.XML" />
|
||||||
<Reference Include="System.Xml.Linq" />
|
<Reference Include="System.Xml.Linq" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="AdminMenu.cs" />
|
<Compile Include="AdminMenu.cs" />
|
||||||
<Compile Include="Data\Migration\DataMigrationNotificationProvider.cs" />
|
<Compile Include="Data\Migration\DataMigrationNotificationProvider.cs" />
|
||||||
<Compile Include="Events\IExtensionDisplayEventHandler.cs" />
|
<Compile Include="Events\IExtensionDisplayEventHandler.cs" />
|
||||||
|
<Compile Include="ImportExport\FeaturesStep.cs" />
|
||||||
|
<Compile Include="ImportExport\FeaturesExportHandler.cs" />
|
||||||
<Compile Include="ResourceManifest.cs" />
|
<Compile Include="ResourceManifest.cs" />
|
||||||
<Compile Include="Commands\FeatureCommands.cs" />
|
<Compile Include="Commands\FeatureCommands.cs" />
|
||||||
<Compile Include="Controllers\AdminController.cs" />
|
<Compile Include="Controllers\AdminController.cs" />
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ namespace Orchard.Roles.ImportExport {
|
|||||||
var root = new XElement("Roles");
|
var root = new XElement("Roles");
|
||||||
context.Document.Element("Orchard").Add(root);
|
context.Document.Element("Orchard").Add(root);
|
||||||
|
|
||||||
foreach (var role in roles) {
|
foreach (var role in roles.OrderBy(x => x)) {
|
||||||
root.Add(new XElement("Role",
|
root.Add(new XElement("Role",
|
||||||
new XAttribute("Name", role.Name),
|
new XAttribute("Name", role.Name),
|
||||||
new XAttribute("Permissions", string.Join(",", role.RolesPermissions.Select(rolePermission => rolePermission.Permission.Name)))));
|
new XAttribute("Permissions", string.Join(",", role.RolesPermissions.Select(rolePermission => rolePermission.Permission.Name)))));
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ namespace Orchard.Workflows.ImportExport {
|
|||||||
var root = new XElement("Workflows");
|
var root = new XElement("Workflows");
|
||||||
context.Document.Element("Orchard").Add(root);
|
context.Document.Element("Orchard").Add(root);
|
||||||
|
|
||||||
foreach (var workflowDefinition in workflowDefinitions) {
|
foreach (var workflowDefinition in workflowDefinitions.OrderBy(x => x.Name)) {
|
||||||
root.Add(new XElement("Workflow",
|
root.Add(new XElement("Workflow",
|
||||||
new XAttribute("Name", workflowDefinition.Name),
|
new XAttribute("Name", workflowDefinition.Name),
|
||||||
new XAttribute("Enabled", workflowDefinition.Enabled),
|
new XAttribute("Enabled", workflowDefinition.Enabled),
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ Features:
|
|||||||
Description: Provides tools to create custom workflows.
|
Description: Provides tools to create custom workflows.
|
||||||
Dependencies: Orchard.Tokens, Orchard.Forms, Orchard.jQuery
|
Dependencies: Orchard.Tokens, Orchard.Forms, Orchard.jQuery
|
||||||
Orchard.Workflows.Timer:
|
Orchard.Workflows.Timer:
|
||||||
Name: Workflows Timer
|
Name: Workflows Timer
|
||||||
Description: Provides a Timer activity.
|
Description: Provides a Timer activity.
|
||||||
Category: Workflows
|
Category: Workflows
|
||||||
Dependencies: Orchard.Workflows
|
Dependencies: Orchard.Workflows
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using System.Xml;
|
using System.Linq;
|
||||||
|
using System.Xml;
|
||||||
using System.Xml.Linq;
|
using System.Xml.Linq;
|
||||||
using Orchard.ContentManagement.MetaData.Models;
|
using Orchard.ContentManagement.MetaData.Models;
|
||||||
using Orchard.Validation;
|
using Orchard.Validation;
|
||||||
@@ -36,7 +37,7 @@ namespace Orchard.ContentManagement.MetaData.Services {
|
|||||||
typeElement.Add(new XAttribute("DisplayName", contentTypeDefinition.DisplayName));
|
typeElement.Add(new XAttribute("DisplayName", contentTypeDefinition.DisplayName));
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var typePart in contentTypeDefinition.Parts) {
|
foreach (var typePart in contentTypeDefinition.Parts.OrderBy(x => x.PartDefinition.Name)) {
|
||||||
typeElement.Add(NewElement(typePart.PartDefinition.Name, typePart.Settings));
|
typeElement.Add(NewElement(typePart.PartDefinition.Name, typePart.Settings));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -52,7 +53,7 @@ namespace Orchard.ContentManagement.MetaData.Services {
|
|||||||
Argument.ThrowIfNull(contentPartDefinition, "contentPartDefinition");
|
Argument.ThrowIfNull(contentPartDefinition, "contentPartDefinition");
|
||||||
|
|
||||||
var partElement = NewElement(contentPartDefinition.Name, contentPartDefinition.Settings);
|
var partElement = NewElement(contentPartDefinition.Name, contentPartDefinition.Settings);
|
||||||
foreach (var partField in contentPartDefinition.Fields) {
|
foreach (var partField in contentPartDefinition.Fields.OrderBy(x => x.Name)) {
|
||||||
var attributeName = string.Format("{0}.{1}", partField.Name, partField.FieldDefinition.Name);
|
var attributeName = string.Format("{0}.{1}", partField.Name, partField.FieldDefinition.Name);
|
||||||
var partFieldElement = NewElement(attributeName, partField.Settings);
|
var partFieldElement = NewElement(attributeName, partField.Settings);
|
||||||
partElement.Add(partFieldElement);
|
partElement.Add(partFieldElement);
|
||||||
|
|||||||
Reference in New Issue
Block a user