You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by Marshall Roch <ma...@exclupen.com> on 2003/11/29 02:59:00 UTC

Flat navigation

Hi,

I've checked the list archives as best I could, but couldn't find 
anything on this issue.  I apologize in advance in case this has been 
asked before and I missed it.

I'm looking for a way to create "flat" navigation in the left menu.  I 
think this is best explained through example (bold means the selected tab):

Tabs: Home | *Samples* | Community | How-Tos

Menu:
- Apache document (/samples/apache.html)
- Static content (/samples/static.html)
- Wiki page (/samples/wiki.html)
- ihtml page (/samples/ihtml.html)
- ehtml page (/samples/ehtml.html)
- FAQ (/samples/faq.html)
- Simplified Docbook (/samples/docbook.html)
- Subdir <--- THIS WOULD BECOME A LINK TO /samples/subdir/index.html
--- Index <--- THIS WOULD NOT BE SHOWN AT ALL
--- File 2 <--- THIS WOULD NOT BE SHOWN AT ALL

I'm guessing this is just an XSL thing, but I don't know that much about 
it to figure it out.  Hopefully, someone can help me out. Thanks!

--
Marshall Roch



Re: Flat navigation

Posted by Robert Koberg <ro...@koberg.com>.
Hi,

Nicola Ken Barozzi wrote:

> Marshall Roch wrote:
> 
>> Jason End wrote:
>>
>>> For flat links, just put the inside a single "subtag"
>>> of <site>...</site>. Subdirs are only created if you
>>> nest more than one set of tagged entries within
>>> another. 
>>
>>
>> Right, but if I want to use subdirectories without having them in the 
>> nav until you click on their folder, how would I do that?
> 
> 
> I understand what you mean.
> 
> It's one of the things that IMHO should be done by Forrest, and I had 
> also taked about it... well... months ago (which makes me think that I 
> should do more and talk less ;-)
> 
> Please enter a request for enhancement in the Forrest JIRA and assign it 
> to me. If for some reason JIRA doesn't make you assign people, send the 
> id of the "bug" here so I will assign myself to it.
> 

This is one of the reasons (as I have explained in the past, I believe) 
the site.xml should use generic names and IDs as opposed to unique 
element names. It is also useful to provide some metadata attributes as 
well.

When using a name like 'folder' you can use an XSL like (check the 
inline comments for more explanation):

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" 
xmlns:xsl="http://www.w3.org/1999/XSL/Transform">

   <!-- Start the nav by using the current view's parent folder -->
   <xsl:template name="nav">
     <div id="nav">
       <div class="title">In this section:</div>
       <xsl:apply-templates mode="nav" select="key('site', 
$lsb_folder_id)/*"/>
     </div>
   </xsl:template>

   <xsl:template match="regions | title | label" mode="nav"/>

   <xsl:template match="folder" mode="nav">

   <!-- determine whether this folder should show on the nav -->

     <xsl:if test="@onnav='1'">
       <xsl:variable name="_href">
         <xsl:call-template name="folder_path_builder"/>
       </xsl:variable>
       <xsl:variable name="title">
         <xsl:value-of select="title"/>
       </xsl:variable>
       <xsl:choose>

       <!-- should this folder expand it's contents on the nav? -->

         <xsl:when test="@expand='1'">
           <div class="normal" title="{$title}">
             <div class="expandedFolder">
               <xsl:value-of select="label"/>
             </div>
             <div class="expanded">
               <xsl:apply-templates mode="nav" select="*"/>
             </div>
           </div>
         </xsl:when>

         <!-- if not expanded and not a descendant of the current view's 
parent folder,
         show a link to the folder (actually, the index page) -->

         <xsl:when test="not(@id=$folder_idref or 
descendant::*[@id=$folder_idref])">
           <div class="normal" title="{$title}">
             <a href="{$_href}" title="{$title}">
               <img alt="Links to a section" src="{$relative_path}i/f.gif"/>
               <xsl:value-of select="label"/>
             </a>
           </div>
         </xsl:when>
         <xsl:otherwise>
           <div class="selected">
             <a href="{$_href}" title="{$title}">
               <xsl:text>&#160;&#187;&#160;</xsl:text>
               <xsl:value-of select="label"/>
             </a>
           </div>
         </xsl:otherwise>
       </xsl:choose>
     </xsl:if>
   </xsl:template>

   <xsl:template match="page" mode="nav">

   <!-- determine whether to include this page in the nav
   based on the onnav attribute and if this page is ready to be 
generated -->

     <xsl:if test="@onnav='1' and @generate='1'">
       <xsl:variable name="id" select="@id"/>
       <xsl:variable name="_href">
         <xsl:call-template name="page_path_builder"/>
       </xsl:variable>
       <xsl:variable name="title">
         <xsl:value-of select="title"/>
       </xsl:variable>
       <xsl:choose>

       <!-- determine if this page is the focus view -->

         <xsl:when test="not($id=$page_idref)">
           <div class="normal">
             <a href="{$_href}" title="{$title}">
               <img alt="Links to a page" src="{$relative_path}i/p.gif"/>
               <xsl:value-of select="label"/>
             </a>
           </div>
         </xsl:when>
         <xsl:otherwise>
           <div class="selected">
             <a href="{$_href}" title="{$title}">
               <xsl:text>&#160;&#187;&#160;</xsl:text>
               <xsl:value-of select="label"/>
             </a>
           </div>
         </xsl:otherwise>
       </xsl:choose>
     </xsl:if>
   </xsl:template>

</xsl:stylesheet>



Re: Flat navigation

Posted by Juan Jose Pablos <ch...@che-che.com>.
Marshall Roch wrote:

> Nicola Ken Barozzi wrote:
>
>> Please enter a request for enhancement in the Forrest JIRA and assign 
>> it to me. If for some reason JIRA doesn't make you assign people, 
>> send the id of the "bug" here so I will assign myself to it.
>
>
> http://issues.cocoondev.org/jira/secure/ViewIssue.jspa?key=FOR-91
>
> I saw no way to change the assignee. :-/
>

done for you



Re: Flat navigation

Posted by Marshall Roch <ma...@exclupen.com>.
Nicola Ken Barozzi wrote:
> Please enter a request for enhancement in the Forrest JIRA and assign it 
> to me. If for some reason JIRA doesn't make you assign people, send the 
> id of the "bug" here so I will assign myself to it.

http://issues.cocoondev.org/jira/secure/ViewIssue.jspa?key=FOR-91

I saw no way to change the assignee. :-/

--
Marshall Roch




Re: Flat navigation

Posted by Nicola Ken Barozzi <ni...@apache.org>.
Marshall Roch wrote:

> Jason End wrote:
> 
>> For flat links, just put the inside a single "subtag"
>> of <site>...</site>. Subdirs are only created if you
>> nest more than one set of tagged entries within
>> another. 
> 
> Right, but if I want to use subdirectories without having them in the 
> nav until you click on their folder, how would I do that?

I understand what you mean.

It's one of the things that IMHO should be done by Forrest, and I had 
also taked about it... well... months ago (which makes me think that I 
should do more and talk less ;-)

Please enter a request for enhancement in the Forrest JIRA and assign it 
to me. If for some reason JIRA doesn't make you assign people, send the 
id of the "bug" here so I will assign myself to it.

-- 
Nicola Ken Barozzi                   nicolaken@apache.org
             - verba volant, scripta manent -
    (discussions get forgotten, just code remains)
---------------------------------------------------------------------


Re: Flat navigation

Posted by Marshall Roch <ma...@exclupen.com>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Jason End wrote:
| I still don't understand what you want. You can make
| links to subdirectories (href="subdir/") but where do
| you want the content links to show up?

Sorry for still being unclear.

I think a good way to think about this is like you would as you click
through directories in Windows' My Computer (there is no directory tree
here, only icons).

When you first open it, you see the root directory of your site.  You
see files and the icons for any folders.  You don't see any of the files
inside those folders.

Next, you click on a folder.  Now, you see the files and folders in this
directory, but not anything in the folders it contains, or from the
folder you just came from.

Does this make more sense?  If not, don't hesitate to shout; the more I
clarify this, the easier it will be to write coherent docs for the next
site maintainer.

- --
Marshall Roch
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.3 (GNU/Linux)
Comment: Using GnuPG with Thunderbird - http://enigmail.mozdev.org

iD8DBQE/ymBp2HnL88P8ZgkRAjkfAKCj2rC1rjBB2QTTwdu7fqTKi7PUKwCgjq51
+bOvrSr+8cZxvJHrruVQUac=
=zN+k
-----END PGP SIGNATURE-----


Re: Flat navigation

Posted by Jason End <be...@yahoo.com>.
--- Marshall Roch <ma...@exclupen.com> wrote:

> The default Forrest navigation makes nested lists
> with the 
> subdirectories and their contents.  I want to turn
> off the "contents" 
> part so it just makes links to the directories.
> 

I still don't understand what you want. You can make
links to subdirectories (href="subdir/") but where do
you want the content links to show up?

Perhaps a solution would be to make links to the index
files of each tab. Take the Forrest site, for e.g., in
their "Home" tab, they could add a link to the
"Community tab" index, which would take you to the
tab, with its own menu of contents.
Have you looked at Menus and Linking section? You
might find the solution there or at least be able to
better describe what you want.
http://xml.apache.org/forrest/linking.html

Jay


__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree

Re: Flat navigation

Posted by Marshall Roch <ma...@exclupen.com>.
Jason End wrote:
> For flat links, just put the inside a single "subtag"
> of <site>...</site>. Subdirs are only created if you
> nest more than one set of tagged entries within
> another. 

Right, but if I want to use subdirectories without having them in the 
nav until you click on their folder, how would I do that?

I seem to have solved this with book.xml, but if it's possible to do 
automatically w/ the XSL, that'd be great.  If not, it's not a huge 
show-stopper anymore.

Sorry if this is still confusing... makes me think that if I can't 
explain it well, my users probably can't figure it out either, which 
isn't a good thing. :)

Using Samples as an example again, let's say that on 
/samples/index.html, I have the following (inside parenthesis = link 
target):

- Apache document (/samples/apache.html)
- Static content (/samples/static.html)
- Wiki page (/samples/wiki.html)
- Subdir (/samples/subdir/index.html)

Then you click on "Subdir" and the navigation changes to:

- Sub page 1 (/samples/subdir/subpage1.html)
- Sub page 2 (/samples/subdir/subpage2.html)
- Sub subdir (/samples/subdir/subsubdir/index.html)
- Sub page 3 (/samples/subdir/subpage3.html)

The default Forrest navigation makes nested lists with the 
subdirectories and their contents.  I want to turn off the "contents" 
part so it just makes links to the directories.

--
Marshall Roch


Re: Flat navigation

Posted by Jason End <be...@yahoo.com>.
I not sure I completely understand what you're looking
for. If the "subdir" part you're only gripe? It's just
an example of an option you can use, but you don't
have to use it. 
For flat links, just put the inside a single "subtag"
of <site>...</site>. Subdirs are only created if you
nest more than one set of tagged entries within
another. 
Anyway, just eliminate the subdir references in
site.xml and enter the links just like the others.

Hope you undestand that, let me know if not.

Jay

--- Marshall Roch <ma...@exclupen.com> wrote:
> Hi,
> 
> I've checked the list archives as best I could, but
> couldn't find 
> anything on this issue.  I apologize in advance in
> case this has been 
> asked before and I missed it.
> 
> I'm looking for a way to create "flat" navigation in
> the left menu.  I 
> think this is best explained through example (bold
> means the selected tab):
> 
> Tabs: Home | *Samples* | Community | How-Tos
> 
> Menu:
> - Apache document (/samples/apache.html)
> - Static content (/samples/static.html)
> - Wiki page (/samples/wiki.html)
> - ihtml page (/samples/ihtml.html)
> - ehtml page (/samples/ehtml.html)
> - FAQ (/samples/faq.html)
> - Simplified Docbook (/samples/docbook.html)
> - Subdir <--- THIS WOULD BECOME A LINK TO
> /samples/subdir/index.html
> --- Index <--- THIS WOULD NOT BE SHOWN AT ALL
> --- File 2 <--- THIS WOULD NOT BE SHOWN AT ALL
> 
> I'm guessing this is just an XSL thing, but I don't
> know that much about 
> it to figure it out.  Hopefully, someone can help me
> out. Thanks!
> 
> --
> Marshall Roch
> 
> 


__________________________________
Do you Yahoo!?
Protect your identity with Yahoo! Mail AddressGuard
http://antispam.yahoo.com/whatsnewfree