From 17698f616fa8a61794f93423d2c1edd243f2329d Mon Sep 17 00:00:00 2001 From: Alan Davis Date: Sat, 31 Jan 2015 10:48:52 +0000 Subject: [PATCH] Merged HEAD-BUG-FIX (5.1/Cloud) to HEAD (5.1/Cloud) 90236: Merged V4.2-BUG-FIX (4.2.4) to HEAD-BUG-FIX (5.0/Cloud) 90185: Merged DEV to V4.2-BUG-FIX (4.2.4). 89014: MNT-12414 Action menu renders two 'cancel edit' actions when working copy opened in webdav by second user. - Was added unlock-document webscript. 89568: MNT-12414 Action menu renders two 'cancel edit' actions when working copy opened in webdav by second user. git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@94665 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261 --- .../action/unlock-document.post.desc.xml | 9 ++++ .../action/unlock-document.post.json.ftl | 2 + .../action/unlock-document.post.json.js | 51 +++++++++++++++++++ 3 files changed, 62 insertions(+) create mode 100644 config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/unlock-document.post.desc.xml create mode 100644 config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/unlock-document.post.json.ftl create mode 100644 config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/unlock-document.post.json.js diff --git a/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/unlock-document.post.desc.xml b/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/unlock-document.post.desc.xml new file mode 100644 index 0000000000..0104d5f375 --- /dev/null +++ b/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/unlock-document.post.desc.xml @@ -0,0 +1,9 @@ + + cancel-checkout + Document List Action - Unlock document + /slingshot/doclib/action/unlock-document/node/{store_type}/{store_id}/{id} + argument + user + required + internal + \ No newline at end of file diff --git a/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/unlock-document.post.json.ftl b/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/unlock-document.post.json.ftl new file mode 100644 index 0000000000..e2f0e9da9f --- /dev/null +++ b/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/unlock-document.post.json.ftl @@ -0,0 +1,2 @@ +<#import "action.lib.ftl" as actionLib /> +<@actionLib.resultsJSON results=results /> \ No newline at end of file diff --git a/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/unlock-document.post.json.js b/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/unlock-document.post.json.js new file mode 100644 index 0000000000..a943527f3e --- /dev/null +++ b/config/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/unlock-document.post.json.js @@ -0,0 +1,51 @@ + + +/** + * Cancel checkout file action + * @method POST + * @param uri {string} /{siteId}/{containerId}/{filepath} + */ + +/** + * Entrypoint required by action.lib.js + * + * @method runAction + * @param p_params {object} standard action parameters: nodeRef, siteId, containerId, path + * @return {object|null} object representation of action result + */ +function runAction(p_params) +{ + var results; + + try + { + var originalDoc = p_params.destNode; + if (p_params.destNode.hasAspect("cm:workingcopy") && p_params.destNode.hasAspect("cm:lockable")) + { + p_params.destNode.unlock(); + } + + var resultId = originalDoc.name, + resultNodeRef = originalDoc.nodeRef.toString(); + + // Construct the result object + results = [ + { + id: resultId, + nodeRef: resultNodeRef, + action: "unlockDocumentAsset", + success: true + }]; + } + catch(e) + { + e.code = status.STATUS_INTERNAL_SERVER_ERROR; + e.message = e.toString(); + throw e; + } + + return results; +} + +/* Bootstrap action script */ +main();