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.6 -r1.7 --- openacs-4/packages/ams/catalog/ams.en_US.ISO-8859-1.xml 3 Jun 2005 05:09:49 -0000 1.6 +++ openacs-4/packages/ams/catalog/ams.en_US.ISO-8859-1.xml 7 Jun 2005 07:44:13 -0000 1.7 @@ -2,9 +2,11 @@ Action + Add an AMS Attribute Add Attribute Add Heading Address + AMS Attributes Answer Optional Answer Required Application Recieved @@ -315,6 +317,7 @@ No Mail No Mails Object Type + Option Optional Ordering Organization Name @@ -335,7 +338,9 @@ Zip/Postal Code Prefix Prefixes + Pretty Name Pretty Name + Pretty Name Plural Pretty Plural Preview the Input Form Program @@ -356,6 +361,7 @@ School Types Drop Down List - One Option Allowed Select One + Sort Order Suffix Suffixes Phone Number @@ -368,6 +374,7 @@ Terms of Interest Unmap Unmapped Attributes + Update Options Update Ordering Website Url Visa Country @@ -378,6 +385,7 @@ Visa Types Visa Transferred from School Visas Transferred from School + Widget Widget Work Permit Work Permits Index: openacs-4/packages/ams/tcl/telecom-number-widget-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/tcl/telecom-number-widget-procs.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/ams/tcl/telecom-number-widget-procs.tcl 21 May 2005 17:49:23 -0000 1.4 +++ openacs-4/packages/ams/tcl/telecom-number-widget-procs.tcl 7 Jun 2005 07:44:13 -0000 1.5 @@ -50,7 +50,7 @@ set telecom_number "" if { [parameter::get_from_package_key -parameter "ForceCountryCodeOneFormatting" -package_key "ams" -default "0"] } { if { $national_number != "1" } { - set telecom_number "011-${national_number}-" + set telecom_number "[_ ams.international_dial_code]${national_number}-" } } else { set telecom_number ${national_number} @@ -113,8 +113,8 @@ set telecom_number_temp "$itu_id$national_number$area_city_code$subscriber_number$extension$sms_enabled_p$best_contact_time" regsub -all " " $telecom_number_temp "" telecom_number_temp ns_log Notice $telecom_number_temp - if { ![regexp {^([0-9]|x|-|\)|\(){1,}$} $telecom_number_temp match telecom_number_temp] } { - set message [_ ams.Telecom_numbers_must_only_contain_numbers_dashes_and_x_es_and_rounded_braces] + if { ![regexp {^([0-9]|x|-|\+|\)|\(){1,}$} $telecom_number_temp match telecom_number_temp] } { + set message [_ ams.lt_Telecom_numbers_must_only_contain] } } else { # we have a number in country code one that must follow certain formatting guidelines @@ -125,7 +125,7 @@ # users know how they are supposed to format numbers. if { ![exists_and_not_null area_city_code] || ![exists_and_not_null national_number] } { - set message [_ ams.Telecom_numbers_in_country_code_one_must_be_formatted_like_AAA-SSS-SSSSxXXXX_out_of_country_like_011-CCC-AAAA-SSSS-SSSxXXXX] + set message [_ ams.lt_Telecom_numbers_in_country_code] } } Index: openacs-4/packages/ams/www/attribute-options-update.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/attribute-options-update.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/ams/www/attribute-options-update.tcl 28 May 2005 15:37:27 -0000 1.3 +++ openacs-4/packages/ams/www/attribute-options-update.tcl 7 Jun 2005 07:44:14 -0000 1.4 @@ -1,50 +1,58 @@ ad_page_contract { - Update sort order @author Matthew Geddert openacs@geddert.com @creation-date 2004-07-28 @cvs-id $Id$ - - } { option:array sort_key:array attribute_id:integer,notnull } -# first we check to see if there are new options. -# if yes we add them + +# first we check to see if there are new options. if yes we add them + foreach option_key [list new1 new2 new3] { set option_string [string trim $option(${option_key})] - if { [exists_and_not_null option_string] } { - set option_id [ams::option::new -attribute_id $attribute_id -option $option_string] + if {[exists_and_not_null option_string]} { + + # Replace the pretty_name and pretty_plural with the message key, so it is inserted correctly in the database + set option_string [lang::util::convert_to_i18n -text $option_string -prefix "ams_option"] + + set option_id [ams::option::new \ + -attribute_id $attribute_id \ + -option $option_string] set sort_key(${option_id}) $sort_key(${option_key}) } } -# now that all the options are in the database we get the "old" sort order -# if not value for sort_key is provided we will keep the same order as before -set option_ids [db_list get_option_ids { select option_id from ams_option_types where attribute_id = :attribute_id order by sort_order }] +# now that all the options are in the database we get the "old" sort +# order if not value for sort_key is provided we will keep the same +# order as before -# first we get the highest sort_order so variables without a sort_order can be given one +set option_ids [db_list get_option_ids {select option_id from ams_option_types where attribute_id = :attribute_id order by sort_order}] + +# first we get the highest sort_order so variables without a +# sort_order can be given one + set highest_sort 0 foreach option_id $option_ids { - if { $sort_key(${option_id}) > $highest_sort } { + if {$sort_key(${option_id}) > $highest_sort} { set highest_sort $sort_key(${option_id}) - } + } } - db_transaction { foreach option_id $option_ids { set sort_order $sort_key(${option_id}) incr highest_sort - db_dml update_sort_order { update ams_option_types set sort_order = :highest_sort where sort_order = :sort_order and attribute_id = :attribute_id } - if { ![exists_and_not_null sort_order] } { + db_dml update_sort_order {update ams_option_types set sort_order = :highest_sort where sort_order = :sort_order and attribute_id = :attribute_id} + if {![exists_and_not_null sort_order]} { incr highest_sort 1 - set sort_order $highest_sort + set sort_order $highest_sort } - db_dml update_sort_order { update ams_option_types set sort_order = :sort_order where option_id = :option_id } + db_dml update_sort_order {update ams_option_types set sort_order = :sort_order where option_id = :option_id} } } -ad_returnredirect -message "[_ ams.Options_Updated]" "attribute?[export_vars -url {attribute_id}]" +ad_returnredirect -message "[_ ams.Options_Updated]" "attribute?[export_vars \ +-url {attribute_id}]" Index: openacs-4/packages/ams/www/attribute.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/attribute.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/packages/ams/www/attribute.tcl 28 May 2005 15:37:27 -0000 1.3 +++ openacs-4/packages/ams/www/attribute.tcl 7 Jun 2005 07:44:14 -0000 1.4 @@ -34,7 +34,7 @@ } -bulk_action_export_vars { attribute_id } -bulk_actions { - "[_ acs-kernel.common_Update]" "attribute-options-update" "[_ ams.Update_Options]" + "#acs-kernel.common_Update#" "attribute-options-update" "#ams.Update_Options#" } -elements { edit { label {} Index: openacs-4/packages/ams/www/list-code.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/list-code.adp,v diff -u -r1.4 -r1.5 --- openacs-4/packages/ams/www/list-code.adp 3 Jun 2005 05:10:18 -0000 1.4 +++ openacs-4/packages/ams/www/list-code.adp 7 Jun 2005 07:44:14 -0000 1.5 @@ -32,8 +32,8 @@ -static_p "@attributes.static_p@" \ -if_does_not_exist] -lang::message::register en_US ams @attributes.message_key@ "@attributes.true_pretty@" -lang::message::register en_US ams @attributes.message_key@_plural "@attributes.true_plural@" +lang::message::register en_US acs-translations @attributes.message_key@ "@attributes.true_pretty@" +lang::message::register en_US acs-translations @attributes.message_key@_plural "@attributes.true_plural@" ams::attribute::new \ -attribute_id $attribute_id \ @@ -46,6 +46,16 @@ -sort_order "@attributes.list_sort_order@" \ -required_p "@attributes.required_p@" \ -section_heading "@attributes.section_heading@" + + + +set option_id [ams::option::new \ + -attribute_id $attribute_id \ + -option "\#@attributes.option@#"] + +lang::message::register en_US acs-translations @attributes.option_key@ "@attributes.true_option@" + + Index: openacs-4/packages/ams/www/list-code.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/list-code.tcl,v diff -u -r1.4 -r1.5 --- openacs-4/packages/ams/www/list-code.tcl 28 May 2005 15:37:27 -0000 1.4 +++ openacs-4/packages/ams/www/list-code.tcl 7 Jun 2005 07:44:14 -0000 1.5 @@ -26,24 +26,34 @@ regsub -all {"} $list_info(description) {\"} list_info(description) -db_multirow -extend {message_key true_pretty true_plural} -unclobber attributes select_mapped_attributes { +db_multirow -extend {message_key option_key true_pretty true_plural true_option} -unclobber attributes select_mapped_attributes { select alam.required_p, alam.section_heading, alam.sort_order as list_sort_order, + aot.option_id, + aot.option, ams.* from ams_list_attribute_map alam, ams_attributes ams + left outer join ams_option_types aot on (ams.attribute_id=aot.attribute_id) where alam.list_id = :list_id and alam.attribute_id = ams.attribute_id order by alam.sort_order } { regsub -all {"} $section_heading {\"} section_heading set message_key "${object_type}_${attribute_name}" - set pretty_name ams.$message_key - set pretty_plural ams.${message_key}_plural - set true_pretty [lang::message::lookup en_US ams.$message_key] - set true_plural [lang::message::lookup en_US ams.${message_key}_plural] + set option_key "${message_key}_[lang::util::suggest_key $option]" + set pretty_name "acs-translation.$message_key" + set pretty_plural "acs-translation.${message_key}_plural" + set true_pretty [lang::message::lookup en_US acs-translations.$message_key] + set true_plural [lang::message::lookup en_US acs-translations.${message_key}_plural] + set true_option $option + set option "acs-translation.$option_key" +# set true_option [lang::message::lookup en_US acs-translations.$option_key] } + + + ad_return_template