Jason van Zyl wrote:
>
> On 1/25/02 8:21 PM, "John McNally" <[EMAIL PROTECTED]> wrote:
>
> > In turbine-2 the first was not easily possible, though one java class
> > per template was standard.
> >
> > In turbine-3 the layout of the page is completely configurable, it seems
> > it is not possible to have a java class per template.
>
> What do you mean java class per template? You mean being able to have a
> module execute for any given screen, navigation or layout template?
>
> If that's not working I'll add a test and get it working again.
>
Earlier the renderer executed a Module prior to rendering a template, so
a java class was always run prior to rendering a template. This led to
an annoying behavior in that the screen module was executed twice. As
it had already been run previously in order to make sure the
isAuthorized method was called.
I had suggested moving the isAuthorized call out of the doBuild method
so that it could be called independently. Then isAuthorized would be
called on the Module corresponding to the target template prior to any
templates being rendered. The renderer would still execute the Module
method responsible for building the context (build, doBuild,
doBuildTemplate, not sure exactly which one off the top of my head).
You stated you would prefer that the isAuthorized be separated from the
Module all together and that there be a (pluggable?) policy service of
some sort that would handle that duty. So I left things as they were
until I, you, or someone else could implement this.
Mike in the mean time went with a different solution to the double
execution of the target Module and separated the jobs of running the
module and rendering the template and added a new class, Runner, to do
the former and left the Renderer with only the latter.
So now in a template, you could do (code below may not be 100% accurate,
but this is the idea)
$runner.run("navigations/LeftNav.vm")
$renderer.render("navigations/LeftNav.vm")
$renderer.render($target)
So you could still execute a module prior to rendering a template, but
you had to explicitly request that it be done and you did not need to do
so for the target template because that was always done before any
rendering started.
Now the $runner is not added to the context by the default valves, so
one will have to write their own valve to have the ability to run
modules from within a template.
Maybe we could provide a default PushRenderer that recombined the the
ability to have a Module automatically executed prior to rendering a
template. Or just add the Runner back to the context. Not sure. Or
maybe I have just missed it and this ability still exists?
john mcnally
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>