Fórum

Adding comment functionality in Custom Portlet.

thumbnail
Praful Shukla, modificado 7 Anos atrás.

Adding comment functionality in Custom Portlet.

Junior Member Postagens: 46 Data de Entrada: 29/09/15 Postagens Recentes
Hello Everyone,

I've created a custom portlet, which displays profile picture of all the users in any particular organisation and it is working fine. Following is the code for the same.
Now I want to integrate comment functionality just like the one in Blogs and Message Boards.
How this can be achieved..?? Any help..???

view.jsp:


<%@page import="com.liferay.portlet.messageboards.service.MBMessageLocalServiceUtil"%>
<%@page import="com.liferay.portlet.messageboards.model.MBMessageDisplay"%>
<%@page import="com.liferay.portal.kernel.language.LanguageUtil"%>
<%@page import="com.liferay.portal.kernel.util.OrderByComparator"%>
<%@page import="com.liferay.portal.util.PortalUtil"%>
<%@page import="com.liferay.portal.service.OrganizationLocalServiceUtil"%>
<%@page import="com.liferay.portal.model.Organization"%>
<%@page import="com.liferay.portal.service.GroupLocalServiceUtil"%>
<%@page import="com.liferay.portal.kernel.util.WebKeys"%>
<%@page import="com.liferay.portal.theme.ThemeDisplay"%>
<%@page import="com.liferay.portal.kernel.dao.orm.QueryUtil"%>
<%@page import="com.liferay.portal.service.UserLocalServiceUtil"%>
<%@page import="com.liferay.portal.model.User"%>
<%@page import="java.util.List"%>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet"%>

<portlet:defineObjects />



<style>
.myDiv {
float: left;
width: 33%;
}
</style>

<%
ThemeDisplay themeDisplay = (ThemeDisplay) request
.getAttribute(WebKeys.THEME_DISPLAY);
%>
<c:if test="<%=themeDisplay.isSignedIn()%>">
<%
int i = UserLocalServiceUtil.getOrganizationUsersCount(12099);
List<User> user = UserLocalServiceUtil
.getOrganizationUsers(12099);
String imgsrc = "/image/user_male_portrait?img_id=";
for (int j = 0; j < i; j++) {
%>
<div class = "myDiv" >

<img src="<%=imgsrc + user.get(j).getPortraitId()%>" width="300px" />


</div>

<%
}
%>

</c:if>


thumbnail
David H Nebinger, modificado 7 Anos atrás.

RE: Adding comment functionality in Custom Portlet.

Liferay Legend Postagens: 14919 Data de Entrada: 02/09/06 Postagens Recentes
Comments are tied to the asset framework.

You should define a custom entity which represents each constructed image and add asset support to it.

After that you can use the Liferay tag libs to add comment support in the jsp page.