mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-19 18:27:55 +08:00
Adding start of initial module management UI
--HG-- branch : dev
This commit is contained in:
@@ -11,3 +11,4 @@ glob:*.sln.cache
|
|||||||
glob:src/Orchard.Web/Modules/Orchard.DevTools/Module.txt
|
glob:src/Orchard.Web/Modules/Orchard.DevTools/Module.txt
|
||||||
glob:src/Orchard.Web/Modules/Orchard.Sandbox/Module.txt
|
glob:src/Orchard.Web/Modules/Orchard.Sandbox/Module.txt
|
||||||
glob:src/Orchard.Web/Media/*
|
glob:src/Orchard.Web/Media/*
|
||||||
|
glob:desktop.ini
|
||||||
|
11
src/Orchard.Specs/Modules.feature
Normal file
11
src/Orchard.Specs/Modules.feature
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
Feature: Module management
|
||||||
|
In order add and enable features
|
||||||
|
As a root Orchard system operator
|
||||||
|
I want to install and enable modules and enable features
|
||||||
|
|
||||||
|
Scenario: Default modules are listed
|
||||||
|
Given I have installed Orchard
|
||||||
|
When I go to "admin/modules"
|
||||||
|
Then I should see "Installed Modules"
|
||||||
|
And I should see "<h3>Themes</h3>"
|
||||||
|
And the status should be 200 OK
|
74
src/Orchard.Specs/Modules.feature.cs
generated
Normal file
74
src/Orchard.Specs/Modules.feature.cs
generated
Normal file
@@ -0,0 +1,74 @@
|
|||||||
|
// ------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// This code was generated by SpecFlow (http://www.specflow.org/).
|
||||||
|
// SpecFlow Version:1.2.0.0
|
||||||
|
// Runtime Version:2.0.50727.4927
|
||||||
|
//
|
||||||
|
// Changes to this file may cause incorrect behavior and will be lost if
|
||||||
|
// the code is regenerated.
|
||||||
|
// </auto-generated>
|
||||||
|
// ------------------------------------------------------------------------------
|
||||||
|
namespace Orchard.Specs
|
||||||
|
{
|
||||||
|
using TechTalk.SpecFlow;
|
||||||
|
|
||||||
|
|
||||||
|
[NUnit.Framework.TestFixtureAttribute()]
|
||||||
|
[NUnit.Framework.DescriptionAttribute("Module management")]
|
||||||
|
public partial class ModuleManagementFeature
|
||||||
|
{
|
||||||
|
|
||||||
|
private static TechTalk.SpecFlow.ITestRunner testRunner;
|
||||||
|
|
||||||
|
#line 1 "Modules.feature"
|
||||||
|
#line hidden
|
||||||
|
|
||||||
|
[NUnit.Framework.TestFixtureSetUpAttribute()]
|
||||||
|
public virtual void FeatureSetup()
|
||||||
|
{
|
||||||
|
testRunner = TechTalk.SpecFlow.TestRunnerManager.GetTestRunner();
|
||||||
|
TechTalk.SpecFlow.FeatureInfo featureInfo = new TechTalk.SpecFlow.FeatureInfo(new System.Globalization.CultureInfo("en-US"), "Module management", "In order add and enable features\r\nAs a root Orchard system operator\r\nI want to in" +
|
||||||
|
"stall and enable modules and enable features", ((string[])(null)));
|
||||||
|
testRunner.OnFeatureStart(featureInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
[NUnit.Framework.TestFixtureTearDownAttribute()]
|
||||||
|
public virtual void FeatureTearDown()
|
||||||
|
{
|
||||||
|
testRunner.OnFeatureEnd();
|
||||||
|
testRunner = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public virtual void ScenarioSetup(TechTalk.SpecFlow.ScenarioInfo scenarioInfo)
|
||||||
|
{
|
||||||
|
testRunner.OnScenarioStart(scenarioInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
[NUnit.Framework.TearDownAttribute()]
|
||||||
|
public virtual void ScenarioTearDown()
|
||||||
|
{
|
||||||
|
testRunner.OnScenarioEnd();
|
||||||
|
}
|
||||||
|
|
||||||
|
[NUnit.Framework.TestAttribute()]
|
||||||
|
[NUnit.Framework.DescriptionAttribute("Default modules are listed")]
|
||||||
|
public virtual void DefaultModulesAreListed()
|
||||||
|
{
|
||||||
|
TechTalk.SpecFlow.ScenarioInfo scenarioInfo = new TechTalk.SpecFlow.ScenarioInfo("Default modules are listed", ((string[])(null)));
|
||||||
|
#line 6
|
||||||
|
this.ScenarioSetup(scenarioInfo);
|
||||||
|
#line 7
|
||||||
|
testRunner.Given("I have installed Orchard");
|
||||||
|
#line 8
|
||||||
|
testRunner.When("I go to \"admin/modules\"");
|
||||||
|
#line 9
|
||||||
|
testRunner.Then("I should see \"Installed Modules\"");
|
||||||
|
#line 10
|
||||||
|
testRunner.And("I should see \"<h3>Themes</h3>\"");
|
||||||
|
#line 11
|
||||||
|
testRunner.And("the status should be 200 OK");
|
||||||
|
#line hidden
|
||||||
|
testRunner.CollectScenarioErrors();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -111,6 +111,11 @@
|
|||||||
<Compile Include="Hosting\RequestExtensions.cs" />
|
<Compile Include="Hosting\RequestExtensions.cs" />
|
||||||
<Compile Include="Hosting\RequestDetails.cs" />
|
<Compile Include="Hosting\RequestDetails.cs" />
|
||||||
<Compile Include="Hosting\Simple.Web\Global.asax.cs" />
|
<Compile Include="Hosting\Simple.Web\Global.asax.cs" />
|
||||||
|
<Compile Include="Modules.feature.cs">
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
<DependentUpon>Modules.feature</DependentUpon>
|
||||||
|
</Compile>
|
||||||
<Compile Include="MultiTenancy.feature.cs">
|
<Compile Include="MultiTenancy.feature.cs">
|
||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
@@ -165,6 +170,10 @@
|
|||||||
<Content Include="Hosting\Orchard.Web\Config\Host.config">
|
<Content Include="Hosting\Orchard.Web\Config\Host.config">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
<None Include="Modules.feature">
|
||||||
|
<Generator>SpecFlowSingleFileGenerator</Generator>
|
||||||
|
<LastGenOutput>Modules.feature.cs</LastGenOutput>
|
||||||
|
</None>
|
||||||
<None Include="MultiTenancy.feature">
|
<None Include="MultiTenancy.feature">
|
||||||
<Generator>SpecFlowSingleFileGenerator</Generator>
|
<Generator>SpecFlowSingleFileGenerator</Generator>
|
||||||
<LastGenOutput>MultiTenancy.feature.cs</LastGenOutput>
|
<LastGenOutput>MultiTenancy.feature.cs</LastGenOutput>
|
||||||
|
@@ -3,8 +3,15 @@ using Orchard.Modules.ViewModels;
|
|||||||
|
|
||||||
namespace Orchard.Modules.Controllers {
|
namespace Orchard.Modules.Controllers {
|
||||||
public class AdminController : Controller {
|
public class AdminController : Controller {
|
||||||
|
private readonly IModuleService _moduleService;
|
||||||
|
|
||||||
|
public AdminController(IModuleService moduleService) {
|
||||||
|
_moduleService = moduleService;
|
||||||
|
}
|
||||||
|
|
||||||
public ActionResult Index() {
|
public ActionResult Index() {
|
||||||
return View(new ModulesIndexViewModel());
|
var modules = _moduleService.GetInstalledModules();
|
||||||
|
return View(new ModulesIndexViewModel {Modules = modules});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
15
src/Orchard.Web/Modules/Orchard.Modules/Models/Module.cs
Normal file
15
src/Orchard.Web/Modules/Orchard.Modules/Models/Module.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using Orchard.Environment.Extensions.Models;
|
||||||
|
|
||||||
|
namespace Orchard.Modules.Models {
|
||||||
|
public class Module : IModule {
|
||||||
|
public string ModuleName { get; set; }
|
||||||
|
public string DisplayName { get; set; }
|
||||||
|
public string Description { get; set; }
|
||||||
|
public string Version { get; set; }
|
||||||
|
public string Author { get; set; }
|
||||||
|
public string HomePage { get; set; }
|
||||||
|
public string Tags { get; set; }
|
||||||
|
public IEnumerable<FeatureDescriptor> Features { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@@ -63,8 +63,10 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="AdminMenu.cs" />
|
<Compile Include="AdminMenu.cs" />
|
||||||
<Compile Include="Controllers\AdminController.cs" />
|
<Compile Include="Controllers\AdminController.cs" />
|
||||||
|
<Compile Include="Models\Module.cs" />
|
||||||
<Compile Include="Permissions.cs" />
|
<Compile Include="Permissions.cs" />
|
||||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||||
|
<Compile Include="Services\ModuleService.cs" />
|
||||||
<Compile Include="ViewModels\ModulesIndexViewModel.cs" />
|
<Compile Include="ViewModels\ModulesIndexViewModel.cs" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@@ -0,0 +1,41 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Web;
|
||||||
|
using Orchard.Environment.Extensions;
|
||||||
|
using Orchard.Modules.Models;
|
||||||
|
|
||||||
|
namespace Orchard.Modules.Services {
|
||||||
|
public class ModuleService : IModuleService {
|
||||||
|
private readonly IExtensionManager _extensionManager;
|
||||||
|
|
||||||
|
public ModuleService(IExtensionManager extensionManager) {
|
||||||
|
_extensionManager = extensionManager;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IModule GetModuleByName(string moduleName) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
public IEnumerable<IModule> GetInstalledModules() {
|
||||||
|
return
|
||||||
|
_extensionManager.AvailableExtensions().Where(
|
||||||
|
e => String.Equals(e.ExtensionType, "Module", StringComparison.OrdinalIgnoreCase)).Select(
|
||||||
|
descriptor => (new Module {
|
||||||
|
ModuleName = descriptor.Name,
|
||||||
|
DisplayName = descriptor.DisplayName,
|
||||||
|
Description = descriptor.Description,
|
||||||
|
Version = descriptor.Version,
|
||||||
|
Author = descriptor.Author,
|
||||||
|
HomePage = descriptor.WebSite,
|
||||||
|
Tags = descriptor.Tags
|
||||||
|
}) as IModule);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void InstallModule(HttpPostedFileBase file) {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void UninstallModule(string moduleName) {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -1,6 +1,8 @@
|
|||||||
using Orchard.Mvc.ViewModels;
|
using System.Collections.Generic;
|
||||||
|
using Orchard.Mvc.ViewModels;
|
||||||
|
|
||||||
namespace Orchard.Modules.ViewModels {
|
namespace Orchard.Modules.ViewModels {
|
||||||
public class ModulesIndexViewModel : BaseViewModel {
|
public class ModulesIndexViewModel : BaseViewModel {
|
||||||
|
public IEnumerable<IModule> Modules { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -2,4 +2,14 @@
|
|||||||
<%@ Import Namespace="Orchard.Mvc.Html"%>
|
<%@ Import Namespace="Orchard.Mvc.Html"%>
|
||||||
<%@ Import Namespace="Orchard.Modules.ViewModels"%>
|
<%@ Import Namespace="Orchard.Modules.ViewModels"%>
|
||||||
<h1><%=Html.TitleForPage(T("Manage Modules").ToString()) %></h1>
|
<h1><%=Html.TitleForPage(T("Manage Modules").ToString()) %></h1>
|
||||||
<p>manage the modules</p>
|
<h2><%=T("Installed Modules") %></h2>
|
||||||
|
<% if (Model.Modules.Count() > 0) { %>
|
||||||
|
<ul><%
|
||||||
|
foreach (var module in Model.Modules.OrderBy(m => m.DisplayName)) { %>
|
||||||
|
<li>
|
||||||
|
<h3><%=Html.Encode(module.DisplayName) %></h3>
|
||||||
|
<p><%=module.Description != null ? Html.Encode(module.Description) : T("<em>no description</em>") %></p>
|
||||||
|
</li><%
|
||||||
|
} %>
|
||||||
|
</ul><%
|
||||||
|
} %>
|
15
src/Orchard/Modules/IModule.cs
Normal file
15
src/Orchard/Modules/IModule.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using Orchard.Environment.Extensions.Models;
|
||||||
|
|
||||||
|
namespace Orchard.Modules {
|
||||||
|
public interface IModule {
|
||||||
|
string ModuleName { get; set; }
|
||||||
|
string DisplayName { get; set; }
|
||||||
|
string Description { get; set; }
|
||||||
|
string Version { get; set; }
|
||||||
|
string Author { get; set; }
|
||||||
|
string HomePage { get; set; }
|
||||||
|
string Tags { get; set; }
|
||||||
|
IEnumerable<FeatureDescriptor> Features { get; set; }
|
||||||
|
}
|
||||||
|
}
|
11
src/Orchard/Modules/IModuleService.cs
Normal file
11
src/Orchard/Modules/IModuleService.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Web;
|
||||||
|
|
||||||
|
namespace Orchard.Modules {
|
||||||
|
public interface IModuleService : IDependency {
|
||||||
|
IModule GetModuleByName(string moduleName);
|
||||||
|
IEnumerable<IModule> GetInstalledModules();
|
||||||
|
void InstallModule(HttpPostedFileBase file);
|
||||||
|
void UninstallModule(string moduleName);
|
||||||
|
}
|
||||||
|
}
|
@@ -190,6 +190,8 @@
|
|||||||
<Compile Include="Environment\Extensions\Models\FeatureDescriptor.cs" />
|
<Compile Include="Environment\Extensions\Models\FeatureDescriptor.cs" />
|
||||||
<Compile Include="Environment\Extensions\OrchardFeatureAttribute.cs" />
|
<Compile Include="Environment\Extensions\OrchardFeatureAttribute.cs" />
|
||||||
<Compile Include="Environment\Extensions\ShellTopology.cs" />
|
<Compile Include="Environment\Extensions\ShellTopology.cs" />
|
||||||
|
<Compile Include="Modules\IModule.cs" />
|
||||||
|
<Compile Include="Modules\IModuleService.cs" />
|
||||||
<Compile Include="Mvc\AntiForgery\ValidateAntiForgeryTokenOrchardAttribute.cs" />
|
<Compile Include="Mvc\AntiForgery\ValidateAntiForgeryTokenOrchardAttribute.cs" />
|
||||||
<Compile Include="Mvc\Extensions\ControllerExtensions.cs" />
|
<Compile Include="Mvc\Extensions\ControllerExtensions.cs" />
|
||||||
<Compile Include="Mvc\Html\FileRegistrationContextExtensions.cs" />
|
<Compile Include="Mvc\Html\FileRegistrationContextExtensions.cs" />
|
||||||
|
Reference in New Issue
Block a user