[Zope] Re: Clever solution wanted

Didier Georgieff Didier.GEORGIEFF@agriculture.gouv.fr
22 Jan 2002 17:39:43 +0100


On Tue, 22 Jan 2002, Mario Valente wrote:

>>   Create a ZClass called MenuItem which has 3 properties
>> (urlText, targetFrame, displayText).     

..... snip ...

> I had quite a similiar idea (not as elegant as yours) but the
> problem is that I would have to include a "Sort"-property which
> would give the ability to arrange the entries in a specific order. 

> Any idea how to solve the ordering problem with your solution?

You can have a look at ZMultiTab wich is a similar simple ZClass 
(not for menus, but for Tab management) but you can get the idea.

http://www.zope.org/Members/dgeorgieff/zMultiTab

Sorting is done simply by a Integer property.

If you want to allow people to put it automagically at the right 
place, why not putting the list in order and when they click to the 
place they want the new entry, calculate the mid value for your 
next entry and assignate it to the order property ?
Start with values from 1000 to 1000 and it should works fine.

Regards.

--
Didier Georgieff
Chef de projet technique SIT du Bas-Rhin
t=E9l : 03.88.76.78.35 - fax : 03.88.76.78.34
email : didier.georgieff@agriculture.gouv.fr