Index: openacs-4/contrib/packages/general-comments/tcl/general-comments-procs.tcl =================================================================== RCS file: /usr/local/cvsroot/openacs-4/contrib/packages/general-comments/tcl/Attic/general-comments-procs.tcl,v diff -u -r1.3 -r1.4 --- openacs-4/contrib/packages/general-comments/tcl/general-comments-procs.tcl 28 May 2003 00:54:13 -0000 1.3 +++ openacs-4/contrib/packages/general-comments/tcl/general-comments-procs.tcl 5 Jun 2003 00:50:27 -0000 1.4 @@ -22,27 +22,31 @@ } namespace eval general_comments {} +namespace eval general_comments::general_comment {} -ad_proc general_comments::general_comment { +ad_proc general_comments::general_comment::create { -object_id -comment_id -title -comment_mime_type -context_id {-user_id ""} {-creation_ip ""} + {-parent_id ""} -package_id -is_live -content } { - + # for now + set description $title + db_transaction { db_exec_plsql insert_comment {} - + db_1row get_revision { - select content_item.get_latest_revision(:comment_id) as revision_id + select content_item__get_latest_revision(:comment_id) as revision_id from dual - } + } db_dml set_content { update cr_revisions @@ -56,7 +60,7 @@ # 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 \ + permission::grant -object_id $comment_id \ -party_id $user_id \ -privilege "read" @@ -65,129 +69,11 @@ -privilege "write" } - } - return $revision_id -} - -ad_proc -public general_comments::get_comments_multirow { - -object_id - { -name comments } - { -return_url {}} - { -print_content:boolean } - { -print_attachments:boolean } -} { - Generates a multirow datasource in the callers namespace containing the - comment data. - - @param print_content switch: specify to print out content of comments. - @param print_attachments switch: specify to print out attachments of comments, - only works if print_content_p is also specified - @param object_id The object_id to retrieve the comments for. - @param name name of the multirow datasource to create - @param return_url A url for the user to return to after viewing a comment. - -} { - # ewww, return a multirow in the variable specified! DaveB - - # get the package url - #[general_comments_package_url] - #if { [empty_string_p $package_url] } { - return "" - #} - - # initialize variables - if { $print_content_p == 0 } { - set content_select "" - set content "" - } else { - set content_select [db_map content_select] ;# ", r.content" } - upvar $name $name - db_multirow $name get_comments {} - } -ad_proc -deprecate -private general_comments_print_comment { - comment_id - title - mime_type - creation_user - author - pretty_date - pretty_date2 - content - print_content_p - print_attachments_p - package_url - return_url -} { - Helper proc to format and print out a single comment. - @param comment_id The id of the comment. - @param title The title of the comment. - @param mime_type The mime_type of the comment. - @param creation_user The creation user of the comment. - @param author The name of the author. - @param pretty_date A short pretty date of the comment. - @param pretty_date2 A long pretty date of the comment. - @param content The content of the comment. - @param print_content_p Pass in 1 to print out content of comments. - @param print_attachments_p Pass in 1 to print out attachments of comments. - @param package_url The url to the mounted general-comments package instance. - @param return_url A url for the user to return to after viewing a comment. -} { - - # -- create query statements to retrieve attachments - # PRS: Moved inline for QueryExtractor - - # This part is really ugly. This will remain here until we figure out a way to - # move this into a template. - set html "" - if { $print_content_p == 1 } { - append html "
-- $author [_ general-comments.on] $pretty_date2 ([_ general-comments.view_details])
\n" - } else { - append html "