Forum OpenACS Development: Automatic form generation revisited

Collapse
Posted by Lars Pind on
It's time that we get the automatic form generation stuff working.

I believe we have several efforts already in that direction, including the 'cms' package, and Jeff's photo book sutff for Sloan. Probably others.

I'd like to catalog the various efforts, and try to get a blessed solution that effectively sets the future direction for this into 5.1.

In order to learn a bit more about the problem space, I've been experimenting with some automated form generation myself.

You can see the code here:

http://cvs.openacs.org/cvs/openacs-4/contrib/packages/simulation/www/object-edit.tcl

and play with it by installing contrib/packages/simulation (requires contrib/packages/bcms).

My approach only works for CR items. It tries to use the attribute definitions and the cr_type_relations info, plus some additional metadata currently defined in the Tcl layer, which we should probably move into the DB layer when it's solidified.

How does this look compared to what other people have been doing? What can we do to merge the efforts?

What are your (qualified) thoughts on how this should be achieved?

/Lars

Collapse
Posted by Jun Yamog on
Hi Lars,

I haven't look at your code.  But one thing in my opinion is very important to me is.  Just in case the automated way of form generation does not cover what I need to do.  I can override is elegantly.

Thanks I hope that consideration can go to the blessed implementation.

Collapse
Posted by Dave Bauer on
I would want to define certain apsects for a content type including the widget to use and its paramteres and the order of form elements for a content type.

Another important feature that exists in the CMS form generation code is the ability to add or edit more than one object of a type per form.

Collapse
Posted by tammy m on
Hi Lars,

There was a discussion of 2 different approaches being taken to auto-form generation in the CMS and Ded's Classified-Ads in CMS forms + widgets versus Classified Ads forums posting. I sent Dave Bauer a copy of the tweaked Ded's code I am currently using to auto-generate forms from the db using CMS and also to save CR objects back to the CR from the auto-generated forms. It still links the forms elements/datatypes to ACS constructs (as Don Baccus pointed out is wanted) but doesn't have quite as many levels of abstraction as does the CMS/CR acs_objects attributes model. That model was just too hard to work with for my purposes and the possibly added flexibility didn't seem worth extra work, learning curve and maintenance to me:(

Collapse
Posted by Randy O'Meara on
I've kind of wandered into this space (auto form generation) and read this thread and the one that Tammy referenced above. I looked for Lars' simulation/www/object-edit.tcl in CVS and didn't see it, so I don't know what direction he's heading.

In the mean time...

Tammy, can you send (or point me toward) the sample code you've developed?

Thanks,

Randy

Collapse
Posted by Randy O'Meara on
Thank you, Lars. This looks like it will be helpful.

Randy

Collapse
Posted by tammy m on
Randy,

I'll package this up and send it to ya. I can't claim I developed it as most of it came from Deds Castillo's Classified Ads package that I got a copy of. I just pulled it out of the Ads package and threw together a package that only had the CMS and FORMS related stuff in it, in a more generic format. I have to mention that I have altered my base OACS code in some minor ways and you might run into that (added optional parameters to some template::form procs so I wouldn't have to have to do things like check if a form element existed for every element when inserting/updating a form in the db). I really should clean that up and I mean to try to take a look at those cases and keep my OACS base code more compatible with the "real" base... some day...

In the meantime, I'll send ya a tar of the package. I'm on OACS 4.6.1 btw.

Collapse
Posted by Caroline Meeks on
Hi Tammy,

Do you happen to have any fixes for the code the Classified Ads package uses? I started to play with it but found lots of bugs.

Thanks

Collapse
Posted by tammy m on
Hi Caroline,

That's hard to say! I am using only portions of the code and I did make significant changes (like repackaging as a service, so I'm not actually using the CA package itself now). If you can tell me more about the bugs you are hitting, I can determine if they would be "fixed" in my package codebase or would not even exist there! Also, I have heard rumors there are multiple different versions of the Classifed Ads package. I'm using the latest version that Deds Castillo originally wrote and some nice folks working with Jun Yamong sent me.

Collapse
Posted by Caroline Meeks on
Hi Tammy,

I posted some of the bugs in the bug tracker but it seems like the first thing to check is if the version in CVS contrib is the same "most recent" one that you are working with.

Thanks
Caroline

Collapse
Posted by tammy m on
Hmmm

It looks like they started as the same codebase at some point but have diverged quite a bit now. I don't use the pages that are giving you errors either. Sorry, wish I could have been more help.

Collapse
Posted by Jun Yamog on
Hi Caroline,

I think the latest is now maintained by Roberto.  Deds gave the code and Roberto continued the work in making it more generic.  I think its the one on contrib.

Hopefully Roberto or Deds can post and give the correct info.

Collapse
Posted by Randy O'Meara on
Tammy,

I'm back. Thank you so much for packaging up your examples and  design notes. Much appreciated.

Randy