Compare commits

..

2 Commits

Author SHA1 Message Date
Kegan Maher
5ad9f50471 consistent permission checks for working with Blog Posts 2016-10-27 12:21:07 -07:00
Kegan Maher
b25b13aa83 check MetaListOwnBlogs for consistency
Fixes #4767
2016-10-27 12:21:07 -07:00
441 changed files with 1346 additions and 3506 deletions

View File

@@ -1,29 +1,22 @@
@echo off
for /f "usebackq tokens=1* delims=: " %%i in (`lib\vswhere\vswhere -latest -version "[15.0,16.0)" -requires Microsoft.Component.MSBuild`) do (
if /i "%%i"=="installationPath" (
set InstallDir=%%j
if exist "%InstallDir%\MSBuild\15.0\Bin\MSBuild.exe" (
echo "Using MSBuild from Visual Studio 2017"
set msbuild="%InstallDir%\MSBuild\15.0\Bin\MSBuild.exe"
goto build
)
)
)
FOR %%b in (
"%VS140COMNTOOLS%\vsvars32.bat"
"%VS120COMNTOOLS%\vsvars32.bat"
"%VS110COMNTOOLS%\vsvars32.bat"
"%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"
) do (
if exist %%b (
echo "Using MSBuild from %%b"
call %%b
set msbuild="msbuild"
goto build
call %%b x86
goto build
)
)
echo "Unable to detect suitable environment. Build may not succeed."
:build
@@ -38,8 +31,6 @@ IF "%solution%" == "" SET solution=src\Orchard.sln
lib\nuget\nuget.exe restore %solution%
%msbuild% /t:%target% %project% /p:Solution=%solution% /m
:end
msbuild /t:%target% %project% /p:Solution=%solution% /m
pause

View File

@@ -167,12 +167,11 @@
</Target>
<Target Name="Spec" DependsOnTargets="Package-Stage">
<!-- Running SpecFlow tests -->
<CreateItem Include="$(CompileFolder)\*.Specs.*dll">
<CreateItem Include="$(CompileFolder)\*.Specs.dll">
<Output TaskParameter="Include" ItemName="SpecAssemblies" />
</CreateItem>
<NUnit Assemblies="@(SpecAssemblies)" ToolPath="@(NUnitPackageToolsFolder)" WorkingDirectory="$(CompileFolder)" OutputXmlFile="$(BuildFolder)\Orchard.Specs.xml" />
<NUnit Assemblies="@(SpecAssemblies)" ToolPath="$(NUnitPackageToolsFolder)" />
</Target>
<!-- Packaging (Stage) -->

View File

@@ -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.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*).
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*).
We invite participation by the developer community in shaping the projects 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.

Binary file not shown.

View File

@@ -42,7 +42,6 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<LangVersion>5</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -52,7 +51,6 @@
<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">

View File

@@ -36,7 +36,6 @@
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
<LangVersion>5</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -48,7 +47,6 @@
<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">

View File

@@ -44,7 +44,6 @@
<CodeAnalysisRuleSet>..\OrchardBasicCorrectness.ruleset</CodeAnalysisRuleSet>
<PlatformTarget>AnyCPU</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
<LangVersion>5</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -56,7 +55,6 @@
<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">

View File

@@ -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.2")]
[assembly: AssemblyFileVersion("1.10.2")]
[assembly: AssemblyVersion("1.10.1")]
[assembly: AssemblyFileVersion("1.10.1")]

View File

@@ -44,7 +44,6 @@
<PlatformTarget>AnyCPU</PlatformTarget>
<CodeAnalysisRuleSet>..\OrchardBasicCorrectness.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
<LangVersion>5</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -55,7 +54,6 @@
<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">

View File

@@ -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.2")]
[assembly: AssemblyFileVersion("1.10.2")]
[assembly: AssemblyVersion("1.10.1")]
[assembly: AssemblyFileVersion("1.10.1")]

View File

@@ -44,7 +44,6 @@
<CodeAnalysisRuleSet>..\OrchardBasicCorrectness.ruleset</CodeAnalysisRuleSet>
<PlatformTarget>AnyCPU</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
<LangVersion>5</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -56,7 +55,6 @@
<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">

View File

@@ -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.2")]
[assembly: AssemblyFileVersion("1.10.2")]
[assembly: AssemblyVersion("1.10.1")]
[assembly: AssemblyFileVersion("1.10.1")]

View File

@@ -14,6 +14,7 @@ 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;
@@ -68,7 +69,6 @@ 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);

View File

@@ -9,7 +9,6 @@ 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 {
@@ -36,7 +35,6 @@ 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>();

View File

@@ -8,7 +8,6 @@ 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 {
@@ -35,7 +34,6 @@ 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>();

View File

@@ -44,7 +44,6 @@
<CodeAnalysisRuleSet>..\OrchardBasicCorrectness.ruleset</CodeAnalysisRuleSet>
<PlatformTarget>AnyCPU</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
<LangVersion>5</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -56,7 +55,6 @@
<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">

View File

@@ -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.2")]
[assembly: AssemblyFileVersion("1.10.2")]
[assembly: AssemblyVersion("1.10.1")]
[assembly: AssemblyFileVersion("1.10.1")]

View File

@@ -17,9 +17,8 @@ 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]

View File

@@ -205,8 +205,7 @@ namespace Orchard.Tests.Modules.Users.Controllers {
@"Ima.Fool@example.com",
@"""Ima.Fool""@example.com",
@"""Ima Fool""@example.com",
"2xxx1414@i.ua",
"Dreißig-öffentliche-Ämter-in-Übersee@Beispiel.de"
"2xxx1414@i.ua"
)]
string email)
{

View File

@@ -39,21 +39,5 @@ 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}\""]);
}
}
}

View File

@@ -44,7 +44,6 @@
<CodeAnalysisRuleSet>..\OrchardBasicCorrectness.ruleset</CodeAnalysisRuleSet>
<PlatformTarget>AnyCPU</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
<LangVersion>5</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -56,7 +55,6 @@
<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">

View File

@@ -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.2")]
[assembly: AssemblyFileVersion("1.10.2")]
[assembly: AssemblyVersion("1.10.1")]
[assembly: AssemblyFileVersion("1.10.1")]

View File

@@ -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,7 +21,6 @@ namespace Orchard.Tests.Utility.Extensions {
var request = new StubHttpRequest();
Assert.That(request.IsLocalUrl("//"), Is.False);
Assert.That(request.IsLocalUrl(" //"), Is.False);
}
[Test]
@@ -29,7 +28,6 @@ namespace Orchard.Tests.Utility.Extensions {
var request = new StubHttpRequest();
Assert.That(request.IsLocalUrl("/\\"), Is.False);
Assert.That(request.IsLocalUrl(" /\\"), Is.False);
}
[Test]
@@ -37,7 +35,6 @@ 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);
@@ -49,18 +46,6 @@ 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]

View File

@@ -23,7 +23,6 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
<LangVersion>5</LangVersion>
<UseVSHostingProcess>false</UseVSHostingProcess>
<CodeAnalysisRuleSet>..\OrchardBasicCorrectness.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
@@ -35,7 +34,6 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
<LangVersion>5</LangVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />

View File

@@ -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.2")]
[assembly: AssemblyFileVersion("1.10.2")]
[assembly: AssemblyVersion("1.10.1")]
[assembly: AssemblyFileVersion("1.10.1")]
// Enable web application to call this assembly in Full Trust
[assembly: AllowPartiallyTrustedCallers]

View File

@@ -44,7 +44,6 @@
<CodeAnalysisRuleSet>..\OrchardBasicCorrectness.ruleset</CodeAnalysisRuleSet>
<PlatformTarget>AnyCPU</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
<LangVersion>5</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -55,7 +54,6 @@
<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">

View File

@@ -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.2")]
[assembly: AssemblyFileVersion("1.10.2")]
[assembly: AssemblyVersion("1.10.1")]
[assembly: AssemblyFileVersion("1.10.1")]

View File

@@ -26,8 +26,8 @@
-->
<!--
<component instance-scope="per-lifetime-scope"
type="Orchard.Data.TransactionManager, Orchard.Framework"
service="Orchard.Data.ITransactionManager">
type="Orchard.Data.SessionLocator, Orchard.Framework"
service="Orchard.Data.ISessionLocator">
<properties>
<property name="IsolationLevel" value="ReadUncommitted" />
</properties>

View File

@@ -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() && String.IsNullOrEmpty(field.Value) ? settings.DefaultValue : field.Value;
var text = part.IsNew() ? settings.DefaultValue : field.Value;
var viewModel = new TextFieldDriverViewModel {
Field = field,
@@ -84,7 +84,8 @@ namespace Orchard.Core.Common.Drivers {
}
protected override void Exporting(ContentPart part, TextField field, ExportContentContext context) {
context.Element(field.FieldDefinition.Name + "." + field.Name).SetAttributeValue("Text", field.Value);
if (!String.IsNullOrEmpty(field.Value))
context.Element(field.FieldDefinition.Name + "." + field.Name).SetAttributeValue("Text", field.Value);
}
protected override void Describe(DescribeMembersContext context) {

View File

@@ -2,7 +2,7 @@
AntiForgery: enabled
Author: The Orchard Team
Website: http://orchardproject.net
Version: 1.10.2
Version: 1.10.1
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.

View File

@@ -2,7 +2,7 @@
AntiForgery: enabled
Author: The Orchard Team
Website: http://orchardproject.net
Version: 1.10.2
Version: 1.10.1
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.

View File

@@ -3,19 +3,16 @@ 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, IAuthorizer authorizer) {
public AdminMenu(IContentDefinitionManager contentDefinitionManager, IContentManager contentManager) {
_contentDefinitionManager = contentDefinitionManager;
_contentManager = contentManager;
_authorizer = authorizer;
}
public Localizer T { get; set; }
@@ -23,17 +20,10 @@ namespace Orchard.Core.Contents {
public void GetNavigation(NavigationBuilder builder) {
var contentTypeDefinitions = _contentDefinitionManager.ListTypeDefinitions().OrderBy(d => d.Name);
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;
}
}
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 contentTypes = contentTypeDefinitions.Where(ctd => ctd.Settings.GetModel<ContentTypeSettings>().Creatable).OrderBy(ctd => ctd.DisplayName);
if (contentTypes.Any()) {
builder.Add(T("New"), "-1", menu => {

View File

@@ -2,7 +2,7 @@
AntiForgery: enabled
Author: The Orchard Team
Website: http://orchardproject.net
Version: 1.10.2
Version: 1.10.1
OrchardVersion: 1.9
Description: The contents module enables the creation of custom content types.
Features:

View File

@@ -2,7 +2,7 @@
AntiForgery: enabled
Author: The Orchard Team
Website: http://orchardproject.net
Version: 1.10.2
Version: 1.10.1
OrchardVersion: 1.9
Description: The dashboard module is providing the dashboard screen of the admininstration UI of the application.
FeatureDescription: Standard admin dashboard.

View File

@@ -2,7 +2,7 @@
AntiForgery: enabled
Author: The Orchard Team
Website: http://orchardproject.net
Version: 1.10.2
Version: 1.10.1
OrchardVersion: 1.9
Description: The Feeds module is providing RSS feeds to content items.
FeatureDescription: RSS feeds for content items.

View File

@@ -2,7 +2,7 @@
AntiForgery: enabled
Author: The Orchard Team
Website: http://orchardproject.net
Version: 1.10.2
Version: 1.10.1
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.

View File

@@ -37,7 +37,6 @@
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>..\..\OrchardBasicCorrectness.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
<LangVersion>5</LangVersion>
<UseVSHostingProcess>false</UseVSHostingProcess>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
@@ -49,7 +48,6 @@
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
<LangVersion>5</LangVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
@@ -399,6 +397,7 @@
</ItemGroup>
<ItemGroup>
<Folder Include="App_Data\" />
<Folder Include="Views\Gamma\" />
</ItemGroup>
<ItemGroup>
<Content Include="Contents\Views\Content.cshtml" />

View File

@@ -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.2")]
[assembly: AssemblyFileVersion("1.10.2")]
[assembly: AssemblyVersion("1.10.1")]
[assembly: AssemblyFileVersion("1.10.1")]

View File

@@ -2,7 +2,7 @@
AntiForgery: enabled
Author: The Orchard Team
Website: http://orchardproject.net
Version: 1.10.2
Version: 1.10.1
OrchardVersion: 1.9
Description: The dashboard module is providing the reports screen of the application.
FeatureDescription: Reports management.

View File

@@ -2,7 +2,7 @@
AntiForgery: enabled
Author: The Orchard Team
Website: http://orchardproject.net
Version: 1.10.2
Version: 1.10.1
OrchardVersion: 1.9
Description: The scheduling module enables background task scheduling.
FeatureDescription: Scheduled background tasks.

View File

@@ -189,7 +189,7 @@ namespace Orchard.Core.Settings.Metadata {
private void Apply(ContentTypeDefinition model, ContentTypeDefinitionRecord record) {
record.DisplayName = model.DisplayName;
record.Settings = Compose(_settingsFormatter.Map(model.Settings));
record.Settings = _settingsFormatter.Map(model.Settings).ToString();
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 = Compose(_settingsFormatter.Map(model.Settings));
record.Settings = _settingsFormatter.Map(model.Settings).ToString();
var toRemove = record.ContentPartFieldDefinitionRecords
.Where(partFieldDefinitionRecord => model.Fields.All(partField => partFieldDefinitionRecord.Name != partField.Name))

View File

@@ -2,7 +2,7 @@
AntiForgery: enabled
Author: The Orchard Team
Website: http://orchardproject.net
Version: 1.10.2
Version: 1.10.1
OrchardVersion: 1.9
Description: The settings module creates site settings that other modules can contribute to.
FeatureDescription: Site settings.

View File

@@ -2,7 +2,7 @@
AntiForgery: enabled
Author: The Orchard Team
Website: http://orchardproject.net
Version: 1.10.2
Version: 1.10.1
OrchardVersion: 1.9
Description: The shapes module contains core shape templates and display hooks.
FeatureDescription: Core shape templates and display hooks.

View File

@@ -2,7 +2,7 @@
AntiForgery: enabled
Author: The Orchard Team
Website: http://orchardproject.net
Version: 1.10.2
Version: 1.10.1
OrchardVersion: 1.9
Description: The title module enables content items to have titles.
FeatureDescription: Title content part.

View File

@@ -2,7 +2,7 @@
AntiForgery: enabled
Author: The Orchard Team
Website: http://orchardproject.net
Version: 1.10.2
Version: 1.10.1
OrchardVersion: 1.9
Description: The XmlRpc module enables creation of contents from client applications such as LiveWriter.
FeatureDescription: XML-RPC opt-in implementation.

View File

@@ -1,69 +0,0 @@
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;
}
}
}

View File

@@ -1,39 +0,0 @@
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" });
}
}
}

View File

@@ -38,7 +38,6 @@
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>..\..\..\OrchardBasicCorrectness.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
<LangVersion>5</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -48,7 +47,6 @@
<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">
@@ -99,12 +97,8 @@
<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" />
@@ -114,7 +108,6 @@
<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" />
@@ -134,13 +127,6 @@
<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>

View File

@@ -1,6 +0,0 @@
namespace Lucene.Models {
public class LuceneAnalyzerSelectorMapping {
public string IndexName { get; set; }
public string AnalyzerName { get; set; }
}
}

View File

@@ -1,21 +0,0 @@
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; }
}
}
}

View File

@@ -2,7 +2,7 @@
AntiForgery: enabled
Author: The Orchard Team
Website: http://orchardproject.net
Version: 1.10.2
Version: 1.10.1
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.

View File

@@ -1,5 +0,0 @@
<Placement>
<Match ContentType="Site">
<Place Parts_LuceneSettings_Edit="Content: 1@LuceneSettings" />
</Match>
</Placement>

View File

@@ -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.2")]
[assembly: AssemblyFileVersion("1.10.2")]
[assembly: AssemblyVersion("1.10.1")]
[assembly: AssemblyFileVersion("1.10.1")]

View File

@@ -1,46 +1,34 @@
using Lucene.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
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, IWorkContextAccessor wca) {
public DefaultLuceneAnalyzerProvider(IEnumerable<ILuceneAnalyzerSelector> analyzerSelectors) {
_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();
return analyzer != null ? analyzer : new StandardAnalyzer(LuceneIndexProvider.LuceneVersion);
if (analyzer != null) {
return analyzer;
}
return new StandardAnalyzer(LuceneIndexProvider.LuceneVersion);
}
}
}

View File

@@ -12,7 +12,5 @@ namespace Lucene.Services {
Analyzer = new StandardAnalyzer(LuceneIndexProvider.LuceneVersion)
};
}
public string Name { get { return "Default"; } }
}
}

View File

@@ -1,8 +1,11 @@
using Orchard;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Orchard;
namespace Lucene.Services {
public interface ILuceneAnalyzerSelector : IDependency {
LuceneAnalyzerSelectorResult GetLuceneAnalyzer(string indexName);
string Name { get; }
}
}

View File

@@ -1,14 +0,0 @@
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; }
}
}

View File

@@ -1,26 +0,0 @@
@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>

View File

@@ -37,7 +37,6 @@
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>..\..\..\OrchardBasicCorrectness.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
<LangVersion>5</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -48,7 +47,6 @@
<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">

View File

@@ -2,7 +2,7 @@
AntiForgery: enabled
Author: The Orchard Team
Website: http://orchardproject.net
Version: 1.10.2
Version: 1.10.1
OrchardVersion: 1.9
Description: The Markdown module enables rich text contents to be created using the Markdown syntax.
FeatureDescription: Markdown editor.

View File

@@ -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.2")]
[assembly: AssemblyFileVersion("1.10.2")]
[assembly: AssemblyVersion("1.10.1")]
[assembly: AssemblyFileVersion("1.10.1")]

View File

@@ -3,26 +3,14 @@ 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 {
private readonly Lazy<IAliasHolderUpdater> _aliasHolderUpdater;
private readonly ConcurrentDictionary<string, AliasMap> _aliasMaps;
public AliasHolder(Lazy<IAliasHolderUpdater> aliasHolderUpdater) {
_aliasHolderUpdater = aliasHolderUpdater;
public AliasHolder() {
_aliasMaps = new ConcurrentDictionary<string, AliasMap>(StringComparer.OrdinalIgnoreCase);
}
private ConcurrentDictionary<string, AliasMap> GetOrRefreshAliasMaps() {
lock (_aliasMaps) {
if (_aliasMaps.Count == 0)
_aliasHolderUpdater.Value.Refresh();
}
return _aliasMaps;
}
private readonly ConcurrentDictionary<string, AliasMap> _aliasMaps;
public void SetAliases(IEnumerable<AliasInfo> aliases) {
var grouped = aliases.GroupBy(alias => alias.Area ?? String.Empty, StringComparer.InvariantCultureIgnoreCase);
@@ -37,7 +25,7 @@ namespace Orchard.Alias.Implementation.Holder {
}
public void SetAlias(AliasInfo alias) {
foreach (var map in GetOrRefreshAliasMaps().Values) {
foreach (var map in _aliasMaps.Values) {
map.Remove(alias);
}
@@ -45,11 +33,11 @@ namespace Orchard.Alias.Implementation.Holder {
}
public IEnumerable<AliasMap> GetMaps() {
return GetOrRefreshAliasMaps().Values;
return _aliasMaps.Values;
}
public AliasMap GetMap(string areaName) {
return GetOrRefreshAliasMaps().GetOrAdd(areaName ?? String.Empty, key => new AliasMap(key));
return _aliasMaps.GetOrAdd(areaName ?? String.Empty, key => new AliasMap(key));
}
public void RemoveAlias(AliasInfo aliasInfo) {

View File

@@ -2,7 +2,7 @@ Name: Alias
AntiForgery: enabled
Author: The Orchard Team
Website: http://orchardproject.net
Version: 1.10.2
Version: 1.10.1
OrchardVersion: 1.9
Description: Maps friendly urls to specific module actions.
FeatureDescription: Maps friendly urls to specific module actions.

View File

@@ -37,7 +37,6 @@
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>..\..\..\OrchardBasicCorrectness.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
<LangVersion>5</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -48,7 +47,6 @@
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
<LangVersion>5</LangVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />

View File

@@ -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.2")]
[assembly: AssemblyFileVersion("1.10.2")]
[assembly: AssemblyVersion("1.10.1")]
[assembly: AssemblyFileVersion("1.10.1")]

View File

@@ -44,6 +44,7 @@
<tr>
<th scope="col">@T("Alias")</th>
<th scope="col">@T("Route")</th>
<th scope="col">&nbsp;</th>
</tr>
</thead>
@foreach (var aliasEntry in Model.AliasEntries) {

View File

@@ -2,7 +2,7 @@ Name: AntiSpam
AntiForgery: enabled
Author: The Orchard Team
Website: http://orchardproject.net
Version: 1.10.2
Version: 1.10.1
OrchardVersion: 1.9
Description: Provides anti-spam services to protect your content from malicious submissions.
Features:

View File

@@ -37,7 +37,6 @@
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>..\..\..\OrchardBasicCorrectness.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
<LangVersion>5</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -48,7 +47,6 @@
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
<LangVersion>5</LangVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />

View File

@@ -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.2")]
[assembly: AssemblyFileVersion("1.10.2")]
[assembly: AssemblyVersion("1.10.1")]
[assembly: AssemblyFileVersion("1.10.1")]

View File

@@ -3,7 +3,7 @@ Path: ArchiveLater
AntiForgery: enabled
Author: The Orchard Team
Website: http://orchardproject.net
Version: 1.10.2
Version: 1.10.1
OrchardVersion: 1.9
Description: The ArchiveLater module introduces scheduled archiving functionality.
FeatureDescription: Scheduled archiving.

View File

@@ -38,7 +38,6 @@
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>..\..\..\OrchardBasicCorrectness.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
<LangVersion>5</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -48,7 +47,6 @@
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<Prefer32Bit>false</Prefer32Bit>
<LangVersion>5</LangVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />

View File

@@ -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.2")]
[assembly: AssemblyFileVersion("1.10.2")]
[assembly: AssemblyVersion("1.10.1")]
[assembly: AssemblyFileVersion("1.10.1")]

View File

@@ -2,63 +2,21 @@
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; }
}
}

View File

@@ -1,18 +1,6 @@
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; }
}
}

View File

@@ -2,7 +2,7 @@
AntiForgery: enabled
Author: The Orchard Team
Website: http://orchardproject.net
Version: 1.10.2
Version: 1.10.1
OrchardVersion: 1.9
Description: Provides a log for recording and viewing back-end changes.
Features:

View File

@@ -36,7 +36,6 @@
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>..\..\..\OrchardBasicCorrectness.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
<LangVersion>5</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -47,7 +46,6 @@
<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">

View File

@@ -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.2")]
[assembly: AssemblyFileVersion("1.10.2")]
[assembly: AssemblyVersion("1.10.1")]
[assembly: AssemblyFileVersion("1.10.1")]

View File

@@ -16,10 +16,6 @@ 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;
@@ -56,14 +52,6 @@ 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,
@@ -114,20 +102,10 @@ 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);
@@ -145,17 +123,6 @@ 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))
@@ -198,49 +165,26 @@ 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 =

View File

@@ -5,17 +5,7 @@ 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);
@@ -28,11 +18,6 @@ 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>();

View File

@@ -6,12 +6,7 @@ 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>

View File

@@ -1,24 +1,8 @@
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);
}
}

View File

@@ -1,20 +1,10 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Orchard.Autoroute.Models;
using Orchard.Autoroute.Settings;
using Orchard.ContentManagement.MetaData;
using Orchard.ContentManagement.MetaData;
using Orchard.Core.Contents.Extensions;
using Orchard.Data.Migration;
using Orchard.Localization.Services;
namespace Orchard.Autoroute {
public class Migrations : DataMigrationImpl {
private readonly ICultureManager _cultureManager;
public Migrations(ICultureManager cultureManager) {
_cultureManager = cultureManager;
}
namespace Orchard.Autoroute
{
public class Migrations : DataMigrationImpl {
public int Create() {
SchemaBuilder.CreateTable("AutoroutePartRecord",
@@ -59,46 +49,5 @@ 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;
}
}
}

View File

@@ -2,7 +2,7 @@ Name: Autoroute
AntiForgery: enabled
Author: The Orchard Team
Website: http://orchardproject.net
Version: 1.10.2
Version: 1.10.1
OrchardVersion: 1.9
Description: Description for the module
Features:

View File

@@ -37,7 +37,6 @@
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>..\..\..\OrchardBasicCorrectness.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
<LangVersion>5</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -48,7 +47,6 @@
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
<LangVersion>5</LangVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />

View File

@@ -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.2")]
[assembly: AssemblyFileVersion("1.10.2")]
[assembly: AssemblyVersion("1.10.1")]
[assembly: AssemblyFileVersion("1.10.1")]

View File

@@ -50,24 +50,19 @@ namespace Orchard.Autoroute.Providers.ContentDefinition {
public void ContentPartAttached(ContentPartAttachedContext context) {
if (context.ContentPartName == "AutoroutePart") {
// Create pattern and default pattern for each culture installed and for the neutral culture
//Create pattern and default pattern for each culture installed
// Get cultures
//get cultures
var SiteCultures = _cultureManager.ListCultures().ToList();
// 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
//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 cultures) {
foreach (string culture in SiteCultures) {
newPatterns.Add(new RoutePattern {
Name = "Title",
Description = "my-title",

View File

@@ -135,47 +135,35 @@ 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 (settings.UseCulturePattern) {
var defaultPatternIndex = "0";
if (String.IsNullOrWhiteSpace(defaultPatternIndex))
defaultPatternIndex = "0";
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 };
}
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 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));
else {
settings.DefaultPatterns.Add(new DefaultPattern { PatternIndex = "0", Culture = culture });
return new RoutePattern { Name = "Title", Description = "my-title", Pattern = "{Content.Slug}", Culture = culture };
}
}
// Return a default pattern if none is defined
// 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 new RoutePattern { Name = "Title", Description = "my-title", Pattern = "{Content.Slug}", Culture = culture };
}
@@ -234,23 +222,6 @@ 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);

View File

@@ -91,7 +91,7 @@ namespace Orchard.Autoroute.Services {
return false;
}
return a.Keys.All(x => String.Equals(a[x], Convert.ToString(b[x]), StringComparison.OrdinalIgnoreCase));
return a.Keys.All(x => String.Equals(a[x], b[x].ToString(), StringComparison.OrdinalIgnoreCase));
}
}
}

View File

@@ -28,55 +28,56 @@ 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();
// Adding Patterns for the UI
//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
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 cultures) {
// Adding all existing patterns for the culture
foreach (string culture in settings.SiteCultures) {
foreach (RoutePattern routePattern in settings.Patterns.Where(x => String.Equals(x.Culture, culture, StringComparison.OrdinalIgnoreCase))) {
newPatterns.Add(settings.Patterns[current]);
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
});
}
current++;
}
// Adding a pattern for each culture if there is none
//We add 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}" });
}
// Adding a new empty line for each culture
//we add 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, 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 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 (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 });
}
}
@@ -95,51 +96,25 @@ 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
// 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
// remove empty patterns
var patterns = settings.Patterns;
patterns.RemoveAll(p => String.IsNullOrWhiteSpace(p.Name) && String.IsNullOrWhiteSpace(p.Pattern) && String.IsNullOrWhiteSpace(p.Description));
// 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
//If there is no default pattern for each culture we set default ones
List<RoutePattern> newPatterns = new List<RoutePattern>();
int current = 0;
foreach (string culture in cultures) {
foreach (string culture in settings.SiteCultures) {
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",
@@ -153,7 +128,7 @@ namespace Orchard.Autoroute.Settings {
settings.Patterns = newPatterns;
// Update the settings builder
// update the settings builder
settings.Build(builder);
}

View File

@@ -1,15 +1,11 @@
@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>
@@ -44,10 +40,10 @@
int i = 1;
string cssClass = "";
}
<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="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="@cssClass" style="@(Model.UseCulturePattern == false ? "display:none;" : "")"><a class="culture" href="#cat-@culture">@culture</a></li>
i++;
}
@@ -55,8 +51,8 @@
</ul>
</div>
<div id="content">
@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;")">
@foreach (var culture in Model.SiteCultures) {
<fieldset id="cat-@culture" class="items @(culture == Model.DefaultSiteCulture ? "default" : "")" style="@(culture == Model.DefaultSiteCulture ? "display:block;" : "display:none;")">
<table class="autoroute-settings-patterns">
<tr>
<th class="autoroute-settings-default">@T("Default")</th>
@@ -67,7 +63,7 @@
</tr>
@for (int index = 0; index < Model.Patterns.Where(x => x.Culture == culture).Count(); index++) {
<tr>
<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.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.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>

View File

@@ -2,7 +2,7 @@
AntiForgery: enabled
Author: Microsoft Open Technologies, Inc
Website: http://msopentech.com
Version: 1.10.2
Version: 1.10.1
OrchardVersion: 1.9
Description: Provides integration of Microsoft Azure Media Services functionality into Orchard.
Features:

View File

@@ -36,7 +36,6 @@
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>..\..\..\OrchardBasicCorrectness.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
<LangVersion>5</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -47,7 +46,6 @@
<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">

View File

@@ -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.2")]
[assembly: AssemblyFileVersion("1.10.2")]
[assembly: AssemblyVersion("1.10.1")]
[assembly: AssemblyFileVersion("1.10.1")]

View File

@@ -44,7 +44,6 @@
<CodeAnalysisRuleSet>..\OrchardBasicCorrectness.ruleset</CodeAnalysisRuleSet>
<PlatformTarget>AnyCPU</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
<LangVersion>5</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -56,7 +55,6 @@
<CodeAnalysisRuleSet>AllRules.ruleset</CodeAnalysisRuleSet>
<PlatformTarget>AnyCPU</PlatformTarget>
<Prefer32Bit>false</Prefer32Bit>
<LangVersion>5</LangVersion>
</PropertyGroup>
<ItemGroup>
<Reference Include="Autofac">

View File

@@ -2,7 +2,7 @@
AntiForgery: enabled
Author: The Orchard Team
Website: http://orchardproject.net
Version: 1.10.2
Version: 1.10.1
OrchardVersion: 1.9
Description: Provides a set of Orchard service implementations targeting Microsoft Azure services.
Category: Hosting

View File

@@ -36,7 +36,6 @@
<WarningLevel>4</WarningLevel>
<CodeAnalysisRuleSet>..\..\..\OrchardBasicCorrectness.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>false</Prefer32Bit>
<LangVersion>5</LangVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
@@ -47,7 +46,6 @@
<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">

View File

@@ -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.2")]
[assembly: AssemblyFileVersion("1.10.2")]
[assembly: AssemblyVersion("1.10.1")]
[assembly: AssemblyFileVersion("1.10.1")]

View File

@@ -26,7 +26,7 @@ namespace Orchard.Blogs {
}
private void BuildMenu(NavigationItemBuilder menu) {
var blogs = _blogService.Get().Where(x => _authorizationService.TryCheckAccess(Permissions.MetaListBlogs, _workContextAccessor.GetContext().CurrentUser, x)).ToArray();
var blogs = _blogService.Get().Where(x => _authorizationService.TryCheckAccess(Permissions.MetaListOwnBlogs, _workContextAccessor.GetContext().CurrentUser, x)).ToArray();
var blogCount = blogs.Count();
var singleBlog = blogCount == 1 ? blogs.ElementAt(0) : null;

View File

@@ -1,24 +1,36 @@
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 IWidgetCommandsService _widgetCommandsService;
private readonly IWidgetsService _widgetsService;
private readonly IBlogService _blogService;
private readonly ISiteService _siteService;
private readonly IMembershipService _membershipService;
private readonly IContentManager _contentManager;
private BlogPart blog;
public BlogWidgetCommands(
IWidgetCommandsService widgetCommandsService,
IWidgetsService widgetsService,
IBlogService blogService,
ISiteService siteService,
IMembershipService membershipService,
IContentManager contentManager) {
_widgetCommandsService = widgetCommandsService;
_widgetsService = widgetsService;
_blogService = blogService;
_siteService = siteService;
_membershipService = membershipService;
_contentManager = contentManager;
RenderTitle = true;
@@ -63,21 +75,11 @@ namespace Orchard.Blogs.Commands {
public void CreateRecentBlogPostsWidget() {
var type = "RecentBlogPosts";
// 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);
var widget = CreateStandardWidget(type);
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.
@@ -88,8 +90,7 @@ namespace Orchard.Blogs.Commands {
}
}
// Publish the successfully created widget.
_widgetCommandsService.Publish(widget);
_contentManager.Publish(widget.ContentItem);
Context.Output.WriteLine(T("{0} widget created successfully.", type).Text);
}
@@ -99,28 +100,64 @@ namespace Orchard.Blogs.Commands {
public void CreateBlogArchivesWidget() {
var type = "BlogArchives";
// 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);
var widget = CreateStandardWidget(type);
if (widget == null) {
return;
}
// Set the custom parameters.
widget.As<BlogArchivesPart>().BlogId = blog.Id;
// Publish the successfully created widget.
_widgetCommandsService.Publish(widget);
_contentManager.Publish(widget.ContentItem);
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);
}

View File

@@ -2,7 +2,7 @@
AntiForgery: enabled
Author: The Orchard Team
Website: http://orchardproject.net
Version: 1.10.2
Version: 1.10.1
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