Index: openacs-4/packages/cms/www/modules/items/unrelate-item.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/cms/www/modules/items/unrelate-item.tcl,v diff -u -N -r1.1 -r1.2 --- openacs-4/packages/cms/www/modules/items/unrelate-item.tcl 20 Apr 2001 20:51:10 -0000 1.1 +++ openacs-4/packages/cms/www/modules/items/unrelate-item.tcl 24 May 2001 01:30:52 -0000 1.2 @@ -6,35 +6,31 @@ request set_param return_url -datatype text -value "index" request set_param passthrough -datatype text -value [content::assemble_passthrough mount_point] -set db [template::begin_db_transaction] - -# Get the item_id; determine if the relationship exists -template::query item_id onevalue " +db_transaction { + # Get the item_id; determine if the relationship exists + template::query get_item_id item_id onevalue " select item_id from cr_item_rels where rel_id = :rel_id" -if { [template::util::is_nil item_id] } { - ns_db dml $db "abort transaction" - template::release_db_handle - request::error no_such_rel "The relationship $rel_id does not exist." - return -} + if { [template::util::is_nil item_id] } { + db_dml abort "abort transaction" + request::error no_such_rel "The relationship $rel_id does not exist." + return + } -# Check permissions -content::check_access $item_id cm_relate \ - -mount_point $mount_point \ - -return_url "modules/sitemap/index" \ - -db $db + # Check permissions + content::check_access $item_id cm_relate \ + -mount_point $mount_point \ + -return_url "modules/sitemap/index" \ + -db $db -lappend passthrough [list item_id $item_id] + lappend passthrough [list item_id $item_id] -template::query unrelate_item dml " + db_exec_plsql unrelate_item " begin content_item.unrelate ( rel_id => :rel_id ); end;" +} -template::end_db_transaction -template::release_db_handle - template::forward "$return_url?[content::url_passthrough $passthrough]"