From fbe26a49f2da2ae6a7f6db52273da28810d431ea Mon Sep 17 00:00:00 2001 From: Kevin Roast Date: Fri, 12 May 2006 14:13:13 +0000 Subject: [PATCH] . Soft Delete UI fixes after testing - Correct rendering of failure/success lists git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@2876 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../org/alfresco/web/bean/TrashcanBean.java | 58 +++++++++++++------ 1 file changed, 39 insertions(+), 19 deletions(-) diff --git a/source/java/org/alfresco/web/bean/TrashcanBean.java b/source/java/org/alfresco/web/bean/TrashcanBean.java index a209c99a74..763a9d6c45 100644 --- a/source/java/org/alfresco/web/bean/TrashcanBean.java +++ b/source/java/org/alfresco/web/bean/TrashcanBean.java @@ -77,7 +77,7 @@ public class TrashcanBean implements IContextListener private static final String MSG_RECOVERED_ITEM_FAILURE_S = "recovered_item_failure_short"; private static final String MSG_RECOVERED_ITEM_SUCCESS = "recovered_item_success"; private static final String MSG_RECOVERY_REASON = "recovery_report_reason"; - private static final String MSG_ORIGINAL_LOCATION = "original_location"; + private static final String MSG_LOCATION = "location"; private static final String MSG_NAME = "name"; private static final String PROP_RECOVERSTATUS = "recoverstatus"; @@ -352,7 +352,7 @@ public class TrashcanBean implements IContextListener */ public String getListedItemsTable() { - return buildItemsTable(getListedItems(), "recoveredItemsList", false); + return buildItemsTable(getListedItems(), "recoveredItemsList", false, true); } /** @@ -360,7 +360,7 @@ public class TrashcanBean implements IContextListener */ public String getSuccessItemsTable() { - return buildItemsTable(this.successItems, "recoveredItemsList", false); + return buildItemsTable(this.successItems, "recoveredItemsList", false, false); } /** @@ -368,7 +368,7 @@ public class TrashcanBean implements IContextListener */ public String getFailureItemsTable() { - return buildItemsTable(this.failureItems, "failedItemsList", true); + return buildItemsTable(this.failureItems, "failedItemsList", true, false); } /** @@ -1066,14 +1066,17 @@ public class TrashcanBean implements IContextListener /** * Build an HTML table of the items that are to be or have been recovered. * - * @param items List of Node objects to display in the table - * @param cssClass CSS style to apply to the table - * @param report Set true to report the reason for any failure. This flag requires that the Node - * object has a pseudo property "recoverstatus" containing the RestoreStatus. + * @param items List of Node objects to display in the table + * @param cssClass CSS style to apply to the table + * @param report Set true to report the reason for any failure. This flag requires that the Node + * object has a pseudo property "recoverstatus" containing the RestoreStatus. + * @param archivedPath Set true to show the path from the 'sys:archivedOriginalParentAssoc' property, + * else the current Node Path will be used. + * * * @return HTML table of node info */ - private String buildItemsTable(List items, String cssClass, boolean report) + private String buildItemsTable(List items, String cssClass, boolean report, boolean archivedPath) { FacesContext fc = FacesContext.getCurrentInstance(); String contextPath = fc.getExternalContext().getRequestContextPath(); @@ -1087,15 +1090,19 @@ public class TrashcanBean implements IContextListener // title row buf.append(""); buf.append(Application.getMessage(fc, MSG_NAME)); - buf.append(""); - buf.append(Application.getMessage(fc, MSG_ORIGINAL_LOCATION)); buf.append(""); - if (report) + if (report == true) { buf.append(""); buf.append(Application.getMessage(fc, MSG_RECOVERY_REASON)); buf.append(""); } + else + { + buf.append(""); + buf.append(Application.getMessage(fc, MSG_LOCATION)); + buf.append(""); + } buf.append(""); for (Node node : items) { @@ -1114,14 +1121,8 @@ public class TrashcanBean implements IContextListener buf.append(""); buf.append(""); buf.append(node.getName()); - buf.append(""); - ChildAssociationRef childRef = - (ChildAssociationRef)node.getProperties().get(ContentModel.PROP_ARCHIVED_ORIGINAL_PARENT_ASSOC); - if (nodeService.exists(childRef.getParentRef())) - { - buf.append(Repository.getNamePath(nodeService, nodeService.getPath(childRef.getParentRef()), null, "/", null)); - } buf.append(""); + if (report) { buf.append(""); @@ -1147,6 +1148,25 @@ public class TrashcanBean implements IContextListener buf.append(Application.getMessage(fc, msg)); buf.append(""); } + else + { + buf.append(""); + if (archivedPath) + { + ChildAssociationRef childRef = + (ChildAssociationRef)node.getProperties().get(ContentModel.PROP_ARCHIVED_ORIGINAL_PARENT_ASSOC); + if (nodeService.exists(childRef.getParentRef())) + { + buf.append(Repository.getNamePath(nodeService, nodeService.getPath(childRef.getParentRef()), null, "/", null)); + } + } + else + { + buf.append(Repository.getNamePath(nodeService, nodeService.getPath(node.getNodeRef()), null, "/", null)); + } + buf.append(""); + } + buf.append(""); } // end table