Author: soh...@jb... Date: 2006-05-04 14:16:20 -0400 (Thu, 04 May 2006) New Revision: 4094 Modified: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/Constants.java labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/ForumsJSFPortlet.java labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/ReplyTopic.java labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/topics/viewtopic_body.xhtml Log: quoting in reply topic usecase integrated Modified: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/Constants.java =================================================================== --- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/Constants.java 2006-05-04 16:52:14 UTC (rev 4093) +++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/Constants.java 2006-05-04 18:16:20 UTC (rev 4094) @@ -46,7 +46,9 @@ public static final String p_poll_title = "POLL_TITLE"; public static final String p_poll_delete = "POLL_DELETE"; public static final String p_attachment = "ATTACHMENT"; - //------------------------------------------------------------------------------------------------------------------------------- + //other constants------------------------------------------------------------------------------------------------------------------------------- + public static final String QUOTE = "quote"; + /** * DOCUMENT_ME */ Modified: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/ForumsJSFPortlet.java =================================================================== --- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/ForumsJSFPortlet.java 2006-05-04 16:52:14 UTC (rev 4093) +++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/ForumsJSFPortlet.java 2006-05-04 18:16:20 UTC (rev 4094) @@ -62,7 +62,7 @@ String attachment = ForumUtil.getParameter(request,Constants.p_attachment); String topicId = ForumUtil.getParameter(request,Constants.p_topicId); String postId = ForumUtil.getParameter(request,Constants.p_postId); - String userId = ForumUtil.getParameter(request,Constants.p_userId); + String userId = ForumUtil.getParameter(request,Constants.p_userId); if(categoryId!=null && categoryId.trim().length()>0) { response.setRenderParameter(Constants.p_categoryId,categoryId); @@ -98,6 +98,6 @@ if(postId!=null && postId.trim().length()>0) { response.setRenderParameter(Constants.p_postId,postId); - } + } } } Modified: labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/ReplyTopic.java =================================================================== --- labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/ReplyTopic.java 2006-05-04 16:52:14 UTC (rev 4093) +++ labs/jbossforums/trunk/forums/src/main/org/jboss/portlet/forums/ui/action/ReplyTopic.java 2006-05-04 18:16:20 UTC (rev 4094) @@ -86,13 +86,18 @@ //grab the forum where this topic will be added if(forumId!=-1) { + Topic topic = this.getForumsModule().findTopicById(new Integer(topicId)); + //re-initialize this controller to add a reply post in a topic //to the specified forum this.cleanup(); //set the selected forum's id and topic's id this.forumId = forumId; - this.topicId = topicId; + this.topicId = topicId; + + //set the subject information + this.subject = "Re: " + topic.getSubject(); } navState = Constants.START_REPLY; @@ -102,7 +107,34 @@ JSFUtil.handleException(e); } return navState; - } + } + + /** + * + * + */ + public String startQuote() + { + String navState = this.start(); + try + { + String p = ForumUtil.getParameter(Constants.p_postId); + if(p!=null && p.trim().length()>0) + { + postId = Integer.parseInt(p); + } + + //setup the quote information + Post post = this.getForumsModule().findPostById(new Integer(postId)); + Poster poster = PortalUtil.getPoster(); + this.message = "["+Constants.QUOTE+"="+poster.getUser().getUserName()+"]"+post.getMessage().getText()+"[/"+Constants.QUOTE+"]"; + } + catch(Exception e) + { + JSFUtil.handleException(e); + } + return navState; + } //--------execute------------------------------------------------------------------------------------------------------------- /** * Modified: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml =================================================================== --- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml 2006-05-04 16:52:14 UTC (rev 4093) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/WEB-INF/forums-config.xml 2006-05-04 18:16:20 UTC (rev 4094) @@ -13,7 +13,7 @@ <view-handler>com.sun.facelets.FaceletPortletViewHandler</view-handler--> <!-- standalone facelets integration --> - <!--view-handler>com.sun.facelets.FaceletViewHandler</view-handler--> + <view-handler>com.sun.facelets.FaceletViewHandler</view-handler> <!-- internationalization --> <locale-config> Modified: labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/topics/viewtopic_body.xhtml =================================================================== --- labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/topics/viewtopic_body.xhtml 2006-05-04 16:52:14 UTC (rev 4093) +++ labs/jbossforums/trunk/forums/src/resources/portal-forums-war/views/topics/viewtopic_body.xhtml 2006-05-04 18:16:20 UTC (rev 4094) @@ -219,6 +219,17 @@ is only for unit testing the edit post usecase --> <td valign="top" nowrap=""> + <!-- add the quote link --> + <h:commandLink action="#{replyTopic.startQuote}" style="text-decoration: none;"> + <f:param name="f" value="#{topic.topic.forum.id}"/> + <f:param name="t" value="#{topic.topic.id}"/> + <f:param name="p" value="#{postrow.id}"/> + <f:verbatim> + <img border="0" + src="#{forums:themeURL('resourceReplyLockedURL')}" + alt="${resource.Topic_locked}" /> + </f:verbatim> + </h:commandLink> <!-- add the edit post link --> <h:commandLink action="#{editPost.start}" style="text-decoration: none;"> <f:param name="p" value="#{postrow.id}"/> |