ad_new_stuff

one of the documented procedures in this installation of the ACS
Usage:
ad_new_stuff   db   { since_when "" }   { only_from_new_users_p "f" }   { purpose "web_display" }
What it does:
Returns a string of new stuff on the site. SINCE_WHEN is an ANSI date. If ONLY_FROM_NEW_USERS_P is "t" then we only look at content posted by users in the USERS_NEW view. 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 ad_new_stuff_module_list.
Defined in: /web/philip/tcl/ad-new-stuff.tcl

Source code:


    # let's default the date if we didn't get one
    if [empty_string_p $since_when] {
	set since_when [database_to_tcl_string $db "select sysdate-1 from dual"]
    }
    ns_share ad_new_stuff_module_list
    set result_list [list]
    foreach sublist $ad_new_stuff_module_list {
	set module_name [lindex $sublist 0]
	set module_proc [lindex $sublist 1]
	set result_elt ""
	if [catch { set subresult [eval "$module_proc $db $since_when $only_from_new_users_p $purpose"] } errmsg ] {
	    # got an error, let's continue to the next iteration
	    ns_log Warning "$module_proc, called from ad_new_stuff, returned an error:\n$errmsg"
	    continue
	}
	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>$module_name</h3>\n\n"
	    }
	    append result_elt "$subresult"
	    append result_elt "\n\n"
	    lappend result_list $result_elt
	}
    }
    # we've got all the results, let's sort by size
    set sorted_list [lsort -command ad_new_stuff_sort_by_length $result_list]
    return [join $sorted_list ""]


philg@mit.edu