mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Compare commits
22 Commits
issue/8786
...
issue/8814
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
12f285caf5 | ||
|
|
f3e9f9550d | ||
|
|
4c1afb119b | ||
|
|
b254fc5463 | ||
|
|
32e7d862f9 | ||
|
|
6e4fefd873 | ||
|
|
fc8b681b4e | ||
|
|
86bcf413e7 | ||
|
|
0d9fccb624 | ||
|
|
62038ed1bb | ||
|
|
6eab0a1260 | ||
|
|
e60a845359 | ||
|
|
23fb9dff92 | ||
|
|
0bce8e634b | ||
|
|
0faf196f74 | ||
|
|
cf4335e5ba | ||
|
|
fdbb06ba8d | ||
|
|
15cad85d1e | ||
|
|
0b86413e60 | ||
|
|
9b0d78b4f6 | ||
|
|
38d35efd4d | ||
|
|
3a6810ec67 |
@@ -49,8 +49,8 @@
|
||||
<HintPath>..\..\..\packages\Iesi.Collections.4.0.4\lib\net461\Iesi.Collections.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="NHibernate, Version=5.3.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\NHibernate.5.3.10\lib\net461\NHibernate.dll</HintPath>
|
||||
<Reference Include="NHibernate, Version=5.5.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\NHibernate.5.5.2\lib\net48\NHibernate.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Remotion.Linq, Version=2.2.0.0, Culture=neutral, PublicKeyToken=fee00910d6e5f53b, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Remotion.Linq.2.2.0\lib\net45\Remotion.Linq.dll</HintPath>
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<packages>
|
||||
<package id="Antlr3.Runtime" version="3.5.1" targetFramework="net48" />
|
||||
<package id="Iesi.Collections" version="4.0.4" targetFramework="net48" />
|
||||
<package id="NHibernate" version="5.3.10" targetFramework="net48" />
|
||||
<package id="NHibernate" version="5.5.2" targetFramework="net48" />
|
||||
<package id="Remotion.Linq" version="2.2.0" targetFramework="net48" />
|
||||
<package id="Remotion.Linq.EagerFetching" version="2.2.0" targetFramework="net48" />
|
||||
</packages>
|
||||
@@ -4,7 +4,7 @@
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Iesi.Collections" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
|
||||
@@ -20,6 +20,7 @@ using Orchard.Core.Feeds.StandardBuilders;
|
||||
using Orchard.Tests.Modules;
|
||||
using Orchard.Tests.Stubs;
|
||||
using Orchard.Core.Title.Models;
|
||||
using Orchard.Services;
|
||||
|
||||
namespace Orchard.Core.Tests.Feeds.Controllers {
|
||||
[TestFixture]
|
||||
@@ -177,6 +178,7 @@ namespace Orchard.Core.Tests.Feeds.Controllers {
|
||||
builder.RegisterInstance(mockContentManager.Object).As<IContentManager>();
|
||||
builder.RegisterType<RssFeedBuilder>().As<IFeedBuilderProvider>();
|
||||
builder.RegisterType<CorePartsFeedItemBuilder>().As<IFeedItemBuilder>();
|
||||
builder.RegisterType<HtmlFilterProcessor>().As<IHtmlFilterProcessor>();
|
||||
builder.RegisterInstance(query).As<IFeedQueryProvider>();
|
||||
var container = builder.Build();
|
||||
|
||||
|
||||
@@ -77,8 +77,8 @@
|
||||
<Reference Include="Moq, Version=4.2.1510.2205, Culture=neutral, PublicKeyToken=69f491c39445e920, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Moq.4.2.1510.2205\lib\net40\Moq.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NHibernate, Version=5.3.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NHibernate.5.3.10\lib\net461\NHibernate.dll</HintPath>
|
||||
<Reference Include="NHibernate, Version=5.5.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NHibernate.5.5.2\lib\net48\NHibernate.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="nunit.framework, Version=2.5.10.11092, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NUnit.2.5.10.11092\lib\nunit.framework.dll</HintPath>
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
<package id="Microsoft.AspNet.WebPages" version="3.2.7" targetFramework="net48" />
|
||||
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net48" />
|
||||
<package id="Moq" version="4.2.1510.2205" targetFramework="net48" />
|
||||
<package id="NHibernate" version="5.3.10" targetFramework="net48" />
|
||||
<package id="NHibernate" version="5.5.2" targetFramework="net48" />
|
||||
<package id="NUnit" version="2.5.10.11092" targetFramework="net48" />
|
||||
<package id="Remotion.Linq" version="2.2.0" targetFramework="net48" />
|
||||
<package id="Remotion.Linq.EagerFetching" version="2.2.0" targetFramework="net48" />
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Iesi.Collections" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
|
||||
@@ -86,8 +86,8 @@
|
||||
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NHibernate, Version=5.3.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NHibernate.5.3.10\lib\net461\NHibernate.dll</HintPath>
|
||||
<Reference Include="NHibernate, Version=5.5.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NHibernate.5.5.2\lib\net48\NHibernate.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="nunit.framework, Version=2.5.10.11092, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NUnit.2.5.10.11092\lib\nunit.framework.dll</HintPath>
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
<package id="Microsoft.AspNet.Razor" version="3.2.7" targetFramework="net48" />
|
||||
<package id="Microsoft.AspNet.WebPages" version="3.2.7" targetFramework="net48" />
|
||||
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net48" />
|
||||
<package id="NHibernate" version="5.3.10" targetFramework="net48" />
|
||||
<package id="NHibernate" version="5.5.2" targetFramework="net48" />
|
||||
<package id="NUnit" version="2.5.10.11092" targetFramework="net48" />
|
||||
<package id="Orchard.FluentPath" version="1.0.0.1" targetFramework="net48" />
|
||||
<package id="Remotion.Linq" version="2.2.0" targetFramework="net48" />
|
||||
<package id="Remotion.Linq.EagerFetching" version="2.2.0" targetFramework="net48" />
|
||||
<package id="SpecFlow" version="1.9.0" targetFramework="net48" />
|
||||
</packages>
|
||||
</packages>
|
||||
@@ -20,7 +20,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" />
|
||||
|
||||
@@ -110,8 +110,8 @@
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NHibernate, Version=5.3.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NHibernate.5.3.10\lib\net461\NHibernate.dll</HintPath>
|
||||
<Reference Include="NHibernate, Version=5.5.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NHibernate.5.5.2\lib\net48\NHibernate.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NuGet.Core, Version=1.1.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Orchard.NuGet.Core.1.1.0.0\lib\NuGet.Core.dll</HintPath>
|
||||
|
||||
@@ -15,6 +15,7 @@ using Orchard.ContentManagement.MetaData.Services;
|
||||
using Orchard.ContentManagement.Records;
|
||||
using Orchard.Core.Settings.Handlers;
|
||||
using Orchard.Core.Settings.Metadata;
|
||||
using Orchard.Core.Settings.Metadata.Records;
|
||||
using Orchard.Core.Settings.Models;
|
||||
using Orchard.Core.Settings.Services;
|
||||
using Orchard.DisplayManagement;
|
||||
@@ -110,7 +111,12 @@ namespace Orchard.Tests.Modules.Users.Controllers {
|
||||
return new[] { typeof(UserPartRecord),
|
||||
typeof(ContentTypeRecord),
|
||||
typeof(ContentItemRecord),
|
||||
typeof(ContentItemVersionRecord),
|
||||
typeof(ContentItemVersionRecord),
|
||||
typeof(ContentPartDefinitionRecord),
|
||||
typeof(ContentPartFieldDefinitionRecord),
|
||||
typeof(ContentFieldDefinitionRecord),
|
||||
typeof(ContentTypeDefinitionRecord),
|
||||
typeof(ContentTypePartDefinitionRecord)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,6 +14,7 @@ using Orchard.ContentManagement.MetaData.Services;
|
||||
using Orchard.ContentManagement.Records;
|
||||
using Orchard.Core.Settings.Handlers;
|
||||
using Orchard.Core.Settings.Metadata;
|
||||
using Orchard.Core.Settings.Metadata.Records;
|
||||
using Orchard.Core.Settings.Services;
|
||||
using Orchard.Data;
|
||||
using Orchard.DisplayManagement;
|
||||
@@ -54,7 +55,12 @@ namespace Orchard.Tests.Modules.Users.Services
|
||||
typeof(UserPartRecord),
|
||||
typeof(ContentItemVersionRecord),
|
||||
typeof(ContentItemRecord),
|
||||
typeof(ContentTypeRecord));
|
||||
typeof(ContentTypeRecord),
|
||||
typeof(ContentPartDefinitionRecord),
|
||||
typeof(ContentPartFieldDefinitionRecord),
|
||||
typeof(ContentFieldDefinitionRecord),
|
||||
typeof(ContentTypeDefinitionRecord),
|
||||
typeof(ContentTypePartDefinitionRecord));
|
||||
}
|
||||
|
||||
[TestFixtureTearDown]
|
||||
|
||||
@@ -14,6 +14,7 @@ using Orchard.ContentManagement.MetaData.Services;
|
||||
using Orchard.ContentManagement.Records;
|
||||
using Orchard.Core.Settings.Handlers;
|
||||
using Orchard.Core.Settings.Metadata;
|
||||
using Orchard.Core.Settings.Metadata.Records;
|
||||
using Orchard.Core.Settings.Services;
|
||||
using Orchard.Data;
|
||||
using Orchard.DisplayManagement;
|
||||
@@ -59,7 +60,12 @@ namespace Orchard.Tests.Modules.Users.Services
|
||||
typeof(UserPartRecord),
|
||||
typeof(ContentItemVersionRecord),
|
||||
typeof(ContentItemRecord),
|
||||
typeof(ContentTypeRecord));
|
||||
typeof(ContentTypeRecord),
|
||||
typeof(ContentPartDefinitionRecord),
|
||||
typeof(ContentPartFieldDefinitionRecord),
|
||||
typeof(ContentFieldDefinitionRecord),
|
||||
typeof(ContentTypeDefinitionRecord),
|
||||
typeof(ContentTypePartDefinitionRecord));
|
||||
}
|
||||
|
||||
[TestFixtureTearDown]
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Net;
|
||||
using System;
|
||||
using System.Net;
|
||||
using NUnit.Framework;
|
||||
using Orchard.Warmup.Services;
|
||||
|
||||
@@ -20,7 +21,7 @@ namespace Orchard.Tests.Modules.Warmup {
|
||||
|
||||
[Test]
|
||||
public void StatusCodeShouldBe404ForUnexistingResources() {
|
||||
var download = _webDownloader.Download("http://orchardproject.net/yepyep");
|
||||
var download = _webDownloader.Download("https://orchardcore.net/" + Guid.NewGuid());
|
||||
Assert.That(download, Is.Not.Null);
|
||||
Assert.That(download.StatusCode, Is.EqualTo(HttpStatusCode.NotFound));
|
||||
Assert.That(download.Content, Is.Null);
|
||||
@@ -28,7 +29,7 @@ namespace Orchard.Tests.Modules.Warmup {
|
||||
|
||||
[Test]
|
||||
public void StatusCodeShouldBe200ForValidRequests() {
|
||||
var download = _webDownloader.Download("http://orchardproject.net/");
|
||||
var download = _webDownloader.Download("https://orchardcore.net/");
|
||||
Assert.That(download, Is.Not.Null);
|
||||
Assert.That(download.StatusCode, Is.EqualTo(HttpStatusCode.OK));
|
||||
Assert.That(download.Content, Is.Not.Empty);
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net48" />
|
||||
<package id="Moq" version="4.2.1510.2205" targetFramework="net48" />
|
||||
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net48" />
|
||||
<package id="NHibernate" version="5.3.10" targetFramework="net48" />
|
||||
<package id="NHibernate" version="5.5.2" targetFramework="net48" />
|
||||
<package id="NUnit" version="2.5.10.11092" targetFramework="net48" />
|
||||
<package id="Orchard.FluentPath" version="1.0.0.1" targetFramework="net48" />
|
||||
<package id="Orchard.NuGet.Core" version="1.1.0.0" targetFramework="net48" />
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30ad4fe6b2a6aeed" />
|
||||
|
||||
@@ -110,8 +110,8 @@
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NHibernate, Version=5.3.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NHibernate.5.3.10\lib\net461\NHibernate.dll</HintPath>
|
||||
<Reference Include="NHibernate, Version=5.5.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NHibernate.5.5.2\lib\net48\NHibernate.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="nunit.framework, Version=2.5.10.11092, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\NUnit.2.5.10.11092\lib\nunit.framework.dll</HintPath>
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net48" />
|
||||
<package id="Moq" version="4.2.1510.2205" targetFramework="net48" />
|
||||
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net48" />
|
||||
<package id="NHibernate" version="5.3.10" targetFramework="net48" />
|
||||
<package id="NHibernate" version="5.5.2" targetFramework="net48" />
|
||||
<package id="NUnit" version="2.5.10.11092" targetFramework="net48" />
|
||||
<package id="NUnitTestAdapter" version="2.3.0" targetFramework="net48" />
|
||||
<package id="Remotion.Linq" version="2.2.0" targetFramework="net48" />
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Iesi.Collections" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using System.Web;
|
||||
using Orchard.Mvc.Html;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Aspects;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
using Orchard.Core.Common.Models;
|
||||
using Orchard.Core.Common.Settings;
|
||||
using Orchard.Core.Common.ViewModels;
|
||||
using Orchard.Services;
|
||||
using System.Web.Mvc;
|
||||
@@ -15,13 +12,13 @@ using Orchard.ContentManagement.Handlers;
|
||||
|
||||
namespace Orchard.Core.Common.Drivers {
|
||||
public class BodyPartDriver : ContentPartDriver<BodyPart> {
|
||||
private readonly IEnumerable<IHtmlFilter> _htmlFilters;
|
||||
private readonly IHtmlFilterProcessor _htmlFilterProcessor;
|
||||
private readonly RequestContext _requestContext;
|
||||
|
||||
private const string TemplateName = "Parts.Common.Body";
|
||||
|
||||
public BodyPartDriver(IOrchardServices services, IEnumerable<IHtmlFilter> htmlFilters, RequestContext requestContext) {
|
||||
_htmlFilters = htmlFilters;
|
||||
public BodyPartDriver(IOrchardServices services, IHtmlFilterProcessor htmlFilterProcessor, RequestContext requestContext) {
|
||||
_htmlFilterProcessor = htmlFilterProcessor;
|
||||
Services = services;
|
||||
_requestContext = requestContext;
|
||||
}
|
||||
@@ -33,32 +30,27 @@ namespace Orchard.Core.Common.Drivers {
|
||||
}
|
||||
|
||||
protected override DriverResult Display(BodyPart part, string displayType, dynamic shapeHelper) {
|
||||
string GetProcessedBodyText() => _htmlFilterProcessor.ProcessFilters(part.Text, part.GetFlavor(), part);
|
||||
|
||||
return Combined(
|
||||
ContentShape("Parts_Common_Body",
|
||||
() => {
|
||||
var bodyText = _htmlFilters.Aggregate(part.Text, (text, filter) => filter.ProcessContent(text, GetFlavor(part)));
|
||||
return shapeHelper.Parts_Common_Body(Html: new HtmlString(bodyText));
|
||||
}),
|
||||
ContentShape("Parts_Common_Body_Summary",
|
||||
() => {
|
||||
var bodyText = _htmlFilters.Aggregate(part.Text, (text, filter) => filter.ProcessContent(text, GetFlavor(part)));
|
||||
return shapeHelper.Parts_Common_Body_Summary(Html: new HtmlString(bodyText));
|
||||
})
|
||||
);
|
||||
ContentShape("Parts_Common_Body", () =>
|
||||
shapeHelper.Parts_Common_Body(Html: new HtmlString(GetProcessedBodyText()))),
|
||||
ContentShape("Parts_Common_Body_Summary", () =>
|
||||
shapeHelper.Parts_Common_Body_Summary(Html: new HtmlString(GetProcessedBodyText()))));
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(BodyPart part, dynamic shapeHelper) {
|
||||
var model = BuildEditorViewModel(part,_requestContext);
|
||||
return ContentShape("Parts_Common_Body_Edit",
|
||||
() => shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: model, Prefix: Prefix));
|
||||
return ContentShape("Parts_Common_Body_Edit", () =>
|
||||
shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: model, Prefix: Prefix));
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(BodyPart part, IUpdateModel updater, dynamic shapeHelper) {
|
||||
var model = BuildEditorViewModel(part, _requestContext);
|
||||
updater.TryUpdateModel(model, Prefix, null, null);
|
||||
|
||||
return ContentShape("Parts_Common_Body_Edit",
|
||||
() => shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: model, Prefix: Prefix));
|
||||
return ContentShape("Parts_Common_Body_Edit", () =>
|
||||
shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: model, Prefix: Prefix));
|
||||
}
|
||||
|
||||
protected override void Importing(BodyPart part, ContentManagement.Handlers.ImportContentContext context) {
|
||||
@@ -83,18 +75,11 @@ namespace Orchard.Core.Common.Drivers {
|
||||
private static BodyEditorViewModel BuildEditorViewModel(BodyPart part,RequestContext requestContext) {
|
||||
return new BodyEditorViewModel {
|
||||
BodyPart = part,
|
||||
EditorFlavor = GetFlavor(part),
|
||||
EditorFlavor = part.GetFlavor(),
|
||||
AddMediaPath = new PathBuilder(part,requestContext).AddContentType().AddContainerSlug().ToString()
|
||||
};
|
||||
}
|
||||
|
||||
private static string GetFlavor(BodyPart part) {
|
||||
var typePartSettings = part.Settings.GetModel<BodyTypePartSettings>();
|
||||
return (typePartSettings != null && !string.IsNullOrWhiteSpace(typePartSettings.Flavor))
|
||||
? typePartSettings.Flavor
|
||||
: part.PartDefinition.Settings.GetModel<BodyPartSettings>().FlavorDefault;
|
||||
}
|
||||
|
||||
class PathBuilder {
|
||||
private readonly IContent _content;
|
||||
private string _path;
|
||||
|
||||
@@ -1,6 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.Drivers;
|
||||
@@ -14,10 +12,10 @@ using Orchard.Utility.Extensions;
|
||||
|
||||
namespace Orchard.Core.Common.Drivers {
|
||||
public class TextFieldDriver : ContentFieldDriver<TextField> {
|
||||
private readonly IEnumerable<IHtmlFilter> _htmlFilters;
|
||||
private readonly IHtmlFilterProcessor _htmlFilterProcessor;
|
||||
|
||||
public TextFieldDriver(IOrchardServices services, IEnumerable<IHtmlFilter> htmlFilters) {
|
||||
_htmlFilters = htmlFilters;
|
||||
public TextFieldDriver(IOrchardServices services, IHtmlFilterProcessor htmlFilterProcessor) {
|
||||
_htmlFilterProcessor = htmlFilterProcessor;
|
||||
Services = services;
|
||||
T = NullLocalizer.Instance;
|
||||
}
|
||||
@@ -37,8 +35,7 @@ namespace Orchard.Core.Common.Drivers {
|
||||
return ContentShape("Fields_Common_Text", GetDifferentiator(field, part),
|
||||
() => {
|
||||
var settings = field.PartFieldDefinition.Settings.GetModel<TextFieldSettings>();
|
||||
|
||||
object fieldValue = new HtmlString(_htmlFilters.Aggregate(field.Value, (text, filter) => filter.ProcessContent(text, settings.Flavor)));
|
||||
var fieldValue = new HtmlString(_htmlFilterProcessor.ProcessFilters(field.Value, settings.Flavor, part));
|
||||
return shapeHelper.Fields_Common_Text(Name: field.Name, Value: fieldValue);
|
||||
});
|
||||
}
|
||||
@@ -75,12 +72,12 @@ namespace Orchard.Core.Common.Drivers {
|
||||
|
||||
if (settings.MaxLength > 0) {
|
||||
|
||||
var value = new HtmlString(_htmlFilters.Aggregate(field.Value, (text, filter) => filter.ProcessContent(text, settings.Flavor)))
|
||||
var value = new HtmlString(_htmlFilterProcessor.ProcessFilters(field.Value, settings.Flavor, part))
|
||||
.ToString().RemoveTags();
|
||||
|
||||
if (value.Length > settings.MaxLength) {
|
||||
updater.AddModelError("Text", T("The maximum allowed length for the field {0} is {1}", T(field.DisplayName), settings.MaxLength));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.Core.Common.Settings;
|
||||
|
||||
namespace Orchard.Core.Common.Models {
|
||||
public class BodyPart : ContentPart<BodyPartRecord> {
|
||||
@@ -11,5 +12,12 @@ namespace Orchard.Core.Common.Models {
|
||||
get { return Retrieve(x => x.Format); }
|
||||
set { Store(x => x.Format, value); }
|
||||
}
|
||||
|
||||
public string GetFlavor() {
|
||||
var typePartSettings = Settings.GetModel<BodyTypePartSettings>();
|
||||
return string.IsNullOrWhiteSpace(typePartSettings?.Flavor)
|
||||
? PartDefinition.Settings.GetModel<BodyPartSettings>().FlavorDefault
|
||||
: typePartSettings.Flavor;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,27 +5,26 @@ using System.Web;
|
||||
using Orchard.Services;
|
||||
|
||||
namespace Orchard.Core.Common.Services {
|
||||
public class BbcodeFilter : IHtmlFilter {
|
||||
public string ProcessContent(string text, string flavor) {
|
||||
return BbcodeReplace(text);
|
||||
public class BbcodeFilter : HtmlFilter {
|
||||
public override string ProcessContent(string text, HtmlFilterContext context) {
|
||||
return BbcodeReplace(text, context);
|
||||
}
|
||||
|
||||
// Can be moved somewhere else once we have IoC enabled body text filters.
|
||||
private static string BbcodeReplace(string text) {
|
||||
if (string.IsNullOrEmpty(text))
|
||||
return string.Empty;
|
||||
private static string BbcodeReplace(string text, HtmlFilterContext context) {
|
||||
if (String.IsNullOrEmpty(text))
|
||||
return String.Empty;
|
||||
|
||||
// optimize code path if nothing to do
|
||||
// Optimize code path if nothing to do.
|
||||
if (!text.Contains("[url]") && !text.Contains("[img]") && !text.Contains("[url=")) {
|
||||
return text;
|
||||
}
|
||||
|
||||
var sb = new StringBuilder(text);
|
||||
|
||||
var index = -1;
|
||||
var allIndexes = new List<int>();
|
||||
|
||||
// process all [url]
|
||||
// Process all [url].
|
||||
while (-1 != (index = text.IndexOf("[url]", index + 1, StringComparison.Ordinal))) {
|
||||
allIndexes.Add(index);
|
||||
}
|
||||
@@ -63,7 +62,7 @@ namespace Orchard.Core.Common.Services {
|
||||
var url = text.Substring(start + 5, urlEnd - start - 5);
|
||||
var title = text.Substring(urlEnd + 1, end - urlEnd - 1);
|
||||
|
||||
// substitue [url] by <a>
|
||||
// Substitute [url] by <a>.
|
||||
sb.Remove(start, end - start + 6);
|
||||
sb.Insert(start, String.Format("<a href=\"{0}\">{1}</a>", url, title));
|
||||
}
|
||||
@@ -85,7 +84,7 @@ namespace Orchard.Core.Common.Services {
|
||||
|
||||
var url = text.Substring(start + 5, end - start - 5);
|
||||
|
||||
// substitue [url] by <a>
|
||||
// Substitue [url] by <a>.
|
||||
sb.Remove(start, end - start + 6);
|
||||
|
||||
if (!string.IsNullOrEmpty(url)) {
|
||||
|
||||
@@ -4,10 +4,10 @@ using Orchard.Services;
|
||||
using Orchard.Utility.Extensions;
|
||||
|
||||
namespace Orchard.Core.Common.Services {
|
||||
public class TextFieldFilter : IHtmlFilter {
|
||||
public string ProcessContent(string text, string flavor) {
|
||||
public class TextFieldFilter : HtmlFilter {
|
||||
public override string ProcessContent(string text, HtmlFilterContext context) {
|
||||
// Flavor is null for a normal input/text field
|
||||
return flavor == null || string.Equals(flavor, "textarea", StringComparison.OrdinalIgnoreCase) ? ReplaceNewLines(text) : text;
|
||||
return context.Flavor == null || String.Equals(context.Flavor, "textarea", StringComparison.OrdinalIgnoreCase) ? ReplaceNewLines(text) : text;
|
||||
}
|
||||
|
||||
private static string ReplaceNewLines(string text) {
|
||||
|
||||
@@ -13,15 +13,15 @@ namespace Orchard.Core.Feeds.StandardBuilders {
|
||||
public class CorePartsFeedItemBuilder : IFeedItemBuilder {
|
||||
private readonly IContentManager _contentManager;
|
||||
private readonly RouteCollection _routes;
|
||||
private readonly IEnumerable<IHtmlFilter> _htmlFilters;
|
||||
private readonly IHtmlFilterProcessor _htmlFilterProcessor;
|
||||
|
||||
public CorePartsFeedItemBuilder(
|
||||
IContentManager contentManager,
|
||||
RouteCollection routes,
|
||||
IEnumerable<IHtmlFilter> htmlFilters) {
|
||||
IHtmlFilterProcessor htmlFilterProcessor) {
|
||||
_contentManager = contentManager;
|
||||
_routes = routes;
|
||||
_htmlFilters = htmlFilters;
|
||||
_htmlFilterProcessor = htmlFilterProcessor;
|
||||
}
|
||||
|
||||
public void Populate(FeedContext context) {
|
||||
@@ -29,8 +29,8 @@ namespace Orchard.Core.Feeds.StandardBuilders {
|
||||
|
||||
var inspector = new ItemInspector(
|
||||
feedItem.Item,
|
||||
_contentManager.GetItemMetadata(feedItem.Item),
|
||||
_htmlFilters);
|
||||
_contentManager.GetItemMetadata(feedItem.Item),
|
||||
_htmlFilterProcessor);
|
||||
|
||||
// author is intentionally left empty as it could result in unwanted spam
|
||||
|
||||
|
||||
@@ -12,17 +12,17 @@ namespace Orchard.Core.Feeds.StandardBuilders {
|
||||
public class ItemInspector {
|
||||
private readonly IContent _item;
|
||||
private readonly ContentItemMetadata _metadata;
|
||||
private readonly IEnumerable<IHtmlFilter> _htmlFilters;
|
||||
private readonly IHtmlFilterProcessor _htmlFilterProcessor;
|
||||
private readonly ICommonPart _common;
|
||||
private readonly ITitleAspect _titleAspect;
|
||||
private readonly BodyPart _body;
|
||||
|
||||
public ItemInspector(IContent item, ContentItemMetadata metadata) : this(item, metadata, Enumerable.Empty<IHtmlFilter>()) {}
|
||||
public ItemInspector(IContent item, ContentItemMetadata metadata) : this(item, metadata, null) {}
|
||||
|
||||
public ItemInspector(IContent item, ContentItemMetadata metadata, IEnumerable<IHtmlFilter> htmlFilters) {
|
||||
public ItemInspector(IContent item, ContentItemMetadata metadata, IHtmlFilterProcessor htmlFilterProcessor) {
|
||||
_item = item;
|
||||
_metadata = metadata;
|
||||
_htmlFilters = htmlFilters;
|
||||
_htmlFilterProcessor = htmlFilterProcessor;
|
||||
_common = item.Get<ICommonPart>();
|
||||
_titleAspect = item.Get<ITitleAspect>();
|
||||
_body = item.Get<BodyPart>();
|
||||
@@ -49,8 +49,8 @@ namespace Orchard.Core.Feeds.StandardBuilders {
|
||||
|
||||
public string Description {
|
||||
get {
|
||||
if (_body != null && !string.IsNullOrEmpty(_body.Text)) {
|
||||
return _htmlFilters.Aggregate(_body.Text, (text, filter) => filter.ProcessContent(text, GetFlavor(_body)));
|
||||
if (_htmlFilterProcessor != null && _body != null && !string.IsNullOrEmpty(_body.Text)) {
|
||||
return _htmlFilterProcessor.ProcessFilters(_body.Text, GetFlavor(_body), _body);
|
||||
}
|
||||
return Title;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Web.Mvc;
|
||||
using System.Xml.Linq;
|
||||
using Orchard.ContentManagement;
|
||||
@@ -8,16 +7,16 @@ using Orchard.Core.Feeds.Models;
|
||||
using Orchard.Core.Feeds.StandardBuilders;
|
||||
using Orchard.Mvc.Extensions;
|
||||
using Orchard.Services;
|
||||
using Orchard.Utility.Extensions;
|
||||
|
||||
namespace Orchard.Core.Feeds.StandardQueries {
|
||||
namespace Orchard.Core.Feeds.StandardQueries
|
||||
{
|
||||
public class ContainerFeedQuery : IFeedQueryProvider, IFeedQuery {
|
||||
private readonly IContentManager _contentManager;
|
||||
private readonly IEnumerable<IHtmlFilter> _htmlFilters;
|
||||
private readonly IHtmlFilterProcessor _htmlFilterProcessor;
|
||||
|
||||
public ContainerFeedQuery(IContentManager contentManager, IEnumerable<IHtmlFilter> htmlFilters) {
|
||||
public ContainerFeedQuery(IContentManager contentManager, IHtmlFilterProcessor htmlFilterProcessor) {
|
||||
_contentManager = contentManager;
|
||||
_htmlFilters = htmlFilters;
|
||||
_htmlFilterProcessor = htmlFilterProcessor;
|
||||
}
|
||||
|
||||
public FeedQueryMatch Match(FeedContext context) {
|
||||
@@ -55,7 +54,7 @@ namespace Orchard.Core.Feeds.StandardQueries {
|
||||
return;
|
||||
}
|
||||
|
||||
var inspector = new ItemInspector(container, _contentManager.GetItemMetadata(container), _htmlFilters);
|
||||
var inspector = new ItemInspector(container, _contentManager.GetItemMetadata(container), _htmlFilterProcessor);
|
||||
if (context.Format == "rss") {
|
||||
var link = new XElement("link");
|
||||
context.Response.Element.SetElementValue("title", inspector.Title);
|
||||
|
||||
@@ -1 +1,10 @@
|
||||
<span class="raw">@Html.Raw(Model.Content.BodyPart.Text)</span>
|
||||
@using Orchard.Core.Common.Models
|
||||
@using Orchard.Services
|
||||
|
||||
@{
|
||||
var htmlFilterProcessor = WorkContext.Resolve<IHtmlFilterProcessor>();
|
||||
var bodyPart = Model.Content.BodyPart as BodyPart;
|
||||
var bodyText = htmlFilterProcessor.ProcessFilters(bodyPart.Text, bodyPart.GetFlavor(), bodyPart);
|
||||
}
|
||||
|
||||
<span class="raw">@Html.Raw(bodyText)</span>
|
||||
|
||||
@@ -53,6 +53,12 @@
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Antlr3.Runtime, Version=3.5.0.2, Culture=neutral, PublicKeyToken=eb42632606e9261f, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Antlr3.Runtime.3.5.1\lib\net40-client\Antlr3.Runtime.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Iesi.Collections, Version=4.0.0.4000, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Iesi.Collections.4.0.4\lib\net461\Iesi.Collections.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.4.1.0\lib\net472\Microsoft.CodeDom.Providers.DotNetCompilerPlatform.dll</HintPath>
|
||||
</Reference>
|
||||
@@ -60,15 +66,24 @@
|
||||
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NHibernate, Version=5.3.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\NHibernate.5.3.10\lib\net461\NHibernate.dll</HintPath>
|
||||
<Reference Include="NHibernate, Version=5.5.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\NHibernate.5.5.2\lib\net48\NHibernate.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Remotion.Linq, Version=2.2.0.0, Culture=neutral, PublicKeyToken=fee00910d6e5f53b, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Remotion.Linq.2.2.0\lib\net45\Remotion.Linq.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Remotion.Linq.EagerFetching, Version=2.2.0.0, Culture=neutral, PublicKeyToken=fee00910d6e5f53b, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\packages\Remotion.Linq.EagerFetching.2.2.0\lib\net45\Remotion.Linq.EagerFetching.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.ComponentModel.DataAnnotations">
|
||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.ServiceModel" />
|
||||
<Reference Include="System.Transactions" />
|
||||
<Reference Include="System.Web" />
|
||||
<Reference Include="System.Web.ApplicationServices" />
|
||||
<Reference Include="System.Web.DynamicData" />
|
||||
@@ -659,4 +674,4 @@
|
||||
</FlavorProperties>
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
||||
</Project>
|
||||
@@ -46,7 +46,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Iesi.Collections" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Antlr3.Runtime" version="3.5.1" targetFramework="net48" />
|
||||
<package id="Iesi.Collections" version="4.0.4" targetFramework="net48" />
|
||||
<package id="Microsoft.AspNet.Mvc" version="5.2.7" targetFramework="net48" />
|
||||
<package id="Microsoft.AspNet.Razor" version="3.2.7" targetFramework="net48" />
|
||||
<package id="Microsoft.AspNet.WebPages" version="3.2.7" targetFramework="net48" />
|
||||
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="4.1.0" targetFramework="net48" />
|
||||
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net48" />
|
||||
<package id="NHibernate" version="5.3.10" targetFramework="net48" />
|
||||
</packages>
|
||||
<package id="NHibernate" version="5.5.2" targetFramework="net48" />
|
||||
<package id="Remotion.Linq" version="2.2.0" targetFramework="net48" />
|
||||
<package id="Remotion.Linq.EagerFetching" version="2.2.0" targetFramework="net48" />
|
||||
</packages>
|
||||
@@ -45,7 +45,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Iesi.Collections" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
|
||||
@@ -1,15 +1,16 @@
|
||||
using System;
|
||||
using Orchard.Services;
|
||||
|
||||
namespace Markdown.Services {
|
||||
public class MarkdownFilter : IHtmlFilter {
|
||||
public string ProcessContent(string text, string flavor) {
|
||||
return String.Equals(flavor, "markdown", StringComparison.OrdinalIgnoreCase) ? MarkdownReplace(text) : text;
|
||||
namespace Markdown.Services
|
||||
{
|
||||
public class MarkdownFilter : HtmlFilter {
|
||||
public override string ProcessContent(string text, HtmlFilterContext context) {
|
||||
return String.Equals(context.Flavor, "markdown", StringComparison.OrdinalIgnoreCase) ? MarkdownReplace(text) : text;
|
||||
}
|
||||
|
||||
private static string MarkdownReplace(string text) {
|
||||
if (string.IsNullOrEmpty(text))
|
||||
return string.Empty;
|
||||
if (String.IsNullOrEmpty(text))
|
||||
return String.Empty;
|
||||
|
||||
return Markdig.Markdown.ToHtml(text);
|
||||
}
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Iesi.Collections" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Iesi.Collections" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Iesi.Collections" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Iesi.Collections" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
|
||||
@@ -67,8 +67,8 @@
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NHibernate, Version=5.3.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\NHibernate.5.3.10\lib\net461\NHibernate.dll</HintPath>
|
||||
<Reference Include="NHibernate, Version=5.5.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\NHibernate.5.5.2\lib\net48\NHibernate.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Remotion.Linq, Version=2.2.0.0, Culture=neutral, PublicKeyToken=fee00910d6e5f53b, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Remotion.Linq.2.2.0\lib\net45\Remotion.Linq.dll</HintPath>
|
||||
|
||||
@@ -48,7 +48,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Iesi.Collections" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
|
||||
@@ -8,8 +8,8 @@
|
||||
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="4.1.0" targetFramework="net48" />
|
||||
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net48" />
|
||||
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net48" />
|
||||
<package id="NHibernate" version="5.3.10" targetFramework="net48" />
|
||||
<package id="NHibernate" version="5.5.2" targetFramework="net48" />
|
||||
<package id="Remotion.Linq" version="2.2.0" targetFramework="net48" />
|
||||
<package id="Remotion.Linq.EagerFetching" version="2.2.0" targetFramework="net48" />
|
||||
<package id="XMLDiffPatch" version="1.0.8.28" targetFramework="net48" />
|
||||
</packages>
|
||||
</packages>
|
||||
@@ -18,6 +18,7 @@ namespace Orchard.Autoroute.Settings {
|
||||
public AutorouteSettings() {
|
||||
PerItemConfiguration = false;
|
||||
AllowCustomPattern = true;
|
||||
AllowSetAsHomePage = true;
|
||||
UseCulturePattern = false;
|
||||
AutomaticAdjustmentOnEdit = false;
|
||||
PatternDefinitions = "[]";
|
||||
@@ -27,6 +28,7 @@ namespace Orchard.Autoroute.Settings {
|
||||
|
||||
public bool PerItemConfiguration { get; set; }
|
||||
public bool AllowCustomPattern { get; set; }
|
||||
public bool AllowSetAsHomePage { get; set; }
|
||||
public bool UseCulturePattern { get; set; }
|
||||
public bool AutomaticAdjustmentOnEdit { get; set; }
|
||||
public bool? IsDefault { get; set; }
|
||||
@@ -100,6 +102,7 @@ namespace Orchard.Autoroute.Settings {
|
||||
public void Build(ContentTypePartDefinitionBuilder builder) {
|
||||
builder.WithSetting("AutorouteSettings.PerItemConfiguration", PerItemConfiguration.ToString(CultureInfo.InvariantCulture));
|
||||
builder.WithSetting("AutorouteSettings.AllowCustomPattern", AllowCustomPattern.ToString(CultureInfo.InvariantCulture));
|
||||
builder.WithSetting("AutorouteSettings.AllowSetAsHomePage", AllowSetAsHomePage.ToString(CultureInfo.InvariantCulture));
|
||||
builder.WithSetting("AutorouteSettings.UseCulturePattern", UseCulturePattern.ToString(CultureInfo.InvariantCulture));
|
||||
builder.WithSetting("AutorouteSettings.AutomaticAdjustmentOnEdit", AutomaticAdjustmentOnEdit.ToString(CultureInfo.InvariantCulture));
|
||||
builder.WithSetting("AutorouteSettings.PatternDefinitions", PatternDefinitions);
|
||||
|
||||
@@ -15,7 +15,15 @@
|
||||
<div>
|
||||
@Html.CheckBoxFor(m => m.AllowCustomPattern)
|
||||
<label class="forcheckbox" for="@Html.FieldIdFor(m => m.AllowCustomPattern)">@T("Allow custom patterns")</label>
|
||||
<span class="hint">@T("Allow the user to change the pattern on each item")</span>
|
||||
<span class="hint">@T("Allow the user to change the pattern on each item.")</span>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<div>
|
||||
@Html.CheckBoxFor(m => m.AllowSetAsHomePage)
|
||||
<label class="forcheckbox" for="@Html.FieldIdFor(m => m.AllowSetAsHomePage)">@T("Allow \"Set as home page\"")</label>
|
||||
<span class="hint">@T("Allow the user to set a content item of this type as the home page.")</span>
|
||||
<span class="hint">@T("NOTE: Certain combinations of content type definitions and permission settings can create circumstances for non-Admin users with Dashboard access to remove the home page without the ability to set another one. Use this option with caution.")</span>
|
||||
</div>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
|
||||
</fieldset>
|
||||
@if (!Model.IsHomePage) {
|
||||
if (AuthorizedFor(Permissions.SetHomePage)) {
|
||||
if (AuthorizedFor(Permissions.SetHomePage) && Model.Settings.AllowSetAsHomePage) {
|
||||
<fieldset>
|
||||
<span class="checkbox-and-label">
|
||||
@Html.CheckBoxFor(m => m.PromoteToHomePage)
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Iesi.Collections" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
|
||||
@@ -115,8 +115,8 @@
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NHibernate, Version=5.3.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\NHibernate.5.3.10\lib\net461\NHibernate.dll</HintPath>
|
||||
<Reference Include="NHibernate, Version=5.5.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\NHibernate.5.5.2\lib\net48\NHibernate.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Remotion.Linq, Version=2.2.0.0, Culture=neutral, PublicKeyToken=fee00910d6e5f53b, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Remotion.Linq.2.2.0\lib\net45\Remotion.Linq.dll</HintPath>
|
||||
|
||||
@@ -12,7 +12,7 @@ using Orchard.MediaLibrary.Models;
|
||||
using Orchard.Services;
|
||||
|
||||
namespace Orchard.Azure.MediaServices.Services.Rendering {
|
||||
public class CloudVideoFilter : IHtmlFilter {
|
||||
public class CloudVideoFilter : HtmlFilter {
|
||||
private readonly IShapeFactory _shapeFactory;
|
||||
private readonly IContentManager _contentManager;
|
||||
private readonly IShapeDisplay _shapeDisplay;
|
||||
@@ -23,8 +23,8 @@ namespace Orchard.Azure.MediaServices.Services.Rendering {
|
||||
_shapeDisplay = shapeDisplay;
|
||||
}
|
||||
|
||||
public string ProcessContent(string text, string flavor) {
|
||||
return String.Equals(flavor, "html", StringComparison.OrdinalIgnoreCase) ? ReplaceVideoPlaceholder(text) : text;
|
||||
public override string ProcessContent(string text, HtmlFilterContext context) {
|
||||
return String.Equals(context.Flavor, "html", StringComparison.OrdinalIgnoreCase) ? ReplaceVideoPlaceholder(text) : text;
|
||||
}
|
||||
|
||||
private string ReplaceVideoPlaceholder(string text) {
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Iesi.Collections" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net48" />
|
||||
<package id="Microsoft.WindowsAzure.ConfigurationManager" version="3.1.0" targetFramework="net48" />
|
||||
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net48" />
|
||||
<package id="NHibernate" version="5.3.10" targetFramework="net48" />
|
||||
<package id="NHibernate" version="5.5.2" targetFramework="net48" />
|
||||
<package id="Orchard.WindowsAzure.Diagnostics" version="2.7.0.0" targetFramework="net48" />
|
||||
<package id="Remotion.Linq" version="2.2.0" targetFramework="net48" />
|
||||
<package id="Remotion.Linq.EagerFetching" version="2.2.0" targetFramework="net48" />
|
||||
|
||||
@@ -107,8 +107,8 @@
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NHibernate, Version=5.3.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\NHibernate.5.3.10\lib\net461\NHibernate.dll</HintPath>
|
||||
<Reference Include="NHibernate, Version=5.5.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\NHibernate.5.5.2\lib\net48\NHibernate.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Remotion.Linq, Version=2.2.0.0, Culture=neutral, PublicKeyToken=fee00910d6e5f53b, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Remotion.Linq.2.2.0\lib\net45\Remotion.Linq.dll</HintPath>
|
||||
@@ -220,4 +220,4 @@
|
||||
</FlavorProperties>
|
||||
</VisualStudio>
|
||||
</ProjectExtensions>
|
||||
</Project>
|
||||
</Project>
|
||||
@@ -96,6 +96,8 @@ namespace Orchard.Azure.Services.FileSystems {
|
||||
return newPath;
|
||||
}
|
||||
|
||||
private static string GetFolderName(string path) => path.Substring(path.LastIndexOf('/') + 1);
|
||||
|
||||
public string Combine(string path1, string path2) {
|
||||
if (path1 == null) {
|
||||
throw new ArgumentNullException("path1");
|
||||
@@ -148,10 +150,10 @@ namespace Orchard.Azure.Services.FileSystems {
|
||||
}
|
||||
|
||||
return BlobClient.ListBlobs(prefix)
|
||||
.OfType<CloudBlockBlob>()
|
||||
.Where(blobItem => !blobItem.Uri.AbsoluteUri.EndsWith(FolderEntry))
|
||||
.Select(blobItem => new AzureBlobFileStorage(blobItem, _absoluteRoot))
|
||||
.ToArray();
|
||||
.OfType<CloudBlockBlob>()
|
||||
.Where(blobItem => !blobItem.Uri.AbsoluteUri.EndsWith(FolderEntry))
|
||||
.Select(blobItem => new AzureBlobFileStorage(blobItem, _absoluteRoot))
|
||||
.ToArray();
|
||||
}
|
||||
|
||||
public IEnumerable<IStorageFolder> ListFolders(string path) {
|
||||
@@ -201,6 +203,11 @@ namespace Orchard.Azure.Services.FileSystems {
|
||||
|
||||
public void CreateFolder(string path) {
|
||||
path = ConvertToRelativeUriPath(path);
|
||||
|
||||
if (FileSystemStorageProvider.FolderNameContainsInvalidCharacters(GetFolderName(path))) {
|
||||
throw new InvalidNameCharacterException("The directory name contains invalid character(s)");
|
||||
}
|
||||
|
||||
Container.EnsureDirectoryDoesNotExist(String.Concat(_root, path));
|
||||
|
||||
// Creating a virtually hidden file to make the directory an existing concept
|
||||
@@ -232,7 +239,11 @@ namespace Orchard.Azure.Services.FileSystems {
|
||||
path = ConvertToRelativeUriPath(path);
|
||||
newPath = ConvertToRelativeUriPath(newPath);
|
||||
|
||||
// Workaround for https://github.com/Azure/azure-storage-net/issues/892
|
||||
if (FileSystemStorageProvider.FolderNameContainsInvalidCharacters(GetFolderName(newPath))) {
|
||||
throw new InvalidNameCharacterException("The new directory name contains invalid character(s)");
|
||||
}
|
||||
|
||||
// Workaround for https://github.com/Azure/azure-storage-net/issues/892.
|
||||
// Renaming a folder by only changing the casing corrupts all the files in the folder.
|
||||
if (path.Equals(newPath, StringComparison.OrdinalIgnoreCase)) {
|
||||
var tempPath = Guid.NewGuid().ToString() + "/";
|
||||
@@ -277,6 +288,10 @@ namespace Orchard.Azure.Services.FileSystems {
|
||||
path = ConvertToRelativeUriPath(path);
|
||||
newPath = ConvertToRelativeUriPath(newPath);
|
||||
|
||||
if (FileSystemStorageProvider.FileNameContainsInvalidCharacters(Path.GetFileName(newPath))) {
|
||||
throw new InvalidNameCharacterException("The new file name contains invalid character(s)");
|
||||
}
|
||||
|
||||
Container.EnsureBlobExists(String.Concat(_root, path));
|
||||
Container.EnsureBlobDoesNotExist(String.Concat(_root, newPath));
|
||||
|
||||
@@ -301,6 +316,10 @@ namespace Orchard.Azure.Services.FileSystems {
|
||||
public IStorageFile CreateFile(string path) {
|
||||
path = ConvertToRelativeUriPath(path);
|
||||
|
||||
if (FileSystemStorageProvider.FileNameContainsInvalidCharacters(Path.GetFileName(path))) {
|
||||
throw new InvalidNameCharacterException("The file name contains invalid character(s)");
|
||||
}
|
||||
|
||||
if (Container.BlobExists(String.Concat(_root, path))) {
|
||||
throw new ArgumentException("File " + path + " already exists");
|
||||
}
|
||||
@@ -388,10 +407,7 @@ namespace Orchard.Azure.Services.FileSystems {
|
||||
_rootPath = rootPath;
|
||||
}
|
||||
|
||||
public string GetName() {
|
||||
var path = GetPath();
|
||||
return path.Substring(path.LastIndexOf('/') + 1);
|
||||
}
|
||||
public string GetName() => GetFolderName(GetPath());
|
||||
|
||||
public string GetPath() {
|
||||
return _blob.Uri.ToString().Substring(_rootPath.Length).Trim('/');
|
||||
@@ -416,11 +432,12 @@ namespace Orchard.Azure.Services.FileSystems {
|
||||
long size = 0;
|
||||
|
||||
foreach (var blobItem in directoryBlob.ListBlobs()) {
|
||||
if (blobItem is CloudBlockBlob)
|
||||
size += ((CloudBlockBlob)blobItem).Properties.Length;
|
||||
|
||||
if (blobItem is CloudBlobDirectory)
|
||||
size += GetDirectorySize((CloudBlobDirectory)blobItem);
|
||||
if (blobItem is CloudBlockBlob blob) {
|
||||
size += blob.Properties.Length;
|
||||
}
|
||||
else if (blobItem is CloudBlobDirectory directory) {
|
||||
size += GetDirectorySize(directory);
|
||||
}
|
||||
}
|
||||
|
||||
return size;
|
||||
|
||||
@@ -71,7 +71,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Iesi.Collections" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
|
||||
@@ -14,10 +14,10 @@
|
||||
<package id="Microsoft.WindowsAzure.Caching" version="2.4.0.0" targetFramework="net48" />
|
||||
<package id="Microsoft.WindowsAzure.ConfigurationManager" version="3.1.0" targetFramework="net48" />
|
||||
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net48" />
|
||||
<package id="NHibernate" version="5.3.10" targetFramework="net48" />
|
||||
<package id="NHibernate" version="5.5.2" targetFramework="net48" />
|
||||
<package id="Orchard.WindowsAzure.ServiceRuntime" version="2.7.0.0" targetFramework="net48" />
|
||||
<package id="Remotion.Linq" version="2.2.0" targetFramework="net48" />
|
||||
<package id="Remotion.Linq.EagerFetching" version="2.2.0" targetFramework="net48" />
|
||||
<package id="System.Spatial" version="5.8.4" targetFramework="net48" />
|
||||
<package id="WindowsAzure.Storage" version="5.0.2" targetFramework="net48" />
|
||||
</packages>
|
||||
</packages>
|
||||
@@ -46,7 +46,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Iesi.Collections" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Iesi.Collections" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
|
||||
@@ -47,11 +47,11 @@
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Newtonsoft.Json" publicKeyToken="30AD4FE6B2A6AEED" culture="neutral"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-12.0.0.0" newVersion="12.0.0.0"/>
|
||||
<bindingRedirect oldVersion="0.0.0.0-13.0.0.0" newVersion="13.0.0.0"/>
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Iesi.Collections" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Iesi.Collections" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Iesi.Collections" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Iesi.Collections" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Iesi.Collections" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
|
||||
@@ -65,8 +65,8 @@
|
||||
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NHibernate, Version=5.3.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\NHibernate.5.3.10\lib\net461\NHibernate.dll</HintPath>
|
||||
<Reference Include="NHibernate, Version=5.5.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\NHibernate.5.5.2\lib\net48\NHibernate.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Remotion.Linq, Version=2.2.0.0, Culture=neutral, PublicKeyToken=fee00910d6e5f53b, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Remotion.Linq.2.2.0\lib\net45\Remotion.Linq.dll</HintPath>
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Iesi.Collections" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<package id="Microsoft.AspNet.WebPages" version="3.2.7" targetFramework="net48" />
|
||||
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="4.1.0" targetFramework="net48" />
|
||||
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net48" />
|
||||
<package id="NHibernate" version="5.3.10" targetFramework="net48" />
|
||||
<package id="NHibernate" version="5.5.2" targetFramework="net48" />
|
||||
<package id="Remotion.Linq" version="2.2.0" targetFramework="net48" />
|
||||
<package id="Remotion.Linq.EagerFetching" version="2.2.0" targetFramework="net48" />
|
||||
</packages>
|
||||
</packages>
|
||||
@@ -66,7 +66,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Iesi.Collections" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Iesi.Collections" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
|
||||
@@ -198,6 +198,13 @@ namespace Orchard.CustomForms.Controllers {
|
||||
|
||||
contentItem.As<ICommonPart>().Container = customForm.ContentItem;
|
||||
|
||||
// save the submitted form
|
||||
if (customForm.SaveContentItem) {
|
||||
conditionallyPublish(contentItem);
|
||||
// Refresh content item
|
||||
contentItem = _contentManager.Get(contentItem.Id, VersionOptions.Latest);
|
||||
}
|
||||
|
||||
// triggers any event
|
||||
_rulesManager.TriggerEvent("CustomForm", "Submitted",
|
||||
() => new Dictionary<string, object> { { "Content", contentItem } });
|
||||
@@ -210,11 +217,6 @@ namespace Orchard.CustomForms.Controllers {
|
||||
returnUrl = _tokenizer.Replace(customForm.RedirectUrl, new Dictionary<string, object> { { "Content", contentItem } });
|
||||
}
|
||||
|
||||
// save the submitted form
|
||||
if (customForm.SaveContentItem) {
|
||||
conditionallyPublish(contentItem);
|
||||
}
|
||||
|
||||
// writes a confirmation message
|
||||
if (customForm.CustomMessage) {
|
||||
if (!String.IsNullOrWhiteSpace(customForm.Message)) {
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Iesi.Collections" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Iesi.Collections" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Iesi.Collections" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
|
||||
@@ -1,12 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Specialized;
|
||||
using System.Linq;
|
||||
using System.Web;
|
||||
|
||||
namespace Orchard.DynamicForms.Helpers {
|
||||
public static class NameValueCollectionExtensions {
|
||||
public static string ToQueryString(this NameValueCollection nameValues) {
|
||||
return String.Join("&", (from string name in nameValues select String.Concat(name, "=", HttpUtility.UrlEncode(nameValues[name]))).ToArray());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -339,7 +339,6 @@
|
||||
<Compile Include="Migrations.cs" />
|
||||
<Compile Include="Handlers\ReadFormValuesHandler.cs" />
|
||||
<Compile Include="Services\FormElementEventHandlerBase.cs" />
|
||||
<Compile Include="Helpers\NameValueCollectionExtensions.cs" />
|
||||
<Compile Include="Models\Submission.cs" />
|
||||
<Compile Include="Permissions.cs" />
|
||||
<Compile Include="Services\FormService.cs" />
|
||||
|
||||
@@ -467,4 +467,4 @@ namespace Orchard.DynamicForms.Services {
|
||||
return validatorElementType == elementType || validatorElementType.IsAssignableFrom(elementType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Iesi.Collections" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Iesi.Collections" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
|
||||
@@ -4,46 +4,41 @@ using Orchard.ContentManagement.Handlers;
|
||||
using Orchard.Fields.Fields;
|
||||
using Orchard.Fields.Settings;
|
||||
using Orchard.Localization;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace Orchard.Fields.Drivers {
|
||||
public class EnumerationFieldDriver : ContentFieldDriver<EnumerationField> {
|
||||
public IOrchardServices Services { get; set; }
|
||||
|
||||
private const string TemplateName = "Fields/Enumeration.Edit";
|
||||
|
||||
public EnumerationFieldDriver(IOrchardServices services) {
|
||||
Services = services;
|
||||
|
||||
T = NullLocalizer.Instance;
|
||||
}
|
||||
|
||||
public Localizer T { get; set; }
|
||||
|
||||
private static string GetPrefix(ContentField field, ContentPart part) {
|
||||
return part.PartDefinition.Name + "." + field.Name;
|
||||
}
|
||||
private static string GetPrefix(ContentField field, ContentPart part) =>
|
||||
part.PartDefinition.Name + "." + field.Name;
|
||||
|
||||
private static string GetDifferentiator(EnumerationField field, ContentPart part) {
|
||||
return field.Name;
|
||||
}
|
||||
private static string GetDifferentiator(EnumerationField field) => field.Name;
|
||||
|
||||
protected override DriverResult Display(ContentPart part, EnumerationField field, string displayType, dynamic shapeHelper) {
|
||||
return ContentShape("Fields_Enumeration", GetDifferentiator(field, part),
|
||||
() => shapeHelper.Fields_Enumeration());
|
||||
return ContentShape("Fields_Enumeration", GetDifferentiator(field), () => shapeHelper.Fields_Enumeration());
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(ContentPart part, EnumerationField field, dynamic shapeHelper) {
|
||||
return ContentShape("Fields_Enumeration_Edit", GetDifferentiator(field, part),
|
||||
() => {
|
||||
if (part.IsNew() && String.IsNullOrEmpty(field.Value)) {
|
||||
var settings = field.PartFieldDefinition.Settings.GetModel<EnumerationFieldSettings>();
|
||||
if (!String.IsNullOrWhiteSpace(settings.DefaultValue)) {
|
||||
field.Value = settings.DefaultValue;
|
||||
}
|
||||
return ContentShape("Fields_Enumeration_Edit", GetDifferentiator(field), () => {
|
||||
if (part.IsNew() && string.IsNullOrEmpty(field.Value)) {
|
||||
var settings = field.PartFieldDefinition.Settings.GetModel<EnumerationFieldSettings>();
|
||||
if (!string.IsNullOrWhiteSpace(settings.DefaultValue)) {
|
||||
field.SelectedValues = new string[] { settings.DefaultValue };
|
||||
}
|
||||
return shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: field, Prefix: GetPrefix(field, part));
|
||||
});
|
||||
}
|
||||
|
||||
return shapeHelper.EditorTemplate(TemplateName: TemplateName, Model: field, Prefix: GetPrefix(field, part));
|
||||
});
|
||||
}
|
||||
|
||||
protected override DriverResult Editor(ContentPart part, EnumerationField field, IUpdateModel updater, dynamic shapeHelper) {
|
||||
|
||||
@@ -7,28 +7,16 @@ namespace Orchard.Fields.Fields {
|
||||
private const char Separator = ';';
|
||||
|
||||
public string Value {
|
||||
get { return Storage.Get<string>(); }
|
||||
set { Storage.Set(value ?? String.Empty); }
|
||||
get => Storage.Get<string>()?.Trim(Separator) ?? "";
|
||||
set => Storage.Set(string.IsNullOrWhiteSpace(value)
|
||||
? string.Empty
|
||||
// It is now the responsibility of this field to (re-)add the separators.
|
||||
: Separator + value.Trim(Separator) + Separator);
|
||||
}
|
||||
|
||||
public string[] SelectedValues {
|
||||
get {
|
||||
var value = Value;
|
||||
if(string.IsNullOrWhiteSpace(value)) {
|
||||
return new string[0];
|
||||
}
|
||||
|
||||
return value.Split(new [] { Separator }, StringSplitOptions.RemoveEmptyEntries);
|
||||
}
|
||||
|
||||
set {
|
||||
if (value == null || value.Length == 0) {
|
||||
Value = String.Empty;
|
||||
}
|
||||
else {
|
||||
Value = Separator + string.Join(Separator.ToString(), value) + Separator;
|
||||
}
|
||||
}
|
||||
get => Value?.Split(new[] { Separator }, StringSplitOptions.RemoveEmptyEntries) ?? new string[0];
|
||||
set => Value = value?.Length > 0 ? string.Join(Separator.ToString(), value) : "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,22 +1,27 @@
|
||||
@model Orchard.Fields.Fields.EnumerationField
|
||||
|
||||
@using Orchard.Fields.Settings;
|
||||
|
||||
@{
|
||||
var settings = Model.PartFieldDefinition.Settings.GetModel<EnumerationFieldSettings>();
|
||||
string[] options = (!String.IsNullOrWhiteSpace(settings.Options)) ? settings.Options.Split(new string[] { System.Environment.NewLine }, StringSplitOptions.None) : new string[] { T("Select an option").ToString() };
|
||||
}
|
||||
|
||||
<fieldset>
|
||||
<label for="@Html.FieldIdFor(m => m.Value)" @if (settings.Required) { <text> class="required" </text> }>@Model.DisplayName</label>
|
||||
<label for="@Html.FieldIdFor(m => m.Value)" @if (settings.Required) { <text> class="required" </text> }>@Model.DisplayName</label>
|
||||
@switch (settings.ListMode) {
|
||||
case ListMode.Dropdown:
|
||||
@Html.DropDownListFor(m => m.Value, new SelectList(options, Model.Value), settings.Required ? new { required = "required" } : null)
|
||||
@Html.DropDownListFor(m => m.Value, new SelectList(options, Model.SelectedValues.FirstOrDefault()), settings.Required ? new { required = "required" } : null)
|
||||
break;
|
||||
|
||||
case ListMode.Radiobutton:
|
||||
foreach (var option in options) {
|
||||
if (string.IsNullOrWhiteSpace(option)) {
|
||||
<label>@Html.RadioButton("Value", "", string.IsNullOrWhiteSpace(Model.Value), settings.Required ? new { required = "required" } : null)<i>@T("unset")</i></label> }
|
||||
<label>@Html.RadioButton("Value", "", string.IsNullOrWhiteSpace(Model.SelectedValues.FirstOrDefault()), settings.Required ? new { required = "required" } : null)<i>@T("unset")</i></label>
|
||||
}
|
||||
else {
|
||||
<label>@Html.RadioButton("Value", option, (option == Model.Value), settings.Required ? new { required = "required" } : null)@option</label> }
|
||||
<label>@Html.RadioButton("Value", option, (option == Model.SelectedValues.FirstOrDefault()), settings.Required ? new { required = "required" } : null)@option</label>
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Iesi.Collections" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Iesi.Collections" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
|
||||
@@ -95,8 +95,8 @@
|
||||
<Reference Include="Newtonsoft.Json, Version=13.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Newtonsoft.Json.13.0.1\lib\net45\Newtonsoft.Json.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NHibernate, Version=5.3.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\NHibernate.5.3.10\lib\net461\NHibernate.dll</HintPath>
|
||||
<Reference Include="NHibernate, Version=5.5.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\NHibernate.5.5.2\lib\net48\NHibernate.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Owin, Version=1.0.0.0, Culture=neutral, PublicKeyToken=f0ebd12fd5e55cc5, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Owin.1.0\lib\net40\Owin.dll</HintPath>
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Iesi.Collections" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<package id="Microsoft.Owin.Security" version="4.2.2" targetFramework="net48" />
|
||||
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net48" />
|
||||
<package id="Newtonsoft.Json" version="13.0.1" targetFramework="net48" />
|
||||
<package id="NHibernate" version="5.3.10" targetFramework="net48" />
|
||||
<package id="NHibernate" version="5.5.2" targetFramework="net48" />
|
||||
<package id="Owin" version="1.0" targetFramework="net48" />
|
||||
<package id="Remotion.Linq" version="2.2.0" targetFramework="net48" />
|
||||
<package id="Remotion.Linq.EagerFetching" version="2.2.0" targetFramework="net48" />
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Iesi.Collections" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
|
||||
@@ -68,8 +68,8 @@
|
||||
<Reference Include="Microsoft.Web.Infrastructure, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="NHibernate, Version=5.3.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\NHibernate.5.3.10\lib\net461\NHibernate.dll</HintPath>
|
||||
<Reference Include="NHibernate, Version=5.5.0.0, Culture=neutral, PublicKeyToken=aa95f207798dfdb4, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\NHibernate.5.5.2\lib\net48\NHibernate.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Remotion.Linq, Version=2.2.0.0, Culture=neutral, PublicKeyToken=fee00910d6e5f53b, processorArchitecture=MSIL">
|
||||
<HintPath>..\..\..\packages\Remotion.Linq.2.2.0\lib\net45\Remotion.Linq.dll</HintPath>
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Iesi.Collections" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
<package id="Microsoft.AspNet.WebPages" version="3.2.7" targetFramework="net48" />
|
||||
<package id="Microsoft.CodeDom.Providers.DotNetCompilerPlatform" version="4.1.0" targetFramework="net48" />
|
||||
<package id="Microsoft.Web.Infrastructure" version="1.0.0.0" targetFramework="net48" />
|
||||
<package id="NHibernate" version="5.3.10" targetFramework="net48" />
|
||||
<package id="NHibernate" version="5.5.2" targetFramework="net48" />
|
||||
<package id="Remotion.Linq" version="2.2.0" targetFramework="net48" />
|
||||
<package id="Remotion.Linq.EagerFetching" version="2.2.0" targetFramework="net48" />
|
||||
</packages>
|
||||
</packages>
|
||||
@@ -46,7 +46,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Iesi.Collections" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Iesi.Collections" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
|
||||
@@ -2,15 +2,15 @@
|
||||
using Orchard.Layouts.Framework.Display;
|
||||
using Orchard.Layouts.Framework.Drivers;
|
||||
using Orchard.Layouts.Helpers;
|
||||
using Orchard.Layouts.Services;
|
||||
using Orchard.Layouts.ViewModels;
|
||||
using Orchard.Services;
|
||||
|
||||
namespace Orchard.Layouts.Drivers {
|
||||
public class HeadingElementDriver : ElementDriver<Heading> {
|
||||
private readonly IElementFilterProcessor _processor;
|
||||
private readonly IHtmlFilterProcessor _htmlFilterProcessor;
|
||||
|
||||
public HeadingElementDriver(IElementFilterProcessor processor) {
|
||||
_processor = processor;
|
||||
public HeadingElementDriver(IHtmlFilterProcessor htmlFilterProcessor) {
|
||||
_htmlFilterProcessor = htmlFilterProcessor;
|
||||
}
|
||||
|
||||
protected override EditorResult OnBuildEditor(Heading element, ElementEditorContext context) {
|
||||
@@ -30,7 +30,7 @@ namespace Orchard.Layouts.Drivers {
|
||||
}
|
||||
|
||||
protected override void OnDisplaying(Heading element, ElementDisplayingContext context) {
|
||||
context.ElementShape.ProcessedContent = _processor.ProcessContent(element.Content, "html", context.GetTokenData());
|
||||
context.ElementShape.ProcessedContent = _htmlFilterProcessor.ProcessFilters(element.Content, new HtmlFilterContext { Flavor = "html", Data = context.GetTokenData() });
|
||||
context.ElementShape.Level = element.Level;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,15 +2,16 @@
|
||||
using Orchard.Layouts.Framework.Display;
|
||||
using Orchard.Layouts.Framework.Drivers;
|
||||
using Orchard.Layouts.Helpers;
|
||||
using Orchard.Layouts.Services;
|
||||
using Orchard.Layouts.ViewModels;
|
||||
using Orchard.Services;
|
||||
|
||||
namespace Orchard.Layouts.Drivers {
|
||||
namespace Orchard.Layouts.Drivers
|
||||
{
|
||||
public class HtmlElementDriver : ElementDriver<Html> {
|
||||
private readonly IElementFilterProcessor _processor;
|
||||
private readonly IHtmlFilterProcessor _htmlFilterProcessor;
|
||||
|
||||
public HtmlElementDriver(IElementFilterProcessor processor) {
|
||||
_processor = processor;
|
||||
public HtmlElementDriver(IHtmlFilterProcessor htmlFilterProcessor) {
|
||||
_htmlFilterProcessor = htmlFilterProcessor;
|
||||
}
|
||||
|
||||
protected override EditorResult OnBuildEditor(Html element, ElementEditorContext context) {
|
||||
@@ -29,7 +30,7 @@ namespace Orchard.Layouts.Drivers {
|
||||
}
|
||||
|
||||
protected override void OnDisplaying(Html element, ElementDisplayingContext context) {
|
||||
context.ElementShape.ProcessedContent = _processor.ProcessContent(element.Content, "html", context.GetTokenData());
|
||||
context.ElementShape.ProcessedContent = _htmlFilterProcessor.ProcessFilters(element.Content, new HtmlFilterContext { Flavor = "html", Data = context.GetTokenData() });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,16 +2,17 @@
|
||||
using Orchard.Layouts.Framework.Display;
|
||||
using Orchard.Layouts.Framework.Drivers;
|
||||
using Orchard.Layouts.Helpers;
|
||||
using Orchard.Layouts.Services;
|
||||
using Orchard.Layouts.ViewModels;
|
||||
using Orchard.Services;
|
||||
using MarkdownElement = Orchard.Layouts.Elements.Markdown;
|
||||
|
||||
namespace Orchard.Layouts.Drivers {
|
||||
namespace Orchard.Layouts.Drivers
|
||||
{
|
||||
[OrchardFeature("Orchard.Layouts.Markdown")]
|
||||
public class MarkdownElementDriver : ElementDriver<MarkdownElement> {
|
||||
private readonly IElementFilterProcessor _processor;
|
||||
public MarkdownElementDriver(IElementFilterProcessor processor) {
|
||||
_processor = processor;
|
||||
private readonly IHtmlFilterProcessor _htmlFilterProcessor;
|
||||
public MarkdownElementDriver(IHtmlFilterProcessor htmlFilterProcessor) {
|
||||
_htmlFilterProcessor = htmlFilterProcessor;
|
||||
}
|
||||
|
||||
protected override EditorResult OnBuildEditor(MarkdownElement element, ElementEditorContext context) {
|
||||
@@ -29,7 +30,7 @@ namespace Orchard.Layouts.Drivers {
|
||||
}
|
||||
|
||||
protected override void OnDisplaying(MarkdownElement element, ElementDisplayingContext context) {
|
||||
context.ElementShape.ProcessedContent = _processor.ProcessContent(element.Content, "markdown", context.GetTokenData());
|
||||
context.ElementShape.ProcessedContent = _htmlFilterProcessor.ProcessFilters(element.Content, new HtmlFilterContext { Flavor = "markdown", Data = context.GetTokenData() });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,15 +2,15 @@
|
||||
using Orchard.Layouts.Framework.Display;
|
||||
using Orchard.Layouts.Framework.Drivers;
|
||||
using Orchard.Layouts.Helpers;
|
||||
using Orchard.Layouts.Services;
|
||||
using Orchard.Layouts.ViewModels;
|
||||
using Orchard.Services;
|
||||
|
||||
namespace Orchard.Layouts.Drivers {
|
||||
public class ParagraphElementDriver : ElementDriver<Paragraph> {
|
||||
private readonly IElementFilterProcessor _processor;
|
||||
private readonly IHtmlFilterProcessor _htmlFilterProcessor;
|
||||
|
||||
public ParagraphElementDriver(IElementFilterProcessor processor) {
|
||||
_processor = processor;
|
||||
public ParagraphElementDriver(IHtmlFilterProcessor htmlFilterProcessor) {
|
||||
_htmlFilterProcessor = htmlFilterProcessor;
|
||||
}
|
||||
|
||||
protected override EditorResult OnBuildEditor(Paragraph element, ElementEditorContext context) {
|
||||
@@ -28,7 +28,7 @@ namespace Orchard.Layouts.Drivers {
|
||||
}
|
||||
|
||||
protected override void OnDisplaying(Paragraph element, ElementDisplayingContext context) {
|
||||
context.ElementShape.ProcessedContent = _processor.ProcessContent(element.Content, "html", context.GetTokenData());
|
||||
context.ElementShape.ProcessedContent = _htmlFilterProcessor.ProcessFilters(element.Content, new HtmlFilterContext { Flavor = "html", Data = context.GetTokenData() });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,15 +2,16 @@
|
||||
using Orchard.Layouts.Framework.Display;
|
||||
using Orchard.Layouts.Framework.Drivers;
|
||||
using Orchard.Layouts.Helpers;
|
||||
using Orchard.Layouts.Services;
|
||||
using Orchard.Layouts.ViewModels;
|
||||
using Orchard.Services;
|
||||
|
||||
namespace Orchard.Layouts.Drivers {
|
||||
namespace Orchard.Layouts.Drivers
|
||||
{
|
||||
public class TextElementDriver : ElementDriver<Text> {
|
||||
private readonly IElementFilterProcessor _processor;
|
||||
private readonly IHtmlFilterProcessor _htmlFilterProcessor;
|
||||
|
||||
public TextElementDriver(IElementFilterProcessor processor) {
|
||||
_processor = processor;
|
||||
public TextElementDriver(IHtmlFilterProcessor htmlFilterProcessor) {
|
||||
_htmlFilterProcessor = htmlFilterProcessor;
|
||||
}
|
||||
|
||||
protected override EditorResult OnBuildEditor(Text element, ElementEditorContext context) {
|
||||
@@ -28,7 +29,7 @@ namespace Orchard.Layouts.Drivers {
|
||||
}
|
||||
|
||||
protected override void OnDisplaying(Text element, ElementDisplayingContext context) {
|
||||
context.ElementShape.ProcessedContent = _processor.ProcessContent(element.Content, "textarea", context.GetTokenData());
|
||||
context.ElementShape.ProcessedContent = _htmlFilterProcessor.ProcessFilters(element.Content, new HtmlFilterContext { Flavor = "textarea", Data = context.GetTokenData() });
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,34 +0,0 @@
|
||||
using System;
|
||||
using Orchard.Environment.Extensions;
|
||||
using Orchard.Layouts.Services;
|
||||
using Orchard.Tokens;
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace Orchard.Layouts.Filters {
|
||||
[OrchardFeature("Orchard.Layouts.Tokens")]
|
||||
public class TokensFilter : IElementFilter {
|
||||
|
||||
private readonly ITokenizer _tokenizer;
|
||||
|
||||
public TokensFilter(ITokenizer tokenizer) {
|
||||
_tokenizer = tokenizer;
|
||||
}
|
||||
|
||||
public string ProcessContent(string text, string flavor) {
|
||||
return ProcessContent(text, flavor, new Dictionary<string, object>());
|
||||
}
|
||||
|
||||
public string ProcessContent(string text, string flavor, IDictionary<string, object> context) {
|
||||
if (String.IsNullOrEmpty(text))
|
||||
return "";
|
||||
|
||||
if (!text.Contains("#{")) {
|
||||
return text;
|
||||
}
|
||||
|
||||
text = _tokenizer.Replace(text, context, new ReplaceOptions { Encoding = ReplaceOptions.NoEncode });
|
||||
|
||||
return text;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -29,7 +29,7 @@ Features:
|
||||
Dependencies: Orchard.Layouts, Orchard.Projections
|
||||
Orchard.Layouts.Tokens:
|
||||
Name: Element Tokens
|
||||
Description: Provides an element token provider that enables elements to be rendered using a token and enables tokens to be used inside of various elements such as Html, Text and Paragraph.
|
||||
Description: Provides an element token provider that enables elements to be rendered using a token.
|
||||
Category: Layout
|
||||
Dependencies: Orchard.Layouts, Orchard.Tokens
|
||||
Orchard.Layouts.UI:
|
||||
|
||||
@@ -319,7 +319,6 @@
|
||||
<Compile Include="Elements\Break.cs" />
|
||||
<Compile Include="Elements\UIElement.cs" />
|
||||
<Compile Include="Elements\PlaceableContentItem.cs" />
|
||||
<Compile Include="Filters\TokensFilter.cs" />
|
||||
<Compile Include="Framework\Display\ElementDisplayedContext.cs" />
|
||||
<Compile Include="Framework\Display\ElementDisplayingContext.cs" />
|
||||
<Compile Include="Framework\Drivers\ImportContentContextWrapper.cs" />
|
||||
@@ -375,9 +374,6 @@
|
||||
<Compile Include="Services\ElementEventContext.cs" />
|
||||
<Compile Include="Services\ElementEventHandlerBase.cs" />
|
||||
<Compile Include="Models\ElementSessionState.cs" />
|
||||
<Compile Include="Services\ElementFilterProcessor.cs" />
|
||||
<Compile Include="Services\IElementFilterProcessor.cs" />
|
||||
<Compile Include="Services\IElementFilter.cs" />
|
||||
<Compile Include="Services\ICurrentControllerAccessor.cs" />
|
||||
<Compile Include="Services\IElementEventHandler.cs" />
|
||||
<Compile Include="Services\ILayoutEditorFactory.cs" />
|
||||
|
||||
@@ -1,19 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.Services;
|
||||
|
||||
namespace Orchard.Layouts.Services {
|
||||
public class ElementFilterProcessor : IElementFilterProcessor {
|
||||
private readonly IEnumerable<IHtmlFilter> _filters;
|
||||
public ElementFilterProcessor(IEnumerable<IHtmlFilter> filters) {
|
||||
_filters = filters;
|
||||
}
|
||||
|
||||
public string ProcessContent(string text, string flavor, IDictionary<string, object> context) {
|
||||
foreach (var htmlFilter in _filters) {
|
||||
var elementFilter = htmlFilter as IElementFilter;
|
||||
text = elementFilter != null ? elementFilter.ProcessContent(text, flavor, context) : htmlFilter.ProcessContent(text, flavor);
|
||||
}
|
||||
return text;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.Services;
|
||||
|
||||
namespace Orchard.Layouts.Services {
|
||||
public interface IElementFilter : IHtmlFilter {
|
||||
string ProcessContent(string text, string flavor, IDictionary<string, object> context);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using Orchard.Services;
|
||||
|
||||
namespace Orchard.Layouts.Services {
|
||||
public interface IElementFilterProcessor : IDependency {
|
||||
string ProcessContent(string text, string flavor, IDictionary<string, object> context);
|
||||
}
|
||||
}
|
||||
@@ -51,7 +51,7 @@
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="NHibernate" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.3.0.0" newVersion="5.3.0.0" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-5.5.0.0" newVersion="5.5.0.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="Iesi.Collections" publicKeyToken="aa95f207798dfdb4" culture="neutral" />
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user