mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
@@ -0,0 +1,36 @@
|
|||||||
|
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))));
|
||||||
|
context.Document.Element("Orchard").Add(root);
|
||||||
|
}
|
||||||
|
|
||||||
|
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" />
|
||||||
|
|||||||
Reference in New Issue
Block a user