mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-07-24 17:32:48 +00:00
- Fixed various delete issues
- Add new delete icons for forums types git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2100 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
// ------------------------------------------------------------------------------
|
||||
|
@@ -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";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -96,9 +96,15 @@ public class NewReplyWizard extends NewPostWizard
|
||||
// remove link breaks and replace with <br/>
|
||||
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;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@@ -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;
|
||||
|
Reference in New Issue
Block a user