ad_comments_on_static_new_stuff db since_when only_from_new_users_p purposeWhat it does:
Produces a report for the site administrator and also a compressed version for random surfers and email summary recipientsDefined in: /web/philip/tcl/ad-new-stuff.tcl
Source code:
if { $only_from_new_users_p == "t" } {
set users_table "users_new"
} else {
set users_table "users"
}
set n_bytes_to_show 750
set query "select comments.comment_id, dbms_lob.getlength(comments.message) as n_message_bytes, dbms_lob.substr(comments.message,$n_bytes_to_show,1) as message_intro, comments.rating, comments.comment_type, posting_time, comments.originating_ip, users.user_id, first_names || ' ' || last_name as name, comments.page_id, sp.url_stub, sp.page_title, nvl(sp.page_title,sp.url_stub) as page_title_anchor, client_file_name, html_p, file_type, original_width, original_height, caption
from static_pages sp, comments_not_deleted comments, $users_table users
where sp.page_id = comments.page_id
and users.user_id = comments.user_id
and posting_time > '$since_when'
order by comment_type, posting_time desc"
set result_items ""
set last_comment_type ""
set selection [ns_db select $db $query]
while { [ns_db getrow $db $selection] } {
set_variables_after_query
if { $n_message_bytes > $n_bytes_to_show } {
set ellipses " ..."
} else {
set ellipses ""
}
# truncation within Oracle might have left open HTML tags; let's close them
set message_intro_cleaned "[util_close_html_tags $message_intro]$ellipses"
switch $purpose {
web_display {
if { $comment_type == "alternative_perspective" } {
append result_items "<li>by <a href=\"/shared/community-member?[export_url_vars user_id]\">$name</a>
on <a href=\"$url_stub\">$page_title_anchor</a>:
<blockquote>
[format_static_comment $comment_id $client_file_name $file_type $original_width $original_height $caption $message_intro_cleaned $html_p]
</blockquote>
"
}
}
site_admin {
if { $comment_type != $last_comment_type } {
append result_items "<h4>$comment_type</h4>\n"
set last_comment_type $comment_type
}
append result_items "<li>[util_AnsiDatetoPrettyDate $posting_time]: "
if { ![empty_string_p $rating] } {
append result_items "$rating -- "
}
append result_items "[format_static_comment $comment_id $client_file_name $file_type $original_width $original_height $caption $message_intro_cleaned $html_p]
<br>
-- <a href=\"/admin/users/one?user_id=$user_id\">$name</a>
from $originating_ip
on <a href=\"/admin/static/page-summary?[export_url_vars page_id]\">$url_stub</a>"
if ![empty_string_p $page_title] {
append result_items " ($page_title) "
}
append result_items " <a href=\"/admin/comments/persistent-edit?[export_url_vars comment_id]\" target=working>edit</a> <a href=\"/admin/comments/delete?[export_url_vars comment_id page_id]\" target=working>delete</a>
<p>
"
}
email_summary {
if { $comment_type == "alternative_perspective" } {
# make sure to have space after URL so mail REGEXPs will offer users hyperlinks
append result_items "by $name on [ad_url]$url_stub :
[wrap_string [ns_striphtml $message_intro]]$ellipses
-----
"
}
}
}
}
# we have the result_items or not
if { $purpose == "email_summary" } {
return $result_items
} elseif { ![empty_string_p $result_items] } {
return "<ul>\n\n$result_items\n</ul>\n"
} else {
return ""
}