Alfresco Tutorial: Custom actions including Share configuration

I’ve published a revision of my original Alfresco custom actions tutorial. The second edition greatly expands on the first by adding a UI action example. The original included only a rule action example. Just like the second edition of the content types tutorial, I’ve added instructions on how to configure the actions in Alfresco Share. The Alfresco Explorer steps are still there–they’ve been moved to the Appendix.

The code that accompanies the tutorial builds on the content types tutorial, so it includes the SomeCo content model and the user interface configuration needed to expose that to the Alfresco Share and Alfresco Explorer user interface.

This should be helpful to anyone who read the first edition who now wants to learn how to do the same thing using Alfresco Share, including some of the new extension points available in Alfresco 4.

Take a look and tell me what you think.

23 comments

  1. htk_tset says:

    I’m using alfresco commubity 4.0.d

    I have download alfresco-community-sdk-4.0.d.

    I try to use Tagging sample in alfresco sdk.

    I have do following step to deploy and test. But It doesn’t work:

    build step

    1/ cp /usr/local/tomcat/apache-tomcat-6.0.33/webapps/alfresco.war /root/alfresco-sdk4.0.a/samples/TaggingSample

    in folder: /root/alfresco-sdk4.0.a/samples/TaggingSample:

    2/ ant compile

    3/ ant integrate-extension

    4/ stop tomcat. ( killall -9 java )

    5/ rm -rf /usr/local/tomcat/apache-tomcat-6.0.33/webapps/alfresco

    6/ cp alfresco.war /usr/local/tomcat/apache-tomcat-6.0.33/webapps/

    7/ restart tomcat: /usr/local/tomcat/apache-tomcat-6.0.33/bin/startup.sh

    Test result:

    login alresco.
    in Company Home. click: More Actions
    –> chose Manage Content Rules
    –> click create rule.
    –> Select Condition , chose all Items
    –> click add to list.
    –> click next.

    In select action list: I donot see option: Add tags to an item.
    Are there any thing wrong?

    Please help me.

    Or please tell me the way to build alfresco sdk samples.

  2. Cheers says:

    Hi jeff,

    Your tutorial is very clear, in fact I figured out how to create a new action that affects only folders.

    I want to do a javascript action not java. The thing that is clear to me is:

    what form should I write the controller? and where should I put my js files?

    thanks jeff

  3. jpotts says:

    Glad the tutorial is working for you. If you want to use JavaScript for actions, you have two choices. You can either use the “execute-script” action that already exists, and point it to your JavaScript file that lives in Data Dictionary/Scripts (this is what you’d do for a rule, for example), or you can write a custom Java class that implements ActionExecuter, and have it load and execute JavaScript from the classpath. You could then re-use that Java class for all of your JavaScript-based actions.

    Jeff

  4. Cheers says:

    Hi Jeff,

    thanks for the reply, Now I have a problem I can not deploy your code because when I deploy with ant on eclipse returned this error:

    Error running javac.exe compiler on line 56 of file build.xml.

    This is the offending line:
    javac srcdir=”${src.dir}” destdir=”${bin.dir}” source=”1.6″ target=”1.6″ debug=”on” fork=”yes”

  5. Luis Arteaga says:

    Hi Jeff,

    Very nice tutorial, but funny enough in CE 4.0.d I have to include again the type of sub-type in share-config-custom.xml in order to make it appear in Drawing 2. For example, with your definition I have to do this:
    <type name="cm:content" >
    <sub-type name="sc:doc" />
    <sub-type name="sc:whitepaper" />
    </type>

    <type: name="sc:doc">
    <sub-type name="sc:whitepaper" />
    </type>

    <!-- I have to add this in order to see "whitepaper" type in
    "criteria" dropdown -->

    <type name="sc:whitepaper" >
    </type>

    I can’t see it on Drawing 4. yet though.
    Any clue?
    Thanks

  6. c4lc4ll says:

    Hi Jeff,

    I have the same problem of Cheers when I try to deploy actions-article-repo project, but not for the others. I tried to fit it but ant said the same things of Cheers.

  7. jpotts says:

    Cheers got his working, so it isn’t a problem with the Ant script. Can you check to make sure you have JDK 1.6 by doing a java -version?

    Jeff

  8. jpotts says:

    Luis,

    That should not be the case. I just re-confirmed that the form config works with no additional type element needed. One thing to note is that it matters what the type of the document currently is. For example, using my configuration, you will only see “doc” and “whitepaper” in the dropdown if the current type of the document is “cm:content” and you will only see “whitepaper” in the dropdown if the current type is “sc:doc”. If the current type is anything else you will not see either.

    Maybe you are testing with a document that is currently set to a different type?

    Jeff

  9. Luis Arteaga says:

    Jeff,

    You are right, my mistake, I overlooked some code in config file, it’s working now pretty nice I even use your directions and add my types to “create content” menu item.
    Thanks for your help.
    Luis

  10. c4lc4ll says:

    Hi Jeff,
    java -version output is right.
    I edited build.xml and now Ant can compile.
    I added /java in javac source dir (line 56) as below:

    Now I can deploy and all work fine.

    Hacking with code in order to fit it to my custom action, I got a strange beahviour, I see the “out of the box” form instead of my custom one.

    My custom action name is “param-rendition” and I have replaced all “MoveReplaced” with “ParamRendition” in rule-config-action.get.config.xml, rule-config-action-custom.js and rule-config-action-custom-min.js .

    If I go back it works fine.

    Where I wrong?

    Thanks for your help,

    Daniele

  11. mdarmaone says:

    Jeff,

    Is it possible for me to know the link download address of Alfresco 4.0 d Community source code ?

    If yes, I would be glad if you pass me the info.

    Thanks

  12. jpotts says:

    Sure, the source code lives here:
    http://svn.alfresco.com/repos/alfresco-open-mirror/alfresco/HEAD

    We don’t currently tag Alfresco Community releases, so you have to know the SVN revision number if you want the source as it existed when Alfresco 4.0.d was distributed. Luckily, that is usually documented in the release notes. To save you a search, the revision number for 4.0.d is 33365.

    Also, if you are just trying to associate the source with some of the JARs for debugging purposes, note that the SDK ships with source for the classes distributed with it. So you may not necessarily need the full source tree, depending on what you’re trying to do.

    Jeff

  13. mdarmaone says:

    Dear all,

    Alfresco 4.0 aren”t find files names correctly, in the search, like the version 3.4. I think that the search engine is with a little bit trouble. Someone, here, have the same perception? and any clue to solve this? Please share…Many Thanks

  14. angel says:

    Hi there,

    I want to tell you that maybe this is not the appropiate blog to ask something referent to dashlets. But I can not find nothing about my requirement. I need to show in a dashlet the workflows history of the user. I found that there is a my tasks dashlet. But I guess that I have to build my own service to retrieve data from activiti history processes table. But, How do I can build something like that? I hope you can help me. Thanks for all your support.

  15. Gustavo says:

    Hi, very nice tutorial as usual. I’m havin a problem though, when extending ActionExecuterAbstractBase I’m getting a “The type org.springframework.beans.factory.BeanNameAware cannot be resolved. It is indirectly referenced from required .class files” error. I’m using maven and STS. I was able to extend/implement other Alfresco API classes/interfaces before. Any help would be much appreciated. Thanks.

  16. Than1234 says:

    Jeff Potts:I want to remove RSS feed icon from the repository page. So can you tell me in which file I need to remove it.I searched using SurfBug.But i am not able to find that Rss feed. I have Checked repo-toolbar.get.html.ftl file. I tried removing entire repo-toolbar.get.html.ftl file, Then entire toolbar was removed. I want just Rss Feed Icon to be removed. Can you tell me which file i need to cahnge?

Comments are closed.