ThemeService now finds first theme that is _enabled_ in priority list. If no theme exists or is enabled the SafeMode theme is selected.

--HG--
branch : dev
This commit is contained in:
Dave Reed
2010-10-19 13:34:39 -07:00
parent cb9c8e4f0f
commit cb17abd73a

View File

@@ -154,11 +154,11 @@ namespace Orchard.Themes.Services {
foreach (var theme in requestTheme) { foreach (var theme in requestTheme) {
var t = GetThemeByName(theme.ThemeName); var t = GetThemeByName(theme.ThemeName);
if (t != null) if (t != null && t.Enabled)
return t; return t;
} }
return null; return GetThemeByName("SafeMode");
} }
public ITheme GetThemeByName(string name) { public ITheme GetThemeByName(string name) {
@@ -221,7 +221,8 @@ namespace Orchard.Themes.Services {
} }
private bool IsThemeEnabled(ExtensionDescriptor descriptor) { private bool IsThemeEnabled(ExtensionDescriptor descriptor) {
return _shellDescriptorManager.GetShellDescriptor().Features.Any(sf => sf.Name == descriptor.Name); return (descriptor.Name == "TheAdmin" || descriptor.Name == "SafeMode") ||
_shellDescriptorManager.GetShellDescriptor().Features.Any(sf => sf.Name == descriptor.Name);
} }
private ITheme CreateTheme(ExtensionDescriptor descriptor) { private ITheme CreateTheme(ExtensionDescriptor descriptor) {