[Zope-CMF] searching 'subportals'

Grégoire Weber gregoire.weber@switzerland.org
Mon, 09 Jul 2001 15:38:36 +0200


Seb,

Oh, so it seems we have the same disposition! See my comments below:

> > 1) You have *real* CMF instances as subportals in a main/top CMF portal?
> > Correct?
> 
> No, though you could do something like this.  In my system, each
> 'subportal' is actually a member's home folder.  So the root of a
> 'subportal' in this example is, in fact, a modified PortalFolder which
> defines a 'getSite()' method.  

Why do you need to make your change to the portal_catalog 
tool? Why not exclude the other subportals items by adding the 
'Creator' to the catalog search? Have a look at the following:

What I do to achieve the same(?):

In the standard_html_header I set a variable to the members name
(= subportals name) by extracting it from the objects path:

<dtml-let anchor="'Members'"
          pos="_.string.find(URLPATH0, anchor)"
          beg="pos + _.len(anchor) + 1"
          end="_.string.find(URLPATH0, '/', beg)">
<dtml-if "pos == -1"><dtml-call "REQUEST.set('member', '')">
<dtml-else><dtml-call "REQUEST.set('member', URLPATH0[beg:end])">
</dtml-if>
</dtml-let>

So the member is '' if the rendered object is not in a Member 
(sub)folder. My top news page (my top portals index_html) then 
shows all news items. But the (same) index_html in the members 
directory only shows the Creator's news items.

The search:

<dtml-let newsitems="portal_catalog.searchResults(meta_type='News Item',
                     sort_on='Date', sort_order='reverse', Creator=member)">


> Off the top of my head, if you wanted 'real' portals as sub-portals,
> you'd want to delete most of their tools after they've been created,
> especially the catalog_tool.  You may have problems with getting the
> CMF to find a catalog in an enclosing portal - have a look at the
> getToolByName method to find out.
> 
> Then you could stick a python script in each subportal root which
> returns a subportal identifier (like getSite in my example) for
> indexing. 
Then I probably would need something like this. I'll have to do that
for long term but not yet now. So your hints will then be very 
important. Thanks!

Greg

P.S.: I had a look at your web page and you bring it to the point!
      'And that's it.' -- cool! you're absolutely right!

   What does Jamkit do?
   We provide content management facilities for web sites.
   Our services are more effective and can be delivered quicker 
   than those of our competitors.
   And that's it.

_____________________________________
Grégoire Weber
Rigistr. 31
CH-8006 Zürich
Switzerland
phone:  +41-(0)1-361 66 11
mobile: +41-(0)79-44 11 457
mailto:gregoire.weber@switzerland.org