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
This commit is contained in:
Alan Davis
2015-01-31 10:48:52 +00:00
parent bcb419efed
commit 17698f616f
3 changed files with 62 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
<webscript>
<shortname>cancel-checkout</shortname>
<description>Document List Action - Unlock document</description>
<url>/slingshot/doclib/action/unlock-document/node/{store_type}/{store_id}/{id}</url>
<format default="json">argument</format>
<authentication>user</authentication>
<transaction>required</transaction>
<lifecycle>internal</lifecycle>
</webscript>

View File

@@ -0,0 +1,2 @@
<#import "action.lib.ftl" as actionLib />
<@actionLib.resultsJSON results=results />

View File

@@ -0,0 +1,51 @@
<import resource="classpath:/alfresco/templates/webscripts/org/alfresco/slingshot/documentlibrary/action/action.lib.js">
/**
* 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();