public IEnumerable<ThreadPart> Get(ForumPart forumPart, VersionOptions versionOptions) { return GetForumQuery(forumPart, versionOptions) .OrderByDescending(cr => cr.CreatedUtc) .ForPart<ThreadPart>() .List(); }
public ActionResult Item(int forumId, PagerParameters pagerParameters) { Pager pager = new Pager(_siteService.GetSiteSettings(), pagerParameters); ForumPart forum = _forumService.Get(forumId, VersionOptions.Latest); if (forum == null) { return(HttpNotFound()); } if (!_orchardServices.Authorizer.Authorize(Permissions.ManageForums, forum, T("Not allowed to view forum"))) { return(new HttpUnauthorizedResult()); } var threads = _threadService.Get(forum, pager.GetStartIndex(), pager.PageSize, VersionOptions.Latest).ToArray(); var threadsShapes = threads.Select(bp => _contentManager.BuildDisplay(bp, "SummaryAdmin")).ToArray(); dynamic forumShape = _contentManager.BuildDisplay(forum, "DetailAdmin"); var list = Shape.List(); list.AddRange(threadsShapes); forumShape.Content.Add(Shape.Parts_Forums_Thread_ListAdmin(ContentItems: list), "5"); var totalItemCount = _threadService.Count(forum, VersionOptions.Latest); forumShape.Content.Add(Shape.Pager(pager).TotalItemCount(totalItemCount), "Content:after"); // Casting to avoid invalid (under medium trust) reflection over the protected View method and force a static invocation. return(View((object)forumShape)); }
public IEnumerable<ThreadPart> Get(ForumPart forumPart, int skip, int count, VersionOptions versionOptions) { return GetParentQuery(forumPart, versionOptions) .Join<ThreadPartRecord>() .OrderByDescending(o => o.IsSticky) .Join<CommonPartRecord>() .OrderByDescending(o => o.ModifiedUtc) .ForPart<ThreadPart>() .Slice(skip, count) .ToList(); }
public ThreadPart Get(ForumPart forumPart, string slug, VersionOptions versionOptions) { return _contentManager .Query<ThreadPart, ThreadPartRecord>() .Join<AutoroutePartRecord>() .Where(r => r.DisplayAlias.EndsWith(slug)) .Join<CommonPartRecord>() .Where(cr => cr.Container == forumPart.Record.ContentItemRecord) .List() .FirstOrDefault(); }
public IEnumerable <ThreadPart> Get(ForumPart forumPart, int skip, int count, VersionOptions versionOptions) { return(GetParentQuery(forumPart, versionOptions) .Join <ThreadPartRecord>() .OrderByDescending(o => o.IsSticky) .Join <CommonPartRecord>() .OrderByDescending(o => o.ModifiedUtc) .ForPart <ThreadPart>() .Slice(skip, count) .ToList()); }
public IEnumerable<ThreadPart> Get(ForumPart forumPart, IUser user) { return GetParentQuery(forumPart, VersionOptions.Published) .Where(o => o.OwnerId == user.Id) .Join<ThreadPartRecord>() .OrderByDescending(o => o.IsSticky) .Join<CommonPartRecord>() .OrderByDescending(o => o.ModifiedUtc) .ForPart<ThreadPart>() .List() .ToList(); }
public IEnumerable <ThreadPart> Get(ForumPart forumPart, IUser user) { return(GetParentQuery(forumPart, VersionOptions.Published) .Where(o => o.OwnerId == user.Id) .Join <ThreadPartRecord>() .OrderByDescending(o => o.IsSticky) .Join <CommonPartRecord>() .OrderByDescending(o => o.ModifiedUtc) .ForPart <ThreadPart>() .List() .ToList()); }
public IEnumerable<ThreadPart> Get(ForumPart forumPart, bool includeInappropriate, IUser user) { var threads = GetParentQuery(forumPart, VersionOptions.Published) .Where(o => o.OwnerId == user.Id) .Join<ThreadPartRecord>(); if ( includeInappropriate == false ) { threads.Where(threadRec => threadRec.IsInappropriate == false); } return threads.OrderByDescending(o => o.IsSticky) .Join<CommonPartRecord>() .OrderByDescending(o => o.ModifiedUtc) .ForPart<ThreadPart>() .List() .ToList(); }
public IEnumerable<ThreadPart> Get(ForumPart forumPart, int skip, int count, bool includeInappropriate, VersionOptions versionOptions) { var threads= GetParentQuery(forumPart, versionOptions) .Join<ThreadPartRecord>(); if ( includeInappropriate == false ) { threads.Where(threadRec => threadRec.IsInappropriate == false); } return threads.OrderByDescending(o => o.IsSticky) .Join<CommonPartRecord>() .OrderByDescending(o => o.ModifiedUtc) .ForPart<ThreadPart>() .Slice(skip, count) .ToList(); }
public ForumCategoryPart GetParentCategory( ForumPart forumPart ){ ForumCategoryPart parentCategory = null; if( forumPart.As<CommonPart>().Container != null ) { parentCategory = forumPart.As<CommonPart>().Container.As<ForumCategoryPart>(); } return parentCategory; /* var parentCategoryId = _categoryToForumMappingRepository.Table.Where(rec => rec.ForumPartRecord.Id == forumPart.Id).Select(rec => rec.ForumCategoryPartRecord.Id).FirstOrDefault(); var parentCategory = _contentManager.Query<ForumCategoryPart, ForumCategoryPartRecord>().Where( cat=>cat.Id == parentCategoryId ).List().FirstOrDefault(); return parentCategory; */ }
private void UpdateForumPartCounters(ThreadPart threadPart) { var commonPart = threadPart.As <CommonPart>(); if (commonPart != null && commonPart.Record.Container != null) { ForumPart forumPart = threadPart.ForumPart ?? _forumService.Get(commonPart.Record.Container.Id, VersionOptions.Published); forumPart.ThreadCount = _threadService.Count(forumPart, VersionOptions.Published); forumPart.PostCount = _threadService .Get(forumPart, VersionOptions.Published) .Sum(publishedThreadPart => publishedThreadPart.PostCount); } }
public void Delete(ForumPart forum) { _contentManager.Remove(forum.ContentItem); }
public void Delete(ForumPart forumPart) { Get(forumPart) .ToList() .ForEach(thread => _contentManager.Remove(thread.ContentItem)); }
public IEnumerable<ThreadPart> Get(ForumPart forumPart, VersionOptions versionOptions) { return GetForumQuery(forumPart, versionOptions).List().Select(ci => ci.As<ThreadPart>()); }
public IEnumerable<ThreadPart> Get(ForumPart forumPart, bool includeInappropriate, VersionOptions versionOptions) { return Get(forumPart, 0, 0,includeInappropriate, versionOptions); }
public static string ThreadCreate(this UrlHelper urlHelper, ForumPart forumPart) { return urlHelper.Action("Create", "Thread", new { forumId = forumPart.Id, area = Constants.LocalArea, returnUrl = urlHelper.RequestContext.HttpContext.Request.ToUrlString() }); }
public static string ForumEdit(this UrlHelper urlHelper, ForumPart forumPart) { return urlHelper.Action("Edit", "ForumAdmin", new { forumId = forumPart.Id, area = Constants.LocalArea }); }
public void OpenForum(ForumPart forumPart) { forumPart.IsClosed = false; }
public static string ForumView(this UrlHelper urlHelper, ForumPart forumPart) { return(urlHelper.Action("Item", "Forum", new { forumId = forumPart.Id, area = Constants.LocalArea })); }
public static string ForumEdit(this UrlHelper urlHelper, ForumPart forumPart) { return(urlHelper.Action("Edit", "ForumAdmin", new { forumId = forumPart.Id, area = Constants.LocalArea })); }
public static string CreateThread(this UrlHelper urlHelper, ForumPart forumPart) { return urlHelper.Action("Create", "Thread", new { forumId = forumPart.Id, area = Constants.LocalArea }); }
public static string AdminThreadsForForum(this UrlHelper urlHelper, ForumPart forumPart) { return urlHelper.Action("List", "ThreadAdmin", new { forumId = forumPart.Id, area = Constants.LocalArea }); }
public IEnumerable<ThreadPart> Get(ForumPart forumPart, int skip, int count, bool includeInappropriate) { return Get(forumPart, skip, count, includeInappropriate, VersionOptions.Published); }
public void CloseForum(ForumPart forumPart) { forumPart.IsClosed = true; }
public static string ThreadCreate(this UrlHelper urlHelper, ForumPart forumPart) { return(urlHelper.Action("Create", "Thread", new { forumId = forumPart.Id, area = Constants.LocalArea, returnUrl = urlHelper.RequestContext.HttpContext.Request.ToUrlString() })); }
public IEnumerable<ThreadPart> Get(ForumPart forumPart, VersionOptions versionOptions) { return Get(forumPart, 0, 0, versionOptions); }
public int Count(ForumPart forumPart, VersionOptions versionOptions) { return(GetParentQuery(forumPart, versionOptions).Count()); }
public static string ForumView(this UrlHelper urlHelper, ForumPart forumPart) { return urlHelper.Action("Item", "Forum", new { forumId = forumPart.Id, area = Constants.LocalArea }); }
public ThreadPart Get(ForumPart forumPart, string slug, VersionOptions versionOptions) { var threadPath = forumPart.As<IRoutableAspect>().GetChildPath(slug); return _contentManager.Query(versionOptions, ContentPartConstants.Thread).Join<RoutePartRecord>().Where(rr => rr.Path == threadPath). Join<CommonPartRecord>().Where(cr => cr.Container == forumPart.Record.ContentItemRecord).List(). SingleOrDefault().As<ThreadPart>(); }
public void Delete(ForumPart forumPart, bool includeInappropriate) { Get(forumPart, true) .ToList() .ForEach(thread => _contentManager.Remove(thread.ContentItem)); }
// Default Route public static string Forums(this UrlHelper urlHelper, ForumPart forumPart) { return ContentItemExtensions.ItemDisplayUrl(urlHelper, forumPart.ContentItem); //return urlHelper.Action("List", "Forum", new { area = Constants.LocalArea }); }
public int Count(ForumPart forumPart, VersionOptions versionOptions) { return GetParentQuery(forumPart, versionOptions).Count(); }
public int ThreadCount(ForumPart forumPart, VersionOptions versionOptions) { return GetForumQuery(forumPart, versionOptions).Count(); }
public PostPart GetLatestPost(ForumPart forumPart, VersionOptions versionOptions) { var threadParts = _contentManager .Query<ThreadPart, ThreadPartRecord>(versionOptions) .Join<CommonPartRecord>().Where(cpr => cpr.Container == forumPart.ContentItem.Record) .List(); return threadParts .Select(o => GetLatestPost(o, versionOptions)) .OrderBy(o => o.As<ICommonPart>().PublishedUtc) .LastOrDefault(); }
public IEnumerable<ThreadPart> Get(ForumPart forumPart, int skip, int count, VersionOptions versionOptions) { return GetForumQuery(forumPart, versionOptions).Slice(skip, count).ToList().Select(ci => ContentExtensions.As<ThreadPart>(ci)); }
public IEnumerable<ThreadPart> Get(ForumPart forumPart) { return Get(forumPart, VersionOptions.Published); }
public IEnumerable <ThreadPart> Get(ForumPart forumPart, VersionOptions versionOptions) { return(Get(forumPart, 0, 0, versionOptions)); }
public IEnumerable<ThreadPart> Get(ForumPart forumPart, int skip, int count) { return Get(forumPart, skip, count, VersionOptions.Published); }
public IEnumerable <ThreadPart> Get(ForumPart forumPart, int skip, int count) { return(Get(forumPart, skip, count, VersionOptions.Published)); }
// The order by on this record needs to be revisited. public IEnumerable<ThreadPart> Get(ForumPart forumPart, int skip, int count, VersionOptions versionOptions) { return GetForumQuery(forumPart, versionOptions) .Join<ThreadPartRecord>() .OrderByDescending(t => t.IsSticky) .Join<CommonPartRecord>() .OrderByDescending(cr => cr.CreatedUtc) .ForPart<ThreadPart>() .Slice(skip, count); }
public IEnumerable <ThreadPart> Get(ForumPart forumPart) { return(Get(forumPart, VersionOptions.Published)); }