diff --git a/src/Orchard.Tests/Environment/DefaultOrchardHostTests.cs b/src/Orchard.Tests/Environment/DefaultOrchardHostTests.cs
index 7ac2b2939..eafe8626f 100644
--- a/src/Orchard.Tests/Environment/DefaultOrchardHostTests.cs
+++ b/src/Orchard.Tests/Environment/DefaultOrchardHostTests.cs
@@ -59,6 +59,10 @@ namespace Orchard.Tests.Environment {
public void InstallExtension(string extensionType, HttpPostedFileBase extensionBundle) {
throw new NotImplementedException();
}
+
+ public void UninstallExtension(string extensionType, string extensionName) {
+ throw new NotImplementedException();
+ }
}
[Test]
diff --git a/src/Orchard.Tests/Mvc/Routes/StandardExtensionRouteProviderTests.cs b/src/Orchard.Tests/Mvc/Routes/StandardExtensionRouteProviderTests.cs
index 06e9d0e62..0a9083bcf 100644
--- a/src/Orchard.Tests/Mvc/Routes/StandardExtensionRouteProviderTests.cs
+++ b/src/Orchard.Tests/Mvc/Routes/StandardExtensionRouteProviderTests.cs
@@ -57,6 +57,10 @@ namespace Orchard.Tests.Mvc.Routes {
public void InstallExtension(string extensionType, HttpPostedFileBase extensionBundle) {
throw new NotImplementedException();
}
+
+ public void UninstallExtension(string extensionType, string extensionName) {
+ throw new NotImplementedException();
+ }
}
}
}
diff --git a/src/Orchard.Web/Core/Themes/Controllers/AdminController.cs b/src/Orchard.Web/Core/Themes/Controllers/AdminController.cs
index a3ad751ca..ae492fd0d 100644
--- a/src/Orchard.Web/Core/Themes/Controllers/AdminController.cs
+++ b/src/Orchard.Web/Core/Themes/Controllers/AdminController.cs
@@ -67,7 +67,20 @@ namespace Orchard.Core.Themes.Controllers {
return RedirectToAction("Index");
}
catch (Exception exception) {
- _notifier.Error("Installing theme failed: " + exception.Message);
+ _notifier.Error(T("Installing theme failed: " + exception.Message));
+ return RedirectToAction("Index");
+ }
+ }
+
+ public ActionResult Uninstall(string themeName) {
+ try {
+ if (!_authorizer.Authorize(Permissions.InstallUninstallTheme, T("Couldn't uninstall theme")))
+ return new HttpUnauthorizedResult();
+ _themeService.UninstallTheme(themeName);
+ return RedirectToAction("Index");
+ }
+ catch (Exception exception) {
+ _notifier.Error(T("Uninstalling theme failed: " + exception.Message));
return RedirectToAction("Index");
}
}
diff --git a/src/Orchard.Web/Core/Themes/Services/ThemeService.cs b/src/Orchard.Web/Core/Themes/Services/ThemeService.cs
index ee4285b03..469774a40 100644
--- a/src/Orchard.Web/Core/Themes/Services/ThemeService.cs
+++ b/src/Orchard.Web/Core/Themes/Services/ThemeService.cs
@@ -76,6 +76,10 @@ namespace Orchard.Core.Themes.Services {
_extensionManager.InstallExtension("Theme", file);
}
+ public void UninstallTheme(string themeName) {
+ _extensionManager.UninstallExtension("Theme", themeName);
+ }
+
#endregion
}
}
diff --git a/src/Orchard.Web/Core/Themes/Views/Admin/Index.aspx b/src/Orchard.Web/Core/Themes/Views/Admin/Index.aspx
index 655dfdf40..a3edbe965 100644
--- a/src/Orchard.Web/Core/Themes/Views/Admin/Index.aspx
+++ b/src/Orchard.Web/Core/Themes/Views/Admin/Index.aspx
@@ -27,7 +27,7 @@
<%= theme.Version %>
<%= theme.Description %>
<%= theme.HomePage %>
- <%=Html.ActionLink("Activate", "Activate", new {themeName = theme.ThemeName}) %>
+ <%=Html.ActionLink("Activate", "Activate", new {themeName = theme.ThemeName}) %> | <%=Html.ActionLink("Uninstall", "Uninstall", new {themeName = theme.ThemeName}) %>