Index: openacs-4/packages/ams/ams.info =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/ams.info,v diff -u -N -r1.8 -r1.9 --- openacs-4/packages/ams/ams.info 9 Sep 2005 14:06:12 -0000 1.8 +++ openacs-4/packages/ams/ams.info 9 Sep 2005 17:43:09 -0000 1.9 @@ -24,6 +24,7 @@ + Index: openacs-4/packages/ams/sql/postgresql/upgrade/upgrade-1.1d2-1.1d3.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/sql/postgresql/upgrade/upgrade-1.1d2-1.1d3.sql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/ams/sql/postgresql/upgrade/upgrade-1.1d2-1.1d3.sql 9 Sep 2005 17:43:09 -0000 1.1 @@ -0,0 +1,53 @@ +-- +-- packages/ams/sql/postgresql/upgrade/upgrade-1.1d1-1.1d2.sql +-- +-- @author Malte Sussdorff (sussdorff@sussdorff.de) +-- @creation-date 2005-08-15 +-- @arch-tag: 8da2f2cc-356f-400d-bbdd-9795acbf6190 +-- @cvs-id $Id: upgrade-1.1d2-1.1d3.sql,v 1.1 2005/09/09 17:43:09 maltes Exp $ +-- + +select define_function_args('ams_option__new','option_id,attribute_id,option,sort_order,depreacted_p;f,creation_date,creation_user,creation_ip,context_id,pretty_name'); + +create or replace function ams_option__new (integer,integer,varchar,integer,boolean,timestamptz,integer,varchar,integer,varchar) +returns integer as ' +declare + p_option_id alias for $1; + p_attribute_id alias for $2; + p_option alias for $3; + p_sort_order alias for $4; + p_deprecated_p alias for $5; + p_creation_date alias for $6; + p_creation_user alias for $7; + p_creation_ip alias for $8; + p_context_id alias for $9; + p_pretty_name alias for $10; + v_option_id integer; + v_sort_order integer; +begin + + v_option_id := acs_object__new ( + p_option_id, + ''ams_option'', + p_creation_date, + p_creation_user, + P_creation_ip, + p_context_id, + ''t'', + p_pretty_name + ); + + if p_sort_order is null then + v_sort_order := v_option_id; + else + v_sort_order := p_sort_order; + end if; + + insert into ams_option_types + (option_id,attribute_id,option,sort_order,deprecated_p) + values + (v_option_id,p_attribute_id,p_option,v_sort_order,p_deprecated_p); + + return v_option_id; +end;' language 'plpgsql'; + Index: openacs-4/packages/ams/tcl/ams-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/tcl/ams-procs.tcl,v diff -u -N -r1.22 -r1.23 --- openacs-4/packages/ams/tcl/ams-procs.tcl 9 Sep 2005 17:08:30 -0000 1.22 +++ openacs-4/packages/ams/tcl/ams-procs.tcl 9 Sep 2005 17:43:09 -0000 1.23 @@ -65,11 +65,8 @@ } { create a new attribute -@see ams::attribute::new + @see ams::attribute::new } { - set pretty_name [lang::util::convert_to_i18n -message_key "ams_attribute_${object_type}_${attribute_name}_pretty_name" -text "$pretty_name"] - set pretty_plural [lang::util::convert_to_i18n -message_key "ams_attribute_${object_type}_${attribute_name}_pretty_plural" -text "$pretty_plural"] - if { $if_does_not_exist_p } { set attribute_id [attribute::id -object_type $object_type -attribute_name $attribute_name] if { [string is false [exists_and_not_null attribute_id]] } { @@ -78,6 +75,11 @@ } else { set attribute_id [db_string create_attribute {}] } + + # Update the pretty names + set pretty_name [lang::util::convert_to_i18n -message_key "ams_attribute_${attribute_id}_pretty_name" -text "$pretty_name"] + set pretty_plural [lang::util::convert_to_i18n -message_key "ams_attribute_${attribute_id}_pretty_plural" -text "$pretty_plural"] + db_dml update_pretty_names "update acs_attributes set pretty_name = :pretty_name, pretty_plural = :pretty_plural where attribute_id = :attribute_id" return $attribute_id }