Index: openacs-4/packages/dynamic-types/tcl/dynamic-type-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dynamic-types/tcl/dynamic-type-procs.tcl,v diff -u -r1.8 -r1.9 --- openacs-4/packages/dynamic-types/tcl/dynamic-type-procs.tcl 4 Sep 2005 12:13:28 -0000 1.8 +++ openacs-4/packages/dynamic-types/tcl/dynamic-type-procs.tcl 25 Apr 2006 12:10:41 -0000 1.9 @@ -40,22 +40,25 @@ continue } switch $datatype { - date - - timestamp - - time_of_day { - set format "'YYYY-MM-DD HH24:MI:SS'" - lappend columns "to_char($column_name, $format) as $name" - } - default { - lappend columns "$column_name as $name" - } + date - + timestamp - + time_of_day { + set format "'YYYY-MM-DD HH24:MI:SS'" + lappend columns "to_char($column_name, $format) as $name" + } + boolean { + lappend columns "case when $column_name = true then 't' else 'f' end as $name" + } + default { + lappend columns "$column_name as $name" + } } } if {[llength $columns] > 0} { db_1row select_table_name {} set columns [join $columns ", "] - db_0or1row select_object {} -column_array local + db_0or1row select_object {} -column_array data } dtype::form::metadata::widgets -object_type $object_type \ @@ -73,7 +76,7 @@ for {set w 1} {$w <= $widget_count} {incr w} { template::multirow get widgets $w - if {[lsearch -exact [list "select" "multiselect" "checkbox" "radio"] $widgets(widget)] > -1} { + if {$dform != "implicit" && ([lsearch -exact [list "select" "multiselect" "checkbox" "radio"] $widgets(widget)] > -1)} { for {set p 1} {$p <= $param_count} {incr p} { template::multirow get params $p @@ -82,16 +85,18 @@ continue; } - set options [dtype::form::parameter_value -parameter params -vars $variables] + set options [lang::util::localize [dtype::form::parameter_value -parameter params -vars $variables]] set new_value "" - set old_value $local($widgets(attribute_name)) + set old_value $data($widgets(attribute_name)) foreach option $options { if {[lsearch -exact $old_value [lindex $option 1]] > -1} { lappend new_value [lindex $option 0] } } set local($widgets(attribute_name)) [join $new_value ", "] } + } else { + set local($widgets(attribute_name)) $data($widgets(attribute_name)) } } } Index: openacs-4/packages/dynamic-types/tcl/form-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/dynamic-types/tcl/form-procs.tcl,v diff -u -r1.12 -r1.13 --- openacs-4/packages/dynamic-types/tcl/form-procs.tcl 6 Apr 2006 11:59:47 -0000 1.12 +++ openacs-4/packages/dynamic-types/tcl/form-procs.tcl 25 Apr 2006 12:10:41 -0000 1.13 @@ -111,9 +111,11 @@ set type_dform $dform } - dtype::get_object -object_id $object_id \ - -object_type $object_type \ - -array object + if {$action != "new"} { + dtype::get_object -object_id $object_id \ + -object_type $object_type \ + -array object + } set object(object_id) $object_id dtype::form::add_type_elements -object_array object \ @@ -345,9 +347,9 @@ set crv_$attributes(name) "" - ns_log notice "PROCESSING: $attributes(name)" + ns_log debug "PROCESSING: $attributes(name)" if {[info exists widgets($attributes(attribute_id))]} { - ns_log notice "PROCESSING: found $attributes(name) in form" + ns_log debug "PROCESSING: found $attributes(name) in form" # first check for the attribute in the submitted form array set this_widget_info $widgets($attributes(attribute_id)) switch $this_widget_info(widget) { @@ -392,6 +394,9 @@ date - time_of_day - timestamp { lappend values [template::util::date::get_property sql_date [lindex [set crv_$attributes(name)] 0]] } + boolean { + lappend values [ad_decode [set crv_$attributes(name)] t true false] + } default { lappend values ":crv_$attributes(name)" } @@ -583,7 +588,7 @@ } } - ns_log Notice "CREATE::: $element_create_cmd" + ns_log Debug "CREATE::: $element_create_cmd" # Get all the params for this element for {set p 1} {$p <= $param_count} {incr p} { template::multirow get params $p @@ -595,7 +600,7 @@ continue } - set value [dtype::form::parameter_value -parameter params -vars $variables] + set value [lang::util::localize [dtype::form::parameter_value -parameter params -vars $variables]] # determine if the parameter value is null switch $params(param_type) {