You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Joe Terry <jo...@knowself.com> on 2001/11/01 05:03:08 UTC
Multiple Layouts for Log-In, special sections, and then of course the "default"...
Anyone have an example of subclassing "VelocityNavigation".
I need to have a layout for Log-In that is different from the layout for another section of the application, that is completely different from the "Default" layout.
I have built the Javadocs, I have the source. 2.2b1
I'm not happy with the documentation, but Turbine rocks ... If only, I can meet my deadlines ...
Cheers!
Joet
Re: Multiple Layouts for Log-In, special sections, and then ofcourse the "default"...
Posted by Joe Terry <jo...@knowself.com>.
Ok. It's working and it IS a pattern similar to JavaBeans based on name,
screen vs. layout.
The problem was that I had the "Administration.vm" screen in a subdirectory
of the "screens" directory. Once I pulled it out into the "flat" screens
directory it pulls the layout "with the same name" correctly.
That's great default behavior.
Jason, what section of code should I look at to think about making choice of
layout a little more explicit?
Joet
===============================================
----- Original Message -----
From: "Joe Terry" <jo...@knowself.com>
To: "Turbine Users List" <tu...@jakarta.apache.org>
Sent: Thursday, November 01, 2001 9:36 AM
Subject: Re: Multiple Layouts for Log-In, special sections, and then
ofcourse the "default"...
> Jason,
>
> I have the "newapp" application running and the "Login.vm" template and
> "Login.vm" layout are a part of that example. ... but ...
>
> How do I activate another layout for another template?
>
> Is it a pattern by name?
>
> I have a screen in a subdirectory of the "screens" directory and I want it
> to have a different layout. Where do I specify this?
>
> A) TurbineResources.properties by installing a subclass of
> "VelocityNavigation.java" such as ...
>
> services.VelocityService.default.navigation=JoesVelocityNavigation
>
> B) In the screen itself?
>
> Administration.java
> ...
> import org.apache.turbine.services.logging.TurbineLogging;
> ...
> protected boolean isAuthorized( RunData data ) throws Exception
> {
> boolean isAuthorized = false;
>
> AccessControlList acl = data.getACL();
>
> if (acl == null )
> {
> data.setScreenTemplate(
> TurbineResources.getString("template.login"));
>
> isAuthorized = false;
> }
> else if(acl.hasRole("turbine_root"))
> {
> isAuthorized = true;
> }
> else if(acl.hasRole("turbine_admin"))
> {
> isAuthorized = true;
> }
>
> TurbineLogging.info("\nisAuthorized = "+isAuthorized+"\n", data);
>
> if ( isAuthorized == true )
> {
> data.setScreenTemplate(
> TurbineResources.getString("template.admin_layout"));
> }
>
> return isAuthorized;
> }
>
> ====================================================
>
> Also, Jason ....
>
> The line ....
>
> TurbineLogging.info("\nisAuthorized = "+isAuthorized+"\n", data);
>
> dosen't seem to be outputting anything to Turbine.log ... Other messages
are
> going in the log, but not mine?
>
> What else should I look at?
>
> =============================
>
> Joet
> Software Sculptor
>
> =============================
>
>
> ----- Original Message -----
> From: "Jason van Zyl" <jv...@zenplex.com>
> To: "Turbine Users List" <tu...@jakarta.apache.org>
> Sent: Wednesday, October 31, 2001 9:13 PM
> Subject: Re: Multiple Layouts for Log-In, special sections, and then
> ofcourse the "default"...
>
>
> > On 10/31/01 11:03 PM, "Joe Terry" <jo...@knowself.com> wrote:
> >
> > > Anyone have an example of subclassing "VelocityNavigation".
> > >
> > > I need to have a layout for Log-In that is different from the layout
for
> > > another section of the application, that is completely different from
> the
> > > "Default" layout.
> >
> > If you have a screen template named Login.vm than make a corresponding
> > layout template called Login.vm and the two will be used together.
> >
> > > I have built the Javadocs, I have the source. 2.2b1
> > >
> > > I'm not happy with the documentation, but Turbine rocks ... If only, I
> can
> > > meet my deadlines ...
> > >
> > > Cheers!
> > >
> > > Joet
> > >
> >
> > --
> >
> > jvz.
> >
> > Jason van Zyl
> >
> > http://tambora.zenplex.org
> > http://jakarta.apache.org/turbine
> > http://jakarta.apache.org/velocity
> > http://jakarta.apache.org/alexandria
> > http://jakarta.apache.org/commons
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> >
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Multiple Layouts for Log-In, special sections, and then
ofcourse the "default"...
Posted by Jason van Zyl <jv...@zenplex.com>.
On 11/1/01 12:36 PM, "Joe Terry" <jo...@knowself.com> wrote:
> Jason,
>
> I have the "newapp" application running and the "Login.vm" template and
> "Login.vm" layout are a part of that example. ... but ...
>
> How do I activate another layout for another template?
>
> Is it a pattern by name?
By directory structure and name.
> I have a screen in a subdirectory of the "screens" directory and I want it
> to have a different layout. Where do I specify this?
screens/
chemistry/Index.vm
physics/Index.vm
layouts/
chemistry/Default.vm
physics/Default.vm
The Default.vm layout template in the layouts/chemistry directory
will be used for the screens/chemistry/Index.vm page.
You get the pattern, this is documented.
For template matching it call all be done by structure your
directories of templates correctly.
> A) TurbineResources.properties by installing a subclass of
> "VelocityNavigation.java" such as ...
>
> services.VelocityService.default.navigation=JoesVelocityNavigation
>
> B) In the screen itself?
>
> Administration.java
> ...
> import org.apache.turbine.services.logging.TurbineLogging;
> ...
> protected boolean isAuthorized( RunData data ) throws Exception
> {
> boolean isAuthorized = false;
>
> AccessControlList acl = data.getACL();
>
> if (acl == null )
> {
> data.setScreenTemplate(
> TurbineResources.getString("template.login"));
>
> isAuthorized = false;
> }
> else if(acl.hasRole("turbine_root"))
> {
> isAuthorized = true;
> }
> else if(acl.hasRole("turbine_admin"))
> {
> isAuthorized = true;
> }
>
> TurbineLogging.info("\nisAuthorized = "+isAuthorized+"\n", data);
>
> if ( isAuthorized == true )
> {
> data.setScreenTemplate(
> TurbineResources.getString("template.admin_layout"));
> }
>
> return isAuthorized;
> }
>
> ====================================================
>
> Also, Jason ....
>
> The line ....
>
> TurbineLogging.info("\nisAuthorized = "+isAuthorized+"\n", data);
>
> dosen't seem to be outputting anything to Turbine.log ... Other messages are
> going in the log, but not mine?
>
> What else should I look at?
>
> =============================
>
> Joet
> Software Sculptor
>
> =============================
>
>
> ----- Original Message -----
> From: "Jason van Zyl" <jv...@zenplex.com>
> To: "Turbine Users List" <tu...@jakarta.apache.org>
> Sent: Wednesday, October 31, 2001 9:13 PM
> Subject: Re: Multiple Layouts for Log-In, special sections, and then
> ofcourse the "default"...
>
>
>> On 10/31/01 11:03 PM, "Joe Terry" <jo...@knowself.com> wrote:
>>
>>> Anyone have an example of subclassing "VelocityNavigation".
>>>
>>> I need to have a layout for Log-In that is different from the layout for
>>> another section of the application, that is completely different from
> the
>>> "Default" layout.
>>
>> If you have a screen template named Login.vm than make a corresponding
>> layout template called Login.vm and the two will be used together.
>>
>>> I have built the Javadocs, I have the source. 2.2b1
>>>
>>> I'm not happy with the documentation, but Turbine rocks ... If only, I
> can
>>> meet my deadlines ...
>>>
>>> Cheers!
>>>
>>> Joet
>>>
>>
>> --
>>
>> jvz.
>>
>> Jason van Zyl
>>
>> http://tambora.zenplex.org
>> http://jakarta.apache.org/turbine
>> http://jakarta.apache.org/velocity
>> http://jakarta.apache.org/alexandria
>> http://jakarta.apache.org/commons
>>
>>
>>
>> --
>> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
>> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>>
>
>
>
> --
> To unsubscribe, e-mail: <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
--
jvz.
Jason van Zyl
http://tambora.zenplex.org
http://jakarta.apache.org/turbine
http://jakarta.apache.org/velocity
http://jakarta.apache.org/alexandria
http://jakarta.apache.org/commons
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Multiple Layouts for Log-In, special sections, and then ofcourse the "default"...
Posted by Joe Terry <jo...@knowself.com>.
Jason,
I have the "newapp" application running and the "Login.vm" template and
"Login.vm" layout are a part of that example. ... but ...
How do I activate another layout for another template?
Is it a pattern by name?
I have a screen in a subdirectory of the "screens" directory and I want it
to have a different layout. Where do I specify this?
A) TurbineResources.properties by installing a subclass of
"VelocityNavigation.java" such as ...
services.VelocityService.default.navigation=JoesVelocityNavigation
B) In the screen itself?
Administration.java
...
import org.apache.turbine.services.logging.TurbineLogging;
...
protected boolean isAuthorized( RunData data ) throws Exception
{
boolean isAuthorized = false;
AccessControlList acl = data.getACL();
if (acl == null )
{
data.setScreenTemplate(
TurbineResources.getString("template.login"));
isAuthorized = false;
}
else if(acl.hasRole("turbine_root"))
{
isAuthorized = true;
}
else if(acl.hasRole("turbine_admin"))
{
isAuthorized = true;
}
TurbineLogging.info("\nisAuthorized = "+isAuthorized+"\n", data);
if ( isAuthorized == true )
{
data.setScreenTemplate(
TurbineResources.getString("template.admin_layout"));
}
return isAuthorized;
}
====================================================
Also, Jason ....
The line ....
TurbineLogging.info("\nisAuthorized = "+isAuthorized+"\n", data);
dosen't seem to be outputting anything to Turbine.log ... Other messages are
going in the log, but not mine?
What else should I look at?
=============================
Joet
Software Sculptor
=============================
----- Original Message -----
From: "Jason van Zyl" <jv...@zenplex.com>
To: "Turbine Users List" <tu...@jakarta.apache.org>
Sent: Wednesday, October 31, 2001 9:13 PM
Subject: Re: Multiple Layouts for Log-In, special sections, and then
ofcourse the "default"...
> On 10/31/01 11:03 PM, "Joe Terry" <jo...@knowself.com> wrote:
>
> > Anyone have an example of subclassing "VelocityNavigation".
> >
> > I need to have a layout for Log-In that is different from the layout for
> > another section of the application, that is completely different from
the
> > "Default" layout.
>
> If you have a screen template named Login.vm than make a corresponding
> layout template called Login.vm and the two will be used together.
>
> > I have built the Javadocs, I have the source. 2.2b1
> >
> > I'm not happy with the documentation, but Turbine rocks ... If only, I
can
> > meet my deadlines ...
> >
> > Cheers!
> >
> > Joet
> >
>
> --
>
> jvz.
>
> Jason van Zyl
>
> http://tambora.zenplex.org
> http://jakarta.apache.org/turbine
> http://jakarta.apache.org/velocity
> http://jakarta.apache.org/alexandria
> http://jakarta.apache.org/commons
>
>
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>
Re: Multiple Layouts for Log-In, special sections, and then of
course the "default"...
Posted by Jason van Zyl <jv...@zenplex.com>.
On 10/31/01 11:03 PM, "Joe Terry" <jo...@knowself.com> wrote:
> Anyone have an example of subclassing "VelocityNavigation".
>
> I need to have a layout for Log-In that is different from the layout for
> another section of the application, that is completely different from the
> "Default" layout.
If you have a screen template named Login.vm than make a corresponding
layout template called Login.vm and the two will be used together.
> I have built the Javadocs, I have the source. 2.2b1
>
> I'm not happy with the documentation, but Turbine rocks ... If only, I can
> meet my deadlines ...
>
> Cheers!
>
> Joet
>
--
jvz.
Jason van Zyl
http://tambora.zenplex.org
http://jakarta.apache.org/turbine
http://jakarta.apache.org/velocity
http://jakarta.apache.org/alexandria
http://jakarta.apache.org/commons
--
To unsubscribe, e-mail: <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>