mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-07-31 00:01:53 +08:00
Continued work on theming fundamentals
--HG-- extra : convert_revision : svn%3A5ff7c347-ad56-4c35-b696-ccb81de16e03/trunk%4044118
This commit is contained in:
parent
7b777ef4f6
commit
d2cc190fd7
@ -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>
|
||||
|
1
src/Orchard.Web/Core/SafeMode/Theme.txt
Normal file
1
src/Orchard.Web/Core/SafeMode/Theme.txt
Normal file
@ -0,0 +1 @@
|
||||
name: SafeMode
|
25
src/Orchard.Web/Core/SafeMode/Views/Shared/_layout.ascx_
Normal file
25
src/Orchard.Web/Core/SafeMode/Views/Shared/_layout.ascx_
Normal 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>
|
10
src/Orchard.Web/Core/Themes/SafeModeThemeSelector.cs
Normal file
10
src/Orchard.Web/Core/Themes/SafeModeThemeSelector.cs
Normal 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"};
|
||||
}
|
||||
}
|
||||
}
|
@ -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 };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -175,10 +175,6 @@
|
||||
<Content Include="Content\Images\title_background.gif" />
|
||||
<Content Include="Content\Site2.css" />
|
||||
<Content Include="Content\Site3.css" />
|
||||
<Content Include="Themes\BlueSky\Theme.gif" />
|
||||
<Content Include="Themes\BlueSky\Theme.txt" />
|
||||
<Content Include="Themes\PinkPretty\Theme.gif" />
|
||||
<Content Include="Themes\PinkPretty\Theme.txt" />
|
||||
<Content Include="Views\Shared\AdminHead.aspx" />
|
||||
<Content Include="Views\Shared\AdminFoot.aspx" />
|
||||
<Content Include="Views\Shared\Messages.ascx" />
|
||||
@ -189,8 +185,6 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="App_Data\" />
|
||||
<Folder Include="Media\Images\" />
|
||||
<Folder Include="Media\Videos\" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
|
91
src/Orchard.Web/Themes/Hacky/Hacky.csproj
Normal file
91
src/Orchard.Web/Themes/Hacky/Hacky.csproj
Normal file
@ -0,0 +1,91 @@
|
||||
<Project ToolsVersion="3.5" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{4A843BF0-C95D-4A51-8B63-2C7EB259A2E3}</ProjectGuid>
|
||||
<ProjectTypeGuids>{349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc}</ProjectTypeGuids>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Hacky</RootNamespace>
|
||||
<AssemblyName>Hacky</AssemblyName>
|
||||
<TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Core">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Extensions">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Web.Services" />
|
||||
<Reference Include="System.EnterpriseServices" />
|
||||
<Reference Include="System.Web.Mobile" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Theme.gif" />
|
||||
<Content Include="Theme.txt" />
|
||||
<Content Include="__Web.config__disabled.txt" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath)\Microsoft\VisualStudio\v9.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
Other similar extension points exist, see Microsoft.Common.targets.
|
||||
<Target Name="BeforeBuild">
|
||||
</Target>
|
||||
<Target Name="AfterBuild">
|
||||
</Target>
|
||||
-->
|
||||
<ProjectExtensions>
|
||||
<VisualStudio>
|
||||
<FlavorProperties GUID="{349c5851-65df-11da-9384-00065b846f21}">
|
||||
<WebProjectProperties>
|
||||
<UseIIS>False</UseIIS>
|
||||
<AutoAssignPort>True</AutoAssignPort>
|
||||
<DevelopmentServerPort>46227</DevelopmentServerPort>
|
||||
<DevelopmentServerVPath>/</DevelopmentServerVPath>
|
||||
<IISUrl>
|
||||
</IISUrl>
|
||||
<NTLMAuthentication>False</NTLMAuthentication>
|
||||
<UseCustomServer>False</UseCustomServer>
|
||||
<CustomServerUrl>
|
||||
</CustomServerUrl>
|
||||
<SaveServerSettingsInUserFile>False</SaveServerSettingsInUserFile>
|
||||
</WebProjectProperties>
|
||||
</FlavorProperties>
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
35
src/Orchard.Web/Themes/Hacky/Properties/AssemblyInfo.cs
Normal file
35
src/Orchard.Web/Themes/Hacky/Properties/AssemblyInfo.cs
Normal file
@ -0,0 +1,35 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Hacky")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Hacky")]
|
||||
[assembly: AssemblyCopyright("Copyright © CodePlex Foundation 2009")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("3d5900ae-111a-45be-96b3-d9e4606ca793")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
BIN
src/Orchard.Web/Themes/Hacky/Theme.gif
Normal file
BIN
src/Orchard.Web/Themes/Hacky/Theme.gif
Normal file
Binary file not shown.
After Width: | Height: | Size: 11 KiB |
6
src/Orchard.Web/Themes/Hacky/Theme.txt
Normal file
6
src/Orchard.Web/Themes/Hacky/Theme.txt
Normal file
@ -0,0 +1,6 @@
|
||||
name: Hacky
|
||||
author: Rick Astley
|
||||
description: This theme represents a blind attempt to evolve a system in place
|
||||
version: 0.1
|
||||
tags: blue
|
||||
homepage: http://tinyurl.com/2g9mqh
|
125
src/Orchard.Web/Themes/Hacky/__Web.config__disabled.txt
Normal file
125
src/Orchard.Web/Themes/Hacky/__Web.config__disabled.txt
Normal file
@ -0,0 +1,125 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<configuration>
|
||||
|
||||
|
||||
<configSections>
|
||||
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
||||
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
||||
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
|
||||
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
|
||||
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere" />
|
||||
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
|
||||
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
|
||||
<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication" />
|
||||
</sectionGroup>
|
||||
</sectionGroup>
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
|
||||
|
||||
<appSettings/>
|
||||
<connectionStrings/>
|
||||
|
||||
<system.web>
|
||||
<!--
|
||||
Set compilation debug="true" to insert debugging
|
||||
symbols into the compiled page. Because this
|
||||
affects performance, set this value to true only
|
||||
during development.
|
||||
-->
|
||||
<compilation debug="false">
|
||||
|
||||
<assemblies>
|
||||
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
|
||||
<add assembly="System.Data.DataSetExtensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
|
||||
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
|
||||
</assemblies>
|
||||
|
||||
</compilation>
|
||||
<!--
|
||||
The <authentication> section enables configuration
|
||||
of the security authentication mode used by
|
||||
ASP.NET to identify an incoming user.
|
||||
-->
|
||||
<authentication mode="Windows" />
|
||||
<!--
|
||||
The <customErrors> section enables configuration
|
||||
of what to do if/when an unhandled error occurs
|
||||
during the execution of a request. Specifically,
|
||||
it enables developers to configure html error pages
|
||||
to be displayed in place of a error stack trace.
|
||||
|
||||
<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
|
||||
<error statusCode="403" redirect="NoAccess.htm" />
|
||||
<error statusCode="404" redirect="FileNotFound.htm" />
|
||||
</customErrors>
|
||||
-->
|
||||
|
||||
<pages>
|
||||
<controls>
|
||||
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
</controls>
|
||||
</pages>
|
||||
|
||||
<httpHandlers>
|
||||
<remove verb="*" path="*.asmx"/>
|
||||
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
|
||||
</httpHandlers>
|
||||
<httpModules>
|
||||
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
</httpModules>
|
||||
|
||||
</system.web>
|
||||
|
||||
<system.codedom>
|
||||
<compilers>
|
||||
<compiler language="c#;cs;csharp" extension=".cs" warningLevel="4"
|
||||
type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
|
||||
<providerOption name="CompilerVersion" value="v3.5"/>
|
||||
<providerOption name="WarnAsError" value="false"/>
|
||||
</compiler>
|
||||
</compilers>
|
||||
</system.codedom>
|
||||
|
||||
<!--
|
||||
The system.webServer section is required for running ASP.NET AJAX under Internet
|
||||
Information Services 7.0. It is not necessary for previous version of IIS.
|
||||
-->
|
||||
<system.webServer>
|
||||
<validation validateIntegratedModeConfiguration="false"/>
|
||||
<modules>
|
||||
<remove name="ScriptModule" />
|
||||
<add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
</modules>
|
||||
<handlers>
|
||||
<remove name="WebServiceHandlerFactory-Integrated"/>
|
||||
<remove name="ScriptHandlerFactory" />
|
||||
<remove name="ScriptHandlerFactoryAppServices" />
|
||||
<remove name="ScriptResource" />
|
||||
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode"
|
||||
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode"
|
||||
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
|
||||
</handlers>
|
||||
</system.webServer>
|
||||
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Extensions" publicKeyToken="31bf3856ad364e35"/>
|
||||
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Extensions.Design" publicKeyToken="31bf3856ad364e35"/>
|
||||
<bindingRedirect oldVersion="1.0.0.0-1.1.0.0" newVersion="3.5.0.0"/>
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
|
||||
</configuration>
|
@ -39,6 +39,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.DevTools", "Orchard
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Tags", "Orchard.Web\Packages\Orchard.Tags\Orchard.Tags.csproj", "{5D0F00F0-26C9-4785-AD61-B85710C60EB0}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Themes", "Themes", "{7DBC1068-9345-483C-8AAE-85BF84006B8A}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Hacky", "Orchard.Web\Themes\Hacky\Hacky.csproj", "{4A843BF0-C95D-4A51-8B63-2C7EB259A2E3}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -113,6 +117,10 @@ Global
|
||||
{5D0F00F0-26C9-4785-AD61-B85710C60EB0}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{5D0F00F0-26C9-4785-AD61-B85710C60EB0}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{5D0F00F0-26C9-4785-AD61-B85710C60EB0}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4A843BF0-C95D-4A51-8B63-2C7EB259A2E3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4A843BF0-C95D-4A51-8B63-2C7EB259A2E3}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4A843BF0-C95D-4A51-8B63-2C7EB259A2E3}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4A843BF0-C95D-4A51-8B63-2C7EB259A2E3}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@ -132,5 +140,6 @@ Global
|
||||
{14C049FD-B35B-415A-A824-87F26B26E7FD} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
|
||||
{67C1D3AF-A0EC-46B2-BAE1-DF1DA8E0B890} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
|
||||
{5D0F00F0-26C9-4785-AD61-B85710C60EB0} = {E9C9F120-07BA-4DFB-B9C3-3AFB9D44C9D5}
|
||||
{4A843BF0-C95D-4A51-8B63-2C7EB259A2E3} = {7DBC1068-9345-483C-8AAE-85BF84006B8A}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
@ -1,3 +1,4 @@
|
||||
using System.Diagnostics;
|
||||
using System.Web.Mvc;
|
||||
using Autofac;
|
||||
using Autofac.Builder;
|
||||
@ -84,6 +85,13 @@ namespace Orchard.Environment {
|
||||
addingModules.RegisterModule(module);
|
||||
}
|
||||
addingModules.Build(shellContainer);
|
||||
|
||||
foreach (var reg in shellContainer.ComponentRegistrations) {
|
||||
reg.Preparing += (s, e) => {
|
||||
Debug.WriteLine(e.Component.Descriptor.BestKnownImplementationType.FullName);
|
||||
};
|
||||
}
|
||||
|
||||
return shellContainer;
|
||||
}
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using Autofac;
|
||||
using Autofac.Builder;
|
||||
using Autofac.Integration.Web;
|
||||
@ -37,7 +38,7 @@ namespace Orchard.Environment {
|
||||
.WithArguments(new NamedParameter("paths", new[] { "~/Core", "~/Packages" }))
|
||||
.SingletonScoped();
|
||||
builder.Register<ThemeFolders>().As<IExtensionFolders>()
|
||||
.WithArguments(new NamedParameter("paths", new[] { "~/Themes" }))
|
||||
.WithArguments(new NamedParameter("paths", new[] { "~/Core", "~/Themes" }))
|
||||
.SingletonScoped();
|
||||
|
||||
registrations(builder);
|
||||
@ -46,7 +47,9 @@ namespace Orchard.Environment {
|
||||
}
|
||||
|
||||
public static IOrchardHost CreateHost(Action<ContainerBuilder> registrations) {
|
||||
return CreateHostContainer(registrations).Resolve<IOrchardHost>();
|
||||
var container = CreateHostContainer(registrations);
|
||||
var orchardHost = container.Resolve<IOrchardHost>();
|
||||
return orchardHost;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -36,12 +36,14 @@ namespace Orchard.Mvc.ViewEngines {
|
||||
if (bodyView.View == null ||
|
||||
layoutView.View == null ||
|
||||
documentView.View == null) {
|
||||
|
||||
return new ViewEngineResult(
|
||||
|
||||
var missingTemplatesResult = new ViewEngineResult(
|
||||
(bodyView.SearchedLocations ?? Enumerable.Empty<string>())
|
||||
.Concat((layoutView.SearchedLocations ?? Enumerable.Empty<string>()))
|
||||
.Concat((documentView.SearchedLocations ?? Enumerable.Empty<string>()))
|
||||
);
|
||||
|
||||
return missingTemplatesResult;
|
||||
}
|
||||
|
||||
var view = new LayoutView(new[] {
|
||||
|
@ -1,4 +1,3 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
@ -9,8 +8,7 @@ using Orchard.Themes;
|
||||
|
||||
namespace Orchard.Mvc.ViewEngines {
|
||||
|
||||
//TEMP: abstract only because it's not functional yet
|
||||
public abstract class ViewEngineFilter : FilterProvider, IResultFilter {
|
||||
public class ViewEngineFilter : FilterProvider, IResultFilter {
|
||||
private readonly ViewEngineCollection _viewEngines;
|
||||
private readonly IThemeService _themeService;
|
||||
private readonly IExtensionManager _extensionManager;
|
||||
@ -30,37 +28,44 @@ namespace Orchard.Mvc.ViewEngines {
|
||||
public void OnResultExecuting(ResultExecutingContext filterContext) {
|
||||
var viewResultBase = filterContext.Result as ViewResultBase;
|
||||
if (viewResultBase == null) {
|
||||
return;
|
||||
return;
|
||||
}
|
||||
|
||||
//TODO: factor out into a service apart from the filter
|
||||
//TODO: add layout engine first
|
||||
|
||||
var requestTheme = _themeService.GetRequestTheme(filterContext.RequestContext);
|
||||
|
||||
var theme = _extensionManager.ActiveExtensions()
|
||||
.Single(x => x.Descriptor.ExtensionType == "Theme" && x.Descriptor.Name == requestTheme.ThemeName);
|
||||
var theme = _extensionManager
|
||||
.AvailableExtensions()
|
||||
.Single(x => x.ExtensionType == "Theme" && x.Name == requestTheme.ThemeName);
|
||||
|
||||
var themeLocation = Path.Combine(theme.Descriptor.Location, theme.Descriptor.Name);
|
||||
var themeLocation = Path.Combine(theme.Location, theme.Name);
|
||||
|
||||
var themeViewEngines = _viewEngineProviders
|
||||
.Select(x => x.CreateThemeViewEngine(new CreateThemeViewEngineParams{VirtualPath = themeLocation}));
|
||||
.Select(x => x.CreateThemeViewEngine(new CreateThemeViewEngineParams { VirtualPath = themeLocation }));
|
||||
|
||||
var packages = _extensionManager.ActiveExtensions()
|
||||
.Where(x => x.Descriptor.ExtensionType == "Package");
|
||||
|
||||
|
||||
var packageLocations = packages.Select(x => Path.Combine(x.Descriptor.Location, x.Descriptor.Name));
|
||||
var packageViewEngines = _viewEngineProviders
|
||||
.Select(x => x.CreatePackagesViewEngine(new CreatePackagesViewEngineParams {VirtualPaths = packageLocations}));
|
||||
.Select(x => x.CreatePackagesViewEngine(new CreatePackagesViewEngineParams { VirtualPaths = packageLocations }));
|
||||
|
||||
viewResultBase.ViewEngineCollection = new ViewEngineCollection(
|
||||
var requestViewEngines = new ViewEngineCollection(
|
||||
themeViewEngines
|
||||
.Concat(packageViewEngines)
|
||||
.Concat(_viewEngines)
|
||||
.ToList());
|
||||
.Concat(packageViewEngines)
|
||||
.Concat(_viewEngines)
|
||||
.ToArray());
|
||||
|
||||
var layoutViewEngine = new LayoutViewEngine(requestViewEngines);
|
||||
|
||||
viewResultBase.ViewEngineCollection = new ViewEngineCollection(_viewEngines);
|
||||
viewResultBase.ViewEngineCollection.Insert(0, layoutViewEngine);
|
||||
}
|
||||
|
||||
public void OnResultExecuted(ResultExecutedContext filterContext) {
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -1,19 +1,60 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace Orchard.Mvc.ViewEngines {
|
||||
public class WebFormsViewEngineProvider : IViewEngineProvider {
|
||||
|
||||
static string[] DisabledFormats = new[] { "~/Disabled" };
|
||||
|
||||
public IViewEngine CreateThemeViewEngine(CreateThemeViewEngineParams parameters) {
|
||||
//var viewEngine = new WebFormViewEngine();
|
||||
//viewEngine.PartialViewLocationFormats
|
||||
return null;
|
||||
// Area: if "area" in RouteData. Url hit for package...
|
||||
// Area-Layout Paths - no-op because LayoutViewEngine uses multi-pass instead of layout paths
|
||||
// Area-View Paths - no-op because LayoutViewEngine relies entirely on Partial view resolution
|
||||
// Area-Partial Paths - enable theming views associated with a package based on the route
|
||||
|
||||
// Layout Paths - no-op because LayoutViewEngine uses multi-pass instead of layout paths
|
||||
// View Paths - no-op because LayoutViewEngine relies entirely on Partial view resolution
|
||||
// Partial Paths -
|
||||
// {area}/{controller}/
|
||||
|
||||
|
||||
var viewEngine = new WebFormViewEngine {
|
||||
MasterLocationFormats = DisabledFormats,
|
||||
ViewLocationFormats = DisabledFormats,
|
||||
AreaMasterLocationFormats = DisabledFormats,
|
||||
AreaViewLocationFormats = DisabledFormats,
|
||||
};
|
||||
|
||||
// enable /Views/Shared/{partialName}
|
||||
// enable /Views/Shared/"DisplayTemplates/"+{templateName}
|
||||
// enable /Views/Shared/"EditorTemplates/+{templateName}
|
||||
viewEngine.PartialViewLocationFormats = new[] {
|
||||
parameters.VirtualPath + "/Views/Shared/{0}.ascx",
|
||||
};
|
||||
|
||||
// for "routed" request views...
|
||||
// enable /Views/{area}/{controller}/{viewName}
|
||||
viewEngine.AreaPartialViewLocationFormats = new[] {
|
||||
parameters.VirtualPath + "/Views/{2}/{1}/{0}.ascx",
|
||||
};
|
||||
|
||||
return viewEngine;
|
||||
}
|
||||
|
||||
public IViewEngine CreatePackagesViewEngine(CreatePackagesViewEngineParams parameters) {
|
||||
return null;
|
||||
var viewEngine = new WebFormViewEngine {
|
||||
MasterLocationFormats = DisabledFormats,
|
||||
ViewLocationFormats = DisabledFormats,
|
||||
AreaMasterLocationFormats = DisabledFormats,
|
||||
AreaViewLocationFormats = DisabledFormats,
|
||||
AreaPartialViewLocationFormats = DisabledFormats,
|
||||
};
|
||||
|
||||
viewEngine.PartialViewLocationFormats = parameters.VirtualPaths
|
||||
.Select(x => x + "/Views/Shared/{0}.ascx")
|
||||
.ToArray();
|
||||
|
||||
return viewEngine;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user