mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 19:54:57 +08:00
Merge
--HG-- branch : dev
This commit is contained in:
@@ -1,14 +1,4 @@
|
||||
/* Clearing Floats
|
||||
***************************************************************/
|
||||
|
||||
.group:after {
|
||||
content: ".";
|
||||
display: block;
|
||||
height: 0;
|
||||
clear: both;
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
html { background:none !important }
|
||||
|
||||
body {
|
||||
color: #333;
|
||||
@@ -17,6 +7,7 @@ body {
|
||||
line-height:1.6em;
|
||||
padding:12px;
|
||||
width:640px;
|
||||
min-width:640px;
|
||||
margin: 0 auto;
|
||||
}
|
||||
|
||||
@@ -29,6 +20,27 @@ body {
|
||||
text-decoration:none;
|
||||
}
|
||||
|
||||
#file-details, #image-preview, #gallery {
|
||||
/*border:1px solid #ff0000;*/
|
||||
width:340px;
|
||||
min-height:430px;
|
||||
float:left;
|
||||
}
|
||||
|
||||
#file-details {
|
||||
float:right;
|
||||
width:220px;
|
||||
}
|
||||
|
||||
#file-list {
|
||||
border:1px solid #bdbcbc;
|
||||
height:324px;
|
||||
max-height:324px;
|
||||
overflow:scroll;
|
||||
overflow-y:scroll;
|
||||
overflow-x:hidden;
|
||||
}
|
||||
|
||||
input[disabled], input[disabled="disabled"], input.disabled {
|
||||
color: White
|
||||
}
|
||||
@@ -96,7 +108,7 @@ legend { font-weight: normal; border:none; }
|
||||
fieldset { padding:0; margin: 0; border: 0px solid #dbdbdb; }
|
||||
#orchardmediapicker label { font-weight:normal; display:block; padding: 0 0 0 0; margin:10px 0 0 0; }
|
||||
#orchardmediapicker label.forcheckbox { display: inline; margin: 10px 0 0 4px; }
|
||||
#orchardmediapicker .actions { margin:12px 0 0 0; }
|
||||
#orchardmediapicker .actions { margin:12px 0 0 0; clear:both; text-align:left; }
|
||||
|
||||
input[type="text"], select, textarea, input.text, input.textMedium, input.text-box {
|
||||
padding:3px;
|
||||
@@ -139,101 +151,6 @@ textarea {
|
||||
min-height:8em;
|
||||
}
|
||||
|
||||
|
||||
form.link button {
|
||||
background:inherit;
|
||||
border:0;
|
||||
padding:0;
|
||||
width:auto;
|
||||
margin:-2px -3px 0;
|
||||
|
||||
/*Remove CSS3 button properties*/
|
||||
filter:none;
|
||||
background:none;
|
||||
background:none;
|
||||
box-shadow:none;
|
||||
-webkit-box-shadow:none;
|
||||
-moz-box-shadow:none;
|
||||
border-radius:none;
|
||||
-webkit-border-radius:none;
|
||||
-moz-border-radius:none;
|
||||
}
|
||||
|
||||
button.remove, .remove.button, .remove.button:link, .remove.button:visited {
|
||||
background-color:#DECCCA;
|
||||
background-image:url(images/tableHeaderBackgroundRed.gif);
|
||||
border-color:#d6c9c7;
|
||||
color:#5c3732;
|
||||
}
|
||||
button.remove:hover, .remove.button:hover,
|
||||
button.remove:active, .remove.button:active,
|
||||
button.remove:focus, .remove.button:focus {
|
||||
background:#8f7c79;
|
||||
border-color:#6e5551;
|
||||
color:#faedeb;
|
||||
}
|
||||
button.remove:focus::-moz-focus-inner, .remove.button:focus::-moz-focus-inner {
|
||||
border-color:#8f7c79;
|
||||
}
|
||||
.delete.button {
|
||||
float:right;
|
||||
}
|
||||
input[type="submit"], input[type="reset"], input[type="button"], button, submit, .button, .button:link, .button:visited {
|
||||
background:#6a7b42;
|
||||
border:1px solid #487328;
|
||||
color:#fff;
|
||||
cursor:pointer;
|
||||
padding:0 14px 2px 14px;
|
||||
text-align:center;
|
||||
margin:0px;
|
||||
|
||||
/*CSS3 properties*/
|
||||
text-shadow: rgba(0,0,0,.5) 0px 0px 1px;
|
||||
/*In ie the first couplet sets the alpha value so 00=transparent and ff=opaque)*/
|
||||
filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, startColorstr='#ff6e7f45', endColorstr='#ff6a7b42');
|
||||
background: -webkit-gradient(linear, 0 0, 0 100%, from(rgba(110, 127, 69, 1.0)), rgba((106, 123, 66, 1.0)));
|
||||
background: -moz-linear-gradient(top, rgba(110, 127, 69, 1.0), rgba(106, 123, 66, 1.0));
|
||||
|
||||
box-shadow: inset 0px 0px 1px rgba(255, 255, 255, 1.0), 1px 1px 1px rgba(102, 102, 102, 0.2);
|
||||
-webkit-box-shadow: inset 0px 0px 1px rgba(255, 255, 255, 1.0), 1px 1px 1px rgba(102, 102, 102, 0.2);
|
||||
-moz-box-shadow: inset 0px 0px 1px rgba(255, 255, 255, 1.0), 1px 1px 1px rgba(102, 102, 102, 0.2);
|
||||
|
||||
border-radius: 2px;
|
||||
-webkit-border-radius: 2px;
|
||||
-moz-border-radius: 2px;
|
||||
|
||||
}
|
||||
input[type="submit"]:hover,input[type="reset"]:hover, input[type="button"]:hover, button:hover, .button:hover, .button.primaryAction:hover {
|
||||
border-color:#3a822e;
|
||||
color:#fff;
|
||||
color:eefcec;
|
||||
text-decoration:none;
|
||||
background: #809f43;
|
||||
|
||||
/*CSS3 properties*/
|
||||
filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, startColorstr='#ff9bb36c', endColorstr='#ff809f43');
|
||||
background: -webkit-gradient(linear, 0 0, 0 100%, from(rgba(110, 127, 69, 1.0)), rgba((106, 123, 66, 1.0)));
|
||||
background: -moz-linear-gradient(top, rgba(155, 179, 108, 1.0), rgba(128, 159, 67, 1.0));
|
||||
|
||||
}
|
||||
input[type="submit"]:active, input[type="reset"]:active, input[type="button"]:active, button:active, .buton:active, .button.primaryAction:active {
|
||||
text-decoration:none;
|
||||
background:#6a7b42;
|
||||
border:1px solid #487328;
|
||||
color:#fff;
|
||||
|
||||
/*CSS3 properties*/
|
||||
text-shadow: rgba(0,0,0,.5) 0px 0px 1px;
|
||||
filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=0, startColorstr='#ff6e7f45', endColorstr='#ff6a7b42');
|
||||
background: -webkit-gradient(linear, 0 0, 0 100%, from(rgba(110, 127, 69, 1.0)), rgba((106, 123, 66, 1.0)));
|
||||
background: -moz-linear-gradient(top, rgba(110, 127, 69, 1.0), rgba(106, 123, 66, 1.0));
|
||||
}
|
||||
input[type="submit"]:focus::-moz-focus-inner, button:focus::-moz-focus-inner, .button:focus::-moz-focus-inner {
|
||||
border: 1px dotted transparent;
|
||||
}
|
||||
|
||||
|
||||
|
||||
.clearboth {
|
||||
clear:both;
|
||||
}
|
@@ -27,7 +27,7 @@
|
||||
</head>
|
||||
<body id="orchardmediapicker">
|
||||
|
||||
<div id="tabs">
|
||||
<div id="tabs" class="group">
|
||||
<ul>
|
||||
<li><a href="#tab-url" data-edittext="@T("Update/Upload Image")" data-edittext-content="true">@T("Insert/Upload Image")</a></li>
|
||||
<li><a href="#tab-gallery">@T("Browse Gallery")</a></li>
|
||||
|
@@ -17,7 +17,7 @@
|
||||
@{
|
||||
var uploadAction = Url.Action("AddFromClient", "Admin", new { area = "Orchard.Media" });
|
||||
}
|
||||
<div style="float:left">
|
||||
<div id="gallery">
|
||||
|
||||
<div class="breadCrumbs">
|
||||
<p>@FolderLink(T("Media Folders").ToString(), "")
|
||||
@@ -32,6 +32,7 @@
|
||||
</fieldset>
|
||||
</div>
|
||||
<fieldset>
|
||||
<div id="file-list">
|
||||
<table class="items" summary="@T("This is a table of the images currently available for use in your application.")">
|
||||
@foreach (var mediaFolder in Model.MediaFolders) {
|
||||
<tr>
|
||||
@@ -57,6 +58,7 @@
|
||||
</tr>
|
||||
}
|
||||
</table>
|
||||
</div>
|
||||
@if (!String.IsNullOrWhiteSpace(Model.MediaPath)) {
|
||||
using (Html.BeginFormAntiForgeryPost(uploadAction, FormMethod.Post, new { id="lib-uploadform", enctype = "multipart/form-data", onsubmit = "jQuery.mediaPicker.uploadMedia(this)" })) {
|
||||
<input type="hidden" name="MediaPath" value="@Model.MediaPath" />
|
||||
@@ -71,9 +73,9 @@
|
||||
</fieldset>
|
||||
|
||||
</div>
|
||||
<div style="float:right">
|
||||
<div id="file-details">
|
||||
<img alt="" id="lib-loader" style="display:none" src="" />
|
||||
<fieldset style="width:200px">
|
||||
<fieldset>
|
||||
<label for="lib-src">@T("URL")</label>
|
||||
<input type="text" id="lib-src" />
|
||||
|
||||
@@ -107,9 +109,11 @@
|
||||
<input type="text" id="lib-height" />
|
||||
|
||||
<input type="checkbox" id="lib-lock" checked="checked" />
|
||||
<label for="lib-lock">@T("Lock Aspect Ratio")</label>
|
||||
<label class="forcheckbox" for="lib-lock">@T("Lock Aspect Ratio")</label>
|
||||
|
||||
<input type="button" id="lib-cancel" value="@T("Cancel")" />
|
||||
<div class="actions">
|
||||
<input type="button" id="lib-insert" value="@T("Insert")" class="disabled" data-edittext="@T("Update")" />
|
||||
<input type="button" id="lib-cancel" value="@T("Cancel")" />
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
@@ -12,7 +12,7 @@
|
||||
mediaPath = "";
|
||||
}
|
||||
}
|
||||
<div style="float:left;">
|
||||
<div id="image-preview">
|
||||
<img alt="" id="img-loader" style="display:none" src="" />
|
||||
<div class="media-largepreview">
|
||||
<img alt="@T("Preview of Image")" id="img-preview" src="TODO: some placeholder image" onload="jQuery.mediaPicker.scalePreview(this)" />
|
||||
@@ -32,8 +32,8 @@
|
||||
</div>
|
||||
|
||||
</div>
|
||||
<div style="float:right">
|
||||
<fieldset style="width:200px">
|
||||
<div id="file-details">
|
||||
<fieldset>
|
||||
<label for="img-alt">@T("Alternative Text")</label>
|
||||
<input type="text" id="img-alt" />
|
||||
|
||||
@@ -64,9 +64,11 @@
|
||||
<input type="text" id="img-height" />
|
||||
|
||||
<input type="checkbox" id="img-lock" checked="checked" />
|
||||
<label for="img-lock">@T("Lock Aspect Ratio")</label>
|
||||
<label class="forcheckbox" for="img-lock">@T("Lock Aspect Ratio")</label>
|
||||
|
||||
<input type="button" id="img-cancel" value="@T("Cancel")" />
|
||||
<div class="actions">
|
||||
<input type="button" id="img-insert" value="@T("Insert")" class="disabled" data-edittext="@T("Update")" />
|
||||
<input type="button" id="img-cancel" value="@T("Cancel")" />
|
||||
</div>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
@@ -3,21 +3,26 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using Orchard.Data.Migration;
|
||||
using Orchard.DisplayManagement;
|
||||
using Orchard.Environment.Descriptor.Models;
|
||||
using Orchard.Environment.Extensions;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
using Orchard.Environment.Features;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Logging;
|
||||
using Orchard.Modules.Events;
|
||||
using Orchard.Modules.Models;
|
||||
using Orchard.Modules.Services;
|
||||
using Orchard.Modules.ViewModels;
|
||||
using Orchard.Reports.Services;
|
||||
using Orchard.Security;
|
||||
using Orchard.UI.Navigation;
|
||||
using Orchard.UI.Notify;
|
||||
using Orchard.Utility.Extensions;
|
||||
|
||||
namespace Orchard.Modules.Controllers {
|
||||
public class AdminController : Controller {
|
||||
private readonly IExtensionDisplayEventHandler _extensionDisplayEventHandler;
|
||||
private readonly IModuleService _moduleService;
|
||||
private readonly IDataMigrationManager _dataMigrationManager;
|
||||
private readonly IReportsCoordinator _reportsCoordinator;
|
||||
@@ -25,21 +30,26 @@ namespace Orchard.Modules.Controllers {
|
||||
private readonly IFeatureManager _featureManager;
|
||||
private readonly ShellDescriptor _shellDescriptor;
|
||||
|
||||
public AdminController(IOrchardServices services,
|
||||
public AdminController(
|
||||
IEnumerable<IExtensionDisplayEventHandler> extensionDisplayEventHandlers,
|
||||
IOrchardServices services,
|
||||
IModuleService moduleService,
|
||||
IDataMigrationManager dataMigrationManager,
|
||||
IReportsCoordinator reportsCoordinator,
|
||||
IExtensionManager extensionManager,
|
||||
IFeatureManager featureManager,
|
||||
ShellDescriptor shellDescriptor)
|
||||
ShellDescriptor shellDescriptor,
|
||||
IShapeFactory shapeFactory)
|
||||
{
|
||||
Services = services;
|
||||
_extensionDisplayEventHandler = extensionDisplayEventHandlers.FirstOrDefault();
|
||||
_moduleService = moduleService;
|
||||
_dataMigrationManager = dataMigrationManager;
|
||||
_reportsCoordinator = reportsCoordinator;
|
||||
_extensionManager = extensionManager;
|
||||
_featureManager = featureManager;
|
||||
_shellDescriptor = shellDescriptor;
|
||||
Shape = shapeFactory;
|
||||
|
||||
T = NullLocalizer.Instance;
|
||||
Logger = NullLogger.Instance;
|
||||
@@ -48,20 +58,44 @@ namespace Orchard.Modules.Controllers {
|
||||
public Localizer T { get; set; }
|
||||
public IOrchardServices Services { get; set; }
|
||||
public ILogger Logger { get; set; }
|
||||
public dynamic Shape { get; set; }
|
||||
|
||||
public ActionResult Index() {
|
||||
public ActionResult Index(ModulesIndexOptions options, PagerParameters pagerParameters) {
|
||||
if (!Services.Authorizer.Authorize(StandardPermissions.SiteOwner, T("Not allowed to manage modules")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
IEnumerable<Module> modules = _extensionManager.AvailableExtensions()
|
||||
.Where(x => DefaultExtensionTypes.IsModule(x.ExtensionType))
|
||||
.Select(extensionDescriptor => new Module(extensionDescriptor) {
|
||||
IsRecentlyInstalled = _moduleService.IsRecentlyInstalled(extensionDescriptor)
|
||||
});
|
||||
Pager pager = new Pager(Services.WorkContext.CurrentSite, pagerParameters);
|
||||
|
||||
return View(new ModulesIndexViewModel {
|
||||
IEnumerable<ModuleEntry> modules = _extensionManager.AvailableExtensions()
|
||||
.Where(extensionDescriptor => DefaultExtensionTypes.IsModule(extensionDescriptor.ExtensionType) &&
|
||||
(string.IsNullOrEmpty(options.SearchText) || extensionDescriptor.Name.ToLowerInvariant().Contains(options.SearchText.ToLowerInvariant())))
|
||||
.OrderBy(extensionDescriptor => extensionDescriptor.Name)
|
||||
.Select(extensionDescriptor => {
|
||||
ModuleEntry moduleEntry = new ModuleEntry {
|
||||
Descriptor = extensionDescriptor,
|
||||
IsRecentlyInstalled = _moduleService.IsRecentlyInstalled(extensionDescriptor)
|
||||
};
|
||||
|
||||
if (_extensionDisplayEventHandler != null) {
|
||||
foreach (string notification in _extensionDisplayEventHandler.Displaying(moduleEntry.Descriptor)) {
|
||||
moduleEntry.Notifications.Add(notification);
|
||||
}
|
||||
}
|
||||
|
||||
return moduleEntry;
|
||||
});
|
||||
|
||||
int totalItemCount = modules.Count();
|
||||
|
||||
if (pager.PageSize != 0) {
|
||||
modules = modules.Skip((pager.Page - 1) * pager.PageSize).Take(pager.PageSize);
|
||||
}
|
||||
|
||||
return View(new ModulesIndexViewModel {
|
||||
Modules = modules,
|
||||
InstallModules = _featureManager.GetEnabledFeatures().FirstOrDefault(f => f.Id == "PackagingServices") != null
|
||||
InstallModules = _featureManager.GetEnabledFeatures().FirstOrDefault(f => f.Id == "PackagingServices") != null,
|
||||
Options = options,
|
||||
Pager = Shape.Pager(pager).TotalItemCount(totalItemCount)
|
||||
});
|
||||
}
|
||||
|
||||
|
@@ -0,0 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
using Orchard.Events;
|
||||
|
||||
namespace Orchard.Modules.Events {
|
||||
public interface IExtensionDisplayEventHandler : IEventHandler {
|
||||
/// <summary>
|
||||
/// Called before an extension is displayed
|
||||
/// </summary>
|
||||
IEnumerable<string> Displaying(ExtensionDescriptor extensionDescriptor);
|
||||
}
|
||||
}
|
@@ -1,21 +1,16 @@
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
using System.Collections.Generic;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
|
||||
namespace Orchard.Modules.ViewModels {
|
||||
namespace Orchard.Modules.Models {
|
||||
/// <summary>
|
||||
/// Represents a module.
|
||||
/// </summary>
|
||||
public class Module {
|
||||
public class ModuleEntry {
|
||||
/// <summary>
|
||||
/// Default constructor.
|
||||
/// </summary>
|
||||
public Module() {}
|
||||
|
||||
/// <summary>
|
||||
/// Instantiates a module based on an extension descriptor.
|
||||
/// </summary>
|
||||
/// <param name="extensionDescriptor">The extension descriptor.</param>
|
||||
public Module(ExtensionDescriptor extensionDescriptor) {
|
||||
Descriptor = extensionDescriptor;
|
||||
public ModuleEntry() {
|
||||
Notifications = new List<string>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -32,5 +27,10 @@ namespace Orchard.Modules.ViewModels {
|
||||
/// Boolean value indicating if the feature was recently installed.
|
||||
/// </summary>
|
||||
public bool IsRecentlyInstalled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// List of module notifications.
|
||||
/// </summary>
|
||||
public List<string> Notifications { get; set; }
|
||||
}
|
||||
}
|
@@ -1,6 +1,6 @@
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
|
||||
namespace Orchard.Modules.ViewModels {
|
||||
namespace Orchard.Modules.Models {
|
||||
/// <summary>
|
||||
/// Represents a module's feature.
|
||||
/// </summary>
|
@@ -43,6 +43,7 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\autofac\Autofac.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
@@ -52,14 +53,15 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AdminMenu.cs" />
|
||||
<Compile Include="Events\IExtensionDisplayEventHandler.cs" />
|
||||
<Compile Include="ResourceManifest.cs" />
|
||||
<Compile Include="Commands\FeatureCommands.cs" />
|
||||
<Compile Include="Controllers\AdminController.cs" />
|
||||
<Compile Include="Extensions\StringExtensions.cs" />
|
||||
<Compile Include="Models\DoghouseComparer.cs" />
|
||||
<Compile Include="Services\IModuleService.cs" />
|
||||
<Compile Include="ViewModels\Module.cs" />
|
||||
<Compile Include="ViewModels\ModuleFeature.cs" />
|
||||
<Compile Include="Models\ModuleEntry.cs" />
|
||||
<Compile Include="Models\ModuleFeature.cs" />
|
||||
<Compile Include="ViewModels\FeaturesViewModel.cs" />
|
||||
<Compile Include="Permissions.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
@@ -98,6 +100,9 @@
|
||||
<ItemGroup>
|
||||
<Content Include="web.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\ModuleEntry.cshtml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
@@ -7,7 +7,7 @@ using Orchard.Environment.Descriptor;
|
||||
using Orchard.Environment.Descriptor.Models;
|
||||
using Orchard.FileSystems.VirtualPath;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Modules.ViewModels;
|
||||
using Orchard.Modules.Models;
|
||||
using Orchard.UI.Notify;
|
||||
|
||||
namespace Orchard.Modules.Services {
|
||||
|
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.Modules.Models;
|
||||
|
||||
namespace Orchard.Modules.ViewModels {
|
||||
public class FeaturesViewModel {
|
||||
|
@@ -1,8 +1,16 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.Modules.Models;
|
||||
|
||||
namespace Orchard.Modules.ViewModels {
|
||||
public class ModulesIndexViewModel {
|
||||
public bool InstallModules { get; set; }
|
||||
public IEnumerable<Module> Modules { get; set; }
|
||||
public IEnumerable<ModuleEntry> Modules { get; set; }
|
||||
|
||||
public ModulesIndexOptions Options { get; set; }
|
||||
public dynamic Pager { get; set; }
|
||||
}
|
||||
|
||||
public class ModulesIndexOptions {
|
||||
public string SearchText { get; set; }
|
||||
}
|
||||
}
|
@@ -4,6 +4,7 @@
|
||||
@using Orchard.Modules.ViewModels;
|
||||
@using Orchard.Utility.Extensions;
|
||||
@using Orchard.Modules.Models;
|
||||
|
||||
@{
|
||||
Style.Require("ModulesAdmin");
|
||||
Style.Require("Switchable");
|
||||
|
@@ -1,40 +1,54 @@
|
||||
@model ModulesIndexViewModel
|
||||
@model Orchard.Modules.ViewModels.ModulesIndexViewModel
|
||||
@using Orchard.Localization;
|
||||
@using Orchard.Modules.Models;
|
||||
@using Orchard.Modules.Extensions;
|
||||
@using Orchard.Mvc.Html;
|
||||
@using Orchard.Modules.ViewModels;
|
||||
@using Orchard.Utility.Extensions;
|
||||
|
||||
@{
|
||||
Style.Require("ModulesAdmin");
|
||||
|
||||
var pageSizes = new List<int?>() { 10, 50, 100 };
|
||||
var defaultPageSize = WorkContext.CurrentSite.PageSize;
|
||||
if (!pageSizes.Contains(defaultPageSize)) {
|
||||
pageSizes.Add(defaultPageSize);
|
||||
}
|
||||
|
||||
Layout.Title = T("Modules").ToString();
|
||||
}
|
||||
|
||||
@if (Model.InstallModules) {
|
||||
<div class="manage">@Html.ActionLink(T("Install a module").ToString(), "AddModule", "PackagingServices", new { area = "Orchard.Packaging", returnUrl = HttpContext.Current.Request.RawUrl }, new { @class = "button primaryAction" })</div>
|
||||
}
|
||||
@using (Html.BeginFormAntiForgeryPost(Url.Action("Index", "Admin"))) {
|
||||
<fieldset class="bulk-actions">
|
||||
<input type="hidden" name="Page" value="1" />
|
||||
<label for="pageSize">@T("Show:")</label>
|
||||
<select id="pageSize" name="PageSize">
|
||||
@Html.SelectOption((int)Model.Pager.PageSize, 0, T("All").ToString())
|
||||
@foreach (int size in pageSizes.OrderBy(p => p)) {
|
||||
@Html.SelectOption((int)Model.Pager.PageSize, size, size.ToString())
|
||||
}
|
||||
</select>
|
||||
<button type="submit">@T("Apply")</button>
|
||||
</fieldset>
|
||||
|
||||
@if (Model.Modules.Count() > 0) {
|
||||
<ul class="contentItems">
|
||||
@foreach (var module in Model.Modules.OrderBy(m => m.Descriptor.Name)) {
|
||||
string moduleClasses = module.IsRecentlyInstalled ? "recentlyInstalledModule" : string.Empty;
|
||||
<fieldset class="search-actions">
|
||||
<input type="text" id="searchText" name="@Html.NameOf(m => m.Options.SearchText)" value="@Model.Options.SearchText" />
|
||||
|
||||
<li class="@moduleClasses">
|
||||
<div class="summary">
|
||||
<div class="properties">
|
||||
<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)) {
|
||||
<p>@module.Descriptor.Description</p>}
|
||||
<ul class="pageStatus" style="color:#666; margin:.6em 0 0 0;">
|
||||
<li>@T("Features: {0}", MvcHtmlString.Create(string.Join(", ", module.Descriptor.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("Website: ")
|
||||
@if (!string.IsNullOrEmpty(module.Descriptor.WebSite)) { <a href="@module.Descriptor.WebSite">@module.Descriptor.WebSite</a> }
|
||||
else { @T("Unknown").ToString() }
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</li>
|
||||
<button type="submit">@T("Search").ToString()</button>
|
||||
|
||||
@if (Model.InstallModules) {
|
||||
@Html.ActionLink(T("Install a module").ToString(), "AddModule", "PackagingServices", new { area = "Orchard.Packaging", returnUrl = HttpContext.Current.Request.RawUrl }, new { @class = "button primaryAction" })
|
||||
}
|
||||
</ul>
|
||||
</fieldset>
|
||||
|
||||
if (Model.Modules.Count() > 0) {
|
||||
<ul class="contentItems">
|
||||
@foreach (ModuleEntry module in Model.Modules.OrderBy(m => m.Descriptor.Name)) {
|
||||
<li>@Display.ModuleEntry(ContentPart: module)</li>
|
||||
}
|
||||
</ul>
|
||||
} else {
|
||||
<p>@T("No modules available").ToString()</p>
|
||||
}
|
||||
|
||||
@Display(Model.Pager)
|
||||
}
|
@@ -0,0 +1,32 @@
|
||||
@using Orchard.Modules.Extensions;
|
||||
@using Orchard.Mvc.Html;
|
||||
@using Orchard.Modules.ViewModels;
|
||||
@using Orchard.Environment.Extensions.Models;
|
||||
|
||||
@{ string moduleClasses = Model.ContentPart.IsRecentlyInstalled ? "recentlyInstalledModule" : string.Empty; }
|
||||
|
||||
<div class="summary @moduleClasses">
|
||||
<div class="properties">
|
||||
<h2>@Model.ContentPart.Descriptor.Name<span> - @T("Version: {0}", !string.IsNullOrEmpty(Model.ContentPart.Descriptor.Version) ? Model.ContentPart.Descriptor.Version : T("1.0").ToString())</span></h2>
|
||||
@if (!string.IsNullOrEmpty(Model.ContentPart.Descriptor.Description)) {
|
||||
<p>@Model.ContentPart.Descriptor.Description</p>}
|
||||
|
||||
@if (Model.ContentPart.Notifications != null && Model.ContentPart.Notifications.Count > 0) {
|
||||
<ul class="notifications">
|
||||
@foreach (string notification in Model.ContentPart.Notifications) {
|
||||
<li>@notification</li>
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
|
||||
<ul class="pageStatus" style="color:#666; margin:.6em 0 0 0;">
|
||||
@{ IEnumerable<FeatureDescriptor> features = Model.ContentPart.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("Author: {0}", !string.IsNullOrEmpty(Model.ContentPart.Descriptor.Author) ? Model.ContentPart.Descriptor.Author : T("Unknown").ToString())</li>
|
||||
<li> | @T("Website: ")
|
||||
@if (!string.IsNullOrEmpty(Model.ContentPart.Descriptor.WebSite)) { <a href="@Model.ContentPart.Descriptor.WebSite">@Model.ContentPart.Descriptor.WebSite</a> }
|
||||
else { @T("Unknown").ToString() }
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
@@ -4,6 +4,9 @@
|
||||
#main .features h3 {
|
||||
padding:0 3em 0 0;
|
||||
}
|
||||
.pageStatus {
|
||||
clear: both;
|
||||
}
|
||||
.features.detail-view .category > ul {
|
||||
border:1px solid #EAEAEA;
|
||||
margin-bottom:2em;
|
||||
@@ -145,4 +148,14 @@
|
||||
}
|
||||
.updateAvailable {
|
||||
background-color: #f1f0cb;
|
||||
}
|
||||
.search-actions {
|
||||
float: right;
|
||||
display: inline;
|
||||
height: auto;
|
||||
margin: 0 1.4em 0 0;
|
||||
padding-top: 0;
|
||||
}
|
||||
.manage {
|
||||
float: right;
|
||||
}
|
@@ -51,7 +51,7 @@ namespace Orchard.PackageManager.Controllers {
|
||||
}
|
||||
|
||||
public ActionResult ModulesUpdates(int? reportId) {
|
||||
return PackageUpdate("ModulesUpdate", DefaultExtensionTypes.Theme, reportId);
|
||||
return PackageUpdate("ModulesUpdate", DefaultExtensionTypes.Module, reportId);
|
||||
}
|
||||
|
||||
private ActionResult PackageUpdate(string view, string extensionType, int? reportId) {
|
||||
|
@@ -0,0 +1,43 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
using Orchard.Localization;
|
||||
using Orchard.PackageManager.Services;
|
||||
using Orchard.Packaging.Services;
|
||||
|
||||
namespace Orchard.PackageManager.Events {
|
||||
public class ExtensionDisplayEventHandler : IExtensionDisplayEventHandler {
|
||||
private readonly IBackgroundPackageUpdateStatus _backgroundPackageUpdateStatus;
|
||||
private readonly IPackagingSourceManager _packagingSourceManager;
|
||||
private readonly IPackageUpdateService _packageUpdateService;
|
||||
|
||||
public ExtensionDisplayEventHandler(IBackgroundPackageUpdateStatus backgroundPackageUpdateStatus,
|
||||
IPackagingSourceManager packagingSourceManager,
|
||||
IPackageUpdateService packageUpdateService) {
|
||||
|
||||
_backgroundPackageUpdateStatus = backgroundPackageUpdateStatus;
|
||||
_packagingSourceManager = packagingSourceManager;
|
||||
_packageUpdateService = packageUpdateService;
|
||||
|
||||
T = NullLocalizer.Instance;
|
||||
}
|
||||
|
||||
public Localizer T { get; set; }
|
||||
|
||||
public IEnumerable<string> Displaying(ExtensionDescriptor extensionDescriptor) {
|
||||
// Get status from background task state or directly
|
||||
_backgroundPackageUpdateStatus.Value =
|
||||
_backgroundPackageUpdateStatus.Value ??
|
||||
_packageUpdateService.GetPackagesStatus(_packagingSourceManager.GetSources());
|
||||
|
||||
UpdatePackageEntry updatePackageEntry = _backgroundPackageUpdateStatus.Value.Entries
|
||||
.Where(package => package.ExtensionsDescriptor.Id.Equals(extensionDescriptor.Id)).FirstOrDefault();
|
||||
|
||||
if (updatePackageEntry != null) {
|
||||
if (updatePackageEntry.NewVersionToInstall != null) {
|
||||
yield return T("New version available: {0}", updatePackageEntry.NewVersionToInstall.Version).ToString();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
using Orchard.Events;
|
||||
|
||||
namespace Orchard.PackageManager.Events {
|
||||
public interface IExtensionDisplayEventHandler : IEventHandler {
|
||||
/// <summary>
|
||||
/// Called before an extension is displayed
|
||||
/// </summary>
|
||||
IEnumerable<string> Displaying(ExtensionDescriptor extensionDescriptor);
|
||||
}
|
||||
}
|
@@ -81,6 +81,8 @@
|
||||
<ItemGroup>
|
||||
<Compile Include="AdminMenu.cs" />
|
||||
<Compile Include="Controllers\AdminController.cs" />
|
||||
<Compile Include="Events\ExtensionDisplayEventHandler.cs" />
|
||||
<Compile Include="Events\IExtensionDisplayEventHandler.cs" />
|
||||
<Compile Include="Services\BackgroundPackageUpdateStatus.cs" />
|
||||
<Compile Include="Services\BackgroundPackageUpdateTask.cs" />
|
||||
<Compile Include="Services\FolderUpdater.cs" />
|
||||
|
@@ -71,6 +71,7 @@
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</li>}
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
}
|
@@ -71,6 +71,7 @@
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</li>}
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
}
|
@@ -1,4 +1,3 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -151,7 +150,8 @@ namespace Orchard.Packaging.Controllers {
|
||||
source,
|
||||
packages => {
|
||||
packages = packages.Where(p => p.PackageType == packageType &&
|
||||
(string.IsNullOrEmpty(options.SearchText) || p.Id.Contains(options.SearchText)));
|
||||
p.IsLatestVersion &&
|
||||
(string.IsNullOrEmpty(options.SearchText) || p.Title.Contains(options.SearchText)));
|
||||
|
||||
switch (options.Order) {
|
||||
case PackagingExtensionsOrder.Downloads:
|
||||
@@ -170,14 +170,14 @@ namespace Orchard.Packaging.Controllers {
|
||||
}
|
||||
|
||||
return packages;
|
||||
}
|
||||
).ToArray();
|
||||
}).ToArray();
|
||||
|
||||
// count packages separately to prevent loading everything just to count
|
||||
totalCount += _packagingSourceManager.GetExtensionCount(
|
||||
source,
|
||||
packages => packages.Where(p => p.PackageType == packageType &&
|
||||
(string.IsNullOrEmpty(options.SearchText) || p.Id.Contains(options.SearchText)))
|
||||
p.IsLatestVersion &&
|
||||
(string.IsNullOrEmpty(options.SearchText) || p.Title.Contains(options.SearchText)))
|
||||
);
|
||||
|
||||
extensions = extensions == null ? sourceExtensions : extensions.Concat(sourceExtensions);
|
||||
|
@@ -14,11 +14,11 @@
|
||||
Layout.Title = T("Modules").ToString();
|
||||
}
|
||||
|
||||
@using ( Html.BeginFormAntiForgeryPost(Url.Action("Modules", "Gallery")) ) {
|
||||
@using (Html.BeginFormAntiForgeryPost(Url.Action("Modules", "Gallery")) ) {
|
||||
<fieldset class="bulk-actions">
|
||||
<label for="filterResults" class="bulk-filter">@T("Feed:")</label>
|
||||
<select id="sourceId" name="sourceId">
|
||||
@Html.SelectOption("", Model.SelectedSource == null, T("Any (show all feeds)").ToString())
|
||||
@Html.SelectOption("", Model.SelectedSource == null, T("All feeds").ToString())
|
||||
@foreach (var source in Model.Sources) {
|
||||
@Html.SelectOption(source.Id, Model.SelectedSource != null && Model.SelectedSource.Id == source.Id, source.FeedTitle)
|
||||
}
|
||||
@@ -36,7 +36,7 @@
|
||||
<label for="pageSize">@T("Show:")</label>
|
||||
<select id="pageSize" name="PageSize">
|
||||
@Html.SelectOption((int)Model.Pager.PageSize, 0, T("All").ToString())
|
||||
@foreach(int size in pageSizes.OrderBy(p => p)) {
|
||||
@foreach (int size in pageSizes.OrderBy(p => p)) {
|
||||
@Html.SelectOption((int)Model.Pager.PageSize, size, size.ToString())
|
||||
}
|
||||
</select>
|
||||
@@ -44,7 +44,7 @@
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="search-actions">
|
||||
<input type="text" id="searchText" name="@Html.NameOf(m => m.Options.SearchText)" />
|
||||
<input type="text" id="searchText" name="@Html.NameOf(m => m.Options.SearchText)" value="@Model.Options.SearchText" />
|
||||
|
||||
<button type="submit">@T("Search")</button>
|
||||
</fieldset>
|
||||
@@ -54,10 +54,10 @@
|
||||
@foreach (var item in Model.Extensions) {
|
||||
<li>
|
||||
@{
|
||||
string iconUrl = @item.IconUrl;
|
||||
if (string.IsNullOrWhiteSpace(iconUrl)) {
|
||||
iconUrl = Href("../../Content/Images/ModuleDefaultIcon.png");
|
||||
}
|
||||
string iconUrl = @item.IconUrl;
|
||||
if (string.IsNullOrWhiteSpace(iconUrl)) {
|
||||
iconUrl = Href("../../Content/Images/ModuleDefaultIcon.png");
|
||||
}
|
||||
}
|
||||
|
||||
<div class="iconThumbnail">
|
||||
@@ -80,7 +80,7 @@
|
||||
<div class="properties">
|
||||
<p>@(item.Description == null ? T("(No description").Text : item.Description)</p>
|
||||
<ul class="pageStatus">
|
||||
<li>@T("Last Updated: {0}", DateTime.Now.ToLocalTime())</li>
|
||||
<li>@T("Last Updated: {0}", item.LastUpdated)</li>
|
||||
<li> | @T("Author: {0}", !string.IsNullOrEmpty(item.Authors) ? item.Authors : T("Unknown").ToString())</li>
|
||||
<li> | @T("Downloads: {0}", item.DownloadCount)</li>
|
||||
<li> | @T("Website: ")
|
||||
|
@@ -85,7 +85,7 @@
|
||||
<div class="properties">
|
||||
<p>@(item.Description == null ? T("(No description").Text : item.Description)</p>
|
||||
<ul class="pageStatus">
|
||||
<li>@T("Last Updated: {0}", DateTime.Now.ToLocalTime())</li>
|
||||
<li>@T("Last Updated: {0}", item.LastUpdated)</li>
|
||||
<li> | @T("Author: {0}", !string.IsNullOrEmpty(item.Authors) ? item.Authors : T("Unknown").ToString())</li>
|
||||
<li> | @T("Downloads: {0}", item.DownloadCount)</li>
|
||||
<li> | @T("Website: ")
|
||||
@@ -107,5 +107,9 @@
|
||||
</div>
|
||||
</li>}
|
||||
</ul>
|
||||
} else {
|
||||
<p>@T("No themes available.").ToString()</p>
|
||||
}
|
||||
|
||||
@Display(Model.Pager)
|
||||
}
|
@@ -66,7 +66,7 @@ namespace Orchard.Themes.Commands {
|
||||
Context.Output.WriteLine(T("--------------------------"));
|
||||
themes.Where(t => t.Name.Trim().Equals(currentTheme.Name.Trim(), StringComparison.OrdinalIgnoreCase) == false)
|
||||
.ToList()
|
||||
.ForEach(t => WriteThemeLines(t));
|
||||
.ForEach(WriteThemeLines);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -13,6 +13,7 @@ using Orchard.Logging;
|
||||
using Orchard.Mvc.Extensions;
|
||||
using Orchard.Reports.Services;
|
||||
using Orchard.Security;
|
||||
using Orchard.Themes.Events;
|
||||
using Orchard.Themes.Models;
|
||||
using Orchard.Themes.Preview;
|
||||
using Orchard.Themes.Services;
|
||||
@@ -23,6 +24,7 @@ using Orchard.Utility.Extensions;
|
||||
namespace Orchard.Themes.Controllers {
|
||||
[ValidateInput(false)]
|
||||
public class AdminController : Controller {
|
||||
private readonly IExtensionDisplayEventHandler _extensionDisplayEventHandler;
|
||||
private readonly IDataMigrationManager _dataMigrationManager;
|
||||
private readonly IFeatureManager _featureManager;
|
||||
private readonly ISiteThemeService _siteThemeService;
|
||||
@@ -33,6 +35,7 @@ namespace Orchard.Themes.Controllers {
|
||||
private readonly IReportsCoordinator _reportsCoordinator;
|
||||
|
||||
public AdminController(
|
||||
IEnumerable<IExtensionDisplayEventHandler> extensionDisplayEventHandlers,
|
||||
IOrchardServices services,
|
||||
IDataMigrationManager dataMigraitonManager,
|
||||
IFeatureManager featureManager,
|
||||
@@ -44,6 +47,7 @@ namespace Orchard.Themes.Controllers {
|
||||
IReportsCoordinator reportsCoordinator) {
|
||||
Services = services;
|
||||
|
||||
_extensionDisplayEventHandler = extensionDisplayEventHandlers.FirstOrDefault();
|
||||
_dataMigrationManager = dataMigraitonManager;
|
||||
_siteThemeService = siteThemeService;
|
||||
_extensionManager = extensionManager;
|
||||
@@ -63,32 +67,44 @@ namespace Orchard.Themes.Controllers {
|
||||
|
||||
public ActionResult Index() {
|
||||
try {
|
||||
var featuresThatNeedUpdate = _dataMigrationManager.GetFeaturesThatNeedUpdate();
|
||||
bool installThemes = _featureManager.GetEnabledFeatures().FirstOrDefault(f => f.Id == "PackagingServices") != null;
|
||||
|
||||
var featuresThatNeedUpdate = _dataMigrationManager.GetFeaturesThatNeedUpdate();
|
||||
ThemeEntry currentTheme = new ThemeEntry(_siteThemeService.GetSiteTheme());
|
||||
IEnumerable<ThemeEntry> themes = _extensionManager.AvailableExtensions()
|
||||
.Where(extensionDescriptor => {
|
||||
bool hidden = false;
|
||||
string tags = extensionDescriptor.Tags;
|
||||
if (tags != null) {
|
||||
hidden = tags.Split(',').Any(t => t.Trim().Equals("hidden", StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
bool hidden = false;
|
||||
string tags = extensionDescriptor.Tags;
|
||||
if (tags != null) {
|
||||
hidden = tags.Split(',').Any(t => t.Trim().Equals("hidden", StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
|
||||
return !hidden &&
|
||||
DefaultExtensionTypes.IsTheme(extensionDescriptor.ExtensionType) &&
|
||||
!currentTheme.Descriptor.Id.Equals(extensionDescriptor.Id);
|
||||
})
|
||||
.Select(extensionDescriptor => new ThemeEntry(extensionDescriptor) {
|
||||
NeedsUpdate = featuresThatNeedUpdate.Contains(extensionDescriptor.Id),
|
||||
IsRecentlyInstalled = _themeService.IsRecentlyInstalled(extensionDescriptor),
|
||||
Enabled = _shellDescriptor.Features.Any(sf => sf.Name == extensionDescriptor.Id)
|
||||
})
|
||||
return !hidden &&
|
||||
DefaultExtensionTypes.IsTheme(extensionDescriptor.ExtensionType) &&
|
||||
!currentTheme.Descriptor.Id.Equals(extensionDescriptor.Id);
|
||||
})
|
||||
.Select(extensionDescriptor => {
|
||||
ThemeEntry themeEntry = new ThemeEntry(extensionDescriptor) {
|
||||
NeedsUpdate = featuresThatNeedUpdate.Contains(extensionDescriptor.Id),
|
||||
IsRecentlyInstalled = _themeService.IsRecentlyInstalled(extensionDescriptor),
|
||||
Enabled = _shellDescriptor.Features.Any(sf => sf.Name == extensionDescriptor.Id),
|
||||
CanUninstall = installThemes
|
||||
};
|
||||
|
||||
if (_extensionDisplayEventHandler != null) {
|
||||
foreach (string notification in _extensionDisplayEventHandler.Displaying(themeEntry.Descriptor)) {
|
||||
themeEntry.Notifications.Add(notification);
|
||||
}
|
||||
}
|
||||
|
||||
return themeEntry;
|
||||
})
|
||||
.ToArray();
|
||||
|
||||
return View(new ThemesIndexViewModel {
|
||||
CurrentTheme = currentTheme,
|
||||
Themes = themes,
|
||||
InstallThemes = _featureManager.GetEnabledFeatures().FirstOrDefault(f => f.Id == "PackagingServices") != null
|
||||
InstallThemes = installThemes
|
||||
});
|
||||
} catch (Exception exception) {
|
||||
this.Error(exception, T("Listing themes failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||
@@ -102,7 +118,10 @@ namespace Orchard.Themes.Controllers {
|
||||
try {
|
||||
if (!Services.Authorizer.Authorize(Permissions.ApplyTheme, T("Couldn't preview the current theme")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
_themeService.EnableThemeFeatures(themeName);
|
||||
_previewTheme.SetPreviewTheme(themeName);
|
||||
|
||||
return this.RedirectLocal(returnUrl, "~/");
|
||||
} catch (Exception exception) {
|
||||
this.Error(exception, T("Previewing theme failed: {0}", exception.Message), Logger, Services.Notifier);
|
||||
|
@@ -0,0 +1,12 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
using Orchard.Events;
|
||||
|
||||
namespace Orchard.Themes.Events {
|
||||
public interface IExtensionDisplayEventHandler : IEventHandler {
|
||||
/// <summary>
|
||||
/// Called before an extension is displayed
|
||||
/// </summary>
|
||||
IEnumerable<string> Displaying(ExtensionDescriptor extensionDescriptor);
|
||||
}
|
||||
}
|
@@ -1,3 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.Environment.Extensions.Models;
|
||||
|
||||
namespace Orchard.Themes.Models {
|
||||
@@ -43,6 +44,16 @@ namespace Orchard.Themes.Models {
|
||||
/// </summary>
|
||||
public bool IsRecentlyInstalled { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Boolean value indicating if the theme can be uninstalled.
|
||||
/// </summary>
|
||||
public bool CanUninstall { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// List of theme notifications.
|
||||
/// </summary>
|
||||
public List<string> Notifications { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The theme's name.
|
||||
/// </summary>
|
||||
|
@@ -49,11 +49,11 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="AdminMenu.cs" />
|
||||
<Compile Include="Models\ThemeEntry.cs" />
|
||||
<Compile Include="Commands\ThemeCommands.cs" />
|
||||
<Compile Include="Events\IExtensionDisplayEventHandler.cs" />
|
||||
<Compile Include="Models\ThemeEntry.cs" />
|
||||
<Compile Include="ResourceManifest.cs" />
|
||||
<Compile Include="Controllers\AdminController.cs" />
|
||||
<Compile Include="Migrations.cs" />
|
||||
<Compile Include="Handlers\ThemeSiteSettingsPartHandler.cs" />
|
||||
<Compile Include="Models\ThemeSiteSettingsPart.cs" />
|
||||
<Compile Include="Models\ThemeSiteSettingsPartRecord.cs" />
|
||||
@@ -103,6 +103,12 @@
|
||||
<ItemGroup>
|
||||
<Content Include="web.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\ThemeEntry.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\ThemeEntry.Current.cshtml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
@@ -15,20 +15,7 @@
|
||||
} else {
|
||||
<h3 id="currentThemeTitle">@T("Current Theme")</h3>
|
||||
|
||||
<div id="currentTheme">
|
||||
@Html.Image(Href(Html.ThemePath(Model.CurrentTheme.Descriptor, "/Theme.png")), Html.Encode(Model.CurrentTheme.Name), new { @class = "themePreviewImage" })
|
||||
|
||||
<div class="details">
|
||||
@Model.CurrentTheme.Name<br />
|
||||
@T("By") @Model.CurrentTheme.Descriptor.Author<br />
|
||||
@T("Version:") @Model.CurrentTheme.Descriptor.Version<br />
|
||||
@if (Model.CurrentTheme.Descriptor.WebSite != null) {
|
||||
<a href="@Model.CurrentTheme.Descriptor.WebSite">@Model.CurrentTheme.Descriptor.WebSite</a><br />
|
||||
}
|
||||
<br />
|
||||
<p>@Model.CurrentTheme.Descriptor.Description</p>
|
||||
</div>
|
||||
</div>
|
||||
@Display.ThemeEntry_Current(ContentPart: Model.CurrentTheme)
|
||||
}
|
||||
|
||||
<div id="installedBar">
|
||||
@@ -43,54 +30,8 @@
|
||||
<p>@T("There are no additional themes installed.")</p>
|
||||
} else {
|
||||
<ul class="templates">
|
||||
@foreach (ThemeEntry theme in Model.Themes) {
|
||||
string themeClasses = theme.IsRecentlyInstalled ? "recentlyInstalledTheme" : string.Empty;
|
||||
|
||||
<li class="@themeClasses">
|
||||
<div>
|
||||
<h3>@theme.Name</h3>
|
||||
@Html.Image(Href(Html.ThemePath(Model.CurrentTheme.Descriptor, "/Theme.png")), Html.Encode(Model.CurrentTheme.Name), null)
|
||||
|
||||
@using (Html.BeginFormAntiForgeryPost(Url.Action("Activate"), FormMethod.Post, new { @class = "inline" })) {
|
||||
@Html.Hidden("themeName", theme.Descriptor.Id)
|
||||
<button type="submit" title="@T("Activate")">@T("Set Current")</button>
|
||||
}
|
||||
|
||||
@using (Html.BeginFormAntiForgeryPost(Url.Action("Preview"), FormMethod.Post, new { @class = "inline" })) {
|
||||
@Html.Hidden("themeName", theme.Descriptor.Id)
|
||||
<button type="submit" title="@T("Preview")">@T("Preview")</button>
|
||||
}
|
||||
|
||||
<h5>@T("By") @theme.Descriptor.Author</h5>
|
||||
<p>
|
||||
@T("Version:") @theme.Descriptor.Version<br />
|
||||
@theme.Descriptor.Description<br />
|
||||
@if (theme.Descriptor.WebSite != null) {
|
||||
<a href="@theme.Descriptor.WebSite">@theme.Descriptor.WebSite</a><br />
|
||||
}
|
||||
</p>
|
||||
|
||||
@if (theme.Enabled) {
|
||||
using (Html.BeginFormAntiForgeryPost(Url.Action("Disable"), FormMethod.Post, new { @class = "inline link" })) {
|
||||
@Html.Hidden("themeName", theme.Descriptor.Id)
|
||||
<button type="submit" title="Disable">@T("Disable")</button>
|
||||
}
|
||||
}
|
||||
|
||||
@if (theme.NeedsUpdate) {
|
||||
using (Html.BeginFormAntiForgeryPost(Url.Action("Update"), FormMethod.Post, new { @class = "inline link" })) {
|
||||
@Html.Hidden("themeName", theme.Descriptor.Id)
|
||||
<button type="submit" class="update">@T("Update")</button> <br/>
|
||||
}
|
||||
}
|
||||
|
||||
@if (Model.InstallThemes) {
|
||||
using (Html.BeginFormAntiForgeryPost(Url.Action("RemoveTheme", "PackagingServices", new { area = "Orchard.Packaging", returnUrl = HttpContext.Current.Request.RawUrl, retryUrl = HttpContext.Current.Request.RawUrl, themeId = theme.Descriptor.Id }), FormMethod.Post, new { @class = "inline link" })) {
|
||||
<button type="submit" class="uninstall" title="@T("Uninstall")">@T("Uninstall")</button>
|
||||
}
|
||||
}
|
||||
</div>
|
||||
</li>
|
||||
@foreach (ThemeEntry themeEntry in Model.Themes) {
|
||||
<li>@Display.ThemeEntry(ContentPart: themeEntry)</li>
|
||||
}
|
||||
</ul>
|
||||
}
|
@@ -0,0 +1,18 @@
|
||||
@using Orchard.Themes.Models
|
||||
@using Orchard.Mvc.Html
|
||||
@using Orchard.Environment.Extensions.Models
|
||||
|
||||
<div id="currentTheme">
|
||||
@Html.Image(Href(Html.ThemePath((ExtensionDescriptor)Model.ContentPart.Descriptor, "/Theme.png")), Html.Encode((string)Model.ContentPart.Name), new { @class = "themePreviewImage" })
|
||||
|
||||
<div class="details">
|
||||
@Model.ContentPart.Name<br />
|
||||
@T("By") @Model.ContentPart.Descriptor.Author<br />
|
||||
@T("Version:") @Model.ContentPart.Descriptor.Version<br />
|
||||
@if (Model.ContentPart.Descriptor.WebSite != null) {
|
||||
<a href="@Model.ContentPart.Descriptor.WebSite">@Model.ContentPart.Descriptor.WebSite</a><br />
|
||||
}
|
||||
<br />
|
||||
<p>@Model.ContentPart.Descriptor.Description</p>
|
||||
</div>
|
||||
</div>
|
@@ -0,0 +1,58 @@
|
||||
@using Orchard.Themes.Models
|
||||
@using Orchard.Mvc.Html
|
||||
@using Orchard.Environment.Extensions.Models
|
||||
|
||||
@{ string themeClasses = Model.ContentPart.IsRecentlyInstalled ? "recentlyInstalledTheme" : string.Empty; }
|
||||
|
||||
<div class="@themeClasses">
|
||||
|
||||
<h3>@Model.ContentPart.Name</h3>
|
||||
|
||||
@Html.Image(Href(Html.ThemePath((ExtensionDescriptor) Model.ContentPart.Descriptor, "/Theme.png")), Html.Encode((string)Model.ContentPart.Name), null)
|
||||
@using (Html.BeginFormAntiForgeryPost(Url.Action("Activate"), FormMethod.Post, new { @class = "inline" })) {
|
||||
@Html.Hidden("themeName", (string)Model.ContentPart.Descriptor.Id)
|
||||
<button type="submit" title="@T("Activate")">@T("Set Current")</button>
|
||||
}
|
||||
|
||||
@using (Html.BeginFormAntiForgeryPost(Url.Action("Preview"), FormMethod.Post, new { @class = "inline" })) {
|
||||
@Html.Hidden("themeName", (string)Model.ContentPart.Descriptor.Id)
|
||||
<button type="submit" title="@T("Preview")">@T("Preview")</button>
|
||||
}
|
||||
|
||||
<h5>@T("By") @Model.ContentPart.Descriptor.Author</h5>
|
||||
<p>
|
||||
@T("Version:") @Model.ContentPart.Descriptor.Version<br />
|
||||
@Model.ContentPart.Descriptor.Description<br />
|
||||
@if (Model.ContentPart.Descriptor.WebSite != null) {
|
||||
<a href="@Model.ContentPart.Descriptor.WebSite">@Model.ContentPart.Descriptor.WebSite</a><br />
|
||||
}
|
||||
</p>
|
||||
|
||||
@if (Model.ContentPart.Notifications != null && Model.ContentPart.Notifications.Count > 0) {
|
||||
<ul class="notifications">
|
||||
@foreach (string notification in Model.ContentPart.Notifications) {
|
||||
<li>@notification</li>
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
|
||||
@if (Model.ContentPart.Enabled) {
|
||||
using (Html.BeginFormAntiForgeryPost(Url.Action("Disable"), FormMethod.Post, new { @class = "inline link" })) {
|
||||
@Html.Hidden("themeName", (string)Model.ContentPart.Descriptor.Id)
|
||||
<button type="submit" title="Disable">@T("Disable")</button>
|
||||
}
|
||||
}
|
||||
|
||||
@if (Model.ContentPart.NeedsUpdate) {
|
||||
using (Html.BeginFormAntiForgeryPost(Url.Action("Update"), FormMethod.Post, new { @class = "inline link" })) {
|
||||
@Html.Hidden("themeName", (string)Model.ContentPart.Descriptor.Id)
|
||||
<button type="submit" class="update">@T("Update")</button> <br/>
|
||||
}
|
||||
}
|
||||
|
||||
@if (Model.ContentPart.CanUninstall) {
|
||||
using (Html.BeginFormAntiForgeryPost(Url.Action("RemoveTheme", "PackagingServices", new { area = "Orchard.Packaging", returnUrl = HttpContext.Current.Request.RawUrl, retryUrl = HttpContext.Current.Request.RawUrl, themeId = Model.ContentPart.Descriptor.Id }), FormMethod.Post, new { @class = "inline link" })) {
|
||||
<button type="submit" class="uninstall" title="@T("Uninstall")">@T("Uninstall")</button>
|
||||
}
|
||||
}
|
||||
</div>
|
@@ -67,5 +67,4 @@ html.dyn #themepreview button.preview { display:none; }
|
||||
<button type="submit" class="cancel" title="@T("Cancel")" name="submit.Cancel" value="@T("Cancel")">@T("Cancel")</button>
|
||||
</fieldset>
|
||||
}
|
||||
</div>
|
||||
|
||||
</div>
|
Reference in New Issue
Block a user