Re: Help with editing portlet_navigation in plone 2.1

classic Classic list List threaded Threaded
2 messages Options
Eric Banford Eric Banford
Reply | Threaded
Open this post in threaded view
|

Re: Help with editing portlet_navigation in plone 2.1

At 01:29 PM 10/13/2005, Nathan Addy wrote:

>I am currently attempting to edit my portlet_navigation so that only the
>contents of the parent folder and below are listed.  For example, if the
>user is at home->section1->subsection1- >page1, I would like the
>navigation portal to display only subsection1 and its contents.  First, I
>glanced at navtree_properties, but I couldn't find any options that did
>what I wanted.  Obviously, if I have overlooked something here, that would
>be the best way.  After that, I've been looking at portlet_navigation.pt
>and it seems like there are two lines that ultimately control how the the
>file tree is displayed.
>
>1.  tal:define="data python:here.plone_utils.createNavTree(here,
>sitemap=None);"
>2. <li tal:replace="structure
>python:here.portlet_navtree_macro(children=data.get('children', [ ]),
>level=1, show_children=True, isNaviTree=True)">

Hi Nathan (and list),
My client is asking for something similar, to show navigation specific to
the folder that you are in. And I came to the same conclusion as you, that
the code above holds the key. But I'm also not sure how to do it, so if
anyone can help, it would be greatly appreciated!

I see that the http://www.oxfamamerica.org/ site does something similar
with their navigation. Maybe someone from enfoldsystems can share how they
solved that problem?

Thanks,
Eric



-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Plone-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users
Dave Zoltok Dave Zoltok
Reply | Threaded
Open this post in threaded view
|

Re: Help with editing portlet_navigation in plone 2.1

Here we go!

The navigation tree is stored as a recursive data structure.  Each
element stores information about itself and a list of its children;
each of those children contains the same information about itself and
a list of its own children, and so on.  putils.createNavTree() passes
back the element corresponding to the root, which contains all
necessary information about the sub folders.  To do what you're
describing, you'd have to pass back the element corresponding to the
current item instead of the portal root.

1 - Check the PloneTool.py code to see where it returns
result[portalpath], and change that to result[currentPath].  This will
ensure you only get the parts of the tree from the current object down

2 - Modify portlet_navigation.pt so that instead of printing the Home
link, it prints the root of the tree.  The best way to do that is to
replace this line:
<li tal:replace="structure
python:here.portlet_navtree_macro(children=data.get('children', []),
level=1, show_children=True, isNaviTree=True)">
with this line:
<li tal:replace="structure
python:here.portlet_navtree_macro(children=[data], level=1,
show_children=True, isNaviTree=True)">
Instead of passing the children of the root into the navigation tree,
you pass in the current item as a list.  This way you get the Home
link at the top, and the current item right below it.  If you want to
hide the Home link, go to portal_properties/navtree_properties and
uncheck includeTop.

Dave


On 10/21/05, Eric Banford <[hidden email]> wrote:

> At 01:29 PM 10/13/2005, Nathan Addy wrote:
> >I am currently attempting to edit my portlet_navigation so that only the
> >contents of the parent folder and below are listed.  For example, if the
> >user is at home->section1->subsection1- >page1, I would like the
> >navigation portal to display only subsection1 and its contents.  First, I
> >glanced at navtree_properties, but I couldn't find any options that did
> >what I wanted.  Obviously, if I have overlooked something here, that would
> >be the best way.  After that, I've been looking at portlet_navigation.pt
> >and it seems like there are two lines that ultimately control how the the
> >file tree is displayed.
> >
> >1.  tal:define="data python:here.plone_utils.createNavTree(here,
> >sitemap=None);"
> >2. <li tal:replace="structure
> >python:here.portlet_navtree_macro(children=data.get('children', [ ]),
> >level=1, show_children=True, isNaviTree=True)">
>
> Hi Nathan (and list),
> My client is asking for something similar, to show navigation specific to
> the folder that you are in. And I came to the same conclusion as you, that
> the code above holds the key. But I'm also not sure how to do it, so if
> anyone can help, it would be greatly appreciated!
>
> I see that the http://www.oxfamamerica.org/ site does something similar
> with their navigation. Maybe someone from enfoldsystems can share how they
> solved that problem?
>
> Thanks,
> Eric
>
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by:
> Power Architecture Resource Center: Free content, downloads, discussions,
> and more. http://solutions.newsforge.com/ibmarch.tmpl
> _______________________________________________
> Plone-users mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/plone-users
>


-------------------------------------------------------
This SF.Net email is sponsored by:
Power Architecture Resource Center: Free content, downloads, discussions,
and more. http://solutions.newsforge.com/ibmarch.tmpl
_______________________________________________
Plone-users mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/plone-users