Index: openacs-4/packages/general-comments/tcl/general-comments-procs-oracle.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/general-comments/tcl/general-comments-procs-oracle.xql,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/general-comments/tcl/general-comments-procs-oracle.xql 28 Aug 2003 09:41:54 -0000 1.3
+++ openacs-4/packages/general-comments/tcl/general-comments-procs-oracle.xql 29 Sep 2003 17:45:48 -0000 1.4
@@ -84,5 +84,46 @@
+
+
+
+
+ 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;
+
+
+
+
+
+
+
+ select content_item.get_latest_revision(:comment_id) as revision_id
+ from dual
+
+
+
+
+
+
+
+
+ update cr_revisions
+ set content = empty_blob()
+ where revision_id = :revision_id
+ returning content into :1
+
+
+
+
Index: openacs-4/packages/general-comments/tcl/general-comments-procs-postgresql.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/general-comments/tcl/general-comments-procs-postgresql.xql,v
diff -u -r1.3 -r1.4
--- openacs-4/packages/general-comments/tcl/general-comments-procs-postgresql.xql 28 Aug 2003 09:41:54 -0000 1.3
+++ openacs-4/packages/general-comments/tcl/general-comments-procs-postgresql.xql 29 Sep 2003 17:45:48 -0000 1.4
@@ -84,5 +84,48 @@
+
+
+ select acs_message__new (
+ :comment_id, -- 1 p_message_id
+ NULL, -- 2 p_reply_to
+ current_timestamp, -- 3 p_sent_date
+ NULL, -- 4 p_sender
+ NULL, -- 5 p_rfc822_id
+ :title, -- 6 p_title
+ NULL, -- 7 p_description
+ :comment_mime_type, -- 8 p_mime_type
+ NULL, -- 9 p_text
+ NULL, -- empty_blob(), -- 10 p_data
+ 0, -- 11 p_parent_id
+ :context_id, -- 12 p_context_id
+ :user_id, -- 13 p_creation_user
+ :creation_ip, -- 14 p_creation_ip
+ 'acs_message', -- 15 p_object_type
+ :is_live -- 16 p_is_live
+ )
+
+
+
+
+
+
+ select content_item__get_latest_revision(:comment_id) as revision_id
+
+
+
+
+
+
+
+
+
+ update cr_revisions
+ set content = :content
+ where revision_id = :revision_id
+
+
+
+
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 -r1.9 -r1.10
--- openacs-4/packages/general-comments/tcl/general-comments-procs.tcl 28 Aug 2003 09:41:54 -0000 1.9
+++ openacs-4/packages/general-comments/tcl/general-comments-procs.tcl 29 Sep 2003 17:45:48 -0000 1.10
@@ -15,6 +15,69 @@
@cvs-id $Id$
}
+
+ad_proc general_comment_new {
+ -object_id
+ -comment_id
+ -title
+ -comment_mime_type
+ -context_id
+ {-user_id ""}
+ {-creation_ip ""}
+ -is_live
+ -category
+ -content
+} {
+
+ 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)
+ }
+
+ db_1row get_revision {}
+
+ db_dml set_content {} -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.
+ if {![empty_string_p $user_id]} {
+ permission::grant -object_id $comment_id \
+ -party_id $user_id \
+ -privilege "read"
+
+ permission::grant -object_id $comment_id \
+ -party_id $user_id \
+ -privilege "write"
+
+ }
+ }
+ return $revision_id
+}
+
ad_proc -public general_comments_get_comments {
{ -print_content_p 0 }
{ -print_attachments_p 0 }
Index: openacs-4/packages/general-comments/tcl/general-comments-procs.xql
===================================================================
RCS file: /usr/local/cvsroot/openacs-4/packages/general-comments/tcl/general-comments-procs.xql,v
diff -u -r1.1 -r1.2
--- openacs-4/packages/general-comments/tcl/general-comments-procs.xql 14 Jun 2001 19:38:05 -0000 1.1
+++ openacs-4/packages/general-comments/tcl/general-comments-procs.xql 29 Sep 2003 17:45:48 -0000 1.2
@@ -29,5 +29,20 @@
+
+
+
+ insert into general_comments
+ (comment_id,
+ object_id,
+ category)
+ values
+ (:comment_id,
+ :object_id,
+ :category)
+
+
+
+