1.1.5. Forum

Warning

You are looking at documentation for an older release. Not what you want? See the current release documentation.

The Forum portlet is the application for users to post and read messages on different topics.

Package

This portlet is packaged in the forum.war file.

Portlet.xml

Preferences

Preference namePossible valueDefault valueDescription
useAjax true, false true Defines if links in the Forum will be plain hrefs or javascript ajax (better for SEO) or not.
showForumActionBar true, false true This is the UIForumActionBar. If the value is set to "true", the UIForumActionBar will be shown. If false, the UIForumActionBar will be hidden.
forumNewPost day number 1 Specifies if a post is new. If the post is created within the set period, it is new in the Forum.
enableIPLogging true, false true Enables the IP logging function in the Forum. IP addresses of all posts will be collected.
enableIPFiltering true, false true Enables the IP filter function in Forum, enabling IP addresses to be blocked in the Forum.
invisibleCategories id categories empty Hides some categories. If the value is set empty, all categories of the Forum will be shown.
invisibleForums id forums empty Hides some Forums. All Forums will be shown if the value is set empty.
uploadFileSizeLimitMB integer 20 Limits the size of uploaded files in MB in the Forum.
isShowForumJump true, false true Specifies if the Forum jump panel is shown or not.
isShowIconsLegend true, false true Specifies if the icon legends panel is shown or not.
isShowModerators true, false true Specifies if the moderators panel is shown or not.
isShowPoll true, false true Specifies if the poll panel is shown or not.
isShowQuickReply true, false true Specifies if the quick reply panel is shown or not.
isShowRules true, false true Specifies if the forum rules panel is shown or not.
isShowStatistics true, false true Specifies if the statistics panel is shown or not.

Events

NameDescription
ReLoadPortletEvent Reloads UIForumPortlet.
ForumPollEvent Sets the render for UIForumPollPortlet.
ForumModerateEvent Sets the render for UIForumModeratorPortlet.
ForumRuleEvent Sets the render for UIForumRulePortlet.
QuickReplyEvent Sets the render for UIForumQuickReplyPortlet.

ReLoadPortletEvent: This event is fired through UIForumPortlet.

To receive ReLoadPortletEvent, you must use the ForumParameter class with two properties:

NameTypePossible valueDescription
topicId string Id of topic.Returns the Id of topic for UIForumPortlet.
isRenderPoll boolean true/falseIf the value is set to true or false, the UITopicPoll component is rendered or not respectively.

For example:

....

ActionResponse actionRes = pcontext.getResponse() ;
ForumParameter param = new ForumParameter() ;
param.setRenderPoll(true);
param.setTopicId(topic.get());
actionRes.setEvent(new QName("ReLoadPortletEvent"), param) ;
....

ForumPollEvent: This event is fired through UIForumPollPortlet.

To receive ForumPollEvent, you must use the ForumParameter class with four properties:

NameTypePossible valueDescription
isRenderPoll boolean True/falseIf the value is set to true or false, the UIForumPollPortlet portlet is rendered or not respectively.
categoryId string Id of categoryReturns the Id of category for UIForumPollPortlet.
forumId string Id of forumReturns the Id of forum for UIForumPollPortlet.
topicId string Id of topicReturns the Id of topic for UIForumPollPortlet.

For example:

....

ActionResponse actionRes = pcontext.getResponse() ;
ForumParameter param = new ForumParameter() ;
param.setCategoryId(categoryId) ;
param.setForumId(forumId);
param.setTopicId(topicId);
param.setRenderPoll(topic.getIsPoll());
actionRes.setEvent(new QName("ForumPollEvent"), param);
....

ForumModerateEvent: This event is fired through UIForumModeratePortlet.

To receive ForumModerateEvent, you must use the ForumParameter class with two properties:

NameTypePossible valueDescription
isRenderModerator boolean True/falseIf the value is set to true or false, the UIForumModeratePortlet portlet is rendered or not respectively.
moderator list of strings List of user nameSets data for UIForumModeratePortlet.

For example:

....

List<String> moderators = Arays.asList(forum.getModerators());
ActionResponse actionRes = pcontext.getResponse() ;
ForumParameter param = new ForumParameter() ;
param.setModerators(moderators);
param.setRenderModerator(true);
actionRes.setEvent(new QName("ForumPollEvent"), param);
....

ForumRuleEvent: This event is fired through UIForumRulePortlet.

To receive ForumRuleEvent, you must use the ForumParameter class with two properties:

NameTypePossible valueDescription
isRenderRule boolean True/falseIf the value is set to true or false, the UIForumRulePortlet portlet is rendered or not respectively.
infoRules list of strings The list of states: can create topic, can add post and topic has lock. Sets permissions for users in UIForumRulePortlet.

For example:

....

ActionResponse actionRes = pcontext.getResponse() ;
ForumParameter param = new ForumParameter() ;
List<String> list = param.getInfoRules();
if(forum.getIsClosed() || forum.getIsLock()) {
  list.set(0, "true");
} else {
  list.set(0, "false");
}
list.set(1, String.valueOf(canCreateTopic));
list.set(2, String.valueOf(isCanPost));
param.setInfoRules(list);
param.setRenderRule(true);
actionRes.setEvent(new QName("ForumRuleEvent"), param) ;
....

QuickReplyEvent: This event is fired through UIQuickReplyPortlet.

To receive QuickReplyEvent, you must use the ForumParameter class with five properties:

NameTypePossible valueDescription
isRenderQuickReply boolean True/falseIf the value is set to true or false, the UIQuickReplyPortlet portlet is rendered or not respectively.
isModerator boolean True/falseSpecifies if the user is moderator of forum containing the topic with quick reply or not.
categoryId string Id of categoryReturns the Id of category for UIQuickReplyPortlet.
forumId string Id of forumReturns the Id of forum for UIQuickReplyPortlet.
topicId string Id of topicReturns the Id of topic for UIQuickReplyPortlet.

For example:

....

ActionResponse actionRes = pcontext.getResponse() ;
ForumParameter param = new ForumParameter() ;
param.setRenderQuickReply(isCanPost);
param.setModerator(isMod);
param.setCategoryId(categoryId) ;
param.setForumId(forumId);
param.setTopicId(topicId);
actionRes.setEvent(new QName("QuickReplyEvent"), param) ;;
....
Copyright ©. All rights reserved. eXo Platform SAS
blog comments powered byDisqus