Forum OpenACS Development: Re: CMS forms + widgets versus Classified Ads

Collapse
Posted by tammy m on
Hi,

Thanks Jun. That is what I was referring to (ded's Classifieds).

I was not able to get the aD CMS to create a FORM using [content::get_revision_form db content_type item_id form_name]. It gave me errors and trying to track them down involved too many layers of not-my-own-code and lots of database tables:( The error was briefly "can't read "rows:rowcount": no such variable" while executing "template::util::array_to_vars row."

But I was able to get the Classifieds code (calling it from my first package I'm building) to build a FORM from a content_type by calling [classified-ads::widgets::get_widget_params -content_type $content_type -form_id $form_name].  I used all aD CMS code (so does Classifieds underneath until it gets to the widget stuff) up until the step where I register and customize widgets. So using the aD CMS UI, I can see my content_types and attributes but the "Register Widget" link shows up as if I don't have associated widgets for my attributes (the aD CMS doesn't recognize them is all).

I have to say that the Classifieds code to add widgets and customize their attributes with a single call to ca_attributes__register_widget per widget, is pretty clean -- easy to use and easy to follow. The params closely mirror the ad_form/ACS Templating parameters you'd expect to use. This makes it much easier (since I recently learned to use template::form etc and ad_form). The aD CMS calls to register widgets and customize their attributes require many more proc calls and fill more tables than the Classifieds code to create the same FORM (theoretically of course, since my FORM didn't actually get rendered in the CMS version).

Also, the Classifieds code has the option of making a widget  sitewide or specific to a package instance.

btw, what is the cool code of Rob Locke? I feel like I'm missing something now...