- 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:
Gavin Cornwell
2006-01-11 15:16:59 +00:00
parent 0d1d1aff57
commit 6d9203a53f
20 changed files with 178 additions and 40 deletions

View File

@@ -59,7 +59,6 @@ import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.NodePropertyResolver; import org.alfresco.web.bean.repository.NodePropertyResolver;
import org.alfresco.web.bean.repository.QNameNodeMap; import org.alfresco.web.bean.repository.QNameNodeMap;
import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.bean.wizard.NewSpaceWizard;
import org.alfresco.web.config.ClientConfigElement; import org.alfresco.web.config.ClientConfigElement;
import org.alfresco.web.ui.common.Utils; import org.alfresco.web.ui.common.Utils;
import org.alfresco.web.ui.common.component.UIActionLink; import org.alfresco.web.ui.common.component.UIActionLink;
@@ -702,6 +701,11 @@ public class ForumsBean implements IContextListener
this.browseBean.clickSpace(forumNodeRef); this.browseBean.clickSpace(forumNodeRef);
context.getApplication().getNavigationHandler().handleNavigation(context, null, "showForum"); 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() public String deleteForumsOK()
{ {
String outcome = "browse"; String outcomeOverride = "browse";
// find out what the parent type of the node being deleted // find out what the parent type of the node being deleted
Node node = this.browseBean.getActionSpace(); Node node = this.browseBean.getActionSpace();
@@ -722,16 +726,22 @@ public class ForumsBean implements IContextListener
QName parentType = this.nodeService.getType(parent); QName parentType = this.nodeService.getType(parent);
if (parentType.equals(ForumModel.TYPE_FORUMS)) if (parentType.equals(ForumModel.TYPE_FORUMS))
{ {
outcome = "forumsDeleted"; outcomeOverride = "forumsDeleted";
} }
} }
// call the generic handler // call the generic handler
this.browseBean.deleteSpaceOK(); String outcome = this.browseBean.deleteSpaceOK();
// return an overidden outcome which closes the dialog with an outcome // if the delete was successful update the outcome
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME + if (outcome != null)
AlfrescoNavigationHandler.DIALOG_SEPARATOR + outcome; {
// 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() public String deleteForumOK()
{ {
this.browseBean.deleteSpaceOK(); String outcomeOverride = "browse";
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME + // if this forum is being used for a discussion on a node we also
AlfrescoNavigationHandler.DIALOG_SEPARATOR + "forumDeleted"; // 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() public String deleteTopicOK()
{ {
this.browseBean.deleteSpaceOK(); // call the generic handler
String outcome = this.browseBean.deleteSpaceOK();
return AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME + // if the delete was successful update the outcome
AlfrescoNavigationHandler.DIALOG_SEPARATOR + "topicDeleted"; 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() 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;
} }
// ------------------------------------------------------------------------------ // ------------------------------------------------------------------------------

View File

@@ -32,7 +32,9 @@ import org.alfresco.model.ForumModel;
import org.alfresco.service.cmr.repository.ChildAssociationRef; import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName; import org.alfresco.service.namespace.QName;
import org.alfresco.web.app.AlfrescoNavigationHandler;
import org.alfresco.web.app.Application; import org.alfresco.web.app.Application;
import org.alfresco.web.bean.repository.Node;
import org.alfresco.web.bean.repository.Repository; import org.alfresco.web.bean.repository.Repository;
import org.alfresco.web.ui.common.Utils; import org.alfresco.web.ui.common.Utils;
import org.alfresco.web.ui.common.component.UIActionLink; import org.alfresco.web.ui.common.component.UIActionLink;
@@ -129,4 +131,51 @@ public class NewDiscussionWizard extends NewTopicWizard
} }
} }
/**
* @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";
}
} }

View File

@@ -43,9 +43,15 @@ public class NewForumWizard extends NewSpaceWizard
@Override @Override
public String finish() 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;
} }
/** /**

View File

@@ -43,9 +43,15 @@ public class NewForumsWizard extends NewSpaceWizard
@Override @Override
public String finish() 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;
} }
/** /**

View File

@@ -24,7 +24,6 @@ import org.alfresco.model.ContentModel;
import org.alfresco.model.ForumModel; import org.alfresco.model.ForumModel;
import org.alfresco.service.cmr.repository.ContentReader; import org.alfresco.service.cmr.repository.ContentReader;
import org.alfresco.service.cmr.repository.ContentWriter; import org.alfresco.service.cmr.repository.ContentWriter;
import org.alfresco.util.GUID;
import org.alfresco.web.app.AlfrescoNavigationHandler; import org.alfresco.web.app.AlfrescoNavigationHandler;
import org.alfresco.web.bean.ForumsBean; import org.alfresco.web.bean.ForumsBean;
import org.alfresco.web.bean.repository.Node; import org.alfresco.web.bean.repository.Node;
@@ -113,9 +112,15 @@ public class NewPostWizard extends CreateContentWizard
this.content = Utils.replaceLineBreaks(this.content); 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;
} }
/** /**

View File

@@ -96,9 +96,15 @@ public class NewReplyWizard extends NewPostWizard
// remove link breaks and replace with <br/> // remove link breaks and replace with <br/>
this.content = Utils.replaceLineBreaks(this.content); 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;
} }
/** /**

View File

@@ -140,18 +140,22 @@ public class NewTopicWizard extends NewSpaceWizard
@Override @Override
public String finish() public String finish()
{ {
super.finish(); String outcome = super.finish();
String outcome = AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME; // if we had a successful outcome work out the outcome to return
if (outcome != null)
if (this.editMode == false)
{ {
// if we are successful in creating the topic we need to setup outcome = AlfrescoNavigationHandler.CLOSE_DIALOG_OUTCOME;
// 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"; 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; return outcome;

Binary file not shown.

After

Width:  |  Height:  |  Size: 622 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 619 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 594 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

View File

@@ -111,7 +111,7 @@
<tr> <tr>
<td width="100%" valign="top"> <td width="100%" valign="top">
<a:errors message="#{msg.error_create_forum_dialog}" styleClass="errorMessage" /> <a:errors message="#{msg.error_create_topic_dialog}" styleClass="errorMessage" />
<% PanelGenerator.generatePanelStart(out, request.getContextPath(), "white", "white"); %> <% PanelGenerator.generatePanelStart(out, request.getContextPath(), "white", "white"); %>
<table cellpadding="2" cellspacing="2" border="0" width="100%"> <table cellpadding="2" cellspacing="2" border="0" width="100%">

View File

@@ -67,7 +67,7 @@
<table cellspacing="4" cellpadding="0" width="100%"> <table cellspacing="4" cellpadding="0" width="100%">
<tr valign="top"> <tr valign="top">
<td width="32"> <td width="32">
<h:graphicImage url="/images/icons/delete_large.gif"/> <h:graphicImage url="/images/icons/delete_forum_large.gif"/>
</td> </td>
<td> <td>
<div class="mainSubTitle"><h:outputText value="#{NavigationBean.nodeProperties.name}" /></div> <div class="mainSubTitle"><h:outputText value="#{NavigationBean.nodeProperties.name}" /></div>

View File

@@ -67,7 +67,7 @@
<table cellspacing="4" cellpadding="0" width="100%"> <table cellspacing="4" cellpadding="0" width="100%">
<tr valign="top"> <tr valign="top">
<td width="32"> <td width="32">
<h:graphicImage url="/images/icons/delete_large.gif"/> <h:graphicImage url="/images/icons/delete_forums_large.gif"/>
</td> </td>
<td> <td>
<div class="mainSubTitle"><h:outputText value="#{NavigationBean.nodeProperties.name}" /></div> <div class="mainSubTitle"><h:outputText value="#{NavigationBean.nodeProperties.name}" /></div>

View File

@@ -67,7 +67,7 @@
<table cellspacing="4" cellpadding="0" width="100%"> <table cellspacing="4" cellpadding="0" width="100%">
<tr valign="top"> <tr valign="top">
<td width="32"> <td width="32">
<h:graphicImage url="/images/icons/delete_large.gif"/> <h:graphicImage url="/images/icons/delete_topic_large.gif"/>
</td> </td>
<td> <td>
<div class="mainSubTitle"><h:outputText value="#{NavigationBean.nodeProperties.name}" /></div> <div class="mainSubTitle"><h:outputText value="#{NavigationBean.nodeProperties.name}" /></div>

View File

@@ -87,7 +87,7 @@
<f:param name="id" value="#{NavigationBean.currentNodeId}" id="param1" /> <f:param name="id" value="#{NavigationBean.currentNodeId}" id="param1" />
</a:actionLink> </a:actionLink>
<r:permissionEvaluator value="#{NavigationBean.currentNode}" allow="Delete" id="eval2"> <r:permissionEvaluator value="#{NavigationBean.currentNode}" allow="Delete" id="eval2">
<a:actionLink value="#{msg.delete_forum}" image="/images/icons/delete.gif" padding="4" action="dialog:deleteForum" actionListener="#{BrowseBean.setupDeleteAction}" id="link3"> <a:actionLink value="#{msg.delete_forum}" image="/images/icons/delete_forum.gif" padding="4" action="dialog:deleteForum" actionListener="#{BrowseBean.setupDeleteAction}" id="link3">
<f:param name="id" value="#{NavigationBean.currentNodeId}" id="param2" /> <f:param name="id" value="#{NavigationBean.currentNodeId}" id="param2" />
</a:actionLink> </a:actionLink>
</r:permissionEvaluator> </r:permissionEvaluator>

View File

@@ -93,7 +93,7 @@
<%-- Current space More actions menu --%> <%-- Current space More actions menu --%>
<a:menu id="spaceMenu" itemSpacing="4" label="#{msg.more_options}" image="/images/icons/more.gif" tooltip="#{msg.more_options_space}" menuStyleClass="moreActionsMenu" style="padding-left:20px"> <a:menu id="spaceMenu" itemSpacing="4" label="#{msg.more_options}" image="/images/icons/more.gif" tooltip="#{msg.more_options_space}" menuStyleClass="moreActionsMenu" style="padding-left:20px">
<r:permissionEvaluator value="#{NavigationBean.currentNode}" allow="Delete" id="eval3"> <r:permissionEvaluator value="#{NavigationBean.currentNode}" allow="Delete" id="eval3">
<a:actionLink value="#{msg.delete_forums}" image="/images/icons/delete.gif" action="dialog:deleteForums" actionListener="#{BrowseBean.setupDeleteAction}" id="link4"> <a:actionLink value="#{msg.delete_forums}" image="/images/icons/delete_forums.gif" action="dialog:deleteForums" actionListener="#{BrowseBean.setupDeleteAction}" id="link4">
<f:param name="id" value="#{NavigationBean.currentNodeId}" id="param2" /> <f:param name="id" value="#{NavigationBean.currentNodeId}" id="param2" />
</a:actionLink> </a:actionLink>
<a:actionLink value="#{msg.cut}" image="/images/icons/cut.gif" actionListener="#{ClipboardBean.cutNode}" id="link5"> <a:actionLink value="#{msg.cut}" image="/images/icons/cut.gif" actionListener="#{ClipboardBean.cutNode}" id="link5">

View File

@@ -87,7 +87,7 @@
<f:param name="id" value="#{NavigationBean.currentNodeId}" id="param1" /> <f:param name="id" value="#{NavigationBean.currentNodeId}" id="param1" />
</a:actionLink> </a:actionLink>
<r:permissionEvaluator value="#{NavigationBean.currentNode}" allow="Delete" id="eval2"> <r:permissionEvaluator value="#{NavigationBean.currentNode}" allow="Delete" id="eval2">
<a:actionLink value="#{msg.delete_topic}" image="/images/icons/delete.gif" padding="4" action="dialog:deleteTopic" actionListener="#{BrowseBean.setupDeleteAction}" id="link3"> <a:actionLink value="#{msg.delete_topic}" image="/images/icons/delete_topic.gif" padding="4" action="dialog:deleteTopic" actionListener="#{BrowseBean.setupDeleteAction}" id="link3">
<f:param name="id" value="#{NavigationBean.currentNodeId}" id="param2" /> <f:param name="id" value="#{NavigationBean.currentNodeId}" id="param2" />
</a:actionLink> </a:actionLink>
</r:permissionEvaluator> </r:permissionEvaluator>