You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@turbine.apache.org by Jason Grant <ja...@logular.com> on 2001/08/06 01:42:30 UTC

Layout only found when a screen class is defined?

I've just discovered why my Layout templates were not being found, but do 
not understand the fix, and was hoping that someone could explain.

After adding a screen template Jason.vm and a layout template Jason.vm to 
the TDK2.1 sample app, I found that the Default.vm layout was still being 
used when I accessed the page with a URL like

http://localhost:8080/turbine/newapp/turbine/template/Jason.vm

I've subsequently found that, once a Jason.java SecureScreen derivative 
is added to my modules.screens package, the new Layout is found.

On reading the Turbine code, I couldn't see why this is so.  I also don't 
understand this requirement in functional terms.

Enlightenment appreciated.

J.




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


Re: Layout only found when a screen class is defined?

Posted by Jason Grant <ja...@logular.com>.
No, no mods were done to SecureScreen.

>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<

On 8/7/01, 7:34:11 PM, "Andrea Papotti" <bi...@ettelematica.it> wrote 
regarding Re: Layout only found when a screen class is defined?:


> ----- Original Message -----
> From: "Jason Grant" <ja...@logular.com>
> To: <tu...@jakarta.apache.org>
> Sent: Tuesday, August 07, 2001 9:29 AM
> Subject: Re: Layout only found when a screen class is defined?


> > No responses to the initial post - hope it made sense.
> >
> > The essence is, why is a screen class required before the corresponding
> > layout template is used?  Bug or feature?
> >

> I had the same problem after I had modified SecureScreen.java to use my 
own
> authentication algorithm (which alerts me if a page have no explicit
> authentication behaviour) .

> Did you have modified it too?

> Before modifications (i.e. with SecureScreen.java as come form exemple 
app.)
> .vm files without correspondig .java were displayed correctly.

> Maybe .vm files with no corresponding .java will need an implicit
> authentication by SecureScreen.java

> Hope is useful,
> Andrea


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

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


Re: Layout only found when a screen class is defined?

Posted by Andrea Papotti <bi...@ettelematica.it>.
----- Original Message -----
From: "Jason Grant" <ja...@logular.com>
To: <tu...@jakarta.apache.org>
Sent: Tuesday, August 07, 2001 9:29 AM
Subject: Re: Layout only found when a screen class is defined?


> No responses to the initial post - hope it made sense.
>
> The essence is, why is a screen class required before the corresponding
> layout template is used?  Bug or feature?
>

I had the same problem after I had modified SecureScreen.java to use my own
authentication algorithm (which alerts me if a page have no explicit
authentication behaviour) .

Did you have modified it too?

Before modifications (i.e. with SecureScreen.java as come form exemple app.)
.vm files without correspondig .java were displayed correctly.

Maybe .vm files with no corresponding .java will need an implicit
authentication by SecureScreen.java

Hope is useful,
Andrea


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


Re: global contexts

Posted by Jason van Zyl <jv...@apache.org>.
On 8/19/01 4:36 AM, "Emile Kok" <em...@toughguy.net> wrote:

> 2 questions:
> 
> 1.  need to add current username to select criteria (I have username stored
> in my table and need only curr user records)
> 
> 2.  can someone point me to the doc which describes the global contexts
> that exist for templates to use (if it exists)?  What I mean by global
> context is, as an example, the $ui object.  If a doc doesn't exist, can
> someone please give me a list and suggest where I can get a property list.

The tools available in the global context are configurable using the
PullService configuration in the TurbineResources.properties file. You can
put whatever you like into the global context. Just look for $ui in the TRP
and you will see where everything is setup.
 
> thanks guys
> Emile
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@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: turbine-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: turbine-user-help@jakarta.apache.org


global contexts

Posted by Emile Kok <em...@toughguy.net>.
2 questions:

1.  need to add current username to select criteria (I have username stored 
in my table and need only curr user records)

2.  can someone point me to the doc which describes the global contexts 
that exist for templates to use (if it exists)?  What I mean by global 
context is, as an example, the $ui object.  If a doc doesn't exist, can 
someone please give me a list and suggest where I can get a property list.

thanks guys
Emile



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


Re: Re Layout only found when a screen class is defined@5.sdm

Posted by Jason Grant <ja...@logular.com>.
I now understand why the sample app fails to find layout templates unless 
a custom screen class is defined.

If no screen class exists, then turbine finds the screen:

	o.a.t.flux.modules.screens.Default

This class has a doBuildTempate() method which calls isAuthorized().  It 
includes the following code, which overwrites the layout template.

        if 
(TurbineResources.getString("flux.mode").equalsIgnoreCase("embedded"))
        {
            data.getTemplateInfo().setLayoutTemplate(
                TurbineResources.getString("flux.embedded.layout"));
        }

I suspect that the fix is for the sample app to include a 
com.appname.modules.screens.Default screen class that extends 
VelocitySecureScreen?  This way, it will be found before the flux 
Default, and so the layout template will not be overwritten.

If folk agree, I'm happy to try and patch the construction of the sample 
app.

J.

>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<

On 8/8/01, 1:24:28 AM, John McNally <jm...@collab.net> wrote regarding 
Re Layout only found when a screen class is defined@5.sdm:


> It should not be necessary to define the screen class to get the layout
> you want.  If it is, then this is a bug.  If you care to help solve it,
> look at the TemplateService.  Otherwise submit a bug report.

> john mcnally

> Jason Grant wrote:
> >
> > No responses to the initial post - hope it made sense.
> >
> > The essence is, why is a screen class required before the corresponding
> > layout template is used?  Bug or feature?
> >
> > J.
> >
> > >>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<
> >
> > On 8/6/01, 9:42:30 AM, Jason Grant <ja...@logular.com> wrote
> > regarding Layout only found when a screen class is defined?:
> >
> > > I've just discovered why my Layout templates were not being found, but do
> > > not understand the fix, and was hoping that someone could explain.
> >
> > > After adding a screen template Jason.vm and a layout template Jason.vm to
> > > the TDK2.1 sample app, I found that the Default.vm layout was still being
> > > used when I accessed the page with a URL like
> >
> > > http://localhost:8080/turbine/newapp/turbine/template/Jason.vm
> >
> > > I've subsequently found that, once a Jason.java SecureScreen derivative
> > > is added to my modules.screens package, the new Layout is found.
> >
> > > On reading the Turbine code, I couldn't see why this is so.  I also don't
> > > understand this requirement in functional terms.
> >
> > > Enlightenment appreciated.
> >
> > > J.
> >
> > > ---------------------------------------------------------------------
> > > To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> > > For additional commands, e-mail: turbine-user-help@jakarta.apache.org
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: turbine-user-help@jakarta.apache.org

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

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


Re: Layout only found when a screen class is defined?

Posted by John McNally <jm...@collab.net>.
It should not be necessary to define the screen class to get the layout
you want.  If it is, then this is a bug.  If you care to help solve it,
look at the TemplateService.  Otherwise submit a bug report.

john mcnally

Jason Grant wrote:
> 
> No responses to the initial post - hope it made sense.
> 
> The essence is, why is a screen class required before the corresponding
> layout template is used?  Bug or feature?
> 
> J.
> 
> >>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<
> 
> On 8/6/01, 9:42:30 AM, Jason Grant <ja...@logular.com> wrote
> regarding Layout only found when a screen class is defined?:
> 
> > I've just discovered why my Layout templates were not being found, but do
> > not understand the fix, and was hoping that someone could explain.
> 
> > After adding a screen template Jason.vm and a layout template Jason.vm to
> > the TDK2.1 sample app, I found that the Default.vm layout was still being
> > used when I accessed the page with a URL like
> 
> > http://localhost:8080/turbine/newapp/turbine/template/Jason.vm
> 
> > I've subsequently found that, once a Jason.java SecureScreen derivative
> > is added to my modules.screens package, the new Layout is found.
> 
> > On reading the Turbine code, I couldn't see why this is so.  I also don't
> > understand this requirement in functional terms.
> 
> > Enlightenment appreciated.
> 
> > J.
> 
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: turbine-user-help@jakarta.apache.org
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: turbine-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: turbine-user-help@jakarta.apache.org

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


Re: Layout only found when a screen class is defined?

Posted by Jason Grant <ja...@logular.com>.
Thanks Kasper, but my initial message was written because the behaviour I 
described contradicts that in velocity-site-howto.html.  i.e. Shouldn't 
the Jason.vm layout template be used in the absence of a Jason screen 
class?  I don't think the doco states that this is necessary...


>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<

On 8/7/01, 7:26:20 PM, "Kasper Nielsen" <ne...@kav.dk> wrote regarding Re: 
Layout only found when a screen class is defined?:


> Hi Jason,

> have you read
> http://jakarta.apache.org/turbine/howto/velocity-site-howto.html ?

> - Kasper
> ----- Original Message -----
> From: "Jason Grant" <ja...@logular.com>
> To: <tu...@jakarta.apache.org>
> Sent: Tuesday, August 07, 2001 9:29 AM
> Subject: Re: Layout only found when a screen class is defined?


> No responses to the initial post - hope it made sense.

> The essence is, why is a screen class required before the corresponding
> layout template is used?  Bug or feature?

> J.

> >>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<

> On 8/6/01, 9:42:30 AM, Jason Grant <ja...@logular.com> wrote
> regarding Layout only found when a screen class is defined?:


> > I've just discovered why my Layout templates were not being found, but do
> > not understand the fix, and was hoping that someone could explain.

> > After adding a screen template Jason.vm and a layout template Jason.vm to
> > the TDK2.1 sample app, I found that the Default.vm layout was still being
> > used when I accessed the page with a URL like

> > http://localhost:8080/turbine/newapp/turbine/template/Jason.vm

> > I've subsequently found that, once a Jason.java SecureScreen derivative
> > is added to my modules.screens package, the new Layout is found.

> > On reading the Turbine code, I couldn't see why this is so.  I also don't
> > understand this requirement in functional terms.

> > Enlightenment appreciated.

> > J.




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

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

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


Re: Layout only found when a screen class is defined?

Posted by Kasper Nielsen <ne...@kav.dk>.
Hi Jason,

have you read
http://jakarta.apache.org/turbine/howto/velocity-site-howto.html ?

- Kasper
----- Original Message -----
From: "Jason Grant" <ja...@logular.com>
To: <tu...@jakarta.apache.org>
Sent: Tuesday, August 07, 2001 9:29 AM
Subject: Re: Layout only found when a screen class is defined?


No responses to the initial post - hope it made sense.

The essence is, why is a screen class required before the corresponding
layout template is used?  Bug or feature?

J.

>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<

On 8/6/01, 9:42:30 AM, Jason Grant <ja...@logular.com> wrote
regarding Layout only found when a screen class is defined?:


> I've just discovered why my Layout templates were not being found, but do
> not understand the fix, and was hoping that someone could explain.

> After adding a screen template Jason.vm and a layout template Jason.vm to
> the TDK2.1 sample app, I found that the Default.vm layout was still being
> used when I accessed the page with a URL like

> http://localhost:8080/turbine/newapp/turbine/template/Jason.vm

> I've subsequently found that, once a Jason.java SecureScreen derivative
> is added to my modules.screens package, the new Layout is found.

> On reading the Turbine code, I couldn't see why this is so.  I also don't
> understand this requirement in functional terms.

> Enlightenment appreciated.

> J.




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

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




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


Re: Layout only found when a screen class is defined?

Posted by Jason Grant <ja...@logular.com>.
No responses to the initial post - hope it made sense.

The essence is, why is a screen class required before the corresponding 
layout template is used?  Bug or feature?

J.

>>>>>>>>>>>>>>>>>> Original Message <<<<<<<<<<<<<<<<<<

On 8/6/01, 9:42:30 AM, Jason Grant <ja...@logular.com> wrote 
regarding Layout only found when a screen class is defined?:


> I've just discovered why my Layout templates were not being found, but do
> not understand the fix, and was hoping that someone could explain.

> After adding a screen template Jason.vm and a layout template Jason.vm to
> the TDK2.1 sample app, I found that the Default.vm layout was still being
> used when I accessed the page with a URL like

> http://localhost:8080/turbine/newapp/turbine/template/Jason.vm

> I've subsequently found that, once a Jason.java SecureScreen derivative
> is added to my modules.screens package, the new Layout is found.

> On reading the Turbine code, I couldn't see why this is so.  I also don't
> understand this requirement in functional terms.

> Enlightenment appreciated.

> J.




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

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


RE: Layout only found when a screen class is defined?

Posted by Finn Smith <fs...@nntllc.com>.
* Jason Grant [jason.grant@logular.com], August 05, 2001 7:43 PM
>
> I've just discovered why my Layout templates were not being found, but do
> not understand the fix, and was hoping that someone could explain.
>
> After adding a screen template Jason.vm and a layout template Jason.vm to
> the TDK2.1 sample app, I found that the Default.vm layout was still being
> used when I accessed the page with a URL like
>
> http://localhost:8080/turbine/newapp/turbine/template/Jason.vm
>
> I've subsequently found that, once a Jason.java SecureScreen derivative
> is added to my modules.screens package, the new Layout is found.
>
> On reading the Turbine code, I couldn't see why this is so.  I also don't
> understand this requirement in functional terms.
>
> Enlightenment appreciated.


Although I was also unable to find the source of this problem, perhaps this
additional information will help someone more versed in Turbine to track it
down:

If there are any of the following classes in the modules.screens package:
 - Jason.java extended from any one of SecureScreen, VelocitySecureScreen or
VelocityScreen
 - Default.java extended from any one of SecureScreen, VelocitySecureScreen
or VelocityScreen

then layouts/Jason.vm is found correctly.

Without those classes, layouts/Jason.vm is not found correctly unless you
add this line to screens/Jason.vm:

$data.setLayout("/Jason.vm")

I think that this problem is located somewhere in lines 154-171 of the
turbine.modules.pages.DefaultPage class:

        // Ask the Screen for its Layout and then execute the Layout.
        // The Screen can override the getLayout() method to re-define
        // the Layout depending on data passed in via the
        // data.parameters object.
        ScreenLoader sl = ScreenLoader.getInstance();
        Screen aScreen = sl.getInstance(data.getScreen());
        String layout = aScreen.getLayout(data);

        // If the Layout has been set to be null, attempt to execute
        // the Screen that has been defined.
        if ( layout != null )
        {
            LayoutLoader.getInstance().exec ( data, layout );
        }
        else
        {
            ScreenLoader.getInstance().exec ( data, data.getScreen() );
        }

Some experimentation determined that when screens/Jason.vm is loaded and
there is no corresponding Jason class then data.getScreen() will return
"Default". However, if there is no Default class I don't know how Turbine
determines it should use VelocityScreen (as the Velocity Site Howto
documentation claims) and I don't know what effect that would have on
aScreen.getLayout(data).

I got lost in the complicated thread of execution that occurs in the loader
and AssemblerBroker code.

Hopefully, someone who knows the loading procedure better can shed some
light on this? But as a temporary fix, you can use the
$data.setLayout("/Jason.vm") command in your screen template.

-F


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