I'm working on a project in which I've developed an action that's working fine as a rule, as a doclib action on a document and as an action in the document detail page in Share using Alfresco CE 6.2-GA. For this I followed Jeff Potts excellent tutorial: http://ecmarchitect.com/alfresco-developer-series-tutorials/actions/tutorial/tutorial.html. I'm using the All-In-One SDK project, version 4.1, in Eclipse. I now need to apply this logic to a group of documents selected by the user in the multi select drop down menu. I don't need user interface like for example "Download as Zip".
I got my new menu item with icon in the drop down list which I configured in an extension module my-custom-share.xml file in a <multi-select> tag. It looks like this:
<config evaluator="string-compare" condition="DocumentLibrary">
<multi-select>
<action type="action-link" id="onActionMultiTag" asset="document" label="my-action-multi-tags" icon="my-action-tag-image"/>
</multi-select>
</config>
In the Share source code I found the actions.js file which I renamed to my-multitag-actions.js and added, as a copy of onActionDownload this piece of code:
onActionMultiTag: function dla_onActionMultiTag(record) {
var downloadDialog = Alfresco.getArchiveAndDownloadInstance(),
config = { nodesToArchive: [] };
if (record.length == 1)
{
config.nodesToArchive.push({"nodeRef": record[0].nodeRef});
config.archiveName = record[0].fileName;
}
else
{
for (var i=0; i<record.length; i++)
{
config.nodesToArchive.push({"nodeRef": record[i].nodeRef})
}
}
downloadDialog.show(config);
}
I placed this file under META-INF/resources/components/documentlibrary/my-multitag. In the extension module my-custom-share.xml I referenced this file like this:
<config evaluator="string-compare" condition="DocLibCustom" replace="true">
<dependencies>
<js src="components/documentlibrary/my-multitag/my-multitag-actions.js" />
<css src="components/toolbar/custom-toolbar.css" />
</dependencies>
</config>
I built the project and tested. I was expecting my menu to do the same as "Download as Zip" but nothing happens. I went into the Share container and found the actions.js file in webapps/share/components/documentlibrary/actions.js. My custom "my-multitag-actions.js" is inside webapps/share/WEB-INF/lib/my-custom-share-1.0-SNAPSHOT.jar. I found that if I paste the onActionMultiTag code into webapps/share/components/documentlibrary/actions.js and restart the container my menu selection works like "Download as Zip".
I suppose the problem is how or where to override actions.js (among other potential problems further on).
Can anybody point me to a tutorial for creating a multi-select action from scratch? I've searched all over and haven't found any complete reference of how to do this.
Thanks.