[Zope-dev] urg
Rik Hoekstra
rik.hoekstra@inghist.nl
Tue, 07 Mar 2000 15:12:16 +0100
Tom Deprez wrote:
>
> >But reading this carefully:
> >
> >- When a KBItem already is inside a KBFolder and the KBFolder is its
> >category, then why go into the trouble of creating/updating properties.
> >THis is information replication, which you should avoid
> >I would think a simple <dtml-var
> >"<specificKBFolder>.objectValues(['KBItem'])"> will get you all the
> >items you want for a specific category.
> >You may need a Catalog to do more complicated things, but you will have
> >to be more specific for us to be able to help you.
>
> Ah yes, but I thought not to catalog KBFolders. They are merely the class
> which shows the KBItems in a way you want. Assume this: you've the
> following Knowledgebase Tree :
>
> Python
> Zope
> What is Zope?
> Problem 1
> Python
> DTML
> What is DTML?
> ...
>
> Then this would be
>
> Python (KBFolder)
> Zope (KBFolder)
> What is Zope? (KBItem; Categorie: ZOPE)
> Problem 1 (KBItem; Categorie: ZOPE)
> Python (KBFolder)
> DTML (KBFolder)
> What is DTML? (KBItem; Categorie ZOPE DTML)
>
> Now:
>
> searching for DTML will return: 'What is DTML?'
> searching for ZOPE will return: 'What is ZOPE?', 'Problem1', 'What is DTML?'
>
OK, this is clear.
This could be (partially) resolved with my proposal:
<dtml-in "ZOPE.objectValues(['KBFolder', 'KBItem])">
<dtml-if "_['sequence-item'].meta_type=='KBFolder'">
<dtml-in "_.sequence-item.objectValues(['KBItem'])>
<dtml-var sequence-item>
</dtml-in>
<dtml-else>
<dtml-var sequence-item>
</dtml-if>
</dtml-in>
[notes:
this is only to give the idea. It is not tested.
1. It would need some elaboration for more than 1 item deep (by
factoring out the dtml-if, for example
2. Though I did not try this, I'm sure you could also do this with
KBFolders returned from a Catalog]
Rik