forrest-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Thorsten Scherler (JIRA)" <>
Subject [jira] Commented: (FOR-203) 2nd level tabs are not selected appropriately
Date Wed, 28 Jun 2006 11:04:30 GMT
    [ ] 

Thorsten Scherler commented on FOR-203:

Gavin commented on FOR-203:
> ---------------------------
> I have tested the attachment now, and I still feel this is a user or documentation error
- or can someone tell me if this feature is required.
> I mean, why have (using the above example) the bug-demo in a different directory ?
> If you want it to belong in the 'Samples' tab and on the Samples part of the site navigation,

> then it makes sense to have the file(s) in the /samples/* directory.
> Or, if it really has to be separate, have it as a subdir such as /samples/bug-demo/
> (or create another tab for it)
This limits the usage of the 2nd level tabs. Imagine you have a flat document store (like
a database) then the directory structure is not helping at all to determine whether the document
is the same url base as the 2nd level tab.

> I dont think it is wrong that this does not work when trying to link a Samples menu item
to a directory
> that is outside of the samples directory tree.
see above.

> Can someone else look and give thier opinion, so this can be resolved/closed.
The following code is taken from tab-to-menu.xsl from the common skin:
<xsl:template match="tab" mode="level2">
      <xsl:when test="@id and @id = $matching-id">
        <xsl:call-template name="level2-selected"/>
      <xsl:when test="@dir = $level2-longest-dir">
        <xsl:call-template name="level2-selected"/>
        <xsl:call-template name="level2-not-selected"/>
<!-- Called from tabs, after it has written the outer 'div class=tabs' and
  any other HTML -->
  <xsl:template name="level2tabs">
    <xsl:call-template name="level2-pre-separator"/>
    <xsl:for-each select="tab[@dir=$longest-dir]/tab|tab[@href=$longest-dir]/tab">
      <xsl:if test="position()!=1"><xsl:call-template name="level2-separator"/></xsl:if>
      <xsl:apply-templates select="." mode="level2"/>
    <xsl:call-template name="level2-post-separator"/>

The problem producing this bug is that we do not actually compare the request but the site.xml.
The request is http://localhost:8888/bug-sample/index.html having in site.xml:
<samples label="Samples" href="samples/" tab="samples">
 <bug-FOR-111 label="BUG DEMO" href="../bug-sample/index.html"/>

To fix this "bug" one need to change the architecture of the tab generation.

See the tabutils.xsl of the common skin.

    The longest path of any level 2 tab, whose path is a subset of the current URL.  Ie,
    the path of the 'current' tab.
  <xsl:template name="level2-longest-dir">
    <xsl:param name="tabfile"/>
    <xsl:for-each select="$tabfile/tabs/tab/tab[starts-with($path, @dir|@href)]">
      <xsl:sort select="string-length(@dir|@href)"
        data-type="number" order="descending"/>
      <xsl:if test="position()=1">
        <xsl:value-of select="@dir|@href"/>

When you add to the following to the tab.xml
<tab id="samples-workaround" label="Samples" dir="bug-sample" indexfile="index.html">
    <tab id="samples-workaround-index" label="Index" dir="samples" indexfile="index.html"/>
    <tab id="samples-workaround-sample2" label="Sample2" dir="samples" indexfile="sample2.html"/>

You will see the second level tabs appearing again demonstrating what Lorenz described in
the initial comment.

Meaning for the solution one can try to change (tabutils.xsl)
<xsl:for-each select="$tabfile/tabs/tab/tab[starts-with($path, @dir|@href)]"/>

and tab-to-menu.xsl
<xsl:for-each select="tab[@dir=$longest-dir]/tab|tab[@href=$longest-dir]/tab"/>

...but I consider the whole issue as feature more then as bug.

> 2nd level tabs are not selected appropriately
> ---------------------------------------------
>          Key: FOR-203
>          URL:
>      Project: Forrest
>         Type: Bug

>   Components: Skins (general issues)
>     Versions: 0.6
>     Reporter: Lorenz Froihofer
>      Fix For: 0.8-dev
>  Attachments: bug-demo.tgz
> The 2nd level tabs are not shown for menu entries that caused the issue FOR-111. This
happens because the starts-with() path comparison fails for menu entries that do not reside
the same directory as is specified in the "dir" attribute of the 2nd level tabs.
> See the attached bug-demo.tgz for an example. Select "Samples/Apache document" and notice
that the 2nd level tabs are shown. Now select "Samples/BUG DEMO" and notice that the 2nd level
tabs are not shown.
> This is because the document corresponding to "Samples/Apache document" resides in the
directory "/samples" whereas the document corresponding to "Samples/BUG DEMO" resides in the
directory "/bug-sample".
> Kind regards,
>   Lorenz Froihofer.

This message is automatically generated by JIRA.
If you think it was sent incorrectly contact one of the administrators:
For more information on JIRA, see:

View raw message