From dfa9efadbfe075fe89f98e46b727975a73969361 Mon Sep 17 00:00:00 2001 From: Kevin Roast Date: Tue, 21 Nov 2006 18:34:56 +0000 Subject: [PATCH] Revert to Snapshot action for Staging Area Snapshot panel git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@4414 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../ui/wcm/component/UISandboxSnapshots.java | 28 ++++++++++++++----- 1 file changed, 21 insertions(+), 7 deletions(-) diff --git a/source/java/org/alfresco/web/ui/wcm/component/UISandboxSnapshots.java b/source/java/org/alfresco/web/ui/wcm/component/UISandboxSnapshots.java index 3bfc452ebd..f244dcc33e 100644 --- a/source/java/org/alfresco/web/ui/wcm/component/UISandboxSnapshots.java +++ b/source/java/org/alfresco/web/ui/wcm/component/UISandboxSnapshots.java @@ -50,6 +50,11 @@ import org.springframework.web.jsf.FacesContextUtils; */ public class UISandboxSnapshots extends SelfRenderingComponent { + private static final String ACT_SNAPSHOT_PREVIEW = "snapshot_preview"; + private static final String ACT_SNAPSHOT_REVERT = "snapshot_revert"; + + private static final String REQUEST_SNAPVERSION = "_snapVer"; + private static Log logger = LogFactory.getLog(UISandboxSnapshots.class); // snapshot date filters @@ -192,6 +197,7 @@ public class UISandboxSnapshots extends SelfRenderingComponent } versions = avmService.getAVMStoreVersions(sandbox, fromDate, toDate); } + Map requestMap = context.getExternalContext().getRequestMap(); for (VersionDescriptor item : versions) { // only display snapshots with a valid tag - others are system generated snapshots @@ -209,15 +215,23 @@ public class UISandboxSnapshots extends SelfRenderingComponent out.write(Integer.toString(item.getVersionID())); out.write(""); // actions for the item - Map params = new HashMap(2, 1.0f); - params.put("sandbox", sandbox); - params.put("version", Integer.toString(item.getVersionID())); - Utils.encodeRecursive(context, aquireAction( - context, sandbox, "snapshot_revert", null, - "#{AVMBrowseBean.revertSnapshot}", null, null, params)); + UIActionLink action = findAction(ACT_SNAPSHOT_REVERT, sandbox); + if (action == null) + { + Map params = new HashMap(2, 1.0f); + params.put("sandbox", sandbox); + params.put("version", "#{" + REQUEST_SNAPVERSION + "}"); + action = createAction(context, sandbox, ACT_SNAPSHOT_REVERT, null, + "#{AVMBrowseBean.revertSnapshot}", null, null, params); + + } + requestMap.put(REQUEST_SNAPVERSION, Integer.toString(item.getVersionID())); + Utils.encodeRecursive(context, action); + requestMap.remove(REQUEST_SNAPVERSION); out.write(" "); + Utils.encodeRecursive(context, aquireAction( - context, sandbox, "snapshot_preview", null, + context, sandbox, ACT_SNAPSHOT_PREVIEW, null, null, null)); out.write(" ");