Index: openacs-4/packages/general-comments/www/comment-add-3.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/general-comments/www/comment-add-3.tcl,v diff -u -r1.8 -r1.9 --- openacs-4/packages/general-comments/www/comment-add-3.tcl 8 Aug 2006 21:26:56 -0000 1.8 +++ openacs-4/packages/general-comments/www/comment-add-3.tcl 5 May 2007 15:54:47 -0000 1.9 @@ -34,66 +34,19 @@ # insert the comment into the database set creation_ip [ad_conn peeraddr] set is_live [ad_parameter AutoApproveCommentsP {general-comments} {t}] -db_transaction { - db_exec_plsql insert_comment { - begin - :1 := acs_message.new ( - message_id => :comment_id, - title => :title, - mime_type => :comment_mime_type, - data => empty_blob(), - context_id => :context_id, - creation_user => :user_id, - creation_ip => :creation_ip, - is_live => :is_live - ); - end; - } - db_dml add_entry { - insert into general_comments - (comment_id, - object_id, - category) - values - (:comment_id, - :object_id, - :category) - } +general_comment_new \ + -object_id $object_id \ + -comment_id $comment_id \ + -title $title \ + -comment_mime_type $comment_mime_type \ + -context_id $context_id \ + -user_id $user_id \ + -creation_ip $creation_ip \ + -is_live $is_live \ + -category $category \ + -content $content - db_1row get_revision { - select content_item.get_latest_revision(:comment_id) as revision_id - from dual - } - - db_dml set_content { - update cr_revisions - set content = empty_blob() - where revision_id = :revision_id - returning content into :1 - } -blobs [list $content] - - # Grant the user sufficient permissions to - # created comment. This is done here to ensure that - # a fail on permissions granting will not leave - # the comment with incorrect permissions. - db_exec_plsql grant_permission { - begin - acs_permission.grant_permission ( - object_id => :comment_id, - grantee_id => :user_id, - privilege => 'read' - ); - acs_permission.grant_permission ( - object_id => :comment_id, - grantee_id => :user_id, - privilege => 'write' - ); - - end; - } -} - if { [string equal $attach_p "f"] && ![empty_string_p $return_url] } { ad_returnredirect $return_url } else {