Forum OpenACS Development: Templatig system questions

Collapse
Posted by Bruno Mattarollo on

Hello guys

As most of you might now already, Greenpeace has been working on moving several of it's sites to ACS 4.2 TCL (why not OpenACS, well, we started several month ago and OpenACS 4 was not yet a reality and aD was still supporting TCL versions and so on and so on, anyway, everything has been done as APM packages -suggested by Don Baccus, THANKS!- so we could port, once we have a working version, to OpenACS pretty much straight forward).

I am messing around with a small series of administrative tasks that I would like to add to the administration of the acs- lang package and I started to look into the templating system. I remember some posts about the form creation and so on but can't find them again... Have anyone been looking into that? I am just asking to make sure that I am not going into a dead-end with that and that it could be ported to OpenACS or that I could take the acs-templating from OpenACS more or less directly

Our programming agency didn't use the templating from acs- templating (AFAIK) so I am the first one to look into it. Any suggestion or recommendation is welcome.

As always, I am trying to find some free time to start beeing more active on the BBOARD of OpenACS because I believe there are many VERY bright and interesting people in this community and it's an honor to be part of it.

Cheers and thanks in advance.

Collapse
Posted by Dan Wickstrom on
Although the cms package has been often derided for its crappy UI, it makes extensive use of the templating system's form building routines, and there are an abundance of good form building examples in the cms code.

I've done alot of work recently using forms built via the templating interface, and I've found it to be quite nice.  In fact the templating system in general is quite nice for development purposes.

Collapse
Posted by Stephen . on
I also have been using template::form::* stuff recently, and have found it very useful. It enables you to build complex multistage forms pretty quickly.

My only gripe is that when I tried to extend the system with new widgets and auto confirmation, new templates etc., I discovered upvar hell!

Still, if you're not planning to extend it, that won't be a problem for you...

Collapse
Posted by Bruno Mattarollo on

I looked more at it and I modified some of the .tcl files to make the output XHTML 1.0 transitional since most of the time the attributes of the elements in the widgets where not quoted or were minimized. I still have to look more into it to make sure that I haven't missed some widgets or elements. I did some tests with forms with select and textarea and it validated using the HTML validator from W3C.

I will continue to work on it and I will also get the OpenACS version to compare the differences.

If anyone is interested in the modifications I did, please let me know and I can tar them and send it to you.

Talli, Don, interested? I am only working with the ACS 4.2 at this moment, will look into adapting it to the OpenACS in the near future, but not now...

Collapse
Posted by Don Baccus on
The templating Tcl procs that don't involve hitting the database will drop into OpenACS 4.2 unchanged.  Yes, I'm interested, we should be putting out correct HTML and getting the form handler and templating code to emit it will be a big step in the right direction.
Collapse
Posted by Bruno Mattarollo on

Ok, I finally found some time to get the package all together ... I haven't touched all the .adp files under the resources directory, only resources/forms/standard.adp since it's the one I have used. I will make the others XHTML 1.0 compliant later... (very busy theese days).

I don't know how to create a patch file against the acs-templating of ACS 4.2 so I tarred and bziped the package. If someone tells me how I should run the diff utility to create a patch file I can also create the proper patch. For now you can get the package from http://web1.greenpeace.org/acs-templating.tar.bz2/. It's the one from ACS 4.2 with my modifications to make the .tcl files output proper XHTML code.

Collapse
Posted by Stephen . on
Nested if/else tags can become very ugly... Fortunately ACS comes with an elseif tag! Unfortunately it's broken...

In acs-templating/tcl/tag-procs.tcl, change line 52 from:

  append condition "} {"
  template::adp_append_code $condition
to
  append condition "} {"
  switch $condition_type {
      if     {template::adp_append_code $condition}
      elseif {template::adp_append_code $condition -nobreak}
  }
Collapse
Posted by Don Baccus on
I've incorporated Bruno and Stephen's changes to the CVS tree.  At long last!  Patience is its own reward etc etc etc ...