Index: openacs-4/packages/simulation/www/object-edit.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/simulation/www/Attic/object-edit.tcl,v diff -u -r1.10 -r1.11 --- openacs-4/packages/simulation/www/object-edit.tcl 27 Oct 2003 12:41:24 -0000 1.10 +++ openacs-4/packages/simulation/www/object-edit.tcl 29 Oct 2003 12:57:13 -0000 1.11 @@ -258,9 +258,10 @@ set attributes [list] foreach attribute_name $attr_names { - lappend attributes $attribute_name [set attr__${content_type}__${attribute_name}] + lappend attributes [list $attribute_name [set attr__${content_type}__${attribute_name}]] } + } -new_data { permission::require_permission -privilege create -object_id [ad_conn package_id] @@ -276,39 +277,42 @@ } } - set item_id [bcms::item::create_item \ - -item_name $name \ - -parent_id $parent_id \ - -content_type $content_type] - - switch $content_method($content_type) { - richtext { - set content_text [template::util::richtext::get_property contents $content_elm] - set mime_type [template::util::richtext::get_property format $content_elm] + db_transaction { + + set item_id [bcms::item::create_item \ + -item_name $name \ + -parent_id $parent_id \ + -content_type $content_type] + + switch $content_method($content_type) { + richtext { + set content_text [template::util::richtext::get_property contents $content_elm] + set mime_type [template::util::richtext::get_property format $content_elm] + } + textarea { + set content_text $content_elm + set mime_type "text/plain" + } } - textarea { - set content_text $content_elm - set mime_type "text/plain" + + if { $content_type == "sim_stylesheet" } { + set mime_type "text/css" } - } + + set revision_id [bcms::revision::add_revision \ + -item_id $item_id \ + -title $title \ + -content_type $content_type \ + -mime_type $mime_type \ + -content $content_text \ + -description $description \ + -additional_properties $attributes] - if { $content_type == "sim_stylesheet" } { - set mime_type "text/css" + bcms::revision::set_revision_status \ + -revision_id $revision_id \ + -status "live" } - - set revision_id [bcms::revision::add_revision \ - -item_id $item_id \ - -title $title \ - -content_type $content_type \ - -mime_type $mime_type \ - -content $content_text \ - -description $description \ - -additional_properties $attributes] - bcms::revision::set_revision_status \ - -revision_id $revision_id \ - -status "live" - } -edit_request { permission::require_write_permission -object_id $item_id @@ -342,22 +346,22 @@ } } + db_transaction { - set revision_id [bcms::revision::add_revision \ - -item_id $item_id \ - -title $title \ - -content_type $content_type \ - -mime_type $mime_type \ - -content $content_text \ - -description $description \ - -additional_properties $attributes] + set revision_id [bcms::revision::add_revision \ + -item_id $item_id \ + -title $title \ + -content_type $content_type \ + -mime_type $mime_type \ + -content $content_text \ + -description $description \ + -additional_properties $attributes] - bcms::revision::set_revision_status \ - -revision_id $revision_id \ - -status "live" - + bcms::revision::set_revision_status \ + -revision_id $revision_id \ + -status "live" + } - } -after_submit { ad_returnredirect object-list ad_script_abort