Add a BeforeViewTemplateLoadHandler
When thinking about how to go about building the
RolebasedRenderingPlugin, I learned that it is not so easy to affect the templates chosen to render a topic from a plugin. The first time (other than on
init a handler is invoked is just before the end of the
view script, when the final topic is rendered).
It might be usefull to allow a plugin to determine which topic is used as the view template, by having a handler that fires off before the topic used as the view template is loaded, so that the plugin could modify which topic is used.
Note that while designing the above plugin got me thinking about this handler, the usability of this handler is not limited to this plugin.
Just FYI, the only way I can see doing the RolebasedRenderingPlugin without such feature is by heavily leveraging context in the view templates with the plugin affecting the context in the init phase.
--
Contributors: ThomasWeigert - 21 Jan 2007
Discussion
Why don't you tie roles to
TWikiGroups and use INCLUDEs and have an own template covering the
textcontent macro with whatever you need?
--
MichaelDaum - 21 Jan 2007
These are two separate questions and really about the plugin, not this issue...
- Roles are situational, not given purely by group membership. For example, for a given topic, AnotherUser may play the author role, while on a different document she may play the approver role.
- I assume you mean includes in templates. Yes, that is what one has to do, but it is not really limited to
textcontent as the whole appearance of the topic may be contingent on the role the user is playing.
--
ThomasWeigert - 21 Jan 2007
Have you looked at the
WorkflowPlugin?
--
MichaelDaum - 21 Jan 2007
Yes, I maintain the
WorkflowPlugin....
I am trying to separate out role-based aspects from state-machine based aspects...
--
ThomasWeigert - 21 Jan 2007
Can someone think another case when this handler could be useful?
--
RafaelAlvarez - 13 Aug 2008