MonoX support board

Start the conversation, ask questions and share tips and solutions with fellow developers.

Non-registered users can only browse through our support boards. Please register now if you want to post your questions. It takes a second and it is completely free. Alternatively, you can log in without registration using your credentials at major sites such as Google, Microsoft Live, OpenId, Facebook, LinkedIn or Yahoo.

Discussion board container/activity stream  (Mono Support )

Viewed 43368 time(s), 2 post(s) 8/30/2012 12:26:34 PMby DanC


8/30/2012 12:26:34 PM
I would like to use something like the blog container for a discussion board (or boards).
The best thing I think to use is an activity stream and dial in to the activities I want to listen to.
I have added an activity stream from events.ascx but I am having difficulty setting it. I seem to have made changes (using the webpart settings) and some of my changes in default.ascx are not being picked up. I don't know how to reset it after making those changes?

Also, I have set EventsToDisplay="Discussion" but the only activities I hear about are new topics and not necessarily new posts to topics. I'm not sure if the client requires this but I want to know if it is theoretically possible shouuld they ask me? I am seeing a lot more entries than just Discussion board related so i don't know what is going on.

<%@ Register TagPrefix="MonoX" TagName="EventsContainer" Src="/MonoX/ModuleGallery/SocialNetworking/Events.ascx" %>

<portal:PortalWebPartZoneTableless ID="PortalWebPartZoneTableless1" runat="server" Width="100%" ChromeTemplateFile="Standard.htm" HeaderText="Middle row left" >
<MonoX:EventsContainer ID="EventContainer" NumberOfEventsToShow="4" EventsToDisplay="Discussion" PagerPageSize="7" runat="server" width="100%" ChromeTemplateFile="Standard.htm" HeaderText="Discussion board topics">
This content has not been rated yet. 
85 Reputation 9 Total posts


8/31/2012 1:43:23 PM

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(SnEventFields.EventTypeId == SnEventTypeEntity.AddedDiscussionTopic.Id);
    IPrefetchPath2 prefetchPath = new PrefetchPath2(EntityType.SnEventEntity);
    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

This content has not been rated yet. 
2218 Reputation 300 Total posts