diff --git a/Toders.FindMyContent/Controllers/FindMyContentController.cs b/Toders.FindMyContent/Controllers/FindMyContentController.cs index 82d5047..5beb99d 100644 --- a/Toders.FindMyContent/Controllers/FindMyContentController.cs +++ b/Toders.FindMyContent/Controllers/FindMyContentController.cs @@ -1,41 +1,37 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web.Mvc; -using EPiServer; -using EPiServer.Core; +using EPiServer.Core; using EPiServer.DataAbstraction; using EPiServer.Editor; -using EPiServer.PlugIn; -using EPiServer.ServiceLocation; +using EPiServer.Shell.Modules; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Mvc; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; using Toders.FindMyContent.Core; using Toders.FindMyContent.Models.FindMyContent; namespace Toders.FindMyContent.Controllers { - [GuiPlugIn( - Area = PlugInArea.AdminMenu, - Url = "/FindMyContent/", - DisplayName = "Find My Content")] + [Authorize(Roles = "CmsAdmins")] public class FindMyContentController : Controller { private readonly IContentTypeRepository _contentTypeRepository; private readonly IContentFinder _contentFinder; - - public FindMyContentController() - : this(ServiceLocator.Current.GetInstance(), - ServiceLocator.Current.GetInstance()) - { - } + private readonly ProtectedModuleOptions _protectedModuleOptions; public FindMyContentController( IContentTypeRepository contentTypeRepository, - IContentFinder contentFinder) + IContentFinder contentFinder, + ProtectedModuleOptions protectedModuleOptions) { _contentTypeRepository = contentTypeRepository; _contentFinder = contentFinder; + _protectedModuleOptions = protectedModuleOptions; } + [Route("FindMyContent")] + [HttpGet] public ActionResult Index() { var contentTypes = _contentTypeRepository.List() @@ -65,9 +61,11 @@ public ActionResult Index() EditUrls = contentTypes.ToDictionary(x => x.Id, CreateEditContentTypeUrl) }; - return View(string.Empty, model); + return View(model); } + [Route("FindMyContent/Details/{id}")] + [HttpGet] public ActionResult Details(int id) { ContentType contentType = _contentTypeRepository.Load(id); @@ -81,7 +79,7 @@ public ActionResult Details(int id) }).ToList() }; - return View(string.Empty, model); + return View(model); } private Dictionary CreateEditContentUrls(ContentSummary contentSummary) @@ -93,9 +91,8 @@ private Dictionary CreateEditContentUrls(ContentSummary contentS private string CreateEditContentTypeUrl(ContentTypeModel contentTypeModel) { - var urlBuilder = new UrlBuilder(UriSupport.AbsoluteUrlFromUIBySettings("Admin/EditContentType.aspx")); - urlBuilder.QueryCollection["typeId"] = contentTypeModel.Id.ToString(); - return urlBuilder.ToString(); + var rootPath = _protectedModuleOptions.RootPath.Replace("~", string.Empty); + return Path.Join(rootPath, $"/EPiServer.Cms.UI.Admin/default#/ContentTypes/edit-content-type/{contentTypeModel.Id}"); } private ContentTypeModel CreateContentTypeModel(ContentType contentType) diff --git a/Toders.FindMyContent/Core/ContentFinder.cs b/Toders.FindMyContent/Core/ContentFinder.cs index 0493a2c..198f5bc 100644 --- a/Toders.FindMyContent/Core/ContentFinder.cs +++ b/Toders.FindMyContent/Core/ContentFinder.cs @@ -1,10 +1,10 @@ -using System.Collections.Generic; -using System.Globalization; -using System.Linq; -using EPiServer; +using EPiServer; using EPiServer.Core; using EPiServer.DataAbstraction; using EPiServer.ServiceLocation; +using System.Collections.Generic; +using System.Globalization; +using System.Linq; namespace Toders.FindMyContent.Core { diff --git a/Toders.FindMyContent/Core/ContentSummary.cs b/Toders.FindMyContent/Core/ContentSummary.cs index 2c7a61b..b577e10 100644 --- a/Toders.FindMyContent/Core/ContentSummary.cs +++ b/Toders.FindMyContent/Core/ContentSummary.cs @@ -1,5 +1,5 @@ -using System.Collections.Generic; -using EPiServer.Core; +using EPiServer.Core; +using System.Collections.Generic; namespace Toders.FindMyContent.Core { diff --git a/Toders.FindMyContent/Core/InitializationModule.cs b/Toders.FindMyContent/Core/InitializationModule.cs deleted file mode 100644 index c4405fd..0000000 --- a/Toders.FindMyContent/Core/InitializationModule.cs +++ /dev/null @@ -1,30 +0,0 @@ -using System.Web.Mvc; -using System.Web.Routing; -using EPiServer.Framework; -using EPiServer.Framework.Initialization; - -namespace Toders.FindMyContent.Core -{ - [InitializableModule] - [ModuleDependency(typeof(EPiServer.Web.InitializationModule))] - public class InitializationModule : IInitializableModule - { - public void Initialize(InitializationEngine context) - { - MapRoutes(RouteTable.Routes); - } - - private static void MapRoutes(RouteCollection routes) - { - routes.MapRoute( - "FindMyContent", - "FindMyContent/{action}/{id}", - new { controller = "FindMyContent", action = "Index", id = UrlParameter.Optional }); - } - - public void Uninitialize(InitializationEngine context) - { - //Add uninitialization logic - } - } -} diff --git a/Toders.FindMyContent/FindMyContentMenuProvider.cs b/Toders.FindMyContent/FindMyContentMenuProvider.cs new file mode 100644 index 0000000..035a3a2 --- /dev/null +++ b/Toders.FindMyContent/FindMyContentMenuProvider.cs @@ -0,0 +1,20 @@ +using EPiServer.Shell.Navigation; +using System.Collections.Generic; + +namespace Toders.FindMyContent +{ + [MenuProvider] + public class FindMyContentMenuProvider : IMenuProvider + { + public IEnumerable GetMenuItems() + { + return new List(1) + { + new UrlMenuItem("Find My Content", "/global/cms/admin/findmycontent", "/FindMyContent/") { + IsAvailable = context => true, + SortIndex = 100, + } + }; + } + } +} diff --git a/Toders.FindMyContent/Models/FindMyContent/ContentTypeModel.cs b/Toders.FindMyContent/Models/FindMyContent/ContentTypeModel.cs index d631ad7..6d9cc14 100644 --- a/Toders.FindMyContent/Models/FindMyContent/ContentTypeModel.cs +++ b/Toders.FindMyContent/Models/FindMyContent/ContentTypeModel.cs @@ -27,6 +27,6 @@ public class ContentSummaryModel { public ContentSummary Summary { get; set; } - public Dictionary EditUrls { get; set; } + public Dictionary EditUrls { get; set; } } } \ No newline at end of file diff --git a/Toders.FindMyContent/Models/FindMyContent/DetailsModel.cs b/Toders.FindMyContent/Models/FindMyContent/DetailsModel.cs index f737c69..66b0576 100644 --- a/Toders.FindMyContent/Models/FindMyContent/DetailsModel.cs +++ b/Toders.FindMyContent/Models/FindMyContent/DetailsModel.cs @@ -1,5 +1,4 @@ using System.Collections.Generic; -using Toders.FindMyContent.Core; namespace Toders.FindMyContent.Models.FindMyContent { diff --git a/Toders.FindMyContent/Toders.FindMyContent.csproj b/Toders.FindMyContent/Toders.FindMyContent.csproj index c4e3f0a..5fb05a5 100644 --- a/Toders.FindMyContent/Toders.FindMyContent.csproj +++ b/Toders.FindMyContent/Toders.FindMyContent.csproj @@ -1,227 +1,38 @@ - - - - - Debug - AnyCPU - - - 2.0 - {77A6E030-CAF6-42B7-AAC2-60676BCBDD00} - {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} - Library - Properties - Toders.FindMyContent - Toders.FindMyContent - v4.7.2 - true - - - - - - - - - - - - true - full - false - bin\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - bin\ - TRACE - prompt - 4 - - - - ..\packages\Castle.Core.4.2.1\lib\net45\Castle.Core.dll - - - ..\packages\Castle.Windsor.4.1.0\lib\net45\Castle.Windsor.dll - - - ..\packages\EPiServer.CMS.Core.11.9.2\lib\net461\EPiServer.dll - - - ..\packages\EPiServer.Framework.11.9.2\lib\net461\EPiServer.ApplicationModules.dll - - - ..\packages\EPiServer.CMS.AspNet.11.9.2\lib\net461\EPiServer.Cms.AspNet.dll - - - ..\packages\EPiServer.CMS.AspNet.11.9.2\lib\net461\EPiServer.Configuration.dll - - - ..\packages\EPiServer.Framework.11.9.2\lib\net461\EPiServer.Data.dll - - - ..\packages\EPiServer.Framework.11.9.2\lib\net461\EPiServer.Data.Cache.dll - - - ..\packages\EPiServer.CMS.Core.11.9.2\lib\net461\EPiServer.Enterprise.dll - - - ..\packages\EPiServer.Framework.11.9.2\lib\net461\EPiServer.Events.dll - - - ..\packages\EPiServer.Framework.11.9.2\lib\net461\EPiServer.Framework.dll - - - ..\packages\EPiServer.Framework.AspNet.11.9.2\lib\net461\EPiServer.Framework.AspNet.dll - - - ..\packages\EPiServer.CMS.AspNet.11.9.2\lib\net461\EPiServer.ImageLibrary.dll - - - ..\packages\EPiServer.Framework.11.9.2\lib\net461\EPiServer.Licensing.dll - - - ..\packages\EPiServer.CMS.Core.11.9.2\lib\net461\EPiServer.LinkAnalyzer.dll - - - ..\packages\EPiServer.CMS.AspNet.11.9.2\lib\net461\EPiServer.Web.WebControls.dll - - - - ..\packages\Microsoft.Web.Infrastructure.1.0.0.0\lib\net40\Microsoft.Web.Infrastructure.dll - - - ..\packages\Newtonsoft.Json.9.0.1\lib\net45\Newtonsoft.Json.dll - - - ..\packages\structuremap-signed.3.1.9.463\lib\net40\StructureMap.dll - - - ..\packages\structuremap-signed.3.1.9.463\lib\net40\StructureMap.Net4.dll - - - ..\packages\structuremap.web-signed.3.1.6.191\lib\net40\StructureMap.Web.dll - - - ..\packages\System.ComponentModel.Annotations.4.4.0\lib\net461\System.ComponentModel.Annotations.dll - - - ..\packages\System.Data.SqlClient.4.4.0\lib\net461\System.Data.SqlClient.dll - - - ..\packages\System.Security.AccessControl.4.4.0\lib\net461\System.Security.AccessControl.dll - - - ..\packages\System.Security.Cryptography.Xml.4.4.0\lib\net461\System.Security.Cryptography.Xml.dll - - - ..\packages\System.Security.Permissions.4.4.0\lib\net461\System.Security.Permissions.dll - - - ..\packages\System.Security.Principal.Windows.4.4.0\lib\net461\System.Security.Principal.Windows.dll - - - ..\packages\System.Threading.AccessControl.4.4.0\lib\net461\System.Threading.AccessControl.dll - - - ..\packages\Microsoft.Tpl.Dataflow.4.5.24\lib\portable-net45+win8+wpa81\System.Threading.Tasks.Dataflow.dll - - - - - - - - - - - ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.Helpers.dll - - - ..\packages\Microsoft.AspNet.Mvc.5.2.3\lib\net45\System.Web.Mvc.dll - - - ..\packages\Microsoft.AspNet.Razor.3.2.3\lib\net45\System.Web.Razor.dll - - - ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.dll - - - ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Deployment.dll - - - ..\packages\Microsoft.AspNet.WebPages.3.2.3\lib\net45\System.Web.WebPages.Razor.dll - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 10.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - - - - - - - - - True - True - 33261 - / - http://localhost:33261/ - False - False - - - False - - - - - + + + Library + + + net7.0 + false + bin\ + + + + + + + + + + + + + + + + + + + + + + + + all + + + + + \ No newline at end of file diff --git a/Toders.FindMyContent/Toders.FindMyContent.nuspec b/Toders.FindMyContent/Toders.FindMyContent.nuspec index 0ea940b..e2021a9 100644 --- a/Toders.FindMyContent/Toders.FindMyContent.nuspec +++ b/Toders.FindMyContent/Toders.FindMyContent.nuspec @@ -3,14 +3,14 @@ Toders.FindMyContent $version$$build$ - Alf Nilsson + Alf Nilsson, Mikael Johansson Alf Nilsson https://github.com/alfnilsson/FindMyContent false - An Admin Plugin for Episerver CMS to find content based on their Content Types. - Updated to 11.9.2. - Copyright 2017 - Episerver CMS Admin + An Admin Plugin for Optimizely CMS to find content based on their Content Types. + Updated to 12.3.1. + Copyright 2023 + Optimizely CMS Admin diff --git a/Toders.FindMyContent/Views/FindMyContent/Details.cshtml b/Toders.FindMyContent/Views/FindMyContent/Details.cshtml index 6acfad1..38e22f4 100644 --- a/Toders.FindMyContent/Views/FindMyContent/Details.cshtml +++ b/Toders.FindMyContent/Views/FindMyContent/Details.cshtml @@ -1,83 +1,80 @@ @{ - Layout = null; + Layout = null; } @model Toders.FindMyContent.Models.FindMyContent.DetailsModel @using EPiServer.Framework.Web.Resources +@using EPiServer.Shell.Navigation @using Toders.FindMyContent.Core @using Toders.FindMyContent.Models.FindMyContent -@using EPiServer.Shell.Web.Mvc.Html - - + - @ViewBag.Title - - - - - @Html.Raw(ClientResources.RenderResources("ShellCore")) - @Html.Raw(ClientResources.RenderResources("ShellWidgets")) - - - @Html.Raw(ClientResources.RenderResources("ShellCoreLightTheme")) - - - @Html.Raw(ClientResources.RenderResources("Navigation")) - - - @Html.Raw(ClientResources.RenderResources("DojoDashboardCompatibility", new[] { ClientResourceType.Style })) - + @ViewData["Title"] + + + + @ClientResources.RenderResources("admin", new[] { ClientResourceType.Style }) + - - @Html.Raw(Html.ShellInitializationScript()) -
- -
- -
-

@Model.ContentType.Name

-

Here you can find all content for your Content Type.

-
+ + @Html.Raw(Html.CreatePlatformNavigationMenu()) + +
+
+
+
+
+
+
+
+

+ @Model.ContentType.Name +

+

Select which Content Type you would like to find.

+
-
- - - - - - - - - @foreach (ContentSummaryModel content in Model.Content) - { - var summary = content.Summary; - var masterLanguage = summary.Translations.First(t => t.Key == summary.MasterLanguage); - - - - - +
+
IdNameLanguage
@summary.ContentLink - @masterLanguage.Value - @masterLanguage.Key (Master Language)Edit content
+ + + + + + + + @foreach (ContentSummaryModel content in Model.Content) + { + var summary = content.Summary; + var masterLanguage = summary.Translations.First(t => t.Key == summary.MasterLanguage); + + + + + - - foreach (var translation in summary.Translations.Where(t => t.Key != summary.MasterLanguage)) - { - - - - - - } - } - -
IdNameLanguage
@summary.ContentLink + @masterLanguage.Value + @masterLanguage.Key (Master Language)Edit content
- @translation.Value - @translation.KeyEdit content
-
-
-
+ + foreach (var translation in summary.Translations.Where(t => t.Key != summary.MasterLanguage)) + { + + + @translation.Value + + @translation.Key + Edit content + + } + } + + +
+
+
+
+
+ diff --git a/Toders.FindMyContent/Views/FindMyContent/Index.cshtml b/Toders.FindMyContent/Views/FindMyContent/Index.cshtml index 2df043b..512f207 100644 --- a/Toders.FindMyContent/Views/FindMyContent/Index.cshtml +++ b/Toders.FindMyContent/Views/FindMyContent/Index.cshtml @@ -1,80 +1,80 @@ -@{ - Layout = null; +@using Microsoft.AspNetCore.Mvc.Razor +@{ + Layout = null; } @model Toders.FindMyContent.Models.FindMyContent.OverviewModel @using EPiServer.Framework.Web.Resources +@using EPiServer.Shell.Navigation @using Toders.FindMyContent.Models.FindMyContent -@using EPiServer.Shell.Web.Mvc.Html -@helper Table(IEnumerable contentTypes) -{ -
- - - - - - - - - - @foreach (var contentType in contentTypes) - { - - - - - - - - } - -
IdNameCategoryAmount of content
@contentType.Id@contentType.Name@contentType.Category@contentType.AmountOfContentEdit Content Type
-
+@{ + HelperResult Table(IEnumerable contentTypes) + { +
+ + + + + + + + + + @foreach (var contentType in contentTypes) + { + + + + + + + + } + +
IdNameCategoryAmount of content
@contentType.Id@contentType.Name@contentType.Category@contentType.AmountOfContentEdit Content Type
+
+ return new HelperResult(w => Task.CompletedTask); + } } - @ViewBag.Title - - - - - @Html.Raw(ClientResources.RenderResources("ShellCore")) - @Html.Raw(ClientResources.RenderResources("ShellWidgets")) - - - @Html.Raw(ClientResources.RenderResources("ShellCoreLightTheme")) - - - @Html.Raw(ClientResources.RenderResources("Navigation")) - - - @Html.Raw(ClientResources.RenderResources("DojoDashboardCompatibility", new[] { ClientResourceType.Style })) - + @ViewData["Title"] + + + + @ClientResources.RenderResources("admin", new[] { ClientResourceType.Style }) + - - @Html.Raw(Html.ShellInitializationScript()) -
- -
- -
-

Find My Content

-

Select which Content Type you would like to find.

-
-

Pages

- @Table(Model.PageTypes) -

Blocks

- @Table(Model.BlockTypes) -

Media

- @Table(Model.MediaTypes) -

Other

- @Table(Model.OtherTypes) -
-
+ + @Html.Raw(Html.CreatePlatformNavigationMenu()) + +
+
+
+
+
+
+
+
+

Find My Content

+

Select which Content Type you would like to find.

+
+

Pages

+ @Table(Model.PageTypes) +

Blocks

+ @Table(Model.BlockTypes) +

Media

+ @Table(Model.MediaTypes) +

Other

+ @Table(Model.OtherTypes) +
+
+
+
+
diff --git a/Toders.FindMyContent/appsettings.json b/Toders.FindMyContent/appsettings.json new file mode 100644 index 0000000..b1ea7fe --- /dev/null +++ b/Toders.FindMyContent/appsettings.json @@ -0,0 +1,3 @@ +{ + "aspnet:UseTaskFriendlySynchronizationContext": true +} \ No newline at end of file diff --git a/Toders.FindMyContent/packages.config b/Toders.FindMyContent/packages.config deleted file mode 100644 index fb36727..0000000 --- a/Toders.FindMyContent/packages.config +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/Toders.FindMyContent/web.config b/Toders.FindMyContent/web.config deleted file mode 100644 index 68d79ed..0000000 --- a/Toders.FindMyContent/web.config +++ /dev/null @@ -1,263 +0,0 @@ - - - - -
-
-
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/nuget.config b/nuget.config index 993c11f..b5b09a8 100644 --- a/nuget.config +++ b/nuget.config @@ -1,9 +1,9 @@ - + - +