[ZDP] Ordering objects implemented

Rik Hoekstra rik.hoekstra@inghist.nl
Fri, 24 Mar 2000 11:14:41 +0100


Hi All,

I implemented a way to keep order in DocumentFolders. Currently I have
only implemented it for FAQSections, but it is easy to add to other
derived ZClasses (see below).

Description:
Because all items in Document Folders (as implemented in the ZDPTools).
The need to keep order arose from fact that there is no independent way
to keep order in objects in folders. Now they are ordered by id, or
modification time, or title, but that will not always do.
The order implementation add the possibility to order them by a property
called contextorder. This is managed in a form under a separate tab in
the product.

Implementation:
- After some discussion I added a contextorder variable to the Info
propertysheet of the DocumentFolder (and in this way to all its
descendants). 
- The ZClasses get an context order variable at creation time. It is set
to 0.
- Document Folder now has two new methods, called manage_changeOrder and
manage_changeOrderForm. These handle the ordering of objects. The order
of objects is handled manually by changing the number. This allows for
some freedom, as you may give an object that should appear at the back
of a list by giving them an arbitrarily large number.
- As yet, implementation is confined to the FAQ Section (notably the
General section, from which the need arose).

Use:
If you want another type of container object to handle it's own order, a
few changes to the class have to be made: 
- in the Views section of the ZClass a you have to map the
manage_changeOrderForm to a new tabname
- the method in the Zclass that takes care of the order of objects has
to be changed so that the sort parameter of the 
<dtml-in "objectValues(['whateverobject'])" sort=contextorder> 
is no longer 'id' (or whatever else it was) but contextorder.
that's it. You may now change the order of object under the new tab you
have mapped.

One more remark: the default contextorder value is 0. This places all
new object in a container that is sorted on order at the top of the
list. You could put this to advantage by excluding them from viewing
unless they have a different contextorder value than 0.

Hope this is clear

Rik