cancel
Showing results for 
Search instead for 
Did you mean: 

Using of SubComponent evaluators

webdesigner
Champ in-the-making
Champ in-the-making
Hello,

I've used this tutorial:
http://docs.alfresco.com/4.0/topic/com.alfresco.enterprise.doc/tasks/tu_40_add-content.html

to place a sub-component to the document library toolbar. This component is a button, that should be displayed according to:

- special folder type
- user membership in the special group

So it means this action should be displayed for some special users in special folders.

But if I tried to use a sub-component evaluator as described here: http://docs.alfresco.com/4.0/topic/com.alfresco.enterprise.doc/tasks/tu-v4-subcomponent-evals.html to implement it, I've found following limitations:
- as parameters in the evaluator implementation I receive only a request context, that has info about used site but not about expanded folder

public boolean evaluate(RequestContext context, Map<String, String> params)
    {
        boolean result;
        String site = context.getUriTokens().get("site");
        ….

- the evaluator has been called only once, if the document library has been opened and not by browsing of folders.

Does anyone have experience with using sub-component evaluators? Is it possible to enable/disable sub-components using another approach?


Thanks in advance
Vitali
1 REPLY 1

afaust
Legendary Innovator
Legendary Innovator
Hello,

Sub-Component evaluations are only evaluate once per sub-component per page load. In a document library, this means you can't use sub-component evaluations to react to navigation events, as these are de-coupled from page load.

In order to enhance the document library toolbar in the way you want, you'd have to bind your button to a specific permission. If you then customize the document library data web script result (see here for information), your button will be automatically enabled/disabled based on the permission of the current user on the current folder.

Regards
Axel