09-21-2011 10:18 AM
var Folder_edi = space.parent.childByNamePath("Edition");
if (Folder_edi == null)
{
Folder_edi = space.parent.createFolder("Edition");
}
if(Folder_edi != null && Folder_edi.hasPermission("CreateChildren"))
{
var childrenList = space.children;
for (var i = 0; i < childrenList.length; i++) {
var copy = childrenList[i].move(Folder_edi);
if(copy != null)
{
childrenList[i].save();
//space.save();
}
}
}
09-22-2011 11:11 AM
09-22-2011 12:32 PM
09-22-2011 02:12 PM
<actionSet id="folder">
…
<action type="action-link" id="onActionMoveToEdition" permission="" label="actions.folder.movetoedition"/>
.doclist .folder .onActionMoveToEdition a
{
background-image: url(images/workflowpermissionIcon.png);
}
actions.document.movetoedition=Move to edition
message.movetoedition.success='{0}' successfully moved to edition.
message.movetoedition.failure=Couldn't move to edition'{0}
<!– Backup Action –>
<@link rel="stylesheet" type="text/css" href="${page.url.context}/components/documentlibrary/movetoedition-action.css" />
<@script type="text/javascript" src="${page.url.context}/components/documentlibrary/movetoedition-action.js"></@script>
<webscript>
<shortname>movetoedition</shortname>
<description>Folder List Action - Start workflow </description>
<url>/demo/change-to-edition/{site}/{container}</url>
<format default="json">argument</format>
<authentification>user</authentification>
<transaction>required</transaction>
</webscript>
var Folder_edi = space.parent.childByNamePath("Edition");
if (Folder_edi == null)
{
Folder_edi = space.parent.createFolder("Edition");
}
function runAction(p_params)
{
var results = [];
var files = p_params.files;
var file, fileNode, result, nodeRef;
// Find destination node
var destNode = p_params.rootNode.childByNamePath("/Edition");
if (destNode == null)
{
destNode = p_params.rootNode.createFolder("Edition");
}
// Must have destNode by this point
if (destNode == null)
{
status.setCode(status.STATUS_NOT_FOUND, "Could not find or create /Edicio folder.");
return;
}
// Must have array of files
if (!files || files.length == 0)
{
status.setCode(status.STATUS_BAD_REQUEST, "No files.");
return;
}
for (file in files)
{
nodeRef = files[file];
result =
{
nodeRef: nodeRef,
action: "iniciWF",
success: false
}
try
{
fileNode = search.findNode(nodeRef);
if (fileNode === null)
{
result.id = file;
result.nodeRef = nodeRef;
result.success = false;
}
else
{
result.id = fileNode.name;
result.type = fileNode.isContainer ? "folder" : "document";
// copy the node to the backup folder
result.nodeRef = fileNode.copy(destNode);
result.success = (result.nodeRef !== null);
}
}
catch (e)
{
result.id = file;
result.nodeRef = nodeRef;
result.success = false;
}
results.push(result);
}
return results;
}
/* Bootstrap action script */
main();
<#import "action.lib.ftl" as actionLib />
<@actionLib.resultsJSON results=results />
(function()
{
Alfresco.doclib.Actions.prototype.onActionMoveToEdition= function DL_onActionMoveToEdition(file)
{
this.modules.actions.genericAction(
{
success:
{
message: this.msg("message.movetoedition.success", file.displayName)
},
failure:
{
message: this.msg("message.movetoedition.failure", file.displayName)
},
webscript:
{
name: "demo/change-to-edition/{site}/{container}",
method: Alfresco.util.Ajax.POST
},
params:
{
site: this.options.siteId,
container: this.options.containerId
},
config:
{
requestContentType: Alfresco.util.Ajax.JSON,
dataObj:
{
nodeRefs: [file.nodeRef]
}
}
});
};
})();
09-22-2011 02:58 PM
success:
{
message: this.msg("message.movetoedition.success", file.displayName),
events : [
{
name : "folderCreated"
}]
},
That will trigger a reload of the document listing.
09-23-2011 03:44 PM
<action id="moveToEdicio">
<permissions>
<permission allow="true">Write</permission>
</permissions>
<label>Moure la carpeta a Edicio</label>
<image>/images/icons/listar_docs_expediente.gif</image>
<tooltip>Moure destat</tooltip>
<script>/Espacio de empresa/Diccionario de datos/Scripts/cM_mouEdicio.js</script>
<params>
<param name="id">#{actionContext.id}</param>
</params>
</action>
var Folder_edi = companyhome.childByNamePath("/Espacio de empresa/ELISAVA/GESTIO DE TREBALLS/EDICIO");
space.move(Folder_edi);
space.save();
// Volvemos a la pantalla desde donde se lanza el script
var goBack = "<script>history.back()</script>";
goBack;
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.