cancel
Showing results for 
Search instead for 
Did you mean: 

Share 3.2 Custom Example - Not working

ahamed_rasmi
Champ in-the-making
Champ in-the-making
Hi,

Example given in following link not working for me.

http://wiki.alfresco.com/wiki/Custom_Document_Library_Action

I am in Alfresco 3.2 RC share site..

The Script backup-action-min.js is found when i view source in IE7..

The relative paths are correct..

Webscripts also responds to URL POST..

Help is sought.
28 REPLIES 28

ggol
Champ in-the-making
Champ in-the-making
Hi,

same problem: Click on new share action "Backup" does not work.
the result of
javascript:alert(Alfresco.doclib.Actions.prototype.onActionBackup);
is
function DL_onActionBackup(file) {
    this.modules.actions.genericAction({success: {message: this.msg("message.backup.success", file.displayName)}, failure: {message: this.msg("message.backup.failure", file.displayName)}, webscript: {name: "backup/site/{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]}}});
}

Does someone have a clue?  Can help?

thanks
Greg

mycroes
Champ in-the-making
Champ in-the-making
Hi Greg,

Are you using a browser which can show requests etc.? If so, check what request is being made when you click the action, and what the response is. If you're not using such a browser, install one  :wink:
Regards,

Michael

ggol
Champ in-the-making
Champ in-the-making
Hi Michael,

yes i used the Firefox Firebug extension - but, if i click on the new action "Backup" there is no output on Firebug console …
so no request is made. Other standard action buttons are working. I can not find the event for clicks on action buttons - do you have a hint (i guess yui is involved somehow)?

thanks a lot
Greg

PS: Alfresco version is Alfresco-Community-3.3g-Full-Setup

mycroes
Champ in-the-making
Champ in-the-making
I just noticed something:
In my post I talk about Alfresco.DocumentList, while you use Alfresco.doclib.Actions. Now it might be one of those objects is an extension of the other, but please verify the action is there.
Regards,

Michael

ggol
Champ in-the-making
Champ in-the-making
I use Alfresco.doclib.Actions as it is described in the Docu http://wiki.alfresco.com/wiki/Custom_Document_Library_Action  (at the end of Page) for version 3.2 onwards.
So i changed the code to this:
/**
* DocumentList "Backup" action
*
* @namespace Alfresco
* @class Alfresco.DocumentList
*/
(function()
{
   /**
    * Backup single document.
    *
    * @method onActionBackup
    * @param row {object} DataTable row representing file to be actioned
    */
  Alfresco.doclib.Actions.prototype.onActionBackup = function DL_onActionBackup(file)
   {
    
      this.modules.actions.genericAction(
      {
         success:
         {
            message: this.msg("message.backup.success", file.displayName)
         },
         failure:
         {
            message: this.msg("message.backup.failure", file.displayName)
         },
         webscript:
         {
            name: "backup/site/{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]
            }
         }
      });
   };
})();
You said
but please verify the action is there.
- but - how can i achive that ?

thanks for your help
Greg

mycroes
Champ in-the-making
Champ in-the-making

You said
but please verify the action is there.
- but - how can i achive that ?


javascript:alert(Alfresco.DocumentList.prototype.onActionBackup);
Regards,

Michael

ggol
Champ in-the-making
Champ in-the-making
Hi Michael,

You gave me a push in the right direction. I have a solution now.
One must use Alfresco.DocumentList NOT Alfresco.doclib.Actions:
 Alfresco.DocumentList.prototype.onActionBackup = function DL_onActionBackup(file)
   {
     this.modules.actions.genericAction(
      …
    success:
         {
            message: this.msg("message.backup.success", file.displayName)
         },
         failure:
         {
            message: this.msg("message.backup.failure", file.displayName)
         },
         ….

}
to get it work for Alfresco version 3.3.

AND: use as parameter: file
and delete row: var file = this.widgets.dataTable.getRecord(row).getData();
it is obsolete.
I test it with: 
Alfresco.DocumentList.prototype.onActionBackup = function DL_onActionBackup(file)
   {
    console.log("File Node: "+file.displayName);

     this.modules.actions.genericAction(
      ….


And change this._msg to this.msg

So - thanks for your help and fast response
Greg

mycroes
Champ in-the-making
Champ in-the-making
You're welcome! Glad you worked it out with the hints I gave, as you can see from this thread the previous poster with this issue wasn't as fortunate.
Regards,

Michael

Hi Michael

I am also making this backup action and when i click on it, it doesn't do anything.

I also checked in firebug that my javascript is not loading neither i am getting a call to it.

Please help what to do

javascript which i want to call

(function()
      {
       /**
      * Backup single document.
      *
      * @method onActionBackup
      * @param file {object} Object literal representing one or more file(s) or folder(s) to be actioned
      */
    YAHOO.Bubbling.fire("registerAction",

             {

                 actionName: "onActionBackup",

                 onActionBackup: function dlA_onActionBackup(record)

       {
   alert("TEST");
         
              var displayName = record.displayName;

              var nodeRef = record.nodeRef;

      this.modules.actions.genericAction(
      {
       success:
       {
      event:
      {
       name: "metadataRefresh"
      },
      message: this.msg("message.archive.success", record.displayName)
       },
       failure:
       {
      message: this.msg("message.archive.failure",record.displayName)
       },
      
       webscript:
       {
      name:"/slingshot/doclib/action/archive/site/{site}/{container}",
      method: Alfresco.util.Ajax.POST
       },
       params:
       {
      site: this.options.siteId,
      container: this.options.containerId
       },
       config:
       {
      requestContentType: Alfresco.util.Ajax.JSON,
      dataObj:
      {
       nodeRefs: [record.nodeRef]
      }
       }
      });
       }
       });
      
      })();




Thanks
Nancy