. Soft Delete UI fixups and minor changes

- Removed use of "sys:archivedOriginalPath" - instead uses childassocref to build path (as per Derek's request)
 - Fix to building of success/failure items lists outside of the transaction to restore nodes
. JavaScript example files added to bootstrap
. JavaScript file icons from Linton

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2868 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Kevin Roast
2006-05-12 11:02:34 +00:00
parent bac4f6f892
commit 2120371a7c
6 changed files with 84 additions and 53 deletions

View File

@@ -35,10 +35,10 @@ import org.alfresco.repo.node.archive.RestoreNodeReport;
import org.alfresco.repo.node.archive.RestoreNodeReport.RestoreStatus; import org.alfresco.repo.node.archive.RestoreNodeReport.RestoreStatus;
import org.alfresco.repo.search.impl.lucene.QueryParser; import org.alfresco.repo.search.impl.lucene.QueryParser;
import org.alfresco.service.cmr.dictionary.DictionaryService; import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.InvalidNodeRefException; import org.alfresco.service.cmr.repository.InvalidNodeRefException;
import org.alfresco.service.cmr.repository.NodeRef; import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.cmr.repository.NodeService; import org.alfresco.service.cmr.repository.NodeService;
import org.alfresco.service.cmr.repository.Path;
import org.alfresco.service.cmr.search.ResultSet; import org.alfresco.service.cmr.search.ResultSet;
import org.alfresco.service.cmr.search.ResultSetRow; import org.alfresco.service.cmr.search.ResultSetRow;
import org.alfresco.service.cmr.search.SearchParameters; import org.alfresco.service.cmr.search.SearchParameters;
@@ -479,13 +479,31 @@ public class TrashcanBean implements IContextListener
private NodePropertyResolver resolverLocationPath = new NodePropertyResolver() { private NodePropertyResolver resolverLocationPath = new NodePropertyResolver() {
public Object get(Node node) { public Object get(Node node) {
return (Path)node.getProperties().get(ContentModel.PROP_ARCHIVED_ORIGINAL_PATH); ChildAssociationRef childRef =
(ChildAssociationRef)node.getProperties().get(ContentModel.PROP_ARCHIVED_ORIGINAL_PARENT_ASSOC);
if (nodeService.exists(childRef.getParentRef()))
{
return nodeService.getPath(childRef.getParentRef());
}
else
{
return null;
}
} }
}; };
private NodePropertyResolver resolverDisplayPath = new NodePropertyResolver() { private NodePropertyResolver resolverDisplayPath = new NodePropertyResolver() {
public Object get(Node node) { public Object get(Node node) {
return Repository.getDisplayPath((Path)node.getProperties().get(ContentModel.PROP_ARCHIVED_ORIGINAL_PATH)); ChildAssociationRef childRef =
(ChildAssociationRef)node.getProperties().get(ContentModel.PROP_ARCHIVED_ORIGINAL_PARENT_ASSOC);
if (nodeService.exists(childRef.getParentRef()))
{
return Repository.getDisplayPath(nodeService.getPath(childRef.getParentRef()), true);
}
else
{
return "";
}
} }
}; };
@@ -623,6 +641,16 @@ public class TrashcanBean implements IContextListener
contextUpdated(); contextUpdated();
} }
/**
* Action handler to setup actions that act on lists
*/
public void setupListAction(ActionEvent event)
{
// clear the UI state in preparation for finishing the next action
setDestination(null);
contextUpdated();
}
/** /**
* Delete single item OK button handler * Delete single item OK button handler
*/ */
@@ -739,12 +767,6 @@ public class TrashcanBean implements IContextListener
{ {
FacesContext fc = FacesContext.getCurrentInstance(); FacesContext fc = FacesContext.getCurrentInstance();
UserTransaction tx = null;
try
{
tx = Repository.getUserTransaction(FacesContext.getCurrentInstance(), true);
tx.begin();
// restore the nodes - the user may have requested a restore to a different parent // restore the nodes - the user may have requested a restore to a different parent
List<NodeRef> nodeRefs = new ArrayList<NodeRef>(this.listedItems.size()); List<NodeRef> nodeRefs = new ArrayList<NodeRef>(this.listedItems.size());
for (Node node : this.listedItems) for (Node node : this.listedItems)
@@ -761,6 +783,12 @@ public class TrashcanBean implements IContextListener
reports = this.nodeArchiveService.restoreArchivedNodes(nodeRefs, this.destination, null, null); reports = this.nodeArchiveService.restoreArchivedNodes(nodeRefs, this.destination, null, null);
} }
UserTransaction tx = null;
try
{
tx = Repository.getUserTransaction(FacesContext.getCurrentInstance(), true);
tx.begin();
saveReportDetail(reports); saveReportDetail(reports);
tx.commit(); tx.commit();
@@ -776,9 +804,6 @@ public class TrashcanBean implements IContextListener
fc.addMessage(null, facesMsg); fc.addMessage(null, facesMsg);
} }
// clear the UI state in preparation for finishing the action
contextUpdated();
return OUTCOME_RECOVERY_REPORT; return OUTCOME_RECOVERY_REPORT;
} }
@@ -789,12 +814,6 @@ public class TrashcanBean implements IContextListener
{ {
FacesContext fc = FacesContext.getCurrentInstance(); FacesContext fc = FacesContext.getCurrentInstance();
UserTransaction tx = null;
try
{
tx = Repository.getUserTransaction(FacesContext.getCurrentInstance(), true);
tx.begin();
// restore all nodes - the user may have requested a restore to a different parent // restore all nodes - the user may have requested a restore to a different parent
List<RestoreNodeReport> reports; List<RestoreNodeReport> reports;
if (this.destination == null) if (this.destination == null)
@@ -806,7 +825,12 @@ public class TrashcanBean implements IContextListener
reports = this.nodeArchiveService.restoreAllArchivedNodes(Repository.getStoreRef(), this.destination, null, null); reports = this.nodeArchiveService.restoreAllArchivedNodes(Repository.getStoreRef(), this.destination, null, null);
} }
// TODO: wrap all this in a UserTransaction - it performs a lot of getProperties()! UserTransaction tx = null;
try
{
tx = Repository.getUserTransaction(FacesContext.getCurrentInstance(), true);
tx.begin();
saveReportDetail(reports); saveReportDetail(reports);
tx.commit(); tx.commit();
@@ -822,9 +846,6 @@ public class TrashcanBean implements IContextListener
fc.addMessage(null, facesMsg); fc.addMessage(null, facesMsg);
} }
// clear the UI state in preparation for finishing the action
contextUpdated();
return OUTCOME_RECOVERY_REPORT; return OUTCOME_RECOVERY_REPORT;
} }
@@ -858,9 +879,6 @@ public class TrashcanBean implements IContextListener
FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err); FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err);
} }
// clear the UI state in preparation for finishing the action
contextUpdated();
return OUTCOME_DIALOGCLOSE; return OUTCOME_DIALOGCLOSE;
} }
@@ -879,9 +897,6 @@ public class TrashcanBean implements IContextListener
FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err); FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err);
} }
// clear the UI state in preparation for finishing the action
contextUpdated();
return OUTCOME_DIALOGCLOSE; return OUTCOME_DIALOGCLOSE;
} }
@@ -1100,10 +1115,11 @@ public class TrashcanBean implements IContextListener
buf.append("</td><td>"); buf.append("</td><td>");
buf.append(node.getName()); buf.append(node.getName());
buf.append("</td><td>"); buf.append("</td><td>");
Path path = (Path)node.getProperties().get(ContentModel.PROP_ARCHIVED_ORIGINAL_PATH); ChildAssociationRef childRef =
if (path != null) (ChildAssociationRef)node.getProperties().get(ContentModel.PROP_ARCHIVED_ORIGINAL_PARENT_ASSOC);
if (nodeService.exists(childRef.getParentRef()))
{ {
buf.append(Repository.getDisplayPath(path)); buf.append(Repository.getNamePath(nodeService, nodeService.getPath(childRef.getParentRef()), null, "/", null));
} }
buf.append("</td>"); buf.append("</td>");
if (report) if (report)

View File

@@ -223,10 +223,25 @@ public final class Repository
* @return human readable form of the Path excluding the final element * @return human readable form of the Path excluding the final element
*/ */
public static String getDisplayPath(Path path) public static String getDisplayPath(Path path)
{
return getDisplayPath(path, false);
}
/**
* Return the human readable form of the specified node Path. Fast version of the method that
* simply converts QName localname components to Strings.
*
* @param path Path to extract readable form from
* @param showLeaf Whether to process the final leaf element of the path
*
* @return human readable form of the Path excluding the final element
*/
public static String getDisplayPath(Path path, boolean showLeaf)
{ {
StringBuilder buf = new StringBuilder(64); StringBuilder buf = new StringBuilder(64);
for (int i=0; i<path.size()-1; i++) int count = path.size() - (showLeaf ? 0 : 1);
for (int i=0; i<count; i++)
{ {
String elementString = null; String elementString = null;
Path.Element element = path.get(i); Path.Element element = path.get(i);

View File

@@ -55,7 +55,7 @@ public class NodePathTag extends HtmlComponentTag
setActionListenerProperty((UICommand)component, this.actionListener); setActionListenerProperty((UICommand)component, this.actionListener);
setBooleanProperty(component, "breadcrumb", this.breadcrumb); setBooleanProperty(component, "breadcrumb", this.breadcrumb);
setBooleanProperty(component, "disabled", this.disabled); setBooleanProperty(component, "disabled", this.disabled);
setBooleanProperty(component, "showLeaf", this.disabled); setBooleanProperty(component, "showLeaf", this.showLeaf);
setStringBindingProperty(component, "value", this.value); setStringBindingProperty(component, "value", this.value);
} }

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@@ -114,8 +114,8 @@
<td align=right style="white-space:nowrap"> <td align=right style="white-space:nowrap">
<%-- Admin only global actions --%> <%-- Admin only global actions --%>
<a:actionLink value="#{msg.recover_all_items}" image="/images/icons/recover_all.gif" action="dialog:recoverAllItems" rendered="#{NavigationBean.currentUser.admin == true}" />&nbsp; <a:actionLink value="#{msg.recover_all_items}" image="/images/icons/recover_all.gif" action="dialog:recoverAllItems" actionListener="#{TrashcanBean.setupListAction}" rendered="#{NavigationBean.currentUser.admin == true}" />&nbsp;
<a:actionLink value="#{msg.delete_all_items}" image="/images/icons/delete_all.gif" action="dialog:deleteAllItems" rendered="#{NavigationBean.currentUser.admin == true}" /> <a:actionLink value="#{msg.delete_all_items}" image="/images/icons/delete_all.gif" action="dialog:deleteAllItems" actionListener="#{TrashcanBean.setupListAction}" rendered="#{NavigationBean.currentUser.admin == true}" />
</td> </td>
</tr> </tr>
</table> </table>
@@ -210,8 +210,8 @@
<div style="padding: 4px;"></div> <div style="padding: 4px;"></div>
<%-- Recover Listed Items actions --%> <%-- Recover Listed Items actions --%>
<a:actionLink value="#{msg.recover_listed_items}" image="/images/icons/recover_all.gif" action="dialog:recoverListedItems" />&nbsp; <a:actionLink value="#{msg.recover_listed_items}" image="/images/icons/recover_all.gif" action="dialog:recoverListedItems" actionListener="#{TrashcanBean.setupListAction}" />&nbsp;
<a:actionLink value="#{msg.delete_listed_items}" image="/images/icons/delete_all.gif" action="dialog:deleteListedItems"/> <a:actionLink value="#{msg.delete_listed_items}" image="/images/icons/delete_all.gif" action="dialog:deleteListedItems" actionListener="#{TrashcanBean.setupListAction}" />
<div style="padding: 4px;"></div> <div style="padding: 4px;"></div>
<a:richList id="trashcan-list" binding="#{TrashcanBean.itemsRichList}" viewMode="details" pageSize="10" <a:richList id="trashcan-list" binding="#{TrashcanBean.itemsRichList}" viewMode="details" pageSize="10"
@@ -238,7 +238,7 @@
<f:facet name="header"> <f:facet name="header">
<a:sortLink label="#{msg.original_location}" value="displayPath" styleClass="header"/> <a:sortLink label="#{msg.original_location}" value="displayPath" styleClass="header"/>
</f:facet> </f:facet>
<r:nodePath value="#{r.locationPath}" actionListener="#{BrowseBean.clickSpacePath}" showLeaf="#{r.isFolder == false}" /> <r:nodePath value="#{r.locationPath}" actionListener="#{BrowseBean.clickSpacePath}" showLeaf="true" />
</a:column> </a:column>
<%-- Deleted Date column --%> <%-- Deleted Date column --%>