Merged V1.3 to HEAD

svn merge svn://www.alfresco.org:3691/alfresco/BRANCHES/V1.3@3099 svn://www.alfresco.org:3691/alfresco/BRANCHES/V1.3@3103 .


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@3344 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Derek Hulley
2006-07-18 15:47:14 +00:00
parent 70cdb203e0
commit 077e413f45
4 changed files with 89 additions and 58 deletions

View File

@@ -74,7 +74,6 @@ public abstract class BaseServlet extends HttpServlet
validRedirectJSPs.add("/jsp/dialog/about.jsp");
validRedirectJSPs.add("/jsp/dialog/advanced-search.jsp");
validRedirectJSPs.add("/jsp/dialog/system-info.jsp");
validRedirectJSPs.add("/jsp/forums/forums.jsp");
validRedirectJSPs.add("/jsp/users/users.jsp");
validRedirectJSPs.add("/jsp/trashcan/trash-list.jsp");
}

View File

@@ -62,32 +62,4 @@ public class CreateReplyDialog extends CreatePostDialog
{
return Application.getMessage(FacesContext.getCurrentInstance(), "reply");
}
// ------------------------------------------------------------------------------
// Bean Getters and Setters
/**
* Returns the content of the post we are replying to
*
* @return The content
*/
public String getReplyContent()
{
if (this.replyContent == null)
{
// get the content reader of the node we are replying to
NodeRef replyNode = this.browseBean.getDocument().getNodeRef();
if (replyNode != null)
{
ContentReader reader = this.contentService.getReader(replyNode, ContentModel.PROP_CONTENT);
if (reader != null)
{
this.replyContent = reader.getContentString();
}
}
}
return this.replyContent;
}
}

View File

@@ -17,6 +17,7 @@
package org.alfresco.web.bean.forums;
import java.io.IOException;
import java.io.StringWriter;
import java.io.Writer;
import java.text.MessageFormat;
import java.text.SimpleDateFormat;
@@ -536,6 +537,61 @@ public class ForumsBean implements IContextListener
}
}
/**
* Returns the HTML to represent a bubble rendition of the text of the the
* forum article being replied to.
*
* @return The HTML for the bubble
*/
public String getReplyBubbleHTML()
{
try
{
// if the forum being replied to was a new post show the orange bubble
// with the user on the left otherwise show the yellow bubble with the
// user on the right.
StringWriter writer = new StringWriter();
FacesContext context = FacesContext.getCurrentInstance();
Node replyToNode = this.browseBean.getDocument();
boolean isReplyPost = this.nodeService.hasAspect(replyToNode.getNodeRef(),
ContentModel.ASPECT_REFERENCING);
String contextPath = context.getExternalContext().getRequestContextPath();
String colour = isReplyPost ? "yellow" : "orange";
String bgColour = isReplyPost ? "#FFF5A3" : "#FCC75E";
// build the HTML to represent the user that posted the article being replied to
StringBuilder replyPosterHTML = new StringBuilder("<td valign='top'>");
replyPosterHTML.append("<img src='");
replyPosterHTML.append(contextPath);
replyPosterHTML.append("/images/icons/user_large.gif' /><br/>");
replyPosterHTML.append((String)replyToNode.getProperties().get("creator"));
replyPosterHTML.append("</td>");
// start the table
writer.write("<table border='0' cellpadding='0' cellspacing='0' width='100%'><tr>");
if (isReplyPost)
{
renderReplyContentHTML(context, replyToNode, writer, contextPath, colour, bgColour);
writer.write(replyPosterHTML.toString());
}
else
{
writer.write(replyPosterHTML.toString());
renderReplyContentHTML(context, replyToNode, writer, contextPath, colour, bgColour);
}
// finish the table
writer.write("</tr></table>");
return writer.toString();
}
catch (IOException ioe)
{
throw new AlfrescoRuntimeException("Failed to render reply bubble HTML", ioe);
}
}
// ------------------------------------------------------------------------------
// IContextListener implementation
@@ -947,7 +1003,7 @@ public class ForumsBean implements IContextListener
// ------------------------------------------------------------------------------
// Private helpers
// Helpers
/**
* Initialise default values from client configuration
@@ -984,6 +1040,37 @@ public class ForumsBean implements IContextListener
}
}
protected void renderReplyContentHTML(FacesContext context,
Node replyToNode, StringWriter writer,
String contextPath, String colour, String bgColour)
throws IOException
{
// get the content of the article being replied to
String replyContent = "";
ContentReader reader = this.contentService.getReader(replyToNode.getNodeRef(),
ContentModel.PROP_CONTENT);
if (reader != null)
{
replyContent = reader.getContentString();
}
// get the date of the article being replied to
String postedDate = Utils.getDateTimeFormat(context).
format(replyToNode.getProperties().get("created"));
// generate the HTML
writer.write("<td width='100%'>");
TopicBubbleViewRenderer.renderBubbleTop(writer, contextPath, colour, bgColour);
writer.write("<span class='mainSubTitle'>");
writer.write(Application.getMessage(context, "posted"));
writer.write(":&nbsp</span>");
writer.write(postedDate);
TopicBubbleViewRenderer.renderBubbleMiddle(writer, contextPath, colour);
writer.write(replyContent);
TopicBubbleViewRenderer.renderBubbleBottom(writer, contextPath, colour);
writer.write("</td>");
}
/**
* Class to implement a bubble view for the RichList component used in the topics screen
*

View File

@@ -19,8 +19,6 @@
<%@ taglib uri="/WEB-INF/alfresco.tld" prefix="a" %>
<%@ taglib uri="/WEB-INF/repo.tld" prefix="r" %>
<%@ page import="org.alfresco.web.bean.forums.ForumsBean.TopicBubbleViewRenderer" %>
<f:verbatim>
<script type="text/javascript">
document.getElementById("dialog:dialog-body:message").focus();
@@ -51,31 +49,6 @@
</h:panelGrid>
</h:panelGrid>
<f:verbatim>
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="100%">
<% TopicBubbleViewRenderer.renderBubbleTop(out, request.getContextPath(), "yellow", "#FFF5A3"); %>
</f:verbatim>
<h:outputText value="#{msg.posted}:&nbsp" styleClass="mainSubTitle" escape="false" />
<h:outputText value="#{BrowseBean.document.properties.created}">
<a:convertXMLDate type="both" pattern="#{msg.date_time_pattern}" />
</h:outputText>
<f:verbatim>
<% TopicBubbleViewRenderer.renderBubbleMiddle(out, request.getContextPath(), "yellow"); %>
</f:verbatim>
<h:outputText value="#{DialogManager.bean.replyContent}" escape="false" />
<f:verbatim>
<% TopicBubbleViewRenderer.renderBubbleBottom(out, request.getContextPath(), "yellow"); %>
</td>
<td valign="top">
</f:verbatim>
<h:graphicImage id="poster" url="/images/icons/user_large.gif" />
<h:outputText value="<br/>#{BrowseBean.document.properties.creator}" escape="false" />
<f:verbatim>
</td>
</tr>
</table>
</f:verbatim>
<h:outputText value="#{ForumsBean.replyBubbleHTML}" escape="false" />