[Zope] Newbie Question: Ordering items within a folder based on a property
Lennart Regebro
lennart@torped.se
Thu, 28 Mar 2002 18:43:30 +0100
From: "Ben Chapman" <benjamin-chapman@utulsa.edu>
> However, we also want to arbitrarily sort the folders and while the
> below code works, it doesn't do exactly what I want. We define an
> integer property 'sort_value', then sort based on sort_value and
> alternatively title_or_id.
Several ways of doing this. The best ones all involve using a ZCatalog to
index all objects and make a query on that ZCatalog. For code example you
can checkout my LUF content management system.
http://www.zope.org/Members/regebro/
It's a trivial hack done in a week or so, but it worked. :)
It works by a "Navigator" object. You place that menu in the folder you want
to appear in a menu, and enter the name of the menu in the navigation
object, together with the navigation title and navigation order.
It then indexes itself in a Navigation ZCatalog, which you can query to
build menues.
I can't help you with it otherwise, I moved my last LUF CMS site over to
Easy Publisher a couple of weeks ago. EP uses the same principal of indexing
the navigatable objects in a ZCatalog, but instead of creating special
objects we use objects that subclass from a Navigatable mixin class, that
keeps track of all the navigation information.