001
014
015 package com.liferay.portlet.messageboards.asset;
016
017 import com.liferay.portal.kernel.portlet.LiferayPortletRequest;
018 import com.liferay.portal.kernel.portlet.LiferayPortletResponse;
019 import com.liferay.portal.util.PortletKeys;
020 import com.liferay.portal.util.WebKeys;
021 import com.liferay.portlet.messageboards.model.MBMessage;
022
023 import javax.portlet.PortletURL;
024 import javax.portlet.RenderRequest;
025 import javax.portlet.RenderResponse;
026
027
030 public class MBDiscussionAssetRenderer extends MBMessageAssetRenderer {
031
032 public MBDiscussionAssetRenderer(MBMessage message) {
033 super(message);
034
035 _message = message;
036 }
037
038 public PortletURL getURLEdit(
039 LiferayPortletRequest liferayPortletRequest,
040 LiferayPortletResponse liferayPortletResponse) {
041
042 PortletURL editPortletURL = liferayPortletResponse.createRenderURL(
043 PortletKeys.MESSAGE_BOARDS);
044
045 editPortletURL.setParameter(
046 "struts_action", "/message_boards/edit_discussion");
047 editPortletURL.setParameter(
048 "messageId", String.valueOf(_message.getMessageId()));
049
050 return editPortletURL;
051 }
052 public String getURLViewInContext(
053 LiferayPortletRequest liferayPortletRequest,
054 LiferayPortletResponse liferayPortletResponse,
055 String noSuchEntryRedirect) {
056
057 return null;
058 }
059
060 public String render(
061 RenderRequest renderRequest, RenderResponse renderResponse,
062 String template)
063 throws Exception {
064
065 if (template.equals(TEMPLATE_ABSTRACT) ||
066 template.equals(TEMPLATE_FULL_CONTENT)) {
067
068 renderRequest.setAttribute(
069 WebKeys.MESSAGE_BOARDS_MESSAGE, _message);
070
071 return
072 "/html/portlet/message_boards/asset/discussion_" + template +
073 ".jsp";
074 }
075 else {
076 return null;
077 }
078 }
079
080 private MBMessage _message;
081
082 }