mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-23 04:43:35 +08:00
- Themes: adding views and actions for installing a theme.
- Extensions: Added a new method to the IExtensionManager for installing extensions (from local zip files currently) --HG-- extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4043760
This commit is contained in:
@@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Web;
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using System.Web.Routing;
|
using System.Web.Routing;
|
||||||
using Autofac;
|
using Autofac;
|
||||||
@@ -54,6 +55,10 @@ namespace Orchard.Tests.Environment {
|
|||||||
public IEnumerable<ExtensionEntry> ActiveExtensions() {
|
public IEnumerable<ExtensionEntry> ActiveExtensions() {
|
||||||
return Enumerable.Empty<ExtensionEntry>();
|
return Enumerable.Empty<ExtensionEntry>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void InstallExtension(HttpPostedFileBase extensionBundle) {
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
|
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Web;
|
||||||
using System.Web.Routing;
|
using System.Web.Routing;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using Orchard.Mvc.Routes;
|
using Orchard.Mvc.Routes;
|
||||||
@@ -52,6 +53,10 @@ namespace Orchard.Tests.Mvc.Routes {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void InstallExtension(HttpPostedFileBase extensionBundle) {
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -136,6 +136,7 @@
|
|||||||
<Content Include="Themes\Views\Models\EditorTemplates\ThemeSiteSettingsRecord.ascx" />
|
<Content Include="Themes\Views\Models\EditorTemplates\ThemeSiteSettingsRecord.ascx" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Content Include="Themes\Views\Admin\Install.aspx" />
|
||||||
<Content Include="Themes\Views\Web.config" />
|
<Content Include="Themes\Views\Web.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
|
@@ -4,6 +4,7 @@ using Orchard.Core.Themes.ViewModels;
|
|||||||
using Orchard.Localization;
|
using Orchard.Localization;
|
||||||
using Orchard.Themes;
|
using Orchard.Themes;
|
||||||
using Orchard.UI.Notify;
|
using Orchard.UI.Notify;
|
||||||
|
using Orchard.Mvc.ViewModels;
|
||||||
|
|
||||||
namespace Orchard.Core.Themes.Controllers {
|
namespace Orchard.Core.Themes.Controllers {
|
||||||
[ValidateInput(false)]
|
[ValidateInput(false)]
|
||||||
@@ -42,5 +43,20 @@ namespace Orchard.Core.Themes.Controllers {
|
|||||||
return RedirectToAction("Index");
|
return RedirectToAction("Index");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ActionResult Install() {
|
||||||
|
return View(new AdminViewModel());
|
||||||
|
}
|
||||||
|
|
||||||
|
[AcceptVerbs(HttpVerbs.Post)]
|
||||||
|
public ActionResult Install(FormCollection input) {
|
||||||
|
try {
|
||||||
|
return RedirectToAction("Index");
|
||||||
|
}
|
||||||
|
catch (Exception exception) {
|
||||||
|
_notifier.Error("Installing theme failed: " + exception.Message);
|
||||||
|
return RedirectToAction("Index");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -13,7 +13,8 @@
|
|||||||
<div>
|
<div>
|
||||||
<h3>Current Theme</h3>
|
<h3>Current Theme</h3>
|
||||||
<% if (Model.CurrentTheme == null) { %>
|
<% if (Model.CurrentTheme == null) { %>
|
||||||
There is no current theme in the application. The built-in theme will be used.
|
<p>There is no current theme in the application. The built-in theme will be used.<br />
|
||||||
|
<%=Html.ActionLink("Install a new Theme", "Install") %></p>
|
||||||
<% } else { %>
|
<% } else { %>
|
||||||
<h4><%= Model.CurrentTheme.DisplayName %> </h4>
|
<h4><%= Model.CurrentTheme.DisplayName %> </h4>
|
||||||
<p><img src="<%= ResolveUrl("~/Themes/" + Model.CurrentTheme.ThemeName + "/Theme.gif")%>" alt="<%= Model.CurrentTheme.DisplayName %>" /><br />
|
<p><img src="<%= ResolveUrl("~/Themes/" + Model.CurrentTheme.ThemeName + "/Theme.gif")%>" alt="<%= Model.CurrentTheme.DisplayName %>" /><br />
|
||||||
@@ -21,6 +22,7 @@
|
|||||||
<%= Model.CurrentTheme.Version %><br />
|
<%= Model.CurrentTheme.Version %><br />
|
||||||
<%= Model.CurrentTheme.Description %><br />
|
<%= Model.CurrentTheme.Description %><br />
|
||||||
<%= Model.CurrentTheme.HomePage %><br />
|
<%= Model.CurrentTheme.HomePage %><br />
|
||||||
|
<%=Html.ActionLink("Install a new Theme", "Install") %>
|
||||||
</p>
|
</p>
|
||||||
<% } %>
|
<% } %>
|
||||||
</div>
|
</div>
|
||||||
|
13
src/Orchard.Web/Core/Themes/Views/Admin/Install.aspx
Normal file
13
src/Orchard.Web/Core/Themes/Views/Admin/Install.aspx
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
<%@ Page Language="C#" Inherits="System.Web.Mvc.ViewPage" %>
|
||||||
|
<%@ Import Namespace="Orchard.Mvc.Html"%>
|
||||||
|
<% Html.Include("AdminHead"); %>
|
||||||
|
<h2>Install Theme</h2>
|
||||||
|
<% using (Html.BeginForm("Install", "Admin", FormMethod.Post, new { enctype = "multipart/form-data" })) {%>
|
||||||
|
<%= Html.ValidationSummary() %>
|
||||||
|
<fieldset>
|
||||||
|
<label for="pageTitle">File Path to the zip file:</label>
|
||||||
|
<input id="ThemeZipPath" name="ThemeZipPath" type="file" class="text" value="Browse" size="64"/><br />
|
||||||
|
<input type="submit" class="button" value="Install" />
|
||||||
|
</fieldset>
|
||||||
|
<% } %>
|
||||||
|
<% Html.Include("AdminFoot"); %>
|
@@ -3,11 +3,13 @@ using System.Collections.Generic;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Orchard.Extensions.Loaders;
|
using Orchard.Extensions.Loaders;
|
||||||
using Yaml.Grammar;
|
using Yaml.Grammar;
|
||||||
|
using System.Web;
|
||||||
|
|
||||||
namespace Orchard.Extensions {
|
namespace Orchard.Extensions {
|
||||||
public interface IExtensionManager {
|
public interface IExtensionManager {
|
||||||
IEnumerable<ExtensionDescriptor> AvailableExtensions();
|
IEnumerable<ExtensionDescriptor> AvailableExtensions();
|
||||||
IEnumerable<ExtensionEntry> ActiveExtensions();
|
IEnumerable<ExtensionEntry> ActiveExtensions();
|
||||||
|
void InstallExtension(HttpPostedFileBase extensionBundle);
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ExtensionManager : IExtensionManager {
|
public class ExtensionManager : IExtensionManager {
|
||||||
@@ -66,6 +68,10 @@ namespace Orchard.Extensions {
|
|||||||
return _activeExtensions;
|
return _activeExtensions;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void InstallExtension(HttpPostedFileBase extensionBundle) {
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
|
||||||
private IEnumerable<ExtensionEntry> BuildActiveExtensions() {
|
private IEnumerable<ExtensionEntry> BuildActiveExtensions() {
|
||||||
//TODO: this component needs access to some "current settings" to know which are active
|
//TODO: this component needs access to some "current settings" to know which are active
|
||||||
foreach (var descriptor in AvailableExtensions()) {
|
foreach (var descriptor in AvailableExtensions()) {
|
||||||
|
Reference in New Issue
Block a user