Commit 205a03b2 authored by saurabh's avatar saurabh
Browse files

created comment module

parent 3f635168
.gradle/
build/
target/
\ No newline at end of file
Bundle-Name: commentModule
Bundle-SymbolicName: comment
Bundle-Version: 1.0.0
Export-Package: comment.constants
\ No newline at end of file
dependencies {
compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "2.0.0"
compileOnly group: "com.liferay.portal", name: "com.liferay.util.taglib", version: "2.0.0"
compileOnly group: "javax.portlet", name: "portlet-api", version: "2.0"
compileOnly group: "javax.servlet", name: "javax.servlet-api", version: "3.0.1"
compileOnly group: "jstl", name: "jstl", version: "1.2"
compileOnly group: "org.osgi", name: "osgi.cmpn", version: "6.0.0"
compile project (":modules:ideaService:ideaService-api")
compile project (":modules:projectService:projectService-api")
}
package comment.constants;
/**
* @author singh
*/
public class commentPortletKeys {
public static final String comment = "comment";
}
\ No newline at end of file
package comment.portlet;
import comment.constants.commentPortletKeys;
import ideaService.model.Ideas;
import ideaService.service.IdeasLocalServiceUtil;
import projectService.service.ProjectLocalServiceUtil;
import com.liferay.asset.kernel.model.AssetEntry;
import com.liferay.asset.kernel.service.AssetEntryLocalServiceUtil;
import com.liferay.portal.kernel.exception.SystemException;
import com.liferay.portal.kernel.portlet.bridges.mvc.MVCPortlet;
import com.liferay.portal.kernel.theme.ThemeDisplay;
import com.liferay.portal.kernel.util.WebKeys;
import java.io.IOException;
import javax.portlet.ActionRequest;
import javax.portlet.ActionResponse;
import javax.portlet.Portlet;
import javax.portlet.PortletException;
import javax.portlet.RenderRequest;
import javax.portlet.RenderResponse;
import org.osgi.service.component.annotations.Component;
/**
* @author singh
*/
@Component(
immediate = true,
property = {
"com.liferay.portlet.display-category=category.EEN",
"com.liferay.portlet.instanceable=true",
"javax.portlet.display-name=commentModule",
"javax.portlet.init-param.template-path=/",
"javax.portlet.init-param.view-template=/view.jsp",
"javax.portlet.name=" + commentPortletKeys.comment,
"javax.portlet.resource-bundle=content.Language",
"javax.portlet.security-role-ref=power-user,user"
},
service = Portlet.class
)
public class commentPortlet extends MVCPortlet {
@Override
public void doView(RenderRequest renderRequest, RenderResponse renderResponse) throws IOException, PortletException {
try{
ThemeDisplay themeDisplay = ((ThemeDisplay)(renderRequest.getAttribute(WebKeys.THEME_DISPLAY)));
long currentUserId = themeDisplay.getUserId();
long layoutRef = (themeDisplay.getLayout().getPrimaryKey());
Ideas idea = IdeasLocalServiceUtil.getIdeasByLayoutIdRef(layoutRef);
renderRequest.setAttribute("classPK", idea.getIdeasId());
renderRequest.setAttribute("userID", themeDisplay.getUserId());
renderRequest.setAttribute("currentURL", themeDisplay.getURLCurrent());
renderRequest.setAttribute("className", Ideas.class.getName());
}catch(Exception ex){
System.out.println(ex);
}
super.doView(renderRequest, renderResponse);
}
@SuppressWarnings("deprecation")
public void commentTestSubmit(ActionRequest request, ActionResponse response)throws PortletException, SystemException {
try{
System.out.println("comes here");
invokeTaglibDiscussion(request, response);
}catch (Exception e){
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
\ No newline at end of file
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/portlet_2_0" prefix="portlet" %>
<%@ taglib uri="http://liferay.com/tld/aui" prefix="aui" %>
<%@taglib uri="http://liferay.com/tld/portlet" prefix="liferay-portlet" %>
<%@taglib uri="http://liferay.com/tld/theme" prefix="liferay-theme" %>
<%@taglib uri="http://liferay.com/tld/ui" prefix="liferay-ui" %>
<%@ taglib prefix="liferay-ui" uri="http://liferay.com/tld/ui" %>
<%@ taglib prefix="portlet" uri="http://java.sun.com/portlet_2_0" %>
<liferay-theme:defineObjects />
<portlet:defineObjects />
\ No newline at end of file
<%@ include file="/init.jsp" %>
<%@ taglib prefix="liferay-ui" uri="http://liferay.com/tld/ui" %>
<%@ taglib prefix="portlet" uri="http://java.sun.com/portlet_2_0" %>
<c:set var="currentUrl" value="${currentURL}"/>
<c:set var="class" value="${className}"/>
<portlet:actionURL name="commentTestSubmit" var="discussionURL" />
<liferay-ui:discussion classPK="${classPK}" userId="${userID}" className="${class}" formAction="<%= discussionURL%>" formName="fm2" redirect="${currentUrl}"/>
\ No newline at end of file
javax.portlet.display-name.commentModule=commentModule JSP
javax.portlet.keywords.commentModule=commentModule,jsp
javax.portlet.short-title.commentModule=commentModule JSP
javax.portlet.title.commentModule=commentModule JSP Portlet
commentModule.caption=Hello from commentModule JSP!
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment