Saturday, February 27, 2010

Liferay WOL portlets in community pages

Liferay have a set of portlets called World of Liferay (WOL) portlets. Under this category there are list of portlets such as JIRA, SVN, Summery, Friends, summery wall etc. By default these portlets are working only if they are placed on a private page. (eg:My Places -> My Community -> Private pages). If we place these portlets in a community page it will give an error messaye "This application will only function when placed on a user page"

I wanted to place the JIRA portlet in one of the community page and display the content successfully. In order to do that I updated tomcat-6.0.18\webapps\wol-portlet\init.jsp file with the following code.

WindowState windowState = renderRequest.getWindowState();

String currentURL = PortalUtil.getCurrentURL(request);

Group group = GroupLocalServiceUtil.getGroup(scopeGroupId);

Organization organization = null;
User user2 = null;

if (group.isOrganization()) {
organization = OrganizationLocalServiceUtil.getOrganization(group.getClassPK());
}

else if (group.isCommunity()) {
user2 = themeDisplay.getRealUser();
}
else if (group.isUser()) {
user2 = UserLocalServiceUtil.getUserById(group.getClassPK());

}

DateFormat dateFormatDate = DateFormat.getDateInstance(DateFormat.LONG, locale);

dateFormatDate.setTimeZone(timeZone);

DateFormat dateFormatDateTime = DateFormats.getDateTime(locale, timeZone);

NumberFormat numberFormat = NumberFormat.getNumberInstance(locale);


3 comments:

  1. I created a Private Page and added Friend's Portlet & Friend's activity portlet to that page, but still I am getting the same message "This application will only function when placed on a user page."

    ReplyDelete
  2. Only thing you need to do is go to menu ->My Places -> My Community -> Private pages and then add these two portlets. It works fine for me...

    ReplyDelete