cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Carsten Ziegeler" <cziege...@s-und-n.de>
Subject RE: [portal] Tab navigation
Date Thu, 29 Jan 2004 14:50:35 GMT
Alex Romayev wrote:
>
> Hi Carsten,
>
> I'm ready for the "portal configuration hell", if you
> can lead me through it ;-)
>
To be honest, I don't know if it works, but it's worth a try :)

Ok, here is a brief description:
Creating a different tab (stateless), means creating a new renderer
for a tab. You will find this somewhere in the cocoon.xconf:
     <renderer
class="org.apache.cocoon.portal.layout.renderer.impl.AspectRenderer"
logger="portal" name="tab">
         <aspects>
             <aspect type="xslt">
                 <parameter name="style"
value="{global:skin}styles/tab.xsl"/>
             </aspect>
             <aspect type="parameter">
                 <parameter name="tag-name" value="tab-layout"/>
             </aspect>
             <aspect type="history"/>
             <aspect type="tab-content">
                 <parameter name="root-tag" value="false"/>
                 <parameter name="store" value="session"/>
             </aspect>
         </aspects>
     </renderer>
Copy this and change the name "tab" in the first line to whatever you want.
Change the "store" configuration for the "tab-content" to "request".
Now, you have to register this renderer in the layout factory:
        <layout class="org.apache.cocoon.portal.layout.impl.CompositeLayout"
name="tab">
            <renderers default="tab">
                <renderer name="tab"/>
            </renderers>
        </layout>
Add a new entry
<renderer name="YOUR NEW TAB NAME"/> inside the renderers section.

Now, you have an alternative renderer for a tab layout object.

Last thing is to use this renderer. Go into your layout.xml, to the
stateless
tab definition and configure the stateless tab to use the new renderer:
<composite-layout name="tab" id="stateless" default-renderer-name="YOUR NEW
TAB NAME">

So, in theory, this is it - if I didn't forget anything.
Now the basic idea is to say, the main tab (stateful) uses a session to
store the
state of a tab. The stateless instead uses the request (one req-res cycle)
to store
the state.
If this doesn't work, well we have to find a better solution :(

> I think stateful + stateless tab solution should work
> for me.  There is also another problem I'm having,
> which I hope will be fixed by this (but I'd like to
> check with you to make sure):
>
> On my "news" sub-tab I have "Latest News" page with
> callouts to news items, which open "News Item" page,
> by passing "news-item" coplet news-id:
>
> <cl:links>
>   "News" is the 4th tab on "maintab"
>   <cl:link layout="maintab" value="3"
> path="aspectDatas/tab"/>
>   "News Item" page is the 3rd page on "newstab"
>   <cl:link layout="newstab" value="2"
> path="aspectDatas/tab"/>
>   <cl:link coplet="news-item-1" value="{@id}"
> path="attributes/news-id"/>
>   <cl:content><xsl:value-of
> select="title"/></cl:content>
> </cl:links>
>
> This works correctly, however if I press brower "Back"
> button when on "News Item" page and click to view
> another news item on the "Latest News" page, I get the
> same news item.  However, if I navigate to "Latest
> News" page by clicking on tabs, everything works
> correctly.
>
No, this is a different issue :) The portal has a built-in
mechanism to "disable" the back button. By this the user
can't get into an undefined state.
This means, that if you use back and to any action, this
action is ignored. If you want to enabled the back-button
you simple have to remove the
        <aspect type="action-counter"/>
from the <event-aspects> configuration in the cocoon.xconf.

HTH
Carsten


Mime
View raw message