im_status_report db { coverage " " } { report_date "f" } { purpose "web_display" } { ns_share_list "im_status_report_section_list" }What it does:
Returns a string of new stuff on the site. COVERAGE and REPORT_DATS are ANSI date. The PURPOSE argument can be \"web_display\" (intended for an ordinary user), \"site_admin\" (to help the owner of a site nuke stuff), or \"email_summary\" (in which case we get plain text back). These arguments are passed down to the procedures on the ns_share'd ns_share_list."Defined in: /web/philip/tcl/intranet-status-report-defs.tcl
Source code:
# let's default the date if we didn't get one
if [empty_string_p $coverage] {
set since_when [database_to_tcl_string $db "select sysdate from dual"]
}
if [empty_string_p $report_date] {
set report_date [database_to_tcl_string $db "select sysdate from dual"]
}
ns_share $ns_share_list
set result_list [list]
# module_name_proc_history will ensure that we do not have duplicates in the
# status report, even if the same procedure is registered twice
# with ns_share_list
set module_name_proc_history [list]
foreach sublist [set $ns_share_list] {
set module_name [lindex $sublist 0]
set module_proc [lindex $sublist 1]
set module_cache_p [lindex $sublist 2]
if { [lsearch -exact $module_name_proc_history "${module_name}_$module_proc"] > -1 } {
# This is a duplicate call to the same procedure! Skip it
continue
}
set result_elt ""
set subresult ""
if { [string compare $module_cache_p "t"] == 0 } {
if { [catch {set subresult [util_memoize [list $module_proc $db $coverage $report_date $purpose]]} err_msg] } {
ns_log error "im_status_report got an error \"$err_msg\" trying to execute: $module_proc $db $coverage $report_date $purpose"
}
} else {
if { [catch {set subresult [eval "$module_proc $db $coverage $report_date $purpose"]} err_msg] } {
ns_log error "im_status_report got an error \"$err_msg\" trying to execute: $module_proc $db $coverage $report_date $purpose"
}
}
if ![empty_string_p $subresult] {
# we got something, let's write a headline
if { $purpose == "email_summary" } {
append result_elt "[string toupper $module_name]\n\n"
} else {
append result_elt "<h3><a name=\"$module_name\">$module_name</a></h3>\n\n"
}
append result_elt $subresult
append result_elt "\n\n"
lappend result_list $result_elt
}
}
return [join $result_list ""]