mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Compare commits
99 Commits
blogpermis
...
1.10.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
cd9bccef96 | ||
|
|
358c57464e | ||
|
|
5d892feceb | ||
|
|
a200e35923 | ||
|
|
d384110253 | ||
|
|
d17930395c | ||
|
|
5eef9c654c | ||
|
|
54575ab513 | ||
|
|
55c43ad236 | ||
|
|
1870e3eb04 | ||
|
|
d8079dec26 | ||
|
|
ac4f7c05c9 | ||
|
|
98e0b43c26 | ||
|
|
17c7c77e3c | ||
|
|
185ad6b1eb | ||
|
|
dbb5668d49 | ||
|
|
d686d688a4 | ||
|
|
5361b29a9c | ||
|
|
86ec07007f | ||
|
|
2eeef52077 | ||
|
|
c228421051 | ||
|
|
a23e9ea764 | ||
|
|
e41e9079d3 | ||
|
|
d85954fa6d | ||
|
|
a709e37ddc | ||
|
|
87bdf9c413 | ||
|
|
d2889e46e3 | ||
|
|
134bac44c3 | ||
|
|
9ec312a1c3 | ||
|
|
097119466a | ||
|
|
9f98d3151b | ||
|
|
234d5214dd | ||
|
|
33bdfd0551 | ||
|
|
ac978b665b | ||
|
|
8dde994bde | ||
|
|
f28da9894a | ||
|
|
8c1ffe2564 | ||
|
|
5a0fe4e105 | ||
|
|
2c26c65f63 | ||
|
|
654a9e1884 | ||
|
|
149346ce68 | ||
|
|
9b6c2315de | ||
|
|
68c10bce60 | ||
|
|
8615422e27 | ||
|
|
06a2e0d6b1 | ||
|
|
6e476243c6 | ||
|
|
eff27ec05e | ||
|
|
0869f957bd | ||
|
|
c795cdb871 | ||
|
|
8bd74c947e | ||
|
|
b7dd2f6055 | ||
|
|
3b7ec4cb89 | ||
|
|
acb93df3ec | ||
|
|
3ac09df891 | ||
|
|
863d2e4e6b | ||
|
|
ddfcfd7379 | ||
|
|
8456716d8b | ||
|
|
fe4a116cb4 | ||
|
|
4f57ecb487 | ||
|
|
7a9f86dac6 | ||
|
|
6df57dd098 | ||
|
|
cccb358ce1 | ||
|
|
db7832db37 | ||
|
|
48e2a6a1b4 | ||
|
|
8425fb4829 | ||
|
|
923646c27f | ||
|
|
27a9bae394 | ||
|
|
3bda4acee1 | ||
|
|
bc66cdb36c | ||
|
|
9f60edc7f5 | ||
|
|
e35b71e1dc | ||
|
|
6ab9ffc7da | ||
|
|
5c6dd3e34f | ||
|
|
d0b65cb60b | ||
|
|
6f3193e52b | ||
|
|
a7f51c13d4 | ||
|
|
4b2e1ca19d | ||
|
|
8a328902fd | ||
|
|
83f47ac148 | ||
|
|
750824b197 | ||
|
|
7045c40406 | ||
|
|
eed3ee6871 | ||
|
|
e6d4d0c9d4 | ||
|
|
0ea47a5554 | ||
|
|
d8f423888a | ||
|
|
4299239482 | ||
|
|
7e859f2ccf | ||
|
|
4584da9214 | ||
|
|
f697fbb06a | ||
|
|
1254a11b8d | ||
|
|
203fd95079 | ||
|
|
fab73d7157 | ||
|
|
c48635540b | ||
|
|
8f2411dbf9 | ||
|
|
68acf2694d | ||
|
|
b160dc731d | ||
|
|
d59f5b511b | ||
|
|
85326ead8c | ||
|
|
d91aa41be3 |
@@ -1,22 +1,18 @@
|
||||
for /f "usebackq tokens=*" %%i in (`lib\vswhere\vswhere -latest -version "[15.0,16.0)" -requires Microsoft.Component.MSBuild -property installationPath`) do (
|
||||
set InstallDir=%%i
|
||||
)
|
||||
|
||||
|
||||
FOR %%b in (
|
||||
"%VS140COMNTOOLS%..\..\VC\vcvarsall.bat"
|
||||
"%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
|
||||
"%ProgramFiles%\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
|
||||
|
||||
"%VS120COMNTOOLS%..\..\VC\vcvarsall.bat"
|
||||
"%ProgramFiles(x86)%\Microsoft Visual Studio 12.0\VC\vcvarsall.bat"
|
||||
"%ProgramFiles%\Microsoft Visual Studio 12.0\VC\vcvarsall.bat"
|
||||
|
||||
"%VS110COMNTOOLS%..\..\VC\vcvarsall.bat"
|
||||
"%ProgramFiles(x86)%\Microsoft Visual Studio 11.0\VC\vcvarsall.bat"
|
||||
"%ProgramFiles%\Microsoft Visual Studio 11.0\VC\vcvarsall.bat"
|
||||
"%InstallDir%\Common7\Tools\VsMSBuildCmd.bat"
|
||||
"%VS140COMNTOOLS%\Common7\Tools\vsvars32.bat"
|
||||
) do (
|
||||
if exist %%b (
|
||||
call %%b x86
|
||||
call %%b
|
||||
goto build
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
echo "Unable to detect suitable environment. Build may not succeed."
|
||||
|
||||
:build
|
||||
|
||||
@@ -167,11 +167,12 @@
|
||||
</Target>
|
||||
|
||||
<Target Name="Spec" DependsOnTargets="Package-Stage">
|
||||
|
||||
<CreateItem Include="$(CompileFolder)\*.Specs.dll">
|
||||
<!-- Running SpecFlow tests -->
|
||||
<CreateItem Include="$(CompileFolder)\*.Specs.*dll">
|
||||
<Output TaskParameter="Include" ItemName="SpecAssemblies" />
|
||||
</CreateItem>
|
||||
<NUnit Assemblies="@(SpecAssemblies)" ToolPath="$(NUnitPackageToolsFolder)" />
|
||||
|
||||
<NUnit Assemblies="@(SpecAssemblies)" ToolPath="@(NUnitPackageToolsFolder)" WorkingDirectory="$(CompileFolder)" OutputXmlFile="$(BuildFolder)\Orchard.Specs.xml" />
|
||||
</Target>
|
||||
|
||||
<!-- Packaging (Stage) -->
|
||||
|
||||
@@ -22,7 +22,7 @@ Our mission is to empower our users and foster a dedicated and diverse community
|
||||
|
||||
## Project Status
|
||||
|
||||
Orchard is currently in version **[1.10.1](https://github.com/OrchardCMS/Orchard/releases/tag/1.10.1)**: It contains bugfixes and the more impactful changes and new features added in the latest major version (*1.10*).
|
||||
Orchard is currently in version **[1.10.2](https://github.com/OrchardCMS/Orchard/releases/tag/1.10.2)**: It contains bugfixes and the more impactful changes and new features added in the latest major version (*1.10*).
|
||||
|
||||
We invite participation by the developer community in shaping the project’s direction, so that we can publicly validate our designs and development approach.
|
||||
All our releases are available on our [Releases](https://github.com/OrchardCMS/Orchard/releases) page, and it's easy to [Install Orchard using the Web Platform Installer](http://docs.orchardproject.net/Documentation/Installing-Orchard) as well. We encourage interested developers to check out the source code on the Orchard GitHub site and get involved with the project.
|
||||
|
||||
BIN
lib/vswhere/vswhere.exe
Normal file
BIN
lib/vswhere/vswhere.exe
Normal file
Binary file not shown.
@@ -42,6 +42,7 @@
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<LangVersion>5</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@@ -51,6 +52,7 @@
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<LangVersion>5</LangVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.WindowsAzure.ServiceRuntime, Version=1.8.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<LangVersion>5</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@@ -47,6 +48,7 @@
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<LangVersion>5</LangVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Autofac, Version=3.5.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
<CodeAnalysisRuleSet>..\OrchardBasicCorrectness.ruleset</CodeAnalysisRuleSet>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<LangVersion>5</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@@ -55,6 +56,7 @@
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<LangVersion>5</LangVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Autofac, Version=3.5.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
|
||||
@@ -30,5 +30,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly: AssemblyVersion("1.10.1")]
|
||||
[assembly: AssemblyFileVersion("1.10.1")]
|
||||
[assembly: AssemblyVersion("1.10.2")]
|
||||
[assembly: AssemblyFileVersion("1.10.2")]
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<CodeAnalysisRuleSet>..\OrchardBasicCorrectness.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<LangVersion>5</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@@ -54,6 +55,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<LangVersion>5</LangVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="nunit.framework, Version=2.5.10.11092, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
|
||||
|
||||
@@ -30,5 +30,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly: AssemblyVersion("1.10.1")]
|
||||
[assembly: AssemblyFileVersion("1.10.1")]
|
||||
[assembly: AssemblyVersion("1.10.2")]
|
||||
[assembly: AssemblyFileVersion("1.10.2")]
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
<CodeAnalysisRuleSet>..\OrchardBasicCorrectness.ruleset</CodeAnalysisRuleSet>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<LangVersion>5</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@@ -55,6 +56,7 @@
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<LangVersion>5</LangVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Autofac, Version=3.5.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
|
||||
@@ -30,5 +30,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly: AssemblyVersion("1.10.1")]
|
||||
[assembly: AssemblyFileVersion("1.10.1")]
|
||||
[assembly: AssemblyVersion("1.10.2")]
|
||||
[assembly: AssemblyFileVersion("1.10.2")]
|
||||
|
||||
@@ -14,7 +14,6 @@ using Orchard.ContentManagement.MetaData.Builders;
|
||||
using Orchard.ContentManagement.Records;
|
||||
using Orchard.Core.Common.Handlers;
|
||||
using Orchard.Core.Common.Models;
|
||||
using Orchard.Data;
|
||||
using Orchard.Environment;
|
||||
using Orchard.Environment.Configuration;
|
||||
using Orchard.Environment.Extensions;
|
||||
@@ -69,6 +68,7 @@ namespace Orchard.Tests.Modules.Indexing {
|
||||
builder.RegisterType<IndexingTaskManager>().As<IIndexingTaskManager>();
|
||||
builder.RegisterType<DefaultContentManager>().As<IContentManager>();
|
||||
builder.RegisterType<StubCacheManager>().As<ICacheManager>();
|
||||
builder.RegisterType<StubWorkContextAccessor>().As<IWorkContextAccessor>();
|
||||
builder.RegisterType<Signals>().As<ISignals>();
|
||||
builder.RegisterType<DefaultContentManagerSession>().As<IContentManagerSession>();
|
||||
builder.RegisterInstance(_contentDefinitionManager.Object);
|
||||
|
||||
@@ -9,6 +9,7 @@ using Orchard.Environment.Configuration;
|
||||
using Orchard.FileSystems.AppData;
|
||||
using Orchard.Indexing;
|
||||
using Orchard.Tests.FileSystems.AppData;
|
||||
using Orchard.Tests.Stubs;
|
||||
|
||||
namespace Orchard.Tests.Modules.Indexing {
|
||||
public class LuceneIndexProviderTests {
|
||||
@@ -35,6 +36,7 @@ namespace Orchard.Tests.Modules.Indexing {
|
||||
_appDataFolder = AppDataFolderTests.CreateAppDataFolder(_basePath);
|
||||
|
||||
var builder = new ContainerBuilder();
|
||||
builder.RegisterType<StubWorkContextAccessor>().As<IWorkContextAccessor>();
|
||||
builder.RegisterType<DefaultLuceneAnalyzerProvider>().As<ILuceneAnalyzerProvider>();
|
||||
builder.RegisterType<DefaultLuceneAnalyzerSelector>().As<ILuceneAnalyzerSelector>();
|
||||
builder.RegisterType<LuceneIndexProvider>().As<IIndexProvider>();
|
||||
|
||||
@@ -8,6 +8,7 @@ using Orchard.Environment.Configuration;
|
||||
using Orchard.FileSystems.AppData;
|
||||
using Orchard.Indexing;
|
||||
using Orchard.Tests.FileSystems.AppData;
|
||||
using Orchard.Tests.Stubs;
|
||||
|
||||
namespace Orchard.Tests.Modules.Indexing {
|
||||
public class LuceneSearchBuilderTests {
|
||||
@@ -34,6 +35,7 @@ namespace Orchard.Tests.Modules.Indexing {
|
||||
_appDataFolder = AppDataFolderTests.CreateAppDataFolder(_basePath);
|
||||
|
||||
var builder = new ContainerBuilder();
|
||||
builder.RegisterType<StubWorkContextAccessor>().As<IWorkContextAccessor>();
|
||||
builder.RegisterType<DefaultLuceneAnalyzerProvider>().As<ILuceneAnalyzerProvider>();
|
||||
builder.RegisterType<DefaultLuceneAnalyzerSelector>().As<ILuceneAnalyzerSelector>();
|
||||
builder.RegisterType<LuceneIndexProvider>().As<IIndexProvider>();
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
<CodeAnalysisRuleSet>..\OrchardBasicCorrectness.ruleset</CodeAnalysisRuleSet>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<LangVersion>5</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@@ -55,6 +56,7 @@
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<LangVersion>5</LangVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Autofac, Version=3.5.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
|
||||
@@ -30,5 +30,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly: AssemblyVersion("1.10.1")]
|
||||
[assembly: AssemblyFileVersion("1.10.1")]
|
||||
[assembly: AssemblyVersion("1.10.2")]
|
||||
[assembly: AssemblyFileVersion("1.10.2")]
|
||||
|
||||
@@ -17,8 +17,9 @@ namespace Orchard.Tests.Modules.Recipes.RecipeHandlers {
|
||||
builder.RegisterType<RecipeExecutionLogger>().AsSelf();
|
||||
builder.RegisterType<StubRecipeExecutionStep>().As<IRecipeExecutionStep>().AsSelf().SingleInstance();
|
||||
builder.RegisterType<RecipeExecutionStepHandler>().SingleInstance();
|
||||
builder.RegisterType<RecipeExecutionStepResolver>().As<IRecipeExecutionStepResolver>().SingleInstance();
|
||||
|
||||
_container = builder.Build();
|
||||
_container = builder.Build();
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -205,7 +205,8 @@ namespace Orchard.Tests.Modules.Users.Controllers {
|
||||
@"Ima.Fool@example.com",
|
||||
@"""Ima.Fool""@example.com",
|
||||
@"""Ima Fool""@example.com",
|
||||
"2xxx1414@i.ua"
|
||||
"2xxx1414@i.ua",
|
||||
"Dreißig-öffentliche-Ämter-in-Übersee@Beispiel.de"
|
||||
)]
|
||||
string email)
|
||||
{
|
||||
|
||||
@@ -39,5 +39,21 @@ namespace Orchard.Tests.Localization {
|
||||
|
||||
Assert.AreEqual("Foo \"{0}\"", translations["~/themes/mytheme/views/myview.cshtml|foo \"{0}\""]);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void ShouldHandleUnclosedQuote() {
|
||||
var parser = new LocalizationStreamParser();
|
||||
|
||||
var text = new StringBuilder();
|
||||
text.AppendLine("#: ~/Themes/MyTheme/Views/MyView.cshtml");
|
||||
text.AppendLine("msgctxt \"");
|
||||
text.AppendLine("msgid \"Foo \\\"{0}\\\"\"");
|
||||
text.AppendLine("msgstr \"Foo \\\"{0}\\\"\"");
|
||||
|
||||
var translations = new Dictionary<string, string>();
|
||||
parser.ParseLocalizationStream(text.ToString(), translations, false);
|
||||
|
||||
Assert.AreEqual("Foo \"{0}\"", translations["|foo \"{0}\""]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -44,6 +44,7 @@
|
||||
<CodeAnalysisRuleSet>..\OrchardBasicCorrectness.ruleset</CodeAnalysisRuleSet>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<LangVersion>5</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@@ -55,6 +56,7 @@
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<LangVersion>5</LangVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Autofac, Version=3.5.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
|
||||
@@ -33,5 +33,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly: AssemblyVersion("1.10.1")]
|
||||
[assembly: AssemblyFileVersion("1.10.1")]
|
||||
[assembly: AssemblyVersion("1.10.2")]
|
||||
[assembly: AssemblyFileVersion("1.10.2")]
|
||||
|
||||
@@ -6,7 +6,7 @@ using Orchard.Utility.Extensions;
|
||||
namespace Orchard.Tests.Utility.Extensions {
|
||||
[TestFixture]
|
||||
public class HttpRequestExtensionsTests {
|
||||
|
||||
|
||||
[Test]
|
||||
public void IsLocalUrlShouldReturnFalseWhenUrlIsNullOrEmpty() {
|
||||
var request = new StubHttpRequest();
|
||||
@@ -21,6 +21,7 @@ namespace Orchard.Tests.Utility.Extensions {
|
||||
var request = new StubHttpRequest();
|
||||
|
||||
Assert.That(request.IsLocalUrl("//"), Is.False);
|
||||
Assert.That(request.IsLocalUrl(" //"), Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -28,6 +29,7 @@ namespace Orchard.Tests.Utility.Extensions {
|
||||
var request = new StubHttpRequest();
|
||||
|
||||
Assert.That(request.IsLocalUrl("/\\"), Is.False);
|
||||
Assert.That(request.IsLocalUrl(" /\\"), Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
@@ -35,6 +37,7 @@ namespace Orchard.Tests.Utility.Extensions {
|
||||
var request = new StubHttpRequest();
|
||||
|
||||
Assert.That(request.IsLocalUrl("/"), Is.True);
|
||||
Assert.That(request.IsLocalUrl("\t/"), Is.True);
|
||||
Assert.That(request.IsLocalUrl("/контакты"), Is.True);
|
||||
Assert.That(request.IsLocalUrl("/ "), Is.True);
|
||||
Assert.That(request.IsLocalUrl("/abc-def"), Is.True);
|
||||
@@ -46,6 +49,18 @@ namespace Orchard.Tests.Utility.Extensions {
|
||||
request.Headers.Add("Host", "localhost");
|
||||
|
||||
Assert.That(request.IsLocalUrl("http://localhost"), Is.True);
|
||||
Assert.That(request.IsLocalUrl("https://localhost"), Is.True);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void IsLocalUrlShouldReturnFalseForNonHttpSchemes() {
|
||||
var request = new StubHttpRequest();
|
||||
request.Headers.Add("Host", "localhost");
|
||||
|
||||
Assert.That(request.IsLocalUrl("httpx://localhost"), Is.False);
|
||||
Assert.That(request.IsLocalUrl("foo://localhost"), Is.False);
|
||||
Assert.That(request.IsLocalUrl("data://localhost"), Is.False);
|
||||
Assert.That(request.IsLocalUrl("mailto://localhost"), Is.False);
|
||||
}
|
||||
|
||||
[Test]
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<LangVersion>5</LangVersion>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
<CodeAnalysisRuleSet>..\OrchardBasicCorrectness.ruleset</CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
@@ -34,6 +35,7 @@
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<LangVersion>5</LangVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
|
||||
@@ -32,8 +32,8 @@ using System.Security;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly: AssemblyVersion("1.10.1")]
|
||||
[assembly: AssemblyFileVersion("1.10.1")]
|
||||
[assembly: AssemblyVersion("1.10.2")]
|
||||
[assembly: AssemblyFileVersion("1.10.2")]
|
||||
|
||||
// Enable web application to call this assembly in Full Trust
|
||||
[assembly: AllowPartiallyTrustedCallers]
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
<CodeAnalysisRuleSet>..\OrchardBasicCorrectness.ruleset</CodeAnalysisRuleSet>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<LangVersion>5</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@@ -54,6 +55,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<LangVersion>5</LangVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Autofac, Version=3.5.0.0, Culture=neutral, PublicKeyToken=17863af14b0044da, processorArchitecture=MSIL">
|
||||
|
||||
@@ -33,5 +33,5 @@ using System.Runtime.InteropServices;
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly: AssemblyVersion("1.10.1")]
|
||||
[assembly: AssemblyFileVersion("1.10.1")]
|
||||
[assembly: AssemblyVersion("1.10.2")]
|
||||
[assembly: AssemblyFileVersion("1.10.2")]
|
||||
|
||||
@@ -26,8 +26,8 @@
|
||||
-->
|
||||
<!--
|
||||
<component instance-scope="per-lifetime-scope"
|
||||
type="Orchard.Data.SessionLocator, Orchard.Framework"
|
||||
service="Orchard.Data.ISessionLocator">
|
||||
type="Orchard.Data.TransactionManager, Orchard.Framework"
|
||||
service="Orchard.Data.ITransactionManager">
|
||||
<properties>
|
||||
<property name="IsolationLevel" value="ReadUncommitted" />
|
||||
</properties>
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace Orchard.Core.Common.Drivers {
|
||||
return ContentShape("Fields_Common_Text_Edit", GetDifferentiator(field, part),
|
||||
() => {
|
||||
var settings = field.PartFieldDefinition.Settings.GetModel<TextFieldSettings>();
|
||||
var text = part.IsNew() ? settings.DefaultValue : field.Value;
|
||||
var text = part.IsNew() && String.IsNullOrEmpty(field.Value) ? settings.DefaultValue : field.Value;
|
||||
|
||||
var viewModel = new TextFieldDriverViewModel {
|
||||
Field = field,
|
||||
@@ -84,8 +84,7 @@ namespace Orchard.Core.Common.Drivers {
|
||||
}
|
||||
|
||||
protected override void Exporting(ContentPart part, TextField field, ExportContentContext context) {
|
||||
if (!String.IsNullOrEmpty(field.Value))
|
||||
context.Element(field.FieldDefinition.Name + "." + field.Name).SetAttributeValue("Text", field.Value);
|
||||
context.Element(field.FieldDefinition.Name + "." + field.Name).SetAttributeValue("Text", field.Value);
|
||||
}
|
||||
|
||||
protected override void Describe(DescribeMembersContext context) {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardproject.net
|
||||
Version: 1.10.1
|
||||
Version: 1.10.2
|
||||
OrchardVersion: 1.9
|
||||
Description: The common module introduces content parts that are going to be used by most content types (common, body, identity).
|
||||
FeatureDescription: Core content parts.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardproject.net
|
||||
Version: 1.10.1
|
||||
Version: 1.10.2
|
||||
OrchardVersion: 1.9
|
||||
Description: The containers module introduces container and containable behaviors for content items.
|
||||
FeatureDescription: Container and containable parts to enable parent-child relationships between content items.
|
||||
|
||||
@@ -3,16 +3,19 @@ using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using Orchard.Core.Contents.Settings;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Security;
|
||||
using Orchard.UI.Navigation;
|
||||
|
||||
namespace Orchard.Core.Contents {
|
||||
public class AdminMenu : INavigationProvider {
|
||||
private readonly IContentDefinitionManager _contentDefinitionManager;
|
||||
private readonly IContentManager _contentManager;
|
||||
private readonly IAuthorizer _authorizer;
|
||||
|
||||
public AdminMenu(IContentDefinitionManager contentDefinitionManager, IContentManager contentManager) {
|
||||
public AdminMenu(IContentDefinitionManager contentDefinitionManager, IContentManager contentManager, IAuthorizer authorizer) {
|
||||
_contentDefinitionManager = contentDefinitionManager;
|
||||
_contentManager = contentManager;
|
||||
_authorizer = authorizer;
|
||||
}
|
||||
|
||||
public Localizer T { get; set; }
|
||||
@@ -20,10 +23,17 @@ namespace Orchard.Core.Contents {
|
||||
|
||||
public void GetNavigation(NavigationBuilder builder) {
|
||||
var contentTypeDefinitions = _contentDefinitionManager.ListTypeDefinitions().OrderBy(d => d.Name);
|
||||
builder.AddImageSet("content")
|
||||
.Add(T("Content"), "1.4", menu => menu
|
||||
.Permission(Permissions.EditOwnContent)
|
||||
.Add(T("Content Items"), "1", item => item.Action("List", "Admin", new { area = "Contents", id = "" }).LocalNav()));
|
||||
var listableContentTypes = contentTypeDefinitions.Where(ctd => ctd.Settings.GetModel<ContentTypeSettings>().Listable);
|
||||
ContentItem listableCi = null;
|
||||
foreach(var contentTypeDefinition in listableContentTypes) {
|
||||
listableCi = _contentManager.New(contentTypeDefinition.Name);
|
||||
if(_authorizer.Authorize(Permissions.EditContent, listableCi)) {
|
||||
builder.AddImageSet("content")
|
||||
.Add(T("Content"), "1.4", menu => menu
|
||||
.Add(T("Content Items"), "1", item => item.Action("List", "Admin", new { area = "Contents", id = "" }).LocalNav()));
|
||||
break;
|
||||
}
|
||||
}
|
||||
var contentTypes = contentTypeDefinitions.Where(ctd => ctd.Settings.GetModel<ContentTypeSettings>().Creatable).OrderBy(ctd => ctd.DisplayName);
|
||||
if (contentTypes.Any()) {
|
||||
builder.Add(T("New"), "-1", menu => {
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardproject.net
|
||||
Version: 1.10.1
|
||||
Version: 1.10.2
|
||||
OrchardVersion: 1.9
|
||||
Description: The contents module enables the creation of custom content types.
|
||||
Features:
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardproject.net
|
||||
Version: 1.10.1
|
||||
Version: 1.10.2
|
||||
OrchardVersion: 1.9
|
||||
Description: The dashboard module is providing the dashboard screen of the admininstration UI of the application.
|
||||
FeatureDescription: Standard admin dashboard.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardproject.net
|
||||
Version: 1.10.1
|
||||
Version: 1.10.2
|
||||
OrchardVersion: 1.9
|
||||
Description: The Feeds module is providing RSS feeds to content items.
|
||||
FeatureDescription: RSS feeds for content items.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardproject.net
|
||||
Version: 1.10.1
|
||||
Version: 1.10.2
|
||||
OrchardVersion: 1.9
|
||||
Description: The navigation module creates and manages a simple navigation menu for the front-end of the application and allows you to add content items to the admin menu.
|
||||
FeatureDescription: Menu management.
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>..\..\OrchardBasicCorrectness.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<LangVersion>5</LangVersion>
|
||||
<UseVSHostingProcess>false</UseVSHostingProcess>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
@@ -48,6 +49,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<LangVersion>5</LangVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
@@ -397,7 +399,6 @@
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Folder Include="App_Data\" />
|
||||
<Folder Include="Views\Gamma\" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Contents\Views\Content.cshtml" />
|
||||
|
||||
@@ -30,6 +30,6 @@ using System.Security;
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.10.1")]
|
||||
[assembly: AssemblyFileVersion("1.10.1")]
|
||||
[assembly: AssemblyVersion("1.10.2")]
|
||||
[assembly: AssemblyFileVersion("1.10.2")]
|
||||
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardproject.net
|
||||
Version: 1.10.1
|
||||
Version: 1.10.2
|
||||
OrchardVersion: 1.9
|
||||
Description: The dashboard module is providing the reports screen of the application.
|
||||
FeatureDescription: Reports management.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardproject.net
|
||||
Version: 1.10.1
|
||||
Version: 1.10.2
|
||||
OrchardVersion: 1.9
|
||||
Description: The scheduling module enables background task scheduling.
|
||||
FeatureDescription: Scheduled background tasks.
|
||||
|
||||
@@ -189,7 +189,7 @@ namespace Orchard.Core.Settings.Metadata {
|
||||
|
||||
private void Apply(ContentTypeDefinition model, ContentTypeDefinitionRecord record) {
|
||||
record.DisplayName = model.DisplayName;
|
||||
record.Settings = _settingsFormatter.Map(model.Settings).ToString();
|
||||
record.Settings = Compose(_settingsFormatter.Map(model.Settings));
|
||||
|
||||
var toRemove = record.ContentTypePartDefinitionRecords
|
||||
.Where(partDefinitionRecord => model.Parts.All(part => partDefinitionRecord.ContentPartDefinitionRecord.Name != part.PartDefinition.Name))
|
||||
@@ -215,7 +215,7 @@ namespace Orchard.Core.Settings.Metadata {
|
||||
}
|
||||
|
||||
private void Apply(ContentPartDefinition model, ContentPartDefinitionRecord record) {
|
||||
record.Settings = _settingsFormatter.Map(model.Settings).ToString();
|
||||
record.Settings = Compose(_settingsFormatter.Map(model.Settings));
|
||||
|
||||
var toRemove = record.ContentPartFieldDefinitionRecords
|
||||
.Where(partFieldDefinitionRecord => model.Fields.All(partField => partFieldDefinitionRecord.Name != partField.Name))
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardproject.net
|
||||
Version: 1.10.1
|
||||
Version: 1.10.2
|
||||
OrchardVersion: 1.9
|
||||
Description: The settings module creates site settings that other modules can contribute to.
|
||||
FeatureDescription: Site settings.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardproject.net
|
||||
Version: 1.10.1
|
||||
Version: 1.10.2
|
||||
OrchardVersion: 1.9
|
||||
Description: The shapes module contains core shape templates and display hooks.
|
||||
FeatureDescription: Core shape templates and display hooks.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardproject.net
|
||||
Version: 1.10.1
|
||||
Version: 1.10.2
|
||||
OrchardVersion: 1.9
|
||||
Description: The title module enables content items to have titles.
|
||||
FeatureDescription: Title content part.
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardproject.net
|
||||
Version: 1.10.1
|
||||
Version: 1.10.2
|
||||
OrchardVersion: 1.9
|
||||
Description: The XmlRpc module enables creation of contents from client applications such as LiveWriter.
|
||||
FeatureDescription: XML-RPC opt-in implementation.
|
||||
|
||||
@@ -0,0 +1,69 @@
|
||||
using Lucene.Models;
|
||||
using Lucene.Services;
|
||||
using Lucene.ViewModels;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.Indexing;
|
||||
using Orchard.Localization;
|
||||
using Orchard.UI.Notify;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace Lucene.Drivers {
|
||||
public class LuceneSettingsPartDriver : ContentPartDriver<LuceneSettingsPart> {
|
||||
private readonly IIndexManager _indexManager;
|
||||
private readonly IEnumerable<ILuceneAnalyzerSelector> _analyzerSelectors;
|
||||
private readonly INotifier _notifier;
|
||||
|
||||
public Localizer T { get; set; }
|
||||
|
||||
public LuceneSettingsPartDriver(IIndexManager indexManager, IEnumerable<ILuceneAnalyzerSelector> analyzerSelectors, INotifier notifier) {
|
||||
_indexManager = indexManager;
|
||||
_analyzerSelectors = analyzerSelectors;
|
||||
_notifier = notifier;
|
||||
T = NullLocalizer.Instance;
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(LuceneSettingsPart part, dynamic shapeHelper) {
|
||||
return ContentShape("Parts_LuceneSettings_Edit", () => {
|
||||
MaintainMappings(part);
|
||||
return shapeHelper.EditorTemplate(
|
||||
TemplateName: "Parts.LuceneSettings",
|
||||
Model: new LuceneSettingsPartEditViewModel {
|
||||
LuceneAnalyzerSelectorMappings = part.LuceneAnalyzerSelectorMappings.ToArray(),
|
||||
LuceneAnalyzerSelectors = _analyzerSelectors.Select(analyzerSelector =>
|
||||
new SelectListItem { Text = T(analyzerSelector.Name).Text, Value = analyzerSelector.Name })
|
||||
},
|
||||
Prefix: Prefix);
|
||||
});
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(LuceneSettingsPart part, IUpdateModel updater, dynamic shapeHelper) {
|
||||
var viewModel = new LuceneSettingsPartEditViewModel();
|
||||
if (updater.TryUpdateModel(viewModel, Prefix, null, null)) {
|
||||
_notifier.Warning(T("Don't forget to rebuild your index in case you have changed its analyzer."));
|
||||
part.LuceneAnalyzerSelectorMappings = viewModel.LuceneAnalyzerSelectorMappings;
|
||||
MaintainMappings(part);
|
||||
}
|
||||
|
||||
return Editor(part, shapeHelper);
|
||||
}
|
||||
|
||||
private void MaintainMappings(LuceneSettingsPart part) {
|
||||
var analyzerProviderNames = _analyzerSelectors.Select(analyzerProvider => analyzerProvider.Name);
|
||||
var indexNames = _indexManager.GetSearchIndexProvider().List();
|
||||
var maintainedMappings = part.LuceneAnalyzerSelectorMappings.ToList();
|
||||
// Removing mappings which contain a removed/invalid index or analyzer provider.
|
||||
maintainedMappings.RemoveAll(mapping => !indexNames.Contains(mapping.IndexName) || !analyzerProviderNames.Contains(mapping.AnalyzerName));
|
||||
// Adding new mappings for the new indexes.
|
||||
foreach (var indexName in indexNames) {
|
||||
if (!maintainedMappings.Any(mapping => mapping.IndexName == indexName)) {
|
||||
maintainedMappings.Add(new LuceneAnalyzerSelectorMapping { IndexName = indexName, AnalyzerName = "Default" });
|
||||
}
|
||||
}
|
||||
|
||||
part.LuceneAnalyzerSelectorMappings = maintainedMappings;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
using Lucene.Models;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Handlers;
|
||||
using Orchard.Localization;
|
||||
using Orchard.Services;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Lucene.Handlers {
|
||||
public class LuceneSettingsPartHandler : ContentHandler {
|
||||
public Localizer T { get; set; }
|
||||
|
||||
public LuceneSettingsPartHandler(IJsonConverter jsonConverter) {
|
||||
T = NullLocalizer.Instance;
|
||||
|
||||
Filters.Add(new ActivatingFilter<LuceneSettingsPart>("Site"));
|
||||
|
||||
OnActivated<LuceneSettingsPart>((context, part) => {
|
||||
part.LuceneAnalyzerSelectorMappingsField.Loader(() => {
|
||||
return string.IsNullOrEmpty(part.LuceneAnalyzerSelectorMappingsSerialized)
|
||||
? new List<LuceneAnalyzerSelectorMapping>()
|
||||
: jsonConverter.Deserialize<List<LuceneAnalyzerSelectorMapping>>(part.LuceneAnalyzerSelectorMappingsSerialized);
|
||||
});
|
||||
|
||||
part.LuceneAnalyzerSelectorMappingsField.Setter((value) => {
|
||||
part.LuceneAnalyzerSelectorMappingsSerialized = value == null ? "[]" : jsonConverter.Serialize(value);
|
||||
return value;
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
protected override void GetItemMetadata(GetContentItemMetadataContext context) {
|
||||
if (context.ContentItem.ContentType != "Site") return;
|
||||
|
||||
base.GetItemMetadata(context);
|
||||
|
||||
context.Metadata.EditorGroupInfo.Add(new GroupInfo(T("Lucene Settings")) { Id = "LuceneSettings" });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -38,6 +38,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>..\..\..\OrchardBasicCorrectness.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<LangVersion>5</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@@ -47,6 +48,7 @@
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<LangVersion>5</LangVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="ICSharpCode.SharpZipLib, Version=0.86.0.518, Culture=neutral, PublicKeyToken=1b03e6acf1164f73, processorArchitecture=MSIL">
|
||||
@@ -97,8 +99,12 @@
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Drivers\LuceneSettingsPartDriver.cs" />
|
||||
<Compile Include="Handlers\LuceneSettingsPartHandler.cs" />
|
||||
<Compile Include="Models\LuceneAnalyzerSelectorMapping.cs" />
|
||||
<Compile Include="Models\LuceneDocumentIndex.cs" />
|
||||
<Compile Include="Models\LuceneSearchHit.cs" />
|
||||
<Compile Include="Models\LuceneSettingsPart.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Services\DefaultLuceneAnalyzerSelector.cs" />
|
||||
<Compile Include="Services\DefaultLuceneAnalyzerProvider.cs" />
|
||||
@@ -108,6 +114,7 @@
|
||||
<Compile Include="Services\LuceneIndexProvider.cs" />
|
||||
<Compile Include="Services\LuceneSearchBuilder.cs" />
|
||||
<Compile Include="Services\SearchBits.cs" />
|
||||
<Compile Include="ViewModels\LuceneSettingsPartEditViewModel.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Module.txt" />
|
||||
@@ -127,6 +134,13 @@
|
||||
<ItemGroup>
|
||||
<Content Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Placement.info" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="Views\EditorTemplates\Parts.LuceneSettings.cshtml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<PropertyGroup>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">10.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
namespace Lucene.Models {
|
||||
public class LuceneAnalyzerSelectorMapping {
|
||||
public string IndexName { get; set; }
|
||||
public string AnalyzerName { get; set; }
|
||||
}
|
||||
}
|
||||
21
src/Orchard.Web/Modules/Lucene/Models/LuceneSettingsPart.cs
Normal file
21
src/Orchard.Web/Modules/Lucene/Models/LuceneSettingsPart.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using Lucene.Models;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Utilities;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Lucene.Models {
|
||||
public class LuceneSettingsPart : ContentPart {
|
||||
public string LuceneAnalyzerSelectorMappingsSerialized {
|
||||
get { return this.Retrieve(x => x.LuceneAnalyzerSelectorMappingsSerialized); }
|
||||
set { this.Store(x => x.LuceneAnalyzerSelectorMappingsSerialized, value); }
|
||||
}
|
||||
|
||||
private readonly LazyField<IEnumerable<LuceneAnalyzerSelectorMapping>> _luceneAnalyzerSelectorMappings = new LazyField<IEnumerable<LuceneAnalyzerSelectorMapping>>();
|
||||
internal LazyField<IEnumerable<LuceneAnalyzerSelectorMapping>> LuceneAnalyzerSelectorMappingsField { get { return _luceneAnalyzerSelectorMappings; }
|
||||
}
|
||||
public IEnumerable<LuceneAnalyzerSelectorMapping> LuceneAnalyzerSelectorMappings {
|
||||
get { return _luceneAnalyzerSelectorMappings.Value; }
|
||||
set { _luceneAnalyzerSelectorMappings.Value = value; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardproject.net
|
||||
Version: 1.10.1
|
||||
Version: 1.10.2
|
||||
OrchardVersion: 1.9
|
||||
Description: The Lucene module enables the site to be indexed using Lucene.NET. The index generated by this module can then be used by the search module to provide an integrated full-text search experience to a web site.
|
||||
FeatureDescription: Lucene indexing services.
|
||||
|
||||
5
src/Orchard.Web/Modules/Lucene/Placement.info
Normal file
5
src/Orchard.Web/Modules/Lucene/Placement.info
Normal file
@@ -0,0 +1,5 @@
|
||||
<Placement>
|
||||
<Match ContentType="Site">
|
||||
<Place Parts_LuceneSettings_Edit="Content: 1@LuceneSettings" />
|
||||
</Match>
|
||||
</Placement>
|
||||
@@ -30,6 +30,6 @@ using System.Security;
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.10.1")]
|
||||
[assembly: AssemblyFileVersion("1.10.1")]
|
||||
[assembly: AssemblyVersion("1.10.2")]
|
||||
[assembly: AssemblyFileVersion("1.10.2")]
|
||||
|
||||
|
||||
@@ -1,34 +1,46 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Lucene.Models;
|
||||
using Lucene.Net.Analysis;
|
||||
using Lucene.Net.Analysis.Standard;
|
||||
using Orchard;
|
||||
using Orchard.ContentManagement;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Lucene.Services {
|
||||
public class DefaultLuceneAnalyzerProvider : ILuceneAnalyzerProvider {
|
||||
|
||||
private readonly IWorkContextAccessor _wca;
|
||||
private IEnumerable<ILuceneAnalyzerSelector> _analyzerSelectors;
|
||||
|
||||
public DefaultLuceneAnalyzerProvider(IEnumerable<ILuceneAnalyzerSelector> analyzerSelectors) {
|
||||
public DefaultLuceneAnalyzerProvider(IEnumerable<ILuceneAnalyzerSelector> analyzerSelectors, IWorkContextAccessor wca) {
|
||||
_analyzerSelectors = analyzerSelectors;
|
||||
_wca = wca;
|
||||
}
|
||||
|
||||
public Analyzer GetAnalyzer(string indexName) {
|
||||
var luceneSettingsPart = _wca
|
||||
.GetContext()
|
||||
.CurrentSite
|
||||
.As<LuceneSettingsPart>();
|
||||
if (luceneSettingsPart == null) {
|
||||
return new StandardAnalyzer(LuceneIndexProvider.LuceneVersion);
|
||||
}
|
||||
|
||||
var currentIndexMapping = luceneSettingsPart
|
||||
.LuceneAnalyzerSelectorMappings
|
||||
.FirstOrDefault(mapping => mapping.IndexName == indexName);
|
||||
if (currentIndexMapping == null) {
|
||||
return new StandardAnalyzer(LuceneIndexProvider.LuceneVersion);
|
||||
}
|
||||
|
||||
var analyzer = _analyzerSelectors
|
||||
.Where(x => x.Name == currentIndexMapping.AnalyzerName)
|
||||
.Select(x => x.GetLuceneAnalyzer(indexName))
|
||||
.Where(x => x != null)
|
||||
.OrderByDescending(x => x.Priority)
|
||||
.Select(x => x.Analyzer)
|
||||
.FirstOrDefault();
|
||||
|
||||
if (analyzer != null) {
|
||||
return analyzer;
|
||||
}
|
||||
|
||||
return new StandardAnalyzer(LuceneIndexProvider.LuceneVersion);
|
||||
return analyzer != null ? analyzer : new StandardAnalyzer(LuceneIndexProvider.LuceneVersion);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,5 +12,7 @@ namespace Lucene.Services {
|
||||
Analyzer = new StandardAnalyzer(LuceneIndexProvider.LuceneVersion)
|
||||
};
|
||||
}
|
||||
|
||||
public string Name { get { return "Default"; } }
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,8 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using Orchard;
|
||||
using Orchard;
|
||||
|
||||
namespace Lucene.Services {
|
||||
public interface ILuceneAnalyzerSelector : IDependency {
|
||||
LuceneAnalyzerSelectorResult GetLuceneAnalyzer(string indexName);
|
||||
string Name { get; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using Lucene.Models;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web.Mvc;
|
||||
|
||||
namespace Lucene.ViewModels {
|
||||
public class LuceneSettingsPartEditViewModel {
|
||||
public LuceneAnalyzerSelectorMapping[] LuceneAnalyzerSelectorMappings { get; set; }
|
||||
|
||||
public IEnumerable<SelectListItem> LuceneAnalyzerSelectors { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
@model Lucene.ViewModels.LuceneSettingsPartEditViewModel
|
||||
|
||||
@using System.Linq
|
||||
|
||||
<fieldset>
|
||||
<legend>@T("Lucene Settings")</legend>
|
||||
@if (!Model.LuceneAnalyzerSelectorMappings.Any()) {
|
||||
@T("There is currently no mapping. Create an index first.")
|
||||
}
|
||||
else {
|
||||
<ul>
|
||||
@for (int i = 0; i < Model.LuceneAnalyzerSelectorMappings.Length; i++) {
|
||||
<li>
|
||||
@Html.HiddenFor(m => Model.LuceneAnalyzerSelectorMappings[i].IndexName)
|
||||
@Html.LabelFor(m => Model.LuceneAnalyzerSelectorMappings[i].AnalyzerName, T("Analyzer name for the \"{0}\" index", Model.LuceneAnalyzerSelectorMappings[i].IndexName))
|
||||
@Html.DropDownListFor(m => Model.LuceneAnalyzerSelectorMappings[i].AnalyzerName, new SelectList(
|
||||
Model.LuceneAnalyzerSelectors,
|
||||
"Text",
|
||||
"Value",
|
||||
Model.LuceneAnalyzerSelectorMappings[i].AnalyzerName
|
||||
))
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
}
|
||||
</fieldset>
|
||||
@@ -37,6 +37,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>..\..\..\OrchardBasicCorrectness.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<LangVersion>5</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@@ -47,6 +48,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<LangVersion>5</LangVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="MarkdownSharp, Version=1.5.1.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardproject.net
|
||||
Version: 1.10.1
|
||||
Version: 1.10.2
|
||||
OrchardVersion: 1.9
|
||||
Description: The Markdown module enables rich text contents to be created using the Markdown syntax.
|
||||
FeatureDescription: Markdown editor.
|
||||
|
||||
@@ -26,6 +26,6 @@ using System.Runtime.InteropServices;
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.10.1")]
|
||||
[assembly: AssemblyFileVersion("1.10.1")]
|
||||
[assembly: AssemblyVersion("1.10.2")]
|
||||
[assembly: AssemblyFileVersion("1.10.2")]
|
||||
|
||||
|
||||
@@ -3,14 +3,26 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Collections.Concurrent;
|
||||
using Orchard.Alias.Implementation.Map;
|
||||
using Orchard.Alias.Implementation.Updater;
|
||||
|
||||
namespace Orchard.Alias.Implementation.Holder {
|
||||
public class AliasHolder : IAliasHolder {
|
||||
public AliasHolder() {
|
||||
private readonly Lazy<IAliasHolderUpdater> _aliasHolderUpdater;
|
||||
private readonly ConcurrentDictionary<string, AliasMap> _aliasMaps;
|
||||
|
||||
public AliasHolder(Lazy<IAliasHolderUpdater> aliasHolderUpdater) {
|
||||
_aliasHolderUpdater = aliasHolderUpdater;
|
||||
_aliasMaps = new ConcurrentDictionary<string, AliasMap>(StringComparer.OrdinalIgnoreCase);
|
||||
}
|
||||
|
||||
private readonly ConcurrentDictionary<string, AliasMap> _aliasMaps;
|
||||
private ConcurrentDictionary<string, AliasMap> GetOrRefreshAliasMaps() {
|
||||
lock (_aliasMaps) {
|
||||
if (_aliasMaps.Count == 0)
|
||||
_aliasHolderUpdater.Value.Refresh();
|
||||
}
|
||||
|
||||
return _aliasMaps;
|
||||
}
|
||||
|
||||
public void SetAliases(IEnumerable<AliasInfo> aliases) {
|
||||
var grouped = aliases.GroupBy(alias => alias.Area ?? String.Empty, StringComparer.InvariantCultureIgnoreCase);
|
||||
@@ -25,7 +37,7 @@ namespace Orchard.Alias.Implementation.Holder {
|
||||
}
|
||||
|
||||
public void SetAlias(AliasInfo alias) {
|
||||
foreach (var map in _aliasMaps.Values) {
|
||||
foreach (var map in GetOrRefreshAliasMaps().Values) {
|
||||
map.Remove(alias);
|
||||
}
|
||||
|
||||
@@ -33,11 +45,11 @@ namespace Orchard.Alias.Implementation.Holder {
|
||||
}
|
||||
|
||||
public IEnumerable<AliasMap> GetMaps() {
|
||||
return _aliasMaps.Values;
|
||||
return GetOrRefreshAliasMaps().Values;
|
||||
}
|
||||
|
||||
public AliasMap GetMap(string areaName) {
|
||||
return _aliasMaps.GetOrAdd(areaName ?? String.Empty, key => new AliasMap(key));
|
||||
return GetOrRefreshAliasMaps().GetOrAdd(areaName ?? String.Empty, key => new AliasMap(key));
|
||||
}
|
||||
|
||||
public void RemoveAlias(AliasInfo aliasInfo) {
|
||||
|
||||
@@ -2,7 +2,7 @@ Name: Alias
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardproject.net
|
||||
Version: 1.10.1
|
||||
Version: 1.10.2
|
||||
OrchardVersion: 1.9
|
||||
Description: Maps friendly urls to specific module actions.
|
||||
FeatureDescription: Maps friendly urls to specific module actions.
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>..\..\..\OrchardBasicCorrectness.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<LangVersion>5</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@@ -47,6 +48,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<LangVersion>5</LangVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
|
||||
@@ -30,6 +30,6 @@ using System.Security;
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.10.1")]
|
||||
[assembly: AssemblyFileVersion("1.10.1")]
|
||||
[assembly: AssemblyVersion("1.10.2")]
|
||||
[assembly: AssemblyFileVersion("1.10.2")]
|
||||
|
||||
|
||||
@@ -44,7 +44,6 @@
|
||||
<tr>
|
||||
<th scope="col">@T("Alias")</th>
|
||||
<th scope="col">@T("Route")</th>
|
||||
<th scope="col"> </th>
|
||||
</tr>
|
||||
</thead>
|
||||
@foreach (var aliasEntry in Model.AliasEntries) {
|
||||
|
||||
@@ -2,7 +2,7 @@ Name: AntiSpam
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardproject.net
|
||||
Version: 1.10.1
|
||||
Version: 1.10.2
|
||||
OrchardVersion: 1.9
|
||||
Description: Provides anti-spam services to protect your content from malicious submissions.
|
||||
Features:
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>..\..\..\OrchardBasicCorrectness.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<LangVersion>5</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@@ -47,6 +48,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<LangVersion>5</LangVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
|
||||
@@ -29,6 +29,6 @@ using System.Runtime.InteropServices;
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.10.1")]
|
||||
[assembly: AssemblyFileVersion("1.10.1")]
|
||||
[assembly: AssemblyVersion("1.10.2")]
|
||||
[assembly: AssemblyFileVersion("1.10.2")]
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ Path: ArchiveLater
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardproject.net
|
||||
Version: 1.10.1
|
||||
Version: 1.10.2
|
||||
OrchardVersion: 1.9
|
||||
Description: The ArchiveLater module introduces scheduled archiving functionality.
|
||||
FeatureDescription: Scheduled archiving.
|
||||
|
||||
@@ -38,6 +38,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>..\..\..\OrchardBasicCorrectness.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<LangVersion>5</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@@ -47,6 +48,7 @@
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<LangVersion>5</LangVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
|
||||
@@ -30,6 +30,6 @@ using System.Security;
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.10.1")]
|
||||
[assembly: AssemblyFileVersion("1.10.1")]
|
||||
[assembly: AssemblyVersion("1.10.2")]
|
||||
[assembly: AssemblyFileVersion("1.10.2")]
|
||||
|
||||
|
||||
@@ -2,21 +2,63 @@
|
||||
using Orchard.Data.Conventions;
|
||||
|
||||
namespace Orchard.AuditTrail.Models {
|
||||
|
||||
/// <summary>
|
||||
/// Audit Trail Event Record in the database.
|
||||
/// </summary>
|
||||
public class AuditTrailEventRecord {
|
||||
public virtual int Id { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The time when the event occurred.
|
||||
/// </summary>
|
||||
public virtual DateTime CreatedUtc { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The user name of the user who caused the event to occur.
|
||||
/// </summary>
|
||||
public virtual string UserName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the event.
|
||||
/// </summary>
|
||||
public virtual string EventName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The full name of the event.
|
||||
/// </summary>
|
||||
public virtual string FullEventName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The category the event belongs to.
|
||||
/// </summary>
|
||||
public virtual string Category { get; set; }
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The data of the event.
|
||||
/// </summary>
|
||||
[StringLengthMax]
|
||||
public virtual string EventData { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The filter key of the event.
|
||||
/// </summary>
|
||||
public virtual string EventFilterKey { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The filter data of the event.
|
||||
/// </summary>
|
||||
public virtual string EventFilterData { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The comment of the event.
|
||||
/// </summary>
|
||||
[StringLengthMax]
|
||||
public virtual string Comment { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The IP address of the user who caused the event to occur.
|
||||
/// </summary>
|
||||
public virtual string ClientIpAddress { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,18 @@
|
||||
namespace Orchard.AuditTrail.Models {
|
||||
|
||||
/// <summary>
|
||||
/// The created audit trail event result
|
||||
/// </summary>
|
||||
public class AuditTrailEventRecordResult {
|
||||
|
||||
/// <summary>
|
||||
/// The created <see cref="AuditTrailEventRecord"/>
|
||||
/// </summary>
|
||||
public AuditTrailEventRecord Record { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether AuditTrailEventRecordResult is disabled for <see cref="AuditTrailEventRecord"/> .
|
||||
/// </summary>
|
||||
public bool IsDisabled { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardproject.net
|
||||
Version: 1.10.1
|
||||
Version: 1.10.2
|
||||
OrchardVersion: 1.9
|
||||
Description: Provides a log for recording and viewing back-end changes.
|
||||
Features:
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>..\..\..\OrchardBasicCorrectness.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<LangVersion>5</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@@ -46,6 +47,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<LangVersion>5</LangVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Iesi.Collections, Version=4.0.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
|
||||
|
||||
@@ -32,6 +32,6 @@ using System.Security;
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
|
||||
[assembly: AssemblyVersion("1.10.1")]
|
||||
[assembly: AssemblyFileVersion("1.10.1")]
|
||||
[assembly: AssemblyVersion("1.10.2")]
|
||||
[assembly: AssemblyFileVersion("1.10.2")]
|
||||
|
||||
|
||||
@@ -16,6 +16,10 @@ using Orchard.Services;
|
||||
using Orchard.Settings;
|
||||
|
||||
namespace Orchard.AuditTrail.Services {
|
||||
|
||||
/// <summary>
|
||||
/// Manage the audit trail.
|
||||
/// </summary>
|
||||
public class AuditTrailManager : Component, IAuditTrailManager {
|
||||
private readonly IRepository<AuditTrailEventRecord> _auditTrailRepository;
|
||||
private readonly IAuditTrailEventProvider _providers;
|
||||
@@ -52,6 +56,14 @@ namespace Orchard.AuditTrail.Services {
|
||||
_clientHostAddressAccessor = clientHostAddressAccessor;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a page of event records from the audit trail.
|
||||
/// </summary>
|
||||
/// <param name="page">The page number to get records from.</param>
|
||||
/// <param name="pageSize">The number of records to get.</param>
|
||||
/// <param name="orderBy">The value to order by.</param>
|
||||
/// <param name="filters">Optional. An object to filter the records on.</param>
|
||||
/// <returns>A page of event records.</returns>
|
||||
public IPageOfItems<AuditTrailEventRecord> GetRecords(
|
||||
int page,
|
||||
int pageSize,
|
||||
@@ -102,10 +114,20 @@ namespace Orchard.AuditTrail.Services {
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a single event record from the audit trail by ID.
|
||||
/// </summary>
|
||||
/// <param name="id">The event record ID.</param>
|
||||
/// <returns>A single event record.</returns>
|
||||
public AuditTrailEventRecord GetRecord(int id) {
|
||||
return _auditTrailRepository.Get(id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Builds a shape tree of filter displays.
|
||||
/// </summary>
|
||||
/// <param name="filters">Input for each filter builder.</param>
|
||||
/// <returns>A tree of shapes.</returns>
|
||||
public dynamic BuildFilterDisplay(Filters filters) {
|
||||
var filterDisplay = (dynamic)_shapeFactory.Create("AuditTrailFilter");
|
||||
var filterDisplayContext = new DisplayFilterContext(_shapeFactory, filters, filterDisplay);
|
||||
@@ -123,6 +145,17 @@ namespace Orchard.AuditTrail.Services {
|
||||
return filterDisplay;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Records an audit trail event.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The audit trail event provider type to determine the scope of the event name.</typeparam>
|
||||
/// <param name="eventName">The shorthand name of the event</param>
|
||||
/// <param name="user">The user to associate with the event. This is typically the currently loggedin user.</param>
|
||||
/// <param name="properties">A property bag of custom event data that could be useful for <see cref="IAuditTrailEventHandler"/> implementations. These values aren't stored. Use the eventData parameter to persist additional data with the event.</param>
|
||||
/// <param name="eventData">A property bag of custom event data that will be stored with the event record.</param>
|
||||
/// <param name="eventFilterKey">The name of a custom key to use when filtering events.</param>
|
||||
/// <param name="eventFilterData">The value of a custom filter key to filter on.</param>
|
||||
/// <returns>The created audit trail event record if the specified event was not disabled.</returns>
|
||||
public AuditTrailEventRecordResult CreateRecord<T>(string eventName, IUser user, IDictionary<string, object> properties = null, IDictionary<string, object> eventData = null, string eventFilterKey = null, string eventFilterData = null) where T : IAuditTrailEventProvider {
|
||||
var eventDescriptor = DescribeEvent<T>(eventName);
|
||||
if (!IsEventEnabled(eventDescriptor))
|
||||
@@ -165,26 +198,49 @@ namespace Orchard.AuditTrail.Services {
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Describes all audit trail events provided by the system.
|
||||
/// </summary>
|
||||
/// <returns>A list of audit trail category descriptors.</returns>
|
||||
public IEnumerable<AuditTrailCategoryDescriptor> DescribeCategories() {
|
||||
var context = DescribeProviders();
|
||||
return context.Describe();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Describes all audit trail event providers.
|
||||
/// </summary>
|
||||
public DescribeContext DescribeProviders() {
|
||||
var context = new DescribeContext();
|
||||
_providers.Describe(context);
|
||||
return context;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Describes a single audit trail event.
|
||||
/// </summary>
|
||||
/// <param name="record">The audit trail event record for which to find its descriptor.</param>
|
||||
/// <returns>A single audit trail event descriptor.</returns>
|
||||
public AuditTrailEventDescriptor DescribeEvent(AuditTrailEventRecord record) {
|
||||
return DescribeEvent(record.FullEventName) ?? AuditTrailEventDescriptor.Basic(record);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Describes a single audit trail event.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The scope of the specified event name.</typeparam>
|
||||
/// <param name="eventName">The shorthand name of the event.</param>
|
||||
/// <returns>A single audit trail event descriptor.</returns>
|
||||
public AuditTrailEventDescriptor DescribeEvent<T>(string eventName) where T : IAuditTrailEventProvider {
|
||||
var fullyQualifiedEventName = EventNameExtensions.GetFullyQualifiedEventName<T>(eventName);
|
||||
return DescribeEvent(fullyQualifiedEventName);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Describes a single audit trail event.
|
||||
/// </summary>
|
||||
/// <param name="fullyQualifiedEventName">The fully qualified event name to describe.</param>
|
||||
/// <returns>A single audit trail event descriptor.</returns>
|
||||
public AuditTrailEventDescriptor DescribeEvent(string fullyQualifiedEventName) {
|
||||
var categoryDescriptors = DescribeCategories();
|
||||
var eventDescriptorQuery =
|
||||
|
||||
@@ -5,7 +5,17 @@ using Newtonsoft.Json;
|
||||
using Orchard.Logging;
|
||||
|
||||
namespace Orchard.AuditTrail.Services {
|
||||
|
||||
/// <summary>
|
||||
/// A service responsible for serializing and deserializing audit trail event data.
|
||||
/// </summary>
|
||||
public class EventDataSerializer : Component, IEventDataSerializer {
|
||||
|
||||
/// <summary>
|
||||
/// Serialize event data.
|
||||
/// </summary>
|
||||
/// <param name="eventData">eventData to be serialized.</param>
|
||||
/// <returns>The serialized data.</returns>
|
||||
public string Serialize(IDictionary<string, object> eventData) {
|
||||
try {
|
||||
var json = JsonConvert.SerializeObject(eventData, Formatting.None);
|
||||
@@ -18,6 +28,11 @@ namespace Orchard.AuditTrail.Services {
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Deserialize event data.
|
||||
/// </summary>
|
||||
/// <param name="eventData">eventData to be deserialized.</param>
|
||||
/// <returns>The deserialized generic dictionary</returns>
|
||||
public IDictionary<string, object> Deserialize(string eventData) {
|
||||
if (String.IsNullOrWhiteSpace(eventData))
|
||||
return new Dictionary<string, object>();
|
||||
|
||||
@@ -6,7 +6,12 @@ using Orchard.Collections;
|
||||
using Orchard.Security;
|
||||
|
||||
namespace Orchard.AuditTrail.Services {
|
||||
|
||||
/// <summary>
|
||||
/// Manage the audit trail.
|
||||
/// </summary>
|
||||
public interface IAuditTrailManager : IDependency {
|
||||
|
||||
/// <summary>
|
||||
/// Gets a page of event records from the audit trail.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,8 +1,24 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Orchard.AuditTrail.Services {
|
||||
|
||||
/// <summary>
|
||||
/// A service responsible for serializing and deserializing audit trail event data.
|
||||
/// </summary>
|
||||
public interface IEventDataSerializer : IDependency {
|
||||
|
||||
/// <summary>
|
||||
/// Serialize event data.
|
||||
/// </summary>
|
||||
/// <param name="eventData">eventData to be serialized.</param>
|
||||
/// <returns>The serialized data.</returns>
|
||||
string Serialize(IDictionary<string, object> eventData);
|
||||
|
||||
/// <summary>
|
||||
/// Deserialize event data.
|
||||
/// </summary>
|
||||
/// <param name="eventData">eventData to be deserialized.</param>
|
||||
/// <returns>The deserialized generic dictionary</returns>
|
||||
IDictionary<string, object> Deserialize(string eventData);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,20 @@
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Orchard.Autoroute.Models;
|
||||
using Orchard.Autoroute.Settings;
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using Orchard.Core.Contents.Extensions;
|
||||
using Orchard.Data.Migration;
|
||||
using Orchard.Localization.Services;
|
||||
|
||||
namespace Orchard.Autoroute
|
||||
{
|
||||
public class Migrations : DataMigrationImpl {
|
||||
namespace Orchard.Autoroute {
|
||||
public class Migrations : DataMigrationImpl {
|
||||
private readonly ICultureManager _cultureManager;
|
||||
|
||||
public Migrations(ICultureManager cultureManager) {
|
||||
_cultureManager = cultureManager;
|
||||
}
|
||||
|
||||
public int Create() {
|
||||
SchemaBuilder.CreateTable("AutoroutePartRecord",
|
||||
@@ -49,5 +59,46 @@ namespace Orchard.Autoroute
|
||||
|
||||
return 4;
|
||||
}
|
||||
|
||||
public int UpdateFrom4() {
|
||||
// Adding some culture neutral patterns if they don't exist
|
||||
var autoroutePartDefinitions = ContentDefinitionManager.ListTypeDefinitions()
|
||||
.Where(t => t.Parts.Any(p => p.PartDefinition.Name.Equals(typeof(AutoroutePart).Name)))
|
||||
.Select(s => new { contentTypeName = s.Name, autoroutePart = s.Parts.First(x => x.PartDefinition.Name == "AutoroutePart") });
|
||||
|
||||
foreach (var partDefinition in autoroutePartDefinitions) {
|
||||
var settingsDictionary = partDefinition.autoroutePart.Settings;
|
||||
var settings = settingsDictionary.GetModel<AutorouteSettings>();
|
||||
|
||||
if (!settings.Patterns.Any(x => String.IsNullOrWhiteSpace(x.Culture))) {
|
||||
string siteCulture = _cultureManager.GetSiteCulture();
|
||||
List<string> newPatterns = new List<string>();
|
||||
|
||||
if (settings.Patterns.Any(x => String.Equals(x.Culture, siteCulture, StringComparison.OrdinalIgnoreCase))) {
|
||||
var siteCulturePatterns = settings.Patterns.Where(x => String.Equals(x.Culture, siteCulture, StringComparison.OrdinalIgnoreCase)).ToList();
|
||||
|
||||
foreach (RoutePattern pattern in siteCulturePatterns) {
|
||||
newPatterns.Add(String.Format("{{\"Name\":\"{0}\",\"Pattern\":\"{1}\",\"Description\":\"{2}\"}}", pattern.Name, pattern.Pattern, pattern.Description));
|
||||
}
|
||||
}
|
||||
else {
|
||||
newPatterns.Add(String.Format("{{\"Name\":\"{0}\",\"Pattern\":\"{1}\",\"Description\":\"{2}\"}}", "Title", "{Content.Slug}", "my-title"));
|
||||
}
|
||||
|
||||
if (settingsDictionary.ContainsKey("AutorouteSettings.PatternDefinitions")) {
|
||||
string oldPatterns = settingsDictionary["AutorouteSettings.PatternDefinitions"];
|
||||
if (oldPatterns.StartsWith("[") && oldPatterns.EndsWith("]"))
|
||||
newPatterns.Add(oldPatterns.Substring(1, oldPatterns.Length - 2));
|
||||
}
|
||||
|
||||
ContentDefinitionManager.AlterTypeDefinition(partDefinition.contentTypeName, cfg => cfg
|
||||
.WithPart("AutoroutePart", builder => builder
|
||||
.WithSetting("AutorouteSettings.PatternDefinitions", "[" + String.Join(",", newPatterns) + "]")
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
return 5;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@ Name: Autoroute
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardproject.net
|
||||
Version: 1.10.1
|
||||
Version: 1.10.2
|
||||
OrchardVersion: 1.9
|
||||
Description: Description for the module
|
||||
Features:
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>..\..\..\OrchardBasicCorrectness.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<LangVersion>5</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@@ -47,6 +48,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<LangVersion>5</LangVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
|
||||
@@ -30,6 +30,6 @@ using System.Security;
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.10.1")]
|
||||
[assembly: AssemblyFileVersion("1.10.1")]
|
||||
[assembly: AssemblyVersion("1.10.2")]
|
||||
[assembly: AssemblyFileVersion("1.10.2")]
|
||||
|
||||
|
||||
@@ -50,19 +50,24 @@ namespace Orchard.Autoroute.Providers.ContentDefinition {
|
||||
|
||||
public void ContentPartAttached(ContentPartAttachedContext context) {
|
||||
if (context.ContentPartName == "AutoroutePart") {
|
||||
//Create pattern and default pattern for each culture installed
|
||||
// Create pattern and default pattern for each culture installed and for the neutral culture
|
||||
|
||||
//get cultures
|
||||
// Get cultures
|
||||
var SiteCultures = _cultureManager.ListCultures().ToList();
|
||||
|
||||
//Create Patterns and DefaultPatterns
|
||||
// Adding a null culture for the culture neutral pattern
|
||||
List<string> cultures = new List<string>();
|
||||
cultures.Add(null);
|
||||
cultures.AddRange(SiteCultures);
|
||||
|
||||
// Create Patterns and DefaultPatterns
|
||||
var settings = new AutorouteSettings {
|
||||
Patterns = new List<RoutePattern>()
|
||||
};
|
||||
|
||||
List<RoutePattern> newPatterns = new List<RoutePattern>();
|
||||
List<DefaultPattern> newDefaultPatterns = new List<DefaultPattern>();
|
||||
foreach (string culture in SiteCultures) {
|
||||
foreach (string culture in cultures) {
|
||||
newPatterns.Add(new RoutePattern {
|
||||
Name = "Title",
|
||||
Description = "my-title",
|
||||
|
||||
@@ -135,35 +135,47 @@ namespace Orchard.Autoroute.Services {
|
||||
|
||||
public RoutePattern GetDefaultPattern(string contentType, string culture) {
|
||||
var settings = GetTypePartSettings(contentType).GetModel<AutorouteSettings>();
|
||||
var defaultPattern = settings.DefaultPatterns.FirstOrDefault(x => x.Culture == culture);
|
||||
var defaultPatternIndex = defaultPattern != null ? defaultPattern.PatternIndex : "0";
|
||||
|
||||
if (String.IsNullOrWhiteSpace(defaultPatternIndex))
|
||||
defaultPatternIndex = "0";
|
||||
if (settings.UseCulturePattern) {
|
||||
var defaultPatternIndex = "0";
|
||||
|
||||
if (!settings.DefaultPatterns.Any(x => String.Equals(x.Culture, culture, StringComparison.OrdinalIgnoreCase))) {
|
||||
var patternIndex = String.IsNullOrWhiteSpace(settings.DefaultPatternIndex) ? "0" : settings.DefaultPatternIndex;
|
||||
// Lazy updating from old setting.
|
||||
if (String.Equals(culture, _cultureManager.GetSiteCulture(), StringComparison.OrdinalIgnoreCase)) {
|
||||
settings.DefaultPatterns.Add(new DefaultPattern { PatternIndex = patternIndex, Culture = culture });
|
||||
return settings.Patterns.Where(x => x.Culture == null).ElementAt(Convert.ToInt32(defaultPatternIndex));
|
||||
if (!settings.DefaultPatterns.Any(x => String.Equals(x.Culture, culture, StringComparison.OrdinalIgnoreCase))) {
|
||||
// If no default pattern exists for the language return the default culture neutral pattern if it exists, else a generic pattern
|
||||
if (settings.Patterns.Any(x => String.IsNullOrEmpty(x.Culture))) {
|
||||
defaultPatternIndex = GetDefaultPatternIndex(contentType, null);
|
||||
return settings.Patterns.Where(x => String.IsNullOrEmpty(x.Culture)).ElementAt(Convert.ToInt32(defaultPatternIndex));
|
||||
}
|
||||
else {
|
||||
return new RoutePattern { Name = "Title", Description = "my-title", Pattern = "{Content.Slug}", Culture = culture };
|
||||
}
|
||||
}
|
||||
else {
|
||||
settings.DefaultPatterns.Add(new DefaultPattern { PatternIndex = "0", Culture = culture });
|
||||
return new RoutePattern { Name = "Title", Description = "my-title", Pattern = "{Content.Slug}", Culture = culture };
|
||||
|
||||
// If patterns for the specified culture exist search one of them, else search a culture neutral pattern
|
||||
var patternCultureSearch = settings.Patterns.Any(x => String.Equals(x.Culture, culture, StringComparison.OrdinalIgnoreCase)) ? culture : null;
|
||||
defaultPatternIndex = GetDefaultPatternIndex(contentType, patternCultureSearch);
|
||||
|
||||
if (settings.Patterns.Any()) {
|
||||
if (settings.Patterns.Where(x => x.Culture == patternCultureSearch).ElementAt(Convert.ToInt32(defaultPatternIndex)) != null) {
|
||||
return settings.Patterns.Where(x => x.Culture == patternCultureSearch).ElementAt(Convert.ToInt32(defaultPatternIndex));
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
// Using the culture neutral pattern
|
||||
if (settings.Patterns.Any(x => String.IsNullOrEmpty(x.Culture))) {
|
||||
var defaultPatternIndex = GetDefaultPatternIndex(contentType, null);
|
||||
|
||||
// If no default culture neutral pattern exist use the default pattern
|
||||
if (!settings.DefaultPatterns.Any(x => String.IsNullOrEmpty(x.Culture))) {
|
||||
var patternIndex = String.IsNullOrWhiteSpace(settings.DefaultPatternIndex) ? "0" : settings.DefaultPatternIndex;
|
||||
settings.DefaultPatterns.Add(new DefaultPattern { PatternIndex = patternIndex, Culture = null });
|
||||
}
|
||||
|
||||
return settings.Patterns.Where(x => String.IsNullOrEmpty(x.Culture)).ElementAt(Convert.ToInt32(defaultPatternIndex));
|
||||
}
|
||||
}
|
||||
|
||||
// Return a default pattern if set.
|
||||
var patternCultureSearch = settings.Patterns.Any(x => String.Equals(x.Culture, culture, StringComparison.OrdinalIgnoreCase)) ? culture : null;
|
||||
|
||||
if (settings.Patterns.Any()) {
|
||||
if (settings.Patterns.Where(x => x.Culture == patternCultureSearch).ElementAt(Convert.ToInt32(defaultPatternIndex)) != null) {
|
||||
return settings.Patterns.Where(x => x.Culture == patternCultureSearch).ElementAt(Convert.ToInt32(defaultPatternIndex));
|
||||
};
|
||||
}
|
||||
|
||||
// Return a default pattern if none is defined.
|
||||
// Return a default pattern if none is defined
|
||||
return new RoutePattern { Name = "Title", Description = "my-title", Pattern = "{Content.Slug}", Culture = culture };
|
||||
}
|
||||
|
||||
@@ -222,6 +234,23 @@ namespace Orchard.Autoroute.Services {
|
||||
return contentDefinition.Parts.First(x => x.PartDefinition.Name == "AutoroutePart").Settings;
|
||||
}
|
||||
|
||||
private string GetDefaultPatternIndex(string contentType, string culture) {
|
||||
var settings = GetTypePartSettings(contentType).GetModel<AutorouteSettings>();
|
||||
|
||||
DefaultPattern defaultPattern = null;
|
||||
if (String.IsNullOrEmpty(culture))
|
||||
defaultPattern = settings.DefaultPatterns.FirstOrDefault(x => String.IsNullOrEmpty(x.Culture));
|
||||
else
|
||||
defaultPattern = settings.DefaultPatterns.FirstOrDefault(x => String.Equals(x.Culture, culture, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
var defaultPatternIndex = defaultPattern != null ? defaultPattern.PatternIndex : "0";
|
||||
|
||||
if (String.IsNullOrWhiteSpace(defaultPatternIndex))
|
||||
defaultPatternIndex = "0";
|
||||
|
||||
return defaultPatternIndex;
|
||||
}
|
||||
|
||||
private static int? GetSlugVersion(string path, string potentialConflictingPath) {
|
||||
int v;
|
||||
var slugParts = potentialConflictingPath.Split(new[] { path }, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace Orchard.Autoroute.Services {
|
||||
return false;
|
||||
}
|
||||
|
||||
return a.Keys.All(x => String.Equals(a[x], b[x].ToString(), StringComparison.OrdinalIgnoreCase));
|
||||
return a.Keys.All(x => String.Equals(a[x], Convert.ToString(b[x]), StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,56 +28,55 @@ namespace Orchard.Autoroute.Settings {
|
||||
|
||||
var settings = definition.Settings.GetModel<AutorouteSettings>();
|
||||
|
||||
//get cultures
|
||||
// Get cultures
|
||||
settings.SiteCultures = _cultureManager.ListCultures().ToList();
|
||||
//get default site culture
|
||||
// Get default site culture
|
||||
settings.DefaultSiteCulture = _cultureManager.GetSiteCulture();
|
||||
|
||||
//if a culture is not set on the pattern we set it to the default site culture for backward compatibility
|
||||
if (!settings.Patterns.Any(x => String.Equals(x.Culture, settings.DefaultSiteCulture, StringComparison.OrdinalIgnoreCase))) {
|
||||
foreach (RoutePattern pattern in settings.Patterns.Where(x => String.IsNullOrWhiteSpace(x.Culture))) {
|
||||
settings.Patterns.Where(x => x.GetHashCode() == pattern.GetHashCode()).FirstOrDefault().Culture = settings.DefaultSiteCulture;
|
||||
}
|
||||
}
|
||||
|
||||
//Adding Patterns for the UI
|
||||
// Adding Patterns for the UI
|
||||
List<RoutePattern> newPatterns = new List<RoutePattern>();
|
||||
|
||||
// Adding a null culture for the culture neutral pattern
|
||||
List<string> cultures = new List<string>();
|
||||
cultures.Add(null);
|
||||
cultures.AddRange(settings.SiteCultures);
|
||||
|
||||
int current = 0;
|
||||
foreach (string culture in settings.SiteCultures) {
|
||||
foreach (string culture in cultures) {
|
||||
// Adding all existing patterns for the culture
|
||||
foreach (RoutePattern routePattern in settings.Patterns.Where(x => String.Equals(x.Culture, culture, StringComparison.OrdinalIgnoreCase))) {
|
||||
if (settings.Patterns.Any(x => String.Equals(x.Culture, culture, StringComparison.OrdinalIgnoreCase))) {
|
||||
newPatterns.Add(settings.Patterns[current]);
|
||||
} else {
|
||||
newPatterns.Add(new RoutePattern {
|
||||
Name = "Title",
|
||||
Description = "my-title",
|
||||
Pattern = "{Content.Slug}",
|
||||
Culture = settings.DefaultSiteCulture
|
||||
});
|
||||
}
|
||||
newPatterns.Add(settings.Patterns[current]);
|
||||
current++;
|
||||
}
|
||||
|
||||
//We add a pattern for each culture if there is none
|
||||
// Adding a pattern for each culture if there is none
|
||||
if (!settings.Patterns.Where(x => String.Equals(x.Culture, culture, StringComparison.OrdinalIgnoreCase)).Any()) {
|
||||
newPatterns.Add(new RoutePattern { Culture = culture, Name = "Title", Description = "my-title", Pattern = "{Content.Slug}" });
|
||||
}
|
||||
|
||||
//we add a new empty line for each culture
|
||||
// Adding a new empty line for each culture
|
||||
newPatterns.Add(new RoutePattern { Culture = culture, Name = null, Description = null, Pattern = null });
|
||||
|
||||
// if the content type has no defaultPattern for autoroute, then assign one
|
||||
if (!settings.DefaultPatterns.Any(x => String.Equals(x.Culture, culture, StringComparison.OrdinalIgnoreCase))) {
|
||||
//if we are in the default culture check the old setting
|
||||
// If the content type has no defaultPattern for autoroute, assign one
|
||||
bool defaultPatternExists = false;
|
||||
if (String.IsNullOrEmpty(culture))
|
||||
defaultPatternExists = settings.DefaultPatterns.Any(x => String.IsNullOrEmpty(x.Culture));
|
||||
else
|
||||
defaultPatternExists = settings.DefaultPatterns.Any(x => String.Equals(x.Culture, culture, StringComparison.OrdinalIgnoreCase));
|
||||
|
||||
if (!defaultPatternExists) {
|
||||
// If in the default culture check the old setting
|
||||
if (String.Equals(culture, _cultureManager.GetSiteCulture(), StringComparison.OrdinalIgnoreCase)) {
|
||||
var defaultPatternIndex = settings.DefaultPatternIndex;
|
||||
if (!String.IsNullOrWhiteSpace(defaultPatternIndex)) {
|
||||
var patternIndex = defaultPatternIndex;
|
||||
settings.DefaultPatterns.Add(new DefaultPattern { Culture = settings.DefaultSiteCulture, PatternIndex = patternIndex });
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
settings.DefaultPatterns.Add(new DefaultPattern { PatternIndex = "0", Culture = culture });
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
settings.DefaultPatterns.Add(new DefaultPattern { PatternIndex = "0", Culture = culture });
|
||||
}
|
||||
}
|
||||
@@ -96,25 +95,51 @@ namespace Orchard.Autoroute.Settings {
|
||||
Patterns = new List<RoutePattern>()
|
||||
};
|
||||
|
||||
//get cultures
|
||||
// Get cultures
|
||||
settings.SiteCultures = _cultureManager.ListCultures().ToList();
|
||||
|
||||
if (updateModel.TryUpdateModel(settings, "AutorouteSettings", null, null)) {
|
||||
//TODO need to add validations client and/or server side here
|
||||
// remove empty patterns
|
||||
|
||||
// If some default pattern is an empty pattern set it to the first pattern for the language
|
||||
List<DefaultPattern> newDefaultPatterns = new List<DefaultPattern>();
|
||||
|
||||
foreach (var defaultPattern in settings.DefaultPatterns) {
|
||||
RoutePattern correspondingPattern = null;
|
||||
|
||||
if (string.IsNullOrEmpty(defaultPattern.Culture))
|
||||
correspondingPattern = settings.Patterns.Where(x => String.IsNullOrEmpty(x.Culture)).ElementAt(Convert.ToInt32(defaultPattern.PatternIndex));
|
||||
else
|
||||
correspondingPattern = settings.Patterns.Where(x => String.Equals(x.Culture, defaultPattern.Culture, StringComparison.OrdinalIgnoreCase)).ElementAt(Convert.ToInt32(defaultPattern.PatternIndex));
|
||||
|
||||
if (String.IsNullOrWhiteSpace(correspondingPattern.Name) && String.IsNullOrWhiteSpace(correspondingPattern.Pattern) && String.IsNullOrWhiteSpace(correspondingPattern.Description))
|
||||
newDefaultPatterns.Add(new DefaultPattern { Culture = defaultPattern.Culture, PatternIndex = "0" });
|
||||
else
|
||||
newDefaultPatterns.Add(defaultPattern);
|
||||
}
|
||||
|
||||
settings.DefaultPatterns = newDefaultPatterns;
|
||||
|
||||
// Remove empty patterns
|
||||
var patterns = settings.Patterns;
|
||||
patterns.RemoveAll(p => String.IsNullOrWhiteSpace(p.Name) && String.IsNullOrWhiteSpace(p.Pattern) && String.IsNullOrWhiteSpace(p.Description));
|
||||
|
||||
//If there is no default pattern for each culture we set default ones
|
||||
// Adding a null culture for the culture neutral pattern
|
||||
List<string> cultures = new List<string>();
|
||||
cultures.Add(null);
|
||||
cultures.AddRange(settings.SiteCultures);
|
||||
|
||||
//If there is no pattern for some culture create a default one
|
||||
List<RoutePattern> newPatterns = new List<RoutePattern>();
|
||||
int current = 0;
|
||||
foreach (string culture in settings.SiteCultures) {
|
||||
foreach (string culture in cultures) {
|
||||
if (settings.Patterns.Any(x => String.Equals(x.Culture, culture, StringComparison.OrdinalIgnoreCase))) {
|
||||
foreach (RoutePattern routePattern in settings.Patterns.Where(x => String.Equals(x.Culture, culture, StringComparison.OrdinalIgnoreCase))) {
|
||||
newPatterns.Add(settings.Patterns[current]);
|
||||
current++;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
else {
|
||||
newPatterns.Add(new RoutePattern {
|
||||
Name = "Title",
|
||||
Description = "my-title",
|
||||
@@ -128,7 +153,7 @@ namespace Orchard.Autoroute.Settings {
|
||||
|
||||
settings.Patterns = newPatterns;
|
||||
|
||||
// update the settings builder
|
||||
// Update the settings builder
|
||||
settings.Build(builder);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,15 @@
|
||||
@model Orchard.Autoroute.Settings.AutorouteSettings
|
||||
@using Orchard.Utility.Extensions;
|
||||
|
||||
@{
|
||||
Script.Require("AutorouteBrowser");
|
||||
Style.Require("AutorouteSettings");
|
||||
|
||||
int patternCount = 0;
|
||||
int patternCultureCount = 0;
|
||||
|
||||
List<string> cultures = new List<string>();
|
||||
cultures.Add(null);
|
||||
cultures.AddRange(Model.SiteCultures);
|
||||
}
|
||||
<fieldset>
|
||||
<div>
|
||||
@@ -40,10 +44,10 @@
|
||||
int i = 1;
|
||||
string cssClass = "";
|
||||
}
|
||||
<li class="first selected"><a class="culture" href="#cat-@Model.DefaultSiteCulture">@Model.DefaultSiteCulture</a></li>
|
||||
@foreach (var culture in Model.SiteCultures) {
|
||||
if (culture != Model.DefaultSiteCulture) {
|
||||
cssClass = i == Model.SiteCultures.Count - 1 ? "last" : "middle";
|
||||
<li class="first selected"><a class="culture" href="#cat-culture-neutral">@T("All cultures")</a></li>
|
||||
@foreach (var culture in cultures) {
|
||||
if (!String.IsNullOrEmpty(culture)) {
|
||||
cssClass = i == cultures.Count - 1 ? "last" : "middle";
|
||||
<li class="@cssClass" style="@(Model.UseCulturePattern == false ? "display:none;" : "")"><a class="culture" href="#cat-@culture">@culture</a></li>
|
||||
i++;
|
||||
}
|
||||
@@ -51,8 +55,8 @@
|
||||
</ul>
|
||||
</div>
|
||||
<div id="content">
|
||||
@foreach (var culture in Model.SiteCultures) {
|
||||
<fieldset id="cat-@culture" class="items @(culture == Model.DefaultSiteCulture ? "default" : "")" style="@(culture == Model.DefaultSiteCulture ? "display:block;" : "display:none;")">
|
||||
@foreach (var culture in cultures) {
|
||||
<fieldset id="cat-@(String.IsNullOrEmpty(culture) ? "culture-neutral" : culture)" class="items @(String.IsNullOrEmpty(culture) ? "default" : "")" style="@(String.IsNullOrEmpty(culture) ? "display:block;" : "display:none;")">
|
||||
<table class="autoroute-settings-patterns">
|
||||
<tr>
|
||||
<th class="autoroute-settings-default">@T("Default")</th>
|
||||
@@ -63,7 +67,7 @@
|
||||
</tr>
|
||||
@for (int index = 0; index < Model.Patterns.Where(x => x.Culture == culture).Count(); index++) {
|
||||
<tr>
|
||||
<td>@Html.RadioButtonFor(m => m.DefaultPatterns[Model.SiteCultures.IndexOf(culture)].Culture, culture + "|" + patternCultureCount, patternCultureCount.ToString() == Model.DefaultPatterns[Model.SiteCultures.IndexOf(culture)].PatternIndex ? new { @checked = "checked" } : null)</td>
|
||||
<td>@Html.RadioButtonFor(m => m.DefaultPatterns[cultures.IndexOf(culture)].Culture, culture + "|" + patternCultureCount, patternCultureCount.ToString() == Model.DefaultPatterns[cultures.IndexOf(culture)].PatternIndex ? new { @checked = "checked" } : null)</td>
|
||||
<td>@Html.TextBoxFor(m => m.Patterns[patternCount].Name, new { @class = "text" })</td>
|
||||
<td>@Html.TextBoxFor(m => m.Patterns[patternCount].Pattern, new { @class = "tokenized text" })</td>
|
||||
<td>@Html.TextBoxFor(m => m.Patterns[patternCount].Description, new { @class = "text" })</td>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
AntiForgery: enabled
|
||||
Author: Microsoft Open Technologies, Inc
|
||||
Website: http://msopentech.com
|
||||
Version: 1.10.1
|
||||
Version: 1.10.2
|
||||
OrchardVersion: 1.9
|
||||
Description: Provides integration of Microsoft Azure Media Services functionality into Orchard.
|
||||
Features:
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>..\..\..\OrchardBasicCorrectness.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<LangVersion>5</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@@ -46,6 +47,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<LangVersion>5</LangVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="FluentNHibernate, Version=2.0.3.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
|
||||
@@ -32,6 +32,6 @@ using System.Security;
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.10.1")]
|
||||
[assembly: AssemblyFileVersion("1.10.1")]
|
||||
[assembly: AssemblyVersion("1.10.2")]
|
||||
[assembly: AssemblyFileVersion("1.10.2")]
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
<CodeAnalysisRuleSet>..\OrchardBasicCorrectness.ruleset</CodeAnalysisRuleSet>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<LangVersion>5</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@@ -55,6 +56,7 @@
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<LangVersion>5</LangVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Autofac">
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardproject.net
|
||||
Version: 1.10.1
|
||||
Version: 1.10.2
|
||||
OrchardVersion: 1.9
|
||||
Description: Provides a set of Orchard service implementations targeting Microsoft Azure services.
|
||||
Category: Hosting
|
||||
|
||||
@@ -36,6 +36,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>..\..\..\OrchardBasicCorrectness.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<LangVersion>5</LangVersion>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
@@ -46,6 +47,7 @@
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
<LangVersion>5</LangVersion>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Iesi.Collections, Version=4.0.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
|
||||
|
||||
@@ -31,6 +31,6 @@ using System.Security;
|
||||
//
|
||||
// You can specify all the values or you can default the Revision and Build Numbers
|
||||
// by using the '*' as shown below:
|
||||
[assembly: AssemblyVersion("1.10.1")]
|
||||
[assembly: AssemblyFileVersion("1.10.1")]
|
||||
[assembly: AssemblyVersion("1.10.2")]
|
||||
[assembly: AssemblyFileVersion("1.10.2")]
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace Orchard.Blogs {
|
||||
}
|
||||
|
||||
private void BuildMenu(NavigationItemBuilder menu) {
|
||||
var blogs = _blogService.Get().Where(x => _authorizationService.TryCheckAccess(Permissions.MetaListOwnBlogs, _workContextAccessor.GetContext().CurrentUser, x)).ToArray();
|
||||
var blogs = _blogService.Get().Where(x => _authorizationService.TryCheckAccess(Permissions.MetaListBlogs, _workContextAccessor.GetContext().CurrentUser, x)).ToArray();
|
||||
var blogCount = blogs.Count();
|
||||
var singleBlog = blogCount == 1 ? blogs.ElementAt(0) : null;
|
||||
|
||||
|
||||
@@ -1,36 +1,24 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using Orchard.Blogs.Models;
|
||||
using Orchard.Blogs.Services;
|
||||
using Orchard.Commands;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Aspects;
|
||||
using Orchard.Core.Common.Models;
|
||||
using Orchard.Security;
|
||||
using Orchard.Settings;
|
||||
using Orchard.Widgets.Models;
|
||||
using Orchard.Widgets.Services;
|
||||
|
||||
namespace Orchard.Blogs.Commands {
|
||||
public class BlogWidgetCommands : DefaultOrchardCommandHandler {
|
||||
private readonly IWidgetsService _widgetsService;
|
||||
private readonly IWidgetCommandsService _widgetCommandsService;
|
||||
private readonly IBlogService _blogService;
|
||||
private readonly ISiteService _siteService;
|
||||
private readonly IMembershipService _membershipService;
|
||||
private readonly IContentManager _contentManager;
|
||||
|
||||
private BlogPart blog;
|
||||
|
||||
public BlogWidgetCommands(
|
||||
IWidgetsService widgetsService,
|
||||
IWidgetCommandsService widgetCommandsService,
|
||||
IBlogService blogService,
|
||||
ISiteService siteService,
|
||||
IMembershipService membershipService,
|
||||
IContentManager contentManager) {
|
||||
_widgetsService = widgetsService;
|
||||
_widgetCommandsService = widgetCommandsService;
|
||||
_blogService = blogService;
|
||||
_siteService = siteService;
|
||||
_membershipService = membershipService;
|
||||
_contentManager = contentManager;
|
||||
|
||||
RenderTitle = true;
|
||||
@@ -75,11 +63,21 @@ namespace Orchard.Blogs.Commands {
|
||||
public void CreateRecentBlogPostsWidget() {
|
||||
var type = "RecentBlogPosts";
|
||||
|
||||
var widget = CreateStandardWidget(type);
|
||||
// Check any custom parameters that could cause creating the widget to fail.
|
||||
blog = GetBlog(BlogId, BlogPath);
|
||||
if (blog == null) {
|
||||
Context.Output.WriteLine(T("Creating {0} widget failed: blog was not found.", type));
|
||||
return;
|
||||
}
|
||||
|
||||
// Create the widget using the standard parameters.
|
||||
var widget = _widgetCommandsService.CreateBaseWidget(
|
||||
Context, type, Title, Name, Zone, Position, Layer, Identity, RenderTitle, Owner, null, false, null);
|
||||
if (widget == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Publish the successfully created widget.
|
||||
widget.As<RecentBlogPostsPart>().BlogId = blog.Id;
|
||||
|
||||
// Setting count to 0 means all posts. It's an optional parameter and defaults to 5.
|
||||
@@ -90,7 +88,8 @@ namespace Orchard.Blogs.Commands {
|
||||
}
|
||||
}
|
||||
|
||||
_contentManager.Publish(widget.ContentItem);
|
||||
// Publish the successfully created widget.
|
||||
_widgetCommandsService.Publish(widget);
|
||||
Context.Output.WriteLine(T("{0} widget created successfully.", type).Text);
|
||||
}
|
||||
|
||||
@@ -100,64 +99,28 @@ namespace Orchard.Blogs.Commands {
|
||||
public void CreateBlogArchivesWidget() {
|
||||
var type = "BlogArchives";
|
||||
|
||||
var widget = CreateStandardWidget(type);
|
||||
// Check any custom parameters that could cause creating the widget to fail.
|
||||
blog = GetBlog(BlogId, BlogPath);
|
||||
if (blog == null) {
|
||||
Context.Output.WriteLine(T("Creating {0} widget failed: blog was not found.", type));
|
||||
return;
|
||||
}
|
||||
|
||||
// Create the widget using the standard parameters.
|
||||
var widget = _widgetCommandsService.CreateBaseWidget(
|
||||
Context, type, Title, Name, Zone, Position, Layer, Identity, RenderTitle, Owner, null, false, null);
|
||||
if (widget == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Set the custom parameters.
|
||||
widget.As<BlogArchivesPart>().BlogId = blog.Id;
|
||||
|
||||
_contentManager.Publish(widget.ContentItem);
|
||||
// Publish the successfully created widget.
|
||||
_widgetCommandsService.Publish(widget);
|
||||
Context.Output.WriteLine(T("{0} widget created successfully.", type).Text);
|
||||
}
|
||||
|
||||
private WidgetPart CreateStandardWidget(string type) {
|
||||
var widgetTypeNames = _widgetsService.GetWidgetTypeNames().ToList();
|
||||
if (!widgetTypeNames.Contains(type)) {
|
||||
Context.Output.WriteLine(T("Creating widget failed: type {0} was not found. Supported widget types are: {1}.",
|
||||
type,
|
||||
string.Join(" ", widgetTypeNames)));
|
||||
return null;
|
||||
}
|
||||
|
||||
var layer = GetLayer(Layer);
|
||||
if (layer == null) {
|
||||
Context.Output.WriteLine(T("Creating {0} widget failed: layer {1} was not found.", type, Layer));
|
||||
return null;
|
||||
}
|
||||
|
||||
blog = GetBlog(BlogId, BlogPath);
|
||||
if (blog == null) {
|
||||
Context.Output.WriteLine(T("Creating {0} widget failed: blog was not found.", type));
|
||||
return null;
|
||||
}
|
||||
|
||||
var widget = _widgetsService.CreateWidget(layer.ContentItem.Id, type, T(Title).Text, Position, Zone);
|
||||
|
||||
if (!String.IsNullOrWhiteSpace(Name)) {
|
||||
widget.Name = Name.Trim();
|
||||
}
|
||||
|
||||
widget.RenderTitle = RenderTitle;
|
||||
|
||||
if (String.IsNullOrEmpty(Owner)) {
|
||||
Owner = _siteService.GetSiteSettings().SuperUser;
|
||||
}
|
||||
var owner = _membershipService.GetUser(Owner);
|
||||
widget.As<ICommonPart>().Owner = owner;
|
||||
|
||||
if (widget.Has<IdentityPart>() && !String.IsNullOrEmpty(Identity)) {
|
||||
widget.As<IdentityPart>().Identifier = Identity;
|
||||
}
|
||||
|
||||
return widget;
|
||||
}
|
||||
|
||||
private LayerPart GetLayer(string layer) {
|
||||
var layers = _widgetsService.GetLayers();
|
||||
return layers.FirstOrDefault(layerPart => String.Equals(layerPart.Name, layer, StringComparison.OrdinalIgnoreCase));
|
||||
}
|
||||
|
||||
private BlogPart GetBlog(int blogId, string blogPath) {
|
||||
return _contentManager.Get<BlogPart>(blogId) ?? _blogService.Get(blogPath);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
AntiForgery: enabled
|
||||
Author: The Orchard Team
|
||||
Website: http://orchardproject.net
|
||||
Version: 1.10.1
|
||||
Version: 1.10.2
|
||||
OrchardVersion: 1.9
|
||||
Description: The Orchard Blogs module is implementing basic blogging features.
|
||||
FeatureDescription: A simple web log.
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user