redirect to source's parent node after move

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
mtsiak
Active Member II

redirect to source's parent node after move

Hi all.

By default, at document details page, after executing the document action "Move to", the user is being redirected to the node's new target place (the window.location.reload(); line).

we would like the user to stay at the parent folder of the document's source place, so we replaced

window.location.reload();
with

Alfresco.util.Ajax.jsonGet({
url: Alfresco.constants.PROXY_URI + "api/sites/shareUrl?nodeRef=" + encodeURIComponent(this.options.parentId),
successCallback:
{
fn: function(response)
{
var obj = Alfresco.util.parseJSON(response.serverResponse.responseText);
window.location.replace(obj.url);
}
},
failureCallback:
{
fn: function(response)
{
window.location.reload();
}
}
});
I am using sdk 2.0, so if I place the the updated copy-move-to.js to src\main\amp\web\modules\documentlibrary\copy-move-to.js, would it be a good practice?

Meanwhile, the '/alfresco/s/api/sites/shareUrl?nodeRef=' responds with failure when the file is under a user's home. So in this case we keep the default functionality. how could i get the url in a user's home (sub)folder give its noderef?

Thanks in advance.