news_item_comments db news_item_idWhat it does:
Displays the comments for this newsgroups items with a link to toggle the approval status.Defined in: /web/philip/tcl/news-defs.tcl
Source code:
set return_string ""
set selection [ns_db select $db "
select comment_id, content, comment_date,
first_names || ' ' || last_name as commenter_name,
users.user_id as comment_user_id, html_p as comment_html_p,
general_comments.approved_p as comment_approved_p
from general_comments, users
where on_what_id= $news_item_id
and on_which_table = 'news_items'
and general_comments.user_id = users.user_id"]
while { [ns_db getrow $db $selection] } {
set_variables_after_query
append return_string "<a href=\"/shared/community-member?user_id=$comment_user_id\">$commenter_name</a>"
# print out the approval status if we are using the approval system
if { [ad_parameter CommentApprovalPolicy news] != "open"} {
if {$comment_approved_p == "t" } {
append return_string " -- <a href=\"comment-toggle-approval?[export_url_vars comment_id news_item_id]\">Revoke approval</a>"
} else {
append return_string " -- <a href=\"comment-toggle-approval?[export_url_vars comment_id news_item_id]\">Approve</a>"
}
}
append return_string "<blockquote>\n[util_maybe_convert_to_html $content $comment_html_p]</blockquote>"
}
if { [empty_string_p $return_string] } {
return ""
} else {
return "<h4>Comments</h4>\n<ul>$return_string</ul>\n"
}