Index: openacs-4/packages/acs-content-repository/tcl/content-revision-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/content-revision-procs.tcl,v diff -u -r1.4.2.3 -r1.4.2.4 --- openacs-4/packages/acs-content-repository/tcl/content-revision-procs.tcl 9 Jan 2005 23:00:32 -0000 1.4.2.3 +++ openacs-4/packages/acs-content-repository/tcl/content-revision-procs.tcl 13 Jan 2005 01:27:07 -0000 1.4.2.4 @@ -60,7 +60,10 @@ @param creation_ip - @param attributes + @param attributes A list of pairs of additional attributes and + their values to pass to the constructor. Each pair is a list of two + elements: key => value such as + [list attribute value attribute value] @return @@ -93,15 +96,13 @@ lappend valid_attributes [lindex $type_attribute 2] } } - foreach attribute_pair $attributes { - set attribute_name [lindex $attribute_pair 0] - set attribute_value [lindex $attribute_pair 1] + foreach {attribute_name attribute_value} $attributes { if {[lsearch $valid_attributes $attribute_name] > -1} { + # first add the column name to the list + append attribute_names ", ${attribute_name}" # create local variable to use for binding - set $attribute_name $attribute_value - append attribute_names ", ${attribute_name}" append attribute_values ", :${attribute_name}" } } Index: openacs-4/packages/acs-content-repository/tcl/test/content-item-test-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-content-repository/tcl/test/content-item-test-procs.tcl,v diff -u -r1.2.2.7 -r1.2.2.8 --- openacs-4/packages/acs-content-repository/tcl/test/content-item-test-procs.tcl 10 Jan 2005 01:57:07 -0000 1.2.2.7 +++ openacs-4/packages/acs-content-repository/tcl/test/content-item-test-procs.tcl 13 Jan 2005 01:27:07 -0000 1.2.2.8 @@ -126,6 +126,18 @@ -table_name "__test_type" \ -id_column "test_id"] + + ######################################################### + # create an attribute + ######################################################### + content::type::attribute::new \ + -content_type "__test_type" \ + -attribute_name "attribute_name" \ + -datatype "text" \ + -pretty_name "Attribute Name" \ + -pretty_plural "Attribute Names" \ + -column_spec "text" + # todo test that new item is NOT allowed to be created # unless registered by catching error when creating new # item @@ -144,7 +156,7 @@ -item_id $new_type_item_id \ -parent_id $first_folder_id \ -content_type "__test_type" \ - -attributes [list title "Title"]] + -attributes [list title "Title" attribute_name "attribute_value"]] ######################################################### # check that the item exists @@ -157,6 +169,11 @@ -array_name new_type_item] == 1] ######################################################### + # check that extended attribute exists + ######################################################### + aa_true "Extended attribute set" [expr [string equal "attribute_value" \ + $new_type_item(attribute_name)]] + ######################################################### # copy it ######################################################### #TODO