portal_header

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

Source code:



    # Get generic display information
    portal_display_info
    
    # 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"]

    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 header_html "
    <table width=100% border=0 cellspacing=0 cellpadding=0>
    <tr>
       <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>
          <tr>
             <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 {$type == "group"} {
	    # convert group_name to a URL friendly string
	    regsub -all -- " " [string tolower $group_name] {-} link_name
	} else {
	    set link_name "user$id"
	}
	# 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]} {
	    set_variables_after_query

	    if {$new_page_number == $page_number} {
		append header_html "$header_td <center> $page_name</td>\n"
	    } else {
		append header_html "
		$subheader_td <center><a href=$link_name-$new_page_number[ad_parameter PortalExtension portams .ptl]>$page_name</a></td>\n"
	    }
	}
    }
    append header_html "
    </tr></table>
    </td></tr></table>
    </td></tr><tr bgcolor=$header_bg><td colspan=2 width=100%><img src=[ad_parameter SpacerImage portals] width=10 height=3></td></tr></table>\n"
   
    return $header_html


philg@mit.edu