I would like to create a custom Event type with an optional registration form.
This is to avoid creating an ad-hoc easyform each time a registration form is required.
I noticed a bunch of event behaviors that could augment custom types.
For example I was thinking about a custom Folder type with event behavior(s)
to include a generic registration form made using easyform.
Or maybe a registration form could be made into a behavior to augment a custom Event type?
You could create a generic EasyForm with a field would be used as a reference for the related event. From individual events you can link to this particular form an pass the id of the event through an url parameter to the registration forms..more interesting question: where would you store registrations and how would you process them?
You could add a behavior to Event type (or add a new type). This event would let you select a related EasyForm. Then a viewlet would show the form. (Maybe with pat-inject… the approach I use for 'similar stuff'). You will need to modify the "saving of registration" so it saves to "your folder" or maybe use a content rule based on "from what context it was called" ?
The upside is that it is easy to edit the Easyform when you need to make changes.
You could make a vielet that is registered for a behavior / and "some_field" is enabled. The viewlet shows the form.
You could just change the event type to folderish and make an event rule that copies an easy form "into it" every time you add an event. (and then a viewlet or another browser view to show it
UPDATE: For the users, it might be more 'slick' if you use pat content load to load/show the registration, then you just use a button to load the registration form (like this http://themes.medialog.no/fragments/yy-1 )
Then, in your file "events.py", (which you have to make), you need to define 'copyEasyForm" and add code to 'copy the form you made', it will be something like
def copyEasyForm(self, context):
"""copy some stuff"""
plone.api.content.copy(source='my_easyform', target=self)
One issue: when changing the Event type to folderish, it does not turn existing event objects into folderish objects, only the new objects are folderish... does it means I'd have to re-import all events (using transmogrifier)?
Because I want the handler to be called when an Event is created, I used for="plone.event.interfaces.IEvent
but it does not seem to work; my copyEasyForm handler contains only a logging call to display the event in the debugging console, and nothing shows.
Any idea how to configure the subscriber?
Also, I added it to the configure.zcml file of my policy package; is it an appropriate place to add it?
Could it be that the ObjectAddedEvent is actually for the folder (event was added to the folder) and you should use something else ( `zope.lifecycleevent.interfaces.IObjectCreatedEvent ? )
Everything I tried failed miserably, as if the "subscriber" tag in my configure.zcml file is simply ignored. Is there a way to list subscribed handlers? How to debug?
As the first argument of a subscriber, is it valid to provide a schema (based on plone.supermodel.model.Schema)?