attribute-procs.tcl

Procs to help with attributes for object types

Location:
packages/acs-subsite/tcl/attribute-procs.tcl
Created:
Thu Dec 7 10:30:57 2000
Author:
mbryzek@arsdigita.com
CVS Identification:
$Id: attribute-procs.tcl,v 1.20.2.10 2024/02/08 18:04:04 gustafn Exp $

Procedures in this file

Detailed information

ad_page_contract_filter_proc_attribute_dynamic_p (public)

 ad_page_contract_filter_proc_attribute_dynamic_p name value_varname

Checks whether the value (assumed to be an integer) is an attribute of a dynamic type.

Parameters:
name (required)
value_varname (required)
Author:
Michael Bryzek <mbryzek@arsdigita.com>
Created:
12/30/2000

Partial Call Graph (max 5 caller/called nodes):
%3 test_acs_subsite_attributes acs_subsite_attributes (test acs-subsite) ad_page_contract_filter_proc_attribute_dynamic_p ad_page_contract_filter_proc_attribute_dynamic_p test_acs_subsite_attributes->ad_page_contract_filter_proc_attribute_dynamic_p ad_complain ad_complain (public) ad_page_contract_filter_proc_attribute_dynamic_p->ad_complain db_0or1row db_0or1row (public) ad_page_contract_filter_proc_attribute_dynamic_p->db_0or1row

Testcases:
acs_subsite_attributes

attribute::add (public)

 attribute::add [ -default default ] [ -min_n_values min_n_values ] \
    [ -max_n_values max_n_values ] object_type datatype pretty_name \
    pretty_plural

wrapper for the acs_attribute.create_attribute call. Note that this procedure assumes type-specific storage.

Switches:
-default (optional)
-min_n_values (optional)
-max_n_values (optional)
Parameters:
object_type (required)
datatype (required)
pretty_name (required)
pretty_plural (required)
Returns:
The attribute_id of the newly created attribute
Author:
Michael Bryzek <mbryzek@arsdigita.com>
Created:
12/2000

Partial Call Graph (max 5 caller/called nodes):
%3 test_acs_subsite_attributes acs_subsite_attributes (test acs-subsite) attribute::add attribute::add test_acs_subsite_attributes->attribute::add attribute::datatype_to_sql_type attribute::datatype_to_sql_type (private) attribute::add->attribute::datatype_to_sql_type db_0or1row db_0or1row (public) attribute::add->db_0or1row db_string db_string (public) attribute::add->db_string plsql_utility::generate_oracle_name plsql_utility::generate_oracle_name (public) attribute::add->plsql_utility::generate_oracle_name packages/acs-subsite/www/admin/attributes/add-2.tcl packages/acs-subsite/ www/admin/attributes/add-2.tcl packages/acs-subsite/www/admin/attributes/add-2.tcl->attribute::add

Testcases:
acs_subsite_attributes

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 ]

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):
%3 packages/acs-subsite/www/admin/groups/new.tcl packages/acs-subsite/ www/admin/groups/new.tcl attribute::add_form_elements attribute::add_form_elements packages/acs-subsite/www/admin/groups/new.tcl->attribute::add_form_elements packages/acs-subsite/www/admin/parties/new.tcl packages/acs-subsite/ www/admin/parties/new.tcl packages/acs-subsite/www/admin/parties/new.tcl->attribute::add_form_elements packages/acs-subsite/www/admin/relations/add.tcl packages/acs-subsite/ www/admin/relations/add.tcl packages/acs-subsite/www/admin/relations/add.tcl->attribute::add_form_elements packages/acs-subsite/www/admin/users/new.tcl packages/acs-subsite/ www/admin/users/new.tcl packages/acs-subsite/www/admin/users/new.tcl->attribute::add_form_elements packages/acs-subsite/www/register/user-join.tcl packages/acs-subsite/ www/register/user-join.tcl packages/acs-subsite/www/register/user-join.tcl->attribute::add_form_elements attribute::translate_datatype attribute::translate_datatype (public) attribute::add_form_elements->attribute::translate_datatype db_list_of_lists db_list_of_lists (public) attribute::add_form_elements->db_list_of_lists package_object_attribute_list package_object_attribute_list (public) attribute::add_form_elements->package_object_attribute_list template::element template::element (public) attribute::add_form_elements->template::element

Testcases:
No testcase defined.

attribute::array_for_type (public)

 attribute::array_for_type [ -start_with start_with ] \
    [ -include_storage_types include_storage_types ] array_name \
    enum_array_name object_type

Fills in 2 arrays used for displaying attributes

Switches:
-start_with (optional, defaults to "acs_object")
-include_storage_types (optional, defaults to "type_specific")
Parameters:
array_name (required)
The name of the array to hold the basic attribute information. The attributes defined are: * array_name(pretty_name:$name) The pretty_name of the attribute * array_name(id:$name) The attribute_id of the attribute * array_name(datatype:$name) The datatype of the attribute
enum_array_name (required)
The name of the array to hold the pretty name of the values of an enumeration. This is only used when the datatype of the attribute_name is enumeration. This array is a mapping from "$attribute_name:enum_value" to value_pretty_name.
object_type (required)
The object for which we are looking up attributes
Returns:
A list of all the names of attributes we looked up. This list can be used to iterated through the arrays:
            set attr_list [attribute::array_for_type attr_props enum_values "group"]
            foreach key $attr_list {
                set attribute_id $attr_props(id:$attribute_name)
                ...
            }
        
Author:
Michael Bryzek <mbryzek@arsdigita.com>
Created:
1/8/2001

Partial Call Graph (max 5 caller/called nodes):
%3 attribute::multirow attribute::multirow (public) attribute::array_for_type attribute::array_for_type attribute::multirow->attribute::array_for_type packages/acs-subsite/www/admin/relations/one.tcl packages/acs-subsite/ www/admin/relations/one.tcl packages/acs-subsite/www/admin/relations/one.tcl->attribute::array_for_type db_foreach db_foreach (public) attribute::array_for_type->db_foreach

Testcases:
No testcase defined.

attribute::datatype_to_sql_type (private)

 attribute::datatype_to_sql_type [ -default default ] table column \
    datatype

Returns the appropriate sql type for a table definition based on the table, column, datatype, and default value. Note that for default values, this proc automatically generates appropriate constraint names as well.

Switches:
-default (optional)
If specified, we add a default clause to the SQL statement
Parameters:
table (required)
column (required)
datatype (required)
Author:
Michael Bryzek <mbryzek@arsdigita.com>
Created:
12/2000

Partial Call Graph (max 5 caller/called nodes):
%3 attribute::add attribute::add (public) attribute::datatype_to_sql_type attribute::datatype_to_sql_type attribute::add->attribute::datatype_to_sql_type plsql_utility::generate_constraint_name plsql_utility::generate_constraint_name (public) attribute::datatype_to_sql_type->plsql_utility::generate_constraint_name

Testcases:
No testcase defined.

attribute::datatype_validator_exists_p (public)

 attribute::datatype_validator_exists_p datatype

Returns 1 if we have a validator for this datatype. 0 otherwise. We currently do not support the "date" datatype and hardcoded support for enumeration. This is hardcoded in this procedure. Also, this procedure assumes that validators are procedures named ::template::data::validate::$datatype

Parameters:
datatype (required)
Author:
Michael Bryzek <mbryzek@arsdigita.com>
Created:
12/2000

Partial Call Graph (max 5 caller/called nodes):
%3 test_acs_subsite_attribute_datatypes acs_subsite_attribute_datatypes (test acs-subsite) attribute::datatype_validator_exists_p attribute::datatype_validator_exists_p test_acs_subsite_attribute_datatypes->attribute::datatype_validator_exists_p attribute::translate_datatype attribute::translate_datatype (public) attribute::translate_datatype->attribute::datatype_validator_exists_p packages/acs-subsite/www/admin/attributes/add.tcl packages/acs-subsite/ www/admin/attributes/add.tcl packages/acs-subsite/www/admin/attributes/add.tcl->attribute::datatype_validator_exists_p

Testcases:
acs_subsite_attribute_datatypes

attribute::delete (public)

 attribute::delete attribute_id

Delete the specified attribute id and all its values. This is irreversible. Returns 1 if the attribute was actually deleted. 0 otherwise.

Parameters:
attribute_id (required)
Author:
Michael Bryzek <mbryzek@arsdigita.com>
Created:
12/2000

Partial Call Graph (max 5 caller/called nodes):
%3 test_acs_subsite_attributes acs_subsite_attributes (test acs-subsite) attribute::delete attribute::delete test_acs_subsite_attributes->attribute::delete db_0or1row db_0or1row (public) attribute::delete->db_0or1row db_column_exists db_column_exists (public) attribute::delete->db_column_exists db_exec_plsql db_exec_plsql (public) attribute::delete->db_exec_plsql attribute::value_delete attribute::value_delete (public) attribute::value_delete->attribute::delete packages/acs-subsite/www/admin/attributes/delete-2.tcl packages/acs-subsite/ www/admin/attributes/delete-2.tcl packages/acs-subsite/www/admin/attributes/delete-2.tcl->attribute::delete

Testcases:
acs_subsite_attributes

attribute::exists_p (public)

 attribute::exists_p [ -convert_p convert_p ] object_type \
    orig_attribute

Returns 1 if the object type already has an attribute of the given name.

Switches:
-convert_p (optional, defaults to "t")
If t, we convert the attribute using plsql_utility::generate_oracle_name
Parameters:
object_type (required)
orig_attribute (required)
The attribute in which we are interested. Note that if convert_p is set to t, we will internally look for the converted attribute name
Returns:
1 if the object type already has an attribute of the specified name. 0 otherwise
Author:
Michael Bryzek <mbryzek@arsdigita.com>
Created:
12/2000

Partial Call Graph (max 5 caller/called nodes):
%3 test_acs_subsite_attributes acs_subsite_attributes (test acs-subsite) attribute::exists_p attribute::exists_p test_acs_subsite_attributes->attribute::exists_p db_string db_string (public) attribute::exists_p->db_string plsql_utility::generate_oracle_name plsql_utility::generate_oracle_name (public) attribute::exists_p->plsql_utility::generate_oracle_name packages/acs-subsite/www/admin/attributes/add-2.tcl packages/acs-subsite/ www/admin/attributes/add-2.tcl packages/acs-subsite/www/admin/attributes/add-2.tcl->attribute::exists_p

Testcases:
acs_subsite_attributes

attribute::multirow (public)

 attribute::multirow [ -start_with start_with ] \
    [ -include_storage_types include_storage_types ] \
    [ -datasource_name datasource_name ] [ -object_type object_type ] \
    [ -return_url return_url ] object_id

Sets up a multirow datasource containing the attribute values of object_id. We only support specific storage attributes. We include all attributes of the object's type, or any of its supertypes, up to $start_with.

Switches:
-start_with (optional, defaults to "acs_object")
-include_storage_types (optional, defaults to "type_specific")
-datasource_name (optional, defaults to "attributes")
-object_type (optional)
-return_url (optional)
Parameters:
object_id (required)

Partial Call Graph (max 5 caller/called nodes):
%3 packages/acs-subsite/www/admin/groups/one.tcl packages/acs-subsite/ www/admin/groups/one.tcl attribute::multirow attribute::multirow packages/acs-subsite/www/admin/groups/one.tcl->attribute::multirow packages/acs-subsite/www/admin/parties/one.tcl packages/acs-subsite/ www/admin/parties/one.tcl packages/acs-subsite/www/admin/parties/one.tcl->attribute::multirow packages/acs-subsite/www/admin/relations/one.tcl packages/acs-subsite/ www/admin/relations/one.tcl packages/acs-subsite/www/admin/relations/one.tcl->attribute::multirow ad_conn ad_conn (public) attribute::multirow->ad_conn attribute::array_for_type attribute::array_for_type (public) attribute::multirow->attribute::array_for_type db_foreach db_foreach (public) attribute::multirow->db_foreach db_string db_string (public) attribute::multirow->db_string export_vars export_vars (public) attribute::multirow->export_vars

Testcases:
No testcase defined.

attribute::translate_datatype (public)

 attribute::translate_datatype datatype

translates the datatype into one that can be validated. Default datatype is text (when no validator is found)

Parameters:
datatype (required)
Author:
Michael Bryzek <mbryzek@arsdigita.com>
Created:
12/2000

Partial Call Graph (max 5 caller/called nodes):
%3 test_acs_subsite_attribute_datatypes acs_subsite_attribute_datatypes (test acs-subsite) attribute::translate_datatype attribute::translate_datatype test_acs_subsite_attribute_datatypes->attribute::translate_datatype attribute::datatype_validator_exists_p attribute::datatype_validator_exists_p (public) attribute::translate_datatype->attribute::datatype_validator_exists_p attribute::add_form_elements attribute::add_form_elements (public) attribute::add_form_elements->attribute::translate_datatype

Testcases:
acs_subsite_attribute_datatypes

attribute::value_add (public)

 attribute::value_add attribute_id enum_value sort_order

adds the specified enumeration value to the attribute.

Parameters:
attribute_id (required)
The attribute to which we are adding
enum_value (required)
The value which we are adding to the enum
sort_order (required)
Author:
Ben Adida <ben@openforce.net>
Created:
08/2001

Partial Call Graph (max 5 caller/called nodes):
%3 test_acs_subsite_attributes acs_subsite_attributes (test acs-subsite) attribute::value_add attribute::value_add test_acs_subsite_attributes->attribute::value_add db_dml db_dml (public) attribute::value_add->db_dml

Testcases:
acs_subsite_attributes

attribute::value_delete (public)

 attribute::value_delete attribute_id enum_value

deletes the specified enumeration value from the attribute. The net effect is that this attribute will have one fewer options for acceptable values.

Parameters:
attribute_id (required)
The attribute from which we are deleting
enum_value (required)
The value of we are deleting
Author:
Michael Bryzek <mbryzek@arsdigita.com>
Created:
12/2000

Partial Call Graph (max 5 caller/called nodes):
%3 test_acs_subsite_attributes acs_subsite_attributes (test acs-subsite) attribute::value_delete attribute::value_delete test_acs_subsite_attributes->attribute::value_delete attribute::delete attribute::delete (public) attribute::value_delete->attribute::delete db_0or1row db_0or1row (public) attribute::value_delete->db_0or1row db_dml db_dml (public) attribute::value_delete->db_dml db_resultrows db_resultrows (public) attribute::value_delete->db_resultrows packages/acs-subsite/www/admin/attributes/value-delete-2.tcl packages/acs-subsite/ www/admin/attributes/value-delete-2.tcl packages/acs-subsite/www/admin/attributes/value-delete-2.tcl->attribute::value_delete

Testcases:
acs_subsite_attributes
[ show source ]