cancel
Showing results for 
Search instead for 
Did you mean: 

MoveTo action on search results

darkredd
Star Contributor
Star Contributor
Hi all,

I have customized my search page to add a checkbox and a button. My requirement is to be able to select documents from search results and then move them to a selected destination. I have created the action, but I want to call the <strong>MoveTo</strong> action from document library when the button is clicked.
I would appreciate pointers as to how can I call an action defined elsewhere in the system. I know it has to be through a webscript url; I just do not know how to formulate the calling url for that action.

I looked through the existing OOTB files but failed to locate the file the action is called from.

Much thanks.
3 REPLIES 3

krutik_jayswal
Elite Collaborator
Elite Collaborator
Beow is code which is used for opening copy dialog.


                                 if (!this.modules.copyTo)
                  {
                     this.modules.copyTo = new Alfresco.module.DoclibCopyTo(this.id + "-copyTo");
                  }

                  var allowedViewModes =
                  [
                         Alfresco.module.DoclibGlobalFolder.VIEW_MODE_REPOSITORY
                  ];

                  this.modules.copyTo.setOptions(
                  {
                     allowedViewModes: allowedViewModes,
                     mode: mode,
                     siteId: this.options.siteId,
                     containerId: this.options.containerId,
                     path: this.currentPath,
                     files: record,
                     rootNode: this.options.rootNode,
                     parentId: this.getParentNodeRef(record)
                  }).showDialog();

Hi krutik.jayswal,

Sorry for the late reply.

The code you posted above is in the actions.js which resides in the server (alfresco) side which to my knowledge is not accessible directly by invoking the function within share; hence I had the need for a url which I can use to call that function in share. I would appreciate the effort of a sample if you have it.

darkredd
Star Contributor
Star Contributor
Hello all,

I am still stuck on this problem. Here is the code of what I have so far (which does not work):

var moveNodesURL = Alfresco.constants.PROXY_URI + "alfresco/service/slingshot/doclib/action/move-to/node/workspace/SpacesStore/a211774d-ba6d-4a35-b97f-dacfaac7bde3";

Alfresco.util.Ajax.request(
{
url: moveNodesURL,
method: Alfresco.util.Ajax.POST,
dataStr: nodeRefs,
successCallback:
{
fn: function successCallback(response, config)
{
   Alfresco.util.PopupManager.displayMessage({text: this.msg('Successfully moved selected file(s)..')});
   this.refreshSearch(
   {
      searchTag: "",
      searchTerm: YAHOO.lang.trim(Dom.get(this.id + "-search-text").value),
      searchQuery: ""
   });
},
scope: this
},
failureMessage: this.msg("Moving file(s) failed"),
failureCallback:
{
fn: this.failureHandler,
scope: this
}
});


I have this time hard coded the last part of the URL for test purposes.
Has any one worked with this or something similar that fetches/posts data using a URL? Help dearly needed.