Index: openacs-4/packages/general-comments/tcl/general-comments-callback-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/general-comments/tcl/general-comments-callback-procs.tcl,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/general-comments/tcl/general-comments-callback-procs.tcl 5 May 2007 15:54:47 -0000 1.1 @@ -0,0 +1,21 @@ +ad_library { + Callback Procs for general comments + +} + +namespace eval general_comments {} + + +ad_proc -public -callback general_comments::notify_objects { + {-object_id:required} + {-comment:required} + {-title:required} + {-object_type:required} +} { + This callback is being called once a comment has been added + + @param object_id Object ID of the object to which the comment was added + @param title Title given with the comment + @param comment Comment that was provided. This is HTML. + @param object_type Object Type of the object id. This is useful to quickly say in the package implementations wether you want to deal with the comment or not. +} - Index: openacs-4/packages/general-comments/tcl/general-comments-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/general-comments/tcl/general-comments-procs.tcl,v diff -u -N -r1.19 -r1.20 --- openacs-4/packages/general-comments/tcl/general-comments-procs.tcl 8 Aug 2006 21:26:56 -0000 1.19 +++ openacs-4/packages/general-comments/tcl/general-comments-procs.tcl 5 May 2007 15:54:47 -0000 1.20 @@ -59,6 +59,19 @@ } } + # Convert the comment to HTML + + if {$comment_mime_type ne "text/html"} { + set content [ad_convert_to_html $content] + } + + # Start notifications + callback general_comments::notify_objects \ + -object_id $object_id \ + -comment $content \ + -title $title \ + -object_type [acs_object_type $object_id] + return $revision_id } 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 -N -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 { Index: openacs-4/packages/general-comments/www/delete-2-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/general-comments/www/delete-2-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/general-comments/www/delete-2-oracle.xql 5 May 2007 15:54:47 -0000 1.1 @@ -0,0 +1,17 @@ + + + + oracle8.1.6 + + + + + begin + acs_message.del(:comment_id); + end; + + + + + + Index: openacs-4/packages/general-comments/www/delete-2-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/general-comments/www/delete-2-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/general-comments/www/delete-2-postgresql.xql 5 May 2007 15:54:47 -0000 1.1 @@ -0,0 +1,18 @@ + + + + postgresql7.1 + + + + + begin + PERFORM acs_message__delete(:comment_id); + return 1; + end; + + + + + + Index: openacs-4/packages/general-comments/www/delete-oracle.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/general-comments/www/Attic/delete-oracle.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/general-comments/www/delete-oracle.xql 5 May 2007 15:54:47 -0000 1.1 @@ -0,0 +1,28 @@ + + + + oracle8.1.6 + + + + + select r.title, + r.content, + r.mime_type, + o.creation_user, + to_char(o.creation_date, 'MM-DD-YYYY') as pretty_date, + acs_object.name(o.creation_user) as author + from acs_objects o, + cr_revisions r, + general_comments g + where g.comment_id = :comment_id and + g.comment_id = o.object_id and + r.revision_id = content_item.get_latest_revision(g.comment_id) + + + + + + + + Index: openacs-4/packages/general-comments/www/delete-postgresql.xql =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/general-comments/www/Attic/delete-postgresql.xql,v diff -u -N --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ openacs-4/packages/general-comments/www/delete-postgresql.xql 5 May 2007 15:54:47 -0000 1.1 @@ -0,0 +1,26 @@ + + + + postgresql7.1 + + + + + + select r.title, + r.content, + r.mime_type, + o.creation_user, + to_char(o.creation_date, 'MM-DD-YYYY') as pretty_date, + acs_object__name(o.creation_user) as author + from acs_objects o, + cr_revisions r, + general_comments g + where g.comment_id = :comment_id and + g.comment_id = o.object_id and + r.revision_id = content_item__get_latest_revision(g.comment_id) + + + + +