mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 11:44:58 +08:00
Merge
--HG-- branch : dev
This commit is contained in:
@@ -75,7 +75,7 @@
|
||||
<Target Name="Package-ForCloud">
|
||||
|
||||
<ItemGroup>
|
||||
<Excluded Include="$(SrcFolder)\**\bin\**\*;$(SrcFolder)\**\obj\**\*;$(SrcFolder)\**\*.cs;$(SrcFolder)\**\*.csproj*;" />
|
||||
<Excluded Include="$(SrcFolder)\**\bin\**\*;$(SrcFolder)\**\obj\**\*;" />
|
||||
|
||||
<Stage-Themes Include="$(SrcFolder)\Orchard.Web\Themes\**\*" Exclude="@(Excluded)" />
|
||||
<Stage-Core Include="$(SrcFolder)\Orchard.Web\Core\**\*" Exclude="@(Excluded)" />
|
||||
@@ -98,14 +98,6 @@
|
||||
<XmlUpdate XmlFileName="$(CloudRootFolder)\web.config"
|
||||
XPath="/configuration/system.web/compilation/@debug"
|
||||
Value="false" />
|
||||
|
||||
<XmlUpdate XmlFileName="$(CloudRootFolder)\web.config"
|
||||
XPath="/configuration/system.web/machineKey/@validationKey"
|
||||
Value="AutoGenerate" />
|
||||
|
||||
<XmlUpdate XmlFileName="$(CloudRootFolder)\web.config"
|
||||
XPath="/configuration/system.web/machineKey/@decryptionKey"
|
||||
Value="AutoGenerate" />
|
||||
|
||||
<XmlUpdate XmlFileName="$(CloudRootFolder)\Config\Diagnostics.config"
|
||||
XPath="/system.diagnostics/trace/@autoflush"
|
||||
|
@@ -53,6 +53,16 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Experimental", "..\
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.CodeGeneration", "..\Orchard.Web\Modules\Orchard.CodeGeneration\Orchard.CodeGeneration.csproj", "{C0C45321-B51D-4D8D-9B7B-AA4C2E0B2962}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.ArchiveLater", "..\Orchard.Web\Modules\Orchard.ArchiveLater\Orchard.ArchiveLater.csproj", "{1C981BB3-26F7-494C-9005-CC27A5144233}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Email", "..\Orchard.Web\Modules\Orchard.Email\Orchard.Email.csproj", "{05660F47-D649-48BD-9DED-DF4E01E7CFF9}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.jQuery", "..\Orchard.Web\Modules\Orchard.jQuery\Orchard.jQuery.csproj", "{8F116B06-1C0E-4E4C-9A0A-D2FAB851E768}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Migrations", "..\Orchard.Web\Modules\Orchard.Migrations\Orchard.Migrations.csproj", "{EA4F1DA7-F2AB-4384-9AA4-9B756E2026B1}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Widgets", "..\Orchard.Web\Modules\Orchard.Widgets\Orchard.Widgets.csproj", "{194D3CCC-1153-474D-8176-FDE8D7D0D0BD}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -155,6 +165,26 @@ Global
|
||||
{C0C45321-B51D-4D8D-9B7B-AA4C2E0B2962}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{C0C45321-B51D-4D8D-9B7B-AA4C2E0B2962}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{C0C45321-B51D-4D8D-9B7B-AA4C2E0B2962}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{1C981BB3-26F7-494C-9005-CC27A5144233}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1C981BB3-26F7-494C-9005-CC27A5144233}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1C981BB3-26F7-494C-9005-CC27A5144233}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1C981BB3-26F7-494C-9005-CC27A5144233}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{05660F47-D649-48BD-9DED-DF4E01E7CFF9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{05660F47-D649-48BD-9DED-DF4E01E7CFF9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{05660F47-D649-48BD-9DED-DF4E01E7CFF9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{05660F47-D649-48BD-9DED-DF4E01E7CFF9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8F116B06-1C0E-4E4C-9A0A-D2FAB851E768}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8F116B06-1C0E-4E4C-9A0A-D2FAB851E768}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8F116B06-1C0E-4E4C-9A0A-D2FAB851E768}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8F116B06-1C0E-4E4C-9A0A-D2FAB851E768}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{EA4F1DA7-F2AB-4384-9AA4-9B756E2026B1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{EA4F1DA7-F2AB-4384-9AA4-9B756E2026B1}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{EA4F1DA7-F2AB-4384-9AA4-9B756E2026B1}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{EA4F1DA7-F2AB-4384-9AA4-9B756E2026B1}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{194D3CCC-1153-474D-8176-FDE8D7D0D0BD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{194D3CCC-1153-474D-8176-FDE8D7D0D0BD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{194D3CCC-1153-474D-8176-FDE8D7D0D0BD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{194D3CCC-1153-474D-8176-FDE8D7D0D0BD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
@@ -178,6 +208,11 @@ Global
|
||||
{DFD137A2-DDB5-4D22-BE0D-FA9AD4C8B059} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
|
||||
{AB3C207C-0126-4143-8D62-1119DF80D366} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
|
||||
{C0C45321-B51D-4D8D-9B7B-AA4C2E0B2962} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
|
||||
{1C981BB3-26F7-494C-9005-CC27A5144233} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
|
||||
{05660F47-D649-48BD-9DED-DF4E01E7CFF9} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
|
||||
{8F116B06-1C0E-4E4C-9A0A-D2FAB851E768} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
|
||||
{EA4F1DA7-F2AB-4384-9AA4-9B756E2026B1} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
|
||||
{194D3CCC-1153-474D-8176-FDE8D7D0D0BD} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
|
||||
{33B1BC8D-E292-4972-A363-22056B207156} = {75E7476C-C05B-4C41-8E38-081D3EB55659}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
@@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Web;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
using System.Web.Routing;
|
||||
using Autofac;
|
||||
@@ -20,19 +16,10 @@ namespace Orchard.Azure.Web {
|
||||
}
|
||||
|
||||
protected void Application_Start() {
|
||||
// This is temporary until MVC2 is officially released.
|
||||
// We want to avoid running against an outdated preview installed in the GAC
|
||||
CheckMvcVersion(
|
||||
new Version("2.0.50217.0")/*MVC2 RTM file version #*/,
|
||||
new Version("2.0.50129.0")/*MVC2 RC2 file version #*/,
|
||||
new Version("2.0.41211.0")/*MVC2 RC file version #*/);
|
||||
|
||||
RegisterRoutes(RouteTable.Routes);
|
||||
|
||||
_host = OrchardStarter.CreateHost(MvcSingletons);
|
||||
_host.Initialize();
|
||||
|
||||
//TODO: what's the failed initialization story - IoC failure in app start can leave you with a zombie appdomain
|
||||
}
|
||||
|
||||
protected void Application_BeginRequest() {
|
||||
@@ -45,58 +32,11 @@ namespace Orchard.Azure.Web {
|
||||
_host.EndRequest();
|
||||
}
|
||||
|
||||
private static void CheckMvcVersion(params Version[] allowedVersions) {
|
||||
Assembly loadedMvcAssembly = typeof(Controller).Assembly;
|
||||
Version loadedMvcVersion = ReadAssemblyFileVersion(loadedMvcAssembly);
|
||||
|
||||
if ( allowedVersions.All(allowed => loadedMvcVersion != allowed) ) {
|
||||
string message;
|
||||
if ( loadedMvcAssembly.GlobalAssemblyCache ) {
|
||||
message = string.Format(
|
||||
"Orchard has been deployed with a version of {0} that has a different file version ({1}) " +
|
||||
"than the version installed in the GAC ({2}).\r\n" +
|
||||
"This implies that Orchard will not be able to run properly in this machine configuration.\r\n" +
|
||||
"Please un-install MVC from the GAC or install a more recent version.",
|
||||
loadedMvcAssembly.GetName().Name,
|
||||
allowedVersions.First(),
|
||||
loadedMvcVersion);
|
||||
}
|
||||
else {
|
||||
message = string.Format(
|
||||
"Orchard has been configured to run with a file version {1} of \"{0}\" " +
|
||||
"but the version deployed with the application is {2}.\r\n" +
|
||||
"This probably implies that Orchard is deployed with a newer version " +
|
||||
"and the source code hasn't been updated accordingly.\r\n" +
|
||||
"Update the Orchard.Web application source code (look for \"CheckMvcVersion\") to " +
|
||||
"specify the correct file version number.\r\n",
|
||||
loadedMvcAssembly.GetName().Name,
|
||||
allowedVersions.First(),
|
||||
loadedMvcVersion);
|
||||
}
|
||||
|
||||
throw new HttpException(500, message);
|
||||
}
|
||||
static void MvcSingletons(ContainerBuilder builder) {
|
||||
builder.Register(ctx => RouteTable.Routes).SingleInstance();
|
||||
builder.Register(ctx => ModelBinders.Binders).SingleInstance();
|
||||
builder.Register(ctx => ViewEngines.Engines).SingleInstance();
|
||||
}
|
||||
|
||||
private static Version ReadAssemblyFileVersion(Assembly assembly) {
|
||||
object[] attributes = assembly.GetCustomAttributes(typeof(AssemblyFileVersionAttribute), true);
|
||||
if ( attributes == null || attributes.Length != 1 ) {
|
||||
string message = string.Format("Assembly \"{0}\" doesn't have a \"{1}\" attribute",
|
||||
assembly.GetName().Name, typeof(AssemblyFileVersionAttribute).FullName);
|
||||
throw new FileLoadException(message);
|
||||
}
|
||||
|
||||
var attribute = (AssemblyFileVersionAttribute)attributes[0];
|
||||
return new Version(attribute.Version);
|
||||
}
|
||||
|
||||
|
||||
protected void MvcSingletons(ContainerBuilder builder) {
|
||||
builder.RegisterInstance(ControllerBuilder.Current);
|
||||
builder.RegisterInstance(RouteTable.Routes);
|
||||
builder.RegisterInstance(ModelBinders.Binders);
|
||||
builder.RegisterInstance(ModelMetadataProviders.Current);
|
||||
builder.RegisterInstance(ViewEngines.Engines);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@@ -44,7 +44,7 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\lib\autofac\Autofac.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Configuration, Version=2.1.13.813, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<Reference Include="Autofac.Configuration, Version=2.2.4.900, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\lib\autofac\Autofac.Configuration.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -54,17 +54,6 @@
|
||||
<Reference Include="Autofac.Integration.Web.Mvc">
|
||||
<HintPath>..\..\..\lib\autofac\Autofac.Integration.Web.Mvc.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Castle.Core, Version=1.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\lib\Castle Windsor 2.0\bin\Castle.Core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Castle.DynamicProxy2, Version=2.1.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\lib\Castle Windsor 2.0\bin\Castle.DynamicProxy2.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.WindowsAzure.Diagnostics, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
|
||||
<Reference Include="Microsoft.WindowsAzure.ServiceRuntime, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<Private>False</Private>
|
||||
@@ -102,6 +91,9 @@
|
||||
<Reference Include="System.Web.Extensions">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Helpers">
|
||||
<HintPath>..\..\..\lib\aspnetmvc\System.Web.Helpers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
|
||||
@@ -116,9 +108,18 @@
|
||||
<Reference Include="System.Web.Abstractions">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Razor">
|
||||
<HintPath>..\..\..\lib\aspnetmvc\System.Web.Razor.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Routing">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.WebPages">
|
||||
<HintPath>..\..\..\lib\aspnetmvc\System.Web.WebPages.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.WebPages.Razor">
|
||||
<HintPath>..\..\..\lib\aspnetmvc\System.Web.WebPages.Razor.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
@@ -137,6 +138,9 @@
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="WebMatrix.Data">
|
||||
<HintPath>..\..\..\lib\aspnetmvc\WebMatrix.Data.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Global.asax.cs">
|
||||
@@ -166,83 +170,15 @@
|
||||
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
|
||||
<Name>Orchard.Core</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Orchard.Web\Modules\Lucene\Lucene.csproj">
|
||||
<Project>{D5D447D7-EF8E-43A6-B9A4-3B025DD9F45D}</Project>
|
||||
<Name>Lucene</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Orchard.Web\Modules\Orchard.Blogs\Orchard.Blogs.csproj">
|
||||
<Project>{63FBD4D9-E1DA-4A7B-AA6A-D6074FE50867}</Project>
|
||||
<Name>Orchard.Blogs</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Orchard.Web\Modules\Orchard.CodeGeneration\Orchard.CodeGeneration.csproj">
|
||||
<Project>{C0C45321-B51D-4D8D-9B7B-AA4C2E0B2962}</Project>
|
||||
<Name>Orchard.CodeGeneration</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Orchard.Web\Modules\Orchard.Comments\Orchard.Comments.csproj">
|
||||
<Project>{14C049FD-B35B-415A-A824-87F26B26E7FD}</Project>
|
||||
<Name>Orchard.Comments</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Orchard.Web\Modules\Orchard.ContentTypes\Orchard.ContentTypes.csproj">
|
||||
<Project>{0E7646E8-FE8F-43C1-8799-D97860925EC4}</Project>
|
||||
<Name>Orchard.ContentTypes</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Orchard.Web\Modules\Orchard.Experimental\Orchard.Experimental.csproj">
|
||||
<Project>{AB3C207C-0126-4143-8D62-1119DF80D366}</Project>
|
||||
<Name>Orchard.Experimental</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Orchard.Web\Modules\Orchard.Indexing\Orchard.Indexing.csproj">
|
||||
<Project>{EA2B9121-EF54-40A6-A53E-6593C86EE696}</Project>
|
||||
<Name>Orchard.Indexing</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Orchard.Web\Modules\Orchard.Media\Orchard.Media.csproj">
|
||||
<Project>{D9A7B330-CD22-4DA1-A95A-8DE1982AD8EB}</Project>
|
||||
<Name>Orchard.Media</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Orchard.Web\Modules\Orchard.Modules\Orchard.Modules.csproj">
|
||||
<Project>{17F86780-9A1F-4AA1-86F1-875EEC2730C7}</Project>
|
||||
<Name>Orchard.Modules</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Orchard.Web\Modules\Orchard.MultiTenancy\Orchard.MultiTenancy.csproj">
|
||||
<Project>{72457126-E118-4171-A08F-9A709EE4B7FC}</Project>
|
||||
<Name>Orchard.MultiTenancy</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Orchard.Web\Modules\Orchard.Packaging\Orchard.Packaging.csproj">
|
||||
<Project>{DFD137A2-DDB5-4D22-BE0D-FA9AD4C8B059}</Project>
|
||||
<Name>Orchard.Packaging</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Orchard.Web\Modules\Orchard.Roles\Orchard.Roles.csproj">
|
||||
<Project>{D10AD48F-407D-4DB5-A328-173EC7CB010F}</Project>
|
||||
<Name>Orchard.Roles</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Orchard.Web\Modules\Orchard.Search\Orchard.Search.csproj">
|
||||
<Project>{4BE4EB01-AC56-4048-924E-2CA77F509ABA}</Project>
|
||||
<Name>Orchard.Search</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Orchard.Web\Modules\Orchard.Setup\Orchard.Setup.csproj">
|
||||
<Project>{8C7FCBC2-E6E1-405E-BFB5-D8D9E67A09C4}</Project>
|
||||
<Name>Orchard.Setup</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Orchard.Web\Modules\Orchard.Tags\Orchard.Tags.csproj">
|
||||
<Project>{5D0F00F0-26C9-4785-AD61-B85710C60EB0}</Project>
|
||||
<Name>Orchard.Tags</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Orchard.Web\Modules\Orchard.Themes\Orchard.Themes.csproj">
|
||||
<Project>{CDE24A24-01D3-403C-84B9-37722E18DFB7}</Project>
|
||||
<Name>Orchard.Themes</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Orchard.Web\Modules\Orchard.Users\Orchard.Users.csproj">
|
||||
<Project>{79AED36E-ABD0-4747-93D3-8722B042454B}</Project>
|
||||
<Name>Orchard.Users</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Orchard.Web\Modules\TinyMce\TinyMce.csproj">
|
||||
<Project>{954CA994-D204-468B-9D69-51F6AD3E1C29}</Project>
|
||||
<Name>TinyMce</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Orchard\Orchard.Framework.csproj">
|
||||
<Project>{2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6}</Project>
|
||||
<Name>Orchard.Framework</Name>
|
||||
<EmbedInteropTypes>False</EmbedInteropTypes>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Tools\Orchard\Orchard.csproj">
|
||||
<Project>{33B1BC8D-E292-4972-A363-22056B207156}</Project>
|
||||
<Name>Orchard</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Orchard.Azure.csproj">
|
||||
<Project>{2505AA84-65A6-43D0-9C27-4F44FD576284}</Project>
|
||||
<Name>Orchard.Azure</Name>
|
||||
|
@@ -9,17 +9,17 @@
|
||||
-->
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="system.razor.web" type="System.Razor.Web.Configuration.SystemRazorWebSectionGroup, System.Razor.Web">
|
||||
<section name="host" type="System.Razor.Web.Configuration.HostSection, System.Razor.Web" requirePermission="false" />
|
||||
<section name="pages" type="System.Razor.Web.Configuration.RazorPagesSection, System.Razor.Web" requirePermission="false" />
|
||||
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor">
|
||||
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor" requirePermission="false" />
|
||||
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor" requirePermission="false" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
|
||||
|
||||
<appSettings/>
|
||||
<system.diagnostics configSource="Config\Diagnostics.config"/>
|
||||
|
||||
<system.razor.web>
|
||||
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
|
||||
<system.web.webPages.razor>
|
||||
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" />
|
||||
<pages pageBaseType="Orchard.Mvc.ViewEngines.Razor.WebViewPage">
|
||||
<namespaces>
|
||||
<add namespace="System.Web.Mvc" />
|
||||
@@ -31,7 +31,7 @@
|
||||
<add namespace="Orchard.Mvc.Html"/>
|
||||
</namespaces>
|
||||
</pages>
|
||||
</system.razor.web>
|
||||
</system.web.webPages.razor>
|
||||
|
||||
<!--
|
||||
Set default transaction timeout to 30 minutes so that interactive debugging
|
||||
@@ -129,7 +129,7 @@
|
||||
<probing privatePath="App_Data/Dependencies"/>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
|
||||
<bindingRedirect oldVersion="2.0.0.0" newVersion="3.0.0.0"/>
|
||||
<bindingRedirect oldVersion="2.0.0.0" newVersion="3.0.0.0"/>
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
|
@@ -181,6 +181,9 @@
|
||||
<ItemGroup>
|
||||
<Content Include="Views\Parts\Tags.ShowTags.Detail.BlogPost.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App_Data\Localization\fr-FR\orchard.module.po" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets" />
|
||||
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
|
||||
|
@@ -39,6 +39,10 @@
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Autofac, Version=2.2.4.900, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\autofac\Autofac.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations">
|
||||
|
@@ -15,12 +15,17 @@ namespace Orchard.Modules.Services {
|
||||
private const string ModuleExtensionType = "module";
|
||||
private readonly IExtensionManager _extensionManager;
|
||||
private readonly IShellDescriptorManager _shellDescriptorManager;
|
||||
private readonly IWorkContextAccessor _workContextAccessor;
|
||||
|
||||
public ModuleService(IOrchardServices orchardServices, IExtensionManager extensionManager,
|
||||
IShellDescriptorManager shellDescriptorManager) {
|
||||
public ModuleService(
|
||||
IOrchardServices orchardServices,
|
||||
IExtensionManager extensionManager,
|
||||
IShellDescriptorManager shellDescriptorManager,
|
||||
IWorkContextAccessor workContextAccessor) {
|
||||
Services = orchardServices;
|
||||
_extensionManager = extensionManager;
|
||||
_shellDescriptorManager = shellDescriptorManager;
|
||||
_workContextAccessor = workContextAccessor;
|
||||
T = NullLocalizer.Instance;
|
||||
}
|
||||
|
||||
@@ -187,17 +192,37 @@ namespace Orchard.Modules.Services {
|
||||
: featuresInQuestion.First()));
|
||||
}
|
||||
|
||||
private static IModule AssembleModuleFromDescriptor(ExtensionDescriptor extensionDescriptor) {
|
||||
private static string TryLocalize(string key, string original, Localizer localizer) {
|
||||
var localized = localizer(key).Text;
|
||||
|
||||
if(key == localized) {
|
||||
// no specific localization available
|
||||
return original;
|
||||
}
|
||||
|
||||
return localized;
|
||||
}
|
||||
|
||||
private IModule AssembleModuleFromDescriptor(ExtensionDescriptor extensionDescriptor) {
|
||||
|
||||
var localizer = LocalizationUtilities.Resolve(_workContextAccessor.GetContext(), String.Concat(extensionDescriptor.Location, "/", extensionDescriptor.Name, "/Module.txt"));
|
||||
|
||||
return new Module {
|
||||
ModuleName = extensionDescriptor.Name,
|
||||
DisplayName = extensionDescriptor.DisplayName,
|
||||
Description = extensionDescriptor.Description,
|
||||
Version = extensionDescriptor.Version,
|
||||
Author = extensionDescriptor.Author,
|
||||
HomePage = extensionDescriptor.WebSite,
|
||||
Tags = extensionDescriptor.Tags,
|
||||
Features = extensionDescriptor.Features
|
||||
};
|
||||
ModuleName = extensionDescriptor.Name,
|
||||
DisplayName = TryLocalize("Name", extensionDescriptor.DisplayName, localizer),
|
||||
Description = TryLocalize("Description", extensionDescriptor.Description, localizer),
|
||||
Version = extensionDescriptor.Version,
|
||||
Author = TryLocalize("Author", extensionDescriptor.Author, localizer),
|
||||
HomePage = TryLocalize("Website", extensionDescriptor.WebSite, localizer),
|
||||
Tags = TryLocalize("Tags", extensionDescriptor.Tags, localizer),
|
||||
Features = extensionDescriptor.Features.Select(f => new FeatureDescriptor {
|
||||
Category = TryLocalize(f.Name + " Category", f.Category, localizer),
|
||||
Dependencies = f.Dependencies,
|
||||
Description = TryLocalize(f.Description + " Description", f.Description, localizer),
|
||||
Extension = f.Extension,
|
||||
Name = f.Name
|
||||
})
|
||||
};
|
||||
}
|
||||
|
||||
private static IModuleFeature AssembleModuleFromDescriptor(Feature feature, bool isEnabled) {
|
||||
|
@@ -39,6 +39,10 @@
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Autofac, Version=2.2.4.900, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\lib\autofac\Autofac.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
|
@@ -19,14 +19,17 @@ namespace Orchard.Themes.Services {
|
||||
private readonly IExtensionManager _extensionManager;
|
||||
private readonly IEnumerable<IThemeSelector> _themeSelectors;
|
||||
private readonly IModuleService _moduleService;
|
||||
private IWorkContextAccessor _workContextAccessor;
|
||||
|
||||
public ThemeService(
|
||||
IExtensionManager extensionManager,
|
||||
IEnumerable<IThemeSelector> themeSelectors,
|
||||
IModuleService moduleService) {
|
||||
IModuleService moduleService,
|
||||
IWorkContextAccessor workContextAccessor) {
|
||||
_extensionManager = extensionManager;
|
||||
_themeSelectors = themeSelectors;
|
||||
_moduleService = moduleService;
|
||||
_workContextAccessor = workContextAccessor;
|
||||
Logger = NullLogger.Instance;
|
||||
T = NullLocalizer.Instance;
|
||||
}
|
||||
@@ -174,15 +177,29 @@ namespace Orchard.Themes.Services {
|
||||
_extensionManager.UninstallExtension("Theme", themeName);
|
||||
}
|
||||
|
||||
private static ITheme CreateTheme(ExtensionDescriptor descriptor) {
|
||||
private static string TryLocalize(string key, string original, Localizer localizer) {
|
||||
var localized = localizer(key).Text;
|
||||
|
||||
if ( key == localized ) {
|
||||
// no specific localization available
|
||||
return original;
|
||||
}
|
||||
|
||||
return localized;
|
||||
}
|
||||
|
||||
private ITheme CreateTheme(ExtensionDescriptor descriptor) {
|
||||
|
||||
var localizer = LocalizationUtilities.Resolve(_workContextAccessor.GetContext(), String.Concat(descriptor.Location, "/", descriptor.Name, "/Theme.txt"));
|
||||
|
||||
return new Theme {
|
||||
Author = descriptor.Author ?? "",
|
||||
Description = descriptor.Description ?? "",
|
||||
DisplayName = descriptor.DisplayName ?? "",
|
||||
HomePage = descriptor.WebSite ?? "",
|
||||
Author = TryLocalize("Author", descriptor.Author, localizer) ?? "",
|
||||
Description = TryLocalize("Description", descriptor.Description, localizer) ?? "",
|
||||
DisplayName = TryLocalize("Name", descriptor.DisplayName, localizer) ?? "",
|
||||
HomePage = TryLocalize("Website", descriptor.WebSite, localizer) ?? "",
|
||||
ThemeName = descriptor.Name,
|
||||
Version = descriptor.Version ?? "",
|
||||
Tags = descriptor.Tags ?? "",
|
||||
Tags = TryLocalize("Tags", descriptor.Tags, localizer) ?? "",
|
||||
Zones = descriptor.Zones ?? "",
|
||||
BaseTheme = descriptor.BaseTheme ?? "",
|
||||
};
|
||||
|
@@ -139,6 +139,7 @@
|
||||
<Content Include="Themes\TheThemeMachine\Styles\site.css" />
|
||||
<Content Include="Themes\TheThemeMachine\Theme.png" />
|
||||
<Content Include="Themes\TheThemeMachine\Theme.txt" />
|
||||
<None Include="Themes\Classic\App_Data\Localization\fr-FR\orchard.theme.po" />
|
||||
<None Include="Themes\TheThemeMachine\Views\Layout-homePage.cshtml" />
|
||||
<None Include="Themes\TheThemeMachine\Views\Recent.cshtml">
|
||||
<SubType>Designer</SubType>
|
||||
|
@@ -1,12 +1,15 @@
|
||||
using System.Web.Mvc;
|
||||
using Autofac;
|
||||
using Orchard.Mvc;
|
||||
|
||||
namespace Orchard.Localization {
|
||||
public class LocalizationUtilities {
|
||||
public static Localizer Resolve(WorkContext workContext, string scope) {
|
||||
return workContext == null ? NullLocalizer.Instance : Resolve(workContext.Resolve<ILifetimeScope>(), scope);
|
||||
}
|
||||
|
||||
public static Localizer Resolve(ControllerContext controllerContext, string scope) {
|
||||
var context = controllerContext.GetWorkContext();
|
||||
return context == null ? NullLocalizer.Instance : Resolve(context.Resolve<ILifetimeScope>(), scope);
|
||||
var workContext = controllerContext.GetWorkContext();
|
||||
return Resolve(workContext, scope);
|
||||
}
|
||||
|
||||
public static Localizer Resolve(IComponentContext context, string scope) {
|
||||
|
@@ -17,6 +17,7 @@ namespace Orchard.Localization.Services {
|
||||
private readonly ISignals _signals;
|
||||
const string CoreLocalizationFilePathFormat = "~/Core/App_Data/Localization/{0}/orchard.core.po";
|
||||
const string ModulesLocalizationFilePathFormat = "~/Modules/{0}/App_Data/Localization/{1}/orchard.module.po";
|
||||
const string ThemesLocalizationFilePathFormat = "~/Themes/{0}/App_Data/Localization/{1}/orchard.theme.po";
|
||||
const string RootLocalizationFilePathFormat = "~/App_Data/Localization/{0}/orchard.root.po";
|
||||
const string TenantLocalizationFilePathFormat = "~/App_Data/Sites/{0}/Localization/{1}/orchard.po";
|
||||
|
||||
@@ -46,12 +47,13 @@ namespace Orchard.Localization.Services {
|
||||
|
||||
foreach (var culture in cultures) {
|
||||
if (String.Equals(cultureName, culture.CultureName, StringComparison.OrdinalIgnoreCase)) {
|
||||
string scopedKey = scope + "|" + text;
|
||||
string genericKey = "|" + text;
|
||||
string scopedKey = (scope + "|" + text).ToLowerInvariant();
|
||||
if (culture.Translations.ContainsKey(scopedKey)) {
|
||||
return culture.Translations[scopedKey];
|
||||
}
|
||||
if (culture.Translations.ContainsKey(genericKey)) {
|
||||
|
||||
string genericKey = ("|" + text).ToLowerInvariant();
|
||||
if ( culture.Translations.ContainsKey(genericKey) ) {
|
||||
return culture.Translations[genericKey];
|
||||
}
|
||||
|
||||
@@ -63,8 +65,8 @@ namespace Orchard.Localization.Services {
|
||||
}
|
||||
|
||||
private static string GetParentTranslation(string scope, string text, string cultureName, IEnumerable<CultureDictionary> cultures) {
|
||||
string scopedKey = scope + "|" + text;
|
||||
string genericKey = "|" + text;
|
||||
string scopedKey = (scope + "|" + text).ToLowerInvariant();
|
||||
string genericKey = ("|" + text).ToLowerInvariant();
|
||||
try {
|
||||
CultureInfo cultureInfo = CultureInfo.GetCultureInfo(cultureName);
|
||||
CultureInfo parentCultureInfo = cultureInfo.Parent;
|
||||
@@ -109,6 +111,7 @@ namespace Orchard.Localization.Services {
|
||||
// In reverse priority order:
|
||||
// "~/Core/App_Data/Localization/<culture_name>/orchard.core.po";
|
||||
// "~/Modules/<module_name>/App_Data/Localization/<culture_name>/orchard.module.po";
|
||||
// "~/Themes/<theme_name>/App_Data/Localization/<culture_name>/orchard.theme.po";
|
||||
// "~/App_Data/Localization/<culture_name>/orchard.root.po";
|
||||
// "~/App_Data/Sites/<tenant_name>/Localization/<culture_name>/orchard.po";
|
||||
// The dictionary entries from po files that live in higher priority locations will
|
||||
@@ -124,17 +127,28 @@ namespace Orchard.Localization.Services {
|
||||
context.Monitor(_webSiteFolder.WhenPathChanges(corePath));
|
||||
}
|
||||
|
||||
foreach (var module in _extensionManager.AvailableExtensions()) {
|
||||
if (String.Equals(module.ExtensionType, "Module")) {
|
||||
foreach ( var module in _extensionManager.AvailableExtensions() ) {
|
||||
if ( String.Equals(module.ExtensionType, "Module") ) {
|
||||
string modulePath = string.Format(ModulesLocalizationFilePathFormat, module.Name, culture);
|
||||
text = _webSiteFolder.ReadFile(modulePath);
|
||||
if (text != null) {
|
||||
if ( text != null ) {
|
||||
ParseLocalizationStream(text, translations, true);
|
||||
context.Monitor(_webSiteFolder.WhenPathChanges(modulePath));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
foreach ( var theme in _extensionManager.AvailableExtensions() ) {
|
||||
if ( String.Equals(theme.ExtensionType, "Theme") ) {
|
||||
string themePath = string.Format(ThemesLocalizationFilePathFormat, theme.Name, culture);
|
||||
text = _webSiteFolder.ReadFile(themePath);
|
||||
if ( text != null ) {
|
||||
ParseLocalizationStream(text, translations, true);
|
||||
context.Monitor(_webSiteFolder.WhenPathChanges(themePath));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
string rootPath = string.Format(RootLocalizationFilePathFormat, culture);
|
||||
text = _webSiteFolder.ReadFile(rootPath);
|
||||
if (text != null) {
|
||||
@@ -170,24 +184,13 @@ namespace Orchard.Localization.Services {
|
||||
if (poLine.StartsWith("msgstr")) {
|
||||
string translation = ParseTranslation(poLine);
|
||||
if (!String.IsNullOrEmpty(id)) {
|
||||
if (!String.IsNullOrEmpty(scope)) {
|
||||
string scopedKey = scope + "|" + id;
|
||||
if (!translations.ContainsKey(scopedKey)) {
|
||||
translations.Add(scopedKey, translation);
|
||||
}
|
||||
else {
|
||||
if (merge) {
|
||||
translations[scopedKey] = translation;
|
||||
}
|
||||
}
|
||||
}
|
||||
string genericKey = "|" + id;
|
||||
if (!translations.ContainsKey(genericKey)) {
|
||||
translations.Add(genericKey, translation);
|
||||
string scopedKey = (scope + "|" + id).ToLowerInvariant();
|
||||
if (!translations.ContainsKey(scopedKey)) {
|
||||
translations.Add(scopedKey, translation);
|
||||
}
|
||||
else {
|
||||
if (merge) {
|
||||
translations[genericKey] = translation;
|
||||
translations[scopedKey] = translation;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user