diff --git a/Kooboo.CMS/Kooboo.CMS.Web/Areas/Contents/Controllers/TextContentController.cs b/Kooboo.CMS/Kooboo.CMS.Web/Areas/Contents/Controllers/TextContentController.cs index 62c2d8e3..40ac151f 100644 --- a/Kooboo.CMS/Kooboo.CMS.Web/Areas/Contents/Controllers/TextContentController.cs +++ b/Kooboo.CMS/Kooboo.CMS.Web/Areas/Contents/Controllers/TextContentController.cs @@ -78,7 +78,7 @@ public class ContentSorter [Kooboo.CMS.Web.Authorizations.Authorization(AreaName = "Contents", Group = "", Name = "Content", Order = 1)] public virtual ActionResult Index(string folderName, string parentUUID, string parentFolder, string search - , IEnumerable whereClause, int? page, int? pageSize, string sortField = null, string sortDir = null) + , IEnumerable whereClause, int? page, int? pageSize, string sortField = null, string sortDir = null, string category = null) { //compatible with the Folder parameter changed to FolderName. folderName = folderName ?? this.ControllerContext.RequestContext.GetRequestValue("Folder"); @@ -92,6 +92,7 @@ public virtual ActionResult Index(string folderName, string parentUUID, string p ViewData["Menu"] = textFolder.GetFormTemplate(FormType.Grid_Menu); ViewData["Template"] = textFolder.GetFormTemplate(FormType.Grid); ViewData["WhereClause"] = whereClause; + ViewData["Category"] = category; SetPermissionData(textFolder); @@ -151,6 +152,21 @@ public virtual ActionResult Index(string folderName, string parentUUID, string p .Where(it => it.Visible) .Where(it => Kooboo.CMS.Content.Services.ServiceFactory.WorkflowManager.AvailableViewContent(it, User.Identity.Name)); } + + // Category filter, only ONE category currently + if (!string.IsNullOrEmpty(category) && textFolder.Categories != null) + { + foreach (var item in textFolder.Categories) + { + var categories = Kooboo.CMS.Sites.View.ContentHelper.TextFolder(item.FolderName).CreateQuery().WhereEquals("UUID", category); + if (categories.Count() > 0) + { + query = query.WhereCategory(categories); + break; + } + } + } + page = page ?? 1; pageSize = pageSize ?? textFolder.PageSize; diff --git a/Kooboo.CMS/Kooboo.CMS.Web/Areas/Contents/Views/TextContent/_AdvancedSearch.cshtml b/Kooboo.CMS/Kooboo.CMS.Web/Areas/Contents/Views/TextContent/_AdvancedSearch.cshtml index f0591cd1..c76013ad 100644 --- a/Kooboo.CMS/Kooboo.CMS.Web/Areas/Contents/Views/TextContent/_AdvancedSearch.cshtml +++ b/Kooboo.CMS/Kooboo.CMS.Web/Areas/Contents/Views/TextContent/_AdvancedSearch.cshtml @@ -172,5 +172,49 @@ }); + + if (folder.Categories != null) + { + + + } } @*end if*@