Delegating theme installation to Orchard.Packaging.

--HG--
branch : dev
This commit is contained in:
Andre Rodrigues
2010-12-01 16:42:36 -08:00
parent 48ccf121f8
commit a1543c964f
7 changed files with 26 additions and 19 deletions

View File

@@ -1,16 +1,13 @@
using System;
using System.Linq;
using System.Reflection;
using System.Web;
using System.Web.Mvc;
using Orchard.Data.Migration;
using Orchard.DisplayManagement;
using Orchard.Environment.Descriptor.Models;
using Orchard.Environment.Extensions;
using Orchard.Environment.Features;
using Orchard.Localization;
using Orchard.Reports.Services;
using Orchard.Security;
using Orchard.Themes.Preview;
using Orchard.Themes.Services;
using Orchard.Themes.ViewModels;
@@ -19,35 +16,36 @@ using Orchard.UI.Notify;
namespace Orchard.Themes.Controllers {
[ValidateInput(false)]
public class AdminController : Controller {
private readonly IDataMigrationManager _dataMigrationManager;
private readonly IFeatureManager _featureManager;
private readonly ISiteThemeService _siteThemeService;
private readonly IPreviewTheme _previewTheme;
private readonly IExtensionManager _extensionManager;
private readonly ShellDescriptor _shellDescriptor;
private readonly IPreviewTheme _previewTheme;
private readonly IThemeService _themeService;
private readonly IDataMigrationManager _dataMigrationManager;
private readonly IReportsCoordinator _reportsCoordinator;
public AdminController(
IDataMigrationManager dataMigraitonManager,
IReportsCoordinator reportsCoordinator,
IOrchardServices services,
IThemeManager themeManager,
IDataMigrationManager dataMigraitonManager,
IFeatureManager featureManager,
ISiteThemeService siteThemeService,
IPreviewTheme previewTheme,
IAuthorizer authorizer,
INotifier notifier,
IExtensionManager extensionManager,
ShellDescriptor shellDescriptor,
IThemeService themeService) {
IPreviewTheme previewTheme,
IThemeService themeService,
IReportsCoordinator reportsCoordinator) {
Services = services;
_dataMigrationManager = dataMigraitonManager;
_reportsCoordinator = reportsCoordinator;
_siteThemeService = siteThemeService;
_previewTheme = previewTheme;
_extensionManager = extensionManager;
_shellDescriptor = shellDescriptor;
_featureManager = featureManager;
_previewTheme = previewTheme;
_themeService = themeService;
_reportsCoordinator = reportsCoordinator;
T = NullLocalizer.Instance;
}
@@ -68,8 +66,9 @@ namespace Orchard.Themes.Controllers {
})
.ToArray();
var model = new ThemesIndexViewModel { CurrentTheme = currentTheme, Themes = themes };
return View(model);
return View(new ThemesIndexViewModel {
CurrentTheme = currentTheme, Themes = themes,
InstallThemes = _featureManager.GetEnabledFeatures().FirstOrDefault(f => f.Id == "Gallery") != null });
}
catch (Exception exception) {
Services.Notifier.Error(T("Listing themes failed: " + exception.Message));