--HG--
branch : perf
This commit is contained in:
Louis DeJardin
2010-11-04 20:38:41 -07:00
45 changed files with 318 additions and 345 deletions

View File

@@ -6,17 +6,19 @@ using Orchard.Environment.Extensions;
using Orchard.Environment.Extensions.Models;
using Orchard.Localization;
using Orchard.Logging;
using Orchard.Settings;
using Orchard.Themes.Models;
namespace Orchard.Themes.Services {
[UsedImplicitly]
public class SiteThemeSelector : IThemeSelector {
private readonly IOrchardServices _orchardServices;
protected virtual ISite CurrentSite { get; [UsedImplicitly] private set; }
public SiteThemeSelector(IOrchardServices orchardServices) {
_orchardServices = orchardServices;
}
public ThemeSelectorResult GetTheme(RequestContext context) {
string currentThemeName = CurrentSite.As<ThemeSiteSettingsPart>().Record.CurrentThemeName;
string currentThemeName = _orchardServices.WorkContext.CurrentSite.As<ThemeSiteSettingsPart>().Record.CurrentThemeName;
if (String.IsNullOrEmpty(currentThemeName)) {
return null;

View File

@@ -12,7 +12,6 @@ using Orchard.Localization;
using Orchard.Logging;
using Orchard.ContentManagement;
using Orchard.Modules;
using Orchard.Settings;
using Orchard.Themes.Models;
namespace Orchard.Themes.Services {
@@ -23,6 +22,7 @@ namespace Orchard.Themes.Services {
private readonly IModuleService _moduleService;
private readonly IWorkContextAccessor _workContextAccessor;
private readonly ShellDescriptor _shellDescriptor;
private readonly IOrchardServices _orchardServices;
private readonly IShellDescriptorManager _shellDescriptorManager;
public ThemeService(
@@ -31,20 +31,21 @@ namespace Orchard.Themes.Services {
IEnumerable<IThemeSelector> themeSelectors,
IModuleService moduleService,
IWorkContextAccessor workContextAccessor,
ShellDescriptor shellDescriptor) {
ShellDescriptor shellDescriptor,
IOrchardServices orchardServices) {
_shellDescriptorManager = shellDescriptorManager;
_extensionManager = extensionManager;
_themeSelectors = themeSelectors;
_moduleService = moduleService;
_workContextAccessor = workContextAccessor;
_shellDescriptor = shellDescriptor;
_orchardServices = orchardServices;
Logger = NullLogger.Instance;
T = NullLocalizer.Instance;
}
public Localizer T { get; set; }
public ILogger Logger { get; set; }
protected virtual ISite CurrentSite { get; [UsedImplicitly] private set; }
public void EnableTheme(string themeName) {
DoEnableTheme(themeName);