Index: openacs-4/packages/acs-object-management/tcl/view-attribute-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/acs-object-management/tcl/view-attribute-procs.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/acs-object-management/tcl/view-attribute-procs.tcl 14 Aug 2009 01:06:08 -0000 1.2 +++ openacs-4/packages/acs-object-management/tcl/view-attribute-procs.tcl 27 Nov 2009 00:38:50 -0000 1.3 @@ -6,11 +6,10 @@ @cvs-id $Id$ } -namespace eval object_type {} -namespace eval object_type::view {} -namespace eval object_type::view::attribute {} +namespace eval object_view {} +namespace eval object_view::attribute {} -ad_proc object_type::view::attribute::copy { +ad_proc object_view::attribute::copy { -to_object_view:required -from_object_view -attribute_id:required @@ -21,17 +20,19 @@ @param attribute_id The attribute_id to copy. } { set object_type \ - [object_type::view::get_element -object_view $to_object_view -element object_type] + [object_view::get_element -object_view $to_object_view -element object_type] if { ![info exists from_object_view] } { set from_object_view [object_type::get_root_view -object_type $object_type] } db_dml copy {} - object_type::view::flush_cache -object_view $to_object_view + object_view::flush_cache -object_view $to_object_view + set var_list [list [list object_view $to_object_view]] + package_exec_plsql -var_list $var_list acs_view create_sql_view } -ad_proc object_type::view::attribute::delete { +ad_proc object_view::attribute::delete { -object_view:required -attribute_id:required } { @@ -41,5 +42,47 @@ @param attribute_id:required } { db_dml delete {} - object_type::view::flush_cache -object_view $object_view + object_view::flush_cache -object_view $object_view + set var_list [list [list object_view $object_view]] + package_exec_plsql -var_list $var_list acs_view create_sql_view } + +ad_proc object_view::attribute::get { + -object_view:required + -attribute_id:required + -array:required +} { + + Get the metadata for the given view attribute and place it in the named array at the + caller's level. + + @param object_view The object type this attribute belongs to. + @param attribute_name The name of the attribute. + @param array The name of the array to store the metadata in. + +} { + upvar $array row + db_1row -cache_pool acs_metadata \ + -cache_key v::${object_view}::${attribute_id}::attribute::get \ + get {} -column_array row +} + +ad_proc object_view::attribute::get_element { + -object_view:required + -attribute_id:required + -element:required +} { + + Get the metadata for the given view attribute and return the requested element. + + @param object_type The object type this attribute belongs to. + @param attribute_name The name of the attribute. + +} { + object_view::attribute::get \ + -object_view $object_view \ + -attribute_id $attribute_id \ + -array row + return $row($element) +} +