mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-04-05 21:01:35 +08:00
Merge
--HG-- branch : dev
This commit is contained in:
commit
13e4040cd0
@ -16,3 +16,4 @@ glob:src/*.ReSharper
|
||||
glob:*.orig
|
||||
glob:*.suo
|
||||
glob:src/Orchard.Web/Modules-temp/*
|
||||
glob:*.itrace.csdef
|
||||
|
@ -33,6 +33,7 @@
|
||||
</Target>
|
||||
|
||||
<Target Name="Package">
|
||||
<CallTarget Targets="Package-ForCloud"/>
|
||||
<CallTarget Targets="Package-Stage"/>
|
||||
<CallTarget Targets="Package-Zip"/>
|
||||
</Target>
|
||||
@ -92,7 +93,7 @@
|
||||
|
||||
<!-- Packaging -->
|
||||
|
||||
<Target Name="Package-Stage">
|
||||
<Target Name="Package-ForCloud">
|
||||
|
||||
<ItemGroup>
|
||||
<Stage-Bin-Exclude Include="$(WebSitesFolder)\**\bin\**\*" />
|
||||
@ -135,7 +136,10 @@
|
||||
SourceFiles="$(SrcFolder)\Orchard.Azure\Orchard.Azure.CloudService\ServiceConfiguration.cscfg"
|
||||
DestinationFolder="$(StageFolder)"
|
||||
/>
|
||||
|
||||
</Target>
|
||||
|
||||
<Target Name="Package-Stage">
|
||||
|
||||
<Exec
|
||||
Command=""$(ServiceHostingSDKBinDir)cspack" "$(ServiceFolder)\ServiceDefinition.csdef" /role:Orchard.Azure.Web;"$(CloudRootFolder)";Orchard.Azure.Web.dll /out:"$(StageFolder)\Orchard.cspkg""
|
||||
WorkingDirectory="$(CloudRootFolder)"
|
||||
|
@ -11,6 +11,50 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Framework", "..\Orc
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Core", "..\Orchard.Web\Core\Orchard.Core.csproj", "{9916839C-39FC-4CEB-A5AF-89CA7E87119F}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Modules", "Modules", "{8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Futures.Widgets", "..\Orchard.Web\Modules\Futures.Widgets\Futures.Widgets.csproj", "{E65E5633-C0FF-453C-A906-481C14F969D6}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Blogs", "..\Orchard.Web\Modules\Orchard.Blogs\Orchard.Blogs.csproj", "{63FBD4D9-E1DA-4A7B-AA6A-D6074FE50867}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Comments", "..\Orchard.Web\Modules\Orchard.Comments\Orchard.Comments.csproj", "{14C049FD-B35B-415A-A824-87F26B26E7FD}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.ContentTypes", "..\Orchard.Web\Modules\Orchard.ContentTypes\Orchard.ContentTypes.csproj", "{0E7646E8-FE8F-43C1-8799-D97860925EC4}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.DevTools", "..\Orchard.Web\Modules\Orchard.DevTools\Orchard.DevTools.csproj", "{67C1D3AF-A0EC-46B2-BAE1-DF1DA8E0B890}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Indexing", "..\Orchard.Web\Modules\Orchard.Indexing\Orchard.Indexing.csproj", "{EA2B9121-EF54-40A6-A53E-6593C86EE696}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Media", "..\Orchard.Web\Modules\Orchard.Media\Orchard.Media.csproj", "{D9A7B330-CD22-4DA1-A95A-8DE1982AD8EB}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.MetaData", "..\Orchard.Web\Modules\Orchard.MetaData\Orchard.MetaData.csproj", "{23E04990-2A8D-41B8-9908-6DDB71EA3B23}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Modules", "..\Orchard.Web\Modules\Orchard.Modules\Orchard.Modules.csproj", "{17F86780-9A1F-4AA1-86F1-875EEC2730C7}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.MultiTenancy", "..\Orchard.Web\Modules\Orchard.MultiTenancy\Orchard.MultiTenancy.csproj", "{72457126-E118-4171-A08F-9A709EE4B7FC}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Pages", "..\Orchard.Web\Modules\Orchard.Pages\Orchard.Pages.csproj", "{4A9C04A6-0986-4A92-A610-5F59FF273FB9}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Roles", "..\Orchard.Web\Modules\Orchard.Roles\Orchard.Roles.csproj", "{D10AD48F-407D-4DB5-A328-173EC7CB010F}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Sandbox", "..\Orchard.Web\Modules\Orchard.Sandbox\Orchard.Sandbox.csproj", "{17C44253-65A2-4597-98C7-16EE576824B6}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Search", "..\Orchard.Web\Modules\Orchard.Search\Orchard.Search.csproj", "{4BE4EB01-AC56-4048-924E-2CA77F509ABA}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Setup", "..\Orchard.Web\Modules\Orchard.Setup\Orchard.Setup.csproj", "{8C7FCBC2-E6E1-405E-BFB5-D8D9E67A09C4}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Tags", "..\Orchard.Web\Modules\Orchard.Tags\Orchard.Tags.csproj", "{5D0F00F0-26C9-4785-AD61-B85710C60EB0}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Themes", "..\Orchard.Web\Modules\Orchard.Themes\Orchard.Themes.csproj", "{CDE24A24-01D3-403C-84B9-37722E18DFB7}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard.Users", "..\Orchard.Web\Modules\Orchard.Users\Orchard.Users.csproj", "{79AED36E-ABD0-4747-93D3-8722B042454B}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "TinyMce", "..\Orchard.Web\Modules\TinyMce\TinyMce.csproj", "{954CA994-D204-468B-9D69-51F6AD3E1C29}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Tools", "Tools", "{75E7476C-C05B-4C41-8E38-081D3EB55659}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Orchard", "..\Tools\Orchard\Orchard.csproj", "{33B1BC8D-E292-4972-A363-22056B207156}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@ -37,8 +81,110 @@ Global
|
||||
{9916839C-39FC-4CEB-A5AF-89CA7E87119F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{9916839C-39FC-4CEB-A5AF-89CA7E87119F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{9916839C-39FC-4CEB-A5AF-89CA7E87119F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{E65E5633-C0FF-453C-A906-481C14F969D6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E65E5633-C0FF-453C-A906-481C14F969D6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E65E5633-C0FF-453C-A906-481C14F969D6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{E65E5633-C0FF-453C-A906-481C14F969D6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{63FBD4D9-E1DA-4A7B-AA6A-D6074FE50867}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{63FBD4D9-E1DA-4A7B-AA6A-D6074FE50867}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{63FBD4D9-E1DA-4A7B-AA6A-D6074FE50867}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{63FBD4D9-E1DA-4A7B-AA6A-D6074FE50867}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{14C049FD-B35B-415A-A824-87F26B26E7FD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{14C049FD-B35B-415A-A824-87F26B26E7FD}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{14C049FD-B35B-415A-A824-87F26B26E7FD}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{14C049FD-B35B-415A-A824-87F26B26E7FD}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{0E7646E8-FE8F-43C1-8799-D97860925EC4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{0E7646E8-FE8F-43C1-8799-D97860925EC4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{0E7646E8-FE8F-43C1-8799-D97860925EC4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{0E7646E8-FE8F-43C1-8799-D97860925EC4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{67C1D3AF-A0EC-46B2-BAE1-DF1DA8E0B890}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{67C1D3AF-A0EC-46B2-BAE1-DF1DA8E0B890}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{67C1D3AF-A0EC-46B2-BAE1-DF1DA8E0B890}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{67C1D3AF-A0EC-46B2-BAE1-DF1DA8E0B890}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{EA2B9121-EF54-40A6-A53E-6593C86EE696}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{EA2B9121-EF54-40A6-A53E-6593C86EE696}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{EA2B9121-EF54-40A6-A53E-6593C86EE696}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{EA2B9121-EF54-40A6-A53E-6593C86EE696}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D9A7B330-CD22-4DA1-A95A-8DE1982AD8EB}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D9A7B330-CD22-4DA1-A95A-8DE1982AD8EB}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D9A7B330-CD22-4DA1-A95A-8DE1982AD8EB}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D9A7B330-CD22-4DA1-A95A-8DE1982AD8EB}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{23E04990-2A8D-41B8-9908-6DDB71EA3B23}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{23E04990-2A8D-41B8-9908-6DDB71EA3B23}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{23E04990-2A8D-41B8-9908-6DDB71EA3B23}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{23E04990-2A8D-41B8-9908-6DDB71EA3B23}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{17F86780-9A1F-4AA1-86F1-875EEC2730C7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{17F86780-9A1F-4AA1-86F1-875EEC2730C7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{17F86780-9A1F-4AA1-86F1-875EEC2730C7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{17F86780-9A1F-4AA1-86F1-875EEC2730C7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{72457126-E118-4171-A08F-9A709EE4B7FC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{72457126-E118-4171-A08F-9A709EE4B7FC}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{72457126-E118-4171-A08F-9A709EE4B7FC}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{72457126-E118-4171-A08F-9A709EE4B7FC}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4A9C04A6-0986-4A92-A610-5F59FF273FB9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4A9C04A6-0986-4A92-A610-5F59FF273FB9}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4A9C04A6-0986-4A92-A610-5F59FF273FB9}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4A9C04A6-0986-4A92-A610-5F59FF273FB9}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{D10AD48F-407D-4DB5-A328-173EC7CB010F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{D10AD48F-407D-4DB5-A328-173EC7CB010F}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{D10AD48F-407D-4DB5-A328-173EC7CB010F}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{D10AD48F-407D-4DB5-A328-173EC7CB010F}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{17C44253-65A2-4597-98C7-16EE576824B6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{17C44253-65A2-4597-98C7-16EE576824B6}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{17C44253-65A2-4597-98C7-16EE576824B6}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{17C44253-65A2-4597-98C7-16EE576824B6}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4BE4EB01-AC56-4048-924E-2CA77F509ABA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4BE4EB01-AC56-4048-924E-2CA77F509ABA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4BE4EB01-AC56-4048-924E-2CA77F509ABA}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4BE4EB01-AC56-4048-924E-2CA77F509ABA}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8C7FCBC2-E6E1-405E-BFB5-D8D9E67A09C4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8C7FCBC2-E6E1-405E-BFB5-D8D9E67A09C4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8C7FCBC2-E6E1-405E-BFB5-D8D9E67A09C4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8C7FCBC2-E6E1-405E-BFB5-D8D9E67A09C4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{5D0F00F0-26C9-4785-AD61-B85710C60EB0}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{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
|
||||
{CDE24A24-01D3-403C-84B9-37722E18DFB7}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{CDE24A24-01D3-403C-84B9-37722E18DFB7}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{CDE24A24-01D3-403C-84B9-37722E18DFB7}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{CDE24A24-01D3-403C-84B9-37722E18DFB7}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{79AED36E-ABD0-4747-93D3-8722B042454B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{79AED36E-ABD0-4747-93D3-8722B042454B}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{79AED36E-ABD0-4747-93D3-8722B042454B}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{79AED36E-ABD0-4747-93D3-8722B042454B}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{954CA994-D204-468B-9D69-51F6AD3E1C29}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{954CA994-D204-468B-9D69-51F6AD3E1C29}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{954CA994-D204-468B-9D69-51F6AD3E1C29}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{954CA994-D204-468B-9D69-51F6AD3E1C29}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{33B1BC8D-E292-4972-A363-22056B207156}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{33B1BC8D-E292-4972-A363-22056B207156}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{33B1BC8D-E292-4972-A363-22056B207156}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{33B1BC8D-E292-4972-A363-22056B207156}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(NestedProjects) = preSolution
|
||||
{E65E5633-C0FF-453C-A906-481C14F969D6} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
|
||||
{63FBD4D9-E1DA-4A7B-AA6A-D6074FE50867} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
|
||||
{14C049FD-B35B-415A-A824-87F26B26E7FD} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
|
||||
{0E7646E8-FE8F-43C1-8799-D97860925EC4} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
|
||||
{67C1D3AF-A0EC-46B2-BAE1-DF1DA8E0B890} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
|
||||
{EA2B9121-EF54-40A6-A53E-6593C86EE696} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
|
||||
{D9A7B330-CD22-4DA1-A95A-8DE1982AD8EB} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
|
||||
{23E04990-2A8D-41B8-9908-6DDB71EA3B23} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
|
||||
{17F86780-9A1F-4AA1-86F1-875EEC2730C7} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
|
||||
{72457126-E118-4171-A08F-9A709EE4B7FC} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
|
||||
{4A9C04A6-0986-4A92-A610-5F59FF273FB9} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
|
||||
{D10AD48F-407D-4DB5-A328-173EC7CB010F} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
|
||||
{17C44253-65A2-4597-98C7-16EE576824B6} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
|
||||
{4BE4EB01-AC56-4048-924E-2CA77F509ABA} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
|
||||
{8C7FCBC2-E6E1-405E-BFB5-D8D9E67A09C4} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
|
||||
{5D0F00F0-26C9-4785-AD61-B85710C60EB0} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
|
||||
{CDE24A24-01D3-403C-84B9-37722E18DFB7} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
|
||||
{79AED36E-ABD0-4747-93D3-8722B042454B} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
|
||||
{954CA994-D204-468B-9D69-51F6AD3E1C29} = {8E3DE014-9B28-4B32-8AC1-B2BE404E9B2D}
|
||||
{33B1BC8D-E292-4972-A363-22056B207156} = {75E7476C-C05B-4C41-8E38-081D3EB55659}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
||||
|
@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
@ -46,8 +45,8 @@ namespace Orchard.Azure.Web {
|
||||
_host.EndRequest();
|
||||
}
|
||||
|
||||
private void CheckMvcVersion(params Version[] allowedVersions) {
|
||||
Assembly loadedMvcAssembly = typeof(System.Web.Mvc.Controller).Assembly;
|
||||
private static void CheckMvcVersion(params Version[] allowedVersions) {
|
||||
Assembly loadedMvcAssembly = typeof(Controller).Assembly;
|
||||
Version loadedMvcVersion = ReadAssemblyFileVersion(loadedMvcAssembly);
|
||||
|
||||
if ( allowedVersions.All(allowed => loadedMvcVersion != allowed) ) {
|
||||
@ -79,7 +78,7 @@ namespace Orchard.Azure.Web {
|
||||
}
|
||||
}
|
||||
|
||||
private Version ReadAssemblyFileVersion(Assembly assembly) {
|
||||
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",
|
||||
@ -99,6 +98,5 @@ namespace Orchard.Azure.Web {
|
||||
builder.RegisterInstance(ModelMetadataProviders.Current);
|
||||
builder.RegisterInstance(ViewEngines.Engines);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -47,6 +47,12 @@
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\lib\autofac\Autofac.Configuration.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Autofac.Integration.Web">
|
||||
<HintPath>..\..\..\lib\autofac\Autofac.Integration.Web.dll</HintPath>
|
||||
</Reference>
|
||||
<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>
|
||||
@ -55,36 +61,80 @@
|
||||
<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>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.WindowsAzure.StorageClient, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="NHibernate.ByteCode.Castle">
|
||||
<HintPath>..\..\..\lib\fluentnhibernate\NHibernate.ByteCode.Castle.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Data">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.ComponentModel.DataAnnotations">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.SQLite">
|
||||
<HintPath>..\..\..\lib\sqlite\x64\System.Data.SQLite.DLL</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.ApplicationServices">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.DynamicData">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Entity">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Extensions">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
<Reference Include="System.Web.Entity" />
|
||||
<Reference Include="System.Web.Extensions" />
|
||||
<Reference Include="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<SpecificVersion>False</SpecificVersion>
|
||||
<HintPath>..\..\..\..\..\..\Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC 2\\Assemblies\System.Web.Mvc.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.Abstractions" />
|
||||
<Reference Include="System.Web.Routing" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Web.Services" />
|
||||
<Reference Include="System.EnterpriseServices" />
|
||||
<Reference Include="System.Web.Mobile" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Drawing">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Web">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Abstractions">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Routing">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Configuration">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Services">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.EnterpriseServices">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Web.Mobile">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq">
|
||||
<Private>False</Private>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Global.asax.cs">
|
||||
@ -95,7 +145,6 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Global.asax" />
|
||||
<Content Include="Web.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Config\Diagnostics.config">
|
||||
@ -115,16 +164,109 @@
|
||||
<Project>{9916839C-39FC-4CEB-A5AF-89CA7E87119F}</Project>
|
||||
<Name>Orchard.Core</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\..\Orchard.Web\Modules\Futures.Widgets\Futures.Widgets.csproj">
|
||||
<Project>{E65E5633-C0FF-453C-A906-481C14F969D6}</Project>
|
||||
<Name>Futures.Widgets</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.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.DevTools\Orchard.DevTools.csproj">
|
||||
<Project>{67C1D3AF-A0EC-46B2-BAE1-DF1DA8E0B890}</Project>
|
||||
<Name>Orchard.DevTools</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.MetaData\Orchard.MetaData.csproj">
|
||||
<Project>{23E04990-2A8D-41B8-9908-6DDB71EA3B23}</Project>
|
||||
<Name>Orchard.MetaData</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.Pages\Orchard.Pages.csproj">
|
||||
<Project>{4A9C04A6-0986-4A92-A610-5F59FF273FB9}</Project>
|
||||
<Name>Orchard.Pages</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.Sandbox\Orchard.Sandbox.csproj">
|
||||
<Project>{17C44253-65A2-4597-98C7-16EE576824B6}</Project>
|
||||
<Name>Orchard.Sandbox</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>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Web.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Web.Debug.config">
|
||||
<DependentUpon>Web.config</DependentUpon>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Web.Release.config">
|
||||
<DependentUpon>Web.config</DependentUpon>
|
||||
</Content>
|
||||
</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.
|
||||
|
8
src/Orchard.Azure/Orchard.Azure.Web/Web.Debug.config
Normal file
8
src/Orchard.Azure/Orchard.Azure.Web/Web.Debug.config
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
|
||||
<system.web>
|
||||
<machineKey xdt:Transform="Insert" validationKey="013B82F217ABB7EAB1F699E4E5B4D290030644D435994692354DAE82B06568B058BFE3C57BF199A41FFDBC84F3BC74D9C5BD96D1265F36A22D58347B591AC8DD" decryptionKey="04797035C490263D73ED991C84C5DFCD0D0206AD4F12BC3638A38FBEABEBB8C7" validation="SHA1" decryption="AES" />
|
||||
</system.web>
|
||||
<system.web.extensions xdt:Transform="Remove" />
|
||||
</configuration>
|
8
src/Orchard.Azure/Orchard.Azure.Web/Web.Release.config
Normal file
8
src/Orchard.Azure/Orchard.Azure.Web/Web.Release.config
Normal file
@ -0,0 +1,8 @@
|
||||
<?xml version="1.0"?>
|
||||
|
||||
<configuration xmlns:xdt="http://schemas.microsoft.com/XML-Document-Transform">
|
||||
<system.web>
|
||||
<machineKey xdt:Transform="Insert" validationKey="013B82F217ABB7EAB1F699E4E5B4D290030644D435994692354DAE82B06568B058BFE3C57BF199A41FFDBC84F3BC74D9C5BD96D1265F36A22D58347B591AC8DD" decryptionKey="04797035C490263D73ED991C84C5DFCD0D0206AD4F12BC3638A38FBEABEBB8C7" validation="SHA1" decryption="AES" />
|
||||
</system.web>
|
||||
<system.web.extensions xdt:Transform="Remove" />
|
||||
</configuration>
|
@ -1,4 +1,4 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
Note: As an alternative to hand editing this file you can use the
|
||||
web admin tool to configure settings for your application. Use
|
||||
@ -8,41 +8,47 @@
|
||||
\Windows\Microsoft.Net\Framework\v2.x\Config
|
||||
-->
|
||||
<configuration>
|
||||
<appSettings/>
|
||||
<system.diagnostics configSource="Config\Diagnostics.config"/>
|
||||
<!--
|
||||
|
||||
<appSettings/>
|
||||
<system.diagnostics configSource="Config\Diagnostics.config"/>
|
||||
<!--
|
||||
Set default transaction timeout to 30 minutes so that interactive debugging
|
||||
is easier (default timeout is less than one minute)
|
||||
-->
|
||||
<system.transactions>
|
||||
<defaultSettings timeout="00:30:00"/>
|
||||
</system.transactions>
|
||||
<system.web>
|
||||
<!--
|
||||
<system.transactions>
|
||||
<defaultSettings timeout="00:30:00"/>
|
||||
</system.transactions>
|
||||
<system.web>
|
||||
<httpRuntime requestValidationMode="2.0" />
|
||||
<!--
|
||||
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="true" targetFramework="4.0">
|
||||
<assemblies>
|
||||
<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add assembly="System.Data.Linq, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies>
|
||||
</compilation>
|
||||
<!--
|
||||
<compilation debug="true" targetFramework="4.0">
|
||||
<buildProviders>
|
||||
<add extension=".csproj" type="Orchard.Environment.Extensions.Compilers.CSharpExtensionBuildProviderShim"/>
|
||||
</buildProviders>
|
||||
<assemblies>
|
||||
<add assembly="System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add assembly="System.Web.Abstractions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add assembly="System.Web.Routing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
<add assembly="System.Data.Linq, Version=4.0.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="Forms">
|
||||
<forms loginUrl="~/Users/Account/AccessDenied" timeout="2880"/>
|
||||
</authentication>
|
||||
<membership defaultProvider="OrchardMembershipProvider">
|
||||
<providers>
|
||||
<clear/>
|
||||
<!--<add name="AspNetSqlMembershipProvider"
|
||||
<authentication mode="Forms">
|
||||
<forms loginUrl="~/Users/Account/AccessDenied" timeout="2880"/>
|
||||
</authentication>
|
||||
<membership defaultProvider="OrchardMembershipProvider">
|
||||
<providers>
|
||||
<clear/>
|
||||
<!--<add name="AspNetSqlMembershipProvider"
|
||||
type="System.Web.Security.SqlMembershipProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"
|
||||
connectionStringName="ApplicationServices"
|
||||
enablePasswordRetrieval="false"
|
||||
@ -57,67 +63,68 @@
|
||||
passwordStrengthRegularExpression=""
|
||||
applicationName="/"
|
||||
/>-->
|
||||
<add name="OrchardMembershipProvider" type="Orchard.Security.Providers.OrchardMembershipProvider, Orchard.Framework" applicationName="/"/>
|
||||
</providers>
|
||||
</membership>
|
||||
<profile>
|
||||
<providers>
|
||||
<clear/>
|
||||
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="ApplicationServices" applicationName="/"/>
|
||||
</providers>
|
||||
</profile>
|
||||
<roleManager enabled="false">
|
||||
<providers>
|
||||
<clear/>
|
||||
<add name="OrchardRoleProvider" type="Orchard.Security.Providers.OrchardRoleProvider, Orchard.Framework"/>
|
||||
<add connectionStringName="ApplicationServices" applicationName="/" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
|
||||
<add applicationName="/" name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
|
||||
</providers>
|
||||
</roleManager>
|
||||
<!--
|
||||
<add name="OrchardMembershipProvider" type="Orchard.Security.Providers.OrchardMembershipProvider, Orchard.Framework" applicationName="/"/>
|
||||
</providers>
|
||||
</membership>
|
||||
<profile>
|
||||
<providers>
|
||||
<clear/>
|
||||
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" connectionStringName="ApplicationServices" applicationName="/"/>
|
||||
</providers>
|
||||
</profile>
|
||||
<roleManager enabled="false">
|
||||
<providers>
|
||||
<clear/>
|
||||
<add name="OrchardRoleProvider" type="Orchard.Security.Providers.OrchardRoleProvider, Orchard.Framework"/>
|
||||
<add connectionStringName="ApplicationServices" applicationName="/" name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
|
||||
<add applicationName="/" name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"/>
|
||||
</providers>
|
||||
</roleManager>
|
||||
<!--
|
||||
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="Off"/>
|
||||
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
|
||||
<namespaces>
|
||||
<add namespace="System.Web.Mvc"/>
|
||||
<add namespace="System.Web.Mvc.Ajax"/>
|
||||
<add namespace="System.Web.Mvc.Html"/>
|
||||
<add namespace="System.Web.Routing"/>
|
||||
<add namespace="System.Linq"/>
|
||||
<add namespace="System.Collections.Generic"/>
|
||||
<add namespace="Orchard.Mvc.Html"/>
|
||||
</namespaces>
|
||||
</pages>
|
||||
<httpHandlers>
|
||||
<add verb="*" path="*.mvc" validate="false" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
</httpHandlers>
|
||||
</system.web>
|
||||
<system.web.extensions/>
|
||||
<!--
|
||||
<customErrors mode="Off"/>
|
||||
<pages controlRenderingCompatibilityVersion="3.5" clientIDMode="AutoID">
|
||||
<namespaces>
|
||||
<add namespace="System.Web.Mvc"/>
|
||||
<add namespace="System.Web.Mvc.Ajax"/>
|
||||
<add namespace="System.Web.Mvc.Html"/>
|
||||
<add namespace="System.Web.Routing"/>
|
||||
<add namespace="System.Linq"/>
|
||||
<add namespace="System.Collections.Generic"/>
|
||||
<add namespace="Orchard.Mvc.Html"/>
|
||||
</namespaces>
|
||||
</pages>
|
||||
<httpHandlers>
|
||||
<add verb="*" path="*.mvc" validate="false" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
</httpHandlers>
|
||||
</system.web>
|
||||
<system.web.extensions/>
|
||||
<!--
|
||||
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 runAllManagedModulesForAllRequests="true">
|
||||
</modules>
|
||||
<handlers>
|
||||
<remove name="MvcHttpHandler"/>
|
||||
<remove name="UrlRoutingHandler"/>
|
||||
<add name="MvcHttpHandler" preCondition="integratedMode" verb="*" path="*.mvc" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
</handlers>
|
||||
</system.webServer>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
|
||||
<bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0"/>
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
<system.webServer>
|
||||
<validation validateIntegratedModeConfiguration="false"/>
|
||||
<modules runAllManagedModulesForAllRequests="true">
|
||||
</modules>
|
||||
<handlers>
|
||||
<remove name="MvcHttpHandler"/>
|
||||
<remove name="UrlRoutingHandler"/>
|
||||
<add name="MvcHttpHandler" preCondition="integratedMode" verb="*" path="*.mvc" type="System.Web.Mvc.MvcHttpHandler, System.Web.Mvc, Version=2.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
|
||||
</handlers>
|
||||
</system.webServer>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<probing privatePath="App_Data/Dependencies"/>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Web.Mvc" publicKeyToken="31bf3856ad364e35"/>
|
||||
<bindingRedirect oldVersion="1.0.0.0" newVersion="2.0.0.0"/>
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
||||
|
@ -86,6 +86,7 @@ namespace Orchard.Core.Settings.Metadata {
|
||||
}
|
||||
|
||||
private void Apply(ContentTypeDefinition model, ContentTypeDefinitionRecord record) {
|
||||
record.DisplayName = model.DisplayName;
|
||||
record.Settings = _settingsWriter.Map(model.Settings).ToString();
|
||||
|
||||
var toRemove = record.ContentTypePartDefinitionRecords
|
||||
|
@ -1,8 +1,6 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using Orchard.ContentManagement.MetaData.Models;
|
||||
using Orchard.ContentTypes.Services;
|
||||
using Orchard.ContentTypes.ViewModels;
|
||||
@ -11,34 +9,25 @@ using Orchard.Mvc.Results;
|
||||
using Orchard.UI.Notify;
|
||||
|
||||
namespace Orchard.ContentTypes.Controllers {
|
||||
public class AdminController : Controller {
|
||||
public class AdminController : Controller, IUpdateModel {
|
||||
private readonly IContentDefinitionService _contentDefinitionService;
|
||||
private readonly IContentDefinitionManager _contentDefinitionManager;
|
||||
private readonly IContentDefinitionEditorEvents _extendViewModels;
|
||||
|
||||
public AdminController(
|
||||
IOrchardServices orchardServices,
|
||||
IContentDefinitionService contentDefinitionService,
|
||||
IContentDefinitionManager contentDefinitionManager,
|
||||
IContentDefinitionEditorEvents extendViewModels) {
|
||||
public AdminController(IOrchardServices orchardServices, IContentDefinitionService contentDefinitionService) {
|
||||
Services = orchardServices;
|
||||
_contentDefinitionService = contentDefinitionService;
|
||||
_contentDefinitionManager = contentDefinitionManager;
|
||||
_extendViewModels = extendViewModels;
|
||||
T = NullLocalizer.Instance;
|
||||
}
|
||||
|
||||
public IOrchardServices Services { get; private set; }
|
||||
public Localizer T { get; set; }
|
||||
public ActionResult Index() {
|
||||
return List();
|
||||
}
|
||||
|
||||
public ActionResult Index() { return List(); }
|
||||
|
||||
#region Types
|
||||
|
||||
public ActionResult List() {
|
||||
return View("List", new ListContentTypesViewModel {
|
||||
Types = _contentDefinitionService.GetTypeDefinitions()
|
||||
Types = _contentDefinitionService.GetTypes()
|
||||
});
|
||||
}
|
||||
|
||||
@ -54,117 +43,51 @@ namespace Orchard.ContentTypes.Controllers {
|
||||
if (!Services.Authorizer.Authorize(Permissions.CreateContentTypes, T("Not allowed to create a content type.")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
if (!ModelState.IsValid)
|
||||
return View(viewModel);
|
||||
|
||||
var definition = _contentDefinitionService.AddTypeDefinition(viewModel.DisplayName);
|
||||
|
||||
return RedirectToAction("Edit", new { id = definition.Name });
|
||||
}
|
||||
|
||||
public ActionResult Edit(string id) {
|
||||
if (!Services.Authorizer.Authorize(Permissions.CreateContentTypes, T("Not allowed to edit a content type.")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var contentTypeDefinition = _contentDefinitionService.GetTypeDefinition(id);
|
||||
|
||||
if (contentTypeDefinition == null)
|
||||
return new NotFoundResult();
|
||||
|
||||
var viewModel = new EditTypeViewModel(contentTypeDefinition) {
|
||||
Templates = _extendViewModels.TypeEditor(contentTypeDefinition)
|
||||
};
|
||||
|
||||
foreach (var part in viewModel.Parts) {
|
||||
part.Templates = _extendViewModels.TypePartEditor(new ContentTypeDefinition.Part(part.PartDefinition.Definition, part.Settings));
|
||||
foreach (var field in part.PartDefinition.Fields)
|
||||
field.Templates = _extendViewModels.PartFieldEditor(new ContentPartDefinition.Field(field.FieldDefinition.Definition, field.Name, field.Settings));
|
||||
}
|
||||
|
||||
if (viewModel.Fields.Any()) {
|
||||
foreach (var field in viewModel.Fields)
|
||||
field.Templates = _extendViewModels.PartFieldEditor(new ContentPartDefinition.Field(field.FieldDefinition.Definition, field.Name, field.Settings));
|
||||
}
|
||||
|
||||
return View(viewModel);
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("Edit")]
|
||||
public ActionResult EditPOST(EditTypeViewModel viewModel) {
|
||||
if (!Services.Authorizer.Authorize(Permissions.CreateContentTypes, T("Not allowed to edit a content type.")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var contentTypeDefinition = _contentDefinitionService.GetTypeDefinition(viewModel.Name);
|
||||
|
||||
if (contentTypeDefinition == null)
|
||||
return new NotFoundResult();
|
||||
|
||||
var updater = new Updater(this);
|
||||
_contentDefinitionManager.AlterTypeDefinition(viewModel.Name, typeBuilder => {
|
||||
|
||||
typeBuilder.DisplayedAs(viewModel.DisplayName);
|
||||
|
||||
// allow extensions to alter type configuration
|
||||
viewModel.Templates = _extendViewModels.TypeEditorUpdate(typeBuilder, updater);
|
||||
|
||||
foreach (var entry in viewModel.Parts.Select((part, index) => new { part, index })) {
|
||||
var partViewModel = entry.part;
|
||||
|
||||
// enable updater to be aware of changing part prefix
|
||||
// todo: stick this info on the view model so the strings don't need to be in code & view
|
||||
var firstHalf = "Parts[" + entry.index + "].";
|
||||
updater._prefix = secondHalf => firstHalf + secondHalf;
|
||||
|
||||
// allow extensions to alter typePart configuration
|
||||
typeBuilder.WithPart(entry.part.PartDefinition.Name, typePartBuilder => {
|
||||
partViewModel.Templates = _extendViewModels.TypePartEditorUpdate(typePartBuilder, updater);
|
||||
});
|
||||
|
||||
if (!partViewModel.PartDefinition.Fields.Any())
|
||||
continue;
|
||||
|
||||
_contentDefinitionManager.AlterPartDefinition(partViewModel.PartDefinition.Name, partBuilder => {
|
||||
foreach (var fieldEntry in partViewModel.PartDefinition.Fields.Select((field, index) => new { field, index })) {
|
||||
partViewModel.PartDefinition.Fields = partViewModel.PartDefinition.Fields.ToArray();
|
||||
var fieldViewModel = fieldEntry.field;
|
||||
|
||||
// enable updater to be aware of changing field prefix
|
||||
var firstHalfFieldName = firstHalf + "PartDefinition.Fields[" + fieldEntry.index + "].";
|
||||
updater._prefix = secondHalf => firstHalfFieldName + secondHalf;
|
||||
|
||||
// allow extensions to alter partField configuration
|
||||
partBuilder.WithField(fieldViewModel.Name, partFieldBuilder => {
|
||||
fieldViewModel.Templates = _extendViewModels.PartFieldEditorUpdate(partFieldBuilder, updater);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (viewModel.Fields.Any()) {
|
||||
_contentDefinitionManager.AlterPartDefinition(viewModel.Name, partBuilder => {
|
||||
viewModel.Fields = viewModel.Fields.ToArray();
|
||||
foreach (var fieldEntry in viewModel.Fields.Select((field, index) => new { field, index })) {
|
||||
var fieldViewModel = fieldEntry.field;
|
||||
|
||||
// enable updater to be aware of changing field prefix
|
||||
var firstHalfFieldName = "Fields[" + fieldEntry.index + "].";
|
||||
updater._prefix = secondHalf => firstHalfFieldName + secondHalf;
|
||||
|
||||
// allow extensions to alter partField configuration
|
||||
partBuilder.WithField(fieldViewModel.Name, partFieldBuilder => {
|
||||
fieldViewModel.Templates = _extendViewModels.PartFieldEditorUpdate(partFieldBuilder, updater);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
var typeViewModel = _contentDefinitionService.AddType(viewModel);
|
||||
|
||||
if (!ModelState.IsValid) {
|
||||
Services.TransactionManager.Cancel();
|
||||
return View(viewModel);
|
||||
}
|
||||
|
||||
Services.Notifier.Information(T("\"{0}\" settings have been saved.", viewModel.DisplayName));
|
||||
Services.Notifier.Information(T("The \"{0}\" content type has been created.", typeViewModel.DisplayName));
|
||||
|
||||
return RedirectToAction("Edit", new { id = typeViewModel.Name });
|
||||
}
|
||||
|
||||
public ActionResult Edit(string id) {
|
||||
if (!Services.Authorizer.Authorize(Permissions.CreateContentTypes, T("Not allowed to edit a content type.")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var typeViewModel = _contentDefinitionService.GetType(id);
|
||||
|
||||
if (typeViewModel == null)
|
||||
return new NotFoundResult();
|
||||
|
||||
return View(typeViewModel);
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("Edit")]
|
||||
public ActionResult EditPOST(string id) {
|
||||
if (!Services.Authorizer.Authorize(Permissions.CreateContentTypes, T("Not allowed to edit a content type.")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var typeViewModel = _contentDefinitionService.GetType(id);
|
||||
|
||||
if (typeViewModel == null)
|
||||
return new NotFoundResult();
|
||||
|
||||
if (!TryUpdateModel(typeViewModel))
|
||||
return View(typeViewModel);
|
||||
|
||||
_contentDefinitionService.AlterType(typeViewModel, this);
|
||||
|
||||
if (!ModelState.IsValid) {
|
||||
Services.TransactionManager.Cancel();
|
||||
return View(typeViewModel);
|
||||
}
|
||||
|
||||
Services.Notifier.Information(T("\"{0}\" settings have been saved.", typeViewModel.DisplayName));
|
||||
|
||||
return RedirectToAction("Index");
|
||||
}
|
||||
@ -173,16 +96,16 @@ namespace Orchard.ContentTypes.Controllers {
|
||||
if (!Services.Authorizer.Authorize(Permissions.CreateContentTypes, T("Not allowed to edit a content type.")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var contentTypeDefinition = _contentDefinitionService.GetTypeDefinition(id);
|
||||
var typeViewModel = _contentDefinitionService.GetType(id);
|
||||
|
||||
if (contentTypeDefinition == null)
|
||||
if (typeViewModel == null)
|
||||
return new NotFoundResult();
|
||||
|
||||
var viewModel = new AddPartsViewModel {
|
||||
Type = new EditTypeViewModel(contentTypeDefinition),
|
||||
PartSelections = _contentDefinitionService.GetPartDefinitions()
|
||||
.Where(cpd => !contentTypeDefinition.Parts.Any(p => p.PartDefinition.Name == cpd.Name))
|
||||
.Select(cpd => new PartSelectionViewModel {PartName = cpd.Name})
|
||||
Type = typeViewModel,
|
||||
PartSelections = _contentDefinitionService.GetParts()
|
||||
.Where(cpd => !typeViewModel.Parts.Any(p => p.PartDefinition.Name == cpd.Name))
|
||||
.Select(cpd => new PartSelectionViewModel { PartName = cpd.Name })
|
||||
};
|
||||
|
||||
return View(viewModel);
|
||||
@ -193,24 +116,28 @@ namespace Orchard.ContentTypes.Controllers {
|
||||
if (!Services.Authorizer.Authorize(Permissions.CreateContentTypes, T("Not allowed to edit a content type.")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var contentTypeDefinition = _contentDefinitionService.GetTypeDefinition(id);
|
||||
var typeViewModel = _contentDefinitionService.GetType(id);
|
||||
|
||||
if (contentTypeDefinition == null)
|
||||
if (typeViewModel == null)
|
||||
return new NotFoundResult();
|
||||
|
||||
var viewModel = new AddPartsViewModel();
|
||||
TryUpdateModel(viewModel);
|
||||
|
||||
if (!ModelState.IsValid) {
|
||||
viewModel.Type = new EditTypeViewModel(contentTypeDefinition);
|
||||
if (!TryUpdateModel(viewModel)) {
|
||||
viewModel.Type = typeViewModel;
|
||||
return View(viewModel);
|
||||
}
|
||||
|
||||
_contentDefinitionManager.AlterTypeDefinition(contentTypeDefinition.Name, typeBuilder => {
|
||||
var partsToAdd = viewModel.PartSelections.Where(ps => ps.IsSelected).Select(ps => ps.PartName);
|
||||
foreach (var partToAdd in partsToAdd)
|
||||
typeBuilder.WithPart(partToAdd);
|
||||
});
|
||||
var partsToAdd = viewModel.PartSelections.Where(ps => ps.IsSelected).Select(ps => ps.PartName);
|
||||
foreach (var partToAdd in partsToAdd) {
|
||||
_contentDefinitionService.AddPartToType(partToAdd, typeViewModel.Name);
|
||||
Services.Notifier.Information(T("The \"{0}\" part has been added.", partToAdd));
|
||||
}
|
||||
|
||||
if (!ModelState.IsValid) {
|
||||
Services.TransactionManager.Cancel(); ;
|
||||
viewModel.Type = typeViewModel;
|
||||
return View(viewModel);
|
||||
}
|
||||
|
||||
return RedirectToAction("Edit", new {id});
|
||||
}
|
||||
@ -219,15 +146,15 @@ namespace Orchard.ContentTypes.Controllers {
|
||||
if (!Services.Authorizer.Authorize(Permissions.CreateContentTypes, T("Not allowed to edit a content type.")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var contentTypeDefinition = _contentDefinitionService.GetTypeDefinition(id);
|
||||
var typeViewModel = _contentDefinitionService.GetType(id);
|
||||
|
||||
var viewModel = new RemovePartViewModel();
|
||||
if (contentTypeDefinition == null
|
||||
if (typeViewModel == null
|
||||
|| !TryUpdateModel(viewModel)
|
||||
|| !contentTypeDefinition.Parts.Any(p => p.PartDefinition.Name == viewModel.Name))
|
||||
|| !typeViewModel.Parts.Any(p => p.PartDefinition.Name == viewModel.Name))
|
||||
return new NotFoundResult();
|
||||
|
||||
viewModel.Type = new EditTypeViewModel { Name = contentTypeDefinition.Name, DisplayName = contentTypeDefinition.DisplayName };
|
||||
viewModel.Type = typeViewModel;
|
||||
return View(viewModel);
|
||||
}
|
||||
|
||||
@ -236,20 +163,22 @@ namespace Orchard.ContentTypes.Controllers {
|
||||
if (!Services.Authorizer.Authorize(Permissions.CreateContentTypes, T("Not allowed to edit a content type.")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var contentTypeDefinition = _contentDefinitionService.GetTypeDefinition(id);
|
||||
var typeViewModel = _contentDefinitionService.GetType(id);
|
||||
|
||||
var viewModel = new RemovePartViewModel();
|
||||
if (contentTypeDefinition == null
|
||||
if (typeViewModel == null
|
||||
|| !TryUpdateModel(viewModel)
|
||||
|| !contentTypeDefinition.Parts.Any(p => p.PartDefinition.Name == viewModel.Name))
|
||||
|| !typeViewModel.Parts.Any(p => p.PartDefinition.Name == viewModel.Name))
|
||||
return new NotFoundResult();
|
||||
|
||||
_contentDefinitionService.RemovePartFromType(viewModel.Name, typeViewModel.Name);
|
||||
|
||||
if (!ModelState.IsValid) {
|
||||
viewModel.Type = new EditTypeViewModel { Name = contentTypeDefinition.Name, DisplayName = contentTypeDefinition.DisplayName };
|
||||
Services.TransactionManager.Cancel();
|
||||
viewModel.Type = typeViewModel;
|
||||
return View(viewModel);
|
||||
}
|
||||
|
||||
_contentDefinitionManager.AlterTypeDefinition(id, typeBuilder => typeBuilder.RemovePart(viewModel.Name));
|
||||
Services.Notifier.Information(T("The \"{0}\" part has been removed.", viewModel.Name));
|
||||
|
||||
return RedirectToAction("Edit", new {id});
|
||||
@ -261,7 +190,7 @@ namespace Orchard.ContentTypes.Controllers {
|
||||
|
||||
public ActionResult ListParts() {
|
||||
return View(new ListContentPartsViewModel {
|
||||
Parts = _contentDefinitionService.GetPartDefinitions()
|
||||
Parts = _contentDefinitionService.GetParts()
|
||||
});
|
||||
}
|
||||
|
||||
@ -277,51 +206,50 @@ namespace Orchard.ContentTypes.Controllers {
|
||||
if (!Services.Authorizer.Authorize(Permissions.CreateContentTypes, T("Not allowed to create a content part.")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var partViewModel = _contentDefinitionService.AddPart(viewModel);
|
||||
|
||||
if (!ModelState.IsValid)
|
||||
return View(viewModel);
|
||||
|
||||
var definition = _contentDefinitionService.AddPartDefinition(viewModel.Name);
|
||||
Services.Notifier.Information(T("The \"{0}\" content part has been created.", partViewModel.Name));
|
||||
|
||||
return RedirectToAction("EditPart", new { id = definition.Name });
|
||||
return RedirectToAction("EditPart", new { id = partViewModel.Name });
|
||||
}
|
||||
|
||||
public ActionResult EditPart(string id) {
|
||||
if (!Services.Authorizer.Authorize(Permissions.CreateContentTypes, T("Not allowed to edit a content part.")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var contentPartDefinition = _contentDefinitionService.GetPartDefinition(id);
|
||||
var partViewModel = _contentDefinitionService.GetPart(id);
|
||||
|
||||
if (contentPartDefinition == null)
|
||||
if (partViewModel == null)
|
||||
return new NotFoundResult();
|
||||
|
||||
var viewModel = new EditPartViewModel(contentPartDefinition) {
|
||||
Templates = _extendViewModels.PartEditor(contentPartDefinition)
|
||||
};
|
||||
|
||||
return View(viewModel);
|
||||
return View(partViewModel);
|
||||
}
|
||||
|
||||
[HttpPost, ActionName("EditPart")]
|
||||
public ActionResult EditPartPOST(EditPartViewModel viewModel) {
|
||||
public ActionResult EditPartPOST(string id) {
|
||||
if (!Services.Authorizer.Authorize(Permissions.CreateContentTypes, T("Not allowed to edit a content part.")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var contentPartDefinition = _contentDefinitionService.GetPartDefinition(viewModel.Name);
|
||||
var partViewModel = _contentDefinitionService.GetPart(id);
|
||||
|
||||
if (contentPartDefinition == null)
|
||||
if (partViewModel == null)
|
||||
return new NotFoundResult();
|
||||
|
||||
var updater = new Updater(this);
|
||||
_contentDefinitionManager.AlterPartDefinition(viewModel.Name, partBuilder => {
|
||||
// allow extensions to alter part configuration
|
||||
viewModel.Templates = _extendViewModels.PartEditorUpdate(partBuilder, updater);
|
||||
});
|
||||
if (!TryUpdateModel(partViewModel))
|
||||
return View(partViewModel);
|
||||
|
||||
_contentDefinitionService.AlterPart(partViewModel, this);
|
||||
|
||||
if (!ModelState.IsValid) {
|
||||
Services.TransactionManager.Cancel();
|
||||
return View(viewModel);
|
||||
return View(partViewModel);
|
||||
}
|
||||
|
||||
Services.Notifier.Information(T("\"{0}\" settings have been saved.", partViewModel.Name));
|
||||
|
||||
return RedirectToAction("ListParts");
|
||||
}
|
||||
|
||||
@ -329,20 +257,20 @@ namespace Orchard.ContentTypes.Controllers {
|
||||
if (!Services.Authorizer.Authorize(Permissions.CreateContentTypes, T("Not allowed to edit a content part.")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var contentPartDefinition = _contentDefinitionService.GetPartDefinition(id);
|
||||
var partViewModel = _contentDefinitionService.GetPart(id);
|
||||
|
||||
if (contentPartDefinition == null) {
|
||||
if (partViewModel == null) {
|
||||
//id passed in might be that of a type w/ no implicit field
|
||||
var contentTypeDefinition = _contentDefinitionService.GetTypeDefinition(id);
|
||||
if (contentTypeDefinition != null)
|
||||
contentPartDefinition = new ContentPartDefinition(id);
|
||||
var typeViewModel = _contentDefinitionService.GetType(id);
|
||||
if (typeViewModel != null)
|
||||
partViewModel = new EditPartViewModel(new ContentPartDefinition(id));
|
||||
else
|
||||
return new NotFoundResult();
|
||||
}
|
||||
|
||||
var viewModel = new AddFieldViewModel {
|
||||
Part = new EditPartViewModel(contentPartDefinition),
|
||||
Fields = _contentDefinitionService.GetFieldDefinitions()
|
||||
Part = partViewModel,
|
||||
Fields = _contentDefinitionService.GetFields()
|
||||
};
|
||||
|
||||
return View(viewModel);
|
||||
@ -353,42 +281,36 @@ namespace Orchard.ContentTypes.Controllers {
|
||||
if (!Services.Authorizer.Authorize(Permissions.CreateContentTypes, T("Not allowed to edit a content part.")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var viewModel = new AddFieldViewModel();
|
||||
TryUpdateModel(viewModel);
|
||||
|
||||
var contentPartDefinition = _contentDefinitionService.GetPartDefinition(id);
|
||||
var contentTypeDefinition = _contentDefinitionService.GetTypeDefinition(id);
|
||||
|
||||
if (!ModelState.IsValid)
|
||||
return AddFieldTo(id);
|
||||
|
||||
if (contentPartDefinition == null) {
|
||||
var partViewModel = _contentDefinitionService.GetPart(id);
|
||||
var typeViewModel = _contentDefinitionService.GetType(id);
|
||||
if (partViewModel == null) {
|
||||
//id passed in might be that of a type w/ no implicit field
|
||||
if (contentTypeDefinition != null) {
|
||||
contentPartDefinition = new ContentPartDefinition(id);
|
||||
var contentTypeDefinitionParts = contentTypeDefinition.Parts.ToList();
|
||||
contentTypeDefinitionParts.Add(new ContentTypeDefinition.Part(contentPartDefinition, null));
|
||||
_contentDefinitionService.AlterTypeDefinition(
|
||||
new ContentTypeDefinition(
|
||||
contentTypeDefinition.Name,
|
||||
contentTypeDefinition.DisplayName,
|
||||
contentTypeDefinitionParts,
|
||||
contentTypeDefinition.Settings
|
||||
)
|
||||
);
|
||||
if (typeViewModel != null) {
|
||||
partViewModel = new EditPartViewModel { Name = typeViewModel.Name };
|
||||
_contentDefinitionService.AddPart(new CreatePartViewModel { Name = partViewModel.Name });
|
||||
_contentDefinitionService.AddPartToType(partViewModel.Name, typeViewModel.Name);
|
||||
}
|
||||
else {
|
||||
return new NotFoundResult();
|
||||
}
|
||||
}
|
||||
|
||||
var contentPartFields = contentPartDefinition.Fields.ToList();
|
||||
contentPartFields.Add(new ContentPartDefinition.Field(new ContentFieldDefinition(viewModel.FieldTypeName), viewModel.DisplayName, null));
|
||||
_contentDefinitionService.AlterPartDefinition(new ContentPartDefinition(contentPartDefinition.Name, contentPartFields, contentPartDefinition.Settings));
|
||||
var viewModel = new AddFieldViewModel();
|
||||
if (!TryUpdateModel(viewModel)) {
|
||||
Services.TransactionManager.Cancel();
|
||||
return AddFieldTo(id);
|
||||
}
|
||||
|
||||
_contentDefinitionService.AddFieldToPart(viewModel.DisplayName, viewModel.FieldTypeName, partViewModel.Name);
|
||||
|
||||
if (!ModelState.IsValid) {
|
||||
Services.TransactionManager.Cancel();
|
||||
return AddFieldTo(id);
|
||||
}
|
||||
|
||||
Services.Notifier.Information(T("The \"{0}\" field has been added.", viewModel.DisplayName));
|
||||
|
||||
if (contentTypeDefinition != null)
|
||||
if (typeViewModel != null)
|
||||
return RedirectToAction("Edit", new { id });
|
||||
|
||||
return RedirectToAction("EditPart", new { id });
|
||||
@ -399,15 +321,15 @@ namespace Orchard.ContentTypes.Controllers {
|
||||
if (!Services.Authorizer.Authorize(Permissions.CreateContentTypes, T("Not allowed to edit a content part.")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var contentPartDefinition = _contentDefinitionService.GetPartDefinition(id);
|
||||
var partViewModel = _contentDefinitionService.GetPart(id);
|
||||
|
||||
var viewModel = new RemoveFieldViewModel();
|
||||
if (contentPartDefinition == null
|
||||
if (partViewModel == null
|
||||
|| !TryUpdateModel(viewModel)
|
||||
|| !contentPartDefinition.Fields.Any(p => p.Name == viewModel.Name))
|
||||
|| !partViewModel.Fields.Any(p => p.Name == viewModel.Name))
|
||||
return new NotFoundResult();
|
||||
|
||||
viewModel.Part = new EditPartViewModel { Name = contentPartDefinition.Name };
|
||||
viewModel.Part = partViewModel;
|
||||
return View(viewModel);
|
||||
}
|
||||
|
||||
@ -416,23 +338,25 @@ namespace Orchard.ContentTypes.Controllers {
|
||||
if (!Services.Authorizer.Authorize(Permissions.CreateContentTypes, T("Not allowed to edit a content part.")))
|
||||
return new HttpUnauthorizedResult();
|
||||
|
||||
var contentPartDefinition = _contentDefinitionService.GetPartDefinition(id);
|
||||
var partViewModel = _contentDefinitionService.GetPart(id);
|
||||
|
||||
var viewModel = new RemoveFieldViewModel();
|
||||
if (contentPartDefinition == null
|
||||
if (partViewModel == null
|
||||
|| !TryUpdateModel(viewModel)
|
||||
|| !contentPartDefinition.Fields.Any(p => p.Name == viewModel.Name))
|
||||
|| !partViewModel.Fields.Any(p => p.Name == viewModel.Name))
|
||||
return new NotFoundResult();
|
||||
|
||||
_contentDefinitionService.RemoveFieldFromPart(viewModel.Name, partViewModel.Name);
|
||||
|
||||
if (!ModelState.IsValid) {
|
||||
viewModel.Part = new EditPartViewModel { Name = contentPartDefinition.Name };
|
||||
Services.TransactionManager.Cancel();
|
||||
viewModel.Part = partViewModel;
|
||||
return View(viewModel);
|
||||
}
|
||||
|
||||
_contentDefinitionManager.AlterPartDefinition(id, typeBuilder => typeBuilder.RemoveField(viewModel.Name));
|
||||
Services.Notifier.Information(T("The \"{0}\" field has been removed.", viewModel.Name));
|
||||
|
||||
if (_contentDefinitionService.GetTypeDefinition(id) != null)
|
||||
if (_contentDefinitionService.GetType(id) != null)
|
||||
return RedirectToAction("Edit", new { id });
|
||||
|
||||
return RedirectToAction("EditPart", new { id });
|
||||
@ -440,23 +364,12 @@ namespace Orchard.ContentTypes.Controllers {
|
||||
|
||||
#endregion
|
||||
|
||||
class Updater : IUpdateModel {
|
||||
private readonly AdminController _thunk;
|
||||
|
||||
public Updater(AdminController thunk) {
|
||||
_thunk = thunk;
|
||||
}
|
||||
|
||||
public Func<string, string> _prefix = x => x;
|
||||
|
||||
public bool TryUpdateModel<TModel>(TModel model, string prefix, string[] includeProperties, string[] excludeProperties) where TModel : class {
|
||||
return _thunk.TryUpdateModel(model, _prefix(prefix), includeProperties, excludeProperties);
|
||||
}
|
||||
|
||||
public void AddModelError(string key, LocalizedString errorMessage) {
|
||||
_thunk.ModelState.AddModelError(_prefix(key), errorMessage.ToString());
|
||||
}
|
||||
public new bool TryUpdateModel<TModel>(TModel model, string prefix, string[] includeProperties, string[] excludeProperties) where TModel : class {
|
||||
return base.TryUpdateModel(model, prefix, includeProperties, excludeProperties);
|
||||
}
|
||||
|
||||
public void AddModelError(string key, LocalizedString errorMessage) {
|
||||
ModelState.AddModelError(key, errorMessage.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -99,8 +99,8 @@
|
||||
<Content Include="Views\Admin\EditPart.ascx" />
|
||||
<Content Include="Views\Admin\Edit.ascx" />
|
||||
<Content Include="Views\Admin\List.ascx" />
|
||||
<Content Include="Views\DisplayTemplates\ContentTypeDefinition.ascx" />
|
||||
<Content Include="Views\DisplayTemplates\ContentPartDefinition.ascx" />
|
||||
<Content Include="Views\DisplayTemplates\EditTypeViewModel.ascx" />
|
||||
<Content Include="Views\DisplayTemplates\EditPartViewModel.ascx" />
|
||||
<Content Include="Views\DisplayTemplates\Field.ascx" />
|
||||
<Content Include="Views\DisplayTemplates\Fields.ascx" />
|
||||
<Content Include="Views\DisplayTemplates\Settings.ascx" />
|
||||
|
@ -2,79 +2,172 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using Orchard.ContentManagement.MetaData.Models;
|
||||
using Orchard.ContentTypes.ViewModels;
|
||||
using Orchard.Localization;
|
||||
using Orchard.UI.Notify;
|
||||
|
||||
namespace Orchard.ContentTypes.Services {
|
||||
public class ContentDefinitionService : IContentDefinitionService {
|
||||
private readonly IContentDefinitionManager _contentDefinitionManager;
|
||||
private readonly IEnumerable<IContentPartDriver> _contentPartDrivers;
|
||||
private readonly IEnumerable<IContentFieldDriver> _contentFieldDrivers;
|
||||
private readonly IContentDefinitionEditorEvents _contentDefinitionEditorEvents;
|
||||
|
||||
public ContentDefinitionService(IOrchardServices services, IContentDefinitionManager contentDefinitionManager, IEnumerable<IContentFieldDriver> contentFieldDrivers) {
|
||||
public ContentDefinitionService(
|
||||
IOrchardServices services,
|
||||
IContentDefinitionManager contentDefinitionManager,
|
||||
IEnumerable<IContentPartDriver> contentPartDrivers,
|
||||
IEnumerable<IContentFieldDriver> contentFieldDrivers,
|
||||
IContentDefinitionEditorEvents contentDefinitionEditorEvents)
|
||||
{
|
||||
Services = services;
|
||||
_contentDefinitionManager = contentDefinitionManager;
|
||||
_contentPartDrivers = contentPartDrivers;
|
||||
_contentFieldDrivers = contentFieldDrivers;
|
||||
_contentDefinitionEditorEvents = contentDefinitionEditorEvents;
|
||||
T = NullLocalizer.Instance;
|
||||
}
|
||||
|
||||
public IOrchardServices Services { get; set; }
|
||||
public Localizer T { get; set; }
|
||||
|
||||
public IEnumerable<ContentTypeDefinition> GetTypeDefinitions() {
|
||||
return _contentDefinitionManager.ListTypeDefinitions();
|
||||
public IEnumerable<EditTypeViewModel> GetTypes() {
|
||||
return _contentDefinitionManager.ListTypeDefinitions().Select(ctd => new EditTypeViewModel(ctd));
|
||||
}
|
||||
|
||||
public ContentTypeDefinition GetTypeDefinition(string name) {
|
||||
return _contentDefinitionManager.GetTypeDefinition(name);
|
||||
public EditTypeViewModel GetType(string name) {
|
||||
var contentTypeDefinition = _contentDefinitionManager.GetTypeDefinition(name);
|
||||
|
||||
if (contentTypeDefinition == null)
|
||||
return null;
|
||||
|
||||
var viewModel = new EditTypeViewModel(contentTypeDefinition) {
|
||||
Templates = _contentDefinitionEditorEvents.TypeEditor(contentTypeDefinition)
|
||||
};
|
||||
|
||||
foreach (var part in viewModel.Parts) {
|
||||
part.Templates = _contentDefinitionEditorEvents.TypePartEditor(part._Definition);
|
||||
foreach (var field in part.PartDefinition.Fields)
|
||||
field.Templates = _contentDefinitionEditorEvents.PartFieldEditor(field._Definition);
|
||||
}
|
||||
|
||||
if (viewModel.Fields.Any()) {
|
||||
foreach (var field in viewModel.Fields)
|
||||
field.Templates = _contentDefinitionEditorEvents.PartFieldEditor(field._Definition);
|
||||
}
|
||||
|
||||
return viewModel;
|
||||
}
|
||||
|
||||
public ContentTypeDefinition AddTypeDefinition(string displayName) {
|
||||
var name = GenerateName(displayName);
|
||||
public EditTypeViewModel AddType(CreateTypeViewModel typeViewModel) {
|
||||
var name = GenerateName(typeViewModel.DisplayName);
|
||||
|
||||
while (_contentDefinitionManager.GetTypeDefinition(name) != null)
|
||||
name = VersionName(name);
|
||||
|
||||
var contentTypeDefinition = new ContentTypeDefinition(name) { DisplayName = displayName };
|
||||
//just giving the new type some default parts for now
|
||||
_contentDefinitionManager.StoreTypeDefinition(contentTypeDefinition);
|
||||
_contentDefinitionManager.AlterTypeDefinition(
|
||||
contentTypeDefinition.Name,
|
||||
cfg => cfg.WithPart("CommonAspect")
|
||||
//.WithPart("RoutableAspect") //need to go the new routable route
|
||||
.WithPart("BodyAspect"));
|
||||
|
||||
Services.Notifier.Information(T("The \"{0}\" content type has created.", contentTypeDefinition.DisplayName));
|
||||
|
||||
return contentTypeDefinition;
|
||||
}
|
||||
|
||||
public void AlterTypeDefinition(ContentTypeDefinition contentTypeDefinition) {
|
||||
var contentTypeDefinition = new ContentTypeDefinition(name, typeViewModel.DisplayName);
|
||||
_contentDefinitionManager.StoreTypeDefinition(contentTypeDefinition);
|
||||
|
||||
var implicitTypePart = contentTypeDefinition.Parts.SingleOrDefault(p => p.PartDefinition.Name == contentTypeDefinition.Name);
|
||||
if (implicitTypePart != null) {
|
||||
AlterPartDefinition(implicitTypePart.PartDefinition);
|
||||
}
|
||||
return new EditTypeViewModel(contentTypeDefinition);
|
||||
}
|
||||
|
||||
public void RemoveTypeDefinition(string name) {
|
||||
public void AlterType(EditTypeViewModel typeViewModel, IUpdateModel updateModel) {
|
||||
var updater = new Updater(updateModel);
|
||||
_contentDefinitionManager.AlterTypeDefinition(typeViewModel.Name, typeBuilder => {
|
||||
typeBuilder.DisplayedAs(typeViewModel.DisplayName);
|
||||
|
||||
// allow extensions to alter type configuration
|
||||
typeViewModel.Templates = _contentDefinitionEditorEvents.TypeEditorUpdate(typeBuilder, updater);
|
||||
|
||||
foreach (var part in typeViewModel.Parts) {
|
||||
var partViewModel = part;
|
||||
|
||||
// enable updater to be aware of changing part prefix
|
||||
updater._prefix = secondHalf => string.Format("{0}.{1}", partViewModel.Prefix, secondHalf);
|
||||
|
||||
// allow extensions to alter typePart configuration
|
||||
typeBuilder.WithPart(partViewModel.PartDefinition.Name, typePartBuilder => {
|
||||
partViewModel.Templates = _contentDefinitionEditorEvents.TypePartEditorUpdate(typePartBuilder, updater);
|
||||
});
|
||||
|
||||
if (!partViewModel.PartDefinition.Fields.Any())
|
||||
continue;
|
||||
|
||||
_contentDefinitionManager.AlterPartDefinition(partViewModel.PartDefinition.Name, partBuilder => {
|
||||
var fieldFirstHalf = string.Format("{0}.{1}", partViewModel.Prefix, partViewModel.PartDefinition.Prefix);
|
||||
foreach (var field in partViewModel.PartDefinition.Fields) {
|
||||
var fieldViewModel = field;
|
||||
|
||||
// enable updater to be aware of changing field prefix
|
||||
updater._prefix = secondHalf =>
|
||||
string.Format("{0}.{1}.{2}", fieldFirstHalf, fieldViewModel.Prefix, secondHalf);
|
||||
// allow extensions to alter partField configuration
|
||||
partBuilder.WithField(fieldViewModel.Name, partFieldBuilder => {
|
||||
fieldViewModel.Templates = _contentDefinitionEditorEvents.PartFieldEditorUpdate(partFieldBuilder, updater);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
if (typeViewModel.Fields.Any()) {
|
||||
_contentDefinitionManager.AlterPartDefinition(typeViewModel.Name, partBuilder => {
|
||||
foreach (var field in typeViewModel.Fields) {
|
||||
var fieldViewModel = field;
|
||||
|
||||
// enable updater to be aware of changing field prefix
|
||||
updater._prefix = secondHalf =>
|
||||
string.Format("{0}.{1}", fieldViewModel.Prefix, secondHalf);
|
||||
|
||||
// allow extensions to alter partField configuration
|
||||
partBuilder.WithField(fieldViewModel.Name, partFieldBuilder => {
|
||||
fieldViewModel.Templates = _contentDefinitionEditorEvents.PartFieldEditorUpdate(partFieldBuilder, updater);
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void RemoveType(string name) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public IEnumerable<ContentPartDefinition> GetPartDefinitions() {
|
||||
var typeNames = GetTypeDefinitions().Select(ctd => ctd.Name);
|
||||
return _contentDefinitionManager.ListPartDefinitions().Where(cpd => !typeNames.Contains(cpd.Name));
|
||||
public void AddPartToType(string partName, string typeName) {
|
||||
_contentDefinitionManager.AlterTypeDefinition(typeName, typeBuilder => typeBuilder.WithPart(partName));
|
||||
}
|
||||
|
||||
public ContentPartDefinition GetPartDefinition(string name) {
|
||||
return _contentDefinitionManager.GetPartDefinition(name);
|
||||
public void RemovePartFromType(string partName, string typeName) {
|
||||
_contentDefinitionManager.AlterTypeDefinition(typeName, typeBuilder => typeBuilder.RemovePart(partName));
|
||||
}
|
||||
|
||||
public ContentPartDefinition AddPartDefinition(string name) {
|
||||
name = GenerateName(name);
|
||||
public IEnumerable<EditPartViewModel> GetParts() {
|
||||
var typeNames = GetTypes().Select(ctd => ctd.Name);
|
||||
// code-defined parts
|
||||
var codeDefinedParts = _contentPartDrivers.SelectMany(d => d.GetPartInfo().Select(cpi => new EditPartViewModel {Name = cpi.PartName}));
|
||||
// user-defined parts
|
||||
var contentParts = _contentDefinitionManager.ListPartDefinitions().Where(cpd => !codeDefinedParts.Any(m => m.Name == cpd.Name)).Select(cpd => new EditPartViewModel(cpd));
|
||||
// all together now, except for those parts with the same name as a type (implicit type's part or a mistake)
|
||||
return contentParts.Where(m => !typeNames.Contains(m.Name)).Union(codeDefinedParts).OrderBy(m => m.Name);
|
||||
}
|
||||
|
||||
public EditPartViewModel GetPart(string name) {
|
||||
var contentPartDefinition = _contentDefinitionManager.GetPartDefinition(name);
|
||||
|
||||
if (contentPartDefinition == null)
|
||||
return null;
|
||||
|
||||
var viewModel = new EditPartViewModel(contentPartDefinition) {
|
||||
Templates = _contentDefinitionEditorEvents.PartEditor(contentPartDefinition)
|
||||
};
|
||||
|
||||
return viewModel;
|
||||
}
|
||||
|
||||
public EditPartViewModel AddPart(CreatePartViewModel partViewModel) {
|
||||
var name = GenerateName(partViewModel.Name);
|
||||
|
||||
while (_contentDefinitionManager.GetPartDefinition(name) != null)
|
||||
name = VersionName(name);
|
||||
@ -82,21 +175,34 @@ namespace Orchard.ContentTypes.Services {
|
||||
var contentPartDefinition = new ContentPartDefinition(name);
|
||||
_contentDefinitionManager.StorePartDefinition(contentPartDefinition);
|
||||
|
||||
return contentPartDefinition;
|
||||
return new EditPartViewModel(contentPartDefinition);
|
||||
}
|
||||
|
||||
public void AlterPartDefinition(ContentPartDefinition contentPartDefinition) {
|
||||
_contentDefinitionManager.StorePartDefinition(contentPartDefinition);
|
||||
public void AlterPart(EditPartViewModel partViewModel, IUpdateModel updateModel) {
|
||||
var updater = new Updater(updateModel);
|
||||
_contentDefinitionManager.AlterPartDefinition(partViewModel.Name, partBuilder => {
|
||||
partViewModel.Templates = _contentDefinitionEditorEvents.PartEditorUpdate(partBuilder, updater);
|
||||
});
|
||||
}
|
||||
|
||||
public void RemovePartDefinition(string name) {
|
||||
public void RemovePart(string name) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
public IEnumerable<ContentFieldInfo> GetFieldDefinitions() {
|
||||
public IEnumerable<ContentFieldInfo> GetFields() {
|
||||
return _contentFieldDrivers.SelectMany(d => d.GetFieldInfo());
|
||||
}
|
||||
|
||||
public void AddFieldToPart(string fieldName, string fieldTypeName, string partName) {
|
||||
_contentDefinitionManager.AlterPartDefinition(partName, partBuilder =>
|
||||
partBuilder.WithField(fieldName, fieldBuilder => fieldBuilder.OfType(fieldTypeName))
|
||||
);
|
||||
}
|
||||
|
||||
public void RemoveFieldFromPart(string fieldName, string partName) {
|
||||
_contentDefinitionManager.AlterPartDefinition(partName, typeBuilder => typeBuilder.RemoveField(fieldName));
|
||||
}
|
||||
|
||||
//gratuitously stolen from the RoutableService
|
||||
private static string GenerateName(string displayName) {
|
||||
if (string.IsNullOrWhiteSpace(displayName))
|
||||
@ -130,5 +236,23 @@ namespace Orchard.ContentTypes.Services {
|
||||
|
||||
return string.Format("{0}-{1}", name, version);
|
||||
}
|
||||
|
||||
class Updater : IUpdateModel {
|
||||
private readonly IUpdateModel _thunk;
|
||||
|
||||
public Updater(IUpdateModel thunk) {
|
||||
_thunk = thunk;
|
||||
}
|
||||
|
||||
public Func<string, string> _prefix = x => x;
|
||||
|
||||
public bool TryUpdateModel<TModel>(TModel model, string prefix, string[] includeProperties, string[] excludeProperties) where TModel : class {
|
||||
return _thunk.TryUpdateModel(model, _prefix(prefix), includeProperties, excludeProperties);
|
||||
}
|
||||
|
||||
public void AddModelError(string key, LocalizedString errorMessage) {
|
||||
_thunk.AddModelError(_prefix(key), errorMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,21 +1,26 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using Orchard.ContentManagement.MetaData.Models;
|
||||
using Orchard.ContentTypes.ViewModels;
|
||||
|
||||
namespace Orchard.ContentTypes.Services {
|
||||
public interface IContentDefinitionService : IDependency {
|
||||
IEnumerable<ContentTypeDefinition> GetTypeDefinitions();
|
||||
ContentTypeDefinition GetTypeDefinition(string name);
|
||||
ContentTypeDefinition AddTypeDefinition(string displayName);
|
||||
void AlterTypeDefinition(ContentTypeDefinition contentTypeDefinition);
|
||||
void RemoveTypeDefinition(string name);
|
||||
IEnumerable<EditTypeViewModel> GetTypes();
|
||||
EditTypeViewModel GetType(string name);
|
||||
EditTypeViewModel AddType(CreateTypeViewModel typeViewModel);
|
||||
void AlterType(EditTypeViewModel typeViewModel, IUpdateModel updater);
|
||||
void RemoveType(string name);
|
||||
void AddPartToType(string partName, string typeName);
|
||||
void RemovePartFromType(string partName, string typeName);
|
||||
|
||||
IEnumerable<ContentPartDefinition> GetPartDefinitions();
|
||||
ContentPartDefinition GetPartDefinition(string name);
|
||||
ContentPartDefinition AddPartDefinition(string name);
|
||||
void AlterPartDefinition(ContentPartDefinition contentPartDefinition);
|
||||
void RemovePartDefinition(string name);
|
||||
IEnumerable<EditPartViewModel> GetParts();
|
||||
EditPartViewModel GetPart(string name);
|
||||
EditPartViewModel AddPart(CreatePartViewModel partViewModel);
|
||||
void AlterPart(EditPartViewModel partViewModel, IUpdateModel updater);
|
||||
void RemovePart(string name);
|
||||
|
||||
IEnumerable<ContentFieldInfo> GetFieldDefinitions();
|
||||
IEnumerable<ContentFieldInfo> GetFields();
|
||||
void AddFieldToPart(string fieldName, string fieldTypeName, string partName);
|
||||
void RemoveFieldFromPart(string fieldName, string partName);
|
||||
}
|
||||
}
|
@ -11,34 +11,36 @@ namespace Orchard.ContentTypes.ViewModels {
|
||||
Fields = new List<EditPartFieldViewModel>();
|
||||
Parts = new List<EditTypePartViewModel>();
|
||||
}
|
||||
|
||||
public EditTypeViewModel(ContentTypeDefinition contentTypeDefinition) {
|
||||
Name = contentTypeDefinition.Name;
|
||||
DisplayName = contentTypeDefinition.DisplayName;
|
||||
Settings = contentTypeDefinition.Settings;
|
||||
Fields = GetTypeFields(contentTypeDefinition).ToList();
|
||||
Parts = GetTypeParts(contentTypeDefinition).ToList();
|
||||
Definition = contentTypeDefinition;
|
||||
_Definition = contentTypeDefinition;
|
||||
}
|
||||
|
||||
public string Name { get; set; }
|
||||
public string DisplayName { get; set; }
|
||||
public ContentTypeDefinition Definition { get; private set; }
|
||||
public IEnumerable<TemplateViewModel> Templates { get; set; }
|
||||
|
||||
public SettingsDictionary Settings { get; set; }
|
||||
public IEnumerable<EditPartFieldViewModel> Fields { get; set; }
|
||||
public IEnumerable<EditTypePartViewModel> Parts { get; set; }
|
||||
public IEnumerable<TemplateViewModel> Templates { get; set; }
|
||||
public ContentTypeDefinition _Definition { get; private set; }
|
||||
|
||||
private IEnumerable<EditPartFieldViewModel> GetTypeFields(ContentTypeDefinition contentTypeDefinition) {
|
||||
var implicitTypePart = contentTypeDefinition.Parts.SingleOrDefault(p => p.PartDefinition.Name == Name);
|
||||
|
||||
return implicitTypePart == null
|
||||
? Enumerable.Empty<EditPartFieldViewModel>()
|
||||
: implicitTypePart.PartDefinition.Fields.Select(f => new EditPartFieldViewModel(f) { Part = new EditPartViewModel(implicitTypePart.PartDefinition) });
|
||||
: implicitTypePart.PartDefinition.Fields.Select((f, i) => new EditPartFieldViewModel(i, f) { Part = new EditPartViewModel(implicitTypePart.PartDefinition) });
|
||||
}
|
||||
|
||||
private IEnumerable<EditTypePartViewModel> GetTypeParts(ContentTypeDefinition contentTypeDefinition) {
|
||||
return contentTypeDefinition.Parts.Where(p => p.PartDefinition.Name != Name).Select(p => new EditTypePartViewModel(p) { Type = this });
|
||||
return contentTypeDefinition.Parts
|
||||
.Where(p => p.PartDefinition.Name != Name)
|
||||
.Select((p, i) => new EditTypePartViewModel(i, p) { Type = this });
|
||||
}
|
||||
}
|
||||
|
||||
@ -46,15 +48,21 @@ namespace Orchard.ContentTypes.ViewModels {
|
||||
public EditTypePartViewModel() {
|
||||
Settings = new SettingsDictionary();
|
||||
}
|
||||
public EditTypePartViewModel(ContentTypeDefinition.Part part) {
|
||||
|
||||
public EditTypePartViewModel(int index, ContentTypeDefinition.Part part) {
|
||||
Index = index;
|
||||
PartDefinition = new EditPartViewModel(part.PartDefinition);
|
||||
Settings = part.Settings;
|
||||
_Definition = part;
|
||||
}
|
||||
|
||||
public EditTypeViewModel Type { get; set; }
|
||||
public int Index { get; set; }
|
||||
public string Prefix { get { return "Parts[" + Index + "]"; } }
|
||||
public EditPartViewModel PartDefinition { get; set; }
|
||||
public SettingsDictionary Settings { get; set; }
|
||||
public EditTypeViewModel Type { get; set; }
|
||||
public IEnumerable<TemplateViewModel> Templates { get; set; }
|
||||
public ContentTypeDefinition.Part _Definition { get; private set; }
|
||||
}
|
||||
|
||||
public class EditPartViewModel : BaseViewModel {
|
||||
@ -62,45 +70,56 @@ namespace Orchard.ContentTypes.ViewModels {
|
||||
Fields = new List<EditPartFieldViewModel>();
|
||||
Settings = new SettingsDictionary();
|
||||
}
|
||||
|
||||
public EditPartViewModel(ContentPartDefinition contentPartDefinition) {
|
||||
Name = contentPartDefinition.Name;
|
||||
Fields = contentPartDefinition.Fields.Select(f => new EditPartFieldViewModel(f) { Part = this }).ToList();
|
||||
Fields = contentPartDefinition.Fields.Select((f, i) => new EditPartFieldViewModel(i, f) { Part = this }).ToList();
|
||||
Settings = contentPartDefinition.Settings;
|
||||
Definition = contentPartDefinition;
|
||||
_Definition = contentPartDefinition;
|
||||
}
|
||||
|
||||
public string Prefix { get { return "PartDefinition"; } }
|
||||
public string Name { get; set; }
|
||||
public IEnumerable<TemplateViewModel> Templates { get; set; }
|
||||
public IEnumerable<EditPartFieldViewModel> Fields { get; set; }
|
||||
public ContentPartDefinition Definition { get; private set; }
|
||||
public SettingsDictionary Settings { get; set; }
|
||||
public ContentPartDefinition _Definition { get; private set; }
|
||||
}
|
||||
|
||||
public class EditPartFieldViewModel {
|
||||
|
||||
public EditPartFieldViewModel() {
|
||||
Settings = new SettingsDictionary();
|
||||
}
|
||||
public EditPartFieldViewModel(ContentPartDefinition.Field field) {
|
||||
|
||||
public EditPartFieldViewModel(int index, ContentPartDefinition.Field field) {
|
||||
Index = index;
|
||||
Name = field.Name;
|
||||
FieldDefinition = new EditFieldViewModel(field.FieldDefinition);
|
||||
Settings = field.Settings;
|
||||
_Definition = field;
|
||||
}
|
||||
|
||||
public int Index { get; set; }
|
||||
public string Prefix { get { return "Fields[" + Index + "]"; } }
|
||||
public EditPartViewModel Part { get; set; }
|
||||
|
||||
public string Name { get; set; }
|
||||
public IEnumerable<TemplateViewModel> Templates { get; set; }
|
||||
public EditFieldViewModel FieldDefinition { get; set; }
|
||||
public SettingsDictionary Settings { get; set; }
|
||||
public ContentPartDefinition.Field _Definition { get; private set; }
|
||||
}
|
||||
|
||||
public class EditFieldViewModel {
|
||||
public EditFieldViewModel() { }
|
||||
|
||||
public EditFieldViewModel(ContentFieldDefinition contentFieldDefinition) {
|
||||
Name = contentFieldDefinition.Name;
|
||||
Definition = contentFieldDefinition;
|
||||
_Definition = contentFieldDefinition;
|
||||
}
|
||||
|
||||
public string Name { get; set; }
|
||||
public ContentFieldDefinition Definition { get; private set; }
|
||||
public ContentFieldDefinition _Definition { get; private set; }
|
||||
}
|
||||
}
|
||||
|
@ -1,9 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.ContentManagement.MetaData.Models;
|
||||
using Orchard.Mvc.ViewModels;
|
||||
|
||||
namespace Orchard.ContentTypes.ViewModels {
|
||||
public class ListContentPartsViewModel : BaseViewModel {
|
||||
public IEnumerable<ContentPartDefinition> Parts { get; set; }
|
||||
public IEnumerable<EditPartViewModel> Parts { get; set; }
|
||||
}
|
||||
}
|
@ -1,9 +1,8 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.ContentManagement.MetaData.Models;
|
||||
using Orchard.Mvc.ViewModels;
|
||||
|
||||
namespace Orchard.ContentTypes.ViewModels {
|
||||
public class ListContentTypesViewModel : BaseViewModel {
|
||||
public IEnumerable<ContentTypeDefinition> Types { get; set; }
|
||||
public IEnumerable<EditTypeViewModel> Types { get; set; }
|
||||
}
|
||||
}
|
@ -13,7 +13,7 @@ using (Html.BeginFormAntiForgeryPost()) { %>
|
||||
string.Format(
|
||||
"{0} <label for=\"{1}\" class=\"forcheckbox\">{2}</label>{3}",
|
||||
Html.CheckBox(fieldNameStart + "IsSelected"),
|
||||
fieldNameStart + "IsSelected",
|
||||
ViewData.TemplateInfo.GetFullHtmlFieldId(fieldNameStart + "IsSelected"),
|
||||
partSelection.PartName,
|
||||
Html.Hidden(fieldNameStart + "PartName", partSelection.PartName)));
|
||||
},
|
||||
|
@ -17,12 +17,12 @@ using (Html.BeginFormAntiForgeryPost()) { %>
|
||||
<%:Html.HiddenFor(m => m.Name) %>
|
||||
</fieldset><%
|
||||
Html.RenderTemplates(Model.Templates); %>
|
||||
<h2><%:T("Parts") %></h2>
|
||||
<div class="manage add-to-type"><%: Html.ActionLink(T("Add").Text, "AddPartsTo", new { area = "Orchard.ContentTypes", id = Model.Name }, new { @class = "button" })%></div><%:
|
||||
Html.EditorFor(m => m.Parts, "TypeParts", "") %>
|
||||
<h2><%:T("Fields") %></h2>
|
||||
<div class="manage add-to-type"><%: Html.ActionLink(T("Add").Text, "AddFieldTo", new { area = "Orchard.ContentTypes", id = Model.Name }, new { @class = "button" }) %></div><%:
|
||||
Html.EditorFor(m => m.Fields, "Fields", "") %>
|
||||
<h2><%:T("Parts") %></h2>
|
||||
<div class="manage add-to-type"><%: Html.ActionLink(T("Add").Text, "AddPartsTo", new { area = "Orchard.ContentTypes", id = Model.Name }, new { @class = "button" })%></div><%:
|
||||
Html.EditorFor(m => m.Parts, "TypeParts", "") %>
|
||||
<fieldset class="action">
|
||||
<button class="primaryAction" type="submit"><%:T("Save") %></button>
|
||||
</fieldset>
|
||||
|
@ -1,4 +1,4 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.ContentManagement.MetaData.Models.ContentPartDefinition>" %>
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.ContentTypes.ViewModels.EditPartViewModel>" %>
|
||||
<div class="summary">
|
||||
<div class="properties">
|
||||
<h3><%:Model.Name%></h3>
|
@ -1,4 +1,4 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.ContentManagement.MetaData.Models.ContentTypeDefinition>" %>
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<Orchard.ContentTypes.ViewModels.EditTypeViewModel>" %>
|
||||
<div class="summary">
|
||||
<div class="properties">
|
||||
<h3><%:Model.DisplayName%></h3>
|
@ -4,6 +4,8 @@
|
||||
<div class="manage">
|
||||
<%:Html.ActionLink(T("Remove").Text, "RemoveFieldFrom", new { area = "Orchard.ContentTypes", id = Model.Part.Name, Model.Name }, new { itemprop = "RemoveUrl UnsafeUrl" })%><%--// <- some experimentation--%>
|
||||
</div><%
|
||||
Html.RenderTemplates(Model.Templates); %>
|
||||
<%:Html.HiddenFor(m => m.Name) %><%:Html.HiddenFor(m => m.FieldDefinition.Name) %>
|
||||
Html.RenderTemplates(Model.Templates);
|
||||
%><%:Html.HiddenFor(m => m.Name)
|
||||
%><%:Html.HiddenFor(m => m.FieldDefinition.Name)
|
||||
%><%:Html.HiddenFor(m => m.Index) %>
|
||||
</fieldset>
|
@ -2,11 +2,9 @@
|
||||
<%
|
||||
if (Model.Any()) { %>
|
||||
<fieldset><%
|
||||
var fi = 0;
|
||||
foreach (var field in Model) {
|
||||
var f = field;
|
||||
var htmlFieldName = string.Format("Fields[{0}]", fi++); %>
|
||||
<%:Html.EditorFor(m => f, "Field", htmlFieldName) %><%
|
||||
var f = field; %>
|
||||
<%:Html.EditorFor(m => f, "Field", field.Prefix) %><%
|
||||
} %>
|
||||
</fieldset><%
|
||||
} %>
|
@ -12,5 +12,6 @@
|
||||
<div class="manage minor"><%:Html.ActionLink(T("Edit global part config").Text, "EditPart", new { area = "Orchard.ContentTypes", id = Model.PartDefinition.Name })%></div>
|
||||
<%:Html.DisplayFor(m => m.PartDefinition.Settings, "Settings", "PartDefinition")
|
||||
%><%:Html.EditorFor(m => m.PartDefinition.Fields, "TypePartFields", "PartDefinition")
|
||||
%><%:Html.Hidden("PartDefinition.Name", Model.PartDefinition.Name) %>
|
||||
%><%:Html.HiddenFor(m => m.PartDefinition.Name)
|
||||
%><%:Html.HiddenFor(m => m.Index) %>
|
||||
</fieldset>
|
@ -6,5 +6,7 @@
|
||||
Html.RenderTemplates(Model.Templates); %>
|
||||
</div><%
|
||||
} %>
|
||||
<%:Html.HiddenFor(m => m.Name) %><%:Html.HiddenFor(m => m.FieldDefinition.Name) %>
|
||||
<%:Html.HiddenFor(m => m.Name)
|
||||
%><%:Html.HiddenFor(m => m.FieldDefinition.Name)
|
||||
%><%:Html.HiddenFor(m => m.Index) %>
|
||||
</fieldset>
|
@ -1,10 +1,8 @@
|
||||
<%@ Control Language="C#" Inherits="Orchard.Mvc.ViewUserControl<IEnumerable<Orchard.ContentTypes.ViewModels.EditPartFieldViewModel>>" %>
|
||||
<%
|
||||
if (Model.Any()) {
|
||||
var fi = 0;
|
||||
foreach (var field in Model) {
|
||||
var f = field;
|
||||
var htmlFieldName = string.Format("Fields[{0}]", fi++); %>
|
||||
<%:Html.EditorFor(m => f, "TypePartField", htmlFieldName) %><%
|
||||
var f = field; %>
|
||||
<%:Html.EditorFor(m => f, "TypePartField", f.Prefix) %><%
|
||||
}
|
||||
} %>
|
@ -2,11 +2,9 @@
|
||||
<%
|
||||
if (Model.Any()) { %>
|
||||
<fieldset><%
|
||||
var pi = 0;
|
||||
foreach (var part in Model) {
|
||||
var p = part;
|
||||
var htmlFieldName = string.Format("Parts[{0}]", pi++); %>
|
||||
<%:Html.EditorFor(m => p, "TypePart", htmlFieldName) %><%
|
||||
var p = part; %>
|
||||
<%:Html.EditorFor(m => p, "TypePart", p.Prefix) %><%
|
||||
} %>
|
||||
</fieldset><%
|
||||
} %>
|
@ -83,8 +83,8 @@ namespace Orchard.Indexing.Commands {
|
||||
Context.Output.WriteLine("│ {0} │ {1,6} │", "Title" + new string(' ', 60 - "Title".Length), "Score");
|
||||
Context.Output.WriteLine("├──────────────────────────────────────────────────────────────┼────────┤");
|
||||
foreach ( var searchHit in results ) {
|
||||
var title = searchHit.GetString("title");
|
||||
title = title.Substring(0, Math.Min(60, title.Length)) ?? "- no title -";
|
||||
var title = searchHit.GetString("title") ?? "- no title -";
|
||||
title = title.Substring(0, Math.Min(60, title.Length));
|
||||
var score = searchHit.Score;
|
||||
Context.Output.WriteLine("│ {0} │ {1,6} │", title + new string(' ', 60 - title.Length), score);
|
||||
}
|
||||
|
@ -56,6 +56,12 @@
|
||||
.features.summary-view .disabled.feature {
|
||||
border-color:#CCC;
|
||||
}
|
||||
.features .update.feature {
|
||||
background:#ECC;
|
||||
}
|
||||
.features.summary-view .update.feature {
|
||||
border-color:#E77;
|
||||
}
|
||||
.features.detail-view .feature {
|
||||
border-bottom:1px solid #CCC;
|
||||
}
|
||||
@ -109,26 +115,7 @@
|
||||
right:.4em;
|
||||
top:.4em;
|
||||
}
|
||||
|
||||
a.update {
|
||||
.features .feature .actions form.inline.link,
|
||||
.features .feature .actions a {
|
||||
margin-left:.5em;
|
||||
}
|
||||
.features .update.feature {
|
||||
background:#ecc;
|
||||
}
|
||||
.features.summary-view .update.feature {
|
||||
border-color:#e77;
|
||||
}
|
||||
|
||||
.cathedral {
|
||||
bottom:0;
|
||||
font-size:.8em;
|
||||
position:absolute;
|
||||
right:3px;
|
||||
}
|
||||
.cathedral a,
|
||||
.cathedral a:link,
|
||||
.cathedral a:visited,
|
||||
.cathedral form.inline.link button {
|
||||
color:#aeaeae;
|
||||
}
|
||||
}
|
@ -160,7 +160,7 @@ namespace Orchard.Setup.Services {
|
||||
// add default culture
|
||||
var cultureManager = environment.Resolve<ICultureManager>();
|
||||
cultureManager.AddCulture("en-US");
|
||||
cultureManager.AddCulture("fr-FR");
|
||||
cultureManager.AddCulture("fr");
|
||||
|
||||
var contentManager = environment.Resolve<IContentManager>();
|
||||
|
||||
|
@ -11,7 +11,7 @@ namespace Orchard.ContentManagement.MetaData.Builders {
|
||||
private readonly SettingsDictionary _settings;
|
||||
|
||||
public ContentTypeDefinitionBuilder()
|
||||
: this(new ContentTypeDefinition(null)) {
|
||||
: this(new ContentTypeDefinition(null, null)) {
|
||||
}
|
||||
|
||||
public ContentTypeDefinitionBuilder(ContentTypeDefinition existing) {
|
||||
|
@ -18,7 +18,7 @@ namespace Orchard.ContentManagement.MetaData {
|
||||
|
||||
public static class ContentDefinitionManagerExtensions{
|
||||
public static void AlterTypeDefinition(this IContentDefinitionManager manager, string name, Action<ContentTypeDefinitionBuilder> alteration) {
|
||||
var typeDefinition = manager.GetTypeDefinition(name) ?? new ContentTypeDefinition(name);
|
||||
var typeDefinition = manager.GetTypeDefinition(name) ?? new ContentTypeDefinition(name, name);
|
||||
var builder = new ContentTypeDefinitionBuilder(typeDefinition);
|
||||
alteration(builder);
|
||||
manager.StoreTypeDefinition(builder.Build());
|
||||
|
@ -11,8 +11,9 @@ namespace Orchard.ContentManagement.MetaData.Models {
|
||||
Settings = settings;
|
||||
}
|
||||
|
||||
public ContentTypeDefinition(string name) {
|
||||
public ContentTypeDefinition(string name, string displayName) {
|
||||
Name = name;
|
||||
DisplayName = displayName;
|
||||
Parts = Enumerable.Empty<Part>();
|
||||
Settings = new SettingsDictionary();
|
||||
}
|
||||
@ -20,7 +21,7 @@ namespace Orchard.ContentManagement.MetaData.Models {
|
||||
[StringLength(128)]
|
||||
public string Name { get; private set; }
|
||||
[Required, StringLength(1024)]
|
||||
public string DisplayName { get; set; }
|
||||
public string DisplayName { get; private set; }
|
||||
public IEnumerable<Part> Parts { get; private set; }
|
||||
public SettingsDictionary Settings { get; private set; }
|
||||
|
||||
|
49
src/Orchard/Localization/Commands/CultureCommands.cs
Normal file
49
src/Orchard/Localization/Commands/CultureCommands.cs
Normal file
@ -0,0 +1,49 @@
|
||||
using System.Linq;
|
||||
using JetBrains.Annotations;
|
||||
using Orchard.Commands;
|
||||
using Orchard.Localization.Services;
|
||||
using Orchard.Settings;
|
||||
|
||||
namespace Orchard.Localization.Commands {
|
||||
public class CultureCommands : DefaultOrchardCommandHandler {
|
||||
private readonly ICultureManager _cultureManager;
|
||||
|
||||
protected virtual ISite CurrentSite { get; [UsedImplicitly] private set; }
|
||||
|
||||
public CultureCommands(ICultureManager cultureManager) {
|
||||
_cultureManager = cultureManager;
|
||||
}
|
||||
|
||||
[CommandHelp("cultures list \r\n\t" + "List site cultures")]
|
||||
[CommandName("cultures list")]
|
||||
public void ListCultures() {
|
||||
Context.Output.WriteLine(T("Listing Cultures:"));
|
||||
|
||||
string cultures = _cultureManager.ListCultures().Aggregate<string, string>(null, (current, culture) => current + culture + " ");
|
||||
|
||||
Context.Output.WriteLine(cultures);
|
||||
}
|
||||
|
||||
|
||||
[CommandHelp("cultures get site culture \r\n\t" + "Get culture for the site")]
|
||||
[CommandName("cultures get site culture")]
|
||||
public void GetSiteCulture() {
|
||||
Context.Output.WriteLine(T("Site Culture is {0}", CurrentSite.SiteCulture));
|
||||
}
|
||||
|
||||
[CommandHelp("cultures set site culture <culture-name> \r\n\t" + "Set culture for the site")]
|
||||
[CommandName("cultures set site culture")]
|
||||
public void SetSiteCulture(string cultureName) {
|
||||
Context.Output.WriteLine(T("Setting site culture to {0}", cultureName));
|
||||
|
||||
if (!_cultureManager.IsValidCulture(cultureName)) {
|
||||
Context.Output.WriteLine(T("Supplied culture name {0} is not valid.", cultureName));
|
||||
return;
|
||||
}
|
||||
CurrentSite.SiteCulture = cultureName;
|
||||
|
||||
Context.Output.WriteLine(T("Site culture set to {0} successfully", cultureName));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,7 @@ using System.Linq;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Web;
|
||||
using JetBrains.Annotations;
|
||||
using Orchard.Caching;
|
||||
using Orchard.Data;
|
||||
using Orchard.Localization.Records;
|
||||
using Orchard.Settings;
|
||||
@ -12,10 +13,12 @@ namespace Orchard.Localization.Services {
|
||||
public class DefaultCultureManager : ICultureManager {
|
||||
private readonly IRepository<CultureRecord> _cultureRepository;
|
||||
private readonly IEnumerable<ICultureSelector> _cultureSelectors;
|
||||
private readonly ISignals _signals;
|
||||
|
||||
public DefaultCultureManager(IRepository<CultureRecord> cultureRepository, IEnumerable<ICultureSelector> cultureSelectors) {
|
||||
public DefaultCultureManager(IRepository<CultureRecord> cultureRepository, IEnumerable<ICultureSelector> cultureSelectors, ISignals signals) {
|
||||
_cultureRepository = cultureRepository;
|
||||
_cultureSelectors = cultureSelectors;
|
||||
_signals = signals;
|
||||
}
|
||||
|
||||
protected virtual ISite CurrentSite { get; [UsedImplicitly] private set; }
|
||||
@ -30,6 +33,7 @@ namespace Orchard.Localization.Services {
|
||||
throw new ArgumentException("cultureName");
|
||||
}
|
||||
_cultureRepository.Create(new CultureRecord { Culture = cultureName });
|
||||
_signals.Trigger("culturesChanged");
|
||||
}
|
||||
|
||||
public void DeleteCulture(string cultureName) {
|
||||
@ -38,8 +42,10 @@ namespace Orchard.Localization.Services {
|
||||
}
|
||||
|
||||
var culture = _cultureRepository.Get(cr => cr.Culture == cultureName);
|
||||
if (culture != null)
|
||||
if (culture != null) {
|
||||
_cultureRepository.Delete(culture);
|
||||
_signals.Trigger("culturesChanged");
|
||||
}
|
||||
}
|
||||
|
||||
public string GetCurrentCulture(HttpContext requestContext) {
|
||||
@ -71,7 +77,7 @@ namespace Orchard.Localization.Services {
|
||||
// "<languagecode2>" or
|
||||
// "<languagecode2>-<country/regioncode2>" or
|
||||
// "<languagecode2>-<scripttag>-<country/regioncode2>"
|
||||
private static bool IsValidCulture(string cultureName) {
|
||||
public bool IsValidCulture(string cultureName) {
|
||||
Regex cultureRegex = new Regex(@"\w{2}(-\w{2,})*");
|
||||
if (cultureRegex.IsMatch(cultureName)) {
|
||||
return true;
|
||||
|
@ -14,6 +14,7 @@ namespace Orchard.Localization.Services {
|
||||
private readonly IExtensionManager _extensionManager;
|
||||
private readonly ICacheManager _cacheManager;
|
||||
private readonly ShellSettings _shellSettings;
|
||||
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 RootLocalizationFilePathFormat = "/App_Data/Localization/{0}/orchard.root.po";
|
||||
@ -24,12 +25,14 @@ namespace Orchard.Localization.Services {
|
||||
IWebSiteFolder webSiteFolder,
|
||||
IExtensionManager extensionManager,
|
||||
ICacheManager cacheManager,
|
||||
ShellSettings shellSettings) {
|
||||
ShellSettings shellSettings,
|
||||
ISignals signals) {
|
||||
_cultureManager = cultureManager;
|
||||
_webSiteFolder = webSiteFolder;
|
||||
_extensionManager = extensionManager;
|
||||
_cacheManager = cacheManager;
|
||||
_shellSettings = shellSettings;
|
||||
_signals = signals;
|
||||
}
|
||||
|
||||
// This will translate a string into a string in the target cultureName.
|
||||
@ -96,6 +99,7 @@ namespace Orchard.Localization.Services {
|
||||
Translations = LoadTranslationsForCulture(culture, ctx)
|
||||
});
|
||||
}
|
||||
ctx.Monitor(_signals.When("culturesChanged"));
|
||||
return cultures;
|
||||
});
|
||||
|
||||
|
@ -10,5 +10,6 @@ namespace Orchard.Localization.Services {
|
||||
string GetCurrentCulture(HttpContext requestContext);
|
||||
CultureRecord GetCultureById(int id);
|
||||
string GetSiteCulture();
|
||||
bool IsValidCulture(string cultureName);
|
||||
}
|
||||
}
|
||||
|
@ -406,6 +406,7 @@
|
||||
<Compile Include="Environment\Extensions\Compilers\CSharpExtensionBuildProviderShim.cs" />
|
||||
<Compile Include="Environment\Extensions\Compilers\ProjectFileDescriptor.cs" />
|
||||
<Compile Include="Environment\Extensions\Compilers\IProjectFileParser.cs" />
|
||||
<Compile Include="Localization\Commands\CultureCommands.cs" />
|
||||
<Compile Include="Utility\DependencyOrderingUtility.cs" />
|
||||
<Compile Include="Environment\IOrchardHostContainer.cs" />
|
||||
<Compile Include="Environment\IShim.cs" />
|
||||
|
Loading…
Reference in New Issue
Block a user