diff --git a/src/OrchardCore.Modules/OrchardCore.Admin/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Admin/AdminMenu.cs index cdf8270f5e8..5852e0e6713 100644 --- a/src/OrchardCore.Modules/OrchardCore.Admin/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Admin/AdminMenu.cs @@ -22,11 +22,14 @@ public AdminMenu(IStringLocalizer stringLocalizer) protected override ValueTask BuildAsync(NavigationBuilder builder) { - builder + if (NavigationHelper.UseLegacyFormat()) + { + builder .Add(S["Configuration"], configuration => configuration .Add(S["Settings"], settings => settings .Add(S["Admin"], S["Admin"].PrefixPosition(), admin => admin - .AddClass("admin").Id("admin") + .AddClass("admin") + .Id("admin") .Action("Index", "Admin", _routeValues) .Permission(PermissionsAdminSettings.ManageAdminSettings) .LocalNav() @@ -34,6 +37,19 @@ protected override ValueTask BuildAsync(NavigationBuilder builder) ) ); + return ValueTask.CompletedTask; + } + + builder + .Add(S["Settings"], settings => settings + .Add(S["Admin"], S["Admin"].PrefixPosition(), admin => admin + .AddClass("admin").Id("admin") + .Action("Index", "Admin", _routeValues) + .Permission(PermissionsAdminSettings.ManageAdminSettings) + .LocalNav() + ) + ); + return ValueTask.CompletedTask; } } diff --git a/src/OrchardCore.Modules/OrchardCore.Admin/Views/NavigationItemText-admin.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.Admin/Views/NavigationItemText-admin.Id.cshtml index d05005838d2..a0258b128b8 100644 --- a/src/OrchardCore.Modules/OrchardCore.Admin/Views/NavigationItemText-admin.Id.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Admin/Views/NavigationItemText-admin.Id.cshtml @@ -1,4 +1,15 @@ - - +@using OrchardCore.Navigation + +@if (NavigationHelper.UseLegacyFormat()) +{ + + + + @Model.Text + + return; +} + + -@T["Admin"] +@Model.Text diff --git a/src/OrchardCore.Modules/OrchardCore.AdminDashboard/Views/NavigationItemText-dashboard.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.AdminDashboard/Views/NavigationItemText-dashboard.Id.cshtml index efd5afd2447..4ad956d05f2 100644 --- a/src/OrchardCore.Modules/OrchardCore.AdminDashboard/Views/NavigationItemText-dashboard.Id.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.AdminDashboard/Views/NavigationItemText-dashboard.Id.cshtml @@ -1 +1,4 @@ -@T["Dashboard"] + + + +@Model.Text diff --git a/src/OrchardCore.Modules/OrchardCore.AdminMenu/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.AdminMenu/AdminMenu.cs index 9a60dc21942..d8f3a5fc332 100644 --- a/src/OrchardCore.Modules/OrchardCore.AdminMenu/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.AdminMenu/AdminMenu.cs @@ -20,15 +20,30 @@ public AdminMenu( protected override ValueTask BuildAsync(NavigationBuilder builder) { - // Configuration and settings menus for the AdminMenu module. - builder - .Add(S["Configuration"], configuration => configuration - .Add(S["Admin Menus"], S["Admin Menus"].PrefixPosition(), adminMenu => adminMenu - .Permission(Permissions.ManageAdminMenu) - .Action("List", "Menu", "OrchardCore.AdminMenu") - .LocalNav() - ) - ); + if (NavigationHelper.UseLegacyFormat()) + { + // Configuration and settings menus for the AdminMenu module. + builder + .Add(S["Configuration"], configuration => configuration + .Add(S["Admin menus"], S["Admin menus"].PrefixPosition(), adminMenu => adminMenu + .Permission(Permissions.ManageAdminMenu) + .Action("List", "Menu", "OrchardCore.AdminMenu") + .LocalNav() + ) + ); + } + else + { + // Configuration and settings menus for the AdminMenu module. + builder + .Add(S["Tools"], tools => tools + .Add(S["Admin Menus"], S["Admin Menus"].PrefixPosition(), adminMenu => adminMenu + .Permission(Permissions.ManageAdminMenu) + .Action("List", "Menu", "OrchardCore.AdminMenu") + .LocalNav() + ) + ); + } // This is the entry point for the adminMenu: dynamically generated custom admin menus. return _adminMenuNavigationProviderCoordinator.BuildNavigationAsync(NavigationConstants.AdminMenuId, builder); diff --git a/src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/AdminMenu.cs index 02c371cda73..0a37a616426 100644 --- a/src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Apis.GraphQL/AdminMenu.cs @@ -14,8 +14,22 @@ public AdminMenu(IStringLocalizer stringLocalizer) protected override ValueTask BuildAsync(NavigationBuilder builder) { + if (NavigationHelper.UseLegacyFormat()) + { + builder + .Add(S["Configuration"], configuration => configuration + .Add(S["GraphiQL"], S["GraphiQL"].PrefixPosition(), graphiQL => graphiQL + .Action("Index", "Admin", "OrchardCore.Apis.GraphQL") + .Permission(CommonPermissions.ExecuteGraphQL) + .LocalNav() + ) + ); + + return ValueTask.CompletedTask; + } + builder - .Add(S["Configuration"], configuration => configuration + .Add(S["Tools"], tools => tools .Add(S["GraphiQL"], S["GraphiQL"].PrefixPosition(), graphiQL => graphiQL .Action("Index", "Admin", "OrchardCore.Apis.GraphQL") .Permission(CommonPermissions.ExecuteGraphQL) diff --git a/src/OrchardCore.Modules/OrchardCore.AuditTrail/Navigation/AuditTrailAdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.AuditTrail/Navigation/AuditTrailAdminMenu.cs index 95dcb31301d..7c7a23c4664 100644 --- a/src/OrchardCore.Modules/OrchardCore.AuditTrail/Navigation/AuditTrailAdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.AuditTrail/Navigation/AuditTrailAdminMenu.cs @@ -1,6 +1,7 @@ using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.Localization; using OrchardCore.AuditTrail.Controllers; +using OrchardCore.AuditTrail.Settings; using OrchardCore.Navigation; namespace OrchardCore.AuditTrail.Navigation; @@ -13,6 +14,12 @@ public sealed class AuditTrailAdminMenu : AdminNavigationProvider { "correlationId", string.Empty }, }; + private static readonly RouteValueDictionary _settingsRouteValues = new() + { + { "area", "OrchardCore.Settings" }, + { "groupId", AuditTrailSettingsGroup.Id }, + }; + internal readonly IStringLocalizer S; public AuditTrailAdminMenu(IStringLocalizer stringLocalizer) @@ -22,13 +29,49 @@ public AuditTrailAdminMenu(IStringLocalizer stringLocalizer protected override ValueTask BuildAsync(NavigationBuilder builder) { + if (NavigationHelper.UseLegacyFormat()) + { + builder + .Add(S["Audit Trail"], NavigationConstants.AdminMenuAuditTrailPosition, configuration => configuration + .AddClass("audittrail") + .Id("audittrail") + .Action(nameof(AdminController.Index), "Admin", _routeValues) + .Permission(AuditTrailPermissions.ViewAuditTrail) + .LocalNav() + , priority: 1) + .Add(S["Configuration"], configuration => configuration + .Add(S["Settings"], settings => settings + .Add(S["Audit Trail"], S["Audit Trail"].PrefixPosition(), auditTrail => auditTrail + .AddClass("audittrail") + .Id("audittrailSettings") + .Action("Index", "Admin", _routeValues) + .Permission(AuditTrailPermissions.ManageAuditTrailSettings) + .LocalNav() + ) + ) + ); + + return ValueTask.CompletedTask; + } + builder - .Add(S["Audit Trail"], NavigationConstants.AdminMenuAuditTrailPosition, configuration => configuration - .AddClass("audittrail") - .Id("audittrail") - .Action(nameof(AdminController.Index), "Admin", _routeValues) - .Permission(AuditTrailPermissions.ViewAuditTrail) - .LocalNav() + .Add(S["Tools"], tools => tools + .Add(S["Audit Trail"], S["Audit Trail"].PrefixPosition(), configuration => configuration + .AddClass("audittrail") + .Id("audittrail") + .Action(nameof(AdminController.Index), "Admin", _routeValues) + .Permission(AuditTrailPermissions.ViewAuditTrail) + .LocalNav() + ) + ) + .Add(S["Settings"], settings => settings + .Add(S["Audit Trail"], S["Audit Trail"].PrefixPosition(), auditTrail => auditTrail + .AddClass("audittrail") + .Id("audittrailSettings") + .Action("Index", "Admin", _settingsRouteValues) + .Permission(AuditTrailPermissions.ManageAuditTrailSettings) + .LocalNav() + ) ); return ValueTask.CompletedTask; diff --git a/src/OrchardCore.Modules/OrchardCore.AuditTrail/Navigation/AuditTrailSettingsAdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.AuditTrail/Navigation/AuditTrailSettingsAdminMenu.cs deleted file mode 100644 index 6f9ddd25673..00000000000 --- a/src/OrchardCore.Modules/OrchardCore.AuditTrail/Navigation/AuditTrailSettingsAdminMenu.cs +++ /dev/null @@ -1,40 +0,0 @@ -using Microsoft.AspNetCore.Routing; -using Microsoft.Extensions.Localization; -using OrchardCore.AuditTrail.Settings; -using OrchardCore.Navigation; - -namespace OrchardCore.AuditTrail.Navigation; - -public sealed class AuditTrailSettingsAdminMenu : AdminNavigationProvider -{ - private static readonly RouteValueDictionary _routeValues = new() - { - { "area", "OrchardCore.Settings" }, - { "groupId", AuditTrailSettingsGroup.Id }, - }; - - internal readonly IStringLocalizer S; - - public AuditTrailSettingsAdminMenu(IStringLocalizer stringLocalizer) - { - S = stringLocalizer; - } - - protected override ValueTask BuildAsync(NavigationBuilder builder) - { - builder - .Add(S["Configuration"], configuration => configuration - .Add(S["Settings"], settings => settings - .Add(S["Audit Trail"], S["Audit Trail"].PrefixPosition(), auditTrail => auditTrail - .AddClass("audittrail") - .Id("audittrailSettings") - .Action("Index", "Admin", _routeValues) - .Permission(AuditTrailPermissions.ManageAuditTrailSettings) - .LocalNav() - ) - ) - ); - - return ValueTask.CompletedTask; - } -} diff --git a/src/OrchardCore.Modules/OrchardCore.AuditTrail/Startup.cs b/src/OrchardCore.Modules/OrchardCore.AuditTrail/Startup.cs index e2364354f75..3ca6623e86c 100644 --- a/src/OrchardCore.Modules/OrchardCore.AuditTrail/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.AuditTrail/Startup.cs @@ -43,7 +43,6 @@ public override void ConfigureServices(IServiceCollection services) services.AddPermissionProvider(); services.AddNavigationProvider(); - services.AddNavigationProvider(); services.AddSiteDisplayDriver(); services.AddSiteDisplayDriver(); diff --git a/src/OrchardCore.Modules/OrchardCore.AuditTrail/Views/NavigationItemText-audittrail.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.AuditTrail/Views/NavigationItemText-audittrail.Id.cshtml index db9fc2ed4fb..e7eaa5c96b1 100644 --- a/src/OrchardCore.Modules/OrchardCore.AuditTrail/Views/NavigationItemText-audittrail.Id.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.AuditTrail/Views/NavigationItemText-audittrail.Id.cshtml @@ -1 +1,14 @@ -@Model.Text +@using OrchardCore.Navigation + +@if (NavigationHelper.UseLegacyFormat()) +{ + + + + @Model.Text + + return; +} + + +@Model.Text \ No newline at end of file diff --git a/src/OrchardCore.Modules/OrchardCore.BackgroundTasks/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.BackgroundTasks/AdminMenu.cs index 08f64b7ce73..60ec6750ded 100644 --- a/src/OrchardCore.Modules/OrchardCore.BackgroundTasks/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.BackgroundTasks/AdminMenu.cs @@ -14,14 +14,28 @@ public AdminMenu(IStringLocalizer stringLocalizer) protected override ValueTask BuildAsync(NavigationBuilder builder) { - builder - .Add(S["Configuration"], configuration => configuration - .Add(S["Tasks"], S["Tasks"].PrefixPosition(), tasks => tasks - .Add(S["Background Tasks"], S["Background Tasks"].PrefixPosition(), backgroundTasks => backgroundTasks - .Action("Index", "BackgroundTask", "OrchardCore.BackgroundTasks") - .Permission(Permissions.ManageBackgroundTasks) - .LocalNav() + if (NavigationHelper.UseLegacyFormat()) + { + builder + .Add(S["Configuration"], configuration => configuration + .Add(S["Tasks"], S["Tasks"].PrefixPosition(), tasks => tasks + .Add(S["Background Tasks"], S["Background Tasks"].PrefixPosition(), backgroundTasks => backgroundTasks + .Action("Index", "BackgroundTask", "OrchardCore.BackgroundTasks") + .Permission(Permissions.ManageBackgroundTasks) + .LocalNav() + ) ) + ); + + return ValueTask.CompletedTask; + } + + builder + .Add(S["Tools"], tools => tools + .Add(S["Background Tasks"], S["Background Tasks"].PrefixPosition(), backgroundTasks => backgroundTasks + .Action("Index", "BackgroundTask", "OrchardCore.BackgroundTasks") + .Permission(Permissions.ManageBackgroundTasks) + .LocalNav() ) ); diff --git a/src/OrchardCore.Modules/OrchardCore.ContentLocalization/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.ContentLocalization/AdminMenu.cs index d13935970c3..96c9895eb53 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentLocalization/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentLocalization/AdminMenu.cs @@ -28,7 +28,9 @@ public AdminMenu(IStringLocalizer stringLocalizer) protected override ValueTask BuildAsync(NavigationBuilder builder) { - builder + if (NavigationHelper.UseLegacyFormat()) + { + builder .Add(S["Configuration"], configuration => configuration .Add(S["Settings"], settings => settings .Add(S["Localization"], localization => localization @@ -50,6 +52,29 @@ protected override ValueTask BuildAsync(NavigationBuilder builder) ) ); + return ValueTask.CompletedTask; + } + + builder + .Add(S["Settings"], settings => settings + .Add(S["Localization"], S["Localization"].PrefixPosition(), localization => localization + .Add(S["Content Culture"], S["Content Culture"].PrefixPosition(), provider => provider + .AddClass("contentrequestcultureprovider") + .Id("contentrequestcultureprovider") + .Action("Index", "Admin", _providersRouteValues) + .Permission(Permissions.ManageContentCulturePicker) + .LocalNav() + ) + .Add(S["Content Culture Picker"], S["Content Culture Picker"].PrefixPosition(), picker => picker + .AddClass("contentculturepicker") + .Id("contentculturepicker") + .Action("Index", "Admin", _pickerRouteValues) + .Permission(Permissions.ManageContentCulturePicker) + .LocalNav() + ) + ) + ); + return ValueTask.CompletedTask; } } diff --git a/src/OrchardCore.Modules/OrchardCore.ContentTypes/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.ContentTypes/AdminMenu.cs index 02eec290c50..5a3c69c39f2 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentTypes/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.ContentTypes/AdminMenu.cs @@ -18,9 +18,28 @@ public AdminMenu(IStringLocalizer stringLocalizer) protected override ValueTask BuildAsync(NavigationBuilder builder) { + if (NavigationHelper.UseLegacyFormat()) + { + builder + .Add(S["Content"], content => content + .Add(S["Content Definition"], S["Content Definition"].PrefixPosition("9"), contentDefinition => contentDefinition + .Add(S["Content Types"], S["Content Types"].PrefixPosition("1"), contentTypes => contentTypes + .Action(nameof(AdminController.List), _adminControllerName, "OrchardCore.ContentTypes") + .Permission(Permissions.ViewContentTypes) + .LocalNav() + ) + .Add(S["Content Parts"], S["Content Parts"].PrefixPosition("2"), contentParts => contentParts + .Action(nameof(AdminController.ListParts), _adminControllerName, "OrchardCore.ContentTypes") + .Permission(Permissions.ViewContentTypes) + .LocalNav() + ) + ) + ); + } + builder - .Add(S["Content"], content => content - .Add(S["Content Definition"], S["Content Definition"].PrefixPosition("9"), contentDefinition => contentDefinition + .Add(S["Design"], content => content + .Add(S["Content Definition"], S["Content Definition"].PrefixPosition(), contentDefinition => contentDefinition .Add(S["Content Types"], S["Content Types"].PrefixPosition("1"), contentTypes => contentTypes .Action(nameof(AdminController.List), _adminControllerName, "OrchardCore.ContentTypes") .Permission(Permissions.ViewContentTypes) diff --git a/src/OrchardCore.Modules/OrchardCore.ContentTypes/Views/NavigationItemText-contentdefinition.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.ContentTypes/Views/NavigationItemText-contentdefinition.Id.cshtml index edf5ba38efd..a4befa87880 100644 --- a/src/OrchardCore.Modules/OrchardCore.ContentTypes/Views/NavigationItemText-contentdefinition.Id.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.ContentTypes/Views/NavigationItemText-contentdefinition.Id.cshtml @@ -1 +1,4 @@ -@T["Content Definition"] + + + +@Model.Text diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Contents/AdminMenu.cs index 8c0b556131f..3304290ae04 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/AdminMenu.cs @@ -65,7 +65,7 @@ protected override async ValueTask BuildAsync(NavigationBuilder builder) await builder.AddAsync(S["Content"], NavigationConstants.AdminMenuContentPosition, async content => { content.AddClass("content").Id("content"); - await content.AddAsync(S["Content Items"], S["Content Items"].PrefixPosition(), async contentItems => + await content.AddAsync(S["Content Items"], "before", async contentItems => { if (!await _authorizationService.AuthorizeContentTypeDefinitionsAsync(context.User, CommonPermissions.ListContent, listableContentTypes, _contentManager)) { @@ -75,7 +75,7 @@ await content.AddAsync(S["Content Items"], S["Content Items"].PrefixPosition(), contentItems.Action(nameof(AdminController.List), typeof(AdminController).ControllerName(), _routeValues); contentItems.LocalNav(); }); - }); + }, priority: 1); var adminSettings = await _siteService.GetSettingsAsync(); diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Deployment/ExportContentToDeploymentTarget/ExportContentToDeploymentTargetAdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Contents/Deployment/ExportContentToDeploymentTarget/ExportContentToDeploymentTargetAdminMenu.cs index ea771404b90..7cea8ffca4c 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Deployment/ExportContentToDeploymentTarget/ExportContentToDeploymentTargetAdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Deployment/ExportContentToDeploymentTarget/ExportContentToDeploymentTargetAdminMenu.cs @@ -21,11 +21,13 @@ public ExportContentToDeploymentTargetAdminMenu(IStringLocalizer stri protected override ValueTask BuildAsync(NavigationBuilder builder) { - builder + if (NavigationHelper.UseLegacyFormat()) + { + builder .Add(S["Configuration"], configuration => configuration .Add(S["Import/Export"], S["Import/Export"].PrefixPosition(), import => import .Add(S["Settings"], settings => settings - .Add(S["Export Target Settings"], S["Export Target Settings"].PrefixPosition(), targetSettings => targetSettings + .Add(S["Export target"], S["Export target"].PrefixPosition(), targetSettings => targetSettings .Action("Index", "Admin", _routeValues) .Permission(OrchardCore.Deployment.CommonPermissions.ManageDeploymentPlan) .LocalNav() @@ -34,6 +36,18 @@ protected override ValueTask BuildAsync(NavigationBuilder builder) ) ); + return ValueTask.CompletedTask; + } + + builder + .Add(S["Settings"], settings => settings + .Add(S["Deployment Targets"], S["Deployment Targets"].PrefixPosition(), targetSettings => targetSettings + .Action("Index", "Admin", _routeValues) + .Permission(OrchardCore.Deployment.CommonPermissions.ManageDeploymentPlan) + .LocalNav() + ) + ); + return ValueTask.CompletedTask; } } diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Views/NavigationItemText-content.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.Contents/Views/NavigationItemText-content.Id.cshtml index 11f4a7176d4..4639ba4f839 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Views/NavigationItemText-content.Id.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Views/NavigationItemText-content.Id.cshtml @@ -1 +1,4 @@ -@T["Content"] + + + +@Model.Text diff --git a/src/OrchardCore.Modules/OrchardCore.Contents/Views/NavigationItemText-new.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.Contents/Views/NavigationItemText-new.Id.cshtml index 61896c80aab..22dfd3b2c5d 100644 --- a/src/OrchardCore.Modules/OrchardCore.Contents/Views/NavigationItemText-new.Id.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Contents/Views/NavigationItemText-new.Id.cshtml @@ -1,4 +1,4 @@ -@T["New"] +@Model.Text diff --git a/src/OrchardCore.Modules/OrchardCore.Cors/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Cors/AdminMenu.cs index 2d606abb6ef..f9ba300f6f7 100644 --- a/src/OrchardCore.Modules/OrchardCore.Cors/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Cors/AdminMenu.cs @@ -14,10 +14,28 @@ public AdminMenu(IStringLocalizer localizer) protected override ValueTask BuildAsync(NavigationBuilder builder) { + if (NavigationHelper.UseLegacyFormat()) + { + builder + .Add(S["Configuration"], configuration => configuration + .Add(S["Settings"], S["Settings"].PrefixPosition(), settings => settings + .Add(S["CORS"], S["CORS"].PrefixPosition(), entry => entry + .AddClass("cors") + .Id("cors") + .Action("Index", "Admin", "OrchardCore.Cors") + .Permission(Permissions.ManageCorsSettings) + .LocalNav() + ) + ) + ); + + return ValueTask.CompletedTask; + } + builder - .Add(S["Configuration"], configuration => configuration - .Add(S["Settings"], settings => settings - .Add(S["CORS"], S["CORS"].PrefixPosition(), entry => entry + .Add(S["Settings"], settings => settings + .Add(S["Security"], S["Security"].PrefixPosition(), security => security + .Add(S["Cross-Origin Resource Sharing"], S["Cross-Origin Resource Sharing"].PrefixPosition(), entry => entry .AddClass("cors") .Id("cors") .Action("Index", "Admin", "OrchardCore.Cors") diff --git a/src/OrchardCore.Modules/OrchardCore.Cors/Views/NavigationItemText-cors.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.Cors/Views/NavigationItemText-cors.Id.cshtml index 4e4e100023a..cfe21309a56 100644 --- a/src/OrchardCore.Modules/OrchardCore.Cors/Views/NavigationItemText-cors.Id.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Cors/Views/NavigationItemText-cors.Id.cshtml @@ -1 +1,4 @@ -@T["CORS"] + + + +@Model.Text diff --git a/src/OrchardCore.Modules/OrchardCore.CustomSettings/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.CustomSettings/AdminMenu.cs index f49eaef5c30..dc0279ee2a2 100644 --- a/src/OrchardCore.Modules/OrchardCore.CustomSettings/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.CustomSettings/AdminMenu.cs @@ -40,10 +40,12 @@ protected override async ValueTask BuildAsync(NavigationBuilder builder) var htmlName = type.Name.HtmlClassify(); - builder + if (NavigationHelper.UseLegacyFormat()) + { + builder .Add(S["Configuration"], configuration => configuration .Add(S["Settings"], settings => settings - .Add(new LocalizedString(type.DisplayName, type.DisplayName), type.DisplayName.PrefixPosition(), layers => layers + .Add(new LocalizedString(type.DisplayName, type.DisplayName), type.DisplayName.PrefixPosition(), customSettings => customSettings .Action("Index", "Admin", routeValues) .AddClass(htmlName) .Id(htmlName) @@ -53,6 +55,21 @@ protected override async ValueTask BuildAsync(NavigationBuilder builder) ) ) ); + + continue; + } + + builder + .Add(S["Settings"], settings => settings + .Add(new LocalizedString(type.DisplayName, type.DisplayName), type.DisplayName.PrefixPosition(), layers => layers + .Action("Index", "Admin", routeValues) + .AddClass(htmlName) + .Id(htmlName) + .Permission(Permissions.CreatePermissionForType(type)) + .Resource(type.Name) + .LocalNav() + ) + ); } } } diff --git a/src/OrchardCore.Modules/OrchardCore.Demo/Views/NavigationItemText-demo.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.Demo/Views/NavigationItemText-demo.Id.cshtml index 877ea0cab50..ab2e3f4984e 100644 --- a/src/OrchardCore.Modules/OrchardCore.Demo/Views/NavigationItemText-demo.Id.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Demo/Views/NavigationItemText-demo.Id.cshtml @@ -1 +1,4 @@ -@T["Demo"] + + + +@Model.Text diff --git a/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/AdminMenu.cs index d69bf633a52..c6a5a8befb8 100644 --- a/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Deployment.Remote/AdminMenu.cs @@ -14,9 +14,30 @@ public AdminMenu(IStringLocalizer localizer) protected override ValueTask BuildAsync(NavigationBuilder builder) { + if (NavigationHelper.UseLegacyFormat()) + { + builder + .Add(S["Configuration"], configuration => configuration + .Add(S["Import/Export"], import => import + .Add(S["Remote Instances"], S["Remote Instances"].PrefixPosition(), remote => remote + .Action("Index", "RemoteInstance", "OrchardCore.Deployment.Remote") + .Permission(Permissions.ManageRemoteInstances) + .LocalNav() + ) + .Add(S["Remote Clients"], S["Remote Clients"].PrefixPosition(), remote => remote + .Action("Index", "RemoteClient", "OrchardCore.Deployment.Remote") + .Permission(Permissions.ManageRemoteClients) + .LocalNav() + ) + ) + ); + + return ValueTask.CompletedTask; + } + builder - .Add(S["Configuration"], configuration => configuration - .Add(S["Import/Export"], import => import + .Add(S["Tools"], tools => tools + .Add(S["Deployments"], import => import .Add(S["Remote Instances"], S["Remote Instances"].PrefixPosition(), remote => remote .Action("Index", "RemoteInstance", "OrchardCore.Deployment.Remote") .Permission(Permissions.ManageRemoteInstances) diff --git a/src/OrchardCore.Modules/OrchardCore.Deployment/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Deployment/AdminMenu.cs index 649a5793928..b56865d3bce 100644 --- a/src/OrchardCore.Modules/OrchardCore.Deployment/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Deployment/AdminMenu.cs @@ -14,10 +14,36 @@ public AdminMenu(IStringLocalizer stringLocalizer) protected override ValueTask BuildAsync(NavigationBuilder builder) { + if (NavigationHelper.UseLegacyFormat()) + { + builder + .Add(S["Configuration"], configuration => configuration + .Add(S["Import/Export"], S["Import/Export"].PrefixPosition(), import => import + .Add(S["Deployment Plans"], S["Deployment Plans"].PrefixPosition(), deployment => deployment + .Action("Index", "DeploymentPlan", "OrchardCore.Deployment") + .Permission(CommonPermissions.Export) + .LocalNav() + ) + .Add(S["Package Import"], S["Package Import"].PrefixPosition(), deployment => deployment + .Action("Index", "Import", "OrchardCore.Deployment") + .Permission(CommonPermissions.Import) + .LocalNav() + ) + .Add(S["JSON Import"], S["JSON Import"].PrefixPosition(), deployment => deployment + .Action("Json", "Import", "OrchardCore.Deployment") + .Permission(CommonPermissions.Import) + .LocalNav() + ) + ) + ); + + return ValueTask.CompletedTask; + } + builder - .Add(S["Configuration"], configuration => configuration - .Add(S["Import/Export"], S["Import/Export"].PrefixPosition(), import => import - .Add(S["Deployment Plans"], S["Deployment Plans"].PrefixPosition(), deployment => deployment + .Add(S["Tools"], tools => tools + .Add(S["Deployments"], S["Deployments"].PrefixPosition(), import => import + .Add(S["Plans"], S["Plans"].PrefixPosition("1"), deployment => deployment .Action("Index", "DeploymentPlan", "OrchardCore.Deployment") .Permission(CommonPermissions.Export) .LocalNav() diff --git a/src/OrchardCore.Modules/OrchardCore.Email/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Email/AdminMenu.cs index d580f9096ec..ba6e936d908 100644 --- a/src/OrchardCore.Modules/OrchardCore.Email/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Email/AdminMenu.cs @@ -24,22 +24,51 @@ public AdminMenu(IStringLocalizer stringLocalizer) protected override ValueTask BuildAsync(NavigationBuilder builder) { + if (NavigationHelper.UseLegacyFormat()) + { + builder + .Add(S["Configuration"], configuration => configuration + .Add(S["Settings"], settings => settings + .Add(S["Email"], S["Email"].PrefixPosition(), entry => entry + .AddClass("email") + .Id("email") + .Action("Index", "Admin", _routeValues) + .Permission(Permissions.ManageEmailSettings) + .LocalNav() + ) + .Add(S["Email Test"], S["Email Test"].PrefixPosition(), entry => entry + .AddClass("emailtest") + .Id("emailtest") + .Action(nameof(AdminController.Test), typeof(AdminController).ControllerName(), "OrchardCore.Email") + .Permission(Permissions.ManageEmailSettings) + .LocalNav() + ) + ) + ); + + return ValueTask.CompletedTask; + } + builder - .Add(S["Configuration"], configuration => configuration - .Add(S["Settings"], settings => settings - .Add(S["Email"], S["Email"].PrefixPosition(), entry => entry - .AddClass("email") - .Id("email") - .Action("Index", "Admin", _routeValues) - .Permission(Permissions.ManageEmailSettings) - .LocalNav() + .Add(S["Tools"], tools => tools + .Add(S["Testing"], S["Testing"].PrefixPosition(), testing => testing + .Add(S["Email Test"], S["Email Test"].PrefixPosition(), entry => entry + .AddClass("emailtest") + .Id("emailtest") + .Action(nameof(AdminController.Test), typeof(AdminController).ControllerName(), "OrchardCore.Email") + .Permission(Permissions.ManageEmailSettings) + .LocalNav() ) - .Add(S["Email Test"], S["Email Test"].PrefixPosition(), entry => entry - .AddClass("emailtest") - .Id("emailtest") - .Action(nameof(AdminController.Test), typeof(AdminController).ControllerName(), "OrchardCore.Email") - .Permission(Permissions.ManageEmailSettings) - .LocalNav() + ) + ) + .Add(S["Settings"], settings => settings + .Add(S["Communication"], S["Communication"].PrefixPosition(), communication => communication + .Add(S["Email"], S["Email"].PrefixPosition(), entry => entry + .AddClass("email") + .Id("email") + .Action("Index", "Admin", _routeValues) + .Permission(Permissions.ManageEmailSettings) + .LocalNav() ) ) ); diff --git a/src/OrchardCore.Modules/OrchardCore.Email/Views/NavigationItemText-email.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.Email/Views/NavigationItemText-email.Id.cshtml index 513bf0fef34..d943f075b84 100644 --- a/src/OrchardCore.Modules/OrchardCore.Email/Views/NavigationItemText-email.Id.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Email/Views/NavigationItemText-email.Id.cshtml @@ -1,4 +1,4 @@ -@T["Email"] +@Model.Text diff --git a/src/OrchardCore.Modules/OrchardCore.Facebook/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Facebook/AdminMenu.cs index d4e59228029..1dc2650a025 100644 --- a/src/OrchardCore.Modules/OrchardCore.Facebook/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Facebook/AdminMenu.cs @@ -21,9 +21,27 @@ public AdminMenu(IStringLocalizer stringLocalizer) protected override ValueTask BuildAsync(NavigationBuilder builder) { + if (NavigationHelper.UseLegacyFormat()) + { + builder + .Add(S["Configuration"], configuration => configuration + .Add(S["Settings"], settings => settings + .Add(S["Meta App"], S["Meta App"].PrefixPosition(), metaApp => metaApp + .AddClass("facebookApp") + .Id("facebookApp") + .Action("Index", "Admin", _routeValues) + .Permission(Permissions.ManageFacebookApp) + .LocalNav() + ) + ) + ); + + return ValueTask.CompletedTask; + } + builder - .Add(S["Configuration"], configuration => configuration - .Add(S["Settings"], settings => settings + .Add(S["Settings"], settings => settings + .Add(S["Integrations"], S["Integrations"].PrefixPosition(), integrations => integrations .Add(S["Meta App"], S["Meta App"].PrefixPosition(), metaApp => metaApp .AddClass("facebookApp") .Id("facebookApp") diff --git a/src/OrchardCore.Modules/OrchardCore.Facebook/AdminMenuLogin.cs b/src/OrchardCore.Modules/OrchardCore.Facebook/AdminMenuLogin.cs index c4ad313080b..aa1277d28e0 100644 --- a/src/OrchardCore.Modules/OrchardCore.Facebook/AdminMenuLogin.cs +++ b/src/OrchardCore.Modules/OrchardCore.Facebook/AdminMenuLogin.cs @@ -21,15 +21,35 @@ public AdminMenuLogin(IStringLocalizer stringLocalizer) protected override ValueTask BuildAsync(NavigationBuilder builder) { + if (NavigationHelper.UseLegacyFormat()) + { + builder + .Add(S["Security"], security => security + .Add(S["Authentication"], S["Authentication"].PrefixPosition(), authentication => authentication + .Add(S["Meta"], S["Meta"].PrefixPosition(), meta => meta + .AddClass("facebook") + .Id("facebook") + .Action("Index", "Admin", _routeValues) + .Permission(Permissions.ManageFacebookApp) + .LocalNav() + ) + ) + ); + + return ValueTask.CompletedTask; + } + builder - .Add(S["Security"], security => security - .Add(S["Authentication"], authentication => authentication - .Add(S["Meta"], S["Meta"].PrefixPosition(), meta => meta - .AddClass("facebook") - .Id("facebook") - .Action("Index", "Admin", _routeValues) - .Permission(Permissions.ManageFacebookApp) - .LocalNav() + .Add(S["Settings"], settings => settings + .Add(S["Security"], S["Security"].PrefixPosition(), security => security + .Add(S["Authentication"], S["Authentication"].PrefixPosition(), authentication => authentication + .Add(S["Meta"], S["Meta"].PrefixPosition(), meta => meta + .AddClass("facebook") + .Id("facebook") + .Action("Index", "Admin", _routeValues) + .Permission(Permissions.ManageFacebookApp) + .LocalNav() + ) ) ) ); diff --git a/src/OrchardCore.Modules/OrchardCore.Facebook/AdminMenuPixel.cs b/src/OrchardCore.Modules/OrchardCore.Facebook/AdminMenuPixel.cs index 9494dd75d46..ba6e586f878 100644 --- a/src/OrchardCore.Modules/OrchardCore.Facebook/AdminMenuPixel.cs +++ b/src/OrchardCore.Modules/OrchardCore.Facebook/AdminMenuPixel.cs @@ -22,9 +22,27 @@ public AdminMenuPixel( protected override ValueTask BuildAsync(NavigationBuilder builder) { + if (NavigationHelper.UseLegacyFormat()) + { + builder + .Add(S["Configuration"], configuration => configuration + .Add(S["Settings"], settings => settings + .Add(S["Meta Pixel"], S["Meta Pixel"].PrefixPosition(), pixel => pixel + .AddClass("facebookPixel") + .Id("facebookPixel") + .Action("Index", "Admin", _routeValues) + .Permission(FacebookConstants.ManageFacebookPixelPermission) + .LocalNav() + ) + ) + ); + + return ValueTask.CompletedTask; + } + builder - .Add(S["Configuration"], configuration => configuration - .Add(S["Settings"], settings => settings + .Add(S["Settings"], settings => settings + .Add(S["Integrations"], S["Integrations"].PrefixPosition(), integrations => integrations .Add(S["Meta Pixel"], S["Meta Pixel"].PrefixPosition(), pixel => pixel .AddClass("facebookPixel") .Id("facebookPixel") diff --git a/src/OrchardCore.Modules/OrchardCore.Facebook/Views/NavigationItemText-facebook.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.Facebook/Views/NavigationItemText-facebook.Id.cshtml index 75b3138c222..e23437c500d 100644 --- a/src/OrchardCore.Modules/OrchardCore.Facebook/Views/NavigationItemText-facebook.Id.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Facebook/Views/NavigationItemText-facebook.Id.cshtml @@ -1 +1,4 @@ -@T["Meta"] + + + +@Model.Text diff --git a/src/OrchardCore.Modules/OrchardCore.Facebook/Views/NavigationItemText-facebookApp.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.Facebook/Views/NavigationItemText-facebookApp.Id.cshtml index 8daad823e35..e23437c500d 100644 --- a/src/OrchardCore.Modules/OrchardCore.Facebook/Views/NavigationItemText-facebookApp.Id.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Facebook/Views/NavigationItemText-facebookApp.Id.cshtml @@ -1 +1,4 @@ -@T["Meta App"] + + + +@Model.Text diff --git a/src/OrchardCore.Modules/OrchardCore.Facebook/Views/NavigationItemText-facebookPixel.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.Facebook/Views/NavigationItemText-facebookPixel.Id.cshtml index fd6e992b4e7..e23437c500d 100644 --- a/src/OrchardCore.Modules/OrchardCore.Facebook/Views/NavigationItemText-facebookPixel.Id.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Facebook/Views/NavigationItemText-facebookPixel.Id.cshtml @@ -1 +1,4 @@ -@T["Meta Pixel"] + + + +@Model.Text diff --git a/src/OrchardCore.Modules/OrchardCore.Features/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Features/AdminMenu.cs index e4dbd3e2345..e5004babf1f 100644 --- a/src/OrchardCore.Modules/OrchardCore.Features/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Features/AdminMenu.cs @@ -22,8 +22,22 @@ public AdminMenu(IStringLocalizer stringLocalizer) protected override ValueTask BuildAsync(NavigationBuilder builder) { + if (NavigationHelper.UseLegacyFormat()) + { + builder + .Add(S["Configuration"], configuration => configuration + .Add(S["Features"], S["Features"].PrefixPosition(), deployment => deployment + .Action("Features", "Admin", _routeValues) + .Permission(Permissions.ManageFeatures) + .LocalNav() + ) + ); + + return ValueTask.CompletedTask; + } + builder - .Add(S["Configuration"], configuration => configuration + .Add(S["Tools"], tools => tools .Add(S["Features"], S["Features"].PrefixPosition(), deployment => deployment .Action("Features", "Admin", _routeValues) .Permission(Permissions.ManageFeatures) diff --git a/src/OrchardCore.Modules/OrchardCore.GitHub/AdminMenuGitHubLogin.cs b/src/OrchardCore.Modules/OrchardCore.GitHub/AdminMenuGitHubLogin.cs index 06be42e1584..1d01205996d 100644 --- a/src/OrchardCore.Modules/OrchardCore.GitHub/AdminMenuGitHubLogin.cs +++ b/src/OrchardCore.Modules/OrchardCore.GitHub/AdminMenuGitHubLogin.cs @@ -21,7 +21,9 @@ public AdminMenuGitHubLogin(IStringLocalizer stringLocaliz protected override ValueTask BuildAsync(NavigationBuilder builder) { - builder + if (NavigationHelper.UseLegacyFormat()) + { + builder .Add(S["Security"], security => security .Add(S["Authentication"], authentication => authentication .Add(S["GitHub"], S["GitHub"].PrefixPosition(), settings => settings @@ -34,6 +36,24 @@ protected override ValueTask BuildAsync(NavigationBuilder builder) ) ); + return ValueTask.CompletedTask; + } + + builder + .Add(S["Settings"], settings => settings + .Add(S["Security"], S["Security"].PrefixPosition(), security => security + .Add(S["Authentication"], S["Authentication"].PrefixPosition(), authentication => authentication + .Add(S["GitHub"], S["GitHub"].PrefixPosition(), settings => settings + .AddClass("github") + .Id("github") + .Action("Index", "Admin", _routeValues) + .Permission(Permissions.ManageGitHubAuthentication) + .LocalNav() + ) + ) + ) + ); + return ValueTask.CompletedTask; } } diff --git a/src/OrchardCore.Modules/OrchardCore.GitHub/Views/NavigationItemText-github.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.GitHub/Views/NavigationItemText-github.Id.cshtml index 1397f802376..9ca61d8f123 100644 --- a/src/OrchardCore.Modules/OrchardCore.GitHub/Views/NavigationItemText-github.Id.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.GitHub/Views/NavigationItemText-github.Id.cshtml @@ -1 +1,4 @@ -@T["GitHub"] + + + +@Model.Text diff --git a/src/OrchardCore.Modules/OrchardCore.Google/GoogleAnalyticsAdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Google/GoogleAnalyticsAdminMenu.cs index 5e5ffdbc0e0..0d2f4eeb1ae 100644 --- a/src/OrchardCore.Modules/OrchardCore.Google/GoogleAnalyticsAdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Google/GoogleAnalyticsAdminMenu.cs @@ -21,7 +21,9 @@ public GoogleAnalyticsAdminMenu(IStringLocalizer strin protected override ValueTask BuildAsync(NavigationBuilder builder) { - builder + if (NavigationHelper.UseLegacyFormat()) + { + builder .Add(S["Configuration"], configuration => configuration .Add(S["Settings"], settings => settings .Add(S["Google Analytics"], S["Google Analytics"].PrefixPosition(), google => google @@ -33,6 +35,21 @@ protected override ValueTask BuildAsync(NavigationBuilder builder) ) ); + return ValueTask.CompletedTask; + } + + builder + .Add(S["Settings"], settings => settings + .Add(S["Integrations"], S["Integrations"].PrefixPosition(), integrations => integrations + .Add(S["Google Analytics"], S["Google Analytics"].PrefixPosition(), google => google + .AddClass("googleAnalytics").Id("googleAnalytics") + .Action("Index", "Admin", _routeValues) + .Permission(Permissions.ManageGoogleAnalytics) + .LocalNav() + ) + ) + ); + return ValueTask.CompletedTask; } } diff --git a/src/OrchardCore.Modules/OrchardCore.Google/GoogleAuthenticationAdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Google/GoogleAuthenticationAdminMenu.cs index 9392cd6d583..bab4fd5af04 100644 --- a/src/OrchardCore.Modules/OrchardCore.Google/GoogleAuthenticationAdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Google/GoogleAuthenticationAdminMenu.cs @@ -21,18 +21,38 @@ public GoogleAuthenticationAdminMenu(IStringLocalizer security + .Add(S["Authentication"], authentication => authentication + .Add(S["Google"], S["Google"].PrefixPosition(), google => google + .AddClass("google") + .Id("google") + .Action("Index", "Admin", _routeValues) + .Permission(Permissions.ManageGoogleAuthentication) + .LocalNav() + ) + ) + ); + + return ValueTask.CompletedTask; + } + builder - .Add(S["Security"], security => security - .Add(S["Authentication"], authentication => authentication - .Add(S["Google"], S["Google"].PrefixPosition(), google => google - .AddClass("google") - .Id("google") - .Action("Index", "Admin", _routeValues) - .Permission(Permissions.ManageGoogleAuthentication) - .LocalNav() + .Add(S["Settings"], settings => settings + .Add(S["Security"], S["Security"].PrefixPosition(), security => security + .Add(S["Authentication"], S["Authentication"].PrefixPosition(), authentication => authentication + .Add(S["Google"], S["Google"].PrefixPosition(), google => google + .AddClass("google") + .Id("google") + .Action("Index", "Admin", _routeValues) + .Permission(Permissions.ManageGoogleAuthentication) + .LocalNav() + ) + ) ) - ) - ); + ); return ValueTask.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.Google/GoogleTagManagerAdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Google/GoogleTagManagerAdminMenu.cs index bb5fe072b1c..a2c929b0764 100644 --- a/src/OrchardCore.Modules/OrchardCore.Google/GoogleTagManagerAdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Google/GoogleTagManagerAdminMenu.cs @@ -21,7 +21,9 @@ public GoogleTagManagerAdminMenu(IStringLocalizer str protected override ValueTask BuildAsync(NavigationBuilder builder) { - builder + if (NavigationHelper.UseLegacyFormat()) + { + builder .Add(S["Configuration"], configuration => configuration .Add(S["Settings"], settings => settings .Add(S["Google Tag Manager"], S["Google Tag Manager"].PrefixPosition(), google => google @@ -34,6 +36,22 @@ protected override ValueTask BuildAsync(NavigationBuilder builder) ) ); + return ValueTask.CompletedTask; + } + + builder + .Add(S["Settings"], settings => settings + .Add(S["Integrations"], S["Integrations"].PrefixPosition(), integrations => integrations + .Add(S["Google Tag Manager"], S["Google Tag Manager"].PrefixPosition(), google => google + .AddClass("googleTagManager") + .Id("googleTagManager") + .Action("Index", "Admin", _routeValues) + .Permission(Permissions.ManageGoogleTagManager) + .LocalNav() + ) + ) + ); + return ValueTask.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.Google/Views/NavigationItemText-google.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.Google/Views/NavigationItemText-google.Id.cshtml index 0dacf258951..65c5303af80 100644 --- a/src/OrchardCore.Modules/OrchardCore.Google/Views/NavigationItemText-google.Id.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Google/Views/NavigationItemText-google.Id.cshtml @@ -1 +1,4 @@ -@T["Google"] + + + +@Model.Text diff --git a/src/OrchardCore.Modules/OrchardCore.Google/Views/NavigationItemText-googleAnalytics.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.Google/Views/NavigationItemText-googleAnalytics.Id.cshtml index b0d580c1df0..65c5303af80 100644 --- a/src/OrchardCore.Modules/OrchardCore.Google/Views/NavigationItemText-googleAnalytics.Id.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Google/Views/NavigationItemText-googleAnalytics.Id.cshtml @@ -1 +1,4 @@ -@T["Google Analytics"] + + + +@Model.Text diff --git a/src/OrchardCore.Modules/OrchardCore.Google/Views/NavigationItemText-googleTagManager.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.Google/Views/NavigationItemText-googleTagManager.Id.cshtml index f0990e2e25c..65c5303af80 100644 --- a/src/OrchardCore.Modules/OrchardCore.Google/Views/NavigationItemText-googleTagManager.Id.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Google/Views/NavigationItemText-googleTagManager.Id.cshtml @@ -1 +1,4 @@ -@T["Google Tag Manager"] + + + +@Model.Text diff --git a/src/OrchardCore.Modules/OrchardCore.Https/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Https/AdminMenu.cs index 9df8c2e3f9f..3ebbccf0246 100644 --- a/src/OrchardCore.Modules/OrchardCore.Https/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Https/AdminMenu.cs @@ -22,9 +22,25 @@ public AdminMenu(IStringLocalizer stringLocalizer) protected override ValueTask BuildAsync(NavigationBuilder builder) { + if (NavigationHelper.UseLegacyFormat()) + { + builder + .Add(S["Security"], security => security + .Add(S["Settings"], S["Settings"].PrefixPosition(), settings => settings + .Add(S["HTTPS"], S["HTTPS"].PrefixPosition(), https => https + .Action("Index", "Admin", _routeValues) + .Permission(Permissions.ManageHttps) + .LocalNav() + ) + ) + ); + + return ValueTask.CompletedTask; + } + builder - .Add(S["Security"], security => security - .Add(S["Settings"], settings => settings + .Add(S["Settings"], settings => settings + .Add(S["Security"], S["Security"].PrefixPosition(), security => security .Add(S["HTTPS"], S["HTTPS"].PrefixPosition(), https => https .Action("Index", "Admin", _routeValues) .Permission(Permissions.ManageHttps) diff --git a/src/OrchardCore.Modules/OrchardCore.Layers/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Layers/AdminMenu.cs index 732952081a6..bdd017ef99e 100644 --- a/src/OrchardCore.Modules/OrchardCore.Layers/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Layers/AdminMenu.cs @@ -22,20 +22,41 @@ public AdminMenu(IStringLocalizer stringLocalizer) protected override ValueTask BuildAsync(NavigationBuilder builder) { - builder - .Add(S["Design"], design => design - .Add(S["Settings"], settings => settings - .Add(S["Zones"], S["Zones"].PrefixPosition(), zones => zones - .Action("Index", "Admin", _routeValues) + if (NavigationHelper.UseLegacyFormat()) + { + builder + .Add(S["Design"], design => design + .Add(S["Settings"], settings => settings + .Add(S["Zones"], S["Zones"].PrefixPosition(), zones => zones + .Action("Index", "Admin", _routeValues) + .Permission(Permissions.ManageLayers) + .LocalNav() + ) + ) + .Add(S["Widgets"], S["Widgets"].PrefixPosition(), widgets => widgets .Permission(Permissions.ManageLayers) + .Action("Index", "Admin", "OrchardCore.Layers") .LocalNav() ) - ) + ); + + return ValueTask.CompletedTask; + } + + builder + .Add(S["Design"], design => design .Add(S["Widgets"], S["Widgets"].PrefixPosition(), widgets => widgets .Permission(Permissions.ManageLayers) .Action("Index", "Admin", "OrchardCore.Layers") .LocalNav() ) + ) + .Add(S["Settings"], settings => settings + .Add(S["Zones"], S["Zones"].PrefixPosition(), zones => zones + .Action("Index", "Admin", _routeValues) + .Permission(Permissions.ManageLayers) + .LocalNav() + ) ); return ValueTask.CompletedTask; diff --git a/src/OrchardCore.Modules/OrchardCore.Localization/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Localization/AdminMenu.cs index 42078f84b10..b20949ea84f 100644 --- a/src/OrchardCore.Modules/OrchardCore.Localization/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Localization/AdminMenu.cs @@ -30,19 +30,39 @@ public AdminMenu(IStringLocalizer stringLocalizer) /// protected override ValueTask BuildAsync(NavigationBuilder builder) { + if (NavigationHelper.UseLegacyFormat()) + { + builder + .Add(S["Configuration"], configuration => configuration + .Add(S["Settings"], settings => settings + .Add(S["Localization"], localization => localization + .AddClass("localization") + .Id("localization") + .Add(S["Cultures"], S["Cultures"].PrefixPosition(), cultures => cultures + .AddClass("cultures") + .Id("cultures") + .Action("Index", "Admin", _routeValues) + .Permission(Permissions.ManageCultures) + .LocalNav() + ) + ) + ) + ); + + return ValueTask.CompletedTask; + } + builder - .Add(S["Configuration"], configuration => configuration - .Add(S["Settings"], settings => settings - .Add(S["Localization"], localization => localization - .AddClass("localization") - .Id("localization") - .Add(S["Cultures"], S["Cultures"].PrefixPosition(), cultures => cultures - .AddClass("cultures") - .Id("cultures") - .Action("Index", "Admin", _routeValues) - .Permission(Permissions.ManageCultures) - .LocalNav() - ) + .Add(S["Settings"], settings => settings + .Add(S["Localization"], S["Localization"].PrefixPosition(), localization => localization + .AddClass("localization") + .Id("localization") + .Add(S["Cultures"], S["Cultures"].PrefixPosition(), cultures => cultures + .AddClass("cultures") + .Id("cultures") + .Action("Index", "Admin", _routeValues) + .Permission(Permissions.ManageCultures) + .LocalNav() ) ) ); diff --git a/src/OrchardCore.Modules/OrchardCore.Localization/Views/NavigationItemText-localization.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.Localization/Views/NavigationItemText-localization.Id.cshtml index 4ca42c58931..c924a69bf51 100644 --- a/src/OrchardCore.Modules/OrchardCore.Localization/Views/NavigationItemText-localization.Id.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Localization/Views/NavigationItemText-localization.Id.cshtml @@ -1 +1,4 @@ -@T["Localization"] + + + +@Model.Text diff --git a/src/OrchardCore.Modules/OrchardCore.Media.AmazonS3/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Media.AmazonS3/AdminMenu.cs index a32fe8bebf5..7bb6133c7e5 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media.AmazonS3/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media.AmazonS3/AdminMenu.cs @@ -14,7 +14,22 @@ public AdminMenu(IStringLocalizer stringLocalizer) protected override ValueTask BuildAsync(NavigationBuilder builder) { - builder.Add(S["Configuration"], configuration => configuration + if (NavigationHelper.UseLegacyFormat()) + { + builder.Add(S["Configuration"], configuration => configuration + .Add(S["Media"], S["Media"].PrefixPosition(), media => media + .Add(S["Amazon S3 Options"], S["Amazon S3 Options"].PrefixPosition(), options => options + .Action("Options", "Admin", "OrchardCore.Media.AmazonS3") + .Permission(Permissions.ViewAmazonS3MediaOptions) + .LocalNav() + ) + ) + ); + + return ValueTask.CompletedTask; + } + + builder.Add(S["Settings"], settings => settings .Add(S["Media"], S["Media"].PrefixPosition(), media => media .Add(S["Amazon S3 Options"], S["Amazon S3 Options"].PrefixPosition(), options => options .Action("Options", "Admin", "OrchardCore.Media.AmazonS3") diff --git a/src/OrchardCore.Modules/OrchardCore.Media.Azure/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Media.Azure/AdminMenu.cs index 34cd3558ab2..f653b08a2fc 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media.Azure/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media.Azure/AdminMenu.cs @@ -14,8 +14,24 @@ public AdminMenu(IStringLocalizer stringLocalizer) protected override ValueTask BuildAsync(NavigationBuilder builder) { + if (NavigationHelper.UseLegacyFormat()) + { + builder + .Add(S["Configuration"], configuration => configuration + .Add(S["Media"], S["Media"].PrefixPosition(), media => media + .Add(S["Azure Blob Options"], S["Azure Blob Options"].PrefixPosition(), options => options + .Action("Options", "Admin", "OrchardCore.Media.Azure") + .Permission(Permissions.ViewAzureMediaOptions) + .LocalNav() + ) + ) + ); + + return ValueTask.CompletedTask; + } + builder - .Add(S["Configuration"], configuration => configuration + .Add(S["Settings"], settings => settings .Add(S["Media"], S["Media"].PrefixPosition(), media => media .Add(S["Azure Blob Options"], S["Azure Blob Options"].PrefixPosition(), options => options .Action("Options", "Admin", "OrchardCore.Media.Azure") diff --git a/src/OrchardCore.Modules/OrchardCore.Media/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Media/AdminMenu.cs index 46191f3aabb..f36428800c6 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media/AdminMenu.cs @@ -14,30 +14,62 @@ public AdminMenu(IStringLocalizer stringLocalizer) protected override ValueTask BuildAsync(NavigationBuilder builder) { + if (NavigationHelper.UseLegacyFormat()) + { + builder + .Add(S["Content"], content => content + .AddClass("media") + .Id("media") + .Add(S["Media Library"], S["Media Library"].PrefixPosition(), media => media + .Permission(Permissions.ManageMedia) + .Action("Index", "Admin", "OrchardCore.Media") + .LocalNav() + ) + ); + + builder + .Add(S["Configuration"], configuration => configuration + .Add(S["Media"], S["Media"].PrefixPosition(), media => media + .Add(S["Media Options"], S["Media Options"].PrefixPosition(), options => options + .Action("Options", "Admin", "OrchardCore.Media") + .Permission(Permissions.ViewMediaOptions) + .LocalNav() + ) + .Add(S["Media Profiles"], S["Media Profiles"].PrefixPosition(), mediaProfiles => mediaProfiles + .Action("Index", "MediaProfiles", "OrchardCore.Media") + .Permission(Permissions.ManageMediaProfiles) + .LocalNav() + ) + ) + ); + + return ValueTask.CompletedTask; + } + builder - .Add(S["Content"], content => content + .Add(S["Media"], "after.15", media => media .AddClass("media") .Id("media") - .Add(S["Media Library"], S["Media Library"].PrefixPosition(), media => media + .Add(S["Library"], S["Library"].PrefixPosition("1"), library => library .Permission(Permissions.ManageMedia) .Action("Index", "Admin", "OrchardCore.Media") .LocalNav() ) + .Add(S["Profiles"], S["Profiles"].PrefixPosition("5"), mediaProfiles => mediaProfiles + .Action("Index", "MediaProfiles", "OrchardCore.Media") + .Permission(Permissions.ManageMediaProfiles) + .LocalNav() + ) ); builder - .Add(S["Configuration"], configuration => configuration + .Add(S["Settings"], settings => settings .Add(S["Media"], S["Media"].PrefixPosition(), media => media - .Add(S["Media Options"], S["Media Options"].PrefixPosition(), options => options + .Add(S["Options"], S["Options"].PrefixPosition(), options => options .Action("Options", "Admin", "OrchardCore.Media") .Permission(Permissions.ViewMediaOptions) .LocalNav() ) - .Add(S["Media Profiles"], S["Media Profiles"].PrefixPosition(), mediaProfiles => mediaProfiles - .Action("Index", "MediaProfiles", "OrchardCore.Media") - .Permission(Permissions.ManageMediaProfiles) - .LocalNav() - ) ) ); diff --git a/src/OrchardCore.Modules/OrchardCore.Media/MediaCacheAdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Media/MediaCacheAdminMenu.cs index 1781878da51..d3f3cdfa043 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media/MediaCacheAdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Media/MediaCacheAdminMenu.cs @@ -14,10 +14,26 @@ public MediaCacheAdminMenu(IStringLocalizer stringLocalizer protected override ValueTask BuildAsync(NavigationBuilder builder) { + if (NavigationHelper.UseLegacyFormat()) + { + builder + .Add(S["Configuration"], configuration => configuration + .Add(S["Media"], S["Media"].PrefixPosition(), media => media + .Add(S["Media Cache"], S["Media Cache"].PrefixPosition(), cache => cache + .Action("Index", "MediaCache", "OrchardCore.Media") + .Permission(MediaCachePermissions.ManageAssetCache) + .LocalNav() + ) + ) + ); + + return ValueTask.CompletedTask; + } + builder - .Add(S["Configuration"], configuration => configuration + .Add(S["Settings"], settings => settings .Add(S["Media"], S["Media"].PrefixPosition(), media => media - .Add(S["Media Cache"], S["Media Cache"].PrefixPosition(), cache => cache + .Add(S["Cache"], S["Cache"].PrefixPosition(), cache => cache .Action("Index", "MediaCache", "OrchardCore.Media") .Permission(MediaCachePermissions.ManageAssetCache) .LocalNav() diff --git a/src/OrchardCore.Modules/OrchardCore.Media/Views/NavigationItemText-media.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.Media/Views/NavigationItemText-media.Id.cshtml index ea4fa84c645..9351960fa9a 100644 --- a/src/OrchardCore.Modules/OrchardCore.Media/Views/NavigationItemText-media.Id.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Media/Views/NavigationItemText-media.Id.cshtml @@ -1 +1,4 @@ -@T["Media"] + + + +@Model.Text diff --git a/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/AdminMenuAAD.cs b/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/AdminMenuAAD.cs index 3a54ebefd0c..44492f0fdfa 100644 --- a/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/AdminMenuAAD.cs +++ b/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/AdminMenuAAD.cs @@ -21,18 +21,39 @@ public AdminMenuAAD(IStringLocalizer stringLocalizer) protected override ValueTask BuildAsync(NavigationBuilder builder) { - builder - .Add(S["Security"], security => security - .Add(S["Authentication"], authentication => authentication - .Add(S["Microsoft Entra ID"], S["Microsoft Entra ID"].PrefixPosition(), entraId => entraId - .AddClass("microsoft-entra-id") - .Id("microsoft-entra-id") - .Action("Index", "Admin", _routeValues) - .Permission(Permissions.ManageMicrosoftAuthentication) - .LocalNav()) + if (NavigationHelper.UseLegacyFormat()) + { + builder + .Add(S["Security"], security => security + .Add(S["Authentication"], authentication => authentication + .Add(S["Microsoft Entra ID"], S["Microsoft Entra ID"].PrefixPosition(), entraId => entraId + .AddClass("microsoft-entra-id") + .Id("microsoftentraid") + .Action("Index", "Admin", _routeValues) + .Permission(Permissions.ManageMicrosoftAuthentication) + .LocalNav() + ) ) ); + return ValueTask.CompletedTask; + } + + builder + .Add(S["Settings"], settings => settings + .Add(S["Security"], S["Security"].PrefixPosition(), security => security + .Add(S["Authentication"], S["Authentication"].PrefixPosition(), authentication => authentication + .Add(S["Microsoft Entra ID"], S["Microsoft Entra ID"].PrefixPosition(), entraId => entraId + .AddClass("microsoft-entra-id") + .Id("microsoftentraid") + .Action("Index", "Admin", _routeValues) + .Permission(Permissions.ManageMicrosoftAuthentication) + .LocalNav() + ) + ) + ) + ); + return ValueTask.CompletedTask; } } diff --git a/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/AdminMenuMicrosoftAccount.cs b/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/AdminMenuMicrosoftAccount.cs index 5cbbcbe0558..781168c3f32 100644 --- a/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/AdminMenuMicrosoftAccount.cs +++ b/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/AdminMenuMicrosoftAccount.cs @@ -21,15 +21,35 @@ public AdminMenuMicrosoftAccount(IStringLocalizer str protected override ValueTask BuildAsync(NavigationBuilder builder) { + if (NavigationHelper.UseLegacyFormat()) + { + builder + .Add(S["Security"], security => security + .Add(S["Authentication"], authentication => authentication + .Add(S["Microsoft"], S["Microsoft"].PrefixPosition(), microsoft => microsoft + .AddClass("microsoft") + .Id("microsoft") + .Action("Index", "Admin", _routeValues) + .Permission(Permissions.ManageMicrosoftAuthentication) + .LocalNav() + ) + ) + ); + + return ValueTask.CompletedTask; + } + builder - .Add(S["Security"], security => security - .Add(S["Authentication"], authentication => authentication - .Add(S["Microsoft"], S["Microsoft"].PrefixPosition(), microsoft => microsoft - .AddClass("microsoft") - .Id("microsoft") - .Action("Index", "Admin", _routeValues) - .Permission(Permissions.ManageMicrosoftAuthentication) - .LocalNav() + .Add(S["Settings"], settings => settings + .Add(S["Security"], S["Security"].PrefixPosition(), security => security + .Add(S["Authentication"], S["Authentication"].PrefixPosition(), authentication => authentication + .Add(S["Microsoft"], S["Microsoft"].PrefixPosition(), microsoft => microsoft + .AddClass("microsoft") + .Id("microsoft") + .Action("Index", "Admin", _routeValues) + .Permission(Permissions.ManageMicrosoftAuthentication) + .LocalNav() + ) ) ) ); diff --git a/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Views/NavigationItemText-microsoft-entra-id.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Views/NavigationItemText-microsoft-entra-id.Id.cshtml deleted file mode 100644 index 5ad2d1c2c35..00000000000 --- a/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Views/NavigationItemText-microsoft-entra-id.Id.cshtml +++ /dev/null @@ -1 +0,0 @@ -@T["Microsoft Entra ID"] diff --git a/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Views/NavigationItemText-microsoft.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Views/NavigationItemText-microsoft.Id.cshtml index bd433c813fa..d04756aefc1 100644 --- a/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Views/NavigationItemText-microsoft.Id.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Views/NavigationItemText-microsoft.Id.cshtml @@ -1 +1,4 @@ -@T["Microsoft"] + + + +@Model.Text diff --git a/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Views/NavigationItemText-microsoftentraid.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Views/NavigationItemText-microsoftentraid.Id.cshtml new file mode 100644 index 00000000000..14efd39b6ad --- /dev/null +++ b/src/OrchardCore.Modules/OrchardCore.Microsoft.Authentication/Views/NavigationItemText-microsoftentraid.Id.cshtml @@ -0,0 +1,4 @@ + + + +@Model.Text diff --git a/src/OrchardCore.Modules/OrchardCore.OpenId/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.OpenId/AdminMenu.cs deleted file mode 100644 index 3f76c85c186..00000000000 --- a/src/OrchardCore.Modules/OrchardCore.OpenId/AdminMenu.cs +++ /dev/null @@ -1,90 +0,0 @@ -using System.Collections.Immutable; -using Microsoft.AspNetCore.Routing; -using Microsoft.Extensions.Localization; -using OrchardCore.Environment.Shell.Descriptor.Models; -using OrchardCore.Navigation; - -namespace OrchardCore.OpenId; - -public sealed class AdminMenu : AdminNavigationProvider -{ - private static readonly RouteValueDictionary _clientRouteValues = new() - { - { "area", "OrchardCore.Settings" }, - { "groupId", "OrchardCore.OpenId.Client" }, - }; - - private readonly ShellDescriptor _shellDescriptor; - - internal readonly IStringLocalizer S; - - public AdminMenu( - IStringLocalizer stringLocalizer, - ShellDescriptor shellDescriptor) - { - S = stringLocalizer; - _shellDescriptor = shellDescriptor; - } - - protected override ValueTask BuildAsync(NavigationBuilder builder) - { - builder - .Add(S["Security"], security => security - .Add(S["OpenID Connect"], S["OpenID Connect"].PrefixPosition(), category => - { - category.AddClass("openid").Id("openid"); - - var features = _shellDescriptor.Features.Select(feature => feature.Id).ToImmutableArray(); - if (features.Contains(OpenIdConstants.Features.Client) || - features.Contains(OpenIdConstants.Features.Server) || - features.Contains(OpenIdConstants.Features.Validation)) - { - category.Add(S["Settings"], "1", settings => - { - if (features.Contains(OpenIdConstants.Features.Client)) - { - settings.Add(S["Authentication client"], "1", client => client - .Action("Index", "Admin", _clientRouteValues) - .Permission(Permissions.ManageClientSettings) - .LocalNav()); - } - - if (features.Contains(OpenIdConstants.Features.Server)) - { - settings.Add(S["Authorization server"], "2", server => server - .Action("Index", "ServerConfiguration", "OrchardCore.OpenId") - .Permission(Permissions.ManageServerSettings) - .LocalNav()); - } - - if (features.Contains(OpenIdConstants.Features.Validation)) - { - settings.Add(S["Token validation"], "3", validation => validation - .Action("Index", "ValidationConfiguration", "OrchardCore.OpenId") - .Permission(Permissions.ManageValidationSettings) - .LocalNav()); - } - }); - } - - if (features.Contains(OpenIdConstants.Features.Management)) - { - category.Add(S["Management"], "2", management => - { - management.Add(S["Applications"], "1", applications => applications - .Action("Index", "Application", "OrchardCore.OpenId") - .Permission(Permissions.ManageApplications) - .LocalNav()); - - management.Add(S["Scopes"], "2", applications => applications - .Action("Index", "Scope", "OrchardCore.OpenId") - .Permission(Permissions.ManageScopes) - .LocalNav()); - }); - } - }) - ); - - return ValueTask.CompletedTask; - } -} diff --git a/src/OrchardCore.Modules/OrchardCore.OpenId/ClientAdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.OpenId/ClientAdminMenu.cs new file mode 100644 index 00000000000..93361c05771 --- /dev/null +++ b/src/OrchardCore.Modules/OrchardCore.OpenId/ClientAdminMenu.cs @@ -0,0 +1,60 @@ +using Microsoft.AspNetCore.Routing; +using Microsoft.Extensions.Localization; +using OrchardCore.Navigation; + +namespace OrchardCore.OpenId; + +public sealed class ClientAdminMenu : AdminNavigationProvider +{ + private static readonly RouteValueDictionary _clientRouteValues = new() + { + { "area", "OrchardCore.Settings" }, + { "groupId", "OrchardCore.OpenId.Client" }, + }; + + + internal readonly IStringLocalizer S; + + public ClientAdminMenu(IStringLocalizer stringLocalizer) + { + S = stringLocalizer; + } + + protected override ValueTask BuildAsync(NavigationBuilder builder) + { + if (NavigationHelper.UseLegacyFormat()) + { + builder + .Add(S["Security"], security => security + .Add(S["OpenID Connect"], S["OpenID Connect"].PrefixPosition(), openId => openId + .AddClass("openid") + .Id("openid") + .Add(S["Settings"], S["Settings"].PrefixPosition(), settings => settings + .Add(S["Authentication Client"], S["Authentication Client"].PrefixPosition(), client => client + .Action("Index", "Admin", _clientRouteValues) + .Permission(Permissions.ManageClientSettings) + .LocalNav() + ) + ) + ) + ); + + return ValueTask.CompletedTask; + } + + builder + .Add(S["Settings"], settings => settings + .Add(S["Security"], S["Security"].PrefixPosition(), security => security + .Add(S["OpenID Connect"], S["OpenID Connect"].PrefixPosition(), openId => openId + .Add(S["Authentication Client"], S["Authentication Client"].PrefixPosition(), client => client + .Action("Index", "Admin", _clientRouteValues) + .Permission(Permissions.ManageClientSettings) + .LocalNav() + ) + ) + ) + ); + + return ValueTask.CompletedTask; + } +} diff --git a/src/OrchardCore.Modules/OrchardCore.OpenId/ManagementAdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.OpenId/ManagementAdminMenu.cs new file mode 100644 index 00000000000..3e48ab93481 --- /dev/null +++ b/src/OrchardCore.Modules/OrchardCore.OpenId/ManagementAdminMenu.cs @@ -0,0 +1,62 @@ +using Microsoft.Extensions.Localization; +using OrchardCore.Navigation; + +namespace OrchardCore.OpenId; + +public sealed class ManagementAdminMenu : AdminNavigationProvider +{ + internal readonly IStringLocalizer S; + + public ManagementAdminMenu(IStringLocalizer stringLocalizer) + { + S = stringLocalizer; + } + + protected override ValueTask BuildAsync(NavigationBuilder builder) + { + if (NavigationHelper.UseLegacyFormat()) + { + builder + .Add(S["Security"], security => security + .Add(S["OpenID Connect"], S["OpenID Connect"].PrefixPosition(), openId => openId + .AddClass("openid") + .Id("openid") + .Add(S["Management"], S["Management"].PrefixPosition(), management => management + .Add(S["Applications"], S["Applications"].PrefixPosition(), applications => applications + .Action("Index", "Application", "OrchardCore.OpenId") + .Permission(Permissions.ManageApplications) + .LocalNav() + ) + .Add(S["Scopes"], S["Scopes"].PrefixPosition(), applications => applications + .Action("Index", "Scope", "OrchardCore.OpenId") + .Permission(Permissions.ManageScopes) + .LocalNav() + ) + ) + ) + ); + + return ValueTask.CompletedTask; + } + + builder + .Add(S["Access control"], accessControl => accessControl + .Add(S["OpenID Connect"], S["OpenID Connect"].PrefixPosition(), openId => openId + .AddClass("openid") + .Id("openid") + .Add(S["Applications"], S["Applications"].PrefixPosition(), applications => applications + .Action("Index", "Application", "OrchardCore.OpenId") + .Permission(Permissions.ManageApplications) + .LocalNav() + ) + .Add(S["Scopes"], S["Scopes"].PrefixPosition(), applications => applications + .Action("Index", "Scope", "OrchardCore.OpenId") + .Permission(Permissions.ManageScopes) + .LocalNav() + ) + ) + ); + + return ValueTask.CompletedTask; + } +} diff --git a/src/OrchardCore.Modules/OrchardCore.OpenId/ServerAdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.OpenId/ServerAdminMenu.cs new file mode 100644 index 00000000000..7338f657f27 --- /dev/null +++ b/src/OrchardCore.Modules/OrchardCore.OpenId/ServerAdminMenu.cs @@ -0,0 +1,54 @@ +using Microsoft.Extensions.Localization; +using OrchardCore.Navigation; + +namespace OrchardCore.OpenId; + +public sealed class ServerAdminMenu : AdminNavigationProvider +{ + internal readonly IStringLocalizer S; + + public ServerAdminMenu(IStringLocalizer stringLocalizer) + { + S = stringLocalizer; + } + + protected override ValueTask BuildAsync(NavigationBuilder builder) + { + if (NavigationHelper.UseLegacyFormat()) + { + builder + .Add(S["Security"], security => security + .Add(S["OpenID Connect"], S["OpenID Connect"].PrefixPosition(), openId => openId + .AddClass("openid") + .Id("openid") + .Add(S["Settings"], S["Settings"].PrefixPosition(), settings => settings + .Add(S["Authorization server"], S["Authorization server"].PrefixPosition(), server => server + .Action("Index", "ServerConfiguration", "OrchardCore.OpenId") + .Permission(Permissions.ManageServerSettings) + .LocalNav() + ) + ) + ) + ); + + return ValueTask.CompletedTask; + } + + builder + .Add(S["Settings"], settings => settings + .Add(S["Security"], S["Security"].PrefixPosition(), security => security + .Add(S["OpenID Connect"], S["OpenID Connect"].PrefixPosition(), openId => openId + .AddClass("openid") + .Id("openid") + .Add(S["Authorization server"], S["Authorization server"].PrefixPosition(), server => server + .Action("Index", "ServerConfiguration", "OrchardCore.OpenId") + .Permission(Permissions.ManageServerSettings) + .LocalNav() + ) + ) + ) + ); + + return ValueTask.CompletedTask; + } +} diff --git a/src/OrchardCore.Modules/OrchardCore.OpenId/Startup.cs b/src/OrchardCore.Modules/OrchardCore.OpenId/Startup.cs index 0a3e41050d5..2dfe4a6954f 100644 --- a/src/OrchardCore.Modules/OrchardCore.OpenId/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.OpenId/Startup.cs @@ -52,7 +52,7 @@ public override void ConfigureServices(IServiceCollection services) }); services.AddPermissionProvider(); - services.AddNavigationProvider(); + services.AddNavigationProvider(); } } @@ -61,6 +61,8 @@ public sealed class ClientStartup : StartupBase { public override void ConfigureServices(IServiceCollection services) { + services.AddNavigationProvider(); + services.TryAddSingleton(); // Note: the following services are registered using TryAddEnumerable to prevent duplicate registrations. @@ -88,6 +90,8 @@ public sealed class ServerStartup : StartupBase { public override void ConfigureServices(IServiceCollection services) { + services.AddNavigationProvider(); + services.AddOpenIddict() .AddServer(options => { @@ -206,6 +210,8 @@ public sealed class ValidationStartup : StartupBase { public override void ConfigureServices(IServiceCollection services) { + services.AddNavigationProvider(); + services.AddOpenIddict() .AddValidation(options => { diff --git a/src/OrchardCore.Modules/OrchardCore.OpenId/ValidationAdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.OpenId/ValidationAdminMenu.cs new file mode 100644 index 00000000000..56a38e42365 --- /dev/null +++ b/src/OrchardCore.Modules/OrchardCore.OpenId/ValidationAdminMenu.cs @@ -0,0 +1,52 @@ +using Microsoft.Extensions.Localization; +using OrchardCore.Navigation; + +namespace OrchardCore.OpenId; + +public sealed class ValidationAdminMenu : AdminNavigationProvider +{ + internal readonly IStringLocalizer S; + + public ValidationAdminMenu(IStringLocalizer stringLocalizer) + { + S = stringLocalizer; + } + + protected override ValueTask BuildAsync(NavigationBuilder builder) + { + if (NavigationHelper.UseLegacyFormat()) + { + builder + .Add(S["Security"], security => security + .Add(S["OpenID Connect"], S["OpenID Connect"].PrefixPosition(), openId => openId + .AddClass("openid") + .Id("openid") + .Add(S["Settings"], S["Settings"].PrefixPosition(), settings => settings + .Add(S["Token Validation"], S["Token Validation"].PrefixPosition(), validation => validation + .Action("Index", "ValidationConfiguration", "OrchardCore.OpenId") + .Permission(Permissions.ManageValidationSettings) + .LocalNav() + ) + ) + ) + ); + + return ValueTask.CompletedTask; + } + + builder + .Add(S["Settings"], settings => settings + .Add(S["Security"], S["Security"].PrefixPosition(), security => security + .Add(S["OpenID Connect"], S["OpenID Connect"].PrefixPosition(), openId => openId + .Add(S["Token Validation"], S["Token Validation"].PrefixPosition(), validation => validation + .Action("Index", "ValidationConfiguration", "OrchardCore.OpenId") + .Permission(Permissions.ManageValidationSettings) + .LocalNav() + ) + ) + ) + ); + + return ValueTask.CompletedTask; + } +} diff --git a/src/OrchardCore.Modules/OrchardCore.OpenId/Views/NavigationItemText-openid.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.OpenId/Views/NavigationItemText-openid.Id.cshtml index 37482c6e5d9..edf22b99fce 100644 --- a/src/OrchardCore.Modules/OrchardCore.OpenId/Views/NavigationItemText-openid.Id.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.OpenId/Views/NavigationItemText-openid.Id.cshtml @@ -1,4 +1,4 @@ -@T["OpenID Connect"] +@Model.Text diff --git a/src/OrchardCore.Modules/OrchardCore.Queries/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Queries/AdminMenu.cs index b020bd83075..cc267176fa1 100644 --- a/src/OrchardCore.Modules/OrchardCore.Queries/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Queries/AdminMenu.cs @@ -19,7 +19,7 @@ protected override ValueTask BuildAsync(NavigationBuilder builder) .AddClass("search") .Id("search") .Add(S["Queries"], S["Queries"].PrefixPosition(), queries => queries - .Add(S["All queries"], "1", allQueries => allQueries + .Add(S["All Queries"], "1", allQueries => allQueries .Action("Index", "Admin", "OrchardCore.Queries") .AddClass("searchallqueries") .Id("searchallqueries") diff --git a/src/OrchardCore.Modules/OrchardCore.Queries/Sql/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Queries/Sql/AdminMenu.cs index bd02f352d8e..fb4c50fd271 100644 --- a/src/OrchardCore.Modules/OrchardCore.Queries/Sql/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Queries/Sql/AdminMenu.cs @@ -15,7 +15,7 @@ public AdminMenu(IStringLocalizer stringLocalizer) protected override ValueTask BuildAsync(NavigationBuilder builder) { builder - .Add(S["Search"], search => search + .Add(S["Search"], NavigationConstants.AdminMenuSearchPosition, search => search .Add(S["Queries"], S["Queries"].PrefixPosition(), queries => queries .Add(S["Run SQL Query"], S["Run SQL Query"].PrefixPosition(), sql => sql .Action("Query", "Admin", "OrchardCore.Queries") diff --git a/src/OrchardCore.Modules/OrchardCore.Queries/Views/NavigationItemText-search.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.Queries/Views/NavigationItemText-search.Id.cshtml index 1bca0499158..e3e22dfbe14 100644 --- a/src/OrchardCore.Modules/OrchardCore.Queries/Views/NavigationItemText-search.Id.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Queries/Views/NavigationItemText-search.Id.cshtml @@ -1,4 +1,4 @@ -@T["Search"] +@Model.Text diff --git a/src/OrchardCore.Modules/OrchardCore.ReCaptcha/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.ReCaptcha/AdminMenu.cs index 0e02386740d..483e1c911ef 100644 --- a/src/OrchardCore.Modules/OrchardCore.ReCaptcha/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.ReCaptcha/AdminMenu.cs @@ -22,9 +22,25 @@ public AdminMenu(IStringLocalizer stringLocalizer) protected override ValueTask BuildAsync(NavigationBuilder builder) { + if (NavigationHelper.UseLegacyFormat()) + { + builder + .Add(S["Security"], security => security + .Add(S["Settings"], S["Settings"].PrefixPosition(), settings => settings + .Add(S["reCaptcha"], S["reCaptcha"].PrefixPosition(), reCaptcha => reCaptcha + .Permission(Permissions.ManageReCaptchaSettings) + .Action("Index", "Admin", _routeValues) + .LocalNav() + ) + ) + ); + + return ValueTask.CompletedTask; + } + builder - .Add(S["Security"], security => security - .Add(S["Settings"], settings => settings + .Add(S["Settings"], settings => settings + .Add(S["Security"], S["Security"].PrefixPosition(), security => security .Add(S["reCaptcha"], S["reCaptcha"].PrefixPosition(), reCaptcha => reCaptcha .Permission(Permissions.ManageReCaptchaSettings) .Action("Index", "Admin", _routeValues) diff --git a/src/OrchardCore.Modules/OrchardCore.Recipes/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Recipes/AdminMenu.cs index 447e726db00..0e69cedd702 100644 --- a/src/OrchardCore.Modules/OrchardCore.Recipes/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Recipes/AdminMenu.cs @@ -14,8 +14,24 @@ public AdminMenu(IStringLocalizer stringLocalizer) protected override ValueTask BuildAsync(NavigationBuilder builder) { + if (NavigationHelper.UseLegacyFormat()) + { + builder + .Add(S["Configuration"], configuration => configuration + .Add(S["Recipes"], S["Recipes"].PrefixPosition(), recipes => recipes + .AddClass("recipes") + .Id("recipes") + .Permission(RecipePermissions.ManageRecipes) + .Action("Index", "Admin", "OrchardCore.Recipes") + .LocalNav() + ) + ); + + return ValueTask.CompletedTask; + } + builder - .Add(S["Configuration"], configuration => configuration + .Add(S["Tools"], tools => tools .Add(S["Recipes"], S["Recipes"].PrefixPosition(), recipes => recipes .AddClass("recipes") .Id("recipes") diff --git a/src/OrchardCore.Modules/OrchardCore.ReverseProxy/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.ReverseProxy/AdminMenu.cs index 7d305565eab..8fb04d07f69 100644 --- a/src/OrchardCore.Modules/OrchardCore.ReverseProxy/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.ReverseProxy/AdminMenu.cs @@ -22,12 +22,30 @@ public AdminMenu(IStringLocalizer stringLocalizer) protected override ValueTask BuildAsync(NavigationBuilder builder) { + if (NavigationHelper.UseLegacyFormat()) + { + builder + .Add(S["Configuration"], configuration => configuration + .Add(S["Settings"], settings => settings + .Add(S["Reverse Proxy"], S["Reverse Proxy"].PrefixPosition(), entry => entry + .AddClass("reverseproxy") + .Id("reverseproxy") + .Action("Index", "Admin", _routeValues) + .Permission(Permissions.ManageReverseProxySettings) + .LocalNav() + ) + ) + ); + + return ValueTask.CompletedTask; + } + builder - .Add(S["Configuration"], configuration => configuration - .Add(S["Settings"], settings => settings - .Add(S["Reverse Proxy"], S["Reverse Proxy"].PrefixPosition(), entry => entry - .AddClass("reverseproxy") - .Id("reverseproxy") + .Add(S["Settings"], settings => settings + .Add(S["Security"], S["Security"].PrefixPosition(), security => security + .Add(S["Reverse Proxy"], S["Reverse Proxy"].PrefixPosition(), proxy => proxy + .AddClass("reverseproxy") + .Id("reverseproxy") .Action("Index", "Admin", _routeValues) .Permission(Permissions.ManageReverseProxySettings) .LocalNav() diff --git a/src/OrchardCore.Modules/OrchardCore.ReverseProxy/Views/NavigationItemText-reverseproxy.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.ReverseProxy/Views/NavigationItemText-reverseproxy.Id.cshtml index 0f8bb2b96e9..67b540457c5 100644 --- a/src/OrchardCore.Modules/OrchardCore.ReverseProxy/Views/NavigationItemText-reverseproxy.Id.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.ReverseProxy/Views/NavigationItemText-reverseproxy.Id.cshtml @@ -1 +1,14 @@ -@T["Reverse Proxy"] +@using OrchardCore.Navigation +@if (NavigationHelper.UseLegacyFormat()) +{ + + + + @Model.Text + + return; +} + + + +@Model.Text diff --git a/src/OrchardCore.Modules/OrchardCore.Roles/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Roles/AdminMenu.cs index 607369ab16f..a85f5f3680f 100644 --- a/src/OrchardCore.Modules/OrchardCore.Roles/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Roles/AdminMenu.cs @@ -14,8 +14,23 @@ public AdminMenu(IStringLocalizer stringLocalizer) protected override ValueTask BuildAsync(NavigationBuilder builder) { + if (NavigationHelper.UseLegacyFormat()) + { + builder + .Add(S["Security"], security => security + .Add(S["Roles"], S["Roles"].PrefixPosition(), roles => roles + .AddClass("roles").Id("roles") + .Action("Index", "Admin", "OrchardCore.Roles") + .Permission(CommonPermissions.ManageRoles) + .LocalNav() + ) + ); + + return ValueTask.CompletedTask; + } + builder - .Add(S["Security"], security => security + .Add(S["Access control"], accessControl => accessControl .Add(S["Roles"], S["Roles"].PrefixPosition(), roles => roles .AddClass("roles").Id("roles") .Action("Index", "Admin", "OrchardCore.Roles") diff --git a/src/OrchardCore.Modules/OrchardCore.Roles/Views/NavigationItemText-roles.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.Roles/Views/NavigationItemText-roles.Id.cshtml index e01822d44f2..eba6d71aa9f 100644 --- a/src/OrchardCore.Modules/OrchardCore.Roles/Views/NavigationItemText-roles.Id.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Roles/Views/NavigationItemText-roles.Id.cshtml @@ -1 +1,4 @@ -@T["Roles"] + + + +@Model.Text diff --git a/src/OrchardCore.Modules/OrchardCore.Search.AzureAI/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Search.AzureAI/AdminMenu.cs index f83d396465e..e065968eb0a 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.AzureAI/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search.AzureAI/AdminMenu.cs @@ -1,3 +1,4 @@ +using Microsoft.AspNetCore.Routing; using Microsoft.Extensions.Localization; using Microsoft.Extensions.Options; using OrchardCore.Navigation; @@ -8,6 +9,12 @@ namespace OrchardCore.Search.AzureAI; public sealed class AdminMenu : AdminNavigationProvider { + private static readonly RouteValueDictionary _routeValues = new() + { + { "area", "OrchardCore.Settings" }, + { "groupId", AzureAISearchDefaultSettingsDisplayDriver.GroupId}, + }; + private readonly AzureAISearchDefaultOptions _azureAISearchSettings; internal readonly IStringLocalizer S; @@ -37,22 +44,40 @@ protected override ValueTask BuildAsync(NavigationBuilder builder) ) ); - if (!_azureAISearchSettings.DisableUIConfiguration) + if (_azureAISearchSettings.DisableUIConfiguration) + { + return ValueTask.CompletedTask; + } + + if (NavigationHelper.UseLegacyFormat()) { builder - .Add(S["Configuration"], configuration => configuration - .Add(S["Settings"], settings => settings - .Add(S["Azure AI Search"], S["Azure AI Search"].PrefixPosition(), azureAISearch => azureAISearch - .AddClass("azure-ai-search") - .Id("azureaisearch") - .Action("Index", "Admin", new { area = "OrchardCore.Settings", groupId = AzureAISearchDefaultSettingsDisplayDriver.GroupId }) - .Permission(AzureAISearchIndexPermissionHelper.ManageAzureAISearchIndexes) - .LocalNav() - ) - ) - ); + .Add(S["Configuration"], configuration => configuration + .Add(S["Settings"], settings => settings + .Add(S["Azure AI Search"], S["Azure AI Search"].PrefixPosition(), azureAISearch => azureAISearch + .AddClass("azure-ai-search") + .Id("azureaisearch") + .Action("Index", "Admin", new { area = "OrchardCore.Settings", groupId = AzureAISearchDefaultSettingsDisplayDriver.GroupId }) + .Permission(AzureAISearchIndexPermissionHelper.ManageAzureAISearchIndexes) + .LocalNav() + ) + ) + ); + + return ValueTask.CompletedTask; } + builder + .Add(S["Settings"], settings => settings + .Add(S["Azure AI Search"], S["Azure AI Search"].PrefixPosition(), azureAISearch => azureAISearch + .AddClass("azure-ai-search") + .Id("azureaisearch") + .Action("Index", "Admin", _routeValues) + .Permission(AzureAISearchIndexPermissionHelper.ManageAzureAISearchIndexes) + .LocalNav() + ) + ); + return ValueTask.CompletedTask; } } diff --git a/src/OrchardCore.Modules/OrchardCore.Search.AzureAI/Views/NavigationItemText-azureaisearch.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.Search.AzureAI/Views/NavigationItemText-azureaisearch.Id.cshtml index 499d5e578cb..d04756aefc1 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.AzureAI/Views/NavigationItemText-azureaisearch.Id.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Search.AzureAI/Views/NavigationItemText-azureaisearch.Id.cshtml @@ -1,4 +1,4 @@ -@T["Azure AI Search"] +@Model.Text 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 index 1bca0499158..e3e22dfbe14 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.AzureAI/Views/NavigationItemText-search.Id.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Search.AzureAI/Views/NavigationItemText-search.Id.cshtml @@ -1,4 +1,4 @@ -@T["Search"] +@Model.Text diff --git a/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Views/NavigationItemText-Elasticsearch.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Views/NavigationItemText-Elasticsearch.Id.cshtml index e209899726a..c84626c12c0 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Views/NavigationItemText-Elasticsearch.Id.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Views/NavigationItemText-Elasticsearch.Id.cshtml @@ -1 +1,4 @@ -@T["Search"] + + + +@Model.Text 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 index 1bca0499158..e3e22dfbe14 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Views/NavigationItemText-search.Id.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Search.Elasticsearch/Views/NavigationItemText-search.Id.cshtml @@ -1,4 +1,4 @@ -@T["Search"] +@Model.Text 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 1bca0499158..e3e22dfbe14 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,4 +1,4 @@ -@T["Search"] +@Model.Text diff --git a/src/OrchardCore.Modules/OrchardCore.Search/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Search/AdminMenu.cs index f3176267655..f3f346e8a77 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Search/AdminMenu.cs @@ -21,16 +21,34 @@ public AdminMenu(IStringLocalizer stringLocalizer) protected override ValueTask BuildAsync(NavigationBuilder builder) { + if (NavigationHelper.UseLegacyFormat()) + { + builder + .Add(S["Search"], NavigationConstants.AdminMenuSearchPosition, search => search + .AddClass("search") + .Id("search") + .Add(S["Settings"], S["Settings"].PrefixPosition(), settings => settings + .Action("Index", "Admin", _routeValues) + .AddClass("searchsettings") + .Id("searchsettings") + .Permission(Permissions.ManageSearchSettings) + .LocalNav() + ) + ); + + return ValueTask.CompletedTask; + } + builder - .Add(S["Search"], NavigationConstants.AdminMenuSearchPosition, search => search - .AddClass("search") - .Id("search") - .Add(S["Settings"], S["Settings"].PrefixPosition(), settings => settings - .Action("Index", "Admin", _routeValues) - .AddClass("searchsettings") - .Id("searchsettings") - .Permission(Permissions.ManageSearchSettings) - .LocalNav() + .Add(S["Settings"], settings => settings + .Add(S["Search"], S["Search"].PrefixPosition(), search => search + .Add(S["Site Search"], S["Site Search"].PrefixPosition(), search => search + .Action("Index", "Admin", _routeValues) + .AddClass("searchsettings") + .Id("searchsettings") + .Permission(Permissions.ManageSearchSettings) + .LocalNav() + ) ) ); diff --git a/src/OrchardCore.Modules/OrchardCore.Search/Views/NavigationItemText-search.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.Search/Views/NavigationItemText-search.Id.cshtml index 1bca0499158..e3e22dfbe14 100644 --- a/src/OrchardCore.Modules/OrchardCore.Search/Views/NavigationItemText-search.Id.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Search/Views/NavigationItemText-search.Id.cshtml @@ -1,4 +1,4 @@ -@T["Search"] +@Model.Text diff --git a/src/OrchardCore.Modules/OrchardCore.Security/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Security/AdminMenu.cs index 2bc24e8b352..fbb5c41c539 100644 --- a/src/OrchardCore.Modules/OrchardCore.Security/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Security/AdminMenu.cs @@ -11,7 +11,6 @@ public sealed class AdminMenu : AdminNavigationProvider { { "area", "OrchardCore.Settings" }, { "groupId", SecuritySettingsDisplayDriver.GroupId }, - }; internal readonly IStringLocalizer S; @@ -23,11 +22,27 @@ public AdminMenu(IStringLocalizer stringLocalizer) protected override ValueTask BuildAsync(NavigationBuilder builder) { + if (NavigationHelper.UseLegacyFormat()) + { + builder + .Add(S["Security"], NavigationConstants.AdminMenuSecurityPosition, security => security + .AddClass("security") + .Id("security") + .Add(S["Settings"], settings => settings + .Add(S["Security Headers"], S["Security Headers"].PrefixPosition(), headers => headers + .Permission(SecurityPermissions.ManageSecurityHeadersSettings) + .Action("Index", "Admin", _routeValues) + .LocalNav() + ) + ) + ); + + return ValueTask.CompletedTask; + } + builder - .Add(S["Security"], NavigationConstants.AdminMenuSecurityPosition, security => security - .AddClass("security") - .Id("security") - .Add(S["Settings"], settings => settings + .Add(S["Settings"], settings => settings + .Add(S["Security"], S["Security"].PrefixPosition(), security => security .Add(S["Security Headers"], S["Security Headers"].PrefixPosition(), headers => headers .Permission(SecurityPermissions.ManageSecurityHeadersSettings) .Action("Index", "Admin", _routeValues) diff --git a/src/OrchardCore.Modules/OrchardCore.Seo/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Seo/AdminMenu.cs index 15e06e663da..def1d069a62 100644 --- a/src/OrchardCore.Modules/OrchardCore.Seo/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Seo/AdminMenu.cs @@ -21,15 +21,35 @@ public AdminMenu(IStringLocalizer stringLocalizer) protected override ValueTask BuildAsync(NavigationBuilder builder) { + if (NavigationHelper.UseLegacyFormat()) + { + builder + .Add(S["Configuration"], configuration => configuration + .Add(S["Settings"], settings => settings + .Add(S["SEO"], S["SEO"].PrefixPosition(), seo => seo + .AddClass("seo") + .Id("seo") + .Action("Index", "Admin", _routeValues) + .Permission(SeoConstants.ManageSeoSettings) + .LocalNav() + ) + ) + ); + + return ValueTask.CompletedTask; + } + builder - .Add(S["Configuration"], configuration => configuration - .Add(S["Settings"], settings => settings - .Add(S["SEO"], S["SEO"].PrefixPosition(), seo => seo - .AddClass("seo") - .Id("seo") - .Action("Index", "Admin", _routeValues) - .Permission(SeoConstants.ManageSeoSettings) - .LocalNav() + .Add(S["Settings"], settings => settings + .Add(S["Search"], S["Search"].PrefixPosition(), search => search + .Add(S["Search Engine Optimization"], S["Search Engine Optimization"].PrefixPosition(), seo => seo + .AddClass("seo") + .Id("seo") + .Add(S["Robots"], S["Robots"].PrefixPosition(), robots => robots + .Action("Index", "Admin", _routeValues) + .Permission(SeoConstants.ManageSeoSettings) + .LocalNav() + ) ) ) ); diff --git a/src/OrchardCore.Modules/OrchardCore.Settings/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Settings/AdminMenu.cs index aefaaf97b2a..800ba3944ba 100644 --- a/src/OrchardCore.Modules/OrchardCore.Settings/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Settings/AdminMenu.cs @@ -22,20 +22,43 @@ public AdminMenu(IStringLocalizer stringLocalizer) protected override ValueTask BuildAsync(NavigationBuilder builder) { + + if (NavigationHelper.UseLegacyFormat()) + { + builder + .Add(S["Configuration"], NavigationConstants.AdminMenuConfigurationPosition, configuration => configuration + .AddClass("menu-configuration") + .Id("configuration") + .Add(S["Settings"], "1", settings => settings + .Add(S["General"], "1", entry => entry + .AddClass("general") + .Id("general") + .Action("Index", "Admin", _routeValues) + .Permission(Permissions.ManageGroupSettings) + .LocalNav() + ), + priority: 1) + ); + + return ValueTask.CompletedTask; + } + builder - .Add(S["Configuration"], NavigationConstants.AdminMenuConfigurationPosition, configuration => configuration - .AddClass("menu-configuration") - .Id("configuration") - .Add(S["Settings"], "1", settings => settings - .Add(S["General"], "1", entry => entry - .AddClass("general") - .Id("general") - .Action("Index", "Admin", _routeValues) - .Permission(Permissions.ManageGroupSettings) - .LocalNav() - ), - priority: 1) - ); + .Add(S["Tools"], "after.50", tools => tools + .Id("tools") + .AddClass("tools") + , priority: 1) + .Add(S["Settings"], "after.100", settings => settings + .Id("settings") + .AddClass("settings") + .Add(S["General"], "before", general => general + .AddClass("general") + .Id("general") + .Action("Index", "Admin", _routeValues) + .Permission(Permissions.ManageGroupSettings) + .LocalNav() + ) + , priority: 1); return ValueTask.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.Settings/Views/NavigationItemText-configuration.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.Settings/Views/NavigationItemText-configuration.Id.cshtml index 098ebd66a52..58fd3708090 100644 --- a/src/OrchardCore.Modules/OrchardCore.Settings/Views/NavigationItemText-configuration.Id.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Settings/Views/NavigationItemText-configuration.Id.cshtml @@ -1 +1,4 @@ -@T["Configuration"] + + + +@Model.Text diff --git a/src/OrchardCore.Modules/OrchardCore.Settings/Views/NavigationItemText-general.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.Settings/Views/NavigationItemText-general.Id.cshtml index 353d4a92a75..f9595c25d4d 100644 --- a/src/OrchardCore.Modules/OrchardCore.Settings/Views/NavigationItemText-general.Id.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Settings/Views/NavigationItemText-general.Id.cshtml @@ -1 +1,15 @@ -@T["General"] +@using OrchardCore.Navigation + +@if (NavigationHelper.UseLegacyFormat()) +{ + + + + @Model.Text + + return; +} + + + +@Model.Text diff --git a/src/OrchardCore.Modules/OrchardCore.Settings/Views/NavigationItemText-settings.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.Settings/Views/NavigationItemText-settings.Id.cshtml new file mode 100644 index 00000000000..58fd3708090 --- /dev/null +++ b/src/OrchardCore.Modules/OrchardCore.Settings/Views/NavigationItemText-settings.Id.cshtml @@ -0,0 +1,4 @@ + + + +@Model.Text diff --git a/src/OrchardCore.Modules/OrchardCore.Settings/Views/NavigationItemText-tools.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.Settings/Views/NavigationItemText-tools.Id.cshtml new file mode 100644 index 00000000000..bead4f789e9 --- /dev/null +++ b/src/OrchardCore.Modules/OrchardCore.Settings/Views/NavigationItemText-tools.Id.cshtml @@ -0,0 +1,4 @@ + + + +@Model.Text diff --git a/src/OrchardCore.Modules/OrchardCore.Sitemaps/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Sitemaps/AdminMenu.cs index aa152c86415..134725b9a45 100644 --- a/src/OrchardCore.Modules/OrchardCore.Sitemaps/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Sitemaps/AdminMenu.cs @@ -14,9 +14,32 @@ public AdminMenu(IStringLocalizer stringLocalizer) protected override ValueTask BuildAsync(NavigationBuilder builder) { + if (NavigationHelper.UseLegacyFormat()) + { + builder + .Add(S["Configuration"], configuration => configuration + .Add(S["SEO"], S["SEO"].PrefixPosition(), seo => seo + .Permission(Permissions.ManageSitemaps) + .Add(S["Sitemaps"], S["Sitemaps"].PrefixPosition("1"), sitemaps => sitemaps + .Action("List", "Admin", "OrchardCore.Sitemaps") + .LocalNav() + ) + .Add(S["Sitemap Indexes"], S["Sitemap Indexes"].PrefixPosition("2"), indexes => indexes + .Action("List", "SitemapIndex", "OrchardCore.Sitemaps") + .LocalNav() + ) + .Add(S["Sitemaps Cache"], S["Sitemaps Cache"].PrefixPosition("3"), cache => cache + .Action("List", "SitemapCache", "OrchardCore.Sitemaps") + .LocalNav() + ) + ) + ); + + return ValueTask.CompletedTask; + } builder - .Add(S["Configuration"], configuration => configuration - .Add(S["SEO"], S["SEO"].PrefixPosition(), seo => seo + .Add(S["Tools"], tools => tools + .Add(S["Search Engine Optimization"], S["Search Engine Optimization"].PrefixPosition(), seo => seo .Permission(Permissions.ManageSitemaps) .Add(S["Sitemaps"], S["Sitemaps"].PrefixPosition("1"), sitemaps => sitemaps .Action("List", "Admin", "OrchardCore.Sitemaps") diff --git a/src/OrchardCore.Modules/OrchardCore.Sms/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Sms/AdminMenu.cs index da32ab0d607..e430080ee34 100644 --- a/src/OrchardCore.Modules/OrchardCore.Sms/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Sms/AdminMenu.cs @@ -23,9 +23,34 @@ public AdminMenu(IStringLocalizer stringLocalizer) protected override ValueTask BuildAsync(NavigationBuilder builder) { + if (NavigationHelper.UseLegacyFormat()) + { + builder + .Add(S["Configuration"], configuration => configuration + .Add(S["Settings"], settings => settings + .Add(S["SMS"], S["SMS"].PrefixPosition(), sms => sms + .AddClass("sms") + .Id("sms") + .Action("Index", "Admin", _routeValues) + .Permission(SmsPermissions.ManageSmsSettings) + .LocalNav() + ) + .Add(S["SMS Test"], S["SMS Test"].PrefixPosition(), sms => sms + .AddClass("smstest") + .Id("smstest") + .Action(nameof(AdminController.Test), typeof(AdminController).ControllerName(), "OrchardCore.Sms") + .Permission(SmsPermissions.ManageSmsSettings) + .LocalNav() + ) + ) + ); + + return ValueTask.CompletedTask; + } + builder - .Add(S["Configuration"], configuration => configuration - .Add(S["Settings"], settings => settings + .Add(S["Settings"], settings => settings + .Add(S["Communication"], S["Communication"].PrefixPosition(), communication => communication .Add(S["SMS"], S["SMS"].PrefixPosition(), sms => sms .AddClass("sms") .Id("sms") @@ -33,6 +58,10 @@ protected override ValueTask BuildAsync(NavigationBuilder builder) .Permission(SmsPermissions.ManageSmsSettings) .LocalNav() ) + ) + ) + .Add(S["Tools"], tools => tools + .Add(S["Testing"], S["Testing"].PrefixPosition(), testing => testing .Add(S["SMS Test"], S["SMS Test"].PrefixPosition(), sms => sms .AddClass("smstest") .Id("smstest") diff --git a/src/OrchardCore.Modules/OrchardCore.Sms/Views/NavigationItemText-sms.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.Sms/Views/NavigationItemText-sms.Id.cshtml index fadfbabe7a8..dcb18020c7c 100644 --- a/src/OrchardCore.Modules/OrchardCore.Sms/Views/NavigationItemText-sms.Id.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Sms/Views/NavigationItemText-sms.Id.cshtml @@ -1,4 +1,4 @@ -@T["SMS"] +@Model.Text diff --git a/src/OrchardCore.Modules/OrchardCore.Taxonomies/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Taxonomies/AdminMenu.cs index d66fccb078f..cc3ac7d3620 100644 --- a/src/OrchardCore.Modules/OrchardCore.Taxonomies/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Taxonomies/AdminMenu.cs @@ -22,7 +22,9 @@ public AdminMenu(IStringLocalizer stringLocalizer) protected override ValueTask BuildAsync(NavigationBuilder builder) { - builder + if (NavigationHelper.UseLegacyFormat()) + { + builder .Add(S["Configuration"], configuration => configuration .Add(S["Settings"], "1", settings => settings .Add(S["Taxonomy Filters"], S["Taxonomy Filters"].PrefixPosition(), filters => filters @@ -35,6 +37,20 @@ protected override ValueTask BuildAsync(NavigationBuilder builder) ) ); + return ValueTask.CompletedTask; + } + + builder + .Add(S["Settings"], settings => settings + .Add(S["Taxonomy Filters"], S["Taxonomy Filters"].PrefixPosition(), filters => filters + .AddClass("taxonomyfilters") + .Id("taxonomyfilters") + .Permission(Permissions.ManageTaxonomies) + .Action("Index", "Admin", _routeValues) + .LocalNav() + ) + ); + return ValueTask.CompletedTask; } } diff --git a/src/OrchardCore.Modules/OrchardCore.Taxonomies/Views/NavigationItemText-taxonomyfilters.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.Taxonomies/Views/NavigationItemText-taxonomyfilters.Id.cshtml index ef090278a99..84353dc2501 100644 --- a/src/OrchardCore.Modules/OrchardCore.Taxonomies/Views/NavigationItemText-taxonomyfilters.Id.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Taxonomies/Views/NavigationItemText-taxonomyfilters.Id.cshtml @@ -1 +1,15 @@ -@T["Taxonomy Filters"] +@using OrchardCore.Navigation + +@if (NavigationHelper.UseLegacyFormat()) +{ + + + + @Model.Text + + return; +} + + + +@Model.Text diff --git a/src/OrchardCore.Modules/OrchardCore.Tenants/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Tenants/AdminMenu.cs index 2a65a73a7ee..d83190e5574 100644 --- a/src/OrchardCore.Modules/OrchardCore.Tenants/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Tenants/AdminMenu.cs @@ -27,7 +27,7 @@ protected override ValueTask BuildAsync(NavigationBuilder builder) } builder - .Add(S["Multi-Tenancy"], "after", tenancy => tenancy + .Add(S["Multi-Tenancy"], "after.25", tenancy => tenancy .AddClass("menu-multitenancy") .Id("multitenancy") .Add(S["Tenants"], S["Tenants"].PrefixPosition(), tenant => tenant diff --git a/src/OrchardCore.Modules/OrchardCore.Tenants/Views/NavigationItemText-design.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.Tenants/Views/NavigationItemText-design.Id.cshtml index 534939c85af..58fd3708090 100644 --- a/src/OrchardCore.Modules/OrchardCore.Tenants/Views/NavigationItemText-design.Id.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Tenants/Views/NavigationItemText-design.Id.cshtml @@ -1,4 +1,4 @@ -@T["Design"] +@Model.Text diff --git a/src/OrchardCore.Modules/OrchardCore.Themes/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Themes/AdminMenu.cs index a792d6924c5..3e8338ac4f0 100644 --- a/src/OrchardCore.Modules/OrchardCore.Themes/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Themes/AdminMenu.cs @@ -16,13 +16,14 @@ protected override ValueTask BuildAsync(NavigationBuilder builder) { builder .Add(S["Design"], NavigationConstants.AdminMenuDesignPosition, design => design - .AddClass("themes").Id("themes") + .AddClass("design") + .Id("design") .Add(S["Themes"], S["Themes"].PrefixPosition(), themes => themes .Action("Index", "Admin", "OrchardCore.Themes") .Permission(Permissions.ApplyTheme) .LocalNav() ) - ); + , priority: 1); return ValueTask.CompletedTask; } diff --git a/src/OrchardCore.Modules/OrchardCore.Themes/Views/NavigationItemText-design.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.Themes/Views/NavigationItemText-design.Id.cshtml new file mode 100644 index 00000000000..fe929ac2430 --- /dev/null +++ b/src/OrchardCore.Modules/OrchardCore.Themes/Views/NavigationItemText-design.Id.cshtml @@ -0,0 +1,4 @@ + + + +@Model.Text diff --git a/src/OrchardCore.Modules/OrchardCore.Themes/Views/NavigationItemText-themes.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.Themes/Views/NavigationItemText-themes.Id.cshtml deleted file mode 100644 index 6d96141b7d4..00000000000 --- a/src/OrchardCore.Modules/OrchardCore.Themes/Views/NavigationItemText-themes.Id.cshtml +++ /dev/null @@ -1 +0,0 @@ -@T["Design"] diff --git a/src/OrchardCore.Modules/OrchardCore.Twitter/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Twitter/AdminMenu.cs index abbd61cc8b2..c22a4d90d27 100644 --- a/src/OrchardCore.Modules/OrchardCore.Twitter/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Twitter/AdminMenu.cs @@ -21,7 +21,9 @@ public AdminMenu(IStringLocalizer stringLocalizer) protected override ValueTask BuildAsync(NavigationBuilder builder) { - builder + if (NavigationHelper.UseLegacyFormat()) + { + builder .Add(S["Configuration"], configuration => configuration .Add(S["Settings"], settings => settings .Add(S["X (Twitter)"], S["X (Twitter)"].PrefixPosition(), twitter => twitter @@ -33,6 +35,21 @@ protected override ValueTask BuildAsync(NavigationBuilder builder) ) ); + return ValueTask.CompletedTask; + } + + builder + .Add(S["Settings"], settings => settings + .Add(S["Integrations"], S["Integrations"].PrefixPosition(), integrations => integrations + .Add(S["X (Twitter)"], S["X (Twitter)"].PrefixPosition(), twitter => twitter + .AddClass("twitter").Id("twitter") + .Action("Index", "Admin", _routeValues) + .Permission(Permissions.ManageTwitter) + .LocalNav() + ) + ) + ); + return ValueTask.CompletedTask; } } diff --git a/src/OrchardCore.Modules/OrchardCore.Twitter/AdminMenuSignin.cs b/src/OrchardCore.Modules/OrchardCore.Twitter/AdminMenuSignin.cs index 071074d46e4..fd38cefd0c1 100644 --- a/src/OrchardCore.Modules/OrchardCore.Twitter/AdminMenuSignin.cs +++ b/src/OrchardCore.Modules/OrchardCore.Twitter/AdminMenuSignin.cs @@ -4,7 +4,7 @@ namespace OrchardCore.Twitter; -public sealed class AdminMenuSignin : AdminNavigationProvider +public sealed class AdminMenuSignIn : AdminNavigationProvider { private static readonly RouteValueDictionary _routeValues = new() { @@ -14,22 +14,43 @@ public sealed class AdminMenuSignin : AdminNavigationProvider internal readonly IStringLocalizer S; - public AdminMenuSignin(IStringLocalizer stringLocalizer) + public AdminMenuSignIn(IStringLocalizer stringLocalizer) { S = stringLocalizer; } protected override ValueTask BuildAsync(NavigationBuilder builder) { + if (NavigationHelper.UseLegacyFormat()) + { + builder + .Add(S["Security"], security => security + .Add(S["Authentication"], authentication => authentication + + .Add(S["Sign In with X (Twitter)"], S["Sign In with X (Twitter)"].PrefixPosition(), twitter => twitter + .AddClass("twitter") + .Id("twitter") + .Action("Index", "Admin", _routeValues) + .Permission(Permissions.ManageTwitterSignin) + .LocalNav()) + ) + ); + + return ValueTask.CompletedTask; + } + builder - .Add(S["Security"], security => security - .Add(S["Authentication"], authentication => authentication - .Add(S["Sign in with X (Twitter)"], S["Sign in with X (Twitter)"].PrefixPosition(), twitter => twitter - .AddClass("twitter") - .Id("twitter") - .Action("Index", "Admin", _routeValues) - .Permission(Permissions.ManageTwitterSignin) - .LocalNav()) + .Add(S["Settings"], settings => settings + .Add(S["Security"], S["Security"].PrefixPosition(), security => security + .Add(S["Authentication"], S["Authentication"].PrefixPosition(), authentication => authentication + .Add(S["Sign In with X (Twitter)"], S["Sign In with X (Twitter)"].PrefixPosition(), twitter => twitter + .AddClass("twitter") + .Id("twitter") + .Action("Index", "Admin", _routeValues) + .Permission(Permissions.ManageTwitterSignin) + .LocalNav() + ) + ) ) ); diff --git a/src/OrchardCore.Modules/OrchardCore.Twitter/Startup.cs b/src/OrchardCore.Modules/OrchardCore.Twitter/Startup.cs index 1b4d4664f03..362b1ad7c9b 100644 --- a/src/OrchardCore.Modules/OrchardCore.Twitter/Startup.cs +++ b/src/OrchardCore.Modules/OrchardCore.Twitter/Startup.cs @@ -64,7 +64,7 @@ public sealed class TwitterSigninStartup : StartupBase { public override void ConfigureServices(IServiceCollection services) { - services.AddNavigationProvider(); + services.AddNavigationProvider(); services.AddSingleton(); services.AddSiteDisplayDriver(); diff --git a/src/OrchardCore.Modules/OrchardCore.Twitter/Views/NavigationItemText-twitter.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.Twitter/Views/NavigationItemText-twitter.Id.cshtml index f343d0a4bb5..6388651d972 100644 --- a/src/OrchardCore.Modules/OrchardCore.Twitter/Views/NavigationItemText-twitter.Id.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Twitter/Views/NavigationItemText-twitter.Id.cshtml @@ -1 +1,4 @@ -@T["X (Twitter)"] + + + +@Model.Text diff --git a/src/OrchardCore.Modules/OrchardCore.UrlRewriting/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.UrlRewriting/AdminMenu.cs index 36a784eb8ac..17ef389cba4 100644 --- a/src/OrchardCore.Modules/OrchardCore.UrlRewriting/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.UrlRewriting/AdminMenu.cs @@ -14,9 +14,25 @@ public AdminMenu(IStringLocalizer stringLocalizer) protected override ValueTask BuildAsync(NavigationBuilder builder) { + if (NavigationHelper.UseLegacyFormat()) + { + builder + .Add(S["Configuration"], configuration => configuration + .Add(S["URL Rewriting"], S["URL Rewriting"].PrefixPosition(), rewriting => rewriting + .AddClass("url-rewriting") + .Id("urlRewriting") + .Permission(UrlRewritingPermissions.ManageUrlRewritingRules) + .Action("Index", "Admin", "OrchardCore.UrlRewriting") + .LocalNav() + ) + ); + + return ValueTask.CompletedTask; + } + builder - .Add(S["Configuration"], configuration => configuration - .Add(S["URL Rewriting"], S["URL Rewriting"].PrefixPosition(), rewriting => rewriting + .Add(S["Tools"], tools => tools + .Add(S["URL rewriting"], S["URL rewriting"].PrefixPosition(), rewriting => rewriting .AddClass("url-rewriting") .Id("urlRewriting") .Permission(UrlRewritingPermissions.ManageUrlRewritingRules) diff --git a/src/OrchardCore.Modules/OrchardCore.UrlRewriting/Views/NavigationItemText-urlrewriting.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.UrlRewriting/Views/NavigationItemText-urlrewriting.Id.cshtml index 316c0cb2935..9bfa4bb962f 100644 --- a/src/OrchardCore.Modules/OrchardCore.UrlRewriting/Views/NavigationItemText-urlrewriting.Id.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.UrlRewriting/Views/NavigationItemText-urlrewriting.Id.cshtml @@ -1,4 +1,14 @@ - - - -@T["URL Rewriting"] +@using OrchardCore.Navigation + +@if (NavigationHelper.UseLegacyFormat()) +{ + + + + @Model.Text + + return; +} + + +@Model.Text \ No newline at end of file diff --git a/src/OrchardCore.Modules/OrchardCore.Users/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Users/AdminMenu.cs index a32f0b0bdaf..6f1c9a83f6f 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/AdminMenu.cs @@ -23,10 +23,36 @@ public AdminMenu(IStringLocalizer stringLocalizer) protected override ValueTask BuildAsync(NavigationBuilder builder) { + if (NavigationHelper.UseLegacyFormat()) + { + builder + .Add(S["Security"], NavigationConstants.AdminMenuSecurityPosition, security => security + .AddClass("security") + .Id("security") + .Add(S["Users"], S["Users"].PrefixPosition(), users => users + .AddClass("users") + .Id("users") + .Action("Index", "Admin", UserConstants.Features.Users) + .Permission(CommonPermissions.ListUsers) + .Resource(new User()) + .LocalNav() + ) + .Add(S["Settings"], settings => settings + .Add(S["User Login"], S["User Login"].PrefixPosition(), login => login + .Permission(CommonPermissions.ManageUsers) + .Action("Index", "Admin", _routeValues) + .LocalNav() + ) + ) + ); + + return ValueTask.CompletedTask; + } + builder - .Add(S["Security"], NavigationConstants.AdminMenuSecurityPosition, security => security - .AddClass("security") - .Id("security") + .Add(S["Access Control"], NavigationConstants.AdminMenuAccessControlPosition, accessControl => accessControl + .AddClass("accessControl") + .Id("accessControl") .Add(S["Users"], S["Users"].PrefixPosition(), users => users .AddClass("users") .Id("users") @@ -35,7 +61,10 @@ protected override ValueTask BuildAsync(NavigationBuilder builder) .Resource(new User()) .LocalNav() ) - .Add(S["Settings"], settings => settings + , priority: 1) + + .Add(S["Settings"], settings => settings + .Add(S["Security"], S["Security"].PrefixPosition(), security => security .Add(S["User Login"], S["User Login"].PrefixPosition(), login => login .Permission(CommonPermissions.ManageUsers) .Action("Index", "Admin", _routeValues) diff --git a/src/OrchardCore.Modules/OrchardCore.Users/ChangeEmailAdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Users/ChangeEmailAdminMenu.cs index 44682388897..85649a4b2f0 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/ChangeEmailAdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/ChangeEmailAdminMenu.cs @@ -22,10 +22,26 @@ public ChangeEmailAdminMenu(IStringLocalizer stringLocaliz protected override ValueTask BuildAsync(NavigationBuilder builder) { + if (NavigationHelper.UseLegacyFormat()) + { + builder + .Add(S["Security"], security => security + .Add(S["Settings"], settings => settings + .Add(S["User Change Email"], S["User Change Email"].PrefixPosition(), email => email + .Permission(CommonPermissions.ManageUsers) + .Action("Index", "Admin", _routeValues) + .LocalNav() + ) + ) + ); + + return ValueTask.CompletedTask; + } + builder - .Add(S["Security"], security => security - .Add(S["Settings"], settings => settings - .Add(S["User Change email"], S["User Change email"].PrefixPosition(), email => email + .Add(S["Settings"], settings => settings + .Add(S["Security"], S["Security"].PrefixPosition(), security => security + .Add(S["Change Email"], S["Change Email"].PrefixPosition(), email => email .Permission(CommonPermissions.ManageUsers) .Action("Index", "Admin", _routeValues) .LocalNav() diff --git a/src/OrchardCore.Modules/OrchardCore.Users/RegistrationAdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Users/RegistrationAdminMenu.cs index a568fe9d980..c96debc48a0 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/RegistrationAdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/RegistrationAdminMenu.cs @@ -22,10 +22,26 @@ public RegistrationAdminMenu(IStringLocalizer stringLocal protected override ValueTask BuildAsync(NavigationBuilder builder) { + if (NavigationHelper.UseLegacyFormat()) + { + builder + .Add(S["Security"], security => security + .Add(S["Settings"], S["Settings"].PrefixPosition(), settings => settings + .Add(S["User Registration"], S["User Registration"].PrefixPosition(), registration => registration + .Permission(CommonPermissions.ManageUsers) + .Action("Index", "Admin", _routeValues) + .LocalNav() + ) + ) + ); + + return ValueTask.CompletedTask; + } + builder - .Add(S["Security"], security => security - .Add(S["Settings"], settings => settings - .Add(S["User Registration"], S["User Registration"].PrefixPosition(), registration => registration + .Add(S["Settings"], settings => settings + .Add(S["Security"], S["Security"].PrefixPosition(), security => security + .Add(S["Registration"], S["Registration"].PrefixPosition(), registration => registration .Permission(CommonPermissions.ManageUsers) .Action("Index", "Admin", _routeValues) .LocalNav() diff --git a/src/OrchardCore.Modules/OrchardCore.Users/ResetPasswordAdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Users/ResetPasswordAdminMenu.cs index eeea745cb99..19e90f2f44e 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/ResetPasswordAdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Users/ResetPasswordAdminMenu.cs @@ -22,10 +22,26 @@ public ResetPasswordAdminMenu(IStringLocalizer stringLoc protected override ValueTask BuildAsync(NavigationBuilder builder) { + if (NavigationHelper.UseLegacyFormat()) + { + builder + .Add(S["Security"], security => security + .Add(S["Settings"], settings => settings + .Add(S["User Reset Password"], S["User Reset Password"].PrefixPosition(), password => password + .Permission(CommonPermissions.ManageUsers) + .Action("Index", "Admin", _routeValues) + .LocalNav() + ) + ) + ); + + return ValueTask.CompletedTask; + } + builder - .Add(S["Security"], security => security - .Add(S["Settings"], settings => settings - .Add(S["User Reset password"], S["User Reset password"].PrefixPosition(), password => password + .Add(S["Settings"], settings => settings + .Add(S["Security"], S["Security"].PrefixPosition(), security => security + .Add(S["Reset Password"], S["Reset Password"].PrefixPosition(), password => password .Permission(CommonPermissions.ManageUsers) .Action("Index", "Admin", _routeValues) .LocalNav() diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Views/NavigationItemText-UserProfileSettings.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.Users/Views/NavigationItemText-UserProfileSettings.Id.cshtml index 081b06a99fd..23e55035a40 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Views/NavigationItemText-UserProfileSettings.Id.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Users/Views/NavigationItemText-UserProfileSettings.Id.cshtml @@ -1 +1,4 @@ -@T["User Profile Settings"] + + + +@Model.Text diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Views/NavigationItemText-accessControl.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.Users/Views/NavigationItemText-accessControl.Id.cshtml new file mode 100644 index 00000000000..6f884903ef9 --- /dev/null +++ b/src/OrchardCore.Modules/OrchardCore.Users/Views/NavigationItemText-accessControl.Id.cshtml @@ -0,0 +1,4 @@ + + + +@Model.Text diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Views/NavigationItemText-security.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.Users/Views/NavigationItemText-security.Id.cshtml index 7e67db721b9..6f884903ef9 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Views/NavigationItemText-security.Id.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Users/Views/NavigationItemText-security.Id.cshtml @@ -1 +1,4 @@ -@T["Security"] + + + +@Model.Text diff --git a/src/OrchardCore.Modules/OrchardCore.Users/Views/NavigationItemText-users.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.Users/Views/NavigationItemText-users.Id.cshtml index 2ac1d8f896d..c0f03d000dc 100644 --- a/src/OrchardCore.Modules/OrchardCore.Users/Views/NavigationItemText-users.Id.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Users/Views/NavigationItemText-users.Id.cshtml @@ -1 +1,4 @@ -@T["Users"] + + + +@Model.Text diff --git a/src/OrchardCore.Modules/OrchardCore.Workflows/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Workflows/AdminMenu.cs index 53c45ec6651..79cda258d76 100644 --- a/src/OrchardCore.Modules/OrchardCore.Workflows/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Workflows/AdminMenu.cs @@ -14,13 +14,29 @@ public AdminMenu(IStringLocalizer stringLocalizer) protected override ValueTask BuildAsync(NavigationBuilder builder) { + if (NavigationHelper.UseLegacyFormat()) + { + builder + .Add(S["Workflows"], NavigationConstants.AdminMenuWorkflowsPosition, workflow => workflow + .AddClass("workflows") + .Id("workflows") + .Action("Index", "WorkflowType", "OrchardCore.Workflows") + .Permission(Permissions.ManageWorkflows) + .LocalNav() + ); + + return ValueTask.CompletedTask; + } + builder - .Add(S["Workflows"], NavigationConstants.AdminMenuWorkflowsPosition, workflow => workflow - .AddClass("workflows") - .Id("workflows") - .Action("Index", "WorkflowType", "OrchardCore.Workflows") - .Permission(Permissions.ManageWorkflows) - .LocalNav() + .Add(S["Tools"], tools => tools + .Add(S["Workflows"], S["Workflows"].PrefixPosition(), workflow => workflow + .AddClass("workflows") + .Id("workflows") + .Action("Index", "WorkflowType", "OrchardCore.Workflows") + .Permission(Permissions.ManageWorkflows) + .LocalNav() + ) ); return ValueTask.CompletedTask; diff --git a/src/OrchardCore.Modules/OrchardCore.Workflows/Trimming/AdminMenu.cs b/src/OrchardCore.Modules/OrchardCore.Workflows/Trimming/AdminMenu.cs index 9be8ceef695..3d2d1561951 100644 --- a/src/OrchardCore.Modules/OrchardCore.Workflows/Trimming/AdminMenu.cs +++ b/src/OrchardCore.Modules/OrchardCore.Workflows/Trimming/AdminMenu.cs @@ -22,14 +22,28 @@ public AdminMenu(IStringLocalizer stringLocalizer) protected override ValueTask BuildAsync(NavigationBuilder builder) { + if (NavigationHelper.UseLegacyFormat()) + { + builder + .Add(S["Configuration"], configuration => configuration + .Add(S["Settings"], settings => settings + .Add(S["Workflow Trimming"], S["Workflow Trimming"], trimming => trimming + .Action("Index", "Admin", _routeValues) + .Permission(Permissions.ManageWorkflowSettings) + .LocalNav() + ) + ) + ); + + return ValueTask.CompletedTask; + } + builder - .Add(S["Configuration"], configuration => configuration - .Add(S["Settings"], settings => settings - .Add(S["Workflow Trimming"], S["Workflow Trimming"], trimming => trimming - .Action("Index", "Admin", _routeValues) - .Permission(Permissions.ManageWorkflowSettings) - .LocalNav() - ) + .Add(S["Settings"], settings => settings + .Add(S["Workflow Trimming"], S["Workflow Trimming"].PrefixPosition(), trimming => trimming + .Action("Index", "Admin", _routeValues) + .Permission(Permissions.ManageWorkflowSettings) + .LocalNav() ) ); diff --git a/src/OrchardCore.Modules/OrchardCore.Workflows/Views/NavigationItemText-workflows.Id.cshtml b/src/OrchardCore.Modules/OrchardCore.Workflows/Views/NavigationItemText-workflows.Id.cshtml index 6224b0fd00d..19f1b2a28bd 100644 --- a/src/OrchardCore.Modules/OrchardCore.Workflows/Views/NavigationItemText-workflows.Id.cshtml +++ b/src/OrchardCore.Modules/OrchardCore.Workflows/Views/NavigationItemText-workflows.Id.cshtml @@ -1 +1,14 @@ -@T["Workflows"] +@using OrchardCore.Navigation + +@if (NavigationHelper.UseLegacyFormat()) +{ + + + + @Model.Text + + return; +} + + +@Model.Text diff --git a/src/OrchardCore.Themes/TheBlogTheme/Recipes/blog.recipe.json b/src/OrchardCore.Themes/TheBlogTheme/Recipes/blog.recipe.json index ceabdaee507..e0434064b4e 100644 --- a/src/OrchardCore.Themes/TheBlogTheme/Recipes/blog.recipe.json +++ b/src/OrchardCore.Themes/TheBlogTheme/Recipes/blog.recipe.json @@ -1119,6 +1119,19 @@ } ] }, + { + "name": "MediaProfiles", + "MediaProfiles": { + "banner": { + "Hint": "A banner image (2048px x 600px, cropped)", + "Width": 2048, + "Height": 600, + "Mode": 2, + "Format": 0, + "Quality": 100 + } + } + }, { "name": "media", "Files": [ @@ -1264,62 +1277,37 @@ "Classes": [] }, { - "$type": "OrchardCore.AdminMenu.AdminNodes.PlaceholderAdminNode, OrchardCore.AdminMenu", - "LinkText": "Content Types", - "IconClass": null, - "PermissionNames": [], - "UniqueId": "2f1fc33133334a1abf7d1a0516ee8b4e", + "$type": "OrchardCore.Contents.AdminNodes.ContentTypesAdminNode, OrchardCore.Contents", + "ShowAll": false, + "ContentTypes": [ + { + "ContentTypeId": "Article" + }, + { + "ContentTypeId": "Page" + }, + { + "ContentTypeId": "Taxonomy" + } + ], + "UniqueId": "ee18224e1b814c638b0732678b74cfd9", "Enabled": true, "Text": null, "Id": null, "Href": null, "Url": null, - "Position": "1", - "Priority": 50, + "Position": null, "LinkToFirstChild": true, "LocalNav": false, "Culture": null, - "Items": [ - { - "$type": "OrchardCore.Contents.AdminNodes.ContentTypesAdminNode, OrchardCore.Contents", - "ShowAll": true, - "IconClass": null, - "ContentTypes": [], - "UniqueId": "ee18224e1b814c638b0732678b74cfd9", - "Enabled": true, - "Text": null, - "Id": null, - "Href": null, - "Url": null, - "Position": null, - "LinkToFirstChild": true, - "LocalNav": false, - "Culture": null, - "Items": [], - "Classes": [] - } - ], + "Items": [], "Classes": [] } - ], - "Classes": [] + ] } ] } ] - }, - { - "name": "MediaProfiles", - "MediaProfiles": { - "banner": { - "Hint": "A banner image (2048px x 600px, cropped)", - "Width": 2048, - "Height": 600, - "Mode": 2, - "Format": 0, - "Quality": 100 - } - } } ] } diff --git a/src/OrchardCore/OrchardCore.Navigation.Core/NavigationConstants.cs b/src/OrchardCore/OrchardCore.Navigation.Core/NavigationConstants.cs index 70e19561e20..016e0b2366c 100644 --- a/src/OrchardCore/OrchardCore.Navigation.Core/NavigationConstants.cs +++ b/src/OrchardCore/OrchardCore.Navigation.Core/NavigationConstants.cs @@ -10,7 +10,9 @@ public static class NavigationConstants public const string AdminMenuSearchPosition = "6"; - public const string AdminMenuSecurityPosition = "7"; + public const string AdminMenuAccessControlPosition = "7"; + + public const string AdminMenuSecurityPosition = AdminMenuAccessControlPosition; public const string AdminMenuAuditTrailPosition = "7.5"; @@ -21,4 +23,6 @@ public static class NavigationConstants public const string AdminId = "admin"; public const string AdminMenuId = "adminMenu"; + + public const string LegacyAdminMenuNavigationSwitchKey = "LegacyAdminMenuNavigation"; } diff --git a/src/OrchardCore/OrchardCore.Navigation.Core/NavigationHelper.cs b/src/OrchardCore/OrchardCore.Navigation.Core/NavigationHelper.cs index ea67b5f8d0d..337f9544269 100644 --- a/src/OrchardCore/OrchardCore.Navigation.Core/NavigationHelper.cs +++ b/src/OrchardCore/OrchardCore.Navigation.Core/NavigationHelper.cs @@ -7,6 +7,11 @@ namespace OrchardCore.Navigation; public static class NavigationHelper { + public static bool UseLegacyFormat() + { + return AppContext.TryGetSwitch(NavigationConstants.LegacyAdminMenuNavigationSwitchKey, out var enable) && enable; + } + /// /// Populates the menu shapes. ///