chat_get_posts_to_moderate

one of the documented procedures in this installation of the ACS
Usage:
chat_get_posts_to_moderate   chat_room_id
What it does:
Returns HTML fragment of chat posts awaiting moderator approval.
Defined in: /web/philip/tcl/chat-defs.tcl

Source code:



    set user_id [ad_verify_and_get_user_id]
    set db [ns_db gethandle subquery]

    set order ""
    if {[ad_parameter MostRecentOnTopP chat]} {
	set order "desc"
    }

    set chat_rows "<form action=moderate-2 method=post><br>Accept / Reject / Decide Later<br>"
    set ids ""

    set selection [ns_db select $db "select to_char(creation_date,'HH24:MI:SS') as time, 
 chat_msg_id, msg_bowdlerized, msg, content_tag, first_names, creation_user
from chat_msgs, users
where chat_msgs.creation_user = users.user_id
  and chat_room_id = $chat_room_id
  and chat_msgs.approved_p = 'f'
order by creation_date $order"]

    while { [ns_db getrow $db $selection]} {
	set_variables_after_query

	set filtered_msg [ns_quotehtml $msg]

	if { ![empty_string_p $msg_bowdlerized] } {
	    set msg_bowdlerized "([ns_quotehtml $msg_bowdlerized])"
	}

	set rating "G"
	if { $content_tag & 1 } {
	    set rating "PG"
	}
	if { $content_tag & 2 } {
	    set rating "R"
	}
	if { $content_tag & 4 } {
	    set rating "X"
	}
	
	lappend ids $chat_msg_id
	
	append chat_rows "<input type=radio name=moderate$chat_msg_id value=t checked>
<input type=radio name=moderate$chat_msg_id value=\"\">
<input type=radio name=moderate$chat_msg_id value=f>
($rating) <a target=newwindow href=\"/shared/community-member?[export_url_vars user_id]\">$first_names</a> ($time) $filtered_msg $msg_bowdlerized<br>\n"
    }
    
    ns_db releasehandle $db
    append chat_rows "[export_form_vars ids chat_room_id]<input type=submit value=Submit></form>"
    
    if {[empty_string_p $ids]} {
	return ""
    } else { 
	return $chat_rows
    }


philg@mit.edu