Next phase of forums functionality

Simple dialog framework implementation

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2056 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Gavin Cornwell
2005-12-22 11:57:43 +00:00
parent 6df515c801
commit a4564a1a49
65 changed files with 1215 additions and 560 deletions

View File

@@ -17,6 +17,8 @@
*/
package org.alfresco.web.app;
import java.util.Stack;
import javax.faces.application.NavigationHandler;
import javax.faces.application.ViewHandler;
import javax.faces.component.UIViewRoot;
@@ -38,7 +40,12 @@ import org.springframework.web.jsf.FacesContextUtils;
*/
public class AlfrescoNavigationHandler extends NavigationHandler
{
public final static String DIALOG_SEPARATOR = ":";
public final static String DIALOG_PREXIX = "dialog" + DIALOG_SEPARATOR;
public final static String CLOSE_DIALOG_OUTCOME = DIALOG_PREXIX + "close";
private final static Log logger = LogFactory.getLog(AlfrescoNavigationHandler.class);
private final static String VIEW_STACK = "_alfViewStack";
// The original navigation handler
private NavigationHandler origHandler;
@@ -58,102 +65,228 @@ public class AlfrescoNavigationHandler extends NavigationHandler
* @see javax.faces.application.NavigationHandler#handleNavigation(javax.faces.context.FacesContext, java.lang.String, java.lang.String)
*/
@Override
@SuppressWarnings("unchecked")
public void handleNavigation(FacesContext context, String fromAction, String outcome)
{
if (logger.isDebugEnabled())
logger.debug("handleNavigation (fromAction=" + fromAction + ", outcome=" + outcome + ")");
boolean useOriginalNavHandler = true;
String finalOutcome = outcome;
boolean closingDialog = false;
String viewId = context.getViewRoot().getViewId();
if (logger.isDebugEnabled())
logger.debug("Current view id: " + viewId);
NavigationBean navBean = (NavigationBean)context.getExternalContext().
getSessionMap().get("NavigationBean");
// only continue if we have some dispatching context
if (navBean != null && navBean.getDispatchContextNode() != null)
// determine if we are dealing with a dialog
if (outcome != null && outcome.startsWith(DIALOG_PREXIX))
{
Node node = navBean.getDispatchContextNode();
if (logger.isDebugEnabled())
logger.debug("Found node in dispatch context: " + node);
// determine whether it's being closed or opened
closingDialog = outcome.startsWith(CLOSE_DIALOG_OUTCOME);
// remove the dialog prefix
outcome = outcome.substring(DIALOG_PREXIX.length());
// see if there is any navigation config for the node type
ConfigService configSvc = (ConfigService)FacesContextUtils.getRequiredWebApplicationContext(
context).getBean(Application.BEAN_CONFIG_SERVICE);
Config nodeConfig = configSvc.getConfig(node);
NavigationConfigElement navigationCfg = (NavigationConfigElement)nodeConfig.
getConfigElement(NavigationElementReader.ELEMENT_NAVIGATION);
if (navigationCfg != null)
if (closingDialog)
{
// see if there is config for the current view state
NavigationResult navResult = navigationCfg.getOverride(viewId, outcome);
if (navResult != null)
// if we are closing the dialog take the view off the
// top of the stack then decide whether to use the view
// or any overridden outcome that may be present
if (getViewStack(context).empty() == false)
{
if (logger.isDebugEnabled())
logger.debug("Found navigation config: " + navResult);
if (navResult.isOutcome())
String newViewId = (String)getViewStack(context).pop();
// is there an overiddent outcome?
int idx = outcome.indexOf(DIALOG_SEPARATOR);
if (idx == -1)
{
finalOutcome = navResult.getResult();
// there isn't an overidden outcome so go back to the previous view
if (logger.isDebugEnabled())
logger.debug("Closing dialog, going back to view id: " + newViewId);
goToView(context, newViewId);
}
else
{
String newViewId = navResult.getResult();
// there is an overidden outcome so extract it
outcome = outcome.substring(idx+1, outcome.length());
if (logger.isDebugEnabled())
logger.debug("Closing dialog with an overridden outcome of '" + outcome + "'");
if (newViewId.equals(viewId) == false)
this.origHandler.handleNavigation(context, fromAction, outcome);
}
}
else
{
// we are trying to close a dialog when one hasn't been opened!
// log a warning and return a null outcome to stay on the same page
if (logger.isWarnEnabled())
{
logger.warn("Attempting to close a dialog with an empty view stack, returning 'browse' outcome");
}
// TODO: change this back to returning null outcome as that
// will highlight any areas we have neglected to launch
// in a dilaog, for backwards compatibility for the short
// term return 'browse' outcome.
this.origHandler.handleNavigation(context, fromAction, "browse");
}
}
else
{
// if we are opening a dialog push the current view id
// on to the stack, but only if it is different than the
// current view at the top (you can't launch a dialog from
// the same page 2 times in a row!)
// TODO: This wouldn't happen if we could be sure a dialog is
// ALWAYS exited properly, look into a way of ensuring
// dialogs get closed if a user navigates away from the page,
// would a PhaseListener help in any way??
if (getViewStack(context).empty() ||
viewId.equals(getViewStack(context).peek()) == false)
{
getViewStack(context).push(viewId);
if (logger.isDebugEnabled())
logger.debug("Pushed current view to stack: " + viewId);
}
else
{
if (getViewStack(context).empty() == false && logger.isDebugEnabled())
{
logger.debug("current view is already top the view stack!");
}
}
}
if (logger.isDebugEnabled())
logger.debug("view stack: " + getViewStack(context));
}
if (closingDialog == false)
{
NavigationBean navBean = (NavigationBean)context.getExternalContext().
getSessionMap().get("NavigationBean");
// only continue if we have some dispatching context
if (navBean != null && navBean.getDispatchContextNode() != null)
{
Node node = navBean.getDispatchContextNode();
if (logger.isDebugEnabled())
logger.debug("Found node with type '" + node.getType().toString() +
"' in dispatch context");
// see if there is any navigation config for the node type
ConfigService configSvc = (ConfigService)FacesContextUtils.getRequiredWebApplicationContext(
context).getBean(Application.BEAN_CONFIG_SERVICE);
Config nodeConfig = configSvc.getConfig(node);
NavigationConfigElement navigationCfg = (NavigationConfigElement)nodeConfig.
getConfigElement(NavigationElementReader.ELEMENT_NAVIGATION);
if (navigationCfg != null)
{
// see if there is config for the current view state
NavigationResult navResult = navigationCfg.getOverride(viewId, outcome);
if (navResult != null)
{
if (logger.isDebugEnabled())
logger.debug("Found navigation config: " + navResult);
if (navResult.isOutcome())
{
useOriginalNavHandler = false;
if (logger.isDebugEnabled())
logger.debug("Dispatching to new view id: " + newViewId);
ViewHandler viewHandler = context.getApplication().getViewHandler();
UIViewRoot viewRoot = viewHandler.createView(context, newViewId);
viewRoot.setViewId(newViewId);
context.setViewRoot(viewRoot);
context.renderResponse();
outcome = navResult.getResult();
}
else
{
if (logger.isDebugEnabled())
logger.debug("New view id is the same as the current one so setting outcome to null");
String newViewId = navResult.getResult();
finalOutcome = null;
if (newViewId.equals(viewId) == false)
{
useOriginalNavHandler = false;
if (logger.isDebugEnabled())
logger.debug("Dispatching to new view id: " + newViewId);
goToView(context, newViewId);
}
else
{
if (logger.isDebugEnabled())
logger.debug("New view id is the same as the current one so setting outcome to null");
outcome = null;
}
}
}
else if (logger.isDebugEnabled())
{
logger.debug("No override configuration found for current view or outcome");
}
}
else if (logger.isDebugEnabled())
{
logger.debug("No override configuration found for current view or outcome");
logger.debug("No navigation configuration found for node");
}
// reset the dispatch context
navBean.resetDispatchContext();
}
else if (logger.isDebugEnabled())
{
logger.debug("No navigation configuration found for node");
logger.debug("No dispatch context found");
}
// reset the dispatch context
navBean.resetDispatchContext();
}
else if (logger.isDebugEnabled())
{
logger.debug("No dispatch context found");
}
// do the appropriate navigation handling
if (useOriginalNavHandler)
{
if (logger.isDebugEnabled())
logger.debug("Passing outcome '" + finalOutcome + "' to original navigation handler");
this.origHandler.handleNavigation(context, fromAction, finalOutcome);
// do the appropriate navigation handling
if (useOriginalNavHandler)
{
if (logger.isDebugEnabled())
logger.debug("Passing outcome '" + outcome + "' to original navigation handler");
this.origHandler.handleNavigation(context, fromAction, outcome);
}
}
}
/**
* Dispatches to the given view id
*
* @param context Faces context
* @param viewId The view id to go to
*/
private void goToView(FacesContext context, String viewId)
{
ViewHandler viewHandler = context.getApplication().getViewHandler();
UIViewRoot viewRoot = viewHandler.createView(context, viewId);
viewRoot.setViewId(viewId);
context.setViewRoot(viewRoot);
context.renderResponse();
}
/**
* Returns the view stack for the current user.
*
* @param context FacesContext
* @return A Stack representing the views that have launched dialogs in
* the users session, will never be null
*/
@SuppressWarnings("unchecked")
private Stack getViewStack(FacesContext context)
{
Stack viewStack = (Stack)context.getExternalContext().getSessionMap().get(VIEW_STACK);
if (viewStack == null)
{
viewStack = new Stack();
context.getExternalContext().getSessionMap().put(VIEW_STACK, viewStack);
}
return viewStack;
}
}

View File

@@ -28,6 +28,7 @@ import javax.faces.event.ActionEvent;
import javax.transaction.UserTransaction;
import org.alfresco.model.ContentModel;
import org.alfresco.model.ForumModel;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.dictionary.TypeDefinition;
import org.alfresco.service.cmr.lock.LockService;
@@ -43,6 +44,8 @@ import org.alfresco.service.cmr.search.ResultSetRow;
import org.alfresco.service.cmr.search.SearchService;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.RegexQNamePattern;
import org.alfresco.web.app.AlfrescoNavigationHandler;
import org.alfresco.web.app.Application;
import org.alfresco.web.app.context.IContextListener;
import org.alfresco.web.app.context.UIContextService;
@@ -399,6 +402,7 @@ public class BrowseBean implements IContextListener
node.addPropertyResolver("size", this.resolverSize);
node.addPropertyResolver("cancelCheckOut", this.resolverCancelCheckOut);
node.addPropertyResolver("checkIn", this.resolverCheckIn);
node.addPropertyResolver("beingDiscussed", this.resolverBeingDiscussed);
node.addPropertyResolver("editLinkType", this.resolverEditLinkType);
node.addPropertyResolver("webdavUrl", this.resolverWebdavUrl);
node.addPropertyResolver("cifsPath", this.resolverCifsPath);
@@ -490,9 +494,9 @@ public class BrowseBean implements IContextListener
// build a NodeRef for the specified Id and our store
parentRef = new NodeRef(Repository.getStoreRef(), parentNodeId);
}
// TODO: can we improve the Get here with an API call for children of a specific type?
List<ChildAssociationRef> childRefs = this.nodeService.getChildAssocs(parentRef);
List<ChildAssociationRef> childRefs = this.nodeService.getChildAssocs(parentRef,
ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);
this.containerNodes = new ArrayList<Node>(childRefs.size());
this.contentNodes = new ArrayList<Node>(childRefs.size());
for (ChildAssociationRef ref: childRefs)
@@ -517,6 +521,7 @@ public class BrowseBean implements IContextListener
// create our Node representation
MapNode node = new MapNode(nodeRef, this.nodeService, true);
node.addPropertyResolver("icon", this.resolverSpaceIcon);
node.addPropertyResolver("beingDiscussed", this.resolverBeingDiscussed);
this.containerNodes.add(node);
}
@@ -632,6 +637,7 @@ public class BrowseBean implements IContextListener
node.addPropertyResolver("path", this.resolverPath);
node.addPropertyResolver("displayPath", this.resolverDisplayPath);
node.addPropertyResolver("icon", this.resolverSpaceIcon);
node.addPropertyResolver("beingDiscussed", this.resolverBeingDiscussed);
this.containerNodes.add(node);
}
@@ -732,6 +738,12 @@ public class BrowseBean implements IContextListener
}
};
public NodePropertyResolver resolverBeingDiscussed = new NodePropertyResolver() {
public Object get(Node node) {
return node.hasAspect(ForumModel.ASPECT_DISCUSSABLE);
}
};
public NodePropertyResolver resolverDownload = new NodePropertyResolver() {
public Object get(Node node) {
return DownloadContentServlet.generateDownloadURL(node.getNodeRef(), node.getName());
@@ -865,9 +877,7 @@ public class BrowseBean implements IContextListener
try
{
NodeRef ref = new NodeRef(Repository.getStoreRef(), id);
// refresh UI based on node selection
updateUILocation(ref);
clickSpace(ref);
}
catch (InvalidNodeRefException refErr)
{
@@ -877,6 +887,17 @@ public class BrowseBean implements IContextListener
}
}
/**
* Action called when a folder space is clicked.
*
* @param nodeRef The node being clicked
*/
public void clickSpace(NodeRef nodeRef)
{
// refresh UI based on node selection
updateUILocation(nodeRef);
}
/**
* Handler called when a path element is clicked - navigate to the appropriate Space
*/

View File

@@ -48,7 +48,7 @@ public class ExportBean
private static final String ALL_SPACES = "all";
private static final String CURRENT_SPACE = "current";
private static final String DEFAULT_OUTCOME = "browse";
private static final String DEFAULT_OUTCOME = "dialog:close";
private static final String MSG_ERROR = "error_export";

View File

@@ -17,11 +17,15 @@
package org.alfresco.web.bean;
import java.io.IOException;
import java.io.Writer;
import java.text.MessageFormat;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
@@ -29,6 +33,7 @@ import javax.faces.context.ResponseWriter;
import javax.faces.event.ActionEvent;
import javax.transaction.UserTransaction;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel;
import org.alfresco.model.ForumModel;
import org.alfresco.service.cmr.dictionary.DictionaryService;
@@ -44,6 +49,8 @@ import org.alfresco.service.cmr.search.QueryParameterDefinition;
import org.alfresco.service.cmr.search.SearchService;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.RegexQNamePattern;
import org.alfresco.web.app.AlfrescoNavigationHandler;
import org.alfresco.web.app.Application;
import org.alfresco.web.app.context.IContextListener;
import org.alfresco.web.app.context.UIContextService;
@@ -53,6 +60,7 @@ import org.alfresco.web.bean.repository.NodePropertyResolver;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.config.ClientConfigElement;
import org.alfresco.web.ui.common.Utils;
import org.alfresco.web.ui.common.component.UIActionLink;
import org.alfresco.web.ui.common.component.UIModeList;
import org.alfresco.web.ui.common.component.data.UIColumn;
import org.alfresco.web.ui.common.component.data.UIRichList;
@@ -428,8 +436,8 @@ public class ForumsBean implements IContextListener
parentRef = new NodeRef(Repository.getStoreRef(), parentNodeId);
}
// TODO: can we improve the Get here with an API call for children of a specific type?
List<ChildAssociationRef> childRefs = this.nodeService.getChildAssocs(parentRef);
List<ChildAssociationRef> childRefs = this.nodeService.getChildAssocs(parentRef,
ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);
this.forums = new ArrayList<Node>(childRefs.size());
this.topics = new ArrayList<Node>(childRefs.size());
this.posts = new ArrayList<Node>(childRefs.size());
@@ -596,6 +604,13 @@ public class ForumsBean implements IContextListener
// push the view mode into the lists
setForumsViewMode(viewMode);
// get the default for the forum page
this.forumsPageSize = this.clientConfig.getDefaultPageSize(PAGE_NAME_FORUMS,
this.forumsViewMode);
if (logger.isDebugEnabled())
logger.debug("Set default forums page size to: " + this.forumsPageSize);
}
/**
@@ -612,6 +627,13 @@ public class ForumsBean implements IContextListener
// push the view mode into the lists
setForumViewMode(viewMode);
// get the default for the forum page
this.forumPageSize = this.clientConfig.getDefaultPageSize(PAGE_NAME_FORUM,
this.forumViewMode);
if (logger.isDebugEnabled())
logger.debug("Set default forum page size to: " + this.forumPageSize);
}
/**
@@ -628,6 +650,137 @@ public class ForumsBean implements IContextListener
// push the view mode into the lists
setTopicViewMode(viewMode);
// change the default page size if necessary
this.topicPageSize = this.clientConfig.getDefaultPageSize(PAGE_NAME_TOPIC,
this.topicViewMode);
if (logger.isDebugEnabled())
logger.debug("Set default topic page size to: " + this.topicPageSize);
}
/**
* Event handler called when a user wants to view or participate
* in a discussion on an object
*
* @param event ActionEvent
*/
public void discuss(ActionEvent event)
{
UIActionLink link = (UIActionLink)event.getComponent();
Map<String, String> params = link.getParameterMap();
String id = params.get("id");
if (id == null || id.length() == 0)
{
throw new AlfrescoRuntimeException("discuss called without an id");
}
FacesContext context = FacesContext.getCurrentInstance();
NodeRef nodeRef = new NodeRef(Repository.getStoreRef(), id);
if (this.nodeService.hasAspect(nodeRef, ForumModel.ASPECT_DISCUSSABLE) == false)
{
throw new AlfrescoRuntimeException("discuss called for an object that does not have a discussion!");
}
// as the node has the discussable aspect there must be a discussions child assoc
List<ChildAssociationRef> children = this.nodeService.getChildAssocs(nodeRef,
ForumModel.ASSOC_DISCUSSION, RegexQNamePattern.MATCH_ALL);
// there should only be one child, retrieve it if there is
if (children.size() == 1)
{
NodeRef forumNodeRef = children.get(0).getChildRef();
// query for the number of topics there are
String repliesXPath = "./*[(subtypeOf('" + ForumModel.TYPE_TOPIC + "'))]";
List<NodeRef> topics = searchService.selectNodes(forumNodeRef, repliesXPath,
new QueryParameterDefinition[] {}, this.namespaceService, false);
if (topics.size() == 1)
{
// if the forum has only one topic go straight into the topic by
// setting the context and navigating to it
NodeRef topicNodeRef = topics.get(0);
this.browseBean.clickSpace(topicNodeRef);
context.getApplication().getNavigationHandler().handleNavigation(context, null, "showTopic");
}
else
{
// if the forum has more than one topic we need to setup the context
// for the forum and navigate to the forum page
this.browseBean.clickSpace(forumNodeRef);
context.getApplication().getNavigationHandler().handleNavigation(context, null, "showForum");
}
}
}
/**
* Called when the user confirms they wish to delete a forum space
*
* @return The outcome
*/
public String deleteForumsOK()
{
String outcome = "browse";
// find out what the parent type of the node being deleted
Node node = this.browseBean.getActionSpace();
ChildAssociationRef assoc = this.nodeService.getPrimaryParent(node.getNodeRef());
if (assoc != null)
{
NodeRef parent = assoc.getParentRef();
QName parentType = this.nodeService.getType(parent);
if (parentType.equals(ForumModel.TYPE_FORUMS))
{
outcome = "forumsDeleted";
}
}
// call the generic handler
this.browseBean.deleteSpaceOK();
// return an overidden outcome which closes the dialog with an outcome
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME +
AlfrescoNavigationHandler.DIALOG_SEPARATOR + outcome;
}
/**
* Called when the user confirms they wish to delete a forum space
*
* @return The outcome
*/
public String deleteForumOK()
{
this.browseBean.deleteSpaceOK();
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME +
AlfrescoNavigationHandler.DIALOG_SEPARATOR + "forumDeleted";
}
/**
* Called when the user confirms they wish to delete a forum space
*
* @return The outcome
*/
public String deleteTopicOK()
{
this.browseBean.deleteSpaceOK();
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME +
AlfrescoNavigationHandler.DIALOG_SEPARATOR + "topicDeleted";
}
/**
* Called when the user confirms they wish to delete a forum space
*
* @return The outcome
*/
public String deletePostOK()
{
this.browseBean.deleteFileOK();
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME;
}
// ------------------------------------------------------------------------------
@@ -703,6 +856,25 @@ public class ForumsBean implements IContextListener
}
};
/**
* Creates a file name for the message being posted
*
* @return The file name for the post
*/
public static String createPostFileName()
{
StringBuilder name = new StringBuilder("posted-");
// add a timestamp
SimpleDateFormat dateFormat = new SimpleDateFormat("dd-MM-yyyy-hh:mm:ss");
name.append(dateFormat.format(new Date()));
// add the HTML file extension
name.append(".html");
return name.toString();
}
// ------------------------------------------------------------------------------
// Private helpers
@@ -839,6 +1011,124 @@ public class ForumsBean implements IContextListener
out.write("</td></tr>");
}
/**
* Renders the top part of the bubble i.e. before the header
*
* @param out The writer to output to
* @param contextPath Context path of the application
* @param colour The colour of the bubble
* @param titleBgColour Background colour of the header area
*/
public static void renderBubbleTop(Writer out, String contextPath,
String colour, String titleBgColour) throws IOException
{
out.write("<table border='0' cellpadding='0' cellspacing='0' width='100%'><tr>");
out.write("<td style='background: url(");
out.write(contextPath);
out.write("/images/parts/");
out.write(colour);
out.write("header_1.gif) no-repeat #FFFFFF;' width='24' height='24'></td>");
out.write("<td style='background: url(");
out.write(contextPath);
out.write("/images/parts/");
out.write(colour);
out.write("header_2.gif) repeat-x ");
out.write(titleBgColour);
out.write("'>");
}
/**
* Renders the middle part of the bubble i.e. after the header and before the body
*
* @param out The writer to output to
* @param contextPath Context path of the application
* @param colour The colour of the bubble
*/
public static void renderBubbleMiddle(Writer out, String contextPath, String colour)
throws IOException
{
out.write("</td>");
out.write("<td style='background: url(");
out.write(contextPath);
out.write("/images/parts/");
out.write(colour);
out.write("header_3.gif) no-repeat #FFFFFF;' width='24' height='24'></td>");
out.write("</tr><tr>");
out.write("<td width='24' height='13'><img width='24' height='13' alt='' src='");
out.write(contextPath);
out.write("/images/parts/");
out.write(colour);
out.write("body_1.gif' /></td>");
out.write("<td background='");
out.write(contextPath);
out.write("/images/parts/");
out.write(colour);
out.write("body_2.gif'><img width='21' height='13' alt='' src='");
out.write(contextPath);
out.write("/images/parts/");
out.write(colour);
out.write("body_2.gif' /></td>");
out.write("<td width='24' height='13'><img width='24' height='13' alt='' src='");
out.write(contextPath);
out.write("/images/parts/");
out.write(colour);
out.write("body_3.gif' /></td>");
out.write("</tr><tr>");
out.write("<td width='24' height='13' background='");
out.write(contextPath);
out.write("/images/parts/");
out.write(colour);
out.write("body_4.gif'><img width='24' height='4' alt='' src='");
out.write(contextPath);
out.write("/images/parts/");
out.write(colour);
out.write("body_4.gif' /></td>");
out.write("<td>");
}
/**
* Renders the bottom part of the bubble i.e. after the body
*
* @param out The writer to output to
* @param contextPath Context path of the application
* @param colour The colour of the bubble
*/
public static void renderBubbleBottom(Writer out, String contextPath, String colour)
throws IOException
{
out.write("</td>");
out.write("<td width='24' height='13' background='");
out.write(contextPath);
out.write("/images/parts/");
out.write(colour);
out.write("body_6.gif'><img width='24' height='3' alt='' src='");
out.write(contextPath);
out.write("/images/parts/");
out.write(colour);
out.write("body_6.gif' /></td>");
out.write("</tr><tr>");
out.write("<td width='24' height='13'><img width='24' height='13' alt='' src='");
out.write(contextPath);
out.write("/images/parts/");
out.write(colour);
out.write("body_7.gif' /></td>");
out.write("<td background='");
out.write(contextPath);
out.write("/images/parts/");
out.write(colour);
out.write("body_8.gif'><img width='20' height='13' alt='' src='");
out.write(contextPath);
out.write("/images/parts/");
out.write(colour);
out.write("body_8.gif' /></td>");
out.write("<td width='24' height='13'><img width='24' height='13' alt='' src='");
out.write(contextPath);
out.write("/images/parts/");
out.write(colour);
out.write("body_9.gif' /></td>");
out.write("</tr></table>");
}
/**
* Renders the new post speech bubble
*
@@ -852,13 +1142,22 @@ public class ForumsBean implements IContextListener
private void renderNewPostBubble(FacesContext context, ResponseWriter out, Node node,
UIColumn primaryColumn, UIColumn actionsColumn, UIColumn[] columns) throws IOException
{
String contextPath = context.getExternalContext().getRequestContextPath();
String colour = "orange";
out.write("<td><table border='0' cellpadding='0' cellspacing='0' width='100%'><tr>");
out.write("<td><img src='");
out.write(context.getExternalContext().getRequestContextPath());
out.write(contextPath);
out.write("/images/icons/user_large.gif'/><br/>");
out.write((String)node.getProperties().get("creator"));
out.write("</td><td width='100%'>");
renderBubble(context, out, "orange", "#FCC75E", primaryColumn, actionsColumn, columns);
renderBubbleTop(out, contextPath, colour, "#FCC75E");
renderHeaderContents(context, out, primaryColumn, actionsColumn, columns);
renderBubbleMiddle(out, contextPath, colour);
renderBodyContents(context, primaryColumn);
renderBubbleBottom(out, contextPath, colour);
out.write("</td><td><div style='width:32px;' /></td></table></td>");
}
@@ -875,48 +1174,28 @@ public class ForumsBean implements IContextListener
private void renderReplyToBubble(FacesContext context, ResponseWriter out, Node node,
UIColumn primaryColumn, UIColumn actionsColumn, UIColumn[] columns) throws IOException
{
String contextPath = context.getExternalContext().getRequestContextPath();
String colour = "yellow";
out.write("<td width='100%'><table border='0' cellpadding='0' cellspacing='0' width='100%'><tr>");
out.write("<td><div style='width:32px;' /></td><td width='100%'>");
renderBubble(context, out, "yellow", "#FFF5A3", primaryColumn, actionsColumn, columns);
renderBubbleTop(out, contextPath, colour, "#FFF5A3");
renderHeaderContents(context, out, primaryColumn, actionsColumn, columns);
renderBubbleMiddle(out, contextPath, colour);
renderBodyContents(context, primaryColumn);
renderBubbleBottom(out, contextPath, colour);
out.write("</td><td><img src='");
out.write(context.getExternalContext().getRequestContextPath());
out.write(contextPath);
out.write("/images/icons/user_large.gif'/><br/>");
out.write((String)node.getProperties().get("creator"));
out.write("</td></table></td>");
}
/**
* Renders the speech bubble
*
* @param context Faces context
* @param out The response writer
* @param colour The colour of the bubble
* @param titleBgColour The colour of the background of the title area (#rrggbb)
* @param primaryColumn The primary column containing the message content
* @param actionsColumn The actions column containing all the actions
* @param columns All configured columns
*/
private void renderBubble(FacesContext context, ResponseWriter out,
String colour, String titleBgColour,
UIColumn primaryColumn, UIColumn actionsColumn, UIColumn[] columns)
throws IOException
private void renderHeaderContents(FacesContext context, ResponseWriter out,
UIColumn primaryColumn, UIColumn actionsColumn, UIColumn[] columns) throws IOException
{
String contextPath = context.getExternalContext().getRequestContextPath();
out.write("<table border='0' cellpadding='0' cellspacing='0' width='100%'><tr>");
out.write("<td style='background: url(");
out.write(contextPath);
out.write("/images/parts/");
out.write(colour);
out.write("header_1.gif) no-repeat #FFFFFF;' width='24' height='24'></td>");
out.write("<td style='background: url(");
out.write(contextPath);
out.write("/images/parts/");
out.write(colour);
out.write("header_2.gif) repeat-x ");
out.write(titleBgColour);
out.write("'>");
// render the header area with the configured columns
out.write("<table width='100%' cellpadding='2' cellspacing='2' border='0'><tr>");
@@ -948,73 +1227,28 @@ public class ForumsBean implements IContextListener
}
// render the actions column
out.write("<td align='right' width='100%'>");
out.write("<td align='right' width='100%'><nobr>");
if (actionsColumn != null && actionsColumn.getChildCount() != 0)
{
Utils.encodeRecursive(context, actionsColumn);
}
out.write("</td></tr></table>");
out.write("</td>");
out.write("<td style='background: url(");
out.write(contextPath);
out.write("/images/parts/");
out.write(colour);
out.write("header_3.gif) no-repeat #FFFFFF;' width='24' height='24'></td>");
out.write("</tr></tr>");
out.write("<td style='background: url(");
out.write(contextPath);
out.write("/images/parts/");
out.write(colour);
out.write("body_1.gif) no-repeat #FFFFFF;' width='24' height='13'></td>");
out.write("<td style='background: url(");
out.write(contextPath);
out.write("/images/parts/");
out.write(colour);
out.write("body_2.gif) repeat-x #FFFFFF;'></td>");
out.write("<td style='background: url(");
out.write(contextPath);
out.write("/images/parts/");
out.write(colour);
out.write("body_3.gif) no-repeat #FFFFFF;' width='24' height='13'></td>");
out.write("</tr><tr>");
out.write("<td style='background: url(");
out.write(contextPath);
out.write("/images/parts/");
out.write(colour);
out.write("body_4.gif) repeat-y #FFFFFF;' width='24' height='13'></td>");
out.write("<td>");
out.write("</nobr></td></tr></table>");
}
/**
* Renders the body contents for the bubble using the given primary coumn
*
* @param context Faces context
* @param primaryColumn The primary column holding the message text
*/
private void renderBodyContents(FacesContext context, UIColumn primaryColumn)
throws IOException
{
// render the primary column
if (primaryColumn != null && primaryColumn.getChildCount() != 0)
{
Utils.encodeRecursive(context, primaryColumn);
}
out.write("</td>");
out.write("<td style='background: url(");
out.write(contextPath);
out.write("/images/parts/");
out.write(colour);
out.write("body_6.gif) repeat-y #FFFFFF;' width='24' height='13'></td>");
out.write("</tr><tr>");
out.write("<td style='background: url(");
out.write(contextPath);
out.write("/images/parts/");
out.write(colour);
out.write("body_7.gif) no-repeat #FFFFFF;' width='24' height='13'></td>");
out.write("<td style='background: url(");
out.write(contextPath);
out.write("/images/parts/");
out.write(colour);
out.write("body_8.gif) repeat-x #FFFFFF;'></td>");
out.write("<td style='background: url(");
out.write(contextPath);
out.write("/images/parts/");
out.write(colour);
out.write("body_9.gif) no-repeat #FFFFFF;' width='24' height='13'></td>");
out.write("</tr></table>");
}
}
}

View File

@@ -53,7 +53,7 @@ public class ImportBean
{
private static final Log logger = LogFactory.getLog(ImportBean.class);
private static final String DEFAULT_OUTCOME = "browse";
private static final String DEFAULT_OUTCOME = "dialog:close";
private static final String MSG_ERROR = "error_import";
private static final String MSG_ERROR_NO_FILE = "error_import_no_file";

View File

@@ -34,6 +34,7 @@ import org.alfresco.service.cmr.repository.TemplateImageResolver;
import org.alfresco.service.cmr.repository.TemplateNode;
import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.web.app.AlfrescoNavigationHandler;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository;
@@ -208,6 +209,7 @@ public class SpaceDetailsBean
*
* @return model containing current current space info.
*/
@SuppressWarnings("unchecked")
public Map getTemplateModel()
{
HashMap model = new HashMap(1, 1.0f);
@@ -402,6 +404,6 @@ public class SpaceDetailsBean
public String closeDialog()
{
this.navigator.resetCurrentNodeProperties();
return "browse";
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME;
}
}

View File

@@ -0,0 +1,132 @@
/*
* Copyright (C) 2005 Alfresco, Inc.
*
* Licensed under the GNU Lesser General Public License as
* published by the Free Software Foundation; either version
* 2.1 of the License, or (at your option) any later version.
* You may obtain a copy of the License at
*
* http://www.gnu.org/licenses/lgpl.txt
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
* either express or implied. See the License for the specific
* language governing permissions and limitations under the
* License.
*/
package org.alfresco.web.bean.wizard;
import java.io.Serializable;
import java.text.MessageFormat;
import java.util.HashMap;
import java.util.Map;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;
import javax.transaction.UserTransaction;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.model.ContentModel;
import org.alfresco.model.ForumModel;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.ui.common.Utils;
import org.alfresco.web.ui.common.component.UIActionLink;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Backing bean class used to create discussions for documents
*
* @author gavinc
*/
public class NewDiscussionWizard extends NewTopicWizard
{
private static final Log logger = LogFactory.getLog(NewDiscussionWizard.class);
private NodeRef discussingNodeRef;
/**
* @see org.alfresco.web.bean.wizard.AbstractWizardBean#startWizard(javax.faces.event.ActionEvent)
*/
@Override
public void startWizard(ActionEvent event)
{
UIActionLink link = (UIActionLink)event.getComponent();
Map<String, String> params = link.getParameterMap();
String id = params.get("id");
if (id == null || id.length() == 0)
{
throw new AlfrescoRuntimeException("startDiscussion called without an id");
}
FacesContext context = FacesContext.getCurrentInstance();
UserTransaction tx = null;
NodeRef forumNodeRef = null;
try
{
tx = Repository.getUserTransaction(context);
tx.begin();
this.discussingNodeRef = new NodeRef(Repository.getStoreRef(), id);
if (this.nodeService.hasAspect(this.discussingNodeRef, ForumModel.ASPECT_DISCUSSABLE))
{
throw new AlfrescoRuntimeException("startDiscussion called for an object that already has a discussion!");
}
// add the discussable aspect
this.nodeService.addAspect(this.discussingNodeRef, ForumModel.ASPECT_DISCUSSABLE, null);
// create a child forum space using the child association just introduced by
// adding the discussable aspect
String name = (String)this.nodeService.getProperty(this.discussingNodeRef,
ContentModel.PROP_NAME);
String msg = Application.getMessage(FacesContext.getCurrentInstance(), "discussion_for");
String forumName = MessageFormat.format(msg, new Object[] {name});
Map<QName, Serializable> forumProps = new HashMap<QName, Serializable>(1);
forumProps.put(ContentModel.PROP_NAME, forumName);
ChildAssociationRef childRef = this.nodeService.createNode(this.discussingNodeRef,
ForumModel.ASSOC_DISCUSSION,
QName.createQName(ForumModel.FORUMS_MODEL_URI, "discussion"),
ForumModel.TYPE_FORUM, forumProps);
forumNodeRef = childRef.getChildRef();
// apply the uifacets aspect
Map<QName, Serializable> uiFacetsProps = new HashMap<QName, Serializable>(5);
uiFacetsProps.put(ContentModel.PROP_ICON, "forum_large");
this.nodeService.addAspect(forumNodeRef, ContentModel.ASPECT_UIFACETS, uiFacetsProps);
if (logger.isDebugEnabled())
logger.debug("created forum for content: " + forumNodeRef.toString());
// commit the transaction
tx.commit();
}
catch (Exception e)
{
// rollback the transaction
try { if (tx != null) {tx.rollback();} } catch (Exception ex) {}
Utils.addErrorMessage(MessageFormat.format(Application.getMessage(
context, Repository.ERROR_GENERIC), e.getMessage()), e);
}
// finally setup the context for the forum we just created
if (forumNodeRef != null)
{
this.browseBean.clickSpace(forumNodeRef);
// now initialise the wizard and navigate to it
super.startWizard(event);
context.getApplication().getNavigationHandler().handleNavigation(context, null, "dialog:createDiscussion");
}
}
}

View File

@@ -17,12 +17,8 @@
*/
package org.alfresco.web.bean.wizard;
import java.util.List;
import javax.faces.context.FacesContext;
import org.alfresco.model.ForumModel;
import org.alfresco.web.ui.common.component.UIListItem;
import org.alfresco.web.app.AlfrescoNavigationHandler;
/**
* Wizard bean used for creating and editing forum spaces
@@ -31,30 +27,6 @@ import org.alfresco.web.ui.common.component.UIListItem;
*/
public class NewForumWizard extends NewSpaceWizard
{
protected String forumStatus;
protected List<UIListItem> forumIcons;
/**
* Returns the status of the forum
*
* @return The status of the forum
*/
public String getForumStatus()
{
return this.forumStatus;
}
/**
* Sets the status of the forum
*
* @param forumStatus The status
*/
public void setForumStatus(String forumStatus)
{
this.forumStatus = forumStatus;
}
/**
* @see org.alfresco.web.bean.wizard.AbstractWizardBean#init()
*/
@@ -63,15 +35,27 @@ public class NewForumWizard extends NewSpaceWizard
super.init();
this.spaceType = ForumModel.TYPE_FORUM.toString();
this.forumStatus = "0";
}
/**
* @see org.alfresco.web.bean.wizard.AbstractWizardBean#finish()
*/
@Override
public String finish()
{
super.finish();
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME;
}
/**
* @see org.alfresco.web.bean.wizard.NewSpaceWizard#performCustomProcessing(javax.faces.context.FacesContext)
* @see org.alfresco.web.bean.wizard.AbstractWizardBean#cancel()
*/
@Override
protected void performCustomProcessing(FacesContext context)
public String cancel()
{
// add or update the ForumModel.PROP_STATUS property depending on the editMode
super.cancel();
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME;
}
}

View File

@@ -17,10 +17,8 @@
*/
package org.alfresco.web.bean.wizard;
import java.util.List;
import org.alfresco.model.ForumModel;
import org.alfresco.web.ui.common.component.UIListItem;
import org.alfresco.web.app.AlfrescoNavigationHandler;
/**
* Wizard bean used for creating and editing forums spaces
@@ -29,8 +27,6 @@ import org.alfresco.web.ui.common.component.UIListItem;
*/
public class NewForumsWizard extends NewSpaceWizard
{
protected List<UIListItem> forumsIcons;
/**
* @see org.alfresco.web.bean.wizard.AbstractWizardBean#init()
*/
@@ -40,4 +36,26 @@ public class NewForumsWizard extends NewSpaceWizard
this.spaceType = ForumModel.TYPE_FORUMS.toString();
}
/**
* @see org.alfresco.web.bean.wizard.AbstractWizardBean#finish()
*/
@Override
public String finish()
{
super.finish();
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME;
}
/**
* @see org.alfresco.web.bean.wizard.AbstractWizardBean#cancel()
*/
@Override
public String cancel()
{
super.cancel();
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME;
}
}

View File

@@ -25,6 +25,8 @@ import org.alfresco.model.ForumModel;
import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.service.cmr.repository.ContentWriter;
import org.alfresco.util.GUID;
import org.alfresco.web.app.AlfrescoNavigationHandler;
import org.alfresco.web.bean.ForumsBean;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.ui.common.Utils;
@@ -56,7 +58,8 @@ public class NewPostWizard extends CreateContentWizard
public void startWizardForEdit(ActionEvent event)
{
// TODO: Allow action link to have multiple action listeners
// then we wouldn't need to have this coupling in here
// then we wouldn't need to have this coupling back
// to the browse bean in here
// we need to setup the content in the browse bean first
this.browseBean.setupContentAction(event);
@@ -101,17 +104,18 @@ public class NewPostWizard extends CreateContentWizard
}
else
{
// create appropriate values for filename, title and content type
this.fileName = GUID.generate() + ".html";
// create appropriate values for filename and content type
this.fileName = ForumsBean.createPostFileName();
this.contentType = Repository.getMimeTypeForFileName(
FacesContext.getCurrentInstance(), this.fileName);
this.title = this.fileName;
// remove link breaks and replace with <br/>
this.content = Utils.replaceLineBreaks(this.content);
}
return super.finish();
super.finish();
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME;
}
/**
@@ -120,16 +124,28 @@ public class NewPostWizard extends CreateContentWizard
@Override
protected void performCustomProcessing()
{
// update the content
Node currentDocument = this.browseBean.getDocument();
ContentWriter writer = this.contentService.getWriter(currentDocument.getNodeRef(),
ContentModel.PROP_CONTENT, true);
if (writer != null)
if (this.editMode)
{
writer.putContent(this.content);
// update the content
Node currentDocument = this.browseBean.getDocument();
ContentWriter writer = this.contentService.getWriter(currentDocument.getNodeRef(),
ContentModel.PROP_CONTENT, true);
if (writer != null)
{
writer.putContent(this.content);
}
}
}
/**
* @see org.alfresco.web.bean.wizard.AbstractWizardBean#cancel()
*/
@Override
public String cancel()
{
super.cancel();
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME;
}
}

View File

@@ -20,6 +20,7 @@ package org.alfresco.web.bean.wizard;
import javax.faces.event.ActionEvent;
import org.alfresco.model.ContentModel;
import org.alfresco.web.app.AlfrescoNavigationHandler;
import org.alfresco.web.ui.common.Utils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -55,7 +56,9 @@ public class NewReplyWizard extends NewPostWizard
// remove link breaks and replace with <br/>
this.content = Utils.replaceLineBreaks(this.content);
return super.finish();
super.finish();
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME;
}
/**
@@ -79,4 +82,15 @@ public class NewReplyWizard extends NewPostWizard
}
}
}
/**
* @see org.alfresco.web.bean.wizard.AbstractWizardBean#cancel()
*/
@Override
public String cancel()
{
super.cancel();
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME;
}
}

View File

@@ -80,10 +80,10 @@ public class NewSpaceWizard extends AbstractWizardBean
private static final String DEFAULT_SPACE_TYPE_ICON = "/images/icons/space.gif";
// new space wizard specific properties
private SearchService searchService;
private NamespaceService namespaceService;
private DictionaryService dictionaryService;
private ConfigService configService;
protected SearchService searchService;
protected NamespaceService namespaceService;
protected DictionaryService dictionaryService;
protected ConfigService configService;
protected String spaceType;
protected String icon;
@@ -996,7 +996,7 @@ public class NewSpaceWizard extends AbstractWizardBean
*
* @param context Faces context
*/
protected void performCustomProcessing(FacesContext context)
protected void performCustomProcessing(FacesContext context) throws Exception
{
// used by subclasses if necessary
}

View File

@@ -18,26 +18,22 @@
package org.alfresco.web.bean.wizard;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.faces.context.FacesContext;
import javax.faces.model.SelectItem;
import org.alfresco.model.ContentModel;
import org.alfresco.model.ForumModel;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.model.FileInfo;
import org.alfresco.service.cmr.repository.ContentService;
import org.alfresco.service.cmr.repository.ContentWriter;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.NamespaceService;
import org.alfresco.service.namespace.QName;
import org.alfresco.util.GUID;
import org.alfresco.web.app.AlfrescoNavigationHandler;
import org.alfresco.web.bean.ForumsBean;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.ui.common.Utils;
import org.alfresco.web.ui.common.component.UIListItem;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -51,51 +47,8 @@ public class NewTopicWizard extends NewSpaceWizard
private static final Log logger = LogFactory.getLog(NewTopicWizard.class);
protected String message;
protected String topicType;
protected List<UIListItem> topicIcons;
protected List<SelectItem> topicTypes;
protected ContentService contentService;
/**
* Returns a list of topic types for the user to select from
*
* @return The topic types
*/
public List<SelectItem> getTopicTypes()
{
if (this.topicTypes == null)
{
this.topicTypes = new ArrayList<SelectItem>(3);
// TODO: change this to be based on categories
this.topicTypes.add(new SelectItem("1", "Announcement"));
this.topicTypes.add(new SelectItem("0", "Normal"));
this.topicTypes.add(new SelectItem("2", "Sticky"));
}
return this.topicTypes;
}
/**
* Returns the type of the topic
*
* @return The type of topic
*/
public String getTopicType()
{
return this.topicType;
}
/**
* Sets the type of the topic
*
* @param topicType The type of the topic
*/
public void setTopicType(String topicType)
{
this.topicType = topicType;
}
/**
* Returns the message entered by the user for the first post
@@ -133,7 +86,6 @@ public class NewTopicWizard extends NewSpaceWizard
super.init();
this.spaceType = ForumModel.TYPE_TOPIC.toString();
this.topicType = "0";
this.message = null;
}
@@ -141,34 +93,19 @@ public class NewTopicWizard extends NewSpaceWizard
* @see org.alfresco.web.bean.wizard.NewSpaceWizard#performCustomProcessing(javax.faces.context.FacesContext)
*/
@Override
protected void performCustomProcessing(FacesContext context)
protected void performCustomProcessing(FacesContext context) throws Exception
{
if (this.editMode == false)
{
// *************************
// TODO: Add or update the ForumModel.PROP_TYPE property depending on the editMode
// *************************
// get the node ref of the node that will contain the content
NodeRef containerNodeRef = this.createdNode;
// create a unique file name for the message content
String fileName = GUID.generate() + ".txt";
String fileName = ForumsBean.createPostFileName();
// create properties for content type
Map<QName, Serializable> contentProps = new HashMap<QName, Serializable>(5, 1.0f);
contentProps.put(ContentModel.PROP_NAME, fileName);
// create the node to represent the content
String assocName = QName.createValidLocalName(fileName);
ChildAssociationRef assocRef = this.nodeService.createNode(
containerNodeRef,
ContentModel.ASSOC_CONTAINS,
QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, assocName),
Repository.resolveToQName(ForumModel.TYPE_POST.toString()),
contentProps);
NodeRef postNodeRef = assocRef.getChildRef();
FileInfo fileInfo = this.fileFolderService.create(containerNodeRef,
fileName, ForumModel.TYPE_POST);
NodeRef postNodeRef = fileInfo.getNodeRef();
if (logger.isDebugEnabled())
logger.debug("Created post node with filename: " + fileName);
@@ -196,4 +133,26 @@ public class NewTopicWizard extends NewSpaceWizard
writer.putContent(Utils.replaceLineBreaks(this.message));
}
}
/**
* @see org.alfresco.web.bean.wizard.AbstractWizardBean#finish()
*/
@Override
public String finish()
{
super.finish();
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME;
}
/**
* @see org.alfresco.web.bean.wizard.AbstractWizardBean#cancel()
*/
@Override
public String cancel()
{
super.cancel();
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME;
}
}

View File

@@ -27,6 +27,7 @@ import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.namespace.RegexQNamePattern;
import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.ui.repo.WebResources;
@@ -83,7 +84,8 @@ public class UISpaceSelector extends AbstractItemSelector
public Collection<ChildAssociationRef> getChildrenForNode(FacesContext context)
{
NodeRef nodeRef = new NodeRef(Repository.getStoreRef(), this.navigationId);
List<ChildAssociationRef> allKids = getNodeService(context).getChildAssocs(nodeRef);
List<ChildAssociationRef> allKids = getNodeService(context).getChildAssocs(nodeRef,
ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);
DictionaryService dd = getDictionaryService(context);
NodeService service = getNodeService(context);

View File

@@ -34,6 +34,7 @@ import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.RegexQNamePattern;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.ui.common.Utils;
import org.alfresco.web.ui.common.renderer.BaseRenderer;
@@ -115,7 +116,8 @@ public class NodeDescendantsLinkRenderer extends BaseRenderer
// calculate the number of displayed child refs
if (service.exists(parentRef) == true)
{
List<ChildAssociationRef> childRefs = service.getChildAssocs(parentRef);
List<ChildAssociationRef> childRefs = service.getChildAssocs(parentRef,
ContentModel.ASSOC_CONTAINS, RegexQNamePattern.MATCH_ALL);
List<ChildAssociationRef> refs = new ArrayList<ChildAssociationRef>(childRefs.size());
for (int index=0; index<childRefs.size(); index++)
{