mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Adding start of initial module management UI
--HG-- branch : dev
This commit is contained in:
@@ -3,8 +3,15 @@ using Orchard.Modules.ViewModels;
|
||||
|
||||
namespace Orchard.Modules.Controllers {
|
||||
public class AdminController : Controller {
|
||||
private readonly IModuleService _moduleService;
|
||||
|
||||
public AdminController(IModuleService moduleService) {
|
||||
_moduleService = moduleService;
|
||||
}
|
||||
|
||||
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>
|
||||
<Compile Include="AdminMenu.cs" />
|
||||
<Compile Include="Controllers\AdminController.cs" />
|
||||
<Compile Include="Models\Module.cs" />
|
||||
<Compile Include="Permissions.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Services\ModuleService.cs" />
|
||||
<Compile Include="ViewModels\ModulesIndexViewModel.cs" />
|
||||
</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 {
|
||||
public class ModulesIndexViewModel : BaseViewModel {
|
||||
public IEnumerable<IModule> Modules { get; set; }
|
||||
}
|
||||
}
|
@@ -2,4 +2,14 @@
|
||||
<%@ Import Namespace="Orchard.Mvc.Html"%>
|
||||
<%@ Import Namespace="Orchard.Modules.ViewModels"%>
|
||||
<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><%
|
||||
} %>
|
Reference in New Issue
Block a user