mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Adding Uninstall button for modules under Modules/Installed.
This commit is contained in:
@@ -92,9 +92,13 @@ namespace Orchard.Modules.Controllers {
|
|||||||
modules = modules.Skip((pager.Page - 1) * pager.PageSize).Take(pager.PageSize);
|
modules = modules.Skip((pager.Page - 1) * pager.PageSize).Take(pager.PageSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// This way we can more or less reliably handle this implicit dependency.
|
||||||
|
var installModules = _featureManager.GetEnabledFeatures().FirstOrDefault(f => f.Id == "PackagingServices") != null;
|
||||||
|
|
||||||
modules = modules.ToList();
|
modules = modules.ToList();
|
||||||
foreach (ModuleEntry moduleEntry in modules) {
|
foreach (ModuleEntry moduleEntry in modules) {
|
||||||
moduleEntry.IsRecentlyInstalled = _moduleService.IsRecentlyInstalled(moduleEntry.Descriptor);
|
moduleEntry.IsRecentlyInstalled = _moduleService.IsRecentlyInstalled(moduleEntry.Descriptor);
|
||||||
|
moduleEntry.CanUninstall = installModules;
|
||||||
|
|
||||||
if (_extensionDisplayEventHandler != null) {
|
if (_extensionDisplayEventHandler != null) {
|
||||||
foreach (string notification in _extensionDisplayEventHandler.Displaying(moduleEntry.Descriptor, ControllerContext.RequestContext)) {
|
foreach (string notification in _extensionDisplayEventHandler.Displaying(moduleEntry.Descriptor, ControllerContext.RequestContext)) {
|
||||||
@@ -103,9 +107,10 @@ namespace Orchard.Modules.Controllers {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return View(new ModulesIndexViewModel {
|
return View(new ModulesIndexViewModel {
|
||||||
Modules = modules,
|
Modules = modules,
|
||||||
InstallModules = _featureManager.GetEnabledFeatures().FirstOrDefault(f => f.Id == "PackagingServices") != null,
|
InstallModules = installModules,
|
||||||
Options = options,
|
Options = options,
|
||||||
Pager = Shape.Pager(pager).TotalItemCount(totalItemCount)
|
Pager = Shape.Pager(pager).TotalItemCount(totalItemCount)
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -32,5 +32,10 @@ namespace Orchard.Modules.Models {
|
|||||||
/// List of module notifications.
|
/// List of module notifications.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<string> Notifications { get; set; }
|
public List<string> Notifications { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Indicates whether the module can be uninstalled by the user.
|
||||||
|
/// </summary>
|
||||||
|
public bool CanUninstall { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,35 +2,44 @@
|
|||||||
@using Orchard.Mvc.Html;
|
@using Orchard.Mvc.Html;
|
||||||
@using Orchard.Modules.ViewModels;
|
@using Orchard.Modules.ViewModels;
|
||||||
@using Orchard.Environment.Extensions.Models;
|
@using Orchard.Environment.Extensions.Models;
|
||||||
|
@using Orchard.Utility.Extensions;
|
||||||
|
|
||||||
@{
|
@{
|
||||||
Orchard.Modules.Models.ModuleEntry module = Model.Module;
|
Orchard.Modules.Models.ModuleEntry module = Model.Module;
|
||||||
string moduleClasses = module.IsRecentlyInstalled ? "recentlyInstalledModule" : string.Empty;
|
var moduleClasses = module.IsRecentlyInstalled ? "class=\"recentlyInstalledModule\"" : String.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
<div class="summary">
|
<div class="summary">
|
||||||
@if (module.Notifications != null && module.Notifications.Count > 0) {
|
@if (module.Notifications != null && module.Notifications.Count > 0) {
|
||||||
<div class="notifications">
|
<div class="notifications">
|
||||||
@foreach (string notification in module.Notifications) {
|
@foreach (var notification in module.Notifications) {
|
||||||
<h5>@Html.Raw(notification)</h5>
|
<h5>@Html.Raw(notification)</h5>
|
||||||
}
|
}
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
<div class="properties">
|
<div class="properties">
|
||||||
<h2@{ if(!string.IsNullOrEmpty(moduleClasses)) {<text> class="@moduleClasses" </text> }}>
|
<h2 @Html.Raw(moduleClasses)>
|
||||||
@module.Descriptor.Name<span> - @T("Version: {0}", !string.IsNullOrEmpty(module.Descriptor.Version) ? module.Descriptor.Version : T("1.0").ToString())</span></h2>
|
@module.Descriptor.Name<span> - @T("Version: {0}", !String.IsNullOrEmpty(module.Descriptor.Version) ? module.Descriptor.Version : T("1.0").ToString())</span>
|
||||||
|
</h2>
|
||||||
|
|
||||||
@if (!string.IsNullOrEmpty(module.Descriptor.Description)) {
|
@Html.ActionLink(
|
||||||
|
T("Uninstall").Text,
|
||||||
|
"UninstallModule",
|
||||||
|
"PackagingServices",
|
||||||
|
new { ModuleId = module.Descriptor.Id, ReturnUrl = Request.ToUrlString(), Area = "Orchard.Packaging" },
|
||||||
|
new { itemprop = "RemoveUrl UnsafeUrl" })
|
||||||
|
|
||||||
|
@if (!String.IsNullOrEmpty(module.Descriptor.Description)) {
|
||||||
<p>@module.Descriptor.Description</p>
|
<p>@module.Descriptor.Description</p>
|
||||||
}
|
}
|
||||||
|
|
||||||
<ul class="pageStatus" style="color:#666; margin:.6em 0 0 0;">
|
<ul class="pageStatus" style="color:#666; margin:.6em 0 0 0;">
|
||||||
@{ IEnumerable<FeatureDescriptor> features = module.Descriptor.Features; }
|
@{ var features = module.Descriptor.Features; }
|
||||||
<li>@T("Features: {0}", MvcHtmlString.Create(string.Join(", ", features.Select(f => Html.Link(string.IsNullOrEmpty(f.Name) ? f.Id : f.Name, string.Format("{0}#{1}", Url.Action("features", new { area = "Orchard.Modules" }), f.Id.AsFeatureId(n => T(n)))).ToString()).OrderBy(s => s).ToArray())))</li>
|
<li>@T("Features: {0}", MvcHtmlString.Create(String.Join(", ", features.Select(f => Html.Link(String.IsNullOrEmpty(f.Name) ? f.Id : f.Name, String.Format("{0}#{1}", Url.Action("features", new { area = "Orchard.Modules" }), f.Id.AsFeatureId(n => T(n)))).ToString()).OrderBy(s => s).ToArray())))</li>
|
||||||
<li> | @T("Author: {0}", !string.IsNullOrEmpty(module.Descriptor.Author) ? module.Descriptor.Author : T("Unknown").ToString())</li>
|
<li> | @T("Author: {0}", !String.IsNullOrEmpty(module.Descriptor.Author) ? module.Descriptor.Author : T("Unknown").ToString())</li>
|
||||||
<li>
|
<li>
|
||||||
| @T("Website: ")
|
| @T("Website: ")
|
||||||
@if (!string.IsNullOrEmpty(module.Descriptor.WebSite)) { <a href="@module.Descriptor.WebSite">@module.Descriptor.WebSite</a> }
|
@if (!String.IsNullOrEmpty(module.Descriptor.WebSite)) { <a href="@module.Descriptor.WebSite">@module.Descriptor.WebSite</a> }
|
||||||
else { @T("Unknown").ToString() }
|
else { @T("Unknown").ToString() }
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
|||||||
Reference in New Issue
Block a user