On the list I've often seen complaints about 

<dtml-in foo sort=blah.... > not being dynamic enough. I cooked
up a solution some time ago "Zieve", but the first release required
each user to get a cookie to store their preferred sort order, and
to rank sort order according to the history of their clicks. Zieve-0-1-0
still allows that behavior, but no longer requires it. Below is the current
REAME. Let me know if it works for you! Since cookies are not needed
you can drop a Zieve in at the root of your project and acquire it anywhere
below that. It can then be called on as sort of a 'helper' to sort in all
sorts of situations. You can sort on any attributes, in any order. Anyway,
if *you're* frustrated with sorting problems... check it out!





Zieve 0-1-0

Zieve is a Z-subclassable class that assists in sorting arbitrary Zope
Objects in various ways. It allows developers to sort objects
dynamically with primary, secondary etc keys, and provides an
easy means to include dynmically sortable objects in other documents.

What's New in 0-1-0: 

  * No longer requires Cookies! (Yeah!)

  * More logical parameter names.

What was new last time:

  * A snappy new icon. ;-) 

  * Stand alone product, no longer needs to be subclassed 
    to be useable. 

  * Example table in manage_tabs for perusal 

  * Editing of meta_types and default sort order from management 
    interface reduces coding in dtml docs..

Here is some DTML from a DTMLMethod that uses a zclass derived 
from Zieve to do some sorting...

This displays a table heading with links that dynamically resort the
table according to which link was clicked last. The secondary,
tertiary, ...etc keys are remembered from prior clicks....

Here is an example::
  <dtml-var standard_html_header>
  <h2><dtml-var title_or_id></h2>
  'theZieve' is a Zieve or an instance of a ZClass that is subclassed from Zieve.
  'name', 'color', 'birthsone', 'number' are all properties of the objects being 
  (in this case, they are DTML Documents with properties 'name' etc....) The format 
  allows you to specify a type or filter to use before comparison. In this case 
  allows numerical sorting for one of the properties.
  <dtml-in "theZieve.sortObjects( 
             theObjects = objectValues(['DTML Document']), 
  <dtml-if sequence-start>
  <td><a href="&dtml-URL0;?sortOrder=name">name</a></td>
  <td><a href="&dtml-URL0;?sortOrder=color">color</a></td>
  <td><a href="&dtml-URL0;?sortOrder=birthstone">birthstone</a></td>
  <td><a href="&dtml-URL0;?sortOrder=number:int">number</a></td>
  <dtml-with sequence-item>
  <td><dtml-var name></td>
  <td><dtml-var color></td>
  <td><dtml-var birthstone></td>
  <td><dtml-var number></td>
  <dtml-if sequence-end>
  Sorry.. there are no objects to sort..
  <dtml-var standard_html_footer>

Of course.. a Zieve is smart enough to display objects in a sortable table
all on it's own, if you like... Just 'view' it!


Zope maillist  -  [EMAIL PROTECTED]
**   No cross posts or HTML encoding!  **
(Related lists - 
 http://lists.zope.org/mailman/listinfo/zope-dev )

Reply via email to