[Zope-CMF] Question about portal_actions (plone)

Juan Pablo Romero jpablo@kan.ajusco.upn.mx
Mon, 23 Dec 2002 14:28:52 -0600


On Thursday 19 December 2002 16:09, Michael Laubacher wrote:
> Hello Vladimir,
> Hi all,
> Thank's for pointing out this issue! I had the same problem.
> It seems that selectedTabs.py is not thought for keeping a main tab
> selected if there's a sub/sub/ navigation
>
> An Example:
>
> /company1/jobs                  is defined as portal_tab (=top navigation)
> /company1/jobs/document         is a Navigation on the left
> /company1/jobs/folder           is a Navigation on the left
> /company1/jobs/folder/document  is a Navigation on the left
>
> Now by clicking /company1/jobs/document everything is fine but by clicking
> on /company1/jobs/folder or /company1/jobs/folder/document the portal_tab
> is no more selected.
> If I change selectedTabs.py to tabs['portal']=contentpath[-2] then the
> portal_tab gets selected by clicking on /company1/jobs/folder but no more
> by clicking on /company1/jobs...
> Have you or someone else an idea how to make this working?
> Thank's!
> Michael

Hi

I see a couple of cases:

a) As in your example, you have some portal tab which points to some folder 
(say "company1/jobs"). You want this tab to remain selected whenever the 
current location is a child of "company1/jobs".

You can use  portal_url.getRelativeContentPath(obj), which returns a list, and 
check if tab['id'] is in it. 

For example, in script "header", line 134:

        <metal:block tal:repeat="tab portal_tabs">
            <a href="" class=""
               tal:attributes="href tab/url;
                               class 
python:test(selected_portal_tab==tab['id'], 'selected', 'plain')">
                <span tal:omit-tag="" i18n:translate=""><span 
tal:replace="tab/name">dummy</span></span>
            </a>
        </metal:block>

you could replace 

	selected_portal_tab==tab['id']

by
	tab['id'] in here.portal_url.getRelativeContentPath(here)

It has the problem that some paths return an empty list (for example, 
$portal_url/news ). Also, there could be duplicated entries, but see next 
point.


b) You have some portal tab (which points to, say, "company1/jobs"),  but you 
only want the tab to be selected whenever the current location is exactly 
"company1/jobs", not some child of it.

I found that modifying "selectedTabs.py" to use "contentpath[-1]" worked in 
some cases but not in others. 

Specifically, it worked when the current location was a folder without 
"index_html", or other kind of object (not a folder).

A workaround is this:

Create some portal action:

	Name: Reuniones
	id: reuniones
	Action: string: $portal_url/data/reuniones/reuniones
	...

and put the content you would put normally in

	 $portal_url/data/reuniones/index_html 
in 

	$portal_url/data/reuniones/reuniones


Hope this helps.


Regards


  Juan Pablo






>
> > Subject: Re: [Zope-CMF] Question about portal_actions (plone)
> > From: vlado <vlado@vintech.bg>
> > To: Juan Pablo Romero <jpablo@kan.ajusco.upn.mx>
> > Cc: Zope-CMF <zope-cmf@zope.org>
> > Date: 19 Dec 2002 17:40:46 +0200
> >
> > There is something wrong in selectedTabs.py, find that:
> > tabs['portal']=contentpath[0]
> > and change it to:
> > tabs['portal']=contentpath[-1]
> > and the problem will disapear.
> >
> > On Thu, 2002-12-19 at 03:11, Juan Pablo Romero wrote:
> >> Hi!
> >>
> >> I've added a new action to portal_actions:
> >>
> >> -----------------------------
> >> Name: reuniones
> >> id: reuniones
> >> Action: string: $portal_url/datos/reuniones
> >> Permission: View
> >> Category: portal_tabs
> >> -----------------------------
> >>
> >>
> >> I also created folders "datos", "datos/reuniones". I just want the
> >> contents of "datos/reuniones" display when the user select the
> >> corresponding tab.
> >>
> >> Everything is fine except the tab "reuniones" doesn't get the "selected"
> >> class (just "plain").
> >>
> >> What's wrong here?
> >>
> >> Thanks in advance.
> >>
> >>
> >> Juan Pablo
> >>
> >> PS: Is plone-users@lists.sourceforge.net having problems? I sent this
> >> message to that list about two hours ago and it still doesn't show up.
> >>
> >> _______________________________________________
> >> Zope-CMF maillist  -  Zope-CMF@zope.org
> >> http://lists.zope.org/mailman/listinfo/zope-cmf
> >>
> >> See http://collector.zope.org/CMF for bug reports and feature requests
> >
> > --
> > Vladimir Iliev
>
> _______________________________________________
> Zope-CMF maillist  -  Zope-CMF@zope.org
> http://lists.zope.org/mailman/listinfo/zope-cmf
>
> See http://collector.zope.org/CMF for bug reports and feature requests