You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by Steve Masover <ma...@berkeley.edu> on 2006/08/24 22:30:25 UTC

Menu display defaults (as in FOR-339)

Forrest Developers,

I am using a modified pelt skin on a forrest site, and would prefer that 
menus are "open" by default upon entry into a tabbed pane, rather than 
closed as is the case for all but the current site in the default skin.

A more complete (and more attractive to me) option is described by Clay 
Leeds in FOR-339 (http://issues.apache.org/jira/browse/FOR-339).

I have hacked a solution to the problem I first defined for myself by 
modifying the "innermenuli" template in site2xhtml.xsl of the pelt variant 
I am maintaining, to change the way the variable "tagid" is populated in 
that template.  The code is shown below my signature.

If the variable I've called "menu-state-default" were, instead, a value 
taken from an (inheritable) attribute of nodes of site.xml, as FOR-339 
suggests, I think that this would be a much more interesting and useful 
contribution to Forrest.

However, after spending some time looking into how an attribute such as the 
one described in FOR-339 (display="none|block") might be preserved through 
the pipleline to be included in the input to site2xhtml.xsl I found myself 
in over my head.

I may be able to put some time into implementing a solution to FOR-339 but 
would need some help vis-a-vis how & by what stylesheets site.xml is 
transformed to the input to site2xhtml.xsl, and what would be an 
appropriate point to alter that pipeline.  Before putting any more time 
into it I'd also like to know whether the Forrest developers believe this 
would be a useful contribution to the project.

Thanks,

Steve Masover



+++++++++++++++++++++++++++++++++++++


   <xsl:template name="innermenuli">
     <xsl:param name="id"/>

     <!--
       Menu Default:  Open vs Closed

       if value of menu-state-default is 'open',
       all menu-sections will default to open on entering into tabbed pane;
       otherwise, user must click to open desired menu-sections
     -->
     <xsl:variable name="menu-state-default" select="'open'" />
     <xsl:variable name="tagid">
       <xsl:choose>
         <xsl:when test="$menu-state-default='open'">
           <xsl:value-of select="concat('menu_selected_',$id)"/>
         </xsl:when>
         <xsl:otherwise>
           <xsl:choose>
             <xsl:when 
test="descendant-or-self::node()/li/div/@class='current'"><xsl:value-of 
select="concat('menu_selected_',$id)"/></xsl:when>
             <xsl:otherwise><xsl:value-of 
select="concat('menu_',concat(font,$id))"/></xsl:otherwise>
           </xsl:choose>
         </xsl:otherwise>
       </xsl:choose>
     </xsl:variable>
     <!--
       original pelt skin tagid variable follows:
     -->
    <!--
     <xsl:variable name="tagid">
       <xsl:choose>
         <xsl:when 
test="descendant-or-self::node()/li/div/@class='current'"><xsl:value-of 
select="concat('menu_selected_',$id)"/></xsl:when>
         <xsl:otherwise><xsl:value-of 
select="concat('menu_',concat(font,$id))"/></xsl:otherwise>
       </xsl:choose>
     </xsl:variable>
     -->

     [...]
+++++++++++++++++++++++++++++++++++++







Re: Menu display defaults (as in FOR-339)

Posted by Thorsten Scherler <th...@wyona.com>.
El jue, 24-08-2006 a las 13:30 -0700, Steve Masover escribió:
> Forrest Developers,
> 
> I am using a modified pelt skin on a forrest site, and would prefer
> that menus are "open" by default upon entry into a tabbed pane, rather
> than closed as is the case for all but the current site in the default
> skin.

This feature is implemented in the dispatcher. Have a look at 
http://svn.apache.org/viewvc/forrest/trunk/whiteboard/plugins/org.apache.forrest.themes.core/themes/common/html/nav-section.ft?view=markup

There you find <forrest:property
name="expanding">false</forrest:property>. You will need to see how we
did it there and then apply it to your custom skin.

It is a wee bit different then in FOR-339 but it will give you an idea I
hope.

HTH

salu2

> 
> A more complete (and more attractive to me) option is described by
> Clay Leeds in FOR-339 (http://issues.apache.org/jira/browse/FOR-339).
> 
> I have hacked a solution to the problem I first defined for myself by
> modifying the "innermenuli " template in site2xhtml.xsl of the pelt
> variant I am maintaining, to change the way the variable "tagid" is
> populated in that template.  The code is shown below my signature.
> 
> If the variable I've called "menu-state-default" were, instead, a
> value taken from an (inheritable) attribute of nodes of site.xml, as
> FOR-339 suggests, I think that this would be a much more interesting
> and useful contribution to Forrest.
> 
> However, after spending some time looking into how an attribute such
> as the one described in FOR-339 (display="none|block") might be
> preserved through the pipleline to be included in the input to
> site2xhtml.xsl I found myself in over my head.  
> 
> I may be able to put some time into implementing a solution to FOR-339
> but would need some help vis-a-vis how & by what stylesheets site.xml
> is transformed to the input to site2xhtml.xsl, and what would be an
> appropriate point to alter that pipeline.  Before putting any more
> time into it I'd also like to know whether the Forrest developers
> believe this would be a useful contribution to the project.
> 
> Thanks,
> 
> Steve Masover
> 
> 
> 
> +++++++++++++++++++++++++++++++++++++
> 
> 
>  <xsl:templatename= "innermenuli" >    
>    <xsl:paramname= "id" />
>     
>    <!--
>       Menu Default:  Open vs Closed
>       
>       if value of menu-state-default is 'open', 
>       all menu-sections will default to open on entering into tabbed
> pane;
>       otherwise, user must click to open desired menu-sections
>     -->
>    <xsl:variablename= "menu-state-default" select= "'open'" />
>    <xsl:variablename= "tagid" >
>      <xsl:choose>
>        <xsl:whentest= "$menu-state-default='open'" >
>          <xsl:value-ofselect= "concat('menu_selected_',$id)" />
>        </xsl:when>
>        <xsl:otherwise>
>          <xsl:choose>
>            <xsl:whentest=
> "descendant-or-self::node()/li/div/@class='current'" > <xsl:value-of
> select= "concat('menu_selected_',$id)" /> </xsl:when>
>            <xsl:otherwise><xsl:value-of select=
> "concat('menu_',concat(font,$id))" /> </xsl:otherwise>
>          </xsl:choose>
>        </xsl:otherwise>
>      </xsl:choose>
>    </xsl:variable>
>    <!--
>       original pelt skin tagid variable follows: 
>     -->
>   <!--
>     <xsl:variable name="tagid">
>       <xsl:choose>
>         <xsl:when
> test="descendant-or-self::node()/li/div/@class='current'"><xsl:value-of select="concat('menu_selected_',$id)"/></xsl:when>
>         <xsl:otherwise><xsl:value-of
> select="concat('menu_',concat(font,$id))"/></xsl:otherwise>
>       </xsl:choose>
>     </xsl:variable>
>     -->
> 
>     [...]
> +++++++++++++++++++++++++++++++++++++
> 
> 
> 
> 
> 

-- 
Thorsten Scherler
COO Spain
Wyona Inc.  -  Open Source Content Management  -  Apache Lenya
http://www.wyona.com                   http://lenya.apache.org
thorsten.scherler@wyona.com                thorsten@apache.org