- 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:
suhacan
2009-12-11 00:40:44 +00:00
parent f1c20b3da7
commit ff412f1f7e
7 changed files with 49 additions and 1 deletions

View File

@@ -136,6 +136,7 @@
<Content Include="Themes\Views\Models\EditorTemplates\ThemeSiteSettingsRecord.ascx" />
</ItemGroup>
<ItemGroup>
<Content Include="Themes\Views\Admin\Install.aspx" />
<Content Include="Themes\Views\Web.config" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />

View File

@@ -4,6 +4,7 @@ using Orchard.Core.Themes.ViewModels;
using Orchard.Localization;
using Orchard.Themes;
using Orchard.UI.Notify;
using Orchard.Mvc.ViewModels;
namespace Orchard.Core.Themes.Controllers {
[ValidateInput(false)]
@@ -42,5 +43,20 @@ namespace Orchard.Core.Themes.Controllers {
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");
}
}
}
}

View File

@@ -13,7 +13,8 @@
<div>
<h3>Current Theme</h3>
<% 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 { %>
<h4><%= Model.CurrentTheme.DisplayName %> </h4>
<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.Description %><br />
<%= Model.CurrentTheme.HomePage %><br />
<%=Html.ActionLink("Install a new Theme", "Install") %>
</p>
<% } %>
</div>

View 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"); %>