| |
790 |
790 |
# query for attribute names and datatypes |
| |
791 |
791 |
foreach attribute [get_attributes $content_type attribute_name datatype default_value ancestor] { |
| |
792 |
792 |
|
| |
793 |
793 |
foreach {attribute_name datatype default_value ancestor} $attribute { break } |
| |
794 |
794 |
|
| |
795 |
795 |
# get the form value |
| |
796 |
796 |
if { [template::element exists $form_name $prefix$attribute_name] } { |
| |
797 |
797 |
|
| |
798 |
798 |
set value [template::element get_value $form_name $prefix$attribute_name] |
| |
799 |
799 |
|
| |
800 |
800 |
# Convert dates to linear "YYYY MM DD HH24 MI SS" format |
| |
801 |
801 |
if { [string equal $datatype date] } { |
| |
802 |
802 |
set value [template::util::date get_property linear_date $value] |
| |
803 |
803 |
foreach i {1 2} { |
| |
804 |
804 |
if {[string equal [lindex $value $i] "00"]} { |
| |
805 |
805 |
set value [lreplace $value $i $i 01] |
| |
806 |
806 |
} |
| |
807 |
807 |
} |
| |
808 |
808 |
} |
| |
809 |
809 |
|
| |
810 |
|
if { ! [string equal $value {} ] } { |
| |
|
810 |
if { ! [string equal $value {} ] && ![expr { [string equal $ancestor "content_revision"] && [string equal $attribute_name "title"] }] } { |
| |
811 |
811 |
ns_set put $bind_vars $attribute_name $value |
| |
812 |
812 |
|
| |
813 |
813 |
lappend columns $attribute_name |
| |
814 |
814 |
lappend values [get_sql_value $attribute_name $datatype] |
| |
815 |
815 |
} |
| |
816 |
816 |
} elseif { ![string equal $ancestor "acs_object"] |
| |
817 |
817 |
&& ( ![string equal $ancestor "cr_revision"] |
| |
818 |
818 |
|| [lsearch -exact {revision_id item_id publish_date} $attribute_name] == -1) } { |
| |
819 |
819 |
# We preserve attributes not in the form and not "special" like acs_object and some of cr_revision. |
| |
820 |
820 |
lappend missing_columns $attribute_name |
| |
821 |
821 |
if {$new_p && ![string equal $default_value {}]} { |
| |
822 |
822 |
ns_set put $bind_vars $attribute_name $default_value |
| |
823 |
823 |
|
| |
824 |
824 |
lappend default_columns $attribute_name |
| |
825 |
825 |
lappend default_values [get_sql_value $attribute_name $datatype] |
| |
826 |
826 |
} |
| |
827 |
827 |
} |
| |
828 |
828 |
} |
| |
829 |
829 |
|
| |
830 |
830 |
if {$new_p} { |