mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Merge
--HG-- branch : composition
This commit is contained in:
@@ -75,7 +75,7 @@
|
|||||||
<Target Name="Package-ForCloud">
|
<Target Name="Package-ForCloud">
|
||||||
|
|
||||||
<ItemGroup>
|
<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-Themes Include="$(SrcFolder)\Orchard.Web\Themes\**\*" Exclude="@(Excluded)" />
|
||||||
<Stage-Core Include="$(SrcFolder)\Orchard.Web\Core\**\*" Exclude="@(Excluded)" />
|
<Stage-Core Include="$(SrcFolder)\Orchard.Web\Core\**\*" Exclude="@(Excluded)" />
|
||||||
@@ -99,14 +99,6 @@
|
|||||||
XPath="/configuration/system.web/compilation/@debug"
|
XPath="/configuration/system.web/compilation/@debug"
|
||||||
Value="false" />
|
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"
|
<XmlUpdate XmlFileName="$(CloudRootFolder)\Config\Diagnostics.config"
|
||||||
XPath="/system.diagnostics/trace/@autoflush"
|
XPath="/system.diagnostics/trace/@autoflush"
|
||||||
Value="false" />
|
Value="false" />
|
||||||
|
|||||||
@@ -53,6 +53,16 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Experimental", "..\
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.CodeGeneration", "..\Orchard.Web\Modules\Orchard.CodeGeneration\Orchard.CodeGeneration.csproj", "{C0C45321-B51D-4D8D-9B7B-AA4C2E0B2962}"
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.CodeGeneration", "..\Orchard.Web\Modules\Orchard.CodeGeneration\Orchard.CodeGeneration.csproj", "{C0C45321-B51D-4D8D-9B7B-AA4C2E0B2962}"
|
||||||
EndProject
|
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
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
Debug|Any CPU = Debug|Any CPU
|
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}.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.ActiveCfg = Release|Any CPU
|
||||||
{C0C45321-B51D-4D8D-9B7B-AA4C2E0B2962}.Release|Any CPU.Build.0 = 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
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
@@ -178,6 +208,11 @@ Global
|
|||||||
{DFD137A2-DDB5-4D22-BE0D-FA9AD4C8B059} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
|
{DFD137A2-DDB5-4D22-BE0D-FA9AD4C8B059} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
|
||||||
{AB3C207C-0126-4143-8D62-1119DF80D366} = {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}
|
{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}
|
{33B1BC8D-E292-4972-A363-22056B207156} = {75E7476C-C05B-4C41-8E38-081D3EB55659}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
|||||||
@@ -1,8 +1,4 @@
|
|||||||
using System;
|
using System.Web;
|
||||||
using System.IO;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Reflection;
|
|
||||||
using System.Web;
|
|
||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using System.Web.Routing;
|
using System.Web.Routing;
|
||||||
using Autofac;
|
using Autofac;
|
||||||
@@ -20,19 +16,10 @@ namespace Orchard.Azure.Web {
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected void Application_Start() {
|
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);
|
RegisterRoutes(RouteTable.Routes);
|
||||||
|
|
||||||
_host = OrchardStarter.CreateHost(MvcSingletons);
|
_host = OrchardStarter.CreateHost(MvcSingletons);
|
||||||
_host.Initialize();
|
_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() {
|
protected void Application_BeginRequest() {
|
||||||
@@ -45,58 +32,11 @@ namespace Orchard.Azure.Web {
|
|||||||
_host.EndRequest();
|
_host.EndRequest();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void CheckMvcVersion(params Version[] allowedVersions) {
|
static void MvcSingletons(ContainerBuilder builder) {
|
||||||
Assembly loadedMvcAssembly = typeof(Controller).Assembly;
|
builder.Register(ctx => RouteTable.Routes).SingleInstance();
|
||||||
Version loadedMvcVersion = ReadAssemblyFileVersion(loadedMvcAssembly);
|
builder.Register(ctx => ModelBinders.Binders).SingleInstance();
|
||||||
|
builder.Register(ctx => ViewEngines.Engines).SingleInstance();
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
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>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\..\..\lib\autofac\Autofac.dll</HintPath>
|
<HintPath>..\..\..\lib\autofac\Autofac.dll</HintPath>
|
||||||
</Reference>
|
</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>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\..\..\lib\autofac\Autofac.Configuration.dll</HintPath>
|
<HintPath>..\..\..\lib\autofac\Autofac.Configuration.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
@@ -54,17 +54,6 @@
|
|||||||
<Reference Include="Autofac.Integration.Web.Mvc">
|
<Reference Include="Autofac.Integration.Web.Mvc">
|
||||||
<HintPath>..\..\..\lib\autofac\Autofac.Integration.Web.Mvc.dll</HintPath>
|
<HintPath>..\..\..\lib\autofac\Autofac.Integration.Web.Mvc.dll</HintPath>
|
||||||
</Reference>
|
</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.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">
|
<Reference Include="Microsoft.WindowsAzure.ServiceRuntime, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
@@ -102,6 +91,9 @@
|
|||||||
<Reference Include="System.Web.Extensions">
|
<Reference Include="System.Web.Extensions">
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</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">
|
<Reference Include="System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
|
<HintPath>..\..\..\lib\aspnetmvc\System.Web.Mvc.dll</HintPath>
|
||||||
@@ -116,9 +108,18 @@
|
|||||||
<Reference Include="System.Web.Abstractions">
|
<Reference Include="System.Web.Abstractions">
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="System.Web.Razor">
|
||||||
|
<HintPath>..\..\..\lib\aspnetmvc\System.Web.Razor.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System.Web.Routing">
|
<Reference Include="System.Web.Routing">
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</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">
|
<Reference Include="System.Xml">
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
@@ -137,6 +138,9 @@
|
|||||||
<Reference Include="System.Xml.Linq">
|
<Reference Include="System.Xml.Linq">
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="WebMatrix.Data">
|
||||||
|
<HintPath>..\..\..\lib\aspnetmvc\WebMatrix.Data.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Include="Global.asax.cs">
|
<Compile Include="Global.asax.cs">
|
||||||
@@ -166,83 +170,15 @@
|
|||||||
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
|
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
|
||||||
<Name>Orchard.Core</Name>
|
<Name>Orchard.Core</Name>
|
||||||
</ProjectReference>
|
</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">
|
<ProjectReference Include="..\..\Orchard\Orchard.Framework.csproj">
|
||||||
<Project>{2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6}</Project>
|
<Project>{2D1D92BB-4555-4CBE-8D0E-63563D6CE4C6}</Project>
|
||||||
<Name>Orchard.Framework</Name>
|
<Name>Orchard.Framework</Name>
|
||||||
<EmbedInteropTypes>False</EmbedInteropTypes>
|
<EmbedInteropTypes>False</EmbedInteropTypes>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\..\Tools\Orchard\Orchard.csproj">
|
||||||
|
<Project>{33B1BC8D-E292-4972-A363-22056B207156}</Project>
|
||||||
|
<Name>Orchard</Name>
|
||||||
|
</ProjectReference>
|
||||||
<ProjectReference Include="..\Orchard.Azure.csproj">
|
<ProjectReference Include="..\Orchard.Azure.csproj">
|
||||||
<Project>{2505AA84-65A6-43D0-9C27-4F44FD576284}</Project>
|
<Project>{2505AA84-65A6-43D0-9C27-4F44FD576284}</Project>
|
||||||
<Name>Orchard.Azure</Name>
|
<Name>Orchard.Azure</Name>
|
||||||
|
|||||||
@@ -9,17 +9,17 @@
|
|||||||
-->
|
-->
|
||||||
<configuration>
|
<configuration>
|
||||||
<configSections>
|
<configSections>
|
||||||
<sectionGroup name="system.razor.web" type="System.Razor.Web.Configuration.SystemRazorWebSectionGroup, System.Razor.Web">
|
<sectionGroup name="system.web.webPages.razor" type="System.Web.WebPages.Razor.Configuration.RazorWebSectionGroup, System.Web.WebPages.Razor">
|
||||||
<section name="host" type="System.Razor.Web.Configuration.HostSection, System.Razor.Web" requirePermission="false" />
|
<section name="host" type="System.Web.WebPages.Razor.Configuration.HostSection, System.Web.WebPages.Razor" requirePermission="false" />
|
||||||
<section name="pages" type="System.Razor.Web.Configuration.RazorPagesSection, System.Razor.Web" requirePermission="false" />
|
<section name="pages" type="System.Web.WebPages.Razor.Configuration.RazorPagesSection, System.Web.WebPages.Razor" requirePermission="false" />
|
||||||
</sectionGroup>
|
</sectionGroup>
|
||||||
</configSections>
|
</configSections>
|
||||||
|
|
||||||
<appSettings/>
|
<appSettings/>
|
||||||
<system.diagnostics configSource="Config\Diagnostics.config"/>
|
<system.diagnostics configSource="Config\Diagnostics.config"/>
|
||||||
|
|
||||||
<system.razor.web>
|
<system.web.webPages.razor>
|
||||||
<host factoryType="System.Web.Mvc.MvcWebRazorHostFactory, System.Web.Mvc, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
|
<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">
|
<pages pageBaseType="Orchard.Mvc.ViewEngines.Razor.WebViewPage">
|
||||||
<namespaces>
|
<namespaces>
|
||||||
<add namespace="System.Web.Mvc" />
|
<add namespace="System.Web.Mvc" />
|
||||||
@@ -31,7 +31,7 @@
|
|||||||
<add namespace="Orchard.Mvc.Html"/>
|
<add namespace="Orchard.Mvc.Html"/>
|
||||||
</namespaces>
|
</namespaces>
|
||||||
</pages>
|
</pages>
|
||||||
</system.razor.web>
|
</system.web.webPages.razor>
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
Set default transaction timeout to 30 minutes so that interactive debugging
|
Set default transaction timeout to 30 minutes so that interactive debugging
|
||||||
@@ -129,7 +129,7 @@
|
|||||||
<probing privatePath="App_Data/Dependencies"/>
|
<probing privatePath="App_Data/Dependencies"/>
|
||||||
<dependentAssembly>
|
<dependentAssembly>
|
||||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
|
<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>
|
</dependentAssembly>
|
||||||
</assemblyBinding>
|
</assemblyBinding>
|
||||||
</runtime>
|
</runtime>
|
||||||
|
|||||||
@@ -181,6 +181,9 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Views\Parts\Tags.ShowTags.Detail.BlogPost.cshtml" />
|
<Content Include="Views\Parts\Tags.ShowTags.Detail.BlogPost.cshtml" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
<ItemGroup>
|
||||||
|
<None Include="App_Data\Localization\fr-FR\orchard.module.po" />
|
||||||
|
</ItemGroup>
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.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.
|
<!-- 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>
|
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<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" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
<Reference Include="System.ComponentModel.DataAnnotations">
|
<Reference Include="System.ComponentModel.DataAnnotations">
|
||||||
|
|||||||
@@ -15,12 +15,17 @@ namespace Orchard.Modules.Services {
|
|||||||
private const string ModuleExtensionType = "module";
|
private const string ModuleExtensionType = "module";
|
||||||
private readonly IExtensionManager _extensionManager;
|
private readonly IExtensionManager _extensionManager;
|
||||||
private readonly IShellDescriptorManager _shellDescriptorManager;
|
private readonly IShellDescriptorManager _shellDescriptorManager;
|
||||||
|
private readonly IWorkContextAccessor _workContextAccessor;
|
||||||
|
|
||||||
public ModuleService(IOrchardServices orchardServices, IExtensionManager extensionManager,
|
public ModuleService(
|
||||||
IShellDescriptorManager shellDescriptorManager) {
|
IOrchardServices orchardServices,
|
||||||
|
IExtensionManager extensionManager,
|
||||||
|
IShellDescriptorManager shellDescriptorManager,
|
||||||
|
IWorkContextAccessor workContextAccessor) {
|
||||||
Services = orchardServices;
|
Services = orchardServices;
|
||||||
_extensionManager = extensionManager;
|
_extensionManager = extensionManager;
|
||||||
_shellDescriptorManager = shellDescriptorManager;
|
_shellDescriptorManager = shellDescriptorManager;
|
||||||
|
_workContextAccessor = workContextAccessor;
|
||||||
T = NullLocalizer.Instance;
|
T = NullLocalizer.Instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -187,17 +192,37 @@ namespace Orchard.Modules.Services {
|
|||||||
: featuresInQuestion.First()));
|
: 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 {
|
return new Module {
|
||||||
ModuleName = extensionDescriptor.Name,
|
ModuleName = extensionDescriptor.Name,
|
||||||
DisplayName = extensionDescriptor.DisplayName,
|
DisplayName = TryLocalize("Name", extensionDescriptor.DisplayName, localizer),
|
||||||
Description = extensionDescriptor.Description,
|
Description = TryLocalize("Description", extensionDescriptor.Description, localizer),
|
||||||
Version = extensionDescriptor.Version,
|
Version = extensionDescriptor.Version,
|
||||||
Author = extensionDescriptor.Author,
|
Author = TryLocalize("Author", extensionDescriptor.Author, localizer),
|
||||||
HomePage = extensionDescriptor.WebSite,
|
HomePage = TryLocalize("Website", extensionDescriptor.WebSite, localizer),
|
||||||
Tags = extensionDescriptor.Tags,
|
Tags = TryLocalize("Tags", extensionDescriptor.Tags, localizer),
|
||||||
Features = extensionDescriptor.Features
|
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) {
|
private static IModuleFeature AssembleModuleFromDescriptor(Feature feature, bool isEnabled) {
|
||||||
|
|||||||
@@ -97,6 +97,10 @@
|
|||||||
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
|
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
|
||||||
<Name>Orchard.Core</Name>
|
<Name>Orchard.Core</Name>
|
||||||
</ProjectReference>
|
</ProjectReference>
|
||||||
|
<ProjectReference Include="..\Orchard.Widgets\Orchard.Widgets.csproj">
|
||||||
|
<Project>{194D3CCC-1153-474D-8176-FDE8D7D0D0BD}</Project>
|
||||||
|
<Name>Orchard.Widgets</Name>
|
||||||
|
</ProjectReference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Content Include="Module.txt" />
|
<Content Include="Module.txt" />
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ using Orchard.Settings;
|
|||||||
using Orchard.Themes;
|
using Orchard.Themes;
|
||||||
using Orchard.Environment.State;
|
using Orchard.Environment.State;
|
||||||
using Orchard.Data.Migration;
|
using Orchard.Data.Migration;
|
||||||
|
using Orchard.Widgets.Models;
|
||||||
|
|
||||||
namespace Orchard.Setup.Services {
|
namespace Orchard.Setup.Services {
|
||||||
public class SetupService : ISetupService {
|
public class SetupService : ISetupService {
|
||||||
@@ -224,7 +225,22 @@ namespace Orchard.Setup.Services {
|
|||||||
//contentManager.Publish(page);
|
//contentManager.Publish(page);
|
||||||
//siteSettings.Record.HomePage = "RoutableHomePageProvider;" + page.Id;
|
//siteSettings.Record.HomePage = "RoutableHomePageProvider;" + page.Id;
|
||||||
//scratch that
|
//scratch that
|
||||||
//create the home page as a WidgetPage
|
|
||||||
|
// add a layer for the homepage
|
||||||
|
var layer = contentManager.Create("Layer");
|
||||||
|
layer.As<LayerPart>().Name = "TheHomepage";
|
||||||
|
layer.As<LayerPart>().LayerRule = "url \"~/\"";
|
||||||
|
contentManager.Publish(layer);
|
||||||
|
|
||||||
|
// create an html widget with the homepage layer as its container
|
||||||
|
var htmlWidget = contentManager.Create("HtmlWidget");
|
||||||
|
htmlWidget.As<WidgetPart>().LayerPart = layer.As<LayerPart>();
|
||||||
|
htmlWidget.As<WidgetPart>().Title = T("Welcome to Orchard!").Text;
|
||||||
|
htmlWidget.As<WidgetPart>().Zone = "Content";
|
||||||
|
htmlWidget.As<BodyPart>().Text = "<p>Welcome to Orchard!</p><p>Congratulations, you've successfully set-up your Orchard site.</p><p>This is the home page of your new site. We've taken the liberty to write here about a few things you could look at next in order to get familiar with the application. Once you feel confident you don't need this anymore, just click <a href=\"Admin/Pages/Edit/3\">Edit</a> to go into edit mode and replace this with whatever you want on your home page to make it your own.</p><p>One thing you could do (but you don't have to) is go into <a href=\"Admin/Settings\">Manage Settings</a> (follow the <a href=\"Admin\">Admin</a> link and then look for it under \"Settings\" in the menu on the left) and check that everything is configured the way you want.</p><p>You probably want to make the site your own. One of the ways you can do that is by clicking <a href=\"Admin/Themes\">Manage Themes</a> in the admin menu. A theme is a packaged look and feel that affects the whole site.</p><p>Next, you can start playing with the content types that we installed. For example, go ahead and click <a href=\"Admin/Pages/Create\">Add New Page</a> in the admin menu and create an \"about\" page. Then, add it to the navigation menu by going to <a href=\"Admin/Navigation\">Manage Menu</a>. You can also click <a href=\"Admin/Blogs/Create\">Add New Blog</a> and start posting by clicking \"Add New Post\".</p><p>Finally, Orchard has been designed to be extended. It comes with a few built-in modules such as pages and blogs or themes. You can install new themes by going to <a href=\"Admin/Themes\">Manage Themes</a> and clicking <a href=\"Admin/Themes/Install\">Install a new Theme</a>. Like for themes, modules are created by other users of Orchard just like you so if you feel up to it, please <a href=\"http://www.orchardproject.net/\">consider participating</a>.</p><p>--The Orchard Crew</p>";
|
||||||
|
contentManager.Publish(htmlWidget);
|
||||||
|
|
||||||
|
// create the home page as a WidgetPage
|
||||||
var page = contentManager.Create("WidgetPage", VersionOptions.Draft);
|
var page = contentManager.Create("WidgetPage", VersionOptions.Draft);
|
||||||
page.As<RoutePart>().Title = T("Home").ToString();
|
page.As<RoutePart>().Title = T("Home").ToString();
|
||||||
contentManager.Publish(page);
|
contentManager.Publish(page);
|
||||||
|
|||||||
@@ -39,6 +39,10 @@
|
|||||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<ItemGroup>
|
<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="Microsoft.CSharp" />
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.Data" />
|
<Reference Include="System.Data" />
|
||||||
|
|||||||
@@ -19,14 +19,17 @@ namespace Orchard.Themes.Services {
|
|||||||
private readonly IExtensionManager _extensionManager;
|
private readonly IExtensionManager _extensionManager;
|
||||||
private readonly IEnumerable<IThemeSelector> _themeSelectors;
|
private readonly IEnumerable<IThemeSelector> _themeSelectors;
|
||||||
private readonly IModuleService _moduleService;
|
private readonly IModuleService _moduleService;
|
||||||
|
private IWorkContextAccessor _workContextAccessor;
|
||||||
|
|
||||||
public ThemeService(
|
public ThemeService(
|
||||||
IExtensionManager extensionManager,
|
IExtensionManager extensionManager,
|
||||||
IEnumerable<IThemeSelector> themeSelectors,
|
IEnumerable<IThemeSelector> themeSelectors,
|
||||||
IModuleService moduleService) {
|
IModuleService moduleService,
|
||||||
|
IWorkContextAccessor workContextAccessor) {
|
||||||
_extensionManager = extensionManager;
|
_extensionManager = extensionManager;
|
||||||
_themeSelectors = themeSelectors;
|
_themeSelectors = themeSelectors;
|
||||||
_moduleService = moduleService;
|
_moduleService = moduleService;
|
||||||
|
_workContextAccessor = workContextAccessor;
|
||||||
Logger = NullLogger.Instance;
|
Logger = NullLogger.Instance;
|
||||||
T = NullLocalizer.Instance;
|
T = NullLocalizer.Instance;
|
||||||
}
|
}
|
||||||
@@ -174,15 +177,29 @@ namespace Orchard.Themes.Services {
|
|||||||
_extensionManager.UninstallExtension("Theme", themeName);
|
_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 {
|
return new Theme {
|
||||||
Author = descriptor.Author ?? "",
|
Author = TryLocalize("Author", descriptor.Author, localizer) ?? "",
|
||||||
Description = descriptor.Description ?? "",
|
Description = TryLocalize("Description", descriptor.Description, localizer) ?? "",
|
||||||
DisplayName = descriptor.DisplayName ?? "",
|
DisplayName = TryLocalize("Name", descriptor.DisplayName, localizer) ?? "",
|
||||||
HomePage = descriptor.WebSite ?? "",
|
HomePage = TryLocalize("Website", descriptor.WebSite, localizer) ?? "",
|
||||||
ThemeName = descriptor.Name,
|
ThemeName = descriptor.Name,
|
||||||
Version = descriptor.Version ?? "",
|
Version = descriptor.Version ?? "",
|
||||||
Tags = descriptor.Tags ?? "",
|
Tags = TryLocalize("Tags", descriptor.Tags, localizer) ?? "",
|
||||||
Zones = descriptor.Zones ?? "",
|
Zones = descriptor.Zones ?? "",
|
||||||
BaseTheme = descriptor.BaseTheme ?? "",
|
BaseTheme = descriptor.BaseTheme ?? "",
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -36,6 +36,7 @@ namespace Orchard.Widgets.Filters {
|
|||||||
|
|
||||||
List<int> activeLayerIds = new List<int>();
|
List<int> activeLayerIds = new List<int>();
|
||||||
foreach (var activeLayer in activeLayers) {
|
foreach (var activeLayer in activeLayers) {
|
||||||
|
var context = workContext.HttpContext;
|
||||||
if (_ruleManager.Matches(activeLayer.Record.LayerRule)) {
|
if (_ruleManager.Matches(activeLayer.Record.LayerRule)) {
|
||||||
activeLayerIds.Add(activeLayer.ContentItem.Id);
|
activeLayerIds.Add(activeLayer.ContentItem.Id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,21 +1,33 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using Orchard.Mvc;
|
||||||
using Orchard.UI.Widgets;
|
using Orchard.UI.Widgets;
|
||||||
|
|
||||||
namespace Orchard.Widgets.RuleEngine {
|
namespace Orchard.Widgets.RuleEngine {
|
||||||
public class UrlRuleProvider : IRuleProvider {
|
public class UrlRuleProvider : IRuleProvider {
|
||||||
private readonly IWorkContextAccessor _workContextAccessor;
|
private readonly IHttpContextAccessor _httpContextAccessor;
|
||||||
|
|
||||||
public UrlRuleProvider(IWorkContextAccessor workContextAccessor) {
|
public UrlRuleProvider(IHttpContextAccessor httpContextAccessor) {
|
||||||
_workContextAccessor = workContextAccessor;
|
_httpContextAccessor = httpContextAccessor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Process(RuleContext ruleContext) {
|
public void Process(RuleContext ruleContext) {
|
||||||
if (!String.Equals(ruleContext.FunctionName, "url", StringComparison.OrdinalIgnoreCase)) {
|
if (!String.Equals(ruleContext.FunctionName, "url", StringComparison.OrdinalIgnoreCase))
|
||||||
return;
|
return;
|
||||||
}
|
|
||||||
|
|
||||||
var context = _workContextAccessor.GetContext();
|
var context = _httpContextAccessor.Current();
|
||||||
ruleContext.Result = context.HttpContext.Request.RawUrl.StartsWith(Convert.ToString(ruleContext.Arguments[0]));
|
var url = Convert.ToString(ruleContext.Arguments[0]);
|
||||||
|
if (url.StartsWith("~/")) {
|
||||||
|
url = url.Substring(2);
|
||||||
|
var appPath = context.Request.ApplicationPath;
|
||||||
|
if (appPath == "/")
|
||||||
|
appPath = "";
|
||||||
|
url = string.Format("{0}/{1}", appPath, url);
|
||||||
|
}
|
||||||
|
if (!url.Contains("?") && url.EndsWith("/"))
|
||||||
|
url = url.TrimEnd('/');
|
||||||
|
ruleContext.Result = url.EndsWith("*")
|
||||||
|
? context.Request.RawUrl.ToUpperInvariant().StartsWith(url.ToUpperInvariant())
|
||||||
|
: context.Request.Path.ToUpperInvariant() == url.ToUpperInvariant();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -140,6 +140,7 @@
|
|||||||
<Content Include="Themes\TheThemeMachine\Styles\site.css" />
|
<Content Include="Themes\TheThemeMachine\Styles\site.css" />
|
||||||
<Content Include="Themes\TheThemeMachine\Theme.png" />
|
<Content Include="Themes\TheThemeMachine\Theme.png" />
|
||||||
<Content Include="Themes\TheThemeMachine\Theme.txt" />
|
<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\Layout-homePage.cshtml" />
|
||||||
<None Include="Themes\TheThemeMachine\Views\Recent.cshtml">
|
<None Include="Themes\TheThemeMachine\Views\Recent.cshtml">
|
||||||
<SubType>Designer</SubType>
|
<SubType>Designer</SubType>
|
||||||
|
|||||||
@@ -1,12 +1,15 @@
|
|||||||
using System.Web.Mvc;
|
using System.Web.Mvc;
|
||||||
using Autofac;
|
using Autofac;
|
||||||
using Orchard.Mvc;
|
|
||||||
|
|
||||||
namespace Orchard.Localization {
|
namespace Orchard.Localization {
|
||||||
public class LocalizationUtilities {
|
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) {
|
public static Localizer Resolve(ControllerContext controllerContext, string scope) {
|
||||||
var context = controllerContext.GetWorkContext();
|
var workContext = controllerContext.GetWorkContext();
|
||||||
return context == null ? NullLocalizer.Instance : Resolve(context.Resolve<ILifetimeScope>(), scope);
|
return Resolve(workContext, scope);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Localizer Resolve(IComponentContext context, string scope) {
|
public static Localizer Resolve(IComponentContext context, string scope) {
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ namespace Orchard.Localization.Services {
|
|||||||
private readonly ISignals _signals;
|
private readonly ISignals _signals;
|
||||||
const string CoreLocalizationFilePathFormat = "~/Core/App_Data/Localization/{0}/orchard.core.po";
|
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 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 RootLocalizationFilePathFormat = "~/App_Data/Localization/{0}/orchard.root.po";
|
||||||
const string TenantLocalizationFilePathFormat = "~/App_Data/Sites/{0}/Localization/{1}/orchard.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) {
|
foreach (var culture in cultures) {
|
||||||
if (String.Equals(cultureName, culture.CultureName, StringComparison.OrdinalIgnoreCase)) {
|
if (String.Equals(cultureName, culture.CultureName, StringComparison.OrdinalIgnoreCase)) {
|
||||||
string scopedKey = scope + "|" + text;
|
string scopedKey = (scope + "|" + text).ToLowerInvariant();
|
||||||
string genericKey = "|" + text;
|
|
||||||
if (culture.Translations.ContainsKey(scopedKey)) {
|
if (culture.Translations.ContainsKey(scopedKey)) {
|
||||||
return culture.Translations[scopedKey];
|
return culture.Translations[scopedKey];
|
||||||
}
|
}
|
||||||
if (culture.Translations.ContainsKey(genericKey)) {
|
|
||||||
|
string genericKey = ("|" + text).ToLowerInvariant();
|
||||||
|
if ( culture.Translations.ContainsKey(genericKey) ) {
|
||||||
return culture.Translations[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) {
|
private static string GetParentTranslation(string scope, string text, string cultureName, IEnumerable<CultureDictionary> cultures) {
|
||||||
string scopedKey = scope + "|" + text;
|
string scopedKey = (scope + "|" + text).ToLowerInvariant();
|
||||||
string genericKey = "|" + text;
|
string genericKey = ("|" + text).ToLowerInvariant();
|
||||||
try {
|
try {
|
||||||
CultureInfo cultureInfo = CultureInfo.GetCultureInfo(cultureName);
|
CultureInfo cultureInfo = CultureInfo.GetCultureInfo(cultureName);
|
||||||
CultureInfo parentCultureInfo = cultureInfo.Parent;
|
CultureInfo parentCultureInfo = cultureInfo.Parent;
|
||||||
@@ -109,6 +111,7 @@ namespace Orchard.Localization.Services {
|
|||||||
// In reverse priority order:
|
// In reverse priority order:
|
||||||
// "~/Core/App_Data/Localization/<culture_name>/orchard.core.po";
|
// "~/Core/App_Data/Localization/<culture_name>/orchard.core.po";
|
||||||
// "~/Modules/<module_name>/App_Data/Localization/<culture_name>/orchard.module.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/Localization/<culture_name>/orchard.root.po";
|
||||||
// "~/App_Data/Sites/<tenant_name>/Localization/<culture_name>/orchard.po";
|
// "~/App_Data/Sites/<tenant_name>/Localization/<culture_name>/orchard.po";
|
||||||
// The dictionary entries from po files that live in higher priority locations will
|
// 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));
|
context.Monitor(_webSiteFolder.WhenPathChanges(corePath));
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var module in _extensionManager.AvailableExtensions()) {
|
foreach ( var module in _extensionManager.AvailableExtensions() ) {
|
||||||
if (String.Equals(module.ExtensionType, "Module")) {
|
if ( String.Equals(module.ExtensionType, "Module") ) {
|
||||||
string modulePath = string.Format(ModulesLocalizationFilePathFormat, module.Name, culture);
|
string modulePath = string.Format(ModulesLocalizationFilePathFormat, module.Name, culture);
|
||||||
text = _webSiteFolder.ReadFile(modulePath);
|
text = _webSiteFolder.ReadFile(modulePath);
|
||||||
if (text != null) {
|
if ( text != null ) {
|
||||||
ParseLocalizationStream(text, translations, true);
|
ParseLocalizationStream(text, translations, true);
|
||||||
context.Monitor(_webSiteFolder.WhenPathChanges(modulePath));
|
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);
|
string rootPath = string.Format(RootLocalizationFilePathFormat, culture);
|
||||||
text = _webSiteFolder.ReadFile(rootPath);
|
text = _webSiteFolder.ReadFile(rootPath);
|
||||||
if (text != null) {
|
if (text != null) {
|
||||||
@@ -170,24 +184,13 @@ namespace Orchard.Localization.Services {
|
|||||||
if (poLine.StartsWith("msgstr")) {
|
if (poLine.StartsWith("msgstr")) {
|
||||||
string translation = ParseTranslation(poLine);
|
string translation = ParseTranslation(poLine);
|
||||||
if (!String.IsNullOrEmpty(id)) {
|
if (!String.IsNullOrEmpty(id)) {
|
||||||
if (!String.IsNullOrEmpty(scope)) {
|
string scopedKey = (scope + "|" + id).ToLowerInvariant();
|
||||||
string scopedKey = scope + "|" + id;
|
if (!translations.ContainsKey(scopedKey)) {
|
||||||
if (!translations.ContainsKey(scopedKey)) {
|
translations.Add(scopedKey, translation);
|
||||||
translations.Add(scopedKey, translation);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if (merge) {
|
|
||||||
translations[scopedKey] = translation;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
string genericKey = "|" + id;
|
|
||||||
if (!translations.ContainsKey(genericKey)) {
|
|
||||||
translations.Add(genericKey, translation);
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (merge) {
|
if (merge) {
|
||||||
translations[genericKey] = translation;
|
translations[scopedKey] = translation;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -24,6 +24,7 @@ MenuItem
|
|||||||
-RouteValues
|
-RouteValues
|
||||||
-Item (clr object)
|
-Item (clr object)
|
||||||
|
|
||||||
|
|
||||||
List: ul|ol + li*
|
List: ul|ol + li*
|
||||||
.Items (meta-property, bound to shape children or passed in)
|
.Items (meta-property, bound to shape children or passed in)
|
||||||
.Id
|
.Id
|
||||||
|
|||||||
Reference in New Issue
Block a user