[dev] Updated "Divot" thingy...

Jason M. Felice jfelice at cronosys.com
Thu Aug 11 07:36:42 PDT 2005


Attached is a somewhat cleaned-up piece of concept code, which now uses 
serialization instead of the memento pattern.

Also, it would now depend on the Horde registry to find divot class 
files that applications provide.  (Before you could specify a path, now 
you specify an app name.)

All comments appreciated.

I'm also beginning to think about the details of event dispatch.  I'm 
thinking the most functional way to do it is this:

Have a method Divot::trigger($callback, ...) which returns a URL which 
will call the specified method.  For example, in a derived class:

function render()
{
    return '<a href="' . $this->trigger('submit', 'ok') . '">OK</a>' .
           '<a href="' . $this->trigger('submit', 'cancel') . '">Cancel</a>';
}

function submit($type)
{
    if ($type == 'ok') {
       ...
    } else {
       ...
    }
}

(trigger() would use opaque keys to store callback name and parameters 
as well.)

-- 
Jason M. Felice
Cronosys, LLC <http://www.cronosys.com>
216-221-4600 x302
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Divot.php
Type: application/x-php
Size: 6735 bytes
Desc: not available
Url : http://lists.horde.org/archives/dev/attachments/20050811/53418f98/Divot.bin


More information about the dev mailing list