Hi David, Thanks for thinking along. I'll try the PFG action adapter. Thanks for your pointers.
Kees On 08/31/2010 09:41 PM, David Glick wrote: > On 8/31/10 2:24 AM, Kees Hink wrote: >> A question for collective.megaphone developers: >> >> A client of ours wants to store collective.megaphone data in a MySQL >> database. >> One could do this by following the steps at >> http://plone.org/products/ploneformgen/documentation/tutorial/sql-crud/tutorial-all-pages. >> That's a lot of manual work, and it requires some ZMI/MySQL knowledge [1]. It >> would be nice to enable editors to create an Action Letter with a MySQL >> extension using the wizard. >> >> I'd like to create either some kind of extension to collective.megaphone >> itself >> or a separate add-on product, which will do the following: >> * on installation/activation, a create "Z MySQl database connection" is >> created >> - host, username, database are supplied by admin user at this moment >> * When an Action Letter is created, the user can checks the box that says >> "Save >> also to MySQL database". If checked, this happens: >> - a table is created (name derived from the Action Letter's id) >> + add columns for all form fields are added >> + maybe later allow users to select which fields are added >> + maybe later allow updates when fields have changed >> - a "Z MySQL Method" for storing is added >> + maybe later add other "Z MySQL Methods" >> - this method will be called after saving the form >> + for example, an after-validation script calling this method >> * each time an Action letter is deleted, its table is deleted >> >> What i'd like to know: >> * Are there currently solutions available that i may have missed? > Not that I'm aware of (but I haven't looked). Massimo Azzolini from Red > Turtle also recently expressed interest in something like this. >> * Is it feasible to do this in collective.megaphone? If I created a branch, >> would someone be willing to merge it if the quality is good? >> * Or is this out of scope, and/or are there reasons why a separate package is >> better suited for this than collective.megaphone? > I would rather see this as a separate package which provides an > additional wizard step for Megaphone. In Megaphone >= 2.0b1 (e.g. > current trunk), the MegaphoneActionWizard class has a dynamic 'steps' > property which returns the list of steps to be included in the wizard. > We should modify this to do an adapter lookup to a new > IMegaphoneWizardStep interface we define, so that a separate package can > supply an additional step. I would be happy to merge a branch > implementing that adapter lookup in order to make it possible to create > the MySQL integration as a separate add-on. >> [1] Also, I'm currently pondering about a way to use _two_ after-validation >> scripts: collective.megaphone has one already filled in >> (here/@@recipient_multiplexer), which i currently replace with my Z MySQL >> Method. > You should probably instead create a PloneFormGen "action adapter", and > call your Z MySQL method from its onSuccess method. If you do this, the > recipient multiplexer will ensure that it is called once for each > selected recipient (with different values in the request form each time): > - mark the action adapter with > collective.megaphone.recipient_multiplexer.IMultiplexedActionAdapter > - *don't* enable the action adapter as one normally does in PloneFormGen > (then it will get run directly by PFG instead of via the recipient > multiplexer) > - set the execCondition of the adapter to "python:True" (this is how the > multiplexer tells whether it is enabled or not) > > David > ---------- > David Glick > Web Developer > [email protected] > 206.286.1235x32 > > Groundwire: You Are Connected > http://groundwire.org _______________________________________________ Product-Developers mailing list [email protected] http://lists.plone.org/mailman/listinfo/product-developers
