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.20 -r1.21 --- openacs-4/packages/ams/catalog/ams.en_US.ISO-8859-1.xml 30 Jan 2006 22:44:59 -0000 1.20 +++ openacs-4/packages/ams/catalog/ams.en_US.ISO-8859-1.xml 9 Feb 2006 20:46:42 -0000 1.21 @@ -19,6 +19,7 @@ Applications Recieved Application Visa Application Visas + Attribute Attribute Name Birthday Birthdays @@ -301,6 +302,7 @@ Genders has been added as an attribute to Heading + Help text Bachelor's Graduation Year Bachelor's Graduation Years Html options @@ -356,6 +358,7 @@ Objects Option Optional + Options Updated Ordering Organization Name Organization Names @@ -423,6 +426,7 @@ Terms of Interest Unmap Unmapped Attributes + Update Options Update Ordering Website Url Visa Country Index: openacs-4/packages/ams/sql/postgresql/ams-create.sql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/sql/postgresql/ams-create.sql,v diff -u -r1.8 -r1.9 --- openacs-4/packages/ams/sql/postgresql/ams-create.sql 22 Nov 2005 16:58:21 -0000 1.8 +++ openacs-4/packages/ams/sql/postgresql/ams-create.sql 9 Feb 2006 20:46:42 -0000 1.9 @@ -45,6 +45,7 @@ constraint ams_attribute_items_dynamic_p_nn not null, deprecated_p boolean default 'f' constraint ams_attribute_items_deprecated_nn not null, + help_text varchar(50), UNIQUE(attribute_id) ); 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 -r1.39 -r1.40 --- openacs-4/packages/ams/tcl/ams-procs.tcl 1 Feb 2006 01:07:37 -0000 1.39 +++ openacs-4/packages/ams/tcl/ams-procs.tcl 9 Feb 2006 20:46:42 -0000 1.40 @@ -47,12 +47,26 @@ return [db_string get_pretty_plural {} -default {}] } +ad_proc -public attribute::help_text { + {-attribute_id:required} +} { + get the help_text of an attribute. +} { + set help_text [lang::util::localize "#acs-translations.ams_attribute_${attribute_id}_help_text#"] + if {[string match "MESSAGE KEY MISSING*" $help_text]} { + return "" + } else { + return $help_text + } +} + ad_proc -public attribute::new { -object_type:required -attribute_name:required -datatype:required -pretty_name:required -pretty_plural:required + {-help_text ""} {-table_name ""} {-column_name ""} {-default_value ""} @@ -80,6 +94,12 @@ 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" + + # Set and update the helptext + # Note: We are not storing the help_text in the attributes table. It is just an I18N string. + if {![string eq "" $help_text]} { + set help_text [lang::util::convert_to_i18n -message_key "ams_attribute_${attribute_id}_help_text" -text "$help_text"] + } return $attribute_id } @@ -104,7 +124,7 @@ ad_proc -public ams::util::edit_lang_key_url { -message:required - {-package_key "ams"} + {-package_key "acs-translations"} } { } { if { [regsub "^${package_key}." [string trim $message "\#"] {} message_key] } { Index: openacs-4/packages/ams/tcl/ams-widget-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/tcl/ams-widget-procs.tcl,v diff -u -r1.20 -r1.21 --- openacs-4/packages/ams/tcl/ams-widget-procs.tcl 31 Jan 2006 00:23:54 -0000 1.20 +++ openacs-4/packages/ams/tcl/ams-widget-procs.tcl 9 Feb 2006 20:46:43 -0000 1.21 @@ -78,7 +78,7 @@ } } ns_log Debug "MGEDDERT DEBUG: return ::ams::widget::${widget} -request $request -attribute_name $attribute_name -pretty_name $pretty_name -value $value -optional_p $optional_p -form_name $form_name -options $options" - return [::ams::widget::${widget} -request $request -attribute_name $attribute_name -pretty_name $pretty_name -value $value -optional_p $optional_p -form_name $form_name -options $options] + return [::ams::widget::${widget} -request $request -attribute_name $attribute_name -pretty_name $pretty_name -value $value -optional_p $optional_p -form_name $form_name -options $options -attribute_id $attribute_id] } else { # the widget requested did not exist ns_log Debug "AMS: the ams widget \"${widget}\" was requested and the associated ::ams::widget::${widget} procedure does not exist" @@ -176,18 +176,19 @@ -value:required -optional_p:required -options:required + -attribute_id:required } { This proc responds to the ams::widget procs. @see ams::widget } { - + set help_text [attribute::help_text -attribute_id $attribute_id] switch $request { ad_form_widget { if { [string is true $optional_p] } { - return "${attribute_name}:address(address),optional {[list label ${pretty_name}]}" + return "${attribute_name}:address(address),optional {help_text $help_text} {[list label ${pretty_name}]}" } else { - return "${attribute_name}:address(address) {[list label ${pretty_name}]}" + return "${attribute_name}:address(address) {help_text $help_text} {[list label ${pretty_name}]}" } } template_form_widget { @@ -260,18 +261,19 @@ -value:required -optional_p:required -options:required + -attribute_id:required } { This proc responds to the ams::widget procs. @see ams::widget } { - + set help_text [attribute::help_text -attribute_id $attribute_id] switch $request { ad_form_widget { if { [string is true $optional_p] } { - return "${attribute_name}:telecom_number(telecom_number),optional {[list label ${pretty_name}]}" + return "${attribute_name}:telecom_number(telecom_number),optional {help_text $help_text} {[list label ${pretty_name}]}" } else { - return "${attribute_name}:telecom_number(telecom_number) {[list label ${pretty_name}]}" + return "${attribute_name}:telecom_number(telecom_number) {help_text $help_text} {[list label ${pretty_name}]}" } } template_form_widget { @@ -342,18 +344,20 @@ -value:required -optional_p:required -options:required + -attribute_id:required } { This proc responds to the ams::widget procs. @see ams::widget } { + set help_text [attribute::help_text -attribute_id $attribute_id] switch $request { ad_form_widget { if { [string is true $optional_p] } { - return "${attribute_name}:date(date),optional {[list label ${pretty_name}]}" + return "${attribute_name}:date(date),optional {help_text $help_text} {[list label ${pretty_name}]}" } else { - return "${attribute_name}:date(date) {[list label ${pretty_name}]}" + return "${attribute_name}:date(date) {help_text $help_text} {[list label ${pretty_name}]}" } } template_form_widget { @@ -417,20 +421,22 @@ -value:required -optional_p:required -options:required + -attribute_id:required } { This proc responds to the ams::widget procs. @see ams::widget } { + set help_text [attribute::help_text -attribute_id $attribute_id] switch $request { ad_form_widget { if { [string is true $optional_p] } { set options [concat [list [list "" ""]] $options] - return "${attribute_name}:integer(select),optional {[list label ${pretty_name}]} {[list options $options]}" + return "${attribute_name}:integer(select),optional {help_text $help_text} {[list label ${pretty_name}]} {[list options $options]}" } else { set options [concat [list [list "- [_ ams.select_one] -" ""]] $options] - return "${attribute_name}:integer(select) {[list label ${pretty_name}]} {[list options $options]}" + return "${attribute_name}:integer(select) {help_text $help_text} {[list label ${pretty_name}]} {[list options $options]}" } } template_form_widget { @@ -491,18 +497,20 @@ -value:required -optional_p:required -options:required + -attribute_id:required } { This proc responds to the ams::widget procs. @see ams::widget } { + set help_text [attribute::help_text -attribute_id $attribute_id] switch $request { ad_form_widget { if { [string is true $optional_p] } { - return "${attribute_name}:integer(radio),optional {[list label ${pretty_name}]} {[list options $options]}" + return "${attribute_name}:integer(radio),optional {help_text $help_text} {[list label ${pretty_name}]} {[list options $options]}" } else { - return "${attribute_name}:integer(radio) {[list label ${pretty_name}]} {[list options $options]}" + return "${attribute_name}:integer(radio) {help_text $help_text} {[list label ${pretty_name}]} {[list options $options]}" } } template_form_widget { @@ -562,18 +570,20 @@ -value:required -optional_p:required -options:required + -attribute_id:required } { This proc responds to the ams::widget procs. @see ams::widget } { + set help_text [attribute::help_text -attribute_id $attribute_id] switch $request { ad_form_widget { if { [string is true $optional_p] } { - return "${attribute_name}:integer(checkbox),multiple,optional {[list label ${pretty_name}]} {[list options $options]}" + return "${attribute_name}:integer(checkbox),multiple,optional {help_text $help_text} {[list label ${pretty_name}]} {[list options $options]}" } else { - return "${attribute_name}:integer(checkbox),multiple {[list label ${pretty_name}]} {[list options $options]}" + return "${attribute_name}:integer(checkbox),multiple {help_text $help_text} {[list label ${pretty_name}]} {[list options $options]}" } } template_form_widget { @@ -635,18 +645,20 @@ -value:required -optional_p:required -options:required + -attribute_id:required } { This proc responds to the ams::widget procs. @see ams::widget } { + set help_text [attribute::help_text -attribute_id $attribute_id] switch $request { ad_form_widget { if { [string is true $optional_p] } { - return "${attribute_name}:integer(multiselect),multiple,optional {[list label ${pretty_name}]} {[list options $options]}" + return "${attribute_name}:integer(multiselect),multiple,optional {help_text $help_text} {[list label ${pretty_name}]} {[list options $options]}" } else { - return "${attribute_name}:integer(multiselect),multiple {[list label ${pretty_name}]} {[list options $options]}" + return "${attribute_name}:integer(multiselect),multiple {help_text $help_text} {[list label ${pretty_name}]} {[list options $options]}" } } template_form_widget { @@ -710,18 +722,20 @@ -value:required -optional_p:required -options:required + -attribute_id:required } { This proc responds to the ams::widget procs. @see ams::widget } { + set help_text [attribute::help_text -attribute_id $attribute_id] switch $request { ad_form_widget { if { [string is true $optional_p] } { - return "${attribute_name}:integer(text),optional {html {size 6}} {[list label ${pretty_name}]}" + return "${attribute_name}:integer(text),optional {html {size 6}} {help_text $help_text} {[list label ${pretty_name}]}" } else { - return "${attribute_name}:integer(text) {html {size 6}} {[list label ${pretty_name}]}" + return "${attribute_name}:integer(text) {html {size 6}} {help_text $help_text} {[list label ${pretty_name}]}" } } template_form_widget { @@ -783,18 +797,21 @@ -value:required -optional_p:required -options:required + -attribute_id:required } { This proc responds to the ams::widget procs. @see ams::widget } { + + set help_text [attribute::help_text -attribute_id $attribute_id] set value [ams::util::text_value -value $value] switch $request { ad_form_widget { if { [string is true $optional_p] } { - return "${attribute_name}:text(text),optional {html {size 30}} {[list label ${pretty_name}]}" + return "${attribute_name}:text(text),optional {html {size 30}} {help_text $help_text} {[list label ${pretty_name}]}" } else { - return "${attribute_name}:text(text) {html {size 30}} {[list label ${pretty_name}]}" + return "${attribute_name}:text(text) {html {size 30}} {help_text $help_text} {[list label ${pretty_name}]}" } } template_form_widget { @@ -857,18 +874,20 @@ -value:required -optional_p:required -options:required + -attribute_id:required } { This proc responds to the ams::widget procs. @see ams::widget } { set value [ams::util::text_value -value $value] + set help_text [attribute::help_text -attribute_id $attribute_id] switch $request { ad_form_widget { if { [string is true $optional_p] } { - return "${attribute_name}:text(textarea),optional {html {cols 60 rows 6}} {[list label ${pretty_name}]}" + return "${attribute_name}:text(textarea),optional {html {cols 60 rows 6}} {help_text $help_text} {[list label ${pretty_name}]}" } else { - return "${attribute_name}:text(textarea) {html {cols 60 rows 10}} {[list label ${pretty_name}]}" + return "${attribute_name}:text(textarea) {html {cols 60 rows 10}} {help_text $help_text} {[list label ${pretty_name}]}" } } template_form_widget { @@ -878,13 +897,15 @@ -datatype text \ -widget textarea \ -html {cols 60 rows 10} \ + -help_text test\ -optional } else { ::template::element::create ${form_name} ${attribute_name} \ -label ${pretty_name} \ -datatype text \ -widget textarea \ - -html {cols 60 rows 10} + -html {cols 60 rows 10} \ + -help_text test } } form_set_value { @@ -930,19 +951,21 @@ -value:required -optional_p:required -options:required + -attribute_id:required } { This proc responds to the ams::widget procs. @see ams::widget } { set value_format [ams::util::text_format -value $value] set value [ams::util::text_value -value $value] + set help_text [attribute::help_text -attribute_id $attribute_id] switch $request { ad_form_widget { if { [string is true $optional_p] } { - return "${attribute_name}:richtext(richtext),optional {html {cols 60 rows 14}} {[list label ${pretty_name}]}" + return "${attribute_name}:richtext(richtext),optional {html {cols 60 rows 14}} {help_text $help_text} {[list label ${pretty_name}]}" } else { - return "${attribute_name}:richtext(richtext) {html {cols 60 rows 14}} {[list label ${pretty_name}]}" + return "${attribute_name}:richtext(richtext) {html {cols 60 rows 14}} {help_text $help_text} {[list label ${pretty_name}]}" } } template_form_widget { @@ -1006,18 +1029,20 @@ -value:required -optional_p:required -options:required + -attribute_id:required } { This proc responds to the ams::widget procs. @see ams::widget } { set value [ams::util::text_value -value $value] + set help_text [attribute::help_text -attribute_id $attribute_id] switch $request { ad_form_widget { if { [string is true $optional_p] } { - return "${attribute_name}:email(text),optional {html {size 30}} {[list label ${pretty_name}]}" + return "${attribute_name}:email(text),optional {html {size 30}} {help_text $help_text} {[list label ${pretty_name}]}" } else { - return "${attribute_name}:email(text) {html {size 30}} {[list label ${pretty_name}]}" + return "${attribute_name}:email(text) {html {size 30}} {help_text $help_text} {[list label ${pretty_name}]}" } } template_form_widget { @@ -1079,18 +1104,20 @@ -value:required -optional_p:required -options:required + -attribute_id:required } { This proc responds to the ams::widget procs. @see ams::widget } { set value [ams::util::text_value -value $value] + set help_text [attribute::help_text -attribute_id $attribute_id] switch $request { ad_form_widget { if { [string is true $optional_p] } { - return "${attribute_name}:url(text),optional {html {size 30}} {[list label ${pretty_name}]}" + return "${attribute_name}:url(text),optional {html {size 30}} {help_text $help_text} {[list label ${pretty_name}]}" } else { - return "${attribute_name}:url(text) {html {size 30}} {[list label ${pretty_name}]}" + return "${attribute_name}:url(text) {html {size 30}} {help_text $help_text} {[list label ${pretty_name}]}" } } template_form_widget { Index: openacs-4/packages/ams/www/attribute-add.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/attribute-add.tcl,v diff -u -r1.8 -r1.9 --- openacs-4/packages/ams/www/attribute-add.tcl 17 Jun 2005 19:18:29 -0000 1.8 +++ openacs-4/packages/ams/www/attribute-add.tcl 9 Feb 2006 20:46:43 -0000 1.9 @@ -28,6 +28,7 @@ {attribute_name:text,optional {label "[_ ams.Attribute_Name]"} {html {size 30 maxlength 100}} {help_text {This name must be lower case, contain only letters and underscores, and contain no spaces. If not specified one will be generated for you.}}} {pretty_name:text,optional {label "[_ ams.Pretty_Name_1]"} {html {size 30 maxlength 100}}} {pretty_plural:text,optional {label "[_ ams.Pretty_Plural_1]"} {html {size 30 maxlength 100}}} + {help_text:text,optional {label "[_ ams.Help_text]"} {html {size 30 maxlength 200}}} } @@ -93,7 +94,7 @@ ::template::element::set_value attribute_form attribute_name $attribute_name } } - set required_fields [list widget pretty_name pretty_plural] + set required_fields [list widget pretty_name] if { [exists_and_not_null option_fields_count] } { lappend required_fields "option1" } @@ -104,9 +105,10 @@ } - # Replace the pretty_name and pretty_plural with the message key, so it is inserted correctly in the database -# set pretty_name [lang::util::convert_to_i18n -text $pretty_name -prefix $object_type] -# set pretty_plural [lang::util::convert_to_i18n -text $pretty_plural -prefix $object_type] + # If there is not pretty_plural, set it to pretty_name + if {[string eq "" $pretty_plural]} { + set pretty_plural $pretty_name + } if { [exists_and_not_null widget] } { ::template::element::set_properties attribute_form widget -widget select -mode display @@ -149,7 +151,9 @@ -attribute_name $attribute_name \ -datatype [::ams::widget -widget $widget -request "widget_datatypes"] \ -pretty_name $pretty_name \ - -pretty_plural $pretty_plural] + -pretty_plural $pretty_plural \ + -help_text $help_text + ] set dynamic_p 1 } else { set attribute_id [attribute::id \ Index: openacs-4/packages/ams/www/attribute.adp =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/attribute.adp,v diff -u -r1.6 -r1.7 --- openacs-4/packages/ams/www/attribute.adp 6 Oct 2005 10:42:04 -0000 1.6 +++ openacs-4/packages/ams/www/attribute.adp 9 Feb 2006 20:46:43 -0000 1.7 @@ -6,6 +6,7 @@

#ams.Attribute_Name# @attribute_info.attribute_name@

#ams.Pretty_Name# @attribute_info.pretty_name@ Edit

#ams.Pretty_Plural# @attribute_info.pretty_plural@ Edit

+

#ams.Help_text# @attribute_info.help_text@Edit

#ams.Widget# @attribute_info.widget@

Index: openacs-4/packages/ams/www/attribute.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/ams/www/attribute.tcl,v diff -u -r1.7 -r1.8 --- openacs-4/packages/ams/www/attribute.tcl 9 Sep 2005 14:06:12 -0000 1.7 +++ openacs-4/packages/ams/www/attribute.tcl 9 Feb 2006 20:46:43 -0000 1.8 @@ -11,11 +11,18 @@ #db_1row get_attribute_info {} ams::attribute::get -attribute_id $attribute_id -array "attribute_info" +set attribute_info(help_text) [attribute::help_text -attribute_id $attribute_id] acs_object_type::get -object_type $attribute_info(object_type) -array "object_info" -set pretty_name_url [ams::util::edit_lang_key_url -message $attribute_info(pretty_name)] -set pretty_plural_url [ams::util::edit_lang_key_url -message $attribute_info(pretty_plural)] +set pretty_name_url [lang::util::edit_lang_key_url -message $attribute_info(pretty_name)] +set pretty_plural_url [lang::util::edit_lang_key_url -message $attribute_info(pretty_plural)] +if {[string eq "" $attribute_info(help_text)]} { + set help_text_url [lang::util::edit_lang_key_url -message "#acs-translations.ams_attribute_${attribute_id}_help_text#"] +} else { + set help_text_url [lang::util::edit_lang_key_url -message $attribute_info(help_text)] +} + set title $attribute_info(pretty_name) set context [list [list objects Objects] [list "object?object_type=$attribute_info(object_type)" $object_info(pretty_name)] $title] @@ -104,7 +111,7 @@ incr sort_count 10 incr sort_key_count 1 set delete_url [export_vars -base "attribute-option-delete" -url {attribute_id option_id}] - set edit_url [ams::util::edit_lang_key_url -message $option] + set edit_url [lang::util::edit_lang_key_url -message $option] } if { [template::multirow size options] > 0 } { 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.6 -r1.7 --- openacs-4/packages/ams/www/list-code.adp 10 Jun 2005 21:50:53 -0000 1.6 +++ openacs-4/packages/ams/www/list-code.adp 9 Feb 2006 20:46:43 -0000 1.7 @@ -22,6 +22,7 @@ -datatype "@attributes.datatype@" \ -pretty_name "@attributes.pretty_name@" \ -pretty_plural "@attributes.pretty_plural@" \ + -help_text "@attributes.help_text@" \ -table_name "@attributes.table_name@" \ -column_name "@attributes.column_name@" \ -default_value "@attributes.default_value@" \ 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.6 -r1.7 --- openacs-4/packages/ams/www/list-code.tcl 10 Jun 2005 21:50:53 -0000 1.6 +++ openacs-4/packages/ams/www/list-code.tcl 9 Feb 2006 20:46:43 -0000 1.7 @@ -26,7 +26,7 @@ regsub -all {"} $list_info(description) {\"} list_info(description) -db_multirow -extend {message_key option_key true_pretty true_plural true_option} -unclobber attributes select_mapped_attributes { +db_multirow -extend {message_key option_key true_pretty true_plural help_text true_option} -unclobber attributes select_mapped_attributes { select alam.required_p, alam.section_heading, alam.sort_order as list_sort_order, @@ -41,12 +41,11 @@ order by alam.sort_order } { regsub -all {"} $section_heading {\"} section_heading - set message_key "${object_type}_${attribute_name}" -# set option [lang::message::lookup en_US [string trim $option "#"]] - set pretty_name [lang::message::lookup en_US [string trim $pretty_name "#"]] + set message_key "${object_type}_${attribute_name}" + set pretty_name [lang::message::lookup en_US [string trim $pretty_name "#"]] set pretty_plural [lang::message::lookup en_US [string trim $pretty_plural "#"]] - -# set true_option [lang::message::lookup en_US acs-translations.$option_key] + set help_text [attribute::help_text -attribute_id $attribute_id] + }