You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Jo...@aol.com on 2003/03/10 22:51:18 UTC

Stuck. Need help on Rundata.setLayoutTemplate()

How do I dynamically change the layout template in Turbine according to the 
current user role in a servlet session?

My use case is:
       Two workers share the same set of screens, but one of them
       has the additional role of "admin" and needs additional menu
       buttons to access additional screens. My plan is to have two layout 
       templates and dynamically set the layout template depending on
       the user's role.

My problem is:
       I was able to set the layout template from my "LoginUser.java" by
       calling "data.setLayoutTemplate()". However, every time I call 
       "data.setScreenTemplate()", the layout template got reset back to 
       the default one.

My questions is:
       If I have the plan that makes Turbine-sense, anybody has 
       suggestions/sample-code to show me how to do this?

Thanks in advance,

Joe
       

Re: Stuck. Need help on Rundata.setLayoutTemplate()

Posted by "Henning P. Schmiedehausen" <hp...@intermeta.de>.
Joechen2000@aol.com writes:

>--part1_d3.19abe56f.2b9e62d6_boundary
>Content-Type: text/plain; charset="US-ASCII"
>Content-Transfer-Encoding: 7bit

>How do I dynamically change the layout template in Turbine according to the 
>current user role in a servlet session?

>My use case is:
>       Two workers share the same set of screens, but one of them
>       has the additional role of "admin" and needs additional menu
>       buttons to access additional screens. My plan is to have two layout 
>       templates and dynamically set the layout template depending on
>       the user's role.

>My problem is:
>       I was able to set the layout template from my "LoginUser.java" by
>       calling "data.setLayoutTemplate()". However, every time I call 
>       "data.setScreenTemplate()", the layout template got reset back to 
>       the default one.

much easier: Use a navigation template which checks an user role by

#if ($user.getAcl().hasPermission())
  ... admin menu ...
#end

I'd still consider the back changing of the layout a bug. Can you send
me a small code snippet so I can check?

	Regards
		Henning

-- 
Dipl.-Inf. (Univ.) Henning P. Schmiedehausen          INTERMETA GmbH
hps@intermeta.de        +49 9131 50 654 0   http://www.intermeta.de/

Java, perl, Solaris, Linux, xSP Consulting, Web Services 
freelance consultant -- Jakarta Turbine Development  -- hero for hire

---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


Re: Stuck. Need help on Rundata.setLayoutTemplate()

Posted by Matt Hughes <mh...@ucalgary.ca>.

> How do I dynamically change the layout template in Turbine according to the
> current user role in a servlet session?

Why not use one template for both and put a variable in the context
indicating if the additional access should be displayed? Then you don't
have to maintain two seperate template files....

>
> My use case is:
>        Two workers share the same set of screens, but one of them
>        has the additional role of "admin" and needs additional menu
>        buttons to access additional screens. My plan is to have two layout
>        templates and dynamically set the layout template depending on
>        the user's role.
>
> My problem is:
>        I was able to set the layout template from my "LoginUser.java" by
>        calling "data.setLayoutTemplate()". However, every time I call
>        "data.setScreenTemplate()", the layout template got reset back to
>        the default one.
>
> My questions is:
>        If I have the plan that makes Turbine-sense, anybody has
>        suggestions/sample-code to show me how to do this?
>
> Thanks in advance,
>
> Joe
>
>


---------------------------------------------------------------------
To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org