From 2120371a7c8bb491b12ca4d56265aeeccbda3472 Mon Sep 17 00:00:00 2001 From: Kevin Roast Date: Fri, 12 May 2006 11:02:34 +0000 Subject: [PATCH] . 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 --- .../org/alfresco/web/bean/TrashcanBean.java | 108 ++++++++++-------- .../web/bean/repository/Repository.java | 17 ++- .../alfresco/web/ui/repo/tag/NodePathTag.java | 2 +- source/web/images/filetypes/js.gif | Bin 0 -> 1058 bytes source/web/images/filetypes32/js.gif | Bin 0 -> 1072 bytes source/web/jsp/trashcan/trash-list.jsp | 10 +- 6 files changed, 84 insertions(+), 53 deletions(-) create mode 100644 source/web/images/filetypes/js.gif create mode 100644 source/web/images/filetypes32/js.gif diff --git a/source/java/org/alfresco/web/bean/TrashcanBean.java b/source/java/org/alfresco/web/bean/TrashcanBean.java index 13bc4cc33..a209c99a7 100644 --- a/source/java/org/alfresco/web/bean/TrashcanBean.java +++ b/source/java/org/alfresco/web/bean/TrashcanBean.java @@ -35,10 +35,10 @@ import org.alfresco.repo.node.archive.RestoreNodeReport; import org.alfresco.repo.node.archive.RestoreNodeReport.RestoreStatus; import org.alfresco.repo.search.impl.lucene.QueryParser; 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.NodeRef; 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.ResultSetRow; import org.alfresco.service.cmr.search.SearchParameters; @@ -479,13 +479,31 @@ public class TrashcanBean implements IContextListener private NodePropertyResolver resolverLocationPath = new NodePropertyResolver() { 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() { 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(); } + /** + * 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 */ @@ -739,28 +767,28 @@ public class TrashcanBean implements IContextListener { FacesContext fc = FacesContext.getCurrentInstance(); + // restore the nodes - the user may have requested a restore to a different parent + List nodeRefs = new ArrayList(this.listedItems.size()); + for (Node node : this.listedItems) + { + nodeRefs.add(node.getNodeRef()); + } + List reports; + if (this.destination == null) + { + reports = this.nodeArchiveService.restoreArchivedNodes(nodeRefs); + } + else + { + reports = this.nodeArchiveService.restoreArchivedNodes(nodeRefs, this.destination, null, null); + } + 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 - List nodeRefs = new ArrayList(this.listedItems.size()); - for (Node node : this.listedItems) - { - nodeRefs.add(node.getNodeRef()); - } - List reports; - if (this.destination == null) - { - reports = this.nodeArchiveService.restoreArchivedNodes(nodeRefs); - } - else - { - reports = this.nodeArchiveService.restoreArchivedNodes(nodeRefs, this.destination, null, null); - } - saveReportDetail(reports); tx.commit(); @@ -776,9 +804,6 @@ public class TrashcanBean implements IContextListener fc.addMessage(null, facesMsg); } - // clear the UI state in preparation for finishing the action - contextUpdated(); - return OUTCOME_RECOVERY_REPORT; } @@ -789,24 +814,23 @@ public class TrashcanBean implements IContextListener { FacesContext fc = FacesContext.getCurrentInstance(); + // restore all nodes - the user may have requested a restore to a different parent + List reports; + if (this.destination == null) + { + reports = this.nodeArchiveService.restoreAllArchivedNodes(Repository.getStoreRef()); + } + else + { + reports = this.nodeArchiveService.restoreAllArchivedNodes(Repository.getStoreRef(), this.destination, null, null); + } + 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 - List reports; - if (this.destination == null) - { - reports = this.nodeArchiveService.restoreAllArchivedNodes(Repository.getStoreRef()); - } - else - { - reports = this.nodeArchiveService.restoreAllArchivedNodes(Repository.getStoreRef(), this.destination, null, null); - } - - // TODO: wrap all this in a UserTransaction - it performs a lot of getProperties()! saveReportDetail(reports); tx.commit(); @@ -822,9 +846,6 @@ public class TrashcanBean implements IContextListener fc.addMessage(null, facesMsg); } - // clear the UI state in preparation for finishing the action - contextUpdated(); - return OUTCOME_RECOVERY_REPORT; } @@ -858,9 +879,6 @@ public class TrashcanBean implements IContextListener FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err); } - // clear the UI state in preparation for finishing the action - contextUpdated(); - return OUTCOME_DIALOGCLOSE; } @@ -879,9 +897,6 @@ public class TrashcanBean implements IContextListener FacesContext.getCurrentInstance(), Repository.ERROR_GENERIC), err.getMessage()), err); } - // clear the UI state in preparation for finishing the action - contextUpdated(); - return OUTCOME_DIALOGCLOSE; } @@ -1100,10 +1115,11 @@ public class TrashcanBean implements IContextListener buf.append(""); buf.append(node.getName()); buf.append(""); - Path path = (Path)node.getProperties().get(ContentModel.PROP_ARCHIVED_ORIGINAL_PATH); - if (path != null) + ChildAssociationRef childRef = + (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(""); if (report) diff --git a/source/java/org/alfresco/web/bean/repository/Repository.java b/source/java/org/alfresco/web/bean/repository/Repository.java index 3f3b4b0ea..3860ac21e 100644 --- a/source/java/org/alfresco/web/bean/repository/Repository.java +++ b/source/java/org/alfresco/web/bean/repository/Repository.java @@ -223,10 +223,25 @@ public final class Repository * @return human readable form of the Path excluding the final element */ 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); - for (int i=0; i&ehrPInQ%;?ib``+$n|v zP{0QqS1=g#dcE!K?OhC}_{&$lPA?LQ_&k0faOCs(J)V7+%k6ON?0bDqm)o#uJPHPX z1p)_$hd#f5-|KaIJll4=*(=`g$T!y|{Sb_dECYeu8v|W6NUMH2eXB(AAZd#RU+lnw^=MnVz1WnwnH9 zC&tGWa{2es(Gi(UGCVvyG}QC?GoJ@Sx!mq<4x9av#bR`JcF^gEpf8`#!UB8yl0$)_zv($doY{{H>_{rvp=`}_O)`uh3# z`S|$w_xJbq_V)Gl_4M@g^Yioa^78TV@$m5Q@9*#K?(XgF?dgww0>FMa`=;!C> z=H}+*<>ln$K_O#KgqI!^6VD z!ok78z`(%2zrVh|zP-J@yu7@-ySuu&y1BWzxVX5tx3{*owzajjw6wIdv$L|YvazwT zu&}VNudlAIuC1-DtgNi7tE;N2s;Q}|sHmu?r>CZ-rlqB&q@<*yqobmtqM@OoprD|i zpP!zdo}HbYoSdASo12=NnwgoIn3$NCmzR~5m6Vi}larH@l9G{;k&uv(kB^Uzj*g9u zjf;zmii(PfiHV4ah=+%Vf`Wp9fr0=3{{R30000000000000000A^8LW004RbEC2ui z03ZM$000O7fO>+1goTEOh#><5BPAv%Dl9DoFfubXH$D@Hh9d|E1_cEM2M7ua3=Izu z5k^QEoP;F_2cV<}38xGWs}VOWOd7F*CkdamrMaoR5E4KlIZwi|DGCY32-ms|4y+PN zG(AvM(}*ey3f8&X%n=e;Q&?SOP_T$B3=8`E%e@j4BWBE?F@%eWO@~}GXuzOhDsJum zQLu19z>F>}E+Bg0z`??W9j8#iLPcT)iUMMEAs_$|j0Z3sTu=hD%mfT(CQz`_p&|yA zED_0oKomnABVD@exUiwf7&cPce87+a#>$q5Xh?_E0mDWbsu~D*33})Tg~JoZkQgE22bnTPUeM4HCxeC!E(T*Y zq@zLwCvbwSNI~QbMKn%w^qAr%42R5w4K1~hriKg{FVbA7D4Coa!>_R;R z2w1ZNhm9I*lw-i~2KW*vc|5Q%zPZqk=~&cg>A_pS zLxc#)5=RafB~3)}h6f*fAm4F>46%U*4APNA5=bPW#1c(FF@+U$m;eF@D$I9C5gcr= zK^SO2@x+NxL~$V&T(m((2qB~Z27-eaVOIwv%%R2`cZgvH7HstAh8-v@l0q0X3W9`< z2TXcU!W2x#(S;XoY)D251Bg%-lHC!aM1f#}sRkZ+bfHL=T9R;r7)k2ELaj7;QGO$e)1Pd1sz^mcVD1gKROyqKr~OMHN+8VZ{|#WTAx?TX4}u94uIX qhy(+$K)|S^mTD@gEDRt4Cla8f+^ew08kPmC4rA-BxaK-YAOJg;r4>p5 literal 0 HcmV?d00001 diff --git a/source/web/jsp/trashcan/trash-list.jsp b/source/web/jsp/trashcan/trash-list.jsp index 62ae75ba1..9812c118f 100644 --- a/source/web/jsp/trashcan/trash-list.jsp +++ b/source/web/jsp/trashcan/trash-list.jsp @@ -114,8 +114,8 @@ <%-- Admin only global actions --%> -   - +   + @@ -210,8 +210,8 @@
<%-- Recover Listed Items actions --%> -   - +   +
- + <%-- Deleted Date column --%>