The Forum portlet is the application for users to post and read messages on different topics.
{docbook}
<para>
<citetitle>
<emphasis role="bold">
Package
</emphasis>
</citetitle>
</para>
{docbook}
This portlet is packaged in the _forum.war_ file.

{docbook}
<para xml:id="KSref.FoumPortlet.ForumPortletxml">
<citetitle>
<emphasis role="bold">
Portlet.xml
</emphasis>
</citetitle>
</para>
{docbook}

* See the _portlet.xml_ file in the project following this path: _forum/WEB-INF/portlet.xml_.
	
{docbook}
<para xml:id="KSref.ForumPortlet.ForumPortletPreferences">
<citetitle>
<emphasis role="bold">
Preferences
</emphasis>
</citetitle>
</para>
{docbook}

|| Preference name || Possible value || Default value || Description ||
| *useAjax* | {{true}}, {{false}} | {{true}} | Define 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}} | Specify if a post is new. If the post is created within the set period, it is new in the Forum. |
| *enableIPLogging* | {{true}}, {{false}} | {{true}} | Enable the IP logging function in the Forum. IP addresses of all posts will be collected. |
| *enableIPFiltering* | {{true}}, {{false}} | {{true}} | Enable the IP filter function in Forum, enabling IP addresses to be blocked in the Forum. |
| *invisibleCategories* | {{id categories}} | {{empty}} | Hide some categories. If the value is set empty, all categories of the Forum will be shown. |
| *invisibleForums* | {{id forums}} | {{empty}} | Hide some Forums. All Forums will be shown if the value is set empty. |
| *uploadFileSizeLimitMB* | {{integer}} | {{20}} | Limit the size of uploaded files in MB in the Forum. |
| *isShowForumJump* | {{true}}, {{false}} | {{true}} | Specify if the Forum jump panel is shown or not. |
| *isShowIconsLegend* | {{true}}, {{false}} | {{true}} | Specify if the icon legends panel is shown or not. |
| *isShowModerators* | {{true}}, {{false}} | {{true}} | Specify if the moderators panel is shown or not. |
| *isShowPoll* | {{true}}, {{false}} | {{true}} | Specify if the poll panel is shown or not. |
| *isShowQuickReply* | {{true}}, {{false}} | {{true}} | Specify if the quick reply panel is shown or not. |
| *isShowRules* | {{true}}, {{false}} | {{true}} | Specify if the forum rules panel is shown or not. |
| *isShowStatistics* | {{true}}, {{false}} | {{true}} | Specify if the statistics panel is shown or not. |


{docbook}
<para xml:id="KSref.ForumPortlet.Event">
<citetitle>
<emphasis role="bold">
Events
</emphasis>
</citetitle>
</para>
{docbook}

|| Name || Description ||
| *[ForumLinkEvent|#KSref.ForumPortlet.ForumLinkEvent]* | Set the render for UIForumLinkPortlet and set values for UIForumLinks. |
| *[ReLoadPortletEvent|#KSref.ForumPortlet.ReLoadPortletEvent]* | Reload UIForumPortlet. |
| *[OpenLink|#KSref.ForumPortlet.OpenLink]* | Update values for UIForumLinks. |
| *[ForumPollEvent|#KSref.ForumPortlet.ForumPollEvent]* | Set the render for UIForumPollPortlet. |
| *[ForumModerateEvent|#KSref.ForumPortlet.ForumModerateEvent]* | Set the render for UIForumModeratorPortlet. |
| *[ForumRuleEvent|#KSref.ForumPortlet.ForumRuleEvent]* | Set the render for UIForumRulePortlet. |
| *[QuickReplyEvent|#KSref.ForumPortlet.QuickReplyEvent]* | Set the render for UIForumQuickReplyPortlet. |

*ForumLinkEvent* {anchor:id=KSref.ForumPortlet.ForumLinkEvent}
This event is fired through UIForumLinkPortlet. 

To receive ForumLinkEvent, you must use the _ForumParameter_ class with two properties:

|| Name || Type || Possible value || Description ||
| *isRenderForumLink* | {{boolean}} | true/false | If the value is set to true or false, the Forum link is rendered or not respectively. |
| *path* | {{string}} | The absolute path of the class node (including types: category, forum, topic) defined by JCR. | Set data for the UIForumLinkPortlet.|

For example:

{code:java}PortletRequestContext pcontext = (PortletRequestContext) WebuiRequestContext.getCurrentInstance();
ActionResponse actionRes = (ActionResponse) pcontext.getResponse();
ForumParameter param = new ForumParameter();
String path = forum.getPath();
if ( ...condition to render the UIForumLinkPortlet... ) {
  param.setRenderForumLink(true);
  param.setPath(path);
} else {
  param.setRenderForumLink(false);
}
actionRes.setEvent(new QName("ForumLinkEvent"), param) ;{code}

*ReLoadPortletEvent* {anchor:id=KSref.ForumPortlet.ReLoadPortletEvent}
This event is fired through UIForumPortlet. 

To receive ReLoadPortletEvent, you must use the _ForumParameter_ class with two properties:
|| Name || Type || Possible value || Description ||
| *topicId* | {{string}} | Id of topic. | Return the id of topic for UIForumPortlet |
| *isRenderPoll* | {{boolean}} | true/false | If the value is set to true or false, the _UITopicPoll_ component is rendered or not respectively. |

For example:

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

*OpenLink* {anchor:id=KSref.ForumPortlet.OpenLink}
This event is fired through UIForumPortlet. 

To receive OpenLink, you must use the _ForumParameter_ class with one property:
|| Name || Type || Possible value || Description ||
| *path* | {{string}} | The absolute path of the node defined by JCR. | Set data for the UIForumPortlet. |

For example:

{code:java}....
ActionResponse actionRes = pcontext.getResponse() ;
ForumParameter param = new ForumParameter() ;
param.setPath(path);
actionRes.setEvent(new QName("OpenLink"), param) ;
....{code}

*ForumPollEvent* {anchor:id=KSref.ForumPortlet.ForumPollEvent}
This event is fired through UIForumPollPortlet.

To receive ForumPollEvent, you must use the _ForumParameter_ class with four properties:
|| Name || Type || Possible value || Description ||
| *isRenderPoll* | {{boolean}} | True/false | If the value is set to true or false, the _UIForumPollPortlet_ portlet is rendered or not respectively. |
| *categoryId* | {{string}} | Id of category | Return  the Id of category for UIForumPollPortlet. |
| *forumId* | {{string}} | Id of forum | Return the Id of forum for UIForumPollPortlet. |
| *topicId* | {{string}} | Id of topic | Return the Id of topic for UIForumPollPortlet. |

For example:

{code:java}....
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);
....{code}

*ForumModerateEvent* {anchor:id=KSref.ForumPortlet.ForumModerateEvent}
This event is fired through UIForumModeratePortlet.

To receive ForumModerateEvent, you must use the _ForumParameter_ class with two properties:
|| Name || Type || Possible value || Description ||
| *isRenderModerator* | {{boolean}} | True/false | If the value is set to true or false, the _UIForumModeratePortlet_ portlet is rendered or not respectively. |
| *moderator* | {{list of strings}} | List of user name | Set data for UIForumModeratePortlet. |

For example:

{code:java}....
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);
....{code}

*ForumRuleEvent* {anchor:id=KSref.ForumPortlet.ForumRuleEvent}
This event is fired through UIForumRulePortlet.

To receive ForumRuleEvent, you must use the _ForumParameter_ class with two properties:
|| Name || Type || Possible value || Description ||
| *isRenderRule* | {{boolean}} | True/false | If 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*. | Set permissions for users in UIForumRulePortlet. |

For example:

{code:java}....
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) ;
....{code}

*QuickReplyEvent* {anchor:id=KSref.ForumPortlet.QuickReplyEvent}
This event is fired through UIQuickReplyPortlet.

To receive QuickReplyEvent, you must use the _ForumParameter_ class with five properties:
|| Name || Type || Possible value || Description ||
| *isRenderQuickReply* | {{boolean}} | True/false | If the value is set to true or false, the _UIQuickReplyPortlet_ portlet is rendered or not respectively. |
| *isModerator* | {{boolean}} | True/false | Specify if the user is moderator of forum containing the topic with quick reply or not. |
| *categoryId* | {{string}} | Id of category | Return the Id of category for UIQuickReplyPortlet. |
| *forumId* | {{string}} | Id of forum | Return the Id of forum for UIQuickReplyPortlet. |
| *topicId* | {{string}} | Id of topic | Return the Id of topic for UIQuickReplyPortlet. |

For example:

{code:java}....
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) ;;
....{code}