diff --git a/source/java/org/alfresco/web/bean/ForumsBean.java b/source/java/org/alfresco/web/bean/ForumsBean.java
index 30ac0f6545..34dcf45e34 100644
--- a/source/java/org/alfresco/web/bean/ForumsBean.java
+++ b/source/java/org/alfresco/web/bean/ForumsBean.java
@@ -59,7 +59,6 @@ import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.NodePropertyResolver;
import org.alfresco.web.bean.repository.QNameNodeMap;
import org.alfresco.web.bean.repository.Repository;
-import org.alfresco.web.bean.wizard.NewSpaceWizard;
import org.alfresco.web.config.ClientConfigElement;
import org.alfresco.web.ui.common.Utils;
import org.alfresco.web.ui.common.component.UIActionLink;
@@ -702,6 +701,11 @@ public class ForumsBean implements IContextListener
this.browseBean.clickSpace(forumNodeRef);
context.getApplication().getNavigationHandler().handleNavigation(context, null, "showForum");
}
+ else if (logger.isWarnEnabled())
+ {
+ logger.warn("Node has the discussable aspect but does not have 1 child, it has " +
+ children.size() + " children!");
+ }
}
/**
@@ -711,7 +715,7 @@ public class ForumsBean implements IContextListener
*/
public String deleteForumsOK()
{
- String outcome = "browse";
+ String outcomeOverride = "browse";
// find out what the parent type of the node being deleted
Node node = this.browseBean.getActionSpace();
@@ -722,16 +726,22 @@ public class ForumsBean implements IContextListener
QName parentType = this.nodeService.getType(parent);
if (parentType.equals(ForumModel.TYPE_FORUMS))
{
- outcome = "forumsDeleted";
+ outcomeOverride = "forumsDeleted";
}
}
// call the generic handler
- this.browseBean.deleteSpaceOK();
+ String outcome = this.browseBean.deleteSpaceOK();
- // return an overidden outcome which closes the dialog with an outcome
- return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME +
- AlfrescoNavigationHandler.DIALOG_SEPARATOR + outcome;
+ // if the delete was successful update the outcome
+ if (outcome != null)
+ {
+ // return an overidden outcome which closes the dialog with an outcome
+ outcome = AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME +
+ AlfrescoNavigationHandler.DIALOG_SEPARATOR + outcomeOverride;
+ }
+
+ return outcome;
}
/**
@@ -741,10 +751,48 @@ public class ForumsBean implements IContextListener
*/
public String deleteForumOK()
{
- this.browseBean.deleteSpaceOK();
+ String outcomeOverride = "browse";
- return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME +
- AlfrescoNavigationHandler.DIALOG_SEPARATOR + "forumDeleted";
+ // if this forum is being used for a discussion on a node we also
+ // need to remove the discussable aspect from the node.
+ Node forumSpace = this.browseBean.getActionSpace();
+ ChildAssociationRef assoc = this.nodeService.getPrimaryParent(forumSpace.getNodeRef());
+ if (assoc != null)
+ {
+ // get the parent node
+ NodeRef parent = assoc.getParentRef();
+
+ // get the association type
+ QName type = assoc.getTypeQName();
+ if (type.equals(ForumModel.ASSOC_DISCUSSION))
+ {
+ // if the association type is the 'discussion' association we
+ // need to remove the discussable aspect from the parent node
+ this.nodeService.removeAspect(parent, ForumModel.ASPECT_DISCUSSABLE);
+ }
+
+ // if the parent type is a forum space then we need the dialog to go
+ // back to the forums view otherwise it will use the default of 'browse',
+ // this happens when a forum being used to discuss a node is deleted.
+ QName parentType = this.nodeService.getType(parent);
+ if (parentType.equals(ForumModel.TYPE_FORUMS))
+ {
+ outcomeOverride = "forumDeleted";
+ }
+ }
+
+ // call the generic handler
+ String outcome = this.browseBean.deleteSpaceOK();
+
+ // if the delete was successful update the outcome
+ if (outcome != null)
+ {
+ // return an overidden outcome which closes the dialog with an outcome
+ outcome = AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME +
+ AlfrescoNavigationHandler.DIALOG_SEPARATOR + outcomeOverride;
+ }
+
+ return outcome;
}
/**
@@ -754,10 +802,17 @@ public class ForumsBean implements IContextListener
*/
public String deleteTopicOK()
{
- this.browseBean.deleteSpaceOK();
+ // call the generic handler
+ String outcome = this.browseBean.deleteSpaceOK();
- return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME +
- AlfrescoNavigationHandler.DIALOG_SEPARATOR + "topicDeleted";
+ // if the delete was successful update the outcome
+ if (outcome != null)
+ {
+ outcome = AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME +
+ AlfrescoNavigationHandler.DIALOG_SEPARATOR + "topicDeleted";
+ }
+
+ return outcome;
}
/**
@@ -767,9 +822,16 @@ public class ForumsBean implements IContextListener
*/
public String deletePostOK()
{
- this.browseBean.deleteFileOK();
+ // call the generic handler
+ String outcome = this.browseBean.deleteFileOK();
- return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME;
+ // if the delete was successful update the outcome
+ if (outcome != null)
+ {
+ outcome = AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME;
+ }
+
+ return outcome;
}
// ------------------------------------------------------------------------------
diff --git a/source/java/org/alfresco/web/bean/wizard/NewDiscussionWizard.java b/source/java/org/alfresco/web/bean/wizard/NewDiscussionWizard.java
index 2c3400369b..cbf96fefd3 100644
--- a/source/java/org/alfresco/web/bean/wizard/NewDiscussionWizard.java
+++ b/source/java/org/alfresco/web/bean/wizard/NewDiscussionWizard.java
@@ -32,7 +32,9 @@ 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.AlfrescoNavigationHandler;
import org.alfresco.web.app.Application;
+import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.ui.common.Utils;
import org.alfresco.web.ui.common.component.UIActionLink;
@@ -128,5 +130,52 @@ public class NewDiscussionWizard extends NewTopicWizard
context.getApplication().getNavigationHandler().handleNavigation(context, null, "dialog:createDiscussion");
}
}
+
+ /**
+ * @see org.alfresco.web.bean.wizard.AbstractWizardBean#cancel()
+ */
+ @Override
+ public String cancel()
+ {
+ // if we cancel the creation of a discussion all the setup that was done
+ // when the wizard started needs to be undone i.e. removing the created forum
+ // and the discussable aspect
+
+ FacesContext context = FacesContext.getCurrentInstance();
+ UserTransaction tx = null;
+
+ try
+ {
+ tx = Repository.getUserTransaction(context);
+ tx.begin();
+
+ // remove the discussable aspect from the node we were going to discuss!
+ this.nodeService.removeAspect(this.discussingNodeRef, ForumModel.ASPECT_DISCUSSABLE);
+
+ // delete the forum space created when the wizard started
+ this.browseBean.setActionSpace(this.navigator.getCurrentNode());
+ this.browseBean.deleteSpaceOK();
+
+ // 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);
+ }
+
+ // do cancel processing
+ super.cancel();
+
+ // as we are cancelling the creation of a discussion we know we need to go back
+ // to the browse screen, this also makes sure we don't end up in the forum that
+ // just got deleted!
+ return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME +
+ AlfrescoNavigationHandler.DIALOG_SEPARATOR + "browse";
+ }
+
}
diff --git a/source/java/org/alfresco/web/bean/wizard/NewForumWizard.java b/source/java/org/alfresco/web/bean/wizard/NewForumWizard.java
index 51a3b5e429..09b9dc7ccf 100644
--- a/source/java/org/alfresco/web/bean/wizard/NewForumWizard.java
+++ b/source/java/org/alfresco/web/bean/wizard/NewForumWizard.java
@@ -43,9 +43,15 @@ public class NewForumWizard extends NewSpaceWizard
@Override
public String finish()
{
- super.finish();
+ String outcome = super.finish();
- return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME;
+ // if we had a successful outcome from the creation close the dialog
+ if (outcome != null);
+ {
+ outcome = AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME;
+ }
+
+ return outcome;
}
/**
diff --git a/source/java/org/alfresco/web/bean/wizard/NewForumsWizard.java b/source/java/org/alfresco/web/bean/wizard/NewForumsWizard.java
index 8f8644d194..45501cbf0e 100644
--- a/source/java/org/alfresco/web/bean/wizard/NewForumsWizard.java
+++ b/source/java/org/alfresco/web/bean/wizard/NewForumsWizard.java
@@ -43,9 +43,15 @@ public class NewForumsWizard extends NewSpaceWizard
@Override
public String finish()
{
- super.finish();
+ String outcome = super.finish();
- return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME;
+ // if we had a successful outcome from the creation close the dialog
+ if (outcome != null);
+ {
+ outcome = AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME;
+ }
+
+ return outcome;
}
/**
diff --git a/source/java/org/alfresco/web/bean/wizard/NewPostWizard.java b/source/java/org/alfresco/web/bean/wizard/NewPostWizard.java
index 5766e68210..17d1a5db03 100644
--- a/source/java/org/alfresco/web/bean/wizard/NewPostWizard.java
+++ b/source/java/org/alfresco/web/bean/wizard/NewPostWizard.java
@@ -24,7 +24,6 @@ import org.alfresco.model.ContentModel;
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;
@@ -113,9 +112,15 @@ public class NewPostWizard extends CreateContentWizard
this.content = Utils.replaceLineBreaks(this.content);
}
- super.finish();
+ String outcome = super.finish();
- return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME;
+ // if we had a successful outcome from the creation close the dialog
+ if (outcome != null);
+ {
+ outcome = AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME;
+ }
+
+ return outcome;
}
/**
diff --git a/source/java/org/alfresco/web/bean/wizard/NewReplyWizard.java b/source/java/org/alfresco/web/bean/wizard/NewReplyWizard.java
index 4d065f481e..0a4730b7ab 100644
--- a/source/java/org/alfresco/web/bean/wizard/NewReplyWizard.java
+++ b/source/java/org/alfresco/web/bean/wizard/NewReplyWizard.java
@@ -96,9 +96,15 @@ public class NewReplyWizard extends NewPostWizard
// remove link breaks and replace with
this.content = Utils.replaceLineBreaks(this.content);
- super.finish();
+ String outcome = super.finish();
- return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME;
+ // if we had a successful outcome from the creation close the dialog
+ if (outcome != null);
+ {
+ outcome = AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME;
+ }
+
+ return outcome;
}
/**
diff --git a/source/java/org/alfresco/web/bean/wizard/NewTopicWizard.java b/source/java/org/alfresco/web/bean/wizard/NewTopicWizard.java
index 287a40e777..f2e5e8f9ad 100644
--- a/source/java/org/alfresco/web/bean/wizard/NewTopicWizard.java
+++ b/source/java/org/alfresco/web/bean/wizard/NewTopicWizard.java
@@ -140,18 +140,22 @@ public class NewTopicWizard extends NewSpaceWizard
@Override
public String finish()
{
- super.finish();
+ String outcome = super.finish();
- String outcome = AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME;
-
- if (this.editMode == false)
+ // if we had a successful outcome work out the outcome to return
+ if (outcome != null)
{
- // if we are successful in creating the topic we need to setup
- // the browse context for the new topic and pass an override
- // outcome of 'showTopic'
- this.browseBean.clickSpace(this.createdNode);
+ outcome = AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME;
- outcome = outcome + AlfrescoNavigationHandler.DIALOG_SEPARATOR + "showTopic";
+ if (this.editMode == false)
+ {
+ // if we are successful in creating the topic we need to setup
+ // the browse context for the new topic and pass an override
+ // outcome of 'showTopic'
+ this.browseBean.clickSpace(this.createdNode);
+
+ outcome = outcome + AlfrescoNavigationHandler.DIALOG_SEPARATOR + "showTopic";
+ }
}
return outcome;
diff --git a/source/web/images/icons/delete_forum.gif b/source/web/images/icons/delete_forum.gif
new file mode 100644
index 0000000000..af1064666e
Binary files /dev/null and b/source/web/images/icons/delete_forum.gif differ
diff --git a/source/web/images/icons/delete_forum_large.gif b/source/web/images/icons/delete_forum_large.gif
new file mode 100644
index 0000000000..122a144bf5
Binary files /dev/null and b/source/web/images/icons/delete_forum_large.gif differ
diff --git a/source/web/images/icons/delete_forums.gif b/source/web/images/icons/delete_forums.gif
new file mode 100644
index 0000000000..ef171768c1
Binary files /dev/null and b/source/web/images/icons/delete_forums.gif differ
diff --git a/source/web/images/icons/delete_forums_large.gif b/source/web/images/icons/delete_forums_large.gif
new file mode 100644
index 0000000000..c2bc6acc7a
Binary files /dev/null and b/source/web/images/icons/delete_forums_large.gif differ
diff --git a/source/web/images/icons/delete_topic.gif b/source/web/images/icons/delete_topic.gif
new file mode 100644
index 0000000000..0addc503cf
Binary files /dev/null and b/source/web/images/icons/delete_topic.gif differ
diff --git a/source/web/images/icons/delete_topic_large.gif b/source/web/images/icons/delete_topic_large.gif
new file mode 100644
index 0000000000..3c06a0ce4f
Binary files /dev/null and b/source/web/images/icons/delete_topic_large.gif differ
diff --git a/source/web/jsp/forums/create-topic.jsp b/source/web/jsp/forums/create-topic.jsp
index 1e398425f9..ca52c509ec 100644
--- a/source/web/jsp/forums/create-topic.jsp
+++ b/source/web/jsp/forums/create-topic.jsp
@@ -111,7 +111,7 @@
-
+
<% PanelGenerator.generatePanelStart(out, request.getContextPath(), "white", "white"); %>
diff --git a/source/web/jsp/forums/delete-forum.jsp b/source/web/jsp/forums/delete-forum.jsp
index 7d1dc556b7..7927ee074d 100644
--- a/source/web/jsp/forums/delete-forum.jsp
+++ b/source/web/jsp/forums/delete-forum.jsp
@@ -67,7 +67,7 @@
-
+
|
diff --git a/source/web/jsp/forums/delete-forums.jsp b/source/web/jsp/forums/delete-forums.jsp
index f507671394..affdb72a85 100644
--- a/source/web/jsp/forums/delete-forums.jsp
+++ b/source/web/jsp/forums/delete-forums.jsp
@@ -67,7 +67,7 @@
-
+
|
diff --git a/source/web/jsp/forums/delete-topic.jsp b/source/web/jsp/forums/delete-topic.jsp
index 702c9a8e0f..c79e5ff447 100644
--- a/source/web/jsp/forums/delete-topic.jsp
+++ b/source/web/jsp/forums/delete-topic.jsp
@@ -67,7 +67,7 @@
-
+
|
diff --git a/source/web/jsp/forums/forum.jsp b/source/web/jsp/forums/forum.jsp
index af561a88c7..3386b500d0 100644
--- a/source/web/jsp/forums/forum.jsp
+++ b/source/web/jsp/forums/forum.jsp
@@ -87,7 +87,7 @@
-
+
diff --git a/source/web/jsp/forums/forums.jsp b/source/web/jsp/forums/forums.jsp
index b4b1c37fd2..f023ac085a 100644
--- a/source/web/jsp/forums/forums.jsp
+++ b/source/web/jsp/forums/forums.jsp
@@ -93,7 +93,7 @@
<%-- Current space More actions menu --%>
| | | |