Continued work on theming fundamentals

--HG--
extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4044118
This commit is contained in:
loudej
2009-12-15 23:19:15 +00:00
parent 7b777ef4f6
commit d2cc190fd7
17 changed files with 396 additions and 41 deletions

View File

@@ -76,6 +76,7 @@
<Compile Include="Common\ViewModels\BodyEditorViewModel.cs" />
<Compile Include="Common\ViewModels\OwnerEditorViewModel.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Themes\SafeModeThemeSelector.cs" />
<Compile Include="Settings\AdminMenu.cs" />
<Compile Include="Settings\Controllers\AdminController.cs" />
<Compile Include="Settings\Models\SiteSettingsHandler.cs" />
@@ -138,6 +139,7 @@
<Content Include="Themes\Views\Models\EditorTemplates\ThemeSiteSettingsRecord.ascx" />
</ItemGroup>
<ItemGroup>
<Content Include="SafeMode\Theme.txt" />
<Content Include="Themes\Views\Admin\Install.aspx" />
<Content Include="Themes\Views\Web.config" />
</ItemGroup>

View File

@@ -0,0 +1 @@
name: SafeMode

View File

@@ -0,0 +1,25 @@

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>
<asp:ContentPlaceHolder ID="TitleContent" runat="server" />
</title>
<link href="<%= ResolveUrl("../../Content/Site.css")%>" rel="stylesheet" type="text/css" />
<link rel="wlwmanifest" type="application/wlwmanifest+xml" href="<%= ResolveUrl("~/xmlrpc/livewriter/manifest?r="+DateTime.UtcNow.Ticks) %>" />
</head>
<body>
<div class="page">
<div id="header">
<%Html.RenderPartial("Header"); %>
<%Html.RenderPartial("Navigation"); %>
</div>
<div id="main">
<asp:ContentPlaceHolder ID="MainContent" runat="server" />
<div id="footer">
</div>
</div>
</div>
</body>
</html>

View File

@@ -0,0 +1,10 @@
using System.Web.Routing;
using Orchard.Themes;
namespace Orchard.Core.Themes {
public class SafeModeThemeSelector : IThemeSelector {
public ThemeSelectorResult GetTheme(RequestContext context) {
return new ThemeSelectorResult {Priority = -100, ThemeName = "SafeMode"};
}
}
}

View File

@@ -10,19 +10,17 @@ using Orchard.Themes;
namespace Orchard.Core.Themes.Services {
public class SiteThemeSelector : IThemeSelector {
private readonly IThemeService _themeService;
public SiteThemeSelector (IThemeService themeService) {
_themeService = themeService;
}
public ISite CurrentSite { get; set; }
public ThemeSelectorResult GetTheme(RequestContext context) {
var theme = _themeService.GetSiteTheme();
if (theme == null) {
string currentThemeName = CurrentSite.As<ThemeSiteSettings>().Record.CurrentThemeName;
if (String.IsNullOrEmpty(currentThemeName)) {
return null;
}
return new ThemeSelectorResult {Priority = -5, ThemeName = theme.ThemeName};
return new ThemeSelectorResult { Priority = -5, ThemeName = currentThemeName };
}
}
}