[Zope-CMF] Relating different objects to each other

sean.upton@uniontrib.com sean.upton@uniontrib.com
Fri, 11 Oct 2002 15:20:17 -0700


Short term: use Max M's mxmRelation product (which is not CMF specific).
For each type of relation, you will need to create a mxmRelation object in
the root of your CMF site, and then code skin methods (form and a form
processing script) to allow you to associate the items in the relation
object using its relate() method.  Add the method name for the form method
for doing this to an action provider for the object (for example, in the
types tool). Then have your skins use the smart-list feature of the
mxmRelation product to render what you need, for example, using a loop or
<dtml-in>... This works out pretty well.  You could use this to associate
images with a news item, for example, with relative ease by simply adding a
skin method for searching for all images in the catalog, and listing them
with checkboxes in an HTML form.  When the form is submitted, it saves the
relationships into the relationship registry object you created.

Long term: I'm sure that eventually, need will dictate a more scalable
relationship management tool in the CMF.  See thread on this in the archives
from a few days ago.

Sean

-----Original Message-----
From: Phil Glaser [mailto:StillSmallVoice@DirectvInternet.com]
Sent: Friday, October 11, 2002 1:04 PM
To: List Zope CMF List
Subject: [Zope-CMF] Relating different objects to each other


Hi,

I am building a site where my client would like to have a "related items"
feature. The idea would be that, for example, when you display a news item,
you would also display a list of other items, from the same or different
object type, that are related to it. So for the news item, the related item
list might include a document, an event, a link, etc., that are thematically
associated with that object.

Is there a way to do this out of the box with CMF?

If not, the way I was thinking of approaching this is as follows: every type
that can be related in this way would have a list property that contains the
ids of items to which it is related. The search catalog would index this
property. When you display the related items for an object, you would do a
catalog search against the object's id in the related items list index. When
you create the relationship between one item and another, you are simply
adding the item's id to the other item's list property.

If this is a sound approach, I'm wondering if the cleanest way of
implementing it would be to implement the list property, and any related
methods, in the object hierarchy above the level of the different
information types. Since the object hierarchy is not documented anywhere,
I'm not sure where the most logical place to do this modification would be,
and welcome any suggestions.

Or, a completely different approach.

Many thanks!



Philip Glaser
Principal and Software Architect
Sustainable Software Solutions, LLC
StillSmallVoice@DirectvInternet.com
www.sustainsoft.com
973-951-9522



_______________________________________________
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