attribute::add_form_elements (public)
attribute::add_form_elements [ -form_id form_id ] \ [ -start_with start_with ] [ -object_type object_type ] \ [ -variable_prefix variable_prefix ]
Defined in packages/acs-subsite/tcl/attribute-procs.tcl
Adds form elements to the specified form_id. Each form element corresponds to an attribute belonging to the given object_type.
- Switches:
- -form_id (optional)
- ID of a form to add form elements to.
- -start_with (optional, defaults to
"acs_object"
)- Object type to start with. Defaults to acs_object.
- -object_type (optional, defaults to
"acs_object"
)- Object type to extract attributes for. Defaults to acs_object.
- -variable_prefix (optional)
- Variable prefix.
- Partial Call Graph (max 5 caller/called nodes):
- Testcases:
- No testcase defined.
Source code: if {$form_id eq ""} { error "attribute::add_form_elements - form_id not specified" } if {$object_type eq ""} { error "attribute::add_form_elements - object type not specified" } if {$variable_prefix ne ""} { append variable_prefix "." } # pull out all the attributes up the hierarchy from this object_type # to the $start_with object type set attr_list_of_lists [package_object_attribute_list -start_with $start_with $object_type] foreach row $attr_list_of_lists { lassign $row attribute_id . attribute_name pretty_name datatype required_p default # Might translate the datatype into one for which we have a # validator (e.g. a string datatype would change into text). set datatype [translate_datatype $datatype] if {$datatype eq "enumeration"} { # For enumerations, we generate a select box of all the possible values set option_list [db_list_of_lists select_enum_values { select enum.pretty_name, enum.enum_value from acs_enum_values enum where enum.attribute_id = :attribute_id order by enum.sort_order }] if {$required_p == "f"} { # This is not a required option list... offer a default lappend option_list [list " (no value) " ""] } template::element create $form_id "$variable_prefix$attribute_name" -datatype "text" [expr {$required_p eq "f" ? "-optional" : ""}] -widget select -options $option_list -label "$pretty_name" -value $default } else { template::element create $form_id "$variable_prefix$attribute_name" -datatype $datatype [expr {$required_p eq "f" ? "-optional" : ""}] -widget text -label $pretty_name -value $default } }Generic XQL file: packages/acs-subsite/tcl/attribute-procs.xql
PostgreSQL XQL file: packages/acs-subsite/tcl/attribute-procs-postgresql.xql
Oracle XQL file: packages/acs-subsite/tcl/attribute-procs-oracle.xql