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