cancel
Showing results for 
Search instead for 
Did you mean: 

Custom or standard action in webscript

nowhere
Champ in-the-making
Champ in-the-making
Hi all,
I have a very stupid question, but it's very important for me. I hope someone can give me a good start point.
I have a webscript that browse my spaces…I can see folder and documents in it, but I can't add the possibility of executing an action on it.
That's, I created a custom action and now I'd like to have an icon in my ftl template that let me execute that action. My action has an action handler that sends user to a custom jsp page where to insert data and then a class that extends "ActionExecuterAbstractBase" creates a space of a custom type I defined with properties entered in jsp page by user. Anyway, my action is working fine…all I need is recall it from a ftl template.
I'd also like to add standard action icon, such as edit-inline , check-out, delete..so users can execute them from my webscript page response.
Hoping someone can give me an hint…or a reference to some examples I can look for. If you need more details, let me know…I know I wasn't much clear in explanation.
Thanks in advance!
8 REPLIES 8

lista
Star Contributor
Star Contributor
It's not exactly what you want, but maybe it can give you an idea:

http://forums.alfresco.com/en/viewtopic.php?f=14&t=16690&p=54825&hilit=action+from+webscript#p54825

Cheers,
Ivan.

nowhere
Champ in-the-making
Champ in-the-making
Hi Ivan,
thanks for reply…I'll try it in the afternoon, now I can't, and I'll let you know.
But I was thinking…I'd like to prompt user with jsp defined in my action handler, that's:

 
public String getJSPPath()
   {
      return "/jsp/custom/create-custom-space.jsp";
   }

Isn't it possible?  Smiley Sad

Still…what if I would use actions definition in web-client-config-custom.xml?
I mean this for example:

<config>
    <actions>
        <!– Quick Checkout document –>
   <action id="quick_checkout_doc">
       <evaluator>
      org.alfresco.web.action.evaluator.CheckoutDocEvaluator
       </evaluator>
            <label-id>quickcheckout</label-id>
            <image>/images/extension/QuickCheckOut_icon.gif</image>
            <action-listener>….

I know. it makes the action available in web client alfresco…is it not possible to use it in webscript?

Thanks for patience  Smiley Happy
Greetings,
Nowhere

nowhere
Champ in-the-making
Champ in-the-making
Here I'm again…

It works fine for me this code:


   // Action
    Action action = null;
  
    // Execute Action
    action = this.getActionService().createAction("myaction", params);

    this.getActionService().executeAction(action, startNode);

in my class extending "DeclarativeWebScript".

<bean id="webscript.com.sample.company.customspace.get" class="com.sample.alfresco.AuthenticationScript" parent="webscript">
  <property name="actionService">
      <ref bean="ActionService" />
  </property>
</bean>

I don't know if it's right, but it executes my action…  :roll:

Still wondering about let user inserting parameters before execution of the action… :?

luxoliver
Champ in-the-making
Champ in-the-making
Hi,
I have create a Web Script who looks like the 'mytask' Alfresco Web Script.
If you want to add an icon on the existing webscript is really complicated, i advise you to modify it or create a 'looks like', and after to add it like in HTML.
First you have to disable the theme by modifying the javascript. After, you can choose to add an icon who refer to your action.

nowhere
Champ in-the-making
Champ in-the-making
Hi LuxOliver,
thanks for your reply!
I solved my problem using directly webscripts and not calling action from them but I'm still wondering for my first post problem…
That is, I can't invoke an action from my freemarker template…can you say me something about that?

Thanks again and sorry for delay in my answer.
Cheers,
Nowhere

luxoliver
Champ in-the-making
Champ in-the-making
Hello,
I don't think that you can call your custom action directly in your ftl.
To be able to use my own action I had used a JavaScript in which I make an Ajax call (with yahoo library) to a Java Bean.
Roughly I have Java classes in whom I have defines my actions and i call there with an Ajax call.
To use this method it is already necessary to be familiar with the Alfresco SDK and the creation of WAR.

I hope that helped you

nowhere
Champ in-the-making
Champ in-the-making
Hi again,
it's clear enough to me what you say.
I instead created a java backed webscript and put my action logic (create a content for example) in the java class. I don't know if it's a correct way, but it works. I hope it's not so bad…
Thanks for your helpfulness  Smiley Happy  and excuse me for my bad english   Smiley Surprisedops:

Greetings,
Nowhere

luxoliver
Champ in-the-making
Champ in-the-making
I am glad to have been able to help you.
If you find that my answers were worth it you can give me a point.

Thank you and good continuation