Disable a content view result layout

I understand that filters are used on actions. However, I want to control who sees a result layout option on a content view. Is this possible? How can I achieve this?

0 votes

1 answers

1490 views

ANSWER



Hi,

Buttons here are custom buttons part of the content view template and are not controlled by filters although that would be a nice improvement.

If you'd like to put this in place, you'll have to override the default template and maybe hardcode behaviour depending on the content views that you'd like to affect. Note that you can still use filters to control this (checking #{webActions.checkFilter('filterId')} in the template, for instance).

The template in 5.8 is at https://github.com/nuxeo/nuxeo-jsf/blob/master/nuxeo-platform-webapp-base/src/main/resources/web/nuxeo.war/incl/content_view_result_layout_actions.xhtml

1 votes



I was thinking of something along those lines, but I didn't want to have to hard code the behavior.

Being able to use filters on other features would be a huge improvement (maybe a separate parameter?!?!?). Thanks for your answer!

02/22/2014

Ooh! Followup, is there a way to find out the name of the view? IE, checkName('viewname') to determine if the view name matches? At least then I could use the checkFilter() in conjunction, and not REALLY hardcode it in there.
02/22/2014

If you mean the name of the content view, yes, you have access to #{contentView.name}. You can add to it the result layout name #{cvLayout.name} and define a filter id to check like this, maybe using a marker (or another convention) to avoid collisions with other filter ids.

But note that the checkFilter method will return false if the corresponding filter is unknown, so you might need to write a Seam component to help achieving this properly.

02/22/2014