Hello,
To show only Discussion Topic events you will need to create your own Repository method to fetch only Discussion Topic event types and then you will need to inherit Events.ascx control and override its BindData Method.
Example repository method:
public
virtual
EntityCollection<SnEventEntity> GetEvents(Guid userId,
int
numberOfEvents,
int
pageIndex,
int
pageSize,
out
int
recordCount)
{
EntityCollection<SnEventEntity> events =
new
EntityCollection<SnEventEntity>(
new
SnEventEntityFactory());
IRelationPredicateBucket filter =
new
RelationPredicateBucket();
filter.PredicateExpression.Add(FriendRepository.GetInstance().GetFriendshipFilter(userId));
filter.PredicateExpression.Add(SnEventFields.EventTypeId == SnEventTypeEntity.AddedDiscussionTopic.Id);
filter.Relations.Add(SnEventEntity.Relations.AspnetUsersEntityUsingUserId);
IPrefetchPath2 prefetchPath =
new
PrefetchPath2(EntityType.SnEventEntity);
prefetchPath.Add(SnEventEntity.PrefetchPathFriendAspnetUsers);
prefetchPath.Add(SnEventEntity.PrefetchPathBlogPost);
prefetchPath.Add(SnEventEntity.PrefetchPathSnAlbum);
prefetchPath.Add(SnEventEntity.PrefetchPathSnFile);
prefetchPath.Add(SnEventEntity.PrefetchPathSnGroup);
prefetchPath.Add(SnEventEntity.PrefetchPathAspnetUsers).SubPath.Add(AspnetUsersEntity.PrefetchPathUserProfile);
prefetchPath.Add(SnEventEntity.PrefetchPathSnDiscussionBoard);
prefetchPath.Add(SnEventEntity.PrefetchPathSnDiscussionTopic);
ISortExpression sortExpression =
new
SortExpression(
new
SortClause(SnEventFields.DateCreated,
null
, SortOperator.Descending));
FetchEntityCollection(events, filter, numberOfEvents, sortExpression, prefetchPath, pageIndex, pageSize);
recordCount = GetDbCount(events, filter);
return
events;
}
Example BindData override:
MonoXCacheManager cacheManager = MonoXCacheManager.GetInstance(CacheKeys.Events.EventList,
this
.CacheDuration);
Guid userId =
this
.UserId;
if
(userId == Guid.Empty)
userId = SecurityUtility.GetUserId();
PagedCollectionContainer bindContainer = cacheManager.Get<PagedCollectionContainer>(userId,
this
.NumberOfEventsToShow,
this
.ShowUserOwnEvents, PagedCollectionContainer.GetPagerCacheKey(pager)) ?? PagedCollectionContainer.GetInstance();
if
(!bindContainer.HasValue)
{
bindContainer.Collection = EventRepository.GetInstance().GetEvents(userId,
this
.NumberOfEventsToShow, pager !=
null
? pager.CurrentPageIndex + 1 : 0, pager !=
null
? pager.PageSize : NumberOfEventsToShow,
out
bindContainer.RecordCount);
cacheManager.Store(bindContainer, userId,
this
.NumberOfEventsToShow,
this
.ShowUserOwnEvents, PagedCollectionContainer.GetPagerCacheKey(pager));
}
if
(bindContainer.HasValue)
{
if
(pager !=
null
)
PagerUtility.BindPager(pager, BindData, lvItems, bindContainer.Collection, bindContainer.RecordCount);
}
Adding events for new topic replies is possible however it is currently not implemented in the current MonoX build. Here's what you will need to do:
1. Add a DiscussionMessage event type
2. Override in DiscussionMessages OnPost method and insert your custom event type
3. Expand the code which I posted above to include your custom event type
Regards,
Mario