AnsweredAssumed Answered

Show dialog in a Share action calling a JavaScript WebScript

Question asked by douglascrp Moderator on Jul 27, 2012
Latest reply on May 8, 2013 by romvdn58
I'm trying to config an action, which calls a javascript function, like the example on this site
http://ecmstuff.blogspot.com.br/2012/04/adding-document-library-actions-in.html

The action is:

      <action id="mycompany.doclib.action.sendAsEmail"
              icon="email"
              type="javascript"
              label="actions.mycompany.sendAsEmail">
         <param name="function">onActionSendAsEmail</param>
         <param name="successMessage">message.sendAsEmail.success</param>
         <param name="failureMessage">message.sendAsEmail.failure</param>
         <evaluator negate="true">mycompany.evaluator.doclib.action.isEmailed
         </evaluator>
      </action>

and the javascript funcion is defined like this


(function() {
    YAHOO.Bubbling.fire("registerAction",
    {
        actionName: "onActionSendAsEmail",
        fn: function mycompany_onActionSendEmail(file) {
            this.modules.actions.genericAction(
            {
                success:
                {
                    message: this.msg("message.sendAsEmail.success", file.displayName, Alfresco.constants.USERNAME)
                },
                failure:
                {
                    message: this.msg("message.sendAsEmail.failure", file.displayName, Alfresco.constants.USERNAME)
                },
                webscript:
                {
                    name: "mycompany/sendDocInEmail?nodeRef={nodeRef}&userName={userName}",
                    stem: Alfresco.constants.PROXY_URI,
                    method: Alfresco.util.Ajax.GET,
                    params:
                    {
                        nodeRef: file.nodeRef,
                        userName: Alfresco.constants.USERNAME
                    }
                },
                config:
                {
                }

            });
        }
    });
})();

Evething work this way.

In the same site, the author shows how to call a form dialog, where user can type some text, which are passed to the action.


    <action id="mycompany.doclib.action.sendAsEmailWithForm"
            icon="email"
            type="javascript"
            label="actions.mycompany.sendAsEmailWithForm">
        <param name="function">onActionFormDialog</param>
        <param name="itemKind">action</param>
        <param name="itemId">send-as-email</param>
        <param name="mode">create</param>
        <param name="destination">{node.nodeRef}</param>
        <param name="successMessage">message.send-as-email.success</param>
        <param name="failureMessage">message.send-as-email.failure</param>
        <evaluator negate="true">
mycompany.evaluator.doclib.action.isEmailed</evaluator>
    </action>

I'm trying to do the same, but the difference between my webscript and the site's webscript is that my webscript is javascript based, and the site's webscript is java based.
The author have configured a bean, which is used in the itemId parameter


<bean id="send-as-email" class="com.mycompany.cms.action.SendAsEmailActionExecuter" parent="action-executer">
        <property name="alfrescoRepoHelper">
            <ref bean="alfrescoRepoHelper"/>
        </property>
        <property name="nodeService">
            <ref bean="NodeService"/>
        </property>
    </bean>

How to make the action to show the form dialog, but calling my javascript webscript instead of java webscript (bean)?

Sorry for the English… I'm typing in a hurry

Thanks in advance

Outcomes