<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Mutli Select Question - Alfresco Development in Alfresco Forum</title>
    <link>https://connect.hyland.com/t5/alfresco-forum/mutli-select-question-alfresco-development/m-p/108022#M30388</link>
    <description>&lt;P&gt;Axel,&lt;/P&gt;&lt;P&gt;In the meantime I've wrapped my action logic in a Java class webscript where I call the action logic in a loop for each NodeRef. It might not be the best way but performance is not an issue in this case. I call my webscripot this way:&lt;/P&gt;&lt;P&gt;http://localhost:8080/alfresco/service/multitagwebscript/workspace://SpacesStore/e54a0c20-48e3-4620-a2a0-864d38a10a6c&lt;/P&gt;&lt;P&gt;It's defined like this:&lt;/P&gt;&lt;P&gt;&amp;lt;url&amp;gt;/multitagwebscript/{nodeRef}&amp;lt;/url&amp;gt;&lt;/P&gt;&lt;P&gt;I also know the menu selection is working becuae when I use this code:&lt;/P&gt;&lt;P&gt;YAHOO.Bubbling.fire("registerAction",&lt;BR /&gt;{&lt;BR /&gt;actionName: "onActionImageMultiTag",&lt;BR /&gt;fn: function org_alfresco_training_onActionImageMultiTag(images) {&lt;BR /&gt;var nodesRef = [];&lt;BR /&gt;var ii = 0;&lt;BR /&gt;for (var i=0, ii=images.length ; i&amp;lt;ii ; i++){&lt;BR /&gt;nodesRef.push(images[i].nodeRef);&lt;BR /&gt;}&lt;BR /&gt;Alfresco.util.PopupManager.displayMessage(&lt;BR /&gt;{&lt;BR /&gt;text: this.msg("alfresco.tutorials.doclib.action.showCustomMessage.text",&lt;BR /&gt;i, Alfresco.constants.USERNAME)&lt;BR /&gt;});&lt;BR /&gt;}&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;the popup shows the number of documents selected.&lt;/P&gt;&lt;P&gt;What I haven't been able to do is to call the webscript from the custom-doclib-actions.js code. I have this:&lt;/P&gt;&lt;P&gt;YAHOO.Bubbling.fire("registerAction",&lt;BR /&gt;{&lt;BR /&gt;actionName: "onActionImageMultiTag",&lt;BR /&gt;fn: function org_alfresco_training_onActionImageMultiTag(images) {&lt;BR /&gt;var nodesRef = [];&lt;BR /&gt;var ii = 0;&lt;BR /&gt;for (var i=0, ii=images.length ; i&amp;lt;ii ; i++){&lt;BR /&gt;nodesRef.push(images[i].nodeRef);&lt;BR /&gt;}&lt;BR /&gt;this.modules.actions.genericAction(&lt;BR /&gt;{&lt;BR /&gt;success: {&lt;BR /&gt;callback: {&lt;BR /&gt;fn: function org_alfresco_training_onActionImageMultiTagSuccess(response) {&lt;BR /&gt;Alfresco.util.PopupManager.displayPrompt(&lt;BR /&gt;{&lt;BR /&gt;title: this.msg("alfresco.tutorials.doclib.action.ImageMultiTag.msg.success"),&lt;BR /&gt;text: JSON.stringify(response.json),&lt;BR /&gt;buttons: [&lt;BR /&gt;{&lt;BR /&gt;text: this.msg("button.ok"),&lt;BR /&gt;handler: function org_alfresco_training_onActionImageMultiTagSuccess_success_ok() {&lt;BR /&gt;this.destroy();&lt;BR /&gt;},&lt;BR /&gt;isDefault: true&lt;BR /&gt;}]&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;},&lt;BR /&gt;scope: this&lt;BR /&gt;}&lt;BR /&gt;},&lt;BR /&gt;failure: {&lt;BR /&gt;message: this.msg("alfresco.tutorials.doclib.action.ImageMultiTag.msg.failure")&lt;BR /&gt;},&lt;BR /&gt;webscript: {&lt;BR /&gt;name: "multitagwebscript/{nodeRef}",&lt;BR /&gt;stem: "http://localhost:8080/alfresco/service/",&lt;BR /&gt;method: Alfresco.util.Ajax.GET,&lt;BR /&gt;params: {&lt;BR /&gt;nodeRef: nodesRef&lt;BR /&gt;}&lt;BR /&gt;},&lt;BR /&gt;config: {}&lt;BR /&gt;});&lt;BR /&gt;}&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;What syntax do I need for this part?&lt;/P&gt;&lt;P&gt;webscript: {&lt;BR /&gt;name: "multitagwebscript/{nodeRef}",&lt;BR /&gt;stem: "http://localhost:8080/alfresco/service/",&lt;BR /&gt;method: Alfresco.util.Ajax.GET,&lt;BR /&gt;params: {&lt;BR /&gt;nodeRef: nodesRef&lt;BR /&gt;}&lt;BR /&gt;},&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
    <pubDate>Fri, 17 Jul 2020 15:25:10 GMT</pubDate>
    <dc:creator>mags1703</dc:creator>
    <dc:date>2020-07-17T15:25:10Z</dc:date>
    <item>
      <title>Mutli Select Question - Alfresco Development</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/mutli-select-question-alfresco-development/m-p/108018#M30384</link>
      <description>&lt;P&gt;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: &lt;A href="http://ecmarchitect.com/alfresco-developer-series-tutorials/actions/tutorial/tutorial.html" target="_blank" rel="noopener nofollow noreferrer"&gt;http://ecmarchitect.com/alfresco-developer-series-tutorials/actions/tutorial/tutorial.html&lt;/A&gt;. 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".&lt;/P&gt;&lt;P&gt;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 &amp;lt;multi-select&amp;gt; tag. It looks like this:&lt;/P&gt;&lt;P&gt;&amp;lt;config evaluator="string-compare" condition="DocumentLibrary"&amp;gt;&lt;BR /&gt;&amp;lt;multi-select&amp;gt;&lt;BR /&gt;&amp;lt;action type="action-link" id="onActionMultiTag" asset="document" label="my-action-multi-tags" icon="my-action-tag-image"/&amp;gt;&lt;BR /&gt;&amp;lt;/multi-select&amp;gt;&lt;BR /&gt;&amp;lt;/config&amp;gt;&lt;/P&gt;&lt;P&gt;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:&lt;/P&gt;&lt;P&gt;onActionMultiTag: function dla_onActionMultiTag(record) {&lt;BR /&gt;var downloadDialog = Alfresco.getArchiveAndDownloadInstance(),&lt;BR /&gt;config = { nodesToArchive: [] };&lt;/P&gt;&lt;P&gt;if (record.length == 1)&lt;BR /&gt;{&lt;BR /&gt;config.nodesToArchive.push({"nodeRef": record[0].nodeRef});&lt;BR /&gt;config.archiveName = record[0].fileName;&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;for (var i=0; i&amp;lt;record.length; i++)&lt;BR /&gt;{&lt;BR /&gt;config.nodesToArchive.push({"nodeRef": record[i].nodeRef})&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;downloadDialog.show(config);&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;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:&lt;/P&gt;&lt;P&gt;&amp;lt;config evaluator="string-compare" condition="DocLibCustom" replace="true"&amp;gt;&lt;BR /&gt;&amp;lt;dependencies&amp;gt;&lt;BR /&gt;&amp;lt;js src="components/documentlibrary/my-multitag/my-multitag-actions.js" /&amp;gt;&lt;BR /&gt;&amp;lt;css src="components/toolbar/custom-toolbar.css" /&amp;gt;&lt;BR /&gt;&amp;lt;/dependencies&amp;gt;&lt;BR /&gt;&amp;lt;/config&amp;gt;&lt;/P&gt;&lt;P&gt;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".&lt;/P&gt;&lt;P&gt;I suppose the problem is how or where to override actions.js (among other potential problems further on).&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 29 Jun 2020 14:55:39 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/mutli-select-question-alfresco-development/m-p/108018#M30384</guid>
      <dc:creator>mags1703</dc:creator>
      <dc:date>2020-06-29T14:55:39Z</dc:date>
    </item>
    <item>
      <title>Re: Mutli Select Question - Alfresco Development</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/mutli-select-question-alfresco-development/m-p/108019#M30385</link>
      <description>&lt;P&gt;Adding new actions to the document library (this includes the toolbar) is actually reasonably weil &lt;A href="https://docs.alfresco.com/6.2/tasks/dev-extensions-share-tutorials-add-action-doclib.html" target="_self" rel="nofollow noopener noreferrer"&gt;documented in the official documentation&lt;/A&gt;.&lt;/P&gt;
&lt;P&gt;The only thing that they are lacking is a description on the difference in call parameters between multi-select and single item actions. While a single item action will get a "record" parameter of a single object, the multi-select actions get a "records" parameter, which is an array of the same kind of objects. Since the action registered via the official extension point is registered both with the toolbar (multi-select) and the document list (single item), it can be called in both ways and needs to be aware of that, if it wants to support both use cases.&lt;/P&gt;
&lt;P&gt;Alternatively, you can also selectively extend only the toolbar component, if you want to limit an action to that scope. I have used that approach to override or complement default toolbar actions, e.g. adding an alternative delete multi-select action which fails if any one file fails to be deleted and provides proper feedback (&lt;A href="https://github.com/Acosix/alfresco-utility/blob/master/core/share/src/main/webapp/acosix/components/documentlibrary/toolbar.js" target="_blank" rel="nofollow noopener noreferrer"&gt;https://github.com/Acosix/alfresco-utility/blob/master/core/share/src/main/webapp/acosix/components/documentlibrary/toolbar.js&lt;/A&gt;).&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jun 2020 11:22:02 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/mutli-select-question-alfresco-development/m-p/108019#M30385</guid>
      <dc:creator>afaust</dc:creator>
      <dc:date>2020-06-30T11:22:02Z</dc:date>
    </item>
    <item>
      <title>Re: Mutli Select Question - Alfresco Development</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/mutli-select-question-alfresco-development/m-p/108020#M30386</link>
      <description>&lt;P&gt;Thanks for your reply. I'll examine the code and report back&lt;/P&gt;</description>
      <pubDate>Tue, 30 Jun 2020 14:32:43 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/mutli-select-question-alfresco-development/m-p/108020#M30386</guid>
      <dc:creator>mags1703</dc:creator>
      <dc:date>2020-06-30T14:32:43Z</dc:date>
    </item>
    <item>
      <title>Re: Mutli Select Question - Alfresco Development</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/mutli-select-question-alfresco-development/m-p/108021#M30387</link>
      <description>&lt;P&gt;Axel,&lt;/P&gt;&lt;P&gt;After following the &lt;A href="https://docs.alfresco.com/6.2/tasks/dev-extensions-share-tutorials-add-action-doclib.html" target="_blank" rel="nofollow noopener noreferrer"&gt;https://docs.alfresco.com/6.2/tasks/dev-extensions-share-tutorials-add-action-doclib.html&lt;/A&gt; tutorial my understanding improved. I got muy multi-select menu item to do the same as "Download as Zip" with this code in custom-actions.js:&lt;/P&gt;&lt;P&gt;....&lt;BR /&gt;YAHOO.Bubbling.fire("registerAction",&lt;BR /&gt;{&lt;BR /&gt;actionName: "onActionMultiTag",&lt;BR /&gt;fn: function org_alfresco_training_onActionMultiTag(record) {&lt;BR /&gt;var downloadDialog = Alfresco.getArchiveAndDownloadInstance(),&lt;BR /&gt;config = { nodesToArchive: [] };&lt;BR /&gt;if (record.length == 1)&lt;BR /&gt;{&lt;BR /&gt;config.nodesToArchive.push({"nodeRef": record[0].nodeRef});&lt;BR /&gt;config.archiveName = record[0].fileName;&lt;BR /&gt;}&lt;BR /&gt;else&lt;BR /&gt;{&lt;BR /&gt;for (var i=0; i&amp;lt;record.length; i++)&lt;BR /&gt;{&lt;BR /&gt;config.nodesToArchive.push({"nodeRef": record[i].nodeRef})&lt;BR /&gt;}&lt;BR /&gt;}&lt;BR /&gt;downloadDialog.show(config);&lt;BR /&gt;}&lt;BR /&gt;});&lt;BR /&gt;....&lt;/P&gt;&lt;P&gt;In this bit of code what's involved in calling my Java class?&lt;/P&gt;&lt;P&gt;Perhaps I have to create a webscript with the class and use the "Call-Web-Script" example as my starting point. In that case, how would I send the nodeRef array in this bit of code?&lt;/P&gt;&lt;P&gt;YAHOO.Bubbling.fire("registerAction",&lt;BR /&gt;{&lt;BR /&gt;actionName: "onActionCallWebScript",&lt;BR /&gt;fn: function org_alfresco_training_onActionCallWebScript(file) {&lt;BR /&gt;this.modules.actions.genericAction(&lt;BR /&gt;{&lt;BR /&gt;success: {&lt;BR /&gt;callback: {&lt;BR /&gt;fn: function org_alfresco_training_onActionCallWebScriptSuccess(response) {&lt;BR /&gt;Alfresco.util.PopupManager.displayPrompt(&lt;BR /&gt;{&lt;BR /&gt;title: this.msg("alfresco.tutorials.doclib.action.callWebScript.msg.success"),&lt;BR /&gt;text: JSON.stringify(response.json),&lt;BR /&gt;buttons: [&lt;BR /&gt;{&lt;BR /&gt;text: this.msg("button.ok"),&lt;BR /&gt;handler: function org_alfresco_training_onActionCallWebScriptSuccess_success_ok() {&lt;BR /&gt;this.destroy();&lt;BR /&gt;},&lt;BR /&gt;isDefault: true&lt;BR /&gt;},&lt;BR /&gt;{&lt;BR /&gt;text: this.msg("button.cancel"),&lt;BR /&gt;handler: function org_alfresco_training_onActionCallWebScriptSuccess_cancel() {&lt;BR /&gt;this.destroy();&lt;BR /&gt;}&lt;BR /&gt;}]&lt;BR /&gt;});&lt;BR /&gt;},&lt;BR /&gt;scope: this&lt;BR /&gt;}&lt;BR /&gt;},&lt;BR /&gt;failure: {&lt;BR /&gt;message: this.msg("alfresco.tutorials.doclib.action.callWebScript.msg.failure",&lt;BR /&gt;file.displayName, Alfresco.constants.USERNAME)&lt;BR /&gt;},&lt;BR /&gt;webscript: {&lt;BR /&gt;name: "sample/fileinfo?nodeRef={nodeRef}",&lt;BR /&gt;stem: Alfresco.constants.PROXY_URI,&lt;BR /&gt;method: Alfresco.util.Ajax.GET,&lt;BR /&gt;params: {&lt;BR /&gt;nodeRef: file.nodeRef&lt;BR /&gt;}&lt;BR /&gt;},&lt;BR /&gt;config: {}&lt;BR /&gt;});&lt;BR /&gt;}&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;The sample webscript would just count the number of documents.&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Mon, 06 Jul 2020 11:18:39 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/mutli-select-question-alfresco-development/m-p/108021#M30387</guid>
      <dc:creator>mags1703</dc:creator>
      <dc:date>2020-07-06T11:18:39Z</dc:date>
    </item>
    <item>
      <title>Re: Mutli Select Question - Alfresco Development</title>
      <link>https://connect.hyland.com/t5/alfresco-forum/mutli-select-question-alfresco-development/m-p/108022#M30388</link>
      <description>&lt;P&gt;Axel,&lt;/P&gt;&lt;P&gt;In the meantime I've wrapped my action logic in a Java class webscript where I call the action logic in a loop for each NodeRef. It might not be the best way but performance is not an issue in this case. I call my webscripot this way:&lt;/P&gt;&lt;P&gt;http://localhost:8080/alfresco/service/multitagwebscript/workspace://SpacesStore/e54a0c20-48e3-4620-a2a0-864d38a10a6c&lt;/P&gt;&lt;P&gt;It's defined like this:&lt;/P&gt;&lt;P&gt;&amp;lt;url&amp;gt;/multitagwebscript/{nodeRef}&amp;lt;/url&amp;gt;&lt;/P&gt;&lt;P&gt;I also know the menu selection is working becuae when I use this code:&lt;/P&gt;&lt;P&gt;YAHOO.Bubbling.fire("registerAction",&lt;BR /&gt;{&lt;BR /&gt;actionName: "onActionImageMultiTag",&lt;BR /&gt;fn: function org_alfresco_training_onActionImageMultiTag(images) {&lt;BR /&gt;var nodesRef = [];&lt;BR /&gt;var ii = 0;&lt;BR /&gt;for (var i=0, ii=images.length ; i&amp;lt;ii ; i++){&lt;BR /&gt;nodesRef.push(images[i].nodeRef);&lt;BR /&gt;}&lt;BR /&gt;Alfresco.util.PopupManager.displayMessage(&lt;BR /&gt;{&lt;BR /&gt;text: this.msg("alfresco.tutorials.doclib.action.showCustomMessage.text",&lt;BR /&gt;i, Alfresco.constants.USERNAME)&lt;BR /&gt;});&lt;BR /&gt;}&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;the popup shows the number of documents selected.&lt;/P&gt;&lt;P&gt;What I haven't been able to do is to call the webscript from the custom-doclib-actions.js code. I have this:&lt;/P&gt;&lt;P&gt;YAHOO.Bubbling.fire("registerAction",&lt;BR /&gt;{&lt;BR /&gt;actionName: "onActionImageMultiTag",&lt;BR /&gt;fn: function org_alfresco_training_onActionImageMultiTag(images) {&lt;BR /&gt;var nodesRef = [];&lt;BR /&gt;var ii = 0;&lt;BR /&gt;for (var i=0, ii=images.length ; i&amp;lt;ii ; i++){&lt;BR /&gt;nodesRef.push(images[i].nodeRef);&lt;BR /&gt;}&lt;BR /&gt;this.modules.actions.genericAction(&lt;BR /&gt;{&lt;BR /&gt;success: {&lt;BR /&gt;callback: {&lt;BR /&gt;fn: function org_alfresco_training_onActionImageMultiTagSuccess(response) {&lt;BR /&gt;Alfresco.util.PopupManager.displayPrompt(&lt;BR /&gt;{&lt;BR /&gt;title: this.msg("alfresco.tutorials.doclib.action.ImageMultiTag.msg.success"),&lt;BR /&gt;text: JSON.stringify(response.json),&lt;BR /&gt;buttons: [&lt;BR /&gt;{&lt;BR /&gt;text: this.msg("button.ok"),&lt;BR /&gt;handler: function org_alfresco_training_onActionImageMultiTagSuccess_success_ok() {&lt;BR /&gt;this.destroy();&lt;BR /&gt;},&lt;BR /&gt;isDefault: true&lt;BR /&gt;}]&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;},&lt;BR /&gt;scope: this&lt;BR /&gt;}&lt;BR /&gt;},&lt;BR /&gt;failure: {&lt;BR /&gt;message: this.msg("alfresco.tutorials.doclib.action.ImageMultiTag.msg.failure")&lt;BR /&gt;},&lt;BR /&gt;webscript: {&lt;BR /&gt;name: "multitagwebscript/{nodeRef}",&lt;BR /&gt;stem: "http://localhost:8080/alfresco/service/",&lt;BR /&gt;method: Alfresco.util.Ajax.GET,&lt;BR /&gt;params: {&lt;BR /&gt;nodeRef: nodesRef&lt;BR /&gt;}&lt;BR /&gt;},&lt;BR /&gt;config: {}&lt;BR /&gt;});&lt;BR /&gt;}&lt;BR /&gt;});&lt;/P&gt;&lt;P&gt;What syntax do I need for this part?&lt;/P&gt;&lt;P&gt;webscript: {&lt;BR /&gt;name: "multitagwebscript/{nodeRef}",&lt;BR /&gt;stem: "http://localhost:8080/alfresco/service/",&lt;BR /&gt;method: Alfresco.util.Ajax.GET,&lt;BR /&gt;params: {&lt;BR /&gt;nodeRef: nodesRef&lt;BR /&gt;}&lt;BR /&gt;},&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;</description>
      <pubDate>Fri, 17 Jul 2020 15:25:10 GMT</pubDate>
      <guid>https://connect.hyland.com/t5/alfresco-forum/mutli-select-question-alfresco-development/m-p/108022#M30388</guid>
      <dc:creator>mags1703</dc:creator>
      <dc:date>2020-07-17T15:25:10Z</dc:date>
    </item>
  </channel>
</rss>

