From b1726ba433c11cafcf4c8d38fc8705d1709eccab Mon Sep 17 00:00:00 2001
From: Tony Han
Date: Wed, 27 Mar 2024 03:07:56 +0800
Subject: [PATCH 01/24] Restore user credentials in HttpBackgroundJob (#14329)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Co-authored-by: Zoltán Lehóczky
---
.../BackgroundJobs/HttpBackgroundJob.cs | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/src/OrchardCore/OrchardCore.Abstractions/BackgroundJobs/HttpBackgroundJob.cs b/src/OrchardCore/OrchardCore.Abstractions/BackgroundJobs/HttpBackgroundJob.cs
index 0b320cad0bf..33e00ac1ea9 100644
--- a/src/OrchardCore/OrchardCore.Abstractions/BackgroundJobs/HttpBackgroundJob.cs
+++ b/src/OrchardCore/OrchardCore.Abstractions/BackgroundJobs/HttpBackgroundJob.cs
@@ -31,6 +31,8 @@ public static Task ExecuteAfterEndOfRequestAsync(string jobName, Func
@@ -59,7 +61,9 @@ public static Task ExecuteAfterEndOfRequestAsync(string jobName, Func();
From 15c95ca7cdba0bff14da0d6891de051daad47ab1 Mon Sep 17 00:00:00 2001
From: Mike Alhayek
Date: Tue, 26 Mar 2024 13:26:16 -0700
Subject: [PATCH 02/24] Convert Themes admin views into shapes (#15589)
---
.../Drivers/ThemeEntryDisplayDriver.cs | 34 +++++++++
.../OrchardCore.Themes/Startup.cs | 2 +
.../Views/Admin/Index.cshtml | 72 +++----------------
.../ThemeEntry-Attributes.SummaryAdmin.cshtml | 37 ++++++++++
...try-ButtonsMakeCurrent.SummaryAdmin.cshtml | 8 +++
...try-ButtonsToggleState.SummaryAdmin.cshtml | 17 +++++
.../ThemeEntry-Current.SummaryAdmin.cshtml | 13 ++++
...hemeEntry-Descriptions.SummaryAdmin.cshtml | 8 +++
.../ThemeEntry-Thumbnail.SummaryAdmin.cshtml | 6 ++
.../ThemeEntry-Title.SummaryAdmin.cshtml | 6 ++
.../Views/ThemeEntry.SummaryAdmin.cshtml | 64 +++++++++++++++++
11 files changed, 205 insertions(+), 62 deletions(-)
create mode 100644 src/OrchardCore.Modules/OrchardCore.Themes/Drivers/ThemeEntryDisplayDriver.cs
create mode 100644 src/OrchardCore.Modules/OrchardCore.Themes/Views/Items/ThemeEntry-Attributes.SummaryAdmin.cshtml
create mode 100644 src/OrchardCore.Modules/OrchardCore.Themes/Views/Items/ThemeEntry-ButtonsMakeCurrent.SummaryAdmin.cshtml
create mode 100644 src/OrchardCore.Modules/OrchardCore.Themes/Views/Items/ThemeEntry-ButtonsToggleState.SummaryAdmin.cshtml
create mode 100644 src/OrchardCore.Modules/OrchardCore.Themes/Views/Items/ThemeEntry-Current.SummaryAdmin.cshtml
create mode 100644 src/OrchardCore.Modules/OrchardCore.Themes/Views/Items/ThemeEntry-Descriptions.SummaryAdmin.cshtml
create mode 100644 src/OrchardCore.Modules/OrchardCore.Themes/Views/Items/ThemeEntry-Thumbnail.SummaryAdmin.cshtml
create mode 100644 src/OrchardCore.Modules/OrchardCore.Themes/Views/Items/ThemeEntry-Title.SummaryAdmin.cshtml
create mode 100644 src/OrchardCore.Modules/OrchardCore.Themes/Views/ThemeEntry.SummaryAdmin.cshtml
diff --git a/src/OrchardCore.Modules/OrchardCore.Themes/Drivers/ThemeEntryDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Themes/Drivers/ThemeEntryDisplayDriver.cs
new file mode 100644
index 00000000000..a8ba0321bf6
--- /dev/null
+++ b/src/OrchardCore.Modules/OrchardCore.Themes/Drivers/ThemeEntryDisplayDriver.cs
@@ -0,0 +1,34 @@
+using System.Collections.Generic;
+using OrchardCore.DisplayManagement.Handlers;
+using OrchardCore.DisplayManagement.Views;
+using OrchardCore.Themes.Models;
+
+namespace OrchardCore.Themes.Drivers;
+
+public class ThemeEntryDisplayDriver : DisplayDriver
+{
+ public override IDisplayResult Display(ThemeEntry model)
+ {
+ var results = new List()
+ {
+ View("ThemeEntry_SummaryAdmin__Thumbnail", model).Location("SummaryAdmin", "Thumbnail:5"),
+ View("ThemeEntry_SummaryAdmin__Title", model).Location("SummaryAdmin", "Header:5"),
+ View("ThemeEntry_SummaryAdmin__Descriptions", model).Location("SummaryAdmin", "Content:5"),
+ View("ThemeEntry_SummaryAdmin__Attributes", model).Location("SummaryAdmin", "Tags:5"),
+ };
+
+ if (model.IsCurrent)
+ {
+ results.Add(View("ThemeEntry_SummaryAdmin__Current", model).Location("SummaryAdmin", "FooterBelow:5"));
+ }
+ else
+ {
+ results.AddRange([
+ View("ThemeEntry_SummaryAdmin__ButtonsMakeCurrent", model).Location("SummaryAdmin", "FooterStart:5"),
+ View("ThemeEntry_SummaryAdmin__ButtonsToggleState", model).Location("SummaryAdmin", "FooterEnd:5")
+ ]);
+ }
+
+ return Combine(results);
+ }
+}
diff --git a/src/OrchardCore.Modules/OrchardCore.Themes/Startup.cs b/src/OrchardCore.Modules/OrchardCore.Themes/Startup.cs
index 6329390f965..10e388c7a46 100644
--- a/src/OrchardCore.Modules/OrchardCore.Themes/Startup.cs
+++ b/src/OrchardCore.Modules/OrchardCore.Themes/Startup.cs
@@ -9,6 +9,7 @@
using OrchardCore.Security.Permissions;
using OrchardCore.Themes.Deployment;
using OrchardCore.Themes.Drivers;
+using OrchardCore.Themes.Models;
using OrchardCore.Themes.Recipes;
using OrchardCore.Themes.Services;
@@ -33,6 +34,7 @@ public override void ConfigureServices(IServiceCollection services)
services.AddScoped();
services.AddDeployment();
services.AddScoped, ToggleThemeNavbarDisplayDriver>();
+ services.AddScoped, ThemeEntryDisplayDriver>();
}
}
}
diff --git a/src/OrchardCore.Modules/OrchardCore.Themes/Views/Admin/Index.cshtml b/src/OrchardCore.Modules/OrchardCore.Themes/Views/Admin/Index.cshtml
index 96a9147b686..efec01d1d9a 100644
--- a/src/OrchardCore.Modules/OrchardCore.Themes/Views/Admin/Index.cshtml
+++ b/src/OrchardCore.Modules/OrchardCore.Themes/Views/Admin/Index.cshtml
@@ -1,4 +1,12 @@
-@model OrchardCore.Themes.Models.SelectThemesViewModel
+@using OrchardCore.DisplayManagement
+@using OrchardCore.DisplayManagement.ModelBinding
+@using OrchardCore.Themes.Models
+
+@inject IDisplayManager ThemeEntryDisplayManager
+@inject IUpdateModelAccessor UpdateModelAccessor
+
+@model SelectThemesViewModel
+
@RenderTitleSegments(T["Themes"])
@@ -12,67 +20,7 @@ else
@foreach (var themeEntry in Model.Themes)
{
-
-
-
-
@themeEntry.Name
-
- @themeEntry.Extension.Manifest.Description
-
- @if (!string.IsNullOrWhiteSpace(themeEntry.Extension.Manifest.Author))
- {
- - @themeEntry.Extension.Manifest.Author
- }
- @if (!string.IsNullOrWhiteSpace(themeEntry.Extension.Manifest.Website))
- {
- - @themeEntry.Extension.Manifest.Website
- }
- @if (themeEntry.Extension.Manifest.Tags.Any())
- {
- - @string.Join(", ", themeEntry.Extension.Manifest.Tags.ToArray())
- }
- - @themeEntry.Extension.Manifest.Version
-
-
-
-
-
+ @await DisplayAsync(await ThemeEntryDisplayManager.BuildDisplayAsync(themeEntry, UpdateModelAccessor.ModelUpdater, "SummaryAdmin"))
}
diff --git a/src/OrchardCore.Modules/OrchardCore.Themes/Views/Items/ThemeEntry-Attributes.SummaryAdmin.cshtml b/src/OrchardCore.Modules/OrchardCore.Themes/Views/Items/ThemeEntry-Attributes.SummaryAdmin.cshtml
new file mode 100644
index 00000000000..1df41ccfadc
--- /dev/null
+++ b/src/OrchardCore.Modules/OrchardCore.Themes/Views/Items/ThemeEntry-Attributes.SummaryAdmin.cshtml
@@ -0,0 +1,37 @@
+@using OrchardCore.DisplayManagement.Views
+@using OrchardCore.Themes.Models
+
+@model ShapeViewModel
+
+@if (!string.IsNullOrWhiteSpace(Model.Value.Extension.Manifest.Author))
+{
+
+
+
+ @Model.Value.Extension.Manifest.Author
+
+
+}
+@if (!string.IsNullOrWhiteSpace(Model.Value.Extension.Manifest.Website))
+{
+
+
+
+ @Model.Value.Extension.Manifest.Website
+
+
+}
+@if (Model.Value.Extension.Manifest.Tags.Any())
+{
+
+
+ @string.Join(", ", Model.Value.Extension.Manifest.Tags.ToArray())
+
+
+}
+
+
+ @Model.Value.Extension.Manifest.Version
+
+
+
diff --git a/src/OrchardCore.Modules/OrchardCore.Themes/Views/Items/ThemeEntry-ButtonsMakeCurrent.SummaryAdmin.cshtml b/src/OrchardCore.Modules/OrchardCore.Themes/Views/Items/ThemeEntry-ButtonsMakeCurrent.SummaryAdmin.cshtml
new file mode 100644
index 00000000000..96599f69bb8
--- /dev/null
+++ b/src/OrchardCore.Modules/OrchardCore.Themes/Views/Items/ThemeEntry-ButtonsMakeCurrent.SummaryAdmin.cshtml
@@ -0,0 +1,8 @@
+@using OrchardCore.DisplayManagement.Views
+@using OrchardCore.Themes.Models
+
+@model ShapeViewModel
+
+
diff --git a/src/OrchardCore.Modules/OrchardCore.Themes/Views/Items/ThemeEntry-ButtonsToggleState.SummaryAdmin.cshtml b/src/OrchardCore.Modules/OrchardCore.Themes/Views/Items/ThemeEntry-ButtonsToggleState.SummaryAdmin.cshtml
new file mode 100644
index 00000000000..891e57e1bcb
--- /dev/null
+++ b/src/OrchardCore.Modules/OrchardCore.Themes/Views/Items/ThemeEntry-ButtonsToggleState.SummaryAdmin.cshtml
@@ -0,0 +1,17 @@
+@using OrchardCore.DisplayManagement.Views
+@using OrchardCore.Themes.Models
+
+@model ShapeViewModel
+
+@if (Model.Value.Enabled)
+{
+
+
+ return;
+}
+
+
diff --git a/src/OrchardCore.Modules/OrchardCore.Themes/Views/Items/ThemeEntry-Current.SummaryAdmin.cshtml b/src/OrchardCore.Modules/OrchardCore.Themes/Views/Items/ThemeEntry-Current.SummaryAdmin.cshtml
new file mode 100644
index 00000000000..5df81437827
--- /dev/null
+++ b/src/OrchardCore.Modules/OrchardCore.Themes/Views/Items/ThemeEntry-Current.SummaryAdmin.cshtml
@@ -0,0 +1,13 @@
+@using OrchardCore.DisplayManagement.Views
+@using OrchardCore.Themes.Models
+
+@model ShapeViewModel
+
+@if (Model.Value.IsAdmin)
+{
+ @T["This is the current Admin theme"]
+
+ return;
+}
+
+@T["This is the current Site theme"]
diff --git a/src/OrchardCore.Modules/OrchardCore.Themes/Views/Items/ThemeEntry-Descriptions.SummaryAdmin.cshtml b/src/OrchardCore.Modules/OrchardCore.Themes/Views/Items/ThemeEntry-Descriptions.SummaryAdmin.cshtml
new file mode 100644
index 00000000000..04d7bfaa8aa
--- /dev/null
+++ b/src/OrchardCore.Modules/OrchardCore.Themes/Views/Items/ThemeEntry-Descriptions.SummaryAdmin.cshtml
@@ -0,0 +1,8 @@
+@using OrchardCore.DisplayManagement.Views
+@using OrchardCore.Themes.Models
+
+@model ShapeViewModel
+
+
+ @Model.Value.Extension.Manifest.Description
+
diff --git a/src/OrchardCore.Modules/OrchardCore.Themes/Views/Items/ThemeEntry-Thumbnail.SummaryAdmin.cshtml b/src/OrchardCore.Modules/OrchardCore.Themes/Views/Items/ThemeEntry-Thumbnail.SummaryAdmin.cshtml
new file mode 100644
index 00000000000..7ad50368694
--- /dev/null
+++ b/src/OrchardCore.Modules/OrchardCore.Themes/Views/Items/ThemeEntry-Thumbnail.SummaryAdmin.cshtml
@@ -0,0 +1,6 @@
+@using OrchardCore.DisplayManagement.Views
+@using OrchardCore.Themes.Models
+
+@model ShapeViewModel
+
+
diff --git a/src/OrchardCore.Modules/OrchardCore.Themes/Views/Items/ThemeEntry-Title.SummaryAdmin.cshtml b/src/OrchardCore.Modules/OrchardCore.Themes/Views/Items/ThemeEntry-Title.SummaryAdmin.cshtml
new file mode 100644
index 00000000000..7774734ae6d
--- /dev/null
+++ b/src/OrchardCore.Modules/OrchardCore.Themes/Views/Items/ThemeEntry-Title.SummaryAdmin.cshtml
@@ -0,0 +1,6 @@
+@using OrchardCore.DisplayManagement.Views
+@using OrchardCore.Themes.Models
+
+@model ShapeViewModel
+
+@Model.Value.Name
diff --git a/src/OrchardCore.Modules/OrchardCore.Themes/Views/ThemeEntry.SummaryAdmin.cshtml b/src/OrchardCore.Modules/OrchardCore.Themes/Views/ThemeEntry.SummaryAdmin.cshtml
new file mode 100644
index 00000000000..393ec3f68e3
--- /dev/null
+++ b/src/OrchardCore.Modules/OrchardCore.Themes/Views/ThemeEntry.SummaryAdmin.cshtml
@@ -0,0 +1,64 @@
+
+
+ @if (Model.Thumbnail != null)
+ {
+ @await DisplayAsync(Model.Thumbnail)
+ }
+
+
+
+ @if (Model.Header != null)
+ {
+ @await DisplayAsync(Model.Header)
+ }
+
+ @if (Model.Content != null || Model.Attributes != null)
+ {
+
+ @if (Model.Content != null)
+ {
+ @await DisplayAsync(Model.Content)
+ }
+
+ @if (Model.Tags != null)
+ {
+
+ @await DisplayAsync(Model.Tags)
+
+ }
+
+ }
+
+
+
+ @if (Model.FooterStart != null || Model.FooterEnd != null || Model.FooterBelow != null)
+ {
+
+ }
+
+
From 1e3874dd56eaf0b6f0df68b248f4aa0255878582 Mon Sep 17 00:00:00 2001
From: Mike Alhayek
Date: Tue, 26 Mar 2024 14:27:38 -0700
Subject: [PATCH 03/24] Rename Method in MinimalAPI (#15594)
---
.../Endpoints/Api/CreateEndpoint.cs | 14 +++++++-------
.../Endpoints/Api/DeleteEndpoint.cs | 4 ++--
.../Endpoints/Api/GetEndpoint.cs | 4 ++--
3 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Endpoints/Api/CreateEndpoint.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Endpoints/Api/CreateEndpoint.cs
index 60ca5cdb575..9fe0aa09175 100644
--- a/src/OrchardCore.Modules/OrchardCore.Contents/Endpoints/Api/CreateEndpoint.cs
+++ b/src/OrchardCore.Modules/OrchardCore.Contents/Endpoints/Api/CreateEndpoint.cs
@@ -17,22 +17,22 @@ namespace OrchardCore.Contents.Endpoints.Api;
public static class CreateEndpoint
{
+ private static readonly JsonMergeSettings _updateJsonMergeSettings = new()
+ {
+ MergeArrayHandling = MergeArrayHandling.Replace,
+ };
+
public static IEndpointRouteBuilder AddCreateContentEndpoint(this IEndpointRouteBuilder builder)
{
- builder.MapPost("api/content", ActionAsync)
+ builder.MapPost("api/content", HandleAsync)
.AllowAnonymous()
.DisableAntiforgery();
return builder;
}
- private static readonly JsonMergeSettings _updateJsonMergeSettings = new()
- {
- MergeArrayHandling = MergeArrayHandling.Replace,
- };
-
[Authorize(AuthenticationSchemes = "Api")]
- private static async Task ActionAsync(
+ private static async Task HandleAsync(
ContentItem model,
IContentManager contentManager,
IAuthorizationService authorizationService,
diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Endpoints/Api/DeleteEndpoint.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Endpoints/Api/DeleteEndpoint.cs
index e3b2b58505b..6aa0a648b5d 100644
--- a/src/OrchardCore.Modules/OrchardCore.Contents/Endpoints/Api/DeleteEndpoint.cs
+++ b/src/OrchardCore.Modules/OrchardCore.Contents/Endpoints/Api/DeleteEndpoint.cs
@@ -12,7 +12,7 @@ public static class DeleteEndpoint
{
public static IEndpointRouteBuilder AddDeleteContentEndpoint(this IEndpointRouteBuilder builder)
{
- builder.MapDelete("api/content/{contentItemId}", ActionAsync)
+ builder.MapDelete("api/content/{contentItemId}", HandleAsync)
.AllowAnonymous()
.DisableAntiforgery();
@@ -20,7 +20,7 @@ public static IEndpointRouteBuilder AddDeleteContentEndpoint(this IEndpointRoute
}
[Authorize(AuthenticationSchemes = "Api")]
- private static async Task ActionAsync(
+ private static async Task HandleAsync(
string contentItemId,
IContentManager contentManager,
IAuthorizationService authorizationService,
diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Endpoints/Api/GetEndpoint.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Endpoints/Api/GetEndpoint.cs
index 851ce7a07f3..faff9130759 100644
--- a/src/OrchardCore.Modules/OrchardCore.Contents/Endpoints/Api/GetEndpoint.cs
+++ b/src/OrchardCore.Modules/OrchardCore.Contents/Endpoints/Api/GetEndpoint.cs
@@ -12,7 +12,7 @@ public static class GetEndpoint
{
public static IEndpointRouteBuilder AddGetContentEndpoint(this IEndpointRouteBuilder builder)
{
- builder.MapGet("api/content/{contentItemId}", ActionAsync)
+ builder.MapGet("api/content/{contentItemId}", HandleAsync)
.AllowAnonymous()
.DisableAntiforgery();
@@ -20,7 +20,7 @@ public static IEndpointRouteBuilder AddGetContentEndpoint(this IEndpointRouteBui
}
[Authorize(AuthenticationSchemes = "Api")]
- private static async Task ActionAsync(
+ private static async Task HandleAsync(
string contentItemId,
IContentManager contentManager,
IAuthorizationService authorizationService,
From 5d4b52d457862dc9c3aaf96a59d93d6cc48cc79e Mon Sep 17 00:00:00 2001
From: lampersky
Date: Tue, 26 Mar 2024 23:32:38 +0100
Subject: [PATCH 04/24] Named Part Fields are not indexed (#14366)
---
.../Extensions/ContentPartFieldDefinitionExtensions.cs | 2 +-
.../Indexing/SQL/BooleanFieldIndexProvider.cs | 2 +-
.../Indexing/SQL/ContentPickerFieldIndexProvider.cs | 2 +-
.../Indexing/SQL/DateFieldIndexProvider.cs | 2 +-
.../Indexing/SQL/DateTimeFieldIndexProvider.cs | 2 +-
.../Indexing/SQL/HtmlFieldIndexProvider.cs | 2 +-
.../Indexing/SQL/LinkFieldIndexProvider.cs | 2 +-
.../Indexing/SQL/MultiTextFieldIndexProvider.cs | 2 +-
.../Indexing/SQL/NumericFieldIndexProvider.cs | 2 +-
.../Indexing/SQL/TextFieldIndexProvider.cs | 2 +-
.../Indexing/SQL/TimeFieldIndexProvider.cs | 2 +-
.../Indexing/SQL/UserPickerFieldIndexProvider.cs | 2 +-
12 files changed, 12 insertions(+), 12 deletions(-)
diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Extensions/ContentPartFieldDefinitionExtensions.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Extensions/ContentPartFieldDefinitionExtensions.cs
index cd8c62e25c0..7efc8777c84 100644
--- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Extensions/ContentPartFieldDefinitionExtensions.cs
+++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Extensions/ContentPartFieldDefinitionExtensions.cs
@@ -13,7 +13,7 @@ public static TField GetContentField(
ContentItem contentItem)
where TField : ContentField
{
- if (((JsonObject)contentItem.Content)[fieldDefinition.PartDefinition.Name] is not JsonObject jPart ||
+ if (((JsonObject)contentItem.Content)[fieldDefinition.ContentTypePartDefinition.Name] is not JsonObject jPart ||
jPart[fieldDefinition.Name] is not JsonObject jField)
{
return null;
diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/BooleanFieldIndexProvider.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/BooleanFieldIndexProvider.cs
index f5fac542076..80f3fc9c184 100644
--- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/BooleanFieldIndexProvider.cs
+++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/BooleanFieldIndexProvider.cs
@@ -77,7 +77,7 @@ public override void Describe(DescribeContext context)
ContentItemId = contentItem.ContentItemId,
ContentItemVersionId = contentItem.ContentItemVersionId,
ContentType = contentItem.ContentType,
- ContentPart = pair.Definition.PartDefinition.Name,
+ ContentPart = pair.Definition.ContentTypePartDefinition.Name,
ContentField = pair.Definition.Name,
Boolean = pair.Field.Value,
});
diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/ContentPickerFieldIndexProvider.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/ContentPickerFieldIndexProvider.cs
index 24234bb5379..e12ede1a931 100644
--- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/ContentPickerFieldIndexProvider.cs
+++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/ContentPickerFieldIndexProvider.cs
@@ -80,7 +80,7 @@ public override void Describe(DescribeContext context)
ContentItemId = contentItem.ContentItemId,
ContentItemVersionId = contentItem.ContentItemVersionId,
ContentType = contentItem.ContentType,
- ContentPart = pair.Definition.PartDefinition.Name,
+ ContentPart = pair.Definition.ContentTypePartDefinition.Name,
ContentField = pair.Definition.Name,
SelectedContentItemId = pair.ContentItemId,
});
diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/DateFieldIndexProvider.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/DateFieldIndexProvider.cs
index 202c01cca17..bd6aac2a50f 100644
--- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/DateFieldIndexProvider.cs
+++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/DateFieldIndexProvider.cs
@@ -76,7 +76,7 @@ public override void Describe(DescribeContext context)
ContentItemId = contentItem.ContentItemId,
ContentItemVersionId = contentItem.ContentItemVersionId,
ContentType = contentItem.ContentType,
- ContentPart = pair.Definition.PartDefinition.Name,
+ ContentPart = pair.Definition.ContentTypePartDefinition.Name,
ContentField = pair.Definition.Name,
Date = pair.Field.Value,
});
diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/DateTimeFieldIndexProvider.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/DateTimeFieldIndexProvider.cs
index b3e2e64298c..823430558d5 100644
--- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/DateTimeFieldIndexProvider.cs
+++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/DateTimeFieldIndexProvider.cs
@@ -77,7 +77,7 @@ public override void Describe(DescribeContext context)
ContentItemId = contentItem.ContentItemId,
ContentItemVersionId = contentItem.ContentItemVersionId,
ContentType = contentItem.ContentType,
- ContentPart = pair.Definition.PartDefinition.Name,
+ ContentPart = pair.Definition.ContentTypePartDefinition.Name,
ContentField = pair.Definition.Name,
DateTime = pair.Field.Value,
});
diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/HtmlFieldIndexProvider.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/HtmlFieldIndexProvider.cs
index 1723484b605..090a62ff547 100644
--- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/HtmlFieldIndexProvider.cs
+++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/HtmlFieldIndexProvider.cs
@@ -77,7 +77,7 @@ public override void Describe(DescribeContext context)
ContentItemId = contentItem.ContentItemId,
ContentItemVersionId = contentItem.ContentItemVersionId,
ContentType = contentItem.ContentType,
- ContentPart = pair.Definition.PartDefinition.Name,
+ ContentPart = pair.Definition.ContentTypePartDefinition.Name,
ContentField = pair.Definition.Name,
Html = pair.Field.Html,
});
diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/LinkFieldIndexProvider.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/LinkFieldIndexProvider.cs
index 6dd04f73036..9c40ac3daa4 100644
--- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/LinkFieldIndexProvider.cs
+++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/LinkFieldIndexProvider.cs
@@ -91,7 +91,7 @@ public override void Describe(DescribeContext context)
ContentItemId = contentItem.ContentItemId,
ContentItemVersionId = contentItem.ContentItemVersionId,
ContentType = contentItem.ContentType,
- ContentPart = pair.Definition.PartDefinition.Name,
+ ContentPart = pair.Definition.ContentTypePartDefinition.Name,
ContentField = pair.Definition.Name,
Url = pair.Field.Url?[..Math.Min(pair.Field.Url.Length, LinkFieldIndex.MaxUrlSize)],
BigUrl = pair.Field.Url,
diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/MultiTextFieldIndexProvider.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/MultiTextFieldIndexProvider.cs
index f8126161632..6e1d3710748 100644
--- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/MultiTextFieldIndexProvider.cs
+++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/MultiTextFieldIndexProvider.cs
@@ -85,7 +85,7 @@ public override void Describe(DescribeContext context)
ContentItemId = contentItem.ContentItemId,
ContentItemVersionId = contentItem.ContentItemVersionId,
ContentType = contentItem.ContentType,
- ContentPart = pair.Definition.PartDefinition.Name,
+ ContentPart = pair.Definition.ContentTypePartDefinition.Name,
ContentField = pair.Definition.Name,
Value = pair.Value?[..Math.Min(pair.Value.Length, MultiTextFieldIndex.MaxValueSize)],
BigValue = pair.Value,
diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/NumericFieldIndexProvider.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/NumericFieldIndexProvider.cs
index 363f90eed55..e3636a97bcc 100644
--- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/NumericFieldIndexProvider.cs
+++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/NumericFieldIndexProvider.cs
@@ -77,7 +77,7 @@ public override void Describe(DescribeContext context)
ContentItemId = contentItem.ContentItemId,
ContentItemVersionId = contentItem.ContentItemVersionId,
ContentType = contentItem.ContentType,
- ContentPart = pair.Definition.PartDefinition.Name,
+ ContentPart = pair.Definition.ContentTypePartDefinition.Name,
ContentField = pair.Definition.Name,
Numeric = pair.Field.Value,
});
diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/TextFieldIndexProvider.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/TextFieldIndexProvider.cs
index b6e784cbf98..3ab714e4ffd 100644
--- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/TextFieldIndexProvider.cs
+++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/TextFieldIndexProvider.cs
@@ -83,7 +83,7 @@ public override void Describe(DescribeContext context)
ContentItemId = contentItem.ContentItemId,
ContentItemVersionId = contentItem.ContentItemVersionId,
ContentType = contentItem.ContentType,
- ContentPart = pair.Definition.PartDefinition.Name,
+ ContentPart = pair.Definition.ContentTypePartDefinition.Name,
ContentField = pair.Definition.Name,
Text = pair.Field.Text?[..Math.Min(pair.Field.Text.Length, TextFieldIndex.MaxTextSize)],
BigText = pair.Field.Text,
diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/TimeFieldIndexProvider.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/TimeFieldIndexProvider.cs
index bed5826ce40..535a856d7ee 100644
--- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/TimeFieldIndexProvider.cs
+++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/TimeFieldIndexProvider.cs
@@ -77,7 +77,7 @@ public override void Describe(DescribeContext context)
ContentItemId = contentItem.ContentItemId,
ContentItemVersionId = contentItem.ContentItemVersionId,
ContentType = contentItem.ContentType,
- ContentPart = pair.Definition.PartDefinition.Name,
+ ContentPart = pair.Definition.ContentTypePartDefinition.Name,
ContentField = pair.Definition.Name,
Time = pair.Field.Value,
});
diff --git a/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/UserPickerFieldIndexProvider.cs b/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/UserPickerFieldIndexProvider.cs
index 3023c76eaa9..fd1f95c4f24 100644
--- a/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/UserPickerFieldIndexProvider.cs
+++ b/src/OrchardCore.Modules/OrchardCore.ContentFields/Indexing/SQL/UserPickerFieldIndexProvider.cs
@@ -79,7 +79,7 @@ public override void Describe(DescribeContext context)
ContentItemId = contentItem.ContentItemId,
ContentItemVersionId = contentItem.ContentItemVersionId,
ContentType = contentItem.ContentType,
- ContentPart = pair.Definition.PartDefinition.Name,
+ ContentPart = pair.Definition.ContentTypePartDefinition.Name,
ContentField = pair.Definition.Name,
SelectedUserId = pair.UserId,
});
From 471850f790b5ac4bcd4dd651eb38a3a7fb304745 Mon Sep 17 00:00:00 2001
From: Mike Alhayek
Date: Tue, 26 Mar 2024 16:50:47 -0700
Subject: [PATCH 05/24] Cleanup Navbar (#15595)
---
src/OrchardCore.Modules/OrchardCore.Admin/Startup.cs | 9 ---------
.../OrchardCore.Admin/Views/Navbar.cshtml | 7 ++++---
2 files changed, 4 insertions(+), 12 deletions(-)
diff --git a/src/OrchardCore.Modules/OrchardCore.Admin/Startup.cs b/src/OrchardCore.Modules/OrchardCore.Admin/Startup.cs
index fee003ba35f..c8357e3f5fe 100644
--- a/src/OrchardCore.Modules/OrchardCore.Admin/Startup.cs
+++ b/src/OrchardCore.Modules/OrchardCore.Admin/Startup.cs
@@ -120,15 +120,6 @@ public override void ConfigureServices(IServiceCollection services)
return NilValue.Instance;
}));
-
- o.MemberAccessStrategy.Register((navbar, name, context) =>
- {
- return name switch
- {
- nameof(Navbar.Properties) => new ObjectValue(navbar.Properties),
- _ => NilValue.Instance
- };
- });
});
}
}
diff --git a/src/OrchardCore.Modules/OrchardCore.Admin/Views/Navbar.cshtml b/src/OrchardCore.Modules/OrchardCore.Admin/Views/Navbar.cshtml
index 81684dd717b..88877f4c199 100644
--- a/src/OrchardCore.Modules/OrchardCore.Admin/Views/Navbar.cshtml
+++ b/src/OrchardCore.Modules/OrchardCore.Admin/Views/Navbar.cshtml
@@ -1,20 +1,21 @@
@using OrchardCore.Admin.Models
@using OrchardCore.DisplayManagement
@using OrchardCore.DisplayManagement.ModelBinding
+@using OrchardCore.DisplayManagement.Zones
@inject IDisplayManager DisplayManager
@inject IUpdateModelAccessor UpdateModelAccessor
@if (Model.Content == null)
{
- dynamic shape = await DisplayAsync(await DisplayManager.BuildDisplayAsync(UpdateModelAccessor.ModelUpdater, (string)Model.Metadata.DisplayType));
+ var shape = await DisplayManager.BuildDisplayAsync(UpdateModelAccessor.ModelUpdater, (string)Model.Metadata.DisplayType);
- if (shape.Content == null)
+ if (!shape.TryGetProperty("Content", out var content))
{
return;
}
- Model.Content = shape.Content;
+ Model.Content = content;
}
From 35ce558480efaa70865f19cd05a511de17816f0a Mon Sep 17 00:00:00 2001
From: Mike Alhayek
Date: Tue, 26 Mar 2024 16:52:47 -0700
Subject: [PATCH 06/24] Update OpenIddict 5.4.0 (#15597)
---
src/OrchardCore.Build/Dependencies.props | 12 ++++++------
src/docs/resources/libraries/README.md | 2 +-
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/OrchardCore.Build/Dependencies.props b/src/OrchardCore.Build/Dependencies.props
index 87a0163d183..7b20592f2a5 100644
--- a/src/OrchardCore.Build/Dependencies.props
+++ b/src/OrchardCore.Build/Dependencies.props
@@ -52,12 +52,12 @@
-
-
-
-
-
-
+
+
+
+
+
+
diff --git a/src/docs/resources/libraries/README.md b/src/docs/resources/libraries/README.md
index bb2999e9a31..0fc39b98e82 100644
--- a/src/docs/resources/libraries/README.md
+++ b/src/docs/resources/libraries/README.md
@@ -40,7 +40,7 @@ The below table lists the different .NET libraries used in Orchard Core:
| [NJsonSchema](https://github.com/RicoSuter/NJsonSchema) | JSON Schema reader, generator and validator for .NET | 11.0.0 | [MIT](https://github.com/RicoSuter/NJsonSchema/blob/master/LICENSE.md) |
| [NLog.Web.AspNetCore](https://github.com/NLog/NLog.Web/tree/master/src/NLog.Web.AspNetCore) | NLog integration for ASP.NET. | 5.3.8 | [BSD-3-Clause](https://github.com/NLog/NLog.Web/blob/master/LICENSE) |
| [Noda Time](https://github.com/nodatime/nodatime) | A better date and time API for .NET. | 3.1.11 | [Apache-2.0](https://github.com/nodatime/nodatime/blob/master/LICENSE.txt) |
-| [OpenIddict](https://github.com/openiddict/openiddict-core) | Flexible and versatile OAuth 2.0/OpenID Connect stack for .NET. | 5.3.0 | [Apache-2.0](https://github.com/openiddict/openiddict-core/blob/dev/LICENSE.md)) |
+| [OpenIddict](https://github.com/openiddict/openiddict-core) | Flexible and versatile OAuth 2.0/OpenID Connect stack for .NET. | 5.4.0 | [Apache-2.0](https://github.com/openiddict/openiddict-core/blob/dev/LICENSE.md)) |
| [PdfPig](https://github.com/UglyToad/PdfPig/) | Library to read and extract text and other content from PDF files. | 0.1.8 | [Apache-2.0](https://github.com/UglyToad/PdfPig/blob/master/LICENSE) |
| [Serilog.AspNetCore](https://github.com/serilog/serilog-aspnetcore) | Serilog integration for ASP.NET Core. | 8.0.1 | [Apache-2.0](https://github.com/serilog/serilog-aspnetcore/blob/dev/LICENSE) |
| [Shortcodes](https://github.com/sebastienros/shortcodes) | Shortcodes processor for .NET. | 1.3.3 | [MIT](https://github.com/sebastienros/shortcodes/blob/dev/LICENSE) |
From 4d892b6f49d4340c4ecbe4630d3e9ac4fba61acb Mon Sep 17 00:00:00 2001
From: Mike Alhayek
Date: Tue, 26 Mar 2024 17:17:35 -0700
Subject: [PATCH 07/24] Verify the return type in migration methods prior to
invoking them (#15596)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---------
Co-authored-by: Sébastien Ros
---
.../Migration/DataMigrationManager.cs | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/src/OrchardCore/OrchardCore.Data.YesSql/Migration/DataMigrationManager.cs b/src/OrchardCore/OrchardCore.Data.YesSql/Migration/DataMigrationManager.cs
index 683295f204d..3a8530abaa4 100644
--- a/src/OrchardCore/OrchardCore.Data.YesSql/Migration/DataMigrationManager.cs
+++ b/src/OrchardCore/OrchardCore.Data.YesSql/Migration/DataMigrationManager.cs
@@ -222,7 +222,7 @@ public async Task UpdateAsync(string featureId)
}
finally
{
- // Persist data migrations
+ // Persist data migrations.
await _session.SaveAsync(_dataMigrationRecord);
}
}
@@ -230,12 +230,17 @@ public async Task UpdateAsync(string featureId)
private static async Task InvokeMethod(MethodInfo method, IDataMigration migration)
{
- if (method.ReturnType.GetMethod(nameof(Task.GetAwaiter)) != null)
+ if (method.ReturnType == typeof(Task))
{
return await (Task)method.Invoke(migration, []);
}
- return (int)method.Invoke(migration, []);
+ if (method.ReturnType == typeof(int))
+ {
+ return (int)method.Invoke(migration, []);
+ }
+
+ throw new InvalidOperationException("Invalid return type used in a migration method.");
}
private async Task GetDataMigrationRecordAsync(IDataMigration tempMigration)
From b829e2a63eea67a6e1ce312c921196b6ec77a2f7 Mon Sep 17 00:00:00 2001
From: Hisham Bin Ateya
Date: Wed, 27 Mar 2024 16:33:41 +0300
Subject: [PATCH 08/24] Avoid NRE in ElasticQueryService.SearchAsync() (#15600)
---
.../ElasticsearchConstants.cs | 2 --
.../Services/ElasticIndexManager.cs | 1 -
.../Services/ElasticQueryService.cs | 2 ++
3 files changed, 2 insertions(+), 3 deletions(-)
diff --git a/src/OrchardCore/OrchardCore.Search.Elasticsearch.Core/ElasticsearchConstants.cs b/src/OrchardCore/OrchardCore.Search.Elasticsearch.Core/ElasticsearchConstants.cs
index 2cb1db51c09..ae6458c44cf 100644
--- a/src/OrchardCore/OrchardCore.Search.Elasticsearch.Core/ElasticsearchConstants.cs
+++ b/src/OrchardCore/OrchardCore.Search.Elasticsearch.Core/ElasticsearchConstants.cs
@@ -2,7 +2,5 @@ namespace OrchardCore.Search.Elasticsearch;
public class ElasticsearchConstants
{
- public const string StandardAnalyzer = "standard";
-
public const string DefaultAnalyzer = "standard";
}
diff --git a/src/OrchardCore/OrchardCore.Search.Elasticsearch.Core/Services/ElasticIndexManager.cs b/src/OrchardCore/OrchardCore.Search.Elasticsearch.Core/Services/ElasticIndexManager.cs
index e81b187efa4..bad44538703 100644
--- a/src/OrchardCore/OrchardCore.Search.Elasticsearch.Core/Services/ElasticIndexManager.cs
+++ b/src/OrchardCore/OrchardCore.Search.Elasticsearch.Core/Services/ElasticIndexManager.cs
@@ -107,7 +107,6 @@ public async Task CreateIndexAsync(ElasticIndexSettings elasticIndexSettin
if (_elasticsearchOptions.Analyzers.TryGetValue(analyzerName, out var analyzerProperties))
{
var analyzer = CreateAnalyzer(analyzerProperties);
- analyzersDescriptor = new AnalyzersDescriptor();
analysisDescriptor.Analyzers(a => a.UserDefined(analyzerName, analyzer));
indexSettingsDescriptor = new IndexSettingsDescriptor();
diff --git a/src/OrchardCore/OrchardCore.Search.Elasticsearch.Core/Services/ElasticQueryService.cs b/src/OrchardCore/OrchardCore.Search.Elasticsearch.Core/Services/ElasticQueryService.cs
index adfc2bf23bf..73be897aab7 100644
--- a/src/OrchardCore/OrchardCore.Search.Elasticsearch.Core/Services/ElasticQueryService.cs
+++ b/src/OrchardCore/OrchardCore.Search.Elasticsearch.Core/Services/ElasticQueryService.cs
@@ -33,6 +33,8 @@ public async Task SearchAsync(string indexName, string query)
if (_elasticClient == null)
{
_logger.LogWarning("Elasticsearch Client is not setup, please validate your Elasticsearch Configurations");
+
+ return elasticTopDocs;
}
try
From 6e227d023e01066e0504ea8089d7436f80fef913 Mon Sep 17 00:00:00 2001
From: Hisham Bin Ateya
Date: Wed, 27 Mar 2024 23:18:55 +0300
Subject: [PATCH 09/24] Update Microsoft.Identity.Web 2.17.3 (#15605)
---
src/OrchardCore.Build/Dependencies.props | 2 +-
src/docs/resources/libraries/README.md | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/OrchardCore.Build/Dependencies.props b/src/OrchardCore.Build/Dependencies.props
index 7b20592f2a5..c75afbc65c8 100644
--- a/src/OrchardCore.Build/Dependencies.props
+++ b/src/OrchardCore.Build/Dependencies.props
@@ -41,7 +41,7 @@
-
+
diff --git a/src/docs/resources/libraries/README.md b/src/docs/resources/libraries/README.md
index 0fc39b98e82..77044e53bee 100644
--- a/src/docs/resources/libraries/README.md
+++ b/src/docs/resources/libraries/README.md
@@ -28,7 +28,7 @@ The below table lists the different .NET libraries used in Orchard Core:
| [Markdig](https://github.com/lunet-io/markdig) | .NET Markdown engine. | 0.36.2 | [BSD-2-Clause](https://github.com/lunet-io/markdig/blob/master/license.txt) |
| [MessagePack](https://github.com/neuecc/MessagePack-CSharp) | Extremely Fast MessagePack Serializer for C# | 2.2.60 | [MIT](https://github.com/neuecc/MessagePack-CSharp/blob/master/LICENSE) |
| [Microsoft.Extensions.Http.Resilience](https://github.com/dotnet/extensions/tree/main/src/Libraries/Microsoft.Extensions.Http.Resilience) | Resilience mechanisms for HttpClient built on the Polly framework. | 8.3.0 | [MIT](https://github.com/dotnet/extensions/blob/main/LICENSE) |
-| [Microsoft.Identity.Web](https://github.com/AzureAD/microsoft-identity-web) | Helps creating protected web apps and web APIs with Microsoft identity platform and Azure AD B2C. | 2.17.2 | [MIT](https://github.com/AzureAD/microsoft-identity-web/blob/master/LICENSE) |
+| [Microsoft.Identity.Web](https://github.com/AzureAD/microsoft-identity-web) | Helps creating protected web apps and web APIs with Microsoft identity platform and Azure AD B2C. | 2.17.3 | [MIT](https://github.com/AzureAD/microsoft-identity-web/blob/master/LICENSE) |
| [Microsoft.SourceLink.GitHub](https://github.com/dotnet/sourcelink) | Source Link enables a great source debugging experience. | 8.0.0 | [MIT](https://github.com/dotnet/sourcelink/blob/main/License.txt) |
| [MimeKit](https://github.com/jstedfast/MailKit) | A cross-platform .NET library for IMAP, POP3, and SMTP. | 4.4.0 | [MIT](https://github.com/jstedfast/MailKit/blob/master/LICENSE) |
| [MiniProfiler](https://github.com/MiniProfiler/dotnet) | A simple but effective mini-profiler for ASP.NET (and Core) websites | 4.3.8 | [MIT](https://github.com/MiniProfiler/dotnet/blob/main/LICENSE.txt) |
From 7e9f3acccb215d87c3240fb979265803c34b6420 Mon Sep 17 00:00:00 2001
From: Hisham Bin Ateya
Date: Thu, 28 Mar 2024 17:05:54 +0300
Subject: [PATCH 10/24] Check the null for searchResult.Value before call
GetResultsAsync() (#15598)
---
.../Services/AzureAISearchIndexDocumentManager.cs | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Services/AzureAISearchIndexDocumentManager.cs b/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Services/AzureAISearchIndexDocumentManager.cs
index 77027c013cd..fd6521aecaa 100644
--- a/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Services/AzureAISearchIndexDocumentManager.cs
+++ b/src/OrchardCore/OrchardCore.Search.AzureAI.Core/Services/AzureAISearchIndexDocumentManager.cs
@@ -60,13 +60,18 @@ public async Task> SearchAsync(string indexName, str
var searchResult = await client.SearchAsync(searchText, searchOptions);
var counter = 0L;
+ if (searchResult.Value is null)
+ {
+ return counter;
+ }
+
await foreach (var doc in searchResult.Value.GetResultsAsync())
{
action(doc.Document);
counter++;
}
- return searchResult.Value?.TotalCount ?? counter;
+ return searchResult.Value.TotalCount ?? counter;
}
public async Task DeleteDocumentsAsync(string indexName, IEnumerable contentItemIds)
From 7aea7c4278980227eaf029f819e9f462153c7ce9 Mon Sep 17 00:00:00 2001
From: Mike Alhayek
Date: Thu, 28 Mar 2024 11:25:58 -0700
Subject: [PATCH 11/24] Fix Taxonomy Serialization (#15615)
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---------
Co-authored-by: Sébastien Ros
---
.../OrchardCore.Taxonomies/Controllers/AdminController.cs | 7 ++++---
.../ContentItemConverter.cs | 5 +++--
2 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/src/OrchardCore.Modules/OrchardCore.Taxonomies/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Taxonomies/Controllers/AdminController.cs
index ffc2d45e3fc..882b33e6350 100644
--- a/src/OrchardCore.Modules/OrchardCore.Taxonomies/Controllers/AdminController.cs
+++ b/src/OrchardCore.Modules/OrchardCore.Taxonomies/Controllers/AdminController.cs
@@ -1,12 +1,10 @@
using System.Linq;
-using System.Text.Json;
using System.Text.Json.Nodes;
using System.Text.Json.Settings;
using System.Threading.Tasks;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.Localization;
-using Microsoft.Extensions.Options;
using OrchardCore.Admin;
using OrchardCore.ContentManagement;
using OrchardCore.ContentManagement.Display;
@@ -321,7 +319,10 @@ public async Task Delete(string taxonomyContentItemId, string tax
return NotFound();
}
- taxonomy.As().Content.Remove(taxonomyItemId);
+ taxonomy.Alter(part =>
+ {
+ part.Terms = part.Terms.Where(x => x.ContentItemId != taxonomyItemId).ToList();
+ });
await _session.SaveAsync(taxonomy);
diff --git a/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/ContentItemConverter.cs b/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/ContentItemConverter.cs
index fa4b82c08e9..7e26f0bea82 100644
--- a/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/ContentItemConverter.cs
+++ b/src/OrchardCore/OrchardCore.ContentManagement.Abstractions/ContentItemConverter.cs
@@ -91,10 +91,11 @@ public override ContentItem Read(ref Utf8JsonReader reader, Type typeToConvert,
contentItem.Owner = reader.TokenType == JsonTokenType.String ? reader.GetString() : null;
break;
default:
- if (reader.TokenType == JsonTokenType.StartObject)
+ if (reader.TokenType == JsonTokenType.StartObject ||
+ reader.TokenType == JsonTokenType.StartArray)
{
var property = JNode.Load(ref reader);
- contentItem.Data.Add(propertyName, property);
+ contentItem.Data[propertyName] = property;
}
break;
From a3f5637f447c1e8452ecc5a07b3c5526f66d32be Mon Sep 17 00:00:00 2001
From: Mike Alhayek
Date: Thu, 28 Mar 2024 12:34:55 -0700
Subject: [PATCH 12/24] Ensure Search Icon shows up on any search module
(#15611)
---
.../Views/NavigationItemText-search.Id.cshtml | 4 ++++
.../Views/NavigationItemText-search.Id.cshtml | 4 ++++
.../Views/NavigationItemText-search.Id.cshtml | 5 ++++-
.../Views/NavigationItemText-search.Id.cshtml | 4 ++++
4 files changed, 16 insertions(+), 1 deletion(-)
create mode 100644 src/OrchardCore.Modules/OrchardCore.Search.AzureAI/Views/NavigationItemText-search.Id.cshtml
create mode 100644 src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Views/NavigationItemText-search.Id.cshtml
create mode 100644 src/OrchardCore.Modules/OrchardCore.Search/Views/NavigationItemText-search.Id.cshtml
diff --git a/src/OrchardCore.Modules/OrchardCore.Search.AzureAI/Views/NavigationItemText-search.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.Search.AzureAI/Views/NavigationItemText-search.Id.cshtml
new file mode 100644
index 00000000000..1bca0499158
--- /dev/null
+++ b/src/OrchardCore.Modules/OrchardCore.Search.AzureAI/Views/NavigationItemText-search.Id.cshtml
@@ -0,0 +1,4 @@
+
+
+
+@T["Search"]
diff --git a/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Views/NavigationItemText-search.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Views/NavigationItemText-search.Id.cshtml
new file mode 100644
index 00000000000..1bca0499158
--- /dev/null
+++ b/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Views/NavigationItemText-search.Id.cshtml
@@ -0,0 +1,4 @@
+
+
+
+@T["Search"]
diff --git a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Views/NavigationItemText-search.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Views/NavigationItemText-search.Id.cshtml
index e209899726a..1bca0499158 100644
--- a/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Views/NavigationItemText-search.Id.cshtml
+++ b/src/OrchardCore.Modules/OrchardCore.Search.Lucene/Views/NavigationItemText-search.Id.cshtml
@@ -1 +1,4 @@
-@T["Search"]
+
+
+
+@T["Search"]
diff --git a/src/OrchardCore.Modules/OrchardCore.Search/Views/NavigationItemText-search.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.Search/Views/NavigationItemText-search.Id.cshtml
new file mode 100644
index 00000000000..1bca0499158
--- /dev/null
+++ b/src/OrchardCore.Modules/OrchardCore.Search/Views/NavigationItemText-search.Id.cshtml
@@ -0,0 +1,4 @@
+
+
+
+@T["Search"]
From ec3fa060c75d163b7d62ee8de8ad835e153307c3 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Ros?=
Date: Thu, 28 Mar 2024 13:19:26 -0700
Subject: [PATCH 13/24] Improve notification filter performance (#15610)
---
.../DynamicCacheShapeDisplayEvents.cs | 2 +-
.../TagHelpers/DynamicCacheTagHelper.cs | 2 +-
.../Pooling/ZStringWriter.cs | 207 ------------------
.../Queries/Types/ContentItemType.cs | 2 +-
.../Notify/Notifier.cs | 17 +-
.../Notify/NotifyEntry.cs | 36 +++
.../Notify/NotifyEntryComparer.cs | 5 +-
.../Notify/NotifyEntryConverter.cs | 17 +-
.../Notify/NotifyEntryExtensions.cs | 21 --
.../Notify/NotifyFilter.cs | 22 +-
.../Notify/NotifyJsonSerializerOptions.cs | 8 +
...otifyJsonSerializerOptionsConfiguration.cs | 19 ++
.../OrchardCoreBuilderExtensions.cs | 2 +
.../Razor/RazorShapeTemplateViewEngine.cs | 2 +-
14 files changed, 100 insertions(+), 262 deletions(-)
delete mode 100644 src/OrchardCore/OrchardCore.Abstractions/Pooling/ZStringWriter.cs
delete mode 100644 src/OrchardCore/OrchardCore.DisplayManagement/Notify/NotifyEntryExtensions.cs
create mode 100644 src/OrchardCore/OrchardCore.DisplayManagement/Notify/NotifyJsonSerializerOptions.cs
create mode 100644 src/OrchardCore/OrchardCore.DisplayManagement/Notify/NotifyJsonSerializerOptionsConfiguration.cs
diff --git a/src/OrchardCore.Modules/OrchardCore.DynamicCache/EventHandlers/DynamicCacheShapeDisplayEvents.cs b/src/OrchardCore.Modules/OrchardCore.DynamicCache/EventHandlers/DynamicCacheShapeDisplayEvents.cs
index 0f79bc5ed69..237d288f156 100644
--- a/src/OrchardCore.Modules/OrchardCore.DynamicCache/EventHandlers/DynamicCacheShapeDisplayEvents.cs
+++ b/src/OrchardCore.Modules/OrchardCore.DynamicCache/EventHandlers/DynamicCacheShapeDisplayEvents.cs
@@ -1,9 +1,9 @@
using System.Collections.Generic;
using System.Text.Encodings.Web;
using System.Threading.Tasks;
+using Cysharp.Text;
using Microsoft.AspNetCore.Html;
using Microsoft.Extensions.Options;
-using OrchardCore.Abstractions.Pooling;
using OrchardCore.DisplayManagement.Implementation;
using OrchardCore.Environment.Cache;
diff --git a/src/OrchardCore.Modules/OrchardCore.DynamicCache/TagHelpers/DynamicCacheTagHelper.cs b/src/OrchardCore.Modules/OrchardCore.DynamicCache/TagHelpers/DynamicCacheTagHelper.cs
index 273bf3255f0..b0e1289e333 100644
--- a/src/OrchardCore.Modules/OrchardCore.DynamicCache/TagHelpers/DynamicCacheTagHelper.cs
+++ b/src/OrchardCore.Modules/OrchardCore.DynamicCache/TagHelpers/DynamicCacheTagHelper.cs
@@ -1,11 +1,11 @@
using System;
using System.Text.Encodings.Web;
using System.Threading.Tasks;
+using Cysharp.Text;
using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc.TagHelpers.Cache;
using Microsoft.AspNetCore.Razor.TagHelpers;
using Microsoft.Extensions.Options;
-using OrchardCore.Abstractions.Pooling;
using OrchardCore.Environment.Cache;
namespace OrchardCore.DynamicCache.TagHelpers
diff --git a/src/OrchardCore/OrchardCore.Abstractions/Pooling/ZStringWriter.cs b/src/OrchardCore/OrchardCore.Abstractions/Pooling/ZStringWriter.cs
deleted file mode 100644
index e68ce00b898..00000000000
--- a/src/OrchardCore/OrchardCore.Abstractions/Pooling/ZStringWriter.cs
+++ /dev/null
@@ -1,207 +0,0 @@
-using System;
-using System.Globalization;
-using System.IO;
-using System.Text;
-using System.Threading;
-using System.Threading.Tasks;
-using Cysharp.Text;
-
-namespace OrchardCore.Abstractions.Pooling
-{
- ///
- /// Based StringWriter but made to use ZString as backing implementation.
- ///
- internal sealed class ZStringWriter : TextWriter
- {
- private Utf16ValueStringBuilder _sb;
- private bool _isOpen;
- private UnicodeEncoding _encoding;
-
- public ZStringWriter() : this(CultureInfo.CurrentCulture)
- {
- }
-
- public ZStringWriter(IFormatProvider formatProvider) : base(formatProvider)
- {
- _sb = ZString.CreateStringBuilder();
- _isOpen = true;
- }
-
- public override void Close()
- {
- Dispose(true);
- }
-
- protected override void Dispose(bool disposing)
- {
- _sb.Dispose();
- _isOpen = false;
- base.Dispose(disposing);
- }
-
- public override Encoding Encoding => _encoding ??= new UnicodeEncoding(false, false);
-
- // Writes a character to the underlying string buffer.
- //
- public override void Write(char value)
- {
- ObjectDisposedException.ThrowIf(!_isOpen, nameof(_sb));
-
- _sb.Append(value);
- }
-
- public override void Write(char[] buffer, int index, int count)
- {
- ArgumentNullException.ThrowIfNull(buffer);
-
- ArgumentOutOfRangeException.ThrowIfLessThan(index, 0);
- ArgumentOutOfRangeException.ThrowIfLessThan(count, 0);
- if (buffer.Length - index < count)
- {
- throw new ArgumentException("Buffer overflow.");
- }
-
- ObjectDisposedException.ThrowIf(!_isOpen, nameof(_sb));
-
- _sb.Append(buffer.AsSpan(index, count));
- }
-
- public override void Write(ReadOnlySpan buffer)
- {
- ObjectDisposedException.ThrowIf(!_isOpen, nameof(_sb));
-
- _sb.Append(buffer);
- }
-
- // Writes a string to the underlying string buffer. If the given string is
- // null, nothing is written.
- //
- public override void Write(string value)
- {
- ObjectDisposedException.ThrowIf(!_isOpen, nameof(_sb));
-
- if (value != null)
- {
- _sb.Append(value);
- }
- }
-
- public override void Write(StringBuilder value)
- {
- ObjectDisposedException.ThrowIf(!_isOpen, nameof(_sb));
-
- _sb.Append(value);
- }
-
- public override void WriteLine(ReadOnlySpan buffer)
- {
- ObjectDisposedException.ThrowIf(!_isOpen, nameof(_sb));
-
- _sb.Append(buffer);
- WriteLine();
- }
-
- public override void WriteLine(StringBuilder value)
- {
- ObjectDisposedException.ThrowIf(!_isOpen, nameof(_sb));
-
- _sb.Append(value);
- WriteLine();
- }
-
- public override Task WriteAsync(char value)
- {
- Write(value);
- return Task.CompletedTask;
- }
-
- public override Task WriteAsync(string value)
- {
- Write(value);
- return Task.CompletedTask;
- }
-
- public override Task WriteAsync(char[] buffer, int index, int count)
- {
- Write(buffer, index, count);
- return Task.CompletedTask;
- }
-
- public override Task WriteAsync(ReadOnlyMemory buffer, CancellationToken cancellationToken = default)
- {
- if (cancellationToken.IsCancellationRequested)
- {
- return Task.FromCanceled(cancellationToken);
- }
-
- Write(buffer.Span);
- return Task.CompletedTask;
- }
-
- public override Task WriteAsync(StringBuilder value, CancellationToken cancellationToken = default)
- {
- if (cancellationToken.IsCancellationRequested)
- {
- return Task.FromCanceled(cancellationToken);
- }
-
- ObjectDisposedException.ThrowIf(!_isOpen, nameof(_sb));
-
- _sb.Append(value);
- return Task.CompletedTask;
- }
-
- public override Task WriteLineAsync(char value)
- {
- WriteLine(value);
- return Task.CompletedTask;
- }
-
- public override Task WriteLineAsync(string value)
- {
- WriteLine(value);
- return Task.CompletedTask;
- }
-
- public override Task WriteLineAsync(StringBuilder value, CancellationToken cancellationToken = default)
- {
- if (cancellationToken.IsCancellationRequested)
- {
- return Task.FromCanceled(cancellationToken);
- }
-
- ObjectDisposedException.ThrowIf(!_isOpen, nameof(_sb));
-
- _sb.Append(value);
- WriteLine();
- return Task.CompletedTask;
- }
-
- public override Task WriteLineAsync(char[] buffer, int index, int count)
- {
- WriteLine(buffer, index, count);
- return Task.CompletedTask;
- }
-
- public override Task WriteLineAsync(ReadOnlyMemory buffer, CancellationToken cancellationToken = default)
- {
- if (cancellationToken.IsCancellationRequested)
- {
- return Task.FromCanceled(cancellationToken);
- }
-
- WriteLine(buffer.Span);
- return Task.CompletedTask;
- }
-
- public override Task FlushAsync()
- {
- return Task.CompletedTask;
- }
-
- public override string ToString()
- {
- return _sb.ToString();
- }
- }
-}
diff --git a/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Types/ContentItemType.cs b/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Types/ContentItemType.cs
index 61baf94f252..391c7caa0f3 100644
--- a/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Types/ContentItemType.cs
+++ b/src/OrchardCore/OrchardCore.ContentManagement.GraphQL/Queries/Types/ContentItemType.cs
@@ -1,10 +1,10 @@
using System.Text.Encodings.Web;
using System.Threading.Tasks;
+using Cysharp.Text;
using GraphQL;
using GraphQL.Types;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
-using OrchardCore.Abstractions.Pooling;
using OrchardCore.Apis.GraphQL;
using OrchardCore.ContentManagement.Display;
using OrchardCore.ContentManagement.GraphQL.Options;
diff --git a/src/OrchardCore/OrchardCore.DisplayManagement/Notify/Notifier.cs b/src/OrchardCore/OrchardCore.DisplayManagement/Notify/Notifier.cs
index b205283de06..08ca4931a90 100644
--- a/src/OrchardCore/OrchardCore.DisplayManagement/Notify/Notifier.cs
+++ b/src/OrchardCore/OrchardCore.DisplayManagement/Notify/Notifier.cs
@@ -1,5 +1,6 @@
-using System;
using System.Collections.Generic;
+using System.Threading.Tasks;
+using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Mvc.Localization;
using Microsoft.Extensions.Logging;
@@ -7,7 +8,7 @@ namespace OrchardCore.DisplayManagement.Notify
{
public class Notifier : INotifier
{
- private readonly IList _entries;
+ private readonly List _entries;
private readonly ILogger _logger;
public Notifier(ILogger logger)
@@ -16,17 +17,21 @@ public Notifier(ILogger logger)
_logger = logger;
}
- [Obsolete("This method will be removed in a later version. Use AddAsync()")]
- // TODO The implementation for this is provided as an interface default implementation
- // when the interface method is removed, replace this with AddAsync.
public void Add(NotifyType type, LocalizedHtmlString message)
+ {
+ throw new System.NotImplementedException();
+ }
+
+ public ValueTask AddAsync(NotifyType type, LocalizedHtmlString message)
{
if (_logger.IsEnabled(LogLevel.Information))
{
- _logger.LogInformation("Notification '{NotificationType}' with message '{NotificationMessage}'", type, message.Value);
+ _logger.LogInformation("Notification '{NotificationType}' with message '{NotificationMessage}'", type, message.ToString());
}
_entries.Add(new NotifyEntry { Type = type, Message = message });
+
+ return ValueTask.CompletedTask;
}
public IList List()
diff --git a/src/OrchardCore/OrchardCore.DisplayManagement/Notify/NotifyEntry.cs b/src/OrchardCore/OrchardCore.DisplayManagement/Notify/NotifyEntry.cs
index 3d37536af8f..11d71a347e2 100644
--- a/src/OrchardCore/OrchardCore.DisplayManagement/Notify/NotifyEntry.cs
+++ b/src/OrchardCore/OrchardCore.DisplayManagement/Notify/NotifyEntry.cs
@@ -1,3 +1,6 @@
+using System.Text.Encodings.Web;
+using System.Web;
+using Cysharp.Text;
using Microsoft.AspNetCore.Html;
namespace OrchardCore.DisplayManagement.Notify
@@ -12,7 +15,40 @@ public enum NotifyType
public class NotifyEntry
{
+ private (HtmlEncoder HtmlEncoder, string Message) _cache;
+
public NotifyType Type { get; set; }
public IHtmlContent Message { get; set; }
+
+ public string ToHtmlString(HtmlEncoder htmlEncoder)
+ {
+ // When the object is created from a cookie the message
+ // is an HtmlString so we can use this instead of using
+ // the TextWriter path.
+
+ if (Message is IHtmlString htmlString)
+ {
+ return htmlString.ToHtmlString();
+ }
+
+ // Cache the encoded version for the specified encoder.
+ // This is necessary as long as there will be string-based comparisons
+ // and the need of NotifyEntryComparer
+
+ var cache = _cache;
+
+ if (cache.Message != null && cache.HtmlEncoder == htmlEncoder)
+ {
+ return cache.Message;
+ }
+
+ using var stringWriter = new ZStringWriter();
+ Message.WriteTo(stringWriter, htmlEncoder);
+ stringWriter.Flush();
+
+ _cache = cache = new(htmlEncoder, stringWriter.ToString());
+
+ return cache.Message;
+ }
}
}
diff --git a/src/OrchardCore/OrchardCore.DisplayManagement/Notify/NotifyEntryComparer.cs b/src/OrchardCore/OrchardCore.DisplayManagement/Notify/NotifyEntryComparer.cs
index 8f31d04776e..eae765b08b7 100644
--- a/src/OrchardCore/OrchardCore.DisplayManagement/Notify/NotifyEntryComparer.cs
+++ b/src/OrchardCore/OrchardCore.DisplayManagement/Notify/NotifyEntryComparer.cs
@@ -1,3 +1,4 @@
+using System;
using System.Collections.Generic;
using System.Text.Encodings.Web;
@@ -14,12 +15,12 @@ public NotifyEntryComparer(HtmlEncoder htmlEncoder)
public bool Equals(NotifyEntry x, NotifyEntry y)
{
- return x.Type == y.Type && x.GetMessageAsString(_htmlEncoder) == y.GetMessageAsString(_htmlEncoder);
+ return x.Type == y.Type && x.ToHtmlString(_htmlEncoder) == y.ToHtmlString(_htmlEncoder);
}
public int GetHashCode(NotifyEntry obj)
{
- return obj.GetMessageAsString(_htmlEncoder).GetHashCode() & 23 * obj.Type.GetHashCode();
+ return HashCode.Combine(obj.ToHtmlString(_htmlEncoder), obj.Type);
}
}
}
diff --git a/src/OrchardCore/OrchardCore.DisplayManagement/Notify/NotifyEntryConverter.cs b/src/OrchardCore/OrchardCore.DisplayManagement/Notify/NotifyEntryConverter.cs
index 82a8c1fff6a..9446ec8df7e 100644
--- a/src/OrchardCore/OrchardCore.DisplayManagement/Notify/NotifyEntryConverter.cs
+++ b/src/OrchardCore/OrchardCore.DisplayManagement/Notify/NotifyEntryConverter.cs
@@ -1,6 +1,4 @@
using System;
-using System.IO;
-using System.Text;
using System.Text.Encodings.Web;
using System.Text.Json;
using System.Text.Json.Nodes;
@@ -48,18 +46,11 @@ public override void Write(Utf8JsonWriter writer, NotifyEntry value, JsonSeriali
return;
}
- var o = new JsonObject();
-
- // Serialize the message as it's an IHtmlContent
- var stringBuilder = new StringBuilder();
- using (var stringWriter = new StringWriter(stringBuilder))
+ var o = new JsonObject
{
- notifyEntry.Message.WriteTo(stringWriter, _htmlEncoder);
- }
-
- // Write all well-known properties
- o.Add(nameof(NotifyEntry.Type), notifyEntry.Type.ToString());
- o.Add(nameof(NotifyEntry.Message), notifyEntry.GetMessageAsString(_htmlEncoder));
+ { nameof(NotifyEntry.Type), notifyEntry.Type.ToString() },
+ { nameof(NotifyEntry.Message), notifyEntry.ToHtmlString(_htmlEncoder) }
+ };
o.WriteTo(writer);
}
diff --git a/src/OrchardCore/OrchardCore.DisplayManagement/Notify/NotifyEntryExtensions.cs b/src/OrchardCore/OrchardCore.DisplayManagement/Notify/NotifyEntryExtensions.cs
deleted file mode 100644
index 1451f0a068d..00000000000
--- a/src/OrchardCore/OrchardCore.DisplayManagement/Notify/NotifyEntryExtensions.cs
+++ /dev/null
@@ -1,21 +0,0 @@
-using System.IO;
-using System.Text;
-using System.Text.Encodings.Web;
-
-namespace OrchardCore.DisplayManagement.Notify
-{
- internal static class NotifyEntryExtensions
- {
- public static string GetMessageAsString(this NotifyEntry entry, HtmlEncoder htmlEncoder)
- {
- var stringBuilder = new StringBuilder();
- using (var stringWriter = new StringWriter(stringBuilder))
- {
- entry.Message.WriteTo(stringWriter, htmlEncoder);
- stringWriter.Flush();
- }
-
- return stringBuilder.ToString();
- }
- }
-}
diff --git a/src/OrchardCore/OrchardCore.DisplayManagement/Notify/NotifyFilter.cs b/src/OrchardCore/OrchardCore.DisplayManagement/Notify/NotifyFilter.cs
index 870c22c4703..073e42ea57b 100644
--- a/src/OrchardCore/OrchardCore.DisplayManagement/Notify/NotifyFilter.cs
+++ b/src/OrchardCore/OrchardCore.DisplayManagement/Notify/NotifyFilter.cs
@@ -10,6 +10,7 @@
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
+using Microsoft.Extensions.Options;
using OrchardCore.DisplayManagement.Layout;
namespace OrchardCore.DisplayManagement.Notify
@@ -23,9 +24,9 @@ public class NotifyFilter : IActionFilter, IAsyncResultFilter, IPageFilter
private readonly ILayoutAccessor _layoutAccessor;
private readonly IDataProtectionProvider _dataProtectionProvider;
private readonly HtmlEncoder _htmlEncoder;
+ private readonly IOptions _notifyJsonSerializerOptions;
private readonly ILogger _logger;
- public readonly JsonSerializerOptions _settings;
private NotifyEntry[] _existingEntries = [];
private bool _shouldDeleteCookie;
@@ -35,6 +36,7 @@ public NotifyFilter(
ILayoutAccessor layoutAccessor,
IDataProtectionProvider dataProtectionProvider,
HtmlEncoder htmlEncoder,
+ IOptions notifyJsonSerializerOptions,
ILogger logger)
{
_notifier = notifier;
@@ -42,15 +44,17 @@ public NotifyFilter(
_layoutAccessor = layoutAccessor;
_dataProtectionProvider = dataProtectionProvider;
_htmlEncoder = htmlEncoder;
+ _notifyJsonSerializerOptions = notifyJsonSerializerOptions;
_logger = logger;
-
- _settings = new(JOptions.Default);
- _settings.Converters.Add(new NotifyEntryConverter(htmlEncoder));
}
private void OnHandlerExecuting(FilterContext filterContext)
{
- var messages = Convert.ToString(filterContext.HttpContext.Request.Cookies[CookiePrefix]);
+ if (!filterContext.HttpContext.Request.Cookies.TryGetValue(CookiePrefix, out var messages))
+ {
+ return;
+ }
+
if (string.IsNullOrEmpty(messages))
{
return;
@@ -76,10 +80,10 @@ private void OnHandlerExecuting(FilterContext filterContext)
private void OnHandlerExecuted(FilterContext filterContext)
{
- var messageEntries = _notifier.List().ToArray();
+ var messageEntries = _notifier.List();
// Don't touch temp data if there's no work to perform.
- if (messageEntries.Length == 0 && _existingEntries.Length == 0)
+ if (messageEntries.Count == 0 && _existingEntries.Length == 0)
{
return;
}
@@ -175,7 +179,7 @@ private string SerializeNotifyEntry(NotifyEntry[] notifyEntries)
try
{
var protector = _dataProtectionProvider.CreateProtector(nameof(NotifyFilter));
- var signed = protector.Protect(JConvert.SerializeObject(notifyEntries, _settings));
+ var signed = protector.Protect(JConvert.SerializeObject(notifyEntries, _notifyJsonSerializerOptions.Value.SerializerOptions));
return WebUtility.UrlEncode(signed);
}
catch
@@ -190,7 +194,7 @@ private void DeserializeNotifyEntries(string value, out NotifyEntry[] messageEnt
{
var protector = _dataProtectionProvider.CreateProtector(nameof(NotifyFilter));
var decoded = protector.Unprotect(WebUtility.UrlDecode(value));
- messageEntries = JConvert.DeserializeObject(decoded, _settings);
+ messageEntries = JConvert.DeserializeObject(decoded, _notifyJsonSerializerOptions.Value.SerializerOptions);
}
catch
{
diff --git a/src/OrchardCore/OrchardCore.DisplayManagement/Notify/NotifyJsonSerializerOptions.cs b/src/OrchardCore/OrchardCore.DisplayManagement/Notify/NotifyJsonSerializerOptions.cs
new file mode 100644
index 00000000000..7fab6149dbd
--- /dev/null
+++ b/src/OrchardCore/OrchardCore.DisplayManagement/Notify/NotifyJsonSerializerOptions.cs
@@ -0,0 +1,8 @@
+using System.Text.Json;
+
+namespace OrchardCore.DisplayManagement.Notify;
+
+public class NotifyJsonSerializerOptions
+{
+ public JsonSerializerOptions SerializerOptions { get; } = new JsonSerializerOptions();
+}
diff --git a/src/OrchardCore/OrchardCore.DisplayManagement/Notify/NotifyJsonSerializerOptionsConfiguration.cs b/src/OrchardCore/OrchardCore.DisplayManagement/Notify/NotifyJsonSerializerOptionsConfiguration.cs
new file mode 100644
index 00000000000..c1ed3ace57e
--- /dev/null
+++ b/src/OrchardCore/OrchardCore.DisplayManagement/Notify/NotifyJsonSerializerOptionsConfiguration.cs
@@ -0,0 +1,19 @@
+using System.Text.Encodings.Web;
+using Microsoft.Extensions.Options;
+
+namespace OrchardCore.DisplayManagement.Notify;
+
+internal sealed class NotifyJsonSerializerOptionsConfiguration : IConfigureOptions
+{
+ private readonly HtmlEncoder _htmlEncoder;
+
+ public NotifyJsonSerializerOptionsConfiguration(HtmlEncoder htmlEncoder)
+ {
+ _htmlEncoder = htmlEncoder;
+ }
+
+ public void Configure(NotifyJsonSerializerOptions options)
+ {
+ options.SerializerOptions.Converters.Add(new NotifyEntryConverter(_htmlEncoder));
+ }
+}
diff --git a/src/OrchardCore/OrchardCore.DisplayManagement/OrchardCoreBuilderExtensions.cs b/src/OrchardCore/OrchardCore.DisplayManagement/OrchardCoreBuilderExtensions.cs
index ca2bff861f0..2ea811a587a 100644
--- a/src/OrchardCore/OrchardCore.DisplayManagement/OrchardCoreBuilderExtensions.cs
+++ b/src/OrchardCore/OrchardCore.DisplayManagement/OrchardCoreBuilderExtensions.cs
@@ -44,6 +44,8 @@ public static OrchardCoreBuilder AddTheming(this OrchardCoreBuilder builder)
options.Filters.Add(typeof(RazorViewActionFilter));
});
+ services.AddTransient, NotifyJsonSerializerOptionsConfiguration>();
+
// Used as a service when we create a fake 'ActionContext'.
services.AddScoped();
diff --git a/src/OrchardCore/OrchardCore.DisplayManagement/Razor/RazorShapeTemplateViewEngine.cs b/src/OrchardCore/OrchardCore.DisplayManagement/Razor/RazorShapeTemplateViewEngine.cs
index 04980a050ac..454c9667b50 100644
--- a/src/OrchardCore/OrchardCore.DisplayManagement/Razor/RazorShapeTemplateViewEngine.cs
+++ b/src/OrchardCore/OrchardCore.DisplayManagement/Razor/RazorShapeTemplateViewEngine.cs
@@ -3,6 +3,7 @@
using System.IO;
using System.Linq;
using System.Threading.Tasks;
+using Cysharp.Text;
using Microsoft.AspNetCore.Html;
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
@@ -16,7 +17,6 @@
using Microsoft.AspNetCore.Routing;
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Options;
-using OrchardCore.Abstractions.Pooling;
using OrchardCore.DisplayManagement.Descriptors.ShapeTemplateStrategy;
using OrchardCore.DisplayManagement.Implementation;
From 816cf8440d5c1e729cdeb77d7249d2bfcc47c95c Mon Sep 17 00:00:00 2001
From: rwawr <153218770+rwawr@users.noreply.github.com>
Date: Thu, 28 Mar 2024 16:19:51 -0400
Subject: [PATCH 14/24] Adjust content type condition to evaluate to true when
no content is displayed (#15603)
---
.../Drivers/ContentTypeConditionEvaluatorDriver.cs | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/OrchardCore.Modules/OrchardCore.Rules/Drivers/ContentTypeConditionEvaluatorDriver.cs b/src/OrchardCore.Modules/OrchardCore.Rules/Drivers/ContentTypeConditionEvaluatorDriver.cs
index 59fe11dd09e..daed06de4a9 100644
--- a/src/OrchardCore.Modules/OrchardCore.Rules/Drivers/ContentTypeConditionEvaluatorDriver.cs
+++ b/src/OrchardCore.Modules/OrchardCore.Rules/Drivers/ContentTypeConditionEvaluatorDriver.cs
@@ -43,6 +43,14 @@ public ValueTask EvaluateAsync(Condition condition)
private ValueTask EvaluateAsync(ContentTypeCondition condition)
{
var operatorComparer = _operatorResolver.GetOperatorComparer(condition.Operation);
+
+ // If no content types are considered, use the empty string as the value to compare against,
+ // since we still want comparisons such as "Does Not Equal", "Does Not Start With", etc. to evaluate to true in this case.
+ if (_contentTypes.Count == 0)
+ {
+ return ValueTask.FromResult(operatorComparer.Compare(condition.Operation, string.Empty, condition.Value));
+ }
+
foreach (var contentType in _contentTypes)
{
if (operatorComparer.Compare(condition.Operation, contentType, condition.Value))
From 8ebf8e3d27fa801910da507f1ae618bc4ec41576 Mon Sep 17 00:00:00 2001
From: Mike Alhayek
Date: Thu, 28 Mar 2024 14:41:50 -0700
Subject: [PATCH 15/24] Improve the Pager extensions (#15617)
---
.../ShapeFactoryExtensions.cs | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/src/OrchardCore/OrchardCore.Navigation.Core/ShapeFactoryExtensions.cs b/src/OrchardCore/OrchardCore.Navigation.Core/ShapeFactoryExtensions.cs
index 62c08f92a77..03d64bc33e9 100644
--- a/src/OrchardCore/OrchardCore.Navigation.Core/ShapeFactoryExtensions.cs
+++ b/src/OrchardCore/OrchardCore.Navigation.Core/ShapeFactoryExtensions.cs
@@ -8,7 +8,7 @@ namespace OrchardCore.DisplayManagement;
public static class ShapeFactoryExtensions
{
public static ValueTask PagerAsync(this IShapeFactory _shapeFactory, Pager pager, int totalItemCount)
- => _shapeFactory.CreateAsync("Pager", Arguments.From(new
+ => _shapeFactory.CreateAsync(nameof(Pager), Arguments.From(new
{
pager.Page,
pager.PageSize,
@@ -17,11 +17,11 @@ public static ValueTask PagerAsync(this IShapeFactory _shapeFactory, Pag
public static async ValueTask PagerAsync(this IShapeFactory _shapeFactory, Pager pager, int totalItemCount, RouteData routeData)
{
- dynamic pagerShape = await _shapeFactory.PagerAsync(pager, totalItemCount);
+ var pagerShape = await _shapeFactory.PagerAsync(pager, totalItemCount);
if (routeData != null)
{
- pagerShape.RouteData(routeData);
+ pagerShape.Properties[nameof(RouteData)] = routeData;
}
return pagerShape;
@@ -31,7 +31,7 @@ public static ValueTask PagerAsync(this IShapeFactory _shapeFactory, Pag
=> _shapeFactory.PagerAsync(pager, totalItemCount, routeValues == null ? null : new RouteData(routeValues));
public static ValueTask PagerSlimAsync(this IShapeFactory _shapeFactory, PagerSlim pager)
- => _shapeFactory.CreateAsync("PagerSlim", Arguments.From(new
+ => _shapeFactory.CreateAsync(nameof(PagerSlim), Arguments.From(new
{
pager.Before,
pager.After,
@@ -40,7 +40,7 @@ public static ValueTask PagerSlimAsync(this IShapeFactory _shapeFactory,
public static async ValueTask PagerSlimAsync(this IShapeFactory _shapeFactory, PagerSlim pager, IDictionary values)
{
- dynamic shape = await _shapeFactory.CreateAsync("PagerSlim", Arguments.From(new
+ var shape = await _shapeFactory.CreateAsync(nameof(PagerSlim), Arguments.From(new
{
pager.Before,
pager.After,
@@ -49,7 +49,7 @@ public static async ValueTask PagerSlimAsync(this IShapeFactory _shapeFa
if (values != null && values.Count > 0)
{
- shape.UrlParams(values);
+ shape.Properties["UrlParams"] = values;
}
return shape;
From b2659d8217e894ea1bd6c2b2d12cc251aeaadd2f Mon Sep 17 00:00:00 2001
From: Mike Alhayek
Date: Thu, 28 Mar 2024 14:42:13 -0700
Subject: [PATCH 16/24] Document the removal of PopulateSettings in 1.9 release
notes (#15618)
---
src/docs/releases/1.9.0.md | 23 +++++++++++++++++++++++
1 file changed, 23 insertions(+)
diff --git a/src/docs/releases/1.9.0.md b/src/docs/releases/1.9.0.md
index 436c638e1e3..9a96c2c91e8 100644
--- a/src/docs/releases/1.9.0.md
+++ b/src/docs/releases/1.9.0.md
@@ -44,6 +44,29 @@ services.AddJsonDerivedTypeInfo();
In particular, any type introduced in custom modules inheriting from `MenuItem`, `AdminNode`, `Condition`, `ConditionOperator`, `Query`, `SitemapType` will have to use this method.
+ - The extension `PopulateSettings(model)` was removed from `PartFieldDefinition`. If you are using this method in your code, you'll have to get the settings using the `Settings` object directly. For instance, if you have this code,
+
+ ```csharp
+ public override IDisplayResult Edit(ContentPartFieldDefinition partFieldDefinition)
+ {
+ return Initialize("NumericFieldSettings_Edit", model => partFieldDefinition.PopulateSettings(model));
+ }
+ ```
+
+ You'll change it to the following:
+
+ ```csharp
+ public override IDisplayResult Edit(ContentPartFieldDefinition partFieldDefinition)
+ {
+ return Initialize("NumericFieldSettings_Edit", model =>
+ {
+ var settings = partFieldDefinition.Settings.ToObject();
+ model.Hint = settings.Hint;
+ // ...
+ });
+ }
+ ```
+
### Media Indexing
Previously, `.pdf` files were automatically indexed in the search providers (Elasticsearch, Lucene or Azure AI Search). Now, if you want to continue to index `.PDF` file you'll need to enable the `OrchardCore.Media.Indexing.Pdf` feature.
From 303dabaf2416a3346ec0ee468e989f8b3eb414e5 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zolt=C3=A1n=20Leh=C3=B3czky?=
Date: Thu, 28 Mar 2024 22:42:52 +0100
Subject: [PATCH 17/24] Publishing preview packages daily (Lombiq Technologies:
OCORE-151) (#15552)
---
.github/workflows/main_ci.yml | 47 +++++++++++++++++
.github/workflows/preview_ci.yml | 50 +++++++++++--------
README.md | 4 +-
.../getting-started/preview-package-source.md | 8 +--
4 files changed, 81 insertions(+), 28 deletions(-)
create mode 100644 .github/workflows/main_ci.yml
diff --git a/.github/workflows/main_ci.yml b/.github/workflows/main_ci.yml
new file mode 100644
index 00000000000..ca8bc847223
--- /dev/null
+++ b/.github/workflows/main_ci.yml
@@ -0,0 +1,47 @@
+name: Main - CI
+on:
+ push:
+ paths-ignore:
+ - '**/*.md'
+ - 'mkdocs.yml'
+ - 'src/docs/**/*'
+ branches: [ main ]
+env:
+ DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
+ DOTNET_CLI_TELEMETRY_OPTOUT: true
+jobs:
+ test:
+ runs-on: ${{ matrix.os }}
+ name: Build & Test
+ strategy:
+ fail-fast: false
+ matrix:
+ os: [ubuntu-latest, windows-latest]
+ steps:
+ - uses: actions/checkout@v3
+ - uses: actions/setup-node@v3
+ with:
+ node-version: "15"
+ - uses: actions/setup-dotnet@v3
+ with:
+ dotnet-version: '8.0.x'
+ - name: Build
+ run: |
+ dotnet build -c Release
+ - name: Unit Tests
+ run: |
+ dotnet test -c Release --no-build ./test/OrchardCore.Tests/OrchardCore.Tests.csproj
+ - name: Functional Tests
+ if: matrix.os == 'ubuntu-latest'
+ run: |
+ cd test/OrchardCore.Tests.Functional
+ npm install
+ npm run cms:test
+ npm run mvc:test
+ - uses: actions/upload-artifact@v2
+ if: matrix.os == 'ubuntu-latest' && failure()
+ with:
+ name: Functional Test failure
+ path: |
+ test/OrchardCore.Tests.Functional/cms-tests/cypress/screenshots
+ src/OrchardCore.Cms.Web/App_Data_Tests/logs
diff --git a/.github/workflows/preview_ci.yml b/.github/workflows/preview_ci.yml
index 961d8bf9b9a..fe25acb75b8 100644
--- a/.github/workflows/preview_ci.yml
+++ b/.github/workflows/preview_ci.yml
@@ -1,69 +1,75 @@
name: Preview - CI
on:
- push:
- paths-ignore:
- - '**/*.md'
- - 'mkdocs.yml'
- - 'src/docs/**/*'
- branches: [ main ]
+ workflow_dispatch:
+ schedule:
+ # 4:19 AM UTC every day. A random time to avoid peak times of GitHub Actions.
+ - cron: '19 4 * * *'
env:
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
jobs:
test:
- runs-on: ${{ matrix.os }}
+ runs-on: ubuntu-latest
name: Build, Test, Deploy
- strategy:
- fail-fast: false
- matrix:
- os: [ubuntu-latest, windows-latest]
steps:
- - uses: actions/checkout@v3
+ - uses: actions/checkout@v4
+ - name: Check if should publish
+ id: check-publish
+ shell: pwsh
+ run: |
+ $hasCommitFromLastDay = ![string]::IsNullOrEmpty((git log --oneline --since '24 hours ago'))
+ Write-Output "Commits found in the last 24 hours: $hasCommitFromLastDay."
+ $shouldPublish = $hasCommitFromLastDay -and '${{ github.event_name }}' -eq 'schedule'
+ "should-publish=$($shouldPublish ? 'true' : 'false')" >> $Env:GITHUB_OUTPUT
- uses: actions/setup-node@v3
+ if: steps.check-publish.outputs.should-publish == 'true'
with:
node-version: "15"
- uses: actions/setup-dotnet@v3
+ if: steps.check-publish.outputs.should-publish == 'true'
with:
dotnet-version: '8.0.x'
- - name: Set build number
- if: matrix.os == 'ubuntu-latest'
+ - name: Set build number
+ if: steps.check-publish.outputs.should-publish == 'true'
run: echo "BuildNumber=$(( $GITHUB_RUN_NUMBER + 16368 ))" >> $GITHUB_ENV
- name: Build
+ if: steps.check-publish.outputs.should-publish == 'true'
run: |
dotnet build -c Release
- name: Unit Tests
+ if: steps.check-publish.outputs.should-publish == 'true'
run: |
dotnet test -c Release --no-build ./test/OrchardCore.Tests/OrchardCore.Tests.csproj
- name: Functional Tests
- if: matrix.os == 'ubuntu-latest'
+ if: steps.check-publish.outputs.should-publish == 'true'
run: |
cd test/OrchardCore.Tests.Functional
npm install
npm run cms:test
npm run mvc:test
- uses: actions/upload-artifact@v2
- if: matrix.os == 'ubuntu-latest' && failure()
+ if: failure()
with:
name: Functional Test failure
path: |
test/OrchardCore.Tests.Functional/cms-tests/cypress/screenshots
src/OrchardCore.Cms.Web/App_Data_Tests/logs
- - name: Deploy preview nuget packages
- if: matrix.os == 'ubuntu-latest'
+ - name: Deploy preview NuGet packages
+ if: steps.check-publish.outputs.should-publish == 'true'
run: |
dotnet pack -c Release --no-build
dotnet nuget push './src/**/*.nupkg' -t 600 -k ${{secrets.CLOUDSMITH_API_KEY}} -n -s https://nuget.cloudsmith.io/orchardcore/preview/v3/index.json --skip-duplicate
- name: Set up Docker Buildx
- if: matrix.os == 'ubuntu-latest'
+ if: steps.check-publish.outputs.should-publish == 'true'
uses: docker/setup-buildx-action@v3
- name: Login to DockerHub
- if: matrix.os == 'ubuntu-latest'
+ if: steps.check-publish.outputs.should-publish == 'true'
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PASSWORD }}
- - name: Deploy preview docker images
- if: matrix.os == 'ubuntu-latest'
+ - name: Deploy preview Docker images
+ if: steps.check-publish.outputs.should-publish == 'true'
shell: pwsh
run: |
Get-ChildItem ./src/OrchardCore.Cms.Web/App_Data -Recurse | Remove-Item -Recurse -Confirm:$false
diff --git a/README.md b/README.md
index a0f2367eb96..e8d7ca49416 100644
--- a/README.md
+++ b/README.md
@@ -12,12 +12,12 @@ Orchard Core consists of two distinct projects:
## Build Status
-Stable (release/1.8.2):
+Stable (`release/1.8.2`):
[![Build status](https://github.com/OrchardCMS/OrchardCore/actions/workflows/release_ci.yml/badge.svg)](https://github.com/OrchardCMS/OrchardCore/actions?query=workflow%3A%22Release+-+CI%22)
[![NuGet](https://img.shields.io/nuget/v/OrchardCore.Application.Cms.Targets.svg)](https://www.nuget.org/packages/OrchardCore.Application.Cms.Targets)
-Nightly (main):
+Nightly (`main`):
[![Build status](https://github.com/OrchardCMS/OrchardCore/actions/workflows/preview_ci.yml/badge.svg)](https://github.com/OrchardCMS/OrchardCore/actions?query=workflow%3A%22Preview+-+CI%22)
[![Cloudsmith](https://api-prd.cloudsmith.io/badges/version/orchardcore/preview/nuget/OrchardCore.Application.Cms.Targets/latest/x/?render=true&badge_token=gAAAAABey9hKFD_C-ZIpLvayS3HDsIjIorQluDs53KjIdlxoDz6Ntt1TzvMNJp7a_UWvQbsfN5nS7_0IbxCyqHZsjhmZP6cBkKforo-NqwrH5-E6QCrJ3D8%3D)](https://cloudsmith.io/~orchardcore/repos/preview/packages/detail/nuget/OrchardCore.Application.Cms.Targets/latest/)
diff --git a/src/docs/getting-started/preview-package-source.md b/src/docs/getting-started/preview-package-source.md
index dcd1d5496d1..3c7d12e6da2 100644
--- a/src/docs/getting-started/preview-package-source.md
+++ b/src/docs/getting-started/preview-package-source.md
@@ -1,11 +1,11 @@
# Add preview package source
-In this article, we are going to add a new package source pointing to the preview packages.
-The preview packages are built each time some code is committed on the `dev` branch, compared to the ones on NuGet, built from the `master` branch.
-They are the most up to date versions but not the most stable and can contain breaking changes.
+In this article, we are going to add a new package source pointing to the preview packages. The preview packages are built every day from the latest code on the `main` branch and published to [Cloudsmith](https://cloudsmith.io/~orchardcore/repos/preview/packages/). Release packages are published to NuGet, built from code corresponding to that release's version tag.
+
+The preview packages are the most up-to-date versions but not the most stable and can contain breaking changes. Only use them if you want to work with the latest development version of Orchard Core, e.g. to try out a fix for a bug you reported.
!!! warning
- We do not suggest you to use the dev packages in production.
+ We do not suggest you use the preview packages in production. Preview packages are not kept forever, and there's no guarantee on how long a given preview package will be available. (You can assume something like 1-1.5 months, but then again, there's no guarantee.)
## Adding Orchard Core preview Feed to Visual Studio
From 8fba42a18c08fa1f59aabae1f3b3867fcad896d2 Mon Sep 17 00:00:00 2001
From: Mike Alhayek
Date: Thu, 28 Mar 2024 15:20:21 -0700
Subject: [PATCH 18/24] Fix HTML style for ThemeEntry (#15609)
---
.../Drivers/ThemeEntryDisplayDriver.cs | 4 +--
...hemeEntry-Descriptions.SummaryAdmin.cshtml | 9 +++++--
.../Views/ThemeEntry.SummaryAdmin.cshtml | 26 +++++++++----------
3 files changed, 21 insertions(+), 18 deletions(-)
diff --git a/src/OrchardCore.Modules/OrchardCore.Themes/Drivers/ThemeEntryDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Themes/Drivers/ThemeEntryDisplayDriver.cs
index a8ba0321bf6..e7e4b44e6a9 100644
--- a/src/OrchardCore.Modules/OrchardCore.Themes/Drivers/ThemeEntryDisplayDriver.cs
+++ b/src/OrchardCore.Modules/OrchardCore.Themes/Drivers/ThemeEntryDisplayDriver.cs
@@ -15,11 +15,11 @@ public override IDisplayResult Display(ThemeEntry model)
View("ThemeEntry_SummaryAdmin__Title", model).Location("SummaryAdmin", "Header:5"),
View("ThemeEntry_SummaryAdmin__Descriptions", model).Location("SummaryAdmin", "Content:5"),
View("ThemeEntry_SummaryAdmin__Attributes", model).Location("SummaryAdmin", "Tags:5"),
- };
+ };
if (model.IsCurrent)
{
- results.Add(View("ThemeEntry_SummaryAdmin__Current", model).Location("SummaryAdmin", "FooterBelow:5"));
+ results.Add(View("ThemeEntry_SummaryAdmin__Current", model).Location("SummaryAdmin", "FooterStart:5"));
}
else
{
diff --git a/src/OrchardCore.Modules/OrchardCore.Themes/Views/Items/ThemeEntry-Descriptions.SummaryAdmin.cshtml b/src/OrchardCore.Modules/OrchardCore.Themes/Views/Items/ThemeEntry-Descriptions.SummaryAdmin.cshtml
index 04d7bfaa8aa..eacd1865ac2 100644
--- a/src/OrchardCore.Modules/OrchardCore.Themes/Views/Items/ThemeEntry-Descriptions.SummaryAdmin.cshtml
+++ b/src/OrchardCore.Modules/OrchardCore.Themes/Views/Items/ThemeEntry-Descriptions.SummaryAdmin.cshtml
@@ -3,6 +3,11 @@
@model ShapeViewModel
-
+@if (string.IsNullOrEmpty(Model.Value.Extension.Manifest.Description))
+{
+ return;
+}
+
+
@Model.Value.Extension.Manifest.Description
-
+
diff --git a/src/OrchardCore.Modules/OrchardCore.Themes/Views/ThemeEntry.SummaryAdmin.cshtml b/src/OrchardCore.Modules/OrchardCore.Themes/Views/ThemeEntry.SummaryAdmin.cshtml
index 393ec3f68e3..ef68fb3cfc3 100644
--- a/src/OrchardCore.Modules/OrchardCore.Themes/Views/ThemeEntry.SummaryAdmin.cshtml
+++ b/src/OrchardCore.Modules/OrchardCore.Themes/Views/ThemeEntry.SummaryAdmin.cshtml
@@ -14,19 +14,17 @@
@if (Model.Content != null || Model.Attributes != null)
{
-
- @if (Model.Content != null)
- {
- @await DisplayAsync(Model.Content)
- }
+ @if (Model.Content != null)
+ {
+ @await DisplayAsync(Model.Content)
+ }
- @if (Model.Tags != null)
- {
-
- @await DisplayAsync(Model.Tags)
-
- }
-
+ @if (Model.Tags != null)
+ {
+
+ @await DisplayAsync(Model.Tags)
+
+ }
}
@@ -39,13 +37,13 @@
{
-
+
@if (Model.FooterStart != null)
{
@await DisplayAsync(Model.FooterStart)
}
-
+
@if (Model.FooterEnd != null)
{
@await DisplayAsync(Model.FooterEnd)
From 42a2e0a85f0ff009340aafe7b2944d944f4d10ef Mon Sep 17 00:00:00 2001
From: Mike Alhayek
Date: Thu, 28 Mar 2024 17:49:12 -0700
Subject: [PATCH 19/24] Do not convert IShape to dynamic (#15622)
---
.../Controllers/NodeController.cs | 8 +++---
.../Views/MenuItem.TreeSummary.cshtml | 8 +++---
.../Views/Node/List.cshtml | 8 +++---
.../DefaultContentDefinitionDisplayManager.cs | 24 +++++++++---------
.../Views/Admin/EditField.cshtml | 8 +++---
.../Views/Admin/EditTypePart.cshtml | 8 +++---
.../Controllers/AdminController.cs | 6 ++---
...ontentsAdminList.Fields.BulkActions.cshtml | 7 ++++--
.../TestContentElementDisplayDriver.cs | 3 ++-
.../Views/Home/DisplayShape.cshtml | 2 +-
.../Controllers/DeploymentPlanController.cs | 8 +++---
.../Controllers/StepController.cs | 4 +--
.../Controllers/AdminController.cs | 2 +-
.../Controllers/AdminController.cs | 10 ++++----
.../Controllers/AdminController.cs | 24 +++++++++---------
.../Views/MenuItem.Admin.cshtml | 7 +++---
.../Views/MenuPart.Edit.cshtml | 14 +++++------
.../ConditionGroup.Fields.Summary.cshtml | 5 ++--
.../Views/Admin/Create.cshtml | 4 +--
.../Views/Admin/Edit.cshtml | 4 +--
.../Controllers/AdminController.cs | 15 +++++------
.../Controllers/SourceController.cs | 4 +--
.../Controllers/AdminController.cs | 24 +++++++++---------
.../Views/Content.TermAdmin.cshtml | 6 ++---
.../Views/TaxonomyPart.Edit.cshtml | 6 ++---
.../Controllers/AdminController.cs | 6 ++---
.../UsersAdminList.Fields.BulkActions.cshtml | 8 ++++--
.../OrchardCore.Widgets/ContentCardShapes.cs | 17 +++++++------
.../Views/ContentCard.cshtml | 15 ++++++-----
.../Controllers/WorkflowController.cs | 11 ++++----
.../Controllers/WorkflowTypeController.cs | 25 ++++++++-----------
.../Handlers/DisplayDriverBase.cs | 4 +--
.../Shapes/CoreShapes.cs | 8 +++---
.../TagHelpers/DateTimeTagHelper.cs | 6 ++---
.../TagHelpers/TimeSpanTagHelper.cs | 6 ++---
35 files changed, 165 insertions(+), 160 deletions(-)
diff --git a/src/OrchardCore.Modules/OrchardCore.AdminMenu/Controllers/NodeController.cs b/src/OrchardCore.Modules/OrchardCore.AdminMenu/Controllers/NodeController.cs
index dd3c9010614..56567072107 100644
--- a/src/OrchardCore.Modules/OrchardCore.AdminMenu/Controllers/NodeController.cs
+++ b/src/OrchardCore.Modules/OrchardCore.AdminMenu/Controllers/NodeController.cs
@@ -68,8 +68,8 @@ private async Task BuildDisplayViewModel(Models.AdminMen
foreach (var factory in _factories)
{
var treeNode = factory.Create();
- dynamic thumbnail = await _displayManager.BuildDisplayAsync(treeNode, _updateModelAccessor.ModelUpdater, "TreeThumbnail");
- thumbnail.TreeNode = treeNode;
+ var thumbnail = await _displayManager.BuildDisplayAsync(treeNode, _updateModelAccessor.ModelUpdater, "TreeThumbnail");
+ thumbnail.Properties["TreeNode"] = treeNode;
thumbnails.Add(factory.Name, thumbnail);
}
@@ -138,8 +138,8 @@ public async Task Create(AdminNodeEditViewModel model)
return NotFound();
}
- dynamic editor = await _displayManager.UpdateEditorAsync(treeNode, updater: _updateModelAccessor.ModelUpdater, isNew: true, "", "");
- editor.TreeNode = treeNode;
+ var editor = await _displayManager.UpdateEditorAsync(treeNode, updater: _updateModelAccessor.ModelUpdater, isNew: true, "", "");
+ editor.Properties["TreeNode"] = treeNode;
if (ModelState.IsValid)
{
diff --git a/src/OrchardCore.Modules/OrchardCore.AdminMenu/Views/MenuItem.TreeSummary.cshtml b/src/OrchardCore.Modules/OrchardCore.AdminMenu/Views/MenuItem.TreeSummary.cshtml
index 9c9915b5810..0cda87a7596 100644
--- a/src/OrchardCore.Modules/OrchardCore.AdminMenu/Views/MenuItem.TreeSummary.cshtml
+++ b/src/OrchardCore.Modules/OrchardCore.AdminMenu/Views/MenuItem.TreeSummary.cshtml
@@ -72,10 +72,10 @@
@foreach (var child in children)
{
- dynamic adminNodeShape = await MenuItemDisplayManager.BuildDisplayAsync(child, updater, "TreeSummary");
- adminNodeShape.AdminMenuId = Model.AdminMenuId;
- adminNodeShape.MenuItem = child;
- adminNodeShape.Index = Model.Index + "-" + index++;
+ var adminNodeShape = await MenuItemDisplayManager.BuildDisplayAsync(child, updater, "TreeSummary");
+ adminNodeShape.Properties["AdminMenuId"] = Model.AdminMenuId;
+ adminNodeShape.Properties["MenuItem"] = child;
+ adminNodeShape.Properties["Index"] = Model.Index + "-" + index++;
@await DisplayAsync(adminNodeShape);
}
}
diff --git a/src/OrchardCore.Modules/OrchardCore.AdminMenu/Views/Node/List.cshtml b/src/OrchardCore.Modules/OrchardCore.AdminMenu/Views/Node/List.cshtml
index d73f1b7481e..58efb647d2b 100644
--- a/src/OrchardCore.Modules/OrchardCore.AdminMenu/Views/Node/List.cshtml
+++ b/src/OrchardCore.Modules/OrchardCore.AdminMenu/Views/Node/List.cshtml
@@ -37,10 +37,10 @@
{
if (menuItem != null)
{
- dynamic adminNodeShape = await MenuItemDisplayManager.BuildDisplayAsync(menuItem, updater, "TreeSummary");
- adminNodeShape.AdminMenuId = Model.AdminMenu.Id;
- adminNodeShape.MenuItem = menuItem;
- adminNodeShape.Index = index++;
+ var adminNodeShape = await MenuItemDisplayManager.BuildDisplayAsync(menuItem, updater, "TreeSummary");
+ adminNodeShape.Properties["AdminMenuId"] = Model.AdminMenu.Id;
+ adminNodeShape.Properties["MenuItem"] = menuItem;
+ adminNodeShape.Properties["Index"] = index++;
@await DisplayAsync(adminNodeShape)
}
diff --git a/src/OrchardCore.Modules/OrchardCore.ContentTypes/Editors/DefaultContentDefinitionDisplayManager.cs b/src/OrchardCore.Modules/OrchardCore.ContentTypes/Editors/DefaultContentDefinitionDisplayManager.cs
index a4a02a639d6..680ffbe3a6b 100644
--- a/src/OrchardCore.Modules/OrchardCore.ContentTypes/Editors/DefaultContentDefinitionDisplayManager.cs
+++ b/src/OrchardCore.Modules/OrchardCore.ContentTypes/Editors/DefaultContentDefinitionDisplayManager.cs
@@ -44,8 +44,8 @@ public async Task BuildTypeEditorAsync(ContentTypeDefinition contentTyp
{
ArgumentNullException.ThrowIfNull(contentTypeDefinition);
- dynamic contentTypeDefinitionShape = await CreateContentShapeAsync("ContentTypeDefinition_Edit");
- contentTypeDefinitionShape.ContentTypeDefinition = contentTypeDefinition;
+ var contentTypeDefinitionShape = await CreateContentShapeAsync("ContentTypeDefinition_Edit");
+ contentTypeDefinitionShape.Properties["ContentTypeDefinition"] = contentTypeDefinition;
var typeContext = new BuildEditorContext(
contentTypeDefinitionShape,
@@ -68,8 +68,8 @@ public async Task UpdateTypeEditorAsync(ContentTypeDefinition contentTy
{
ArgumentNullException.ThrowIfNull(contentTypeDefinition);
- dynamic contentTypeDefinitionShape = await CreateContentShapeAsync("ContentTypeDefinition_Edit");
- contentTypeDefinitionShape.ContentTypeDefinition = contentTypeDefinition;
+ var contentTypeDefinitionShape = await CreateContentShapeAsync("ContentTypeDefinition_Edit");
+ contentTypeDefinitionShape.Properties["ContentTypeDefinition"] = contentTypeDefinition;
var layout = await _layoutAccessor.GetLayoutAsync();
@@ -149,8 +149,8 @@ public async Task BuildTypePartEditorAsync(ContentTypePartDefinition co
{
ArgumentNullException.ThrowIfNull(contentTypePartDefinition);
- dynamic typePartDefinitionShape = await CreateContentShapeAsync("ContentTypePartDefinition_Edit");
- typePartDefinitionShape.ContentPart = contentTypePartDefinition;
+ var typePartDefinitionShape = await CreateContentShapeAsync("ContentTypePartDefinition_Edit");
+ typePartDefinitionShape.Properties["ContentPart"] = contentTypePartDefinition;
var partContext = new BuildEditorContext(
typePartDefinitionShape,
@@ -173,14 +173,14 @@ public async Task UpdateTypePartEditorAsync(ContentTypePartDefinition c
{
ArgumentNullException.ThrowIfNull(contentTypePartDefinition);
- dynamic typePartDefinitionShape = await CreateContentShapeAsync("ContentTypePartDefinition_Edit");
+ var typePartDefinitionShape = await CreateContentShapeAsync("ContentTypePartDefinition_Edit");
var layout = await _layoutAccessor.GetLayoutAsync();
await _contentDefinitionManager.AlterTypeDefinitionAsync(contentTypePartDefinition.ContentTypeDefinition.Name, typeBuilder =>
{
return typeBuilder.WithPartAsync(contentTypePartDefinition.Name, async typePartBuilder =>
{
- typePartDefinitionShape.ContentPart = contentTypePartDefinition;
+ typePartDefinitionShape.Properties["ContentPart"] = contentTypePartDefinition;
var partContext = new UpdateTypePartEditorContext(
typePartBuilder,
@@ -205,8 +205,8 @@ public async Task BuildPartFieldEditorAsync(ContentPartFieldDefinition
{
ArgumentNullException.ThrowIfNull(contentPartFieldDefinition);
- dynamic partFieldDefinitionShape = await CreateContentShapeAsync("ContentPartFieldDefinition_Edit");
- partFieldDefinitionShape.ContentField = contentPartFieldDefinition;
+ var partFieldDefinitionShape = await CreateContentShapeAsync("ContentPartFieldDefinition_Edit");
+ partFieldDefinitionShape.Properties["ContentField"] = contentPartFieldDefinition;
var fieldContext = new BuildEditorContext(
partFieldDefinitionShape,
@@ -230,7 +230,7 @@ public async Task UpdatePartFieldEditorAsync(ContentPartFieldDefinition
ArgumentNullException.ThrowIfNull(contentPartFieldDefinition);
var contentPartDefinition = contentPartFieldDefinition.PartDefinition;
- dynamic partFieldDefinitionShape = await CreateContentShapeAsync("ContentPartFieldDefinition_Edit");
+ var partFieldDefinitionShape = await CreateContentShapeAsync("ContentPartFieldDefinition_Edit");
var layout = await _layoutAccessor.GetLayoutAsync();
@@ -238,7 +238,7 @@ await _contentDefinitionManager.AlterPartDefinitionAsync(contentPartDefinition.N
{
return partBuilder.WithFieldAsync(contentPartFieldDefinition.Name, async partFieldBuilder =>
{
- partFieldDefinitionShape.ContentField = contentPartFieldDefinition;
+ partFieldDefinitionShape.Properties["ContentField"] = contentPartFieldDefinition;
var fieldContext = new UpdatePartFieldEditorContext(
partFieldBuilder,
diff --git a/src/OrchardCore.Modules/OrchardCore.ContentTypes/Views/Admin/EditField.cshtml b/src/OrchardCore.Modules/OrchardCore.ContentTypes/Views/Admin/EditField.cshtml
index 101112342e1..1529f1f130f 100644
--- a/src/OrchardCore.Modules/OrchardCore.ContentTypes/Views/Admin/EditField.cshtml
+++ b/src/OrchardCore.Modules/OrchardCore.ContentTypes/Views/Admin/EditField.cshtml
@@ -56,8 +56,8 @@
@@ -75,8 +75,8 @@
diff --git a/src/OrchardCore.Modules/OrchardCore.ContentTypes/Views/Admin/EditTypePart.cshtml b/src/OrchardCore.Modules/OrchardCore.ContentTypes/Views/Admin/EditTypePart.cshtml
index a5b28618d77..4bf78e4df6e 100644
--- a/src/OrchardCore.Modules/OrchardCore.ContentTypes/Views/Admin/EditTypePart.cshtml
+++ b/src/OrchardCore.Modules/OrchardCore.ContentTypes/Views/Admin/EditTypePart.cshtml
@@ -61,8 +61,8 @@
@@ -80,8 +80,8 @@
diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Controllers/AdminController.cs
index 6a4796edce4..3521aba8fee 100644
--- a/src/OrchardCore.Modules/OrchardCore.Contents/Controllers/AdminController.cs
+++ b/src/OrchardCore.Modules/OrchardCore.Contents/Controllers/AdminController.cs
@@ -192,7 +192,7 @@ public async Task List(
? pagerOptions.Value.MaxPagedCount
: await query.CountAsync();
- dynamic pagerShape = await shapeFactory.PagerAsync(pager, itemsPerPage, options.RouteValues);
+ var pagerShape = await shapeFactory.PagerAsync(pager, itemsPerPage, options.RouteValues);
// Load items so that loading handlers are invoked.
var pageOfContentItems = await query.Skip(pager.GetStartIndex())
@@ -207,11 +207,11 @@ public async Task List(
}
// Populate options pager summary values.
- var startIndex = (pagerShape.Page - 1) * pagerShape.PageSize + 1;
+ var startIndex = (pager.Page - 1) * pager.PageSize + 1;
options.StartIndex = startIndex;
options.EndIndex = startIndex + contentItemSummaries.Count - 1;
options.ContentItemsCount = contentItemSummaries.Count;
- options.TotalItemCount = pagerShape.TotalItemCount;
+ options.TotalItemCount = itemsPerPage;
var header = await _contentOptionsDisplayManager.BuildEditorAsync(options, this, false, string.Empty, string.Empty);
diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Views/ContentsAdminList.Fields.BulkActions.cshtml b/src/OrchardCore.Modules/OrchardCore.Contents/Views/ContentsAdminList.Fields.BulkActions.cshtml
index 1d44728ac23..70c41b01cca 100644
--- a/src/OrchardCore.Modules/OrchardCore.Contents/Views/ContentsAdminList.Fields.BulkActions.cshtml
+++ b/src/OrchardCore.Modules/OrchardCore.Contents/Views/ContentsAdminList.Fields.BulkActions.cshtml
@@ -7,8 +7,11 @@
diff --git a/src/OrchardCore.Modules/OrchardCore.Demo/ContentElementDisplays/TestContentElementDisplayDriver.cs b/src/OrchardCore.Modules/OrchardCore.Demo/ContentElementDisplays/TestContentElementDisplayDriver.cs
index 0f2e1c7164b..f992d1da8af 100644
--- a/src/OrchardCore.Modules/OrchardCore.Demo/ContentElementDisplays/TestContentElementDisplayDriver.cs
+++ b/src/OrchardCore.Modules/OrchardCore.Demo/ContentElementDisplays/TestContentElementDisplayDriver.cs
@@ -32,7 +32,8 @@ public override IDisplayResult Display(ContentItem contentItem, IUpdateModel upd
async ctx => (await ctx.New.TestContentPartA()).Creating(_creating++),
shape =>
{
- ((dynamic)shape).Processing = _processing++;
+ shape.Properties["Processing"] = _processing++;
+
return Task.CompletedTask;
})
.Location("Detail", "Content")
diff --git a/src/OrchardCore.Modules/OrchardCore.Demo/Views/Home/DisplayShape.cshtml b/src/OrchardCore.Modules/OrchardCore.Demo/Views/Home/DisplayShape.cshtml
index ea0fa58748b..3ec26e02c9c 100644
--- a/src/OrchardCore.Modules/OrchardCore.Demo/Views/Home/DisplayShape.cshtml
+++ b/src/OrchardCore.Modules/OrchardCore.Demo/Views/Home/DisplayShape.cshtml
@@ -11,7 +11,7 @@
@await DisplayAsync(Model)
@*
- We can still call the DisplHelper with methods
+ We can still call the DisplayHelper with methods
*@
@await New.Bar()
diff --git a/src/OrchardCore.Modules/OrchardCore.Deployment/Controllers/DeploymentPlanController.cs b/src/OrchardCore.Modules/OrchardCore.Deployment/Controllers/DeploymentPlanController.cs
index 8aac781a8a8..73d0435b812 100644
--- a/src/OrchardCore.Modules/OrchardCore.Deployment/Controllers/DeploymentPlanController.cs
+++ b/src/OrchardCore.Modules/OrchardCore.Deployment/Controllers/DeploymentPlanController.cs
@@ -173,8 +173,8 @@ public async Task
Display(long id)
var items = new List();
foreach (var step in deploymentPlan.DeploymentSteps)
{
- dynamic item = await _displayManager.BuildDisplayAsync(step, _updateModelAccessor.ModelUpdater, "Summary");
- item.DeploymentStep = step;
+ var item = await _displayManager.BuildDisplayAsync(step, _updateModelAccessor.ModelUpdater, "Summary");
+ item.Properties["DeploymentStep"] = step;
items.Add(item);
}
@@ -182,8 +182,8 @@ public async Task Display(long id)
foreach (var factory in _factories)
{
var step = factory.Create();
- dynamic thumbnail = await _displayManager.BuildDisplayAsync(step, _updateModelAccessor.ModelUpdater, "Thumbnail");
- thumbnail.DeploymentStep = step;
+ var thumbnail = await _displayManager.BuildDisplayAsync(step, _updateModelAccessor.ModelUpdater, "Thumbnail");
+ thumbnail.Properties["DeploymentStep"] = step;
thumbnails.Add(factory.Name, thumbnail);
}
diff --git a/src/OrchardCore.Modules/OrchardCore.Deployment/Controllers/StepController.cs b/src/OrchardCore.Modules/OrchardCore.Deployment/Controllers/StepController.cs
index ff2167b0e73..1818f16fbd4 100644
--- a/src/OrchardCore.Modules/OrchardCore.Deployment/Controllers/StepController.cs
+++ b/src/OrchardCore.Modules/OrchardCore.Deployment/Controllers/StepController.cs
@@ -104,8 +104,8 @@ public async Task Create(EditDeploymentPlanStepViewModel model)
return NotFound();
}
- dynamic editor = await _displayManager.UpdateEditorAsync(step, updater: _updateModelAccessor.ModelUpdater, isNew: true, "", "");
- editor.DeploymentStep = step;
+ var editor = await _displayManager.UpdateEditorAsync(step, updater: _updateModelAccessor.ModelUpdater, isNew: true, string.Empty, string.Empty);
+ editor.Properties["DeploymentStep"] = step;
if (ModelState.IsValid)
{
diff --git a/src/OrchardCore.Modules/OrchardCore.Flows/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Flows/Controllers/AdminController.cs
index 1f09fda5cc8..db2c0cd9e69 100644
--- a/src/OrchardCore.Modules/OrchardCore.Flows/Controllers/AdminController.cs
+++ b/src/OrchardCore.Modules/OrchardCore.Flows/Controllers/AdminController.cs
@@ -67,7 +67,7 @@ public async Task BuildEditor(string id, string prefix, string pr
}
// Create a Card Shape
- dynamic contentCard = await _shapeFactory.New.ContentCard(
+ var contentCard = await _shapeFactory.New.ContentCard(
// Updater is the controller for AJAX Requests
Updater: _updateModelAccessor.ModelUpdater,
// Shape Specific
diff --git a/src/OrchardCore.Modules/OrchardCore.Layers/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Layers/Controllers/AdminController.cs
index c93048e9855..81e53934b67 100644
--- a/src/OrchardCore.Modules/OrchardCore.Layers/Controllers/AdminController.cs
+++ b/src/OrchardCore.Modules/OrchardCore.Layers/Controllers/AdminController.cs
@@ -198,16 +198,16 @@ public async Task Edit(string name)
return NotFound();
}
- dynamic rule = await _ruleDisplayManager.BuildDisplayAsync(layer.LayerRule, _updateModelAccessor.ModelUpdater, "Summary");
- rule.ConditionId = layer.LayerRule.ConditionId;
+ var rule = await _ruleDisplayManager.BuildDisplayAsync(layer.LayerRule, _updateModelAccessor.ModelUpdater, "Summary");
+ rule.Properties["ConditionId"] = layer.LayerRule.ConditionId;
var thumbnails = new Dictionary();
foreach (var factory in _conditionFactories)
{
var condition = factory.Create();
- dynamic thumbnail = await _conditionDisplayManager.BuildDisplayAsync(condition, _updateModelAccessor.ModelUpdater, "Thumbnail");
- thumbnail.Condition = condition;
- thumbnail.TargetUrl = Url.ActionLink("Create", "LayerRule", new { name, type = factory.Name });
+ var thumbnail = await _conditionDisplayManager.BuildDisplayAsync(condition, _updateModelAccessor.ModelUpdater, "Thumbnail");
+ thumbnail.Properties["Condition"] = condition;
+ thumbnail.Properties["TargetUrl"] = Url.ActionLink("Create", "LayerRule", new { name, type = factory.Name });
thumbnails.Add(factory.Name, thumbnail);
}
diff --git a/src/OrchardCore.Modules/OrchardCore.Menu/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Menu/Controllers/AdminController.cs
index 563bbea837e..a624d60a69a 100644
--- a/src/OrchardCore.Modules/OrchardCore.Menu/Controllers/AdminController.cs
+++ b/src/OrchardCore.Modules/OrchardCore.Menu/Controllers/AdminController.cs
@@ -63,10 +63,10 @@ public async Task Create(string id, string menuContentItemId, str
var contentItem = await _contentManager.NewAsync(id);
- dynamic model = await _contentItemDisplayManager.BuildEditorAsync(contentItem, _updateModelAccessor.ModelUpdater, true);
+ var model = await _contentItemDisplayManager.BuildEditorAsync(contentItem, _updateModelAccessor.ModelUpdater, true);
- model.MenuContentItemId = menuContentItemId;
- model.MenuItemId = menuItemId;
+ model.Properties["MenuContentItemId"] = menuContentItemId;
+ model.Properties["MenuItemId"] = menuItemId;
return View(model);
}
@@ -100,12 +100,12 @@ public async Task CreatePost(string id, string menuContentItemId,
var contentItem = await _contentManager.NewAsync(id);
- dynamic model = await _contentItemDisplayManager.UpdateEditorAsync(contentItem, _updateModelAccessor.ModelUpdater, true);
+ var model = await _contentItemDisplayManager.UpdateEditorAsync(contentItem, _updateModelAccessor.ModelUpdater, true);
if (!ModelState.IsValid)
{
- model.MenuContentItemId = menuContentItemId;
- model.MenuItemId = menuItemId;
+ model.Properties["MenuContentItemId"] = menuContentItemId;
+ model.Properties["MenuItemId"] = menuItemId;
return View(model);
}
@@ -169,10 +169,10 @@ public async Task Edit(string menuContentItemId, string menuItemI
var contentItem = menuItem.ToObject();
- dynamic model = await _contentItemDisplayManager.BuildEditorAsync(contentItem, _updateModelAccessor.ModelUpdater, false);
+ var model = await _contentItemDisplayManager.BuildEditorAsync(contentItem, _updateModelAccessor.ModelUpdater, false);
- model.MenuContentItemId = menuContentItemId;
- model.MenuItemId = menuItemId;
+ model.Properties["MenuContentItemId"] = menuContentItemId;
+ model.Properties["MenuItemId"] = menuItemId;
return View(model);
}
@@ -220,12 +220,12 @@ public async Task EditPost(string menuContentItemId, string menuI
contentItem.Merge(existing);
- dynamic model = await _contentItemDisplayManager.UpdateEditorAsync(contentItem, _updateModelAccessor.ModelUpdater, false);
+ var model = await _contentItemDisplayManager.UpdateEditorAsync(contentItem, _updateModelAccessor.ModelUpdater, false);
if (!ModelState.IsValid)
{
- model.MenuContentItemId = menuContentItemId;
- model.MenuItemId = menuItemId;
+ model.Properties["MenuContentItemId"] = menuContentItemId;
+ model.Properties["MenuItemId"] = menuItemId;
return View(model);
}
diff --git a/src/OrchardCore.Modules/OrchardCore.Menu/Views/MenuItem.Admin.cshtml b/src/OrchardCore.Modules/OrchardCore.Menu/Views/MenuItem.Admin.cshtml
index ec07ec5f803..6b1ff3a358a 100644
--- a/src/OrchardCore.Modules/OrchardCore.Menu/Views/MenuItem.Admin.cshtml
+++ b/src/OrchardCore.Modules/OrchardCore.Menu/Views/MenuItem.Admin.cshtml
@@ -56,10 +56,9 @@
diff --git a/src/OrchardCore.Modules/OrchardCore.Menu/Views/MenuPart.Edit.cshtml b/src/OrchardCore.Modules/OrchardCore.Menu/Views/MenuPart.Edit.cshtml
index a9a91f4a3b4..3a62d3ad3fe 100644
--- a/src/OrchardCore.Modules/OrchardCore.Menu/Views/MenuPart.Edit.cshtml
+++ b/src/OrchardCore.Modules/OrchardCore.Menu/Views/MenuPart.Edit.cshtml
@@ -37,9 +37,9 @@
{
if (Model.MenuItemContentTypes.Any(c => c.Name == menuItem.ContentType))
{
- dynamic menuItemShape = await ContentItemDisplayManager.BuildDisplayAsync(menuItem, updater, "Admin");
- menuItemShape.MenuPart = Model.MenuPart;
- menuItemShape.Index = index++;
+ var menuItemShape = await ContentItemDisplayManager.BuildDisplayAsync(menuItem, updater, "Admin");
+ menuItemShape.Properties["MenuPart"] = Model.MenuPart;
+ menuItemShape.Properties["Index"] = index++;
@await DisplayAsync(menuItemShape)
}
@@ -62,10 +62,10 @@
@foreach (var type in Model.MenuItemContentTypes)
{
var menuItem = await ContentManager.NewAsync(type.Name);
- dynamic thumbnail = await ContentItemDisplayManager.BuildDisplayAsync(menuItem, updater, "Thumbnail");
- thumbnail.MenuItemType = type.Name;
- thumbnail.MenuItemTypeDisplayName = type.DisplayName;
- thumbnail.MenuContentItemId = Model.MenuPart.ContentItem.ContentItemId;
+ var thumbnail = await ContentItemDisplayManager.BuildDisplayAsync(menuItem, updater, "Thumbnail");
+ thumbnail.Properties["MenuItemType"] = type.Name;
+ thumbnail.Properties["MenuItemTypeDisplayName"] = type.DisplayName;
+ thumbnail.Properties["MenuContentItemId"] = Model.MenuPart.ContentItem.ContentItemId;
@await DisplayAsync(thumbnail)
diff --git a/src/OrchardCore.Modules/OrchardCore.Rules/Views/Items/ConditionGroup.Fields.Summary.cshtml b/src/OrchardCore.Modules/OrchardCore.Rules/Views/Items/ConditionGroup.Fields.Summary.cshtml
index 68e3615aa6f..5411c4849ce 100644
--- a/src/OrchardCore.Modules/OrchardCore.Rules/Views/Items/ConditionGroup.Fields.Summary.cshtml
+++ b/src/OrchardCore.Modules/OrchardCore.Rules/Views/Items/ConditionGroup.Fields.Summary.cshtml
@@ -11,8 +11,9 @@
@foreach (var entry in Model.Entries)
{
- dynamic summary = await DisplayManager.BuildDisplayAsync(entry.Condition, null, "Summary");
- summary.Condition = entry.Condition;
+ var summary = await DisplayManager.BuildDisplayAsync(entry.Condition, null, "Summary");
+ summary.Properties["Condition"] = entry.Condition;
+
-
@await DisplayAsync(summary)
diff --git a/src/OrchardCore.Modules/OrchardCore.Shortcodes/Views/Admin/Create.cshtml b/src/OrchardCore.Modules/OrchardCore.Shortcodes/Views/Admin/Create.cshtml
index e937722f0e9..9b915d4acac 100644
--- a/src/OrchardCore.Modules/OrchardCore.Shortcodes/Views/Admin/Create.cshtml
+++ b/src/OrchardCore.Modules/OrchardCore.Shortcodes/Views/Admin/Create.cshtml
@@ -96,8 +96,8 @@
@{
var descriptor = new ShortcodeDescriptor();
- dynamic shape = await ShortcodeDescriptorDisplayManager.BuildDisplayAsync(descriptor, null, "SummaryAdmin");
- shape.Actions = null;
+ var shape = await ShortcodeDescriptorDisplayManager.BuildDisplayAsync(descriptor, null, "SummaryAdmin");
+ shape.Properties["Actions"] = null;
@await DisplayAsync(shape)
}
diff --git a/src/OrchardCore.Modules/OrchardCore.Shortcodes/Views/Admin/Edit.cshtml b/src/OrchardCore.Modules/OrchardCore.Shortcodes/Views/Admin/Edit.cshtml
index 3e357b8dd8a..6f8268262ca 100644
--- a/src/OrchardCore.Modules/OrchardCore.Shortcodes/Views/Admin/Edit.cshtml
+++ b/src/OrchardCore.Modules/OrchardCore.Shortcodes/Views/Admin/Edit.cshtml
@@ -105,8 +105,8 @@
DefaultValue = Model.DefaultValue,
Usage = Model.Usage
};
- dynamic shape = await ShortcodeDescriptorDisplayManager.BuildDisplayAsync(descriptor, null, "SummaryAdmin");
- shape.Actions = null;
+ var shape = await ShortcodeDescriptorDisplayManager.BuildDisplayAsync(descriptor, null, "SummaryAdmin");
+ shape.Properties["Actions"] = null;
@await DisplayAsync(shape)
}
diff --git a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Controllers/AdminController.cs
index 9cef43df1bb..7f6fd000557 100644
--- a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Controllers/AdminController.cs
+++ b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Controllers/AdminController.cs
@@ -140,9 +140,9 @@ public async Task
Display(string sitemapId)
var items = new List();
foreach (var source in sitemap.SitemapSources)
{
- dynamic item = await _displayManager.BuildDisplayAsync(source, _updateModelAccessor.ModelUpdater, "SummaryAdmin");
- item.SitemapId = sitemap.SitemapId;
- item.SitemapSource = source;
+ var item = await _displayManager.BuildDisplayAsync(source, _updateModelAccessor.ModelUpdater, "SummaryAdmin");
+ item.Properties["SitemapId"] = sitemap.SitemapId;
+ item.Properties["SitemapSource"] = source;
items.Add(item);
}
@@ -150,10 +150,11 @@ public async Task Display(string sitemapId)
foreach (var factory in _sourceFactories)
{
var source = factory.Create();
- dynamic thumbnail = await _displayManager.BuildDisplayAsync(source, _updateModelAccessor.ModelUpdater, "Thumbnail");
- thumbnail.SitemapSource = source;
- thumbnail.SitemapSourceType = factory.Name;
- thumbnail.Sitemap = sitemap;
+ var thumbnail = await _displayManager.BuildDisplayAsync(source, _updateModelAccessor.ModelUpdater, "Thumbnail");
+ thumbnail.Properties["SitemapSource"] = source;
+ thumbnail.Properties["SitemapSourceType"] = factory.Name;
+ thumbnail.Properties["Sitemap"] = sitemap;
+
thumbnails.Add(factory.Name, thumbnail);
}
diff --git a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Controllers/SourceController.cs b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Controllers/SourceController.cs
index de98b278fe3..89140252c0b 100644
--- a/src/OrchardCore.Modules/OrchardCore.Sitemaps/Controllers/SourceController.cs
+++ b/src/OrchardCore.Modules/OrchardCore.Sitemaps/Controllers/SourceController.cs
@@ -107,8 +107,8 @@ public async Task Create(CreateSourceViewModel model)
return NotFound();
}
- dynamic editor = await _displayManager.UpdateEditorAsync(source, updater: _updateModelAccessor.ModelUpdater, isNew: true, "", "");
- editor.SitemapStep = source;
+ var editor = await _displayManager.UpdateEditorAsync(source, updater: _updateModelAccessor.ModelUpdater, isNew: true, "", "");
+ editor.Properties["SitemapStep"] = source;
if (ModelState.IsValid)
{
diff --git a/src/OrchardCore.Modules/OrchardCore.Taxonomies/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Taxonomies/Controllers/AdminController.cs
index 882b33e6350..feb5cda7f2c 100644
--- a/src/OrchardCore.Modules/OrchardCore.Taxonomies/Controllers/AdminController.cs
+++ b/src/OrchardCore.Modules/OrchardCore.Taxonomies/Controllers/AdminController.cs
@@ -72,10 +72,10 @@ public async Task Create(string id, string taxonomyContentItemId,
contentItem.Weld();
contentItem.Alter(t => t.TaxonomyContentItemId = taxonomyContentItemId);
- dynamic model = await _contentItemDisplayManager.BuildEditorAsync(contentItem, _updateModelAccessor.ModelUpdater, true);
+ var model = await _contentItemDisplayManager.BuildEditorAsync(contentItem, _updateModelAccessor.ModelUpdater, true);
- model.TaxonomyContentItemId = taxonomyContentItemId;
- model.TaxonomyItemId = taxonomyItemId;
+ model.Properties["TaxonomyContentItemId"] = taxonomyContentItemId;
+ model.Properties["TaxonomyItemId"] = taxonomyItemId;
return View(model);
}
@@ -121,12 +121,12 @@ public async Task CreatePost(string id, string taxonomyContentIte
contentItem.Weld();
contentItem.Alter(t => t.TaxonomyContentItemId = taxonomyContentItemId);
- dynamic model = await _contentItemDisplayManager.UpdateEditorAsync(contentItem, _updateModelAccessor.ModelUpdater, true);
+ var model = await _contentItemDisplayManager.UpdateEditorAsync(contentItem, _updateModelAccessor.ModelUpdater, true);
if (!ModelState.IsValid)
{
- model.TaxonomyContentItemId = taxonomyContentItemId;
- model.TaxonomyItemId = taxonomyItemId;
+ model.Properties["TaxonomyContentItemId"] = taxonomyContentItemId;
+ model.Properties["TaxonomyItemId"] = taxonomyItemId;
return View(model);
}
@@ -195,10 +195,10 @@ public async Task Edit(string taxonomyContentItemId, string taxon
contentItem.Weld();
contentItem.Alter(t => t.TaxonomyContentItemId = taxonomyContentItemId);
- dynamic model = await _contentItemDisplayManager.BuildEditorAsync(contentItem, _updateModelAccessor.ModelUpdater, false);
+ var model = await _contentItemDisplayManager.BuildEditorAsync(contentItem, _updateModelAccessor.ModelUpdater, false);
- model.TaxonomyContentItemId = taxonomyContentItemId;
- model.TaxonomyItemId = taxonomyItemId;
+ model.Properties["TaxonomyContentItemId"] = taxonomyContentItemId;
+ model.Properties["TaxonomyItemId"] = taxonomyItemId;
return View(model);
}
@@ -254,12 +254,12 @@ public async Task EditPost(string taxonomyContentItemId, string t
contentItem.Weld();
contentItem.Alter(t => t.TaxonomyContentItemId = taxonomyContentItemId);
- dynamic model = await _contentItemDisplayManager.UpdateEditorAsync(contentItem, _updateModelAccessor.ModelUpdater, false);
+ var model = await _contentItemDisplayManager.UpdateEditorAsync(contentItem, _updateModelAccessor.ModelUpdater, false);
if (!ModelState.IsValid)
{
- model.TaxonomyContentItemId = taxonomyContentItemId;
- model.TaxonomyItemId = taxonomyItemId;
+ model.Properties["TaxonomyContentItemId"] = taxonomyContentItemId;
+ model.Properties["TaxonomyItemId"] = taxonomyItemId;
return View(model);
}
diff --git a/src/OrchardCore.Modules/OrchardCore.Taxonomies/Views/Content.TermAdmin.cshtml b/src/OrchardCore.Modules/OrchardCore.Taxonomies/Views/Content.TermAdmin.cshtml
index fa6c90b4d0e..50c074329a1 100644
--- a/src/OrchardCore.Modules/OrchardCore.Taxonomies/Views/Content.TermAdmin.cshtml
+++ b/src/OrchardCore.Modules/OrchardCore.Taxonomies/Views/Content.TermAdmin.cshtml
@@ -54,9 +54,9 @@
@foreach (JsonObject termObject in termsArray)
{
var term = termObject.ToObject();
- dynamic termShape = await ContentItemDisplayManager.BuildDisplayAsync(term, updater, "TermAdmin");
- termShape.TaxonomyPart = Model.TaxonomyPart;
- termShape.Index = Model.Index + "-" + index++;
+ var termShape = await ContentItemDisplayManager.BuildDisplayAsync(term, updater, "TermAdmin");
+ termShape.Properties["TaxonomyPart"] = Model.TaxonomyPart;
+ termShape.Properties["Index"] = Model.Index + "-" + index++;
@await DisplayAsync(termShape)
}
diff --git a/src/OrchardCore.Modules/OrchardCore.Taxonomies/Views/TaxonomyPart.Edit.cshtml b/src/OrchardCore.Modules/OrchardCore.Taxonomies/Views/TaxonomyPart.Edit.cshtml
index 31c78e65b98..84f87e6670c 100644
--- a/src/OrchardCore.Modules/OrchardCore.Taxonomies/Views/TaxonomyPart.Edit.cshtml
+++ b/src/OrchardCore.Modules/OrchardCore.Taxonomies/Views/TaxonomyPart.Edit.cshtml
@@ -52,9 +52,9 @@
diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Controllers/AdminController.cs b/src/OrchardCore.Modules/OrchardCore.Users/Controllers/AdminController.cs
index 6cd8a633dea..f696343d4d4 100644
--- a/src/OrchardCore.Modules/OrchardCore.Users/Controllers/AdminController.cs
+++ b/src/OrchardCore.Modules/OrchardCore.Users/Controllers/AdminController.cs
@@ -121,7 +121,7 @@ public async Task Index([ModelBinder(BinderType = typeof(UserFilte
.Take(pager.PageSize)
.ListAsync();
- dynamic pagerShape = await _shapeFactory.PagerAsync(pager, count, options.RouteValues);
+ var pagerShape = await _shapeFactory.PagerAsync(pager, count, options.RouteValues);
var userEntries = new List();
@@ -189,11 +189,11 @@ .. roleNames.Select(roleName =>
];
// Populate options pager summary values.
- var startIndex = (pagerShape.Page - 1) * pagerShape.PageSize + 1;
+ var startIndex = (pager.Page - 1) * pager.PageSize + 1;
options.StartIndex = startIndex;
options.EndIndex = startIndex + userEntries.Count - 1;
options.UsersCount = userEntries.Count;
- options.TotalItemCount = pagerShape.TotalItemCount;
+ options.TotalItemCount = count;
var header = await _userOptionsDisplayManager.BuildEditorAsync(options, _updateModelAccessor.ModelUpdater, false, string.Empty, string.Empty);
diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Views/UsersAdminList.Fields.BulkActions.cshtml b/src/OrchardCore.Modules/OrchardCore.Users/Views/UsersAdminList.Fields.BulkActions.cshtml
index 5a839be9388..a3045f3a514 100644
--- a/src/OrchardCore.Modules/OrchardCore.Users/Views/UsersAdminList.Fields.BulkActions.cshtml
+++ b/src/OrchardCore.Modules/OrchardCore.Users/Views/UsersAdminList.Fields.BulkActions.cshtml
@@ -8,8 +8,12 @@
diff --git a/src/OrchardCore.Modules/OrchardCore.Widgets/ContentCardShapes.cs b/src/OrchardCore.Modules/OrchardCore.Widgets/ContentCardShapes.cs
index e52feb0c7dd..10bce64a4a1 100644
--- a/src/OrchardCore.Modules/OrchardCore.Widgets/ContentCardShapes.cs
+++ b/src/OrchardCore.Modules/OrchardCore.Widgets/ContentCardShapes.cs
@@ -1,4 +1,5 @@
using System.Threading.Tasks;
+using OrchardCore.DisplayManagement;
using OrchardCore.DisplayManagement.Descriptors;
namespace OrchardCore.Widgets
@@ -20,12 +21,12 @@ public override ValueTask DiscoverAsync(ShapeTableBuilder builder)
.OnDisplaying(context =>
{
// Defines Edit Alternates for the Content Item being edited.
- dynamic contentCardEditor = context.Shape;
- string collectionType = contentCardEditor.CollectionShapeType;
- string contentType = contentCardEditor.ContentTypeValue;
- string parentContentType = contentCardEditor.ParentContentType;
- string namedPart = contentCardEditor.CollectionPartName;
- if (contentCardEditor.BuildEditor == true)
+ var contentCardEditor = context.Shape;
+ var collectionType = contentCardEditor.GetProperty
("CollectionShapeType");
+ var contentType = contentCardEditor.GetProperty("ContentTypeValue");
+ var parentContentType = contentCardEditor.GetProperty("ParentContentType");
+ var namedPart = contentCardEditor.GetProperty("CollectionPartName");
+ if (contentCardEditor.TryGetProperty("BuildEditor", out var buildEditor) && buildEditor)
{
// Define edit card shape per collection type
// ContentCard_Edit__[CollectionType]
@@ -135,8 +136,8 @@ public override ValueTask DiscoverAsync(ShapeTableBuilder builder)
builder.Describe(ContentCardFieldsEdit)
.OnDisplaying(context =>
{
- dynamic contentCardEditorFields = context.Shape;
- var collectionType = contentCardEditorFields.CardShape.CollectionShapeType as string;
+ var contentCardEditorFields = context.Shape;
+ var collectionType = contentCardEditorFields.GetProperty("CardShape").GetProperty("CollectionShapeType");
contentCardEditorFields.Metadata.Alternates.Add($"{collectionType}_Fields_Edit");
});
diff --git a/src/OrchardCore.Modules/OrchardCore.Widgets/Views/ContentCard.cshtml b/src/OrchardCore.Modules/OrchardCore.Widgets/Views/ContentCard.cshtml
index 8f9eff72c52..2165e478e65 100644
--- a/src/OrchardCore.Modules/OrchardCore.Widgets/Views/ContentCard.cshtml
+++ b/src/OrchardCore.Modules/OrchardCore.Widgets/Views/ContentCard.cshtml
@@ -4,7 +4,7 @@
@{
var contentDefinitions = await ContentDefinitionManager.ListTypeDefinitionsAsync();
//Set Model (Current Shape) as Child content of Outer Frame, Later this Model is used to render other shapes
- dynamic contentCardFrame = await New.ContentCard_Frame();
+ var contentCardFrame = await New.ContentCard_Frame();
var contentItem = Model.ContentItem;
Model.ContentTypeValue = contentItem.ContentType;
@@ -25,15 +25,15 @@
//Build Editor for Content Item
// AJAX request is new request and will not have CollectionShape.
var isNew = Model.CollectionShape == null ? true : false;
- dynamic contentItemEditor = await ContentItemDisplayManager.BuildEditorAsync(contentItem, updater, isNew, "", Model.PrefixValue);
+ var contentItemEditor = await ContentItemDisplayManager.BuildEditorAsync(contentItem, updater, isNew, string.Empty, Model.PrefixValue);
//We don't show Actions and Side bar the parent editor has its own buttons.
- contentItemEditor.Actions = null;
- contentItemEditor.Sidebar = null;
+ contentItemEditor.Properties["Actions"] = null;
+ contentItemEditor.Properties["Sidebar"] = null;
//Move Content Footer to Card Footer, if any
- Model.Footer = contentItemEditor.Footer;
- contentItemEditor.Footer = null;
+ Model.Footer = contentItemEditor.GetProperty("Footer");
+ contentItemEditor.Properties["Footer"] = null;
Model.ContentEditor = contentItemEditor;
@@ -48,8 +48,7 @@
else
{
//Just Create Preview
- dynamic contentDisplay = await ContentItemDisplayManager.BuildDisplayAsync(contentItem, updater, Model.DisplayType ?? "Detail");
- Model.ContentPreview = contentDisplay;
+ Model.ContentPreview = await ContentItemDisplayManager.BuildDisplayAsync(contentItem, updater, Model.DisplayType ?? "Detail");
//Hide the Delete
Model.CanDelete = false;
diff --git a/src/OrchardCore.Modules/OrchardCore.Workflows/Controllers/WorkflowController.cs b/src/OrchardCore.Modules/OrchardCore.Workflows/Controllers/WorkflowController.cs
index bdc6037d46d..71409532e9b 100644
--- a/src/OrchardCore.Modules/OrchardCore.Workflows/Controllers/WorkflowController.cs
+++ b/src/OrchardCore.Modules/OrchardCore.Workflows/Controllers/WorkflowController.cs
@@ -332,12 +332,13 @@ public async Task BulkEdit(long workflowTypeId, WorkflowIndexOpti
private async Task BuildActivityDisplayAsync(ActivityContext activityContext, long workflowTypeId, bool isBlocking, string displayType)
{
- dynamic activityShape = await _activityDisplayManager.BuildDisplayAsync(activityContext.Activity, _updateModelAccessor.ModelUpdater, displayType);
+ var activityShape = await _activityDisplayManager.BuildDisplayAsync(activityContext.Activity, _updateModelAccessor.ModelUpdater, displayType);
activityShape.Metadata.Type = $"Activity_{displayType}ReadOnly";
- activityShape.Activity = activityContext.Activity;
- activityShape.ActivityRecord = activityContext.ActivityRecord;
- activityShape.WorkflowTypeId = workflowTypeId;
- activityShape.IsBlocking = isBlocking;
+ activityShape.Properties["Activity"] = activityContext.Activity;
+ activityShape.Properties["ActivityRecord"] = activityContext.ActivityRecord;
+ activityShape.Properties["WorkflowTypeId"] = workflowTypeId;
+ activityShape.Properties["IsBlocking"] = isBlocking;
+
return activityShape;
}
}
diff --git a/src/OrchardCore.Modules/OrchardCore.Workflows/Controllers/WorkflowTypeController.cs b/src/OrchardCore.Modules/OrchardCore.Workflows/Controllers/WorkflowTypeController.cs
index 1c6096d3ede..c6258ce73b5 100644
--- a/src/OrchardCore.Modules/OrchardCore.Workflows/Controllers/WorkflowTypeController.cs
+++ b/src/OrchardCore.Modules/OrchardCore.Workflows/Controllers/WorkflowTypeController.cs
@@ -515,14 +515,12 @@ public async Task Delete(long id)
private async Task BuildActivityDisplay(IActivity activity, int index, long workflowTypeId,
string localId, string displayType)
{
- dynamic activityShape =
- await _activityDisplayManager.BuildDisplayAsync(activity, _updateModelAccessor.ModelUpdater,
- displayType);
+ var activityShape = await _activityDisplayManager.BuildDisplayAsync(activity, _updateModelAccessor.ModelUpdater, displayType);
activityShape.Metadata.Type = $"Activity_{displayType}";
- activityShape.Activity = activity;
- activityShape.WorkflowTypeId = workflowTypeId;
- activityShape.Index = index;
- activityShape.ReturnUrl = Url.Action(nameof(Edit), new
+ activityShape.Properties["Activity"] = activity;
+ activityShape.Properties["WorkflowTypeId"] = workflowTypeId;
+ activityShape.Properties["Index"] = index;
+ activityShape.Properties["ReturnUrl"] = Url.Action(nameof(Edit), new
{
id = workflowTypeId,
localId,
@@ -534,14 +532,13 @@ await _activityDisplayManager.BuildDisplayAsync(activity, _updateModelAccessor.M
private async Task BuildActivityDisplay(ActivityContext activityContext, int index, long workflowTypeId,
string localId, string displayType)
{
- dynamic activityShape = await _activityDisplayManager.BuildDisplayAsync(activityContext.Activity,
- _updateModelAccessor.ModelUpdater, displayType);
+ var activityShape = await _activityDisplayManager.BuildDisplayAsync(activityContext.Activity, _updateModelAccessor.ModelUpdater, displayType);
activityShape.Metadata.Type = $"Activity_{displayType}";
- activityShape.Activity = activityContext.Activity;
- activityShape.ActivityRecord = activityContext.ActivityRecord;
- activityShape.WorkflowTypeId = workflowTypeId;
- activityShape.Index = index;
- activityShape.ReturnUrl = Url.Action(nameof(Edit), new
+ activityShape.Properties["Activity"] = activityContext.Activity;
+ activityShape.Properties["ActivityRecord"] = activityContext.ActivityRecord;
+ activityShape.Properties["WorkflowTypeId"] = workflowTypeId;
+ activityShape.Properties["Index"] = index;
+ activityShape.Properties["ReturnUrl"] = Url.Action(nameof(Edit), new
{
id = workflowTypeId,
localId,
diff --git a/src/OrchardCore/OrchardCore.DisplayManagement/Handlers/DisplayDriverBase.cs b/src/OrchardCore/OrchardCore.DisplayManagement/Handlers/DisplayDriverBase.cs
index 053ba72d1cf..0339d273d59 100644
--- a/src/OrchardCore/OrchardCore.DisplayManagement/Handlers/DisplayDriverBase.cs
+++ b/src/OrchardCore/OrchardCore.DisplayManagement/Handlers/DisplayDriverBase.cs
@@ -71,7 +71,7 @@ public ShapeResult Dynamic(string shapeType, Func initializeAsync
return Factory(shapeType,
async ctx =>
{
- dynamic shape = await ctx.ShapeFactory.CreateAsync(shapeType);
+ var shape = await ctx.ShapeFactory.CreateAsync(shapeType);
await initializeAsync(shape);
return shape;
});
@@ -85,7 +85,7 @@ public ShapeResult Dynamic(string shapeType, Action initialize)
return Factory(shapeType,
async ctx =>
{
- dynamic shape = await ctx.ShapeFactory.CreateAsync(shapeType);
+ var shape = await ctx.ShapeFactory.CreateAsync(shapeType);
initialize(shape);
return shape;
});
diff --git a/src/OrchardCore/OrchardCore.DisplayManagement/Shapes/CoreShapes.cs b/src/OrchardCore/OrchardCore.DisplayManagement/Shapes/CoreShapes.cs
index 070b1594679..c68ec5e1c05 100644
--- a/src/OrchardCore/OrchardCore.DisplayManagement/Shapes/CoreShapes.cs
+++ b/src/OrchardCore/OrchardCore.DisplayManagement/Shapes/CoreShapes.cs
@@ -126,12 +126,10 @@ public override ValueTask DiscoverAsync(ShapeTableBuilder builder)
builder.Describe("List")
.OnCreated(created =>
{
- dynamic list = created.Shape;
-
- // Intializes the common properties of a List shape
+ // Initializes the common properties of a List shape
// such that views can safely add values to them.
- list.ItemClasses = new List();
- list.ItemAttributes = new Dictionary();
+ created.Shape.Properties["ItemClasses"] = new List();
+ created.Shape.Properties["ItemAttributes"] = new Dictionary();
});
return ValueTask.CompletedTask;
diff --git a/src/OrchardCore/OrchardCore.DisplayManagement/TagHelpers/DateTimeTagHelper.cs b/src/OrchardCore/OrchardCore.DisplayManagement/TagHelpers/DateTimeTagHelper.cs
index 9a585bebe92..a5c71e683d0 100644
--- a/src/OrchardCore/OrchardCore.DisplayManagement/TagHelpers/DateTimeTagHelper.cs
+++ b/src/OrchardCore/OrchardCore.DisplayManagement/TagHelpers/DateTimeTagHelper.cs
@@ -28,9 +28,9 @@ public DateTimeTagHelper(IShapeFactory shapeFactory, IDisplayHelper displayHelpe
public async override Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
{
var shapeType = "DateTime";
- dynamic shape = await _shapeFactory.CreateAsync(shapeType);
- shape.Utc = Utc;
- shape.Format = Format;
+ var shape = await _shapeFactory.CreateAsync(shapeType);
+ shape.Properties["Utc"] = Utc;
+ shape.Properties["Format"] = Format;
output.Content.SetHtmlContent(await _displayHelper.ShapeExecuteAsync(shape));
diff --git a/src/OrchardCore/OrchardCore.DisplayManagement/TagHelpers/TimeSpanTagHelper.cs b/src/OrchardCore/OrchardCore.DisplayManagement/TagHelpers/TimeSpanTagHelper.cs
index aeecb9c99c9..186c30b167e 100644
--- a/src/OrchardCore/OrchardCore.DisplayManagement/TagHelpers/TimeSpanTagHelper.cs
+++ b/src/OrchardCore/OrchardCore.DisplayManagement/TagHelpers/TimeSpanTagHelper.cs
@@ -28,9 +28,9 @@ public TimeSpanTagHelper(IShapeFactory shapeFactory, IDisplayHelper displayHelpe
public async override Task ProcessAsync(TagHelperContext context, TagHelperOutput output)
{
var shapeType = "TimeSpan";
- dynamic shape = await _shapeFactory.CreateAsync(shapeType);
- shape.Utc = Utc;
- shape.Origin = Origin;
+ var shape = await _shapeFactory.CreateAsync(shapeType);
+ shape.Properties["Utc"] = Utc;
+ shape.Properties["Origin"] = Origin;
output.Content.SetHtmlContent(await _displayHelper.ShapeExecuteAsync(shape));
From 0fb5ce233424c64506e42d4983c99bac4c48142b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?S=C3=A9bastien=20Ros?=
Date: Fri, 29 Mar 2024 09:28:57 -0700
Subject: [PATCH 20/24] Remove unnecessary FrozenDictionary (#15623)
---
.../Models/PlacementsDocument.cs | 2 +-
.../Services/PlacementProvider.cs | 4 ++--
.../Services/PlacementsManager.cs | 13 +++++++------
3 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/src/OrchardCore.Modules/OrchardCore.Placements/Models/PlacementsDocument.cs b/src/OrchardCore.Modules/OrchardCore.Placements/Models/PlacementsDocument.cs
index 71d4582b836..5ceab7e13c9 100644
--- a/src/OrchardCore.Modules/OrchardCore.Placements/Models/PlacementsDocument.cs
+++ b/src/OrchardCore.Modules/OrchardCore.Placements/Models/PlacementsDocument.cs
@@ -7,6 +7,6 @@ namespace OrchardCore.Placements.Models
{
public class PlacementsDocument : Document
{
- public Dictionary Placements { get; set; } = new Dictionary(StringComparer.OrdinalIgnoreCase);
+ public Dictionary Placements { get; } = new Dictionary(StringComparer.OrdinalIgnoreCase);
}
}
diff --git a/src/OrchardCore.Modules/OrchardCore.Placements/Services/PlacementProvider.cs b/src/OrchardCore.Modules/OrchardCore.Placements/Services/PlacementProvider.cs
index 524aa5b121b..b39dd7ed118 100644
--- a/src/OrchardCore.Modules/OrchardCore.Placements/Services/PlacementProvider.cs
+++ b/src/OrchardCore.Modules/OrchardCore.Placements/Services/PlacementProvider.cs
@@ -30,11 +30,11 @@ public async Task BuildPlacementInfoResolverAsync(IBuild
public class PlacementInfoResolver : IPlacementInfoResolver
{
- private readonly IReadOnlyDictionary> _placements;
+ private readonly IReadOnlyDictionary _placements;
private readonly IEnumerable _placementNodeFilterProviders;
public PlacementInfoResolver(
- IReadOnlyDictionary> placements,
+ IReadOnlyDictionary placements,
IEnumerable placementNodeFilterProviders)
{
_placements = placements;
diff --git a/src/OrchardCore.Modules/OrchardCore.Placements/Services/PlacementsManager.cs b/src/OrchardCore.Modules/OrchardCore.Placements/Services/PlacementsManager.cs
index e9b1295e62d..ce9d47ff7d2 100644
--- a/src/OrchardCore.Modules/OrchardCore.Placements/Services/PlacementsManager.cs
+++ b/src/OrchardCore.Modules/OrchardCore.Placements/Services/PlacementsManager.cs
@@ -1,4 +1,3 @@
-using System.Collections.Frozen;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
@@ -6,21 +5,23 @@
namespace OrchardCore.Placements.Services
{
- public class PlacementsManager
+ public sealed class PlacementsManager
{
private readonly IPlacementStore _placementStore;
public PlacementsManager(IPlacementStore placementStore)
- => _placementStore = placementStore;
+ {
+ _placementStore = placementStore;
+ }
- public async Task>> ListShapePlacementsAsync()
+ public async Task> ListShapePlacementsAsync()
{
var document = await _placementStore.GetPlacementsAsync();
- return document.Placements.ToFrozenDictionary(kvp => kvp.Key, kvp => kvp.Value.AsEnumerable());
+ return document.Placements;
}
- public async Task> GetShapePlacementsAsync(string shapeType)
+ public async Task GetShapePlacementsAsync(string shapeType)
{
var document = await _placementStore.GetPlacementsAsync();
From 3197717842a4cbbe40b08edfd8eacfbab4ada08f Mon Sep 17 00:00:00 2001
From: Sebastien Ros
Date: Fri, 29 Mar 2024 11:33:54 -0700
Subject: [PATCH 21/24] Fix missing extension method in Razor view
---
.../OrchardCore.Widgets/Views/ContentCard.cshtml | 5 +++--
.../OrchardCore.DisplayManagement/IShape.cs | 10 ++++++----
.../Shapes/GroupShapes.cs | 4 ++--
.../OrchardCore.DisplayManagement/Views/ShapeResult.cs | 2 +-
4 files changed, 12 insertions(+), 9 deletions(-)
diff --git a/src/OrchardCore.Modules/OrchardCore.Widgets/Views/ContentCard.cshtml b/src/OrchardCore.Modules/OrchardCore.Widgets/Views/ContentCard.cshtml
index 2165e478e65..88b137e49e0 100644
--- a/src/OrchardCore.Modules/OrchardCore.Widgets/Views/ContentCard.cshtml
+++ b/src/OrchardCore.Modules/OrchardCore.Widgets/Views/ContentCard.cshtml
@@ -1,3 +1,4 @@
+@using OrchardCore.DisplayManagement
@inject OrchardCore.ContentManagement.Display.IContentItemDisplayManager ContentItemDisplayManager
@inject OrchardCore.ContentManagement.Metadata.IContentDefinitionManager ContentDefinitionManager
@@ -25,14 +26,14 @@
//Build Editor for Content Item
// AJAX request is new request and will not have CollectionShape.
var isNew = Model.CollectionShape == null ? true : false;
- var contentItemEditor = await ContentItemDisplayManager.BuildEditorAsync(contentItem, updater, isNew, string.Empty, Model.PrefixValue);
+ IShape contentItemEditor = await ContentItemDisplayManager.BuildEditorAsync(contentItem, updater, isNew, string.Empty, Model.PrefixValue);
//We don't show Actions and Side bar the parent editor has its own buttons.
contentItemEditor.Properties["Actions"] = null;
contentItemEditor.Properties["Sidebar"] = null;
//Move Content Footer to Card Footer, if any
- Model.Footer = contentItemEditor.GetProperty("Footer");
+ Model.Footer = contentItemEditor.GetPropertyOrDefault("Footer");
contentItemEditor.Properties["Footer"] = null;
Model.ContentEditor = contentItemEditor;
diff --git a/src/OrchardCore/OrchardCore.DisplayManagement/IShape.cs b/src/OrchardCore/OrchardCore.DisplayManagement/IShape.cs
index 33a8e9a7c06..95e5b737544 100644
--- a/src/OrchardCore/OrchardCore.DisplayManagement/IShape.cs
+++ b/src/OrchardCore/OrchardCore.DisplayManagement/IShape.cs
@@ -1,3 +1,4 @@
+using System;
using System.Collections.Generic;
using System.Text.Json.Nodes;
using System.Threading.Tasks;
@@ -43,17 +44,18 @@ public static bool TryGetProperty(this IShape shape, string key, out T value)
return false;
}
+ [Obsolete("Use GetPropertyOrDefault()) instead")]
public static object GetProperty(this IShape shape, string key)
{
- return GetProperty(shape, key, (object)null);
+ return shape.GetPropertyOrDefault