Forum OpenACS Development: CMS forms + widgets versus Classified Ads

Collapse
Posted by tammy m on
Hi

I just starting looking at the Classified Ads package as an example of a package that uses the CR. I notice that CA uses it's own widgets procs and tables and even attributes procs and tables in some cases. Is this because the CMS widgets/attributes procs are outdated or not useful? ETP seems to do it's own display of FORM widgets with 'ad_ ' procs. What's the right choice for use in new packages that will be declaring content_types, attributes and widgets?!
TIA

Collapse
Posted by Dave Bauer on
Tammy,

Everything should be using the form builder. If a widget doesn't exsit, building a new one is not too difficult, if not well documented.

ETP is a large culprit of doing its own thing. I will try to bring to around to the OpenACS way some day.

Collapse
Posted by Don Baccus on
Also Classified Ads may've been written as part of the 4.x development process (back in the Ars Digita days) before the CMS merge with ACS 4 was completed.

We are planning to mainstream the CMS widget/attributes stuff and the way they're used to allow autogeneration of forms and other good stuff over the next few months.  They're definitely not out of date but rather we'd like to see this functionality extended to all objects.

Collapse
Posted by Jun Yamog on
Hi Don,

I think Tammy was refering to the classifieds done by Deds not by aD.  Classifieds of Deds has a mechanism of displaying the form according to content type just like cms, etp, etc.  Since we don't have yet a standard on this.  Each implementation varies from one another.

Hopefully we can have a single standard of this.  It will be useful for bcms, as this feature is a yet to be done feature.

It is pretty much related to the thread that Rob Locke is trying to revive.

Here are different packages that I am aware of doing something similar:

-etp
-classifieds (deds)
-cms (aD cms)
-query builder (Tom Jackson's)
-the cool code of Rob Locke

Maybe we can have the core developers look into them and see if any lessons can be learned from them.  One of the most important feature would be the ability to override the system supplied widget (implemented on classifieds and Rob's code).  For example attribute_foo is set as a radio group, but I really need attribute_foo to display as a drop down for some unknown valid reason.

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...

Collapse
Posted by Jun Yamog on
Hi Tammy,

Yup Deds is a very good developer.  I can vouch for that, studied with him, worked with him.

Rob's cool code is less tied to acs_attributes or acs_objects.  Its more tied to postgres fields and relations.  I mentioned it in this thread.

https://openacs.org/forums/message-view?message_id=28086

Collapse
Posted by Don Baccus on
We really want to tie this to acs constructs, not SQL DDL, because we want to be able to override them easily.  And one way to do this is to define a new type that doesn't exist in SQL.  For instance the rich text widget in the form templating code combines SQL text and boolean columns to form a text item that may be flagged as HTML or plain text.

We need functionality of this sort.

We need to straighten this mess out.  We need to start reusing code rather than reinvent it.

Collapse
Posted by tammy m on
Don,

Totally agreed. How do we do that?

I'm going through CMS code and Classifieds code now, trying to find a way to display an entry FORM from a content_type in CMS, accept input from that FORM into the database (new and modified for first documents and then revisions) and display the final created page to a user. Lots of packages in OACS do this, but AFAIK none of them accomplish it in the same way and I would think the CMS  (and Templating) should be the place for this code but then the CMS code seems the most clunky to use:(

Anyway, I'd love to help if there was any clear map to an end goal;)

Collapse
Posted by Dave Bauer on
Tammy,

Are you customizing the existing CMS package? Basically any parts of CMS that are generally useful should be moved into a seperate service package. Some of the parts might belong in the content repository, and some others might be generally useful as part of acs-templating. Others might be more specific to a content management system. It is my goal to end up with a package that provides CMS service to another package that presents the CMS user interface.

I am going to be working on ETP in the next couple of weeks to bring it more in line with standard content repository features. I am also coordinating with Jun and his BCMS package (in contrib) so that we can eventually have a clear set of tools for building a CMS.

Collapse
Posted by tammy m on
Hi Dave,

Great news that ETP + BCMS + CMS are being worked on:) It'd be so great to have a working CMS system with a basic UI like Typo3, Plone or some such with OACS.

I'm not customizing existing CMS. Here's what I have done so far. Hold on it's not pretty. I am using existing CMS tcl/sql procs AND Classified Ads (from Deds) tcl/sql procs in a package I am making for myself. So far the Classified Ads procs all use the CMS procs and expand on that concept with widgets that work for me.

What I could do is pull out the procs I'm using from Classified Ads, make them a little more generic (wouldn't take much, they are pretty usable even from another package so far!) and put them in a new package of their own. If that would make it any easier for you to see what worked and didn't work in CMS for me.

Collapse
Posted by Dave Bauer on
Tammy,

Sure, it would be interesting to see how you are using the system to generate forms.

As I said, we should be able to enhance the form-builder part of acs-templating to make these widgets available to all packages. One part of CMS that assigns the CMS widgets to attributes of objects will have to be generalized. Acs_attributes does some of this, but I think there is not 100% overlap in the functionality.

Collapse
Posted by Jun Yamog on
Hi Don,

Yes we need to reuse an existing code, although the problem is which one?  I guess some leadership, core developer or developers will layout a high level plan.  Hopefully other developers will try and use the plan.

Like in my case for example, if I am to implement this feature on bcms.  Which one should I take?  I am likely to pick Deds code due to familiarity.  Maybe just take out this function in classifieds to a separate service package.  But if there is some agreed high level plan on it, I might try that first and see how it goes.

Similarly in categories, the direction is to use Timo's package.  Although I am unlikely to use it now since I still use 4.6.x code.  I should prepare or keep in the back of my mind that eventually I will have to migrate my packages to it once it becomes the mainstream in 5.x.

Basically the area of generating forms from objects has no clear direction yet.  So we are likely to have different implementation.

Collapse
Posted by Don Baccus on
Jeff Davis has used the existing form generation stuff in the CMS to autogenerate forms for the photobook application that has been done for Sloan recently and will soon show up in .LRN.

He would be a good person to talk to.  He might know if it would be easy to extend for normal objects.

Collapse
Posted by Randy O'Meara on
I don't see a "photobook" package in the contrib section of CVS. Anyone know where this is located?
Collapse
Posted by Jun Yamog on
Thanks Don,

So Jeff Davis is the point man on this.  I guess Tom Jackson, Rob Locke and Tammy can ping him about this.  It not currently near my radar to do automatic form generation.  Guys ping up Jeff Davis on this so maybe some form of direction can be made.

Collapse
Posted by Janine Ohmer on
Randy, photobook isn't quite done yet.  Jeff will be comitting it as soon as it's ready.  We built it for Sloan, and it needs to be "genericized" a bit before it can go into the public tree.