one of the documented procedures in this installation of the ACS
portal_footer   db   id   group_name   page_number   type
What it does:
Generate footer for portal pages.
Defined in: /web/philip/tcl/portals-defs.tcl

Source code:

    # Get generic display information

    # Find out the number of pages this portal has
    set total_pages [database_to_tcl_string $db "
    select count(*) from portal_pages where ${type}_id=$id"]

    if { $type == "group" } {
	# names and emails of the managers of this portal group;
	# we need the "distinct" because a user can be mapped more
	# than once to a group (one mapping per role)
	set administrator_query "select distinct u.first_names||' '||u.last_name as admin_name, u.email as admin_email
	from users u, user_group_map map
	where u.user_id =  map.user_id
	and map.group_id = $id"

	set selection [ns_db select $db $administrator_query]

	set administrator_list [list]
	while {[ns_db getrow $db $selection]} {
	    lappend administrator_list "<a href=mailto:$admin_email>$admin_name</a>"
	set extra_footer_text "The content of this portal page is managed by: [join $administrator_list ", "]"
	regsub -all -- " " [string tolower $group_name] {-} link_name
    } else {
	set link_name "user$id"
	set extra_footer_text "<a href=\"manage-portal\">Personalize</a> this portal."

    set page_name [database_to_tcl_string_or_null $db "
    select page_name from portal_pages 
    where page_number = $page_number 
    and ${type}_id = $id"]

    # while the following may not seem very readable, it is important that there are no
    # extra spaces in this table
    set footer_html "
    <table width=100% border=0 cellspacing=0 cellpadding=0>
    <tr bgcolor=$header_bg>
       <td colspan=2 width=100%><img src=[ad_parameter SpacerImage portals] width=10 height=3></td>
       <td><font face=arial,helvetica><b>[string toupper "$system_name : $group_name"]</td>
       <td align=right valign=bottom><table width=100% border=0 cellspacing=0 cellpadding=1 bgcolor=$header_bg>
             <td><table width=100% border=0 cellspacing=1 cellpadding=3 bgcolor=$header_bg><tr>\n"

    # set up the page tabs only if there is more than one page
    if {$total_pages > 1} {

	# if we want equal size tabs, regsub a width restriction into the td
	if {[ad_parameter EqualWidthTabsP portals]} {
	    regsub {<td} $header_td "<td width=[expr round(100/$total_pages)]" header_td
	    regsub {<td} $subheader_td "<td width=[expr round(100/$total_pages)]" subheader_td

	# Get a list of portal page names	
	set page_select "
	select distinct nvl(page_name,'Page #'||page_number) as page_name, page_number as new_page_number
	from   portal_table_page_map p_tpm, portal_pages p_p
	where  p_tpm.page_id = p_p.page_id
	and    ${type}_id = $id
	order by page_number"

	set selection [ns_db select $db $page_select]
	while {[ns_db getrow $db $selection]} {

	    if {$new_page_number == $page_number} {
		append footer_html "$header_td <center> $page_name</td>\n"
	    } else {
		append footer_html "
		$subheader_td <center><a href=$link_name-$new_page_number[ad_parameter PortalExtension portals .ptl]>$page_name</a></td>\n"

    append footer_html "
    $font_tag <p>
    If you encounter any bugs or have suggestions that are not content-related, email <a href=\"mailto:[ad_parameter Administrator portals [ad_system_owner]]\">[ad_parameter AdministratorName portals [ad_system_owner]]</a>.
    return $footer_html