Custom Evaluator for Document Library
Action
Sometimes we need to show certain
custom action on specified type of content only. Not all content show
that custom action, because we need to evaluate to certain actions
only.
This example explain simple custom
evaluator in alfresco 4 share document library in which I want to
display my custom action only on clm:Draft kind of type content only.
To make this enable we need to modify
following files:
- share-config-custom.xml
- custom-slingshot-application-context.xml
- share-config-custom.xml
This file contains custom action and
actionGroup entry.
Action entry contains information about
the new custom link we are adding to action like below:
<actions>
<param name="page">documentlibrary?nodeRef={node.nodeRef}</param>
<evaluator>evaluator.doclib.action.draftTypeFolder</evaluator>
</action>
</actions>
ActionGroup is the group in which we
are adding our custom action entry
<actionGroups>
<actionGroup id="folder-browse">
<action index="161"
id="folder-assign-workflow" />
</actionGroup>
</actionGroups>
So total entry looks like below :
<config evaluator="string-compare" condition="DocLibActions"> <actions> <action id="folder-assign-workflow" type="pagelink" icon="folder-manage-permissions" label="Start Draft Workflow"> <param name="page">documentlibrary?nodeRef={node.nodeRef}</param> <evaluator>evaluator.doclib.action.draftTypeFolder</evaluator> </action> </actions> <actionGroups> <actionGroup id="folder-browse"> <action index="161" id="folder-assign-workflow" /> </actionGroup> </actionGroups> </config>
- custom-slingshot-application-context.xml
This file contains evaluator entry.
<bean id="evaluator.doclib.action.draftTypeFolder" parent="evaluator.doclib.action.nodeType"> <property name="types"> <list> <value>clm:Draft</value> </list> </property> </bean>
Hi, thanks for post,
ReplyDeleteif I want to create a custom action with a javascript controller where I place my javascript file? I use Alfresco 4.
Regards and thanks.
Hi sil,
Deleteyou can find inside action.js (client side documentlibrary)
you can add your custom method there.
Hi Ghanshym, thanks for reply,
ReplyDeleteI do not mean the client side I have to create an action on a folder that does operations in javascript, where should I put the files?
Thanks
Can you please elaborate more what exactly you want to achieve, because to perform an action here client side js or custom script call to repository is necessary.
DeleteIn javascript operation you place your method inside action.js as I mention earlier.
yes,
DeleteI need to create a script in javascript that works on a folder and allows you to create a DataList type contact.
The datalist must have the same folder name and the fields are dynamically filled with the properties of the document placed in the folder.
Thanks a lot.
Alfresco is not only a simple document management system, it offers rich set of Web 2.0 collaboration features.
ReplyDeletealfresco workflow
How can I make 'Create Content' and 'Create Group' available(enable) for custom roles that I've made ?
ReplyDeleteAlso how can I disable download button for all roles ?
is there anyway to display only draft object in document library or repository?I want to filter object.I want to put that filter on toolbar
ReplyDeleteHi Krutik, can you elaborate your requirements? You can display your action based on your evaluator condition or based on your custom evaluator condition.
DeleteI know i can display my custom action but i would like to do following:
ReplyDeleteone button on toolbar on click of that,spaces(folders) which are displayed will be filtered based on some property.
consider an example ,suppose all object has field named status .I want to display only those objects whose status is draft.This should happen when i click on button that is on toolbar.
Hi Krutik,
DeleteIn your case I dont think you need evaluator. But you should check on your button click and fire a query to repository to fetch your custom type object (e.g. draft kind of content) , simply fire query with your type = draft. to display those result.