Compare commits

..

22 Commits

Author SHA1 Message Date
Benedek Farkas
12f285caf5 Updating ModuleRootWebConfig.txt codegen template according to the new Newtonsoft.Json and NHibernate version 2024-11-29 11:16:22 +01:00
Benedek Farkas
f3e9f9550d Adapting unit tests to NHibernate breaking change
https://github.com/nhibernate/nhibernate-core/issues/1106
https://github.com/nhibernate/nhibernate-core/issues/1095
2024-11-28 16:42:04 +01:00
Benedek Farkas
4c1afb119b Adapting SchemaCommandGenerator to obsolete NHibernate code 2024-11-28 13:24:52 +01:00
Benedek Farkas
b254fc5463 Upgrading NHibernate to 5.5.2 2024-11-28 12:59:40 +01:00
aaronamm
32e7d862f9 Add AutorouteSettings.AllowSetAsHomePage to control whether user can set a content to display on a home page (#8424)
* Add AutorouteSettings.AllowSetAsHomePage to control whether user can set a content to display on a home page

* Extending the description of the AllowSetAsHomePage setting

* Updating setting label

---------

Co-authored-by: Benedek Farkas <benedek.farkas@lombiq.com>
2024-11-14 17:36:34 +01:00
Andrea Piovanelli
6e4fefd873 Content Item published before Custom Form submit event triggers (#8795)
* Moved content item publish before triggering form submit events.
Refreshed the content item passed in the context of rules manager and workflow manager.

* Added version to content manager get call after conditionally publishing the content item.
2024-05-17 09:33:45 +02:00
Andrea Piovanelli
fc8b681b4e Ambiguity in LocalizedTaxonomyController action names (#8785)
* Removed ambiguity to LocalizedTaxonomyController actions.

* Properly added ApplyPreRequest to the action.

* Code refactoring

* Code autoformatting

* Sorting using

* Overriding GetTaxonomy action

* Calling base GetTaxonomy action

* Removing ApplyPreRequest function

* Removed ApplyPreRequest function

* Added virtual keyword to GetTaxonomy action in LocalizedTaxonomyController

---------

Co-authored-by: Benedek Farkas <benedek.farkas@lombiq.com>
2024-05-16 17:16:43 +02:00
Benedek Farkas
86bcf413e7 Merge remote-tracking branch 'origin/1.10.x' into dev 2024-05-03 15:33:22 +02:00
Benedek Farkas
0d9fccb624 Fixing WebDownloaderTests 2024-05-03 15:33:07 +02:00
Benedek Farkas
62038ed1bb #6981: Normalized image profile path hash and added profile purging (#8788)
* #6981 Normalized image profile path hash and added profile purging

* Profile purge functions rather belong in IImageProfileService

* Deleting an Image Profile now also removes all its files too

* Comment formatting

* Caching the value of the "Orchard.MediaProcessing.NormalizePath" app setting in ImageProfileManager

* Code styling in ImageProfileManager

* Formatting and code styling ImageProfileManager

---------

Co-authored-by: Arjan Noordende <arjan@zumey.com>
2024-05-03 15:19:20 +02:00
Benedek Farkas
6eab0a1260 Merge branch '1.10.x' into 'dev' through the 'issue/8791' integration branch (the previous commit was a squash merge by mistake) 2024-04-19 16:50:55 +02:00
Benedek Farkas
e60a845359 #8791: Merge 1.10.x into dev (#8792)
* 6748: Stricter file and folder name validation (#6792)

* Media Library: More strict file and folder name validation, fixes #6748

* Resetting MediaLibraryService changes to 1.10.x

* Code styling in FileSystemStorageProvider

* Adding string file and folder name validation to FileSystemStorageProvider, so that MediaLibrary components don't need to do it separately

* Applying the same file and folder name validation to AzureFileSystem too

* Code styling and fixes in AzureFileSystem, MediaLibrary and IStorageProvider

* Simplifying invalid character detection

* Code styling

* Adding InvalidNameCharacterException to be able to handle invalid characters precisely at various user-facing components

* Updating MediaLibrary not to log an error when a file can't be uploaded due to invalid characters

---------

Co-authored-by: Lombiq <github@lombiq.com>

* #6793: Adding a content-independent culture selector shape for the front-end (#8784)

* Adds a new CultureSelector shape for front-end

* fixed query string culture change

* Moving NameValueCollectionExtensions from Orchard.DynamicForms and Orchard.Localization to Orchard.Framework

* Code styling

* Simplifying UserCultureSelectorController and removing the addition of the culture to the query string

* EOF empty lines and code styling

* Fixing that the main Orchard.Localization should depend on Orchard.Autoroute

* Code styling in LocalizationService

* Updating LocalizationService to not have to use IEnumerable.Single

* Matching culture name matching in LocalizationService culture- and casing-invariant

---------

Co-authored-by: Sergio Navarro <jersio@hotmail.com>
Co-authored-by: psp589 <pablosanchez589@gmail.com>

* #8640: Fixing consistency between different Enumeration Field flavors' data storage (#8789)

* Reworking EnumerationField's logic to store/retrieve its (selected) values

* Fixing exception when creating new item with CheckboxList flavor, adding more nullchecks and compactness

* Code styling in EnumerationFieldDriver

* Code styling in EnumerationField editor template

* Fixing that EnumerationFieldDriver and the EnumerationField editor template should read SelectedValues instead of Values directly

---------

Co-authored-by: Matteo Piovanelli <MatteoPiovanelli-Laser@users.noreply.github.com>

* Fixing merge

---------

Co-authored-by: Lombiq <github@lombiq.com>
Co-authored-by: Sergio Navarro <jersio@hotmail.com>
Co-authored-by: psp589 <pablosanchez589@gmail.com>
Co-authored-by: Matteo Piovanelli <MatteoPiovanelli-Laser@users.noreply.github.com>
2024-04-19 15:48:17 +02:00
Benedek Farkas
23fb9dff92 Fixing merge 2024-04-19 15:34:59 +02:00
Benedek Farkas
0bce8e634b Merge branch '1.10.x' into issue/8791
# Conflicts:
#	src/Orchard.Web/Modules/Orchard.Azure/Services/FileSystems/AzureFileSystem.cs
#	src/Orchard.Web/Modules/Orchard.Localization/Module.txt
#	src/Orchard.Web/Modules/Orchard.Localization/Orchard.Localization.csproj
#	src/Orchard.Web/Modules/Orchard.Localization/Services/LocalizationService.cs
#	src/Orchard.Web/Modules/Orchard.MediaLibrary/Controllers/ClientStorageController.cs
2024-04-19 12:38:53 +02:00
Benedek Farkas
0faf196f74 #6193: IHtmlFilter and TokenFilter improvements and bugfixes (fixing auto-merge) (#8790) 2024-04-19 11:59:21 +02:00
Sipke Schoorstra
cf4335e5ba #6193: IHtmlFilter and TokenFilter improvements and bugfixes (#6938)
* IHtmlFilter and TokenFilter improvements and bugfixes.

This changeset unifies the two separate TokenFilter implementations (one for BodyPart, TextField, etc and another one for certain elements such as Html).
It also fixes a bug with the TokenFilter when executing for HtmlWidget, where the wrong content item is being recorded by the handler (the original implementation).
Thirdly, it removes awkward code repetition by moving filter execution into a dedicated HtmlFilterRunner service.

* Renaming IHtmlFilterRunner to IHtmlFilterProcessor (and its references)

* Applying IHtmlFilterProcessor to HtmlMenuItems too + code styling in BodyPartDriver

* Fixing FeedControllerTests.CorePartValuesAreExtracted

* Code styling

---------

Co-authored-by: Jean-Thierry Kéchichian <jean-thierry.kechichian@wanadoo.fr>
Co-authored-by: Sipke Schoorstra <sipke@ideliverable.com>
Co-authored-by: Benedek Farkas <benedek.farkas@lombiq.com>
2024-04-19 11:20:32 +02:00
Benedek Farkas
fdbb06ba8d #8640: Fixing consistency between different Enumeration Field flavors' data storage (#8789)
* Reworking EnumerationField's logic to store/retrieve its (selected) values

* Fixing exception when creating new item with CheckboxList flavor, adding more nullchecks and compactness

* Code styling in EnumerationFieldDriver

* Code styling in EnumerationField editor template

* Fixing that EnumerationFieldDriver and the EnumerationField editor template should read SelectedValues instead of Values directly

---------

Co-authored-by: Matteo Piovanelli <MatteoPiovanelli-Laser@users.noreply.github.com>
2024-04-19 11:11:47 +02:00
Benedek Farkas
15cad85d1e #6793: Adding a content-independent culture selector shape for the front-end (#8784)
* Adds a new CultureSelector shape for front-end

* fixed query string culture change

* Moving NameValueCollectionExtensions from Orchard.DynamicForms and Orchard.Localization to Orchard.Framework

* Code styling

* Simplifying UserCultureSelectorController and removing the addition of the culture to the query string

* EOF empty lines and code styling

* Fixing that the main Orchard.Localization should depend on Orchard.Autoroute

* Code styling in LocalizationService

* Updating LocalizationService to not have to use IEnumerable.Single

* Matching culture name matching in LocalizationService culture- and casing-invariant

---------

Co-authored-by: Sergio Navarro <jersio@hotmail.com>
Co-authored-by: psp589 <pablosanchez589@gmail.com>
2024-04-18 23:35:48 +02:00
Benedek Farkas
0b86413e60 6748: Stricter file and folder name validation (#6792)
* Media Library: More strict file and folder name validation, fixes #6748

* Resetting MediaLibraryService changes to 1.10.x

* Code styling in FileSystemStorageProvider

* Adding string file and folder name validation to FileSystemStorageProvider, so that MediaLibrary components don't need to do it separately

* Applying the same file and folder name validation to AzureFileSystem too

* Code styling and fixes in AzureFileSystem, MediaLibrary and IStorageProvider

* Simplifying invalid character detection

* Code styling

* Adding InvalidNameCharacterException to be able to handle invalid characters precisely at various user-facing components

* Updating MediaLibrary not to log an error when a file can't be uploaded due to invalid characters

---------

Co-authored-by: Lombiq <github@lombiq.com>
2024-04-18 21:37:48 +02:00
Benedek Farkas
9b0d78b4f6 #8786: Updating Microsoft.IdentityModel.* packages from 5.2.4 to 5.7.0 (#8787)
* Updating Microsoft.IdentityModel.* packages from 5.2.4 to 5.7.0

* Updating OpenId packages from 4.0.0 to 4.2.2 to mach the version of Microsoft.Owin

* Fixing assembly binding redirects in Orchard.Web/Web.config

* OpenId: Updating Microsoft.IdentityModel.Tokens.* packages to version 5.7.0.0 to match Microsoft.IdentityModel.Tokens

* OpenId: Updating Microsoft.IdentityModel.Protocols packages to 5.7.0.0 too

* The return of System.Net.Http assembly binding redirects
2024-04-18 21:35:39 +02:00
Benedek Farkas
38d35efd4d Merge branch '1.10.x' into dev
# Conflicts:
#	src/Orchard.Web/Modules/Orchard.Projections/Migrations.cs
2024-04-17 17:46:14 +02:00
Benedek Farkas
3a6810ec67 8225: Adding a checkbox to StringFilterForm to control whether an empty value should cause the filter to be skipped (#8781)
* Adding a checkbox to StringFilterForm to control whether an empty value should cause the filter to be skipped

* Removing StringOperator.ContainsAnyIfProvided as its now obsolete due to the IgnoreFilterIfValueIsEmpty checkbox setting

* Code styling in StringFilterForm

* Adding missing T-string

* Adding migration step to upgrade from using the ContainsAnyIfProvided operator in StringFilterForm
2024-04-17 11:52:51 +02:00
209 changed files with 1059 additions and 732 deletions

View File

@@ -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>

View File

@@ -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>

View File

@@ -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" />

View File

@@ -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();

View File

@@ -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>

View File

@@ -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" />

View File

@@ -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" />

View File

@@ -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>

View File

@@ -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>

View File

@@ -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" />

View File

@@ -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>

View File

@@ -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)
};
}
}

View File

@@ -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]

View File

@@ -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]

View File

@@ -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);

View File

@@ -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" />

View File

@@ -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" />

View File

@@ -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>

View File

@@ -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" />

View File

@@ -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" />

View File

@@ -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;

View File

@@ -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));
}
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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)) {

View File

@@ -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) {

View File

@@ -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

View File

@@ -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;
}

View File

@@ -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);

View File

@@ -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>

View File

@@ -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>

View File

@@ -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" />

View File

@@ -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>

View File

@@ -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" />

View File

@@ -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);
}

View File

@@ -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" />

View File

@@ -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" />

View File

@@ -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" />

View File

@@ -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" />

View File

@@ -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>

View File

@@ -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" />

View File

@@ -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>

View File

@@ -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);

View File

@@ -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>

View File

@@ -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)

View File

@@ -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" />

View File

@@ -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>

View File

@@ -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) {

View File

@@ -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" />

View File

@@ -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" />

View File

@@ -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>

View File

@@ -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;

View File

@@ -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" />

View File

@@ -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>

View File

@@ -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" />

View File

@@ -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" />

View File

@@ -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" />

View File

@@ -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" />

View File

@@ -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" />

View File

@@ -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" />

View File

@@ -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" />

View File

@@ -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>

View File

@@ -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" />

View File

@@ -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>

View File

@@ -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" />

View File

@@ -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" />

View File

@@ -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)) {

View File

@@ -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" />

View File

@@ -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" />

View File

@@ -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" />

View File

@@ -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());
}
}
}

View File

@@ -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" />

View File

@@ -467,4 +467,4 @@ namespace Orchard.DynamicForms.Services {
return validatorElementType == elementType || validatorElementType.IsAssignableFrom(elementType);
}
}
}
}

View File

@@ -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" />

View File

@@ -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" />

View File

@@ -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) {

View File

@@ -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) : "";
}
}
}

View File

@@ -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;

View File

@@ -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" />

View File

@@ -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" />

View File

@@ -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>

View File

@@ -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" />

View File

@@ -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" />

View File

@@ -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" />

View File

@@ -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>

View File

@@ -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" />

View File

@@ -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>

View File

@@ -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" />

View File

@@ -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" />

View File

@@ -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;
}
}

View File

@@ -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() });
}
}
}

View File

@@ -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() });
}
}
}

View File

@@ -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() });
}
}
}

View File

@@ -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() });
}
}
}

View File

@@ -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;
}
}
}

View File

@@ -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:

View File

@@ -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" />

View File

@@ -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;
}
}
}

View File

@@ -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);
}
}

View File

@@ -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);
}
}

View File

@@ -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