Forum OpenACS Q&A: ETP - news semi-broken

Collapse
Posted by Cathy Sarisky on
I had enough issues with my oacs4.5 install that I'm not entirely
certain this is an actual problem, and not installation weirdness, but
here's what I've got.  If someone else can reproduce, I've got a
working bug-fix I'm testing.

In the ETP-news, if one adds a news item but does not edit and commit
the release date and archive date fields and then goes into the news
index page, an ugly error is thrown due to null values on the dates.
Could someone else with an oacs4.5 install please try this and
confirm?

Thanks!

Side-note:  Is there any way to set a default for a particular
extended attribute?  I haven't seen it in the etp code, but it would
prevent this sort of ugliness..

Collapse
Posted by Dave Bauer on
You can define a tcl proc that will provide a default value when you call etp::define_content_type.

@param content_type The content type you're registering. This name must be unique across all pages that must store extended page attributes.
@param pretty_name The display name for the content type
@param pretty_plural The plural form of the display name
@param attribute_metadata A list of records describing each extended page attribute. Each record is a list containing the following values (in sequence):
  • attribute_name
  • pretty_name
  • pretty_plural
  • datatype (must be one of the entries in acs_datatypes: string, boolean, number, integer, date, etc.)
  • html (a string containing html attributes for the input control. useful attributes are "size=X" to specify the size of standard input controls, and "rows=X cols=X" to specify the size of a textarea. Textareas will be used only if the datatype is string and html specifies rows or cols.)
  • default_value (can either be a string denoting a single default value, or the name of a callback function you've defined in the etp namespace which is used to provide values for select lists).
Collapse
Posted by Dave Bauer on
BTW, I am working on ETP 2.0. See this thread here: https://openacs.org/bboard/q-and-a-fetch-msg.tcl?msg_id=00047q&topic_id=12&topic=OpenACS%204%2e0%20Design

If you are interested in using ETP, I would appreciate any feedback in how we can make it easier to use and extend.