From: Bharat M. <bh...@me...> - 2004-07-30 05:24:10
|
Jerome Daniel wrote: > First of all, congratulations for this great job on Gallery 1 & 2. > Thanks! > I've start to play with Gallery 2 and I'd like to add some features in > interesting on. For that, I would need to trap some particular events > when precise actions occur within Gallery 2. ... > - Events when an item is added (Photo, Album, Sub Album, ...), deleted > (for this one, I think that there is already on event) or moved > > - Events when a user logs in and logs out Right now our event creation model is very informal. We're creating and posting events whenever we think they're appropriate. At some point in the future (~beta?) we'll take a look at the events we're publishing and come up with a more coherent plan. In the meantime, I added two new events: Gallery::Login Gallery::Logout that are thrown at the appropriate time. They contain the GalleryUser entity that's doing the logging in/out. You can track entity creation, modification and deletion with our pre-existing events. Creation: Listen for the GalleryEntity::save event and test the entity for STORAGE_FLAG_NEWLY_CREATED, ie: $entity = $event->getEntity(); if ($entity->testPersistentFlag(STORAGE_FLAG_NEWLY_CREATED)) { ... } Modification: Listen for GalleryEntity::save and test that the above flag is not set. Deletion: Listen for GalleryEntity::delete Hope that helps. If you need more events, just let us know. -Bharat |