Index: openacs-4/packages/ams/catalog/ams.en_US.ISO-8859-1.xml =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/catalog/ams.en_US.ISO-8859-1.xml,v diff -u -r1.4 -r1.5 --- openacs-4/packages/ams/catalog/ams.en_US.ISO-8859-1.xml 1 Jun 2005 01:25:03 -0000 1.4 +++ openacs-4/packages/ams/catalog/ams.en_US.ISO-8859-1.xml 3 Jun 2005 01:17:56 -0000 1.5 @@ -17,6 +17,7 @@ Checkbox - Multiple Options Allowed Citizenship Citizenships + Copy Country Andorra United Arab Emirates Index: openacs-4/packages/ams/tcl/ams-list-procs-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/tcl/ams-list-procs-postgresql.xql,v diff -u -r1.1 -r1.2 --- openacs-4/packages/ams/tcl/ams-list-procs-postgresql.xql 18 May 2005 17:11:48 -0000 1.1 +++ openacs-4/packages/ams/tcl/ams-list-procs-postgresql.xql 3 Jun 2005 01:17:56 -0000 1.2 @@ -1,95 +1,127 @@ - - - - - - - select * - from ams_lists - where list_id = :list_id - - - - - - - select attribute_id - from ams_list_attribute_map - where list_id = :list_id - - - - - - - select '1' - from ams_lists - where package_key = :package_key - and object_type = :object_type - and list_name = :list_name - - - - - - select list_id - from ams_lists - where package_key = :package_key - and object_type = :object_type - and list_name = :list_name - - - - - - - select ams_list__attribute_map ( - :list_id, - :attribute_id, - :sort_order, - :required_p, - :section_heading - ) - - - - - - select sort_order - from ams_list_attribute_map - where list_id = :list_id - order by sort_order desc - limit 1 - - - - - - delete from ams_list_attribute_map - where list_id = :list_id - and attribute_id = :attribute_id - - - - - - update ams_list_attribute_map - set required_p = 't' - where list_id = :list_id - and attribute_id = :attribute_id - - - - - - update ams_list_attribute_map - set required_p = 'f' - where list_id = :list_id - and attribute_id = :attribute_id - - - - - - - + + + + + + + select * + from ams_lists + where list_id = :list_id + + + + + + + select attribute_id + from ams_list_attribute_map + where list_id = :list_id + + + + + + select pretty_name, + description, + description_mime_type + from ams_lists + where list_id = :from_id + + + + + + insert into ams_list_attribute_map + (list_id,attribute_id,sort_order,required_p,section_heading) + ( select :to_id, + attribute_id, + sort_order, + required_p, + section_heading + from ams_list_attribute_map + where list_id = :from_id ) + + + + + + select '1' + from ams_list_attribute_map + where list_id = :to_id + limit 1 + + + + + + select '1' + from ams_lists + where package_key = :package_key + and object_type = :object_type + and list_name = :list_name + + + + + + select list_id + from ams_lists + where package_key = :package_key + and object_type = :object_type + and list_name = :list_name + + + + + + + select ams_list__attribute_map ( + :list_id, + :attribute_id, + :sort_order, + :required_p, + :section_heading + ) + + + + + + select sort_order + from ams_list_attribute_map + where list_id = :list_id + order by sort_order desc + limit 1 + + + + + + delete from ams_list_attribute_map + where list_id = :list_id + and attribute_id = :attribute_id + + + + + + update ams_list_attribute_map + set required_p = 't' + where list_id = :list_id + and attribute_id = :attribute_id + + + + + + update ams_list_attribute_map + set required_p = 'f' + where list_id = :list_id + and attribute_id = :attribute_id + + + + + + + Index: openacs-4/packages/ams/tcl/ams-list-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/tcl/ams-list-procs.tcl,v diff -u -r1.2 -r1.3 --- openacs-4/packages/ams/tcl/ams-list-procs.tcl 28 May 2005 15:37:27 -0000 1.2 +++ openacs-4/packages/ams/tcl/ams-list-procs.tcl 3 Jun 2005 01:17:56 -0000 1.3 @@ -74,8 +74,53 @@ return [util_memoize_flush [list ams::list::ams_attribute_ids_not_cached -list_id $list_id]] } +ad_proc -public ams::list::copy { + -package_key:required + -object_type:required + -from_list_name:required + -to_list_name:required + {-to_pretty_name ""} + {-to_description ""} + {-to_description_mime_type "text/plain"} + {-to_context_id ""} +} { + Copy one ams_list to another +} { + set to_pretty_name [string trim $to_pretty_name] + set from_id [ams::list::get_list_id_not_cached -package_key $package_key -object_type $object_type -list_name $from_list_name] + if { [exists_and_not_null from_id] } { + set to_id [ams::list::get_list_id_not_cached -package_key $package_key -object_type $object_type -list_name $to_list_name] + if { ![exists_and_not_null to_id] } { + if { ![exists_and_not_null to_pretty_name] } { + db_1row get_from_list_data {} + set to_pretty_name "$pretty_name [_ ams.Copy]" + set to_description $description + set to_description_mime_type $description_mime_type + } + set to_id [ams::list::new \ + -package_key $package_key \ + -object_type $object_type \ + -list_name $to_list_name \ + -pretty_name $to_pretty_name \ + -description $to_description \ + -description_mime_type $to_description_mime_type \ + -context_id $to_context_id] + } + if { $to_id != $from_id } { + if { ![db_0or1row list_has_attributes_mapped {}] } { + db_transaction { + db_dml copy_list {} + } + return 1 + } + } + } + return 0 +} + + ad_proc -private ams::list::exists_p { -package_key:required -object_type:required