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 -N -r1.24 -r1.25 --- openacs-4/packages/ams/catalog/ams.en_US.ISO-8859-1.xml 26 Apr 2006 08:40:20 -0000 1.24 +++ openacs-4/packages/ams/catalog/ams.en_US.ISO-8859-1.xml 27 Apr 2006 01:09:16 -0000 1.25 @@ -420,6 +420,7 @@ Invalid phone number format. Phone Numbers must by either formatted as AAA-999-9999xEEEE for Country Code "1" (i.e. the United States, Canada, etc.) or 011-CCC-AAA-99999999xEEEE for numbers outside country code "1". Where "C" is country code, "A" is area code, "9" is the phone number and "E" is the extension number. Textarea Textbox + Text Date - text box with pop up calendar The attribute <b>#%attribute_id%</b> is already mapped to another list. If you want to map it to the <b>default %object_type% </b>list please unmap it from the other lists. The attribute <b>#%attribute_id%</b> is already mapped to the <b>default %object_type%</b> list. You don't need to map this attribute to this list. Transcript Visa 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 -N -r1.30 -r1.31 --- openacs-4/packages/ams/tcl/ams-widget-procs.tcl 25 Apr 2006 07:10:50 -0000 1.30 +++ openacs-4/packages/ams/tcl/ams-widget-procs.tcl 27 Apr 2006 01:09:16 -0000 1.31 @@ -725,12 +725,18 @@ set value [::template::element::get_value ${form_name} ${attribute_name}] return [ams::util::time_save -time [template::util::date::get_property ansi $value]] } - value_text - value_html { + value_text { + return [lc_time_fmt $value %x] + } + value_html { return [lc_time_fmt $value %q] -# return [ad_html_text_convert -from "text/plain" -to "text/html" [lc_time_fmt $value %q]] } value_list_text - value_list_html { - set date [lc_time_fmt $value %q] + if { $request eq "value_list_text" } { + set date [lc_time_fmt $value %x] + } else { + set date [lc_time_fmt $value %q] + } set year [lc_time_fmt $value %Y] set month [lc_time_fmt $value "%m (%b)"] return [list date $date year $year month $month] @@ -759,7 +765,101 @@ } } +ad_proc -private ams::widget::textdate { + -request:required + -attribute_name:required + -pretty_name:required + -form_name:required + -value:required + -optional_p:required + -options:required + -attribute_id:required + -html_options:required +} { + This proc responds to the ams::widget procs. + @see ams::widget +} { + if { $value ne "" } { + # we are fed a full date (with timestamp and time zone, + # so we set the value as only the yyyy-mm-dd part + regexp {^([0-9]{4}-[0-9]{2}-[0-9]{2})} $value match value + } + + switch $request { + ad_form_widget { + set help_text [attribute::help_text -attribute_id $attribute_id] + if { [string is true $optional_p] } { + return "${attribute_name}:textdate(textdate),optional {help_text \"$help_text\"} {[list label ${pretty_name}]} {[list html ${html_options}]}" + } else { + return "${attribute_name}:textdate(textdate) {help_text \"$help_text\"} {[list label ${pretty_name}]} {[list html ${html_options}]}" + } + } + template_form_widget { + if { [string is true $optional_p] } { + ::template::element::create ${form_name} ${attribute_name} \ + -label ${pretty_name} \ + -datatype textdate \ + -widget textdate \ + -html $html_options \ + -help \ + -optional + } else { + ::template::element::create ${form_name} ${attribute_name} \ + -label ${pretty_name} \ + -datatype textdate \ + -widget textdate \ + -html $html_options \ + -help + } + } + form_set_value { + ::template::element::set_value ${form_name} ${attribute_name} ${value} + } + form_save_value { + set value [::template::element::get_value ${form_name} ${attribute_name}] + return [ams::util::time_save -time ${value}] + } + value_text { + return [lc_time_fmt $value %x] + } + value_html { + return [lc_time_fmt $value %q] + } + value_list_text - value_list_html { + if { $request eq "value_list_text" } { + set date [lc_time_fmt $value %x] + } else { + set date [lc_time_fmt $value %q] + } + set year [lc_time_fmt $value %Y] + set month [lc_time_fmt $value "%m (%b)"] + return [list date $date year $year month $month] + } + value_list_headings { + return [list date [_ ams.Date] month [_ acs-templating.Month] year [_ acs-templating.Year]] + } + csv_value { + # not yet implemented + } + csv_headers { + # not yet implemented + } + csv_save { + # not yet implemented + } + widget_datatypes { + return [list "textdate"] + } + widget_name { + return [_ "ams.Text_Date"] + } + value_method { + return "ams_value__time" + } + } +} + ad_proc -private ams::widget::select { -request:required -attribute_name:required