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.1 -r1.1.4.1 --- openacs-4/packages/general-comments/tcl/general-comments-procs-oracle.xql 14 Jun 2001 19:38:05 -0000 1.1 +++ openacs-4/packages/general-comments/tcl/general-comments-procs-oracle.xql 4 Jul 2003 15:11:10 -0000 1.1.4.1 @@ -20,6 +20,7 @@ where g.object_id = :object_id and r.revision_id = content_item.get_live_revision(g.comment_id) and o.object_id = g.comment_id + $context_clause order by o.creation_date 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.1 -r1.1.4.1 --- openacs-4/packages/general-comments/tcl/general-comments-procs-postgresql.xql 14 Jun 2001 19:38:05 -0000 1.1 +++ openacs-4/packages/general-comments/tcl/general-comments-procs-postgresql.xql 4 Jul 2003 15:11:10 -0000 1.1.4.1 @@ -20,6 +20,7 @@ where g.object_id = :object_id and r.revision_id = content_item__get_live_revision(g.comment_id) and o.object_id = g.comment_id + $context_clause order by o.creation_date 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.5.2.1 -r1.5.2.2 --- openacs-4/packages/general-comments/tcl/general-comments-procs.tcl 31 Oct 2002 20:49:55 -0000 1.5.2.1 +++ openacs-4/packages/general-comments/tcl/general-comments-procs.tcl 4 Jul 2003 15:11:10 -0000 1.5.2.2 @@ -18,6 +18,7 @@ ad_proc -public general_comments_get_comments { { -print_content_p 0 } { -print_attachments_p 0 } + {-context_id ""} object_id {return_url {}} } { @@ -26,6 +27,7 @@ @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, only works if print_content_p is 1. + @param context_id Show only comments with given context_id @param object_id The object_id to retrieve the comments for. @param return_url A url for the user to return to after viewing a comment. } { @@ -44,24 +46,15 @@ set content_select [db_map content_select] ;# ", r.content" } # ns_log notice "content_select: $content_select" + + if { ![empty_string_p $context_id] } { + set context_clause "and o.context_id = :context_id" + } else { + set context_clause "" + } set html "" - db_foreach get_comments " - select g.comment_id, - r.title, - r.mime_type, - o.creation_user, - acs_object.name(o.creation_user) as author, - to_char(o.creation_date, 'MM-DD-YYYY') as pretty_date, - to_char(o.creation_date, 'Month DD, YYYY HH12:MI PM') as pretty_date2 - $content_select - from general_comments g, - cr_revisions r, - acs_objects o - where g.object_id = :object_id and - r.revision_id = content_item.get_live_revision(g.comment_id) and - o.object_id = g.comment_id - order by o.creation_date" { + db_foreach get_comments {} { # call on helper proc to print out comment append html [general_comments_print_comment $comment_id $title $mime_type \ $creation_user $author $pretty_date $pretty_date2 $content \ @@ -136,9 +129,7 @@ } if { ![empty_string_p $attachments_html] } { append html "
-- $author on $pretty_date2 (view details)
\n" } else {