chat_history

one of the documented procedures in this installation of the ACS
Usage:
chat_history   chat_room_id
What it does:
Builds page for /chat/history.tcl; chat posts by date
Defined in: /web/philip/tcl/chat-defs.tcl

Source code:


    set db [ns_db gethandle subquery]
    set selection [ns_db 0or1row $db "select pretty_name 
    from chat_rooms 
    where chat_room_id = $chat_room_id"]
    
    if { $selection == "" } {
	return "
	[ad_scope_header "Room Deleted" $db]
	[ad_scope_page_title "Room deleted" $db]

	We couldn't find chat room $chat_room_id. It was probably deleted by the
	site administrator."
    }
    set_variables_after_query
    set whole_page "
    [ad_scope_header "$pretty_name history" $db]
    [ad_scope_page_title "$pretty_name history" $db]
    [ad_scope_context_bar_ws_or_index [list "index.tcl" [chat_system_name]] [list "chat.tcl?[export_url_vars chat_room_id]" "One Room"] "History"]

    <hr>

    <ul>
    
    "
    set selection [ns_db select $db "select trunc(creation_date) as the_date, count(*) as n_msgs
    from chat_msgs 
    where chat_room_id = $chat_room_id
    and approved_p = 't' 
    and system_note_p <> 't'
    group by trunc(creation_date)
    order by trunc(creation_date) desc"]
    while { [ns_db getrow $db $selection] } {
	set_variables_after_query
	append whole_page "<li>[util_AnsiDatetoPrettyDate $the_date]:  <a href=\"history-one-day?the_date=[ns_urlencode $the_date]&chat_room_id=$chat_room_id\">$n_msgs</a>\n"
    }
    append whole_page "
    </ul>
    
    [ad_scope_footer ]
    "
    ns_db releasehandle $db 
    return $whole_page


philg@mit.edu