etp::define_content_type (public)

 etp::define_content_type content_type pretty_name pretty_plural \
    attribute_metadata

Defined in packages/edit-this-page/tcl/etp-procs.tcl

Call this at server startup time to register the extended page attributes for a particular content type. It ensures that there is a corresponding entry in acs_object_types for the content type, and that for each of the extended page attributes given there is an appropriate entry in acs_attributes. Also, a namespace variable stores all extended page attributes in memory data structure for quick retrieval.

Extended page attribute values are stored in the acs_attribute_values table (so-called "generic" storage) to prevent the necessity of creating a table for each content type. This is the reason we're not using the attribute procs defined in the acs-subsite package, as they only support type-specific storage.

NOTE: get the attribute metadata right the first time. If you decide to add a new attribute to an existing object type, the procedure will create it for you. But it won't process updates to existing attributes or remove them. You'll have to do that by hand.

Parameters:
content_type (required)
The content type you're registering. This name must be unique across all pages that must store extended page attributes.
pretty_name (required)
The display name for the content type
pretty_plural (required)
The plural form of the display name
attribute_metadata (required)
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).
# TODO: other features are needed such as making an attribute optional # and also specifying options for select lists.
Author:
Luke Pond
Created:
2001-05-31

Partial Call Graph (max 5 caller/called nodes):
%3 etp::make_content_type etp::make_content_type (public, deprecated) etp::define_content_type etp::define_content_type etp::make_content_type->etp::define_content_type packages/edit-this-page/tcl/etp-init.tcl packages/edit-this-page/ tcl/etp-init.tcl packages/edit-this-page/tcl/etp-init.tcl->etp::define_content_type db_0or1row db_0or1row (public) etp::define_content_type->db_0or1row db_exec_plsql db_exec_plsql (public) etp::define_content_type->db_exec_plsql etp::create_search_impl etp::create_search_impl (public) etp::define_content_type->etp::create_search_impl

Testcases:
No testcase defined.
[ show source ]
Show another procedure: