# - - - b u i l d A l l P a g e s
def buildAllPages ( indexPage, accessSummary ):
'''Write all output pages.
[ (indexPage is a tccpage2.TCCPage instance) and
(accessSummary is an AccessSummary instance) ->
indexPage +:= index-content(accessSummary)
hit-parade-page := hits-content(accessSummary)
letter-pages(accessSummary) := letter-content(accessSummary)
personal-reports(accessSummary) :=
personal-content(accessSummary)
official-reports(accessSummary) :=
official-reports(accessSummary) ]
'''
All XHTML body content on a TCCPage instance
is added as children of its .content
element, which is a div element between the
header and footer of the page.
The index page has four components: the summary table, the link to the hit parade, the NMT homepage report, and the table of links to personal and official pages. Therefore, we'll parcel this work out to four subfunctions. Two of these subfunctions also build one or more additional pages: the function that builds the link to the hit parade page also builds that page; and the function that builds the personal/official pages table also builds both the single-letter index pages and all of the personal and official reports as well.
See Section 11, “addSummaryTable(): Generate the table
summarizing all accesses”.
#-- 1 --
# [ indexPage +:= (summary of total hits in accessSummary) ]
addSummaryTable ( indexPage.content, accessSummary )
See Section 12, “buildHitParade(): Build the hit parade”.
#-- 2 --
# [ indexPage +:= (link to hit-parade-page made from
# accessSummary)
# hit-parade-page := hits-content(accessSummary) ]
buildHitParade ( indexPage.content, accessSummary )
See Section 15, “instituteHomepage(): Access report for
“/””.
#-- 3 --
# [ indexPage +:= (official-content for "/" from accessSummary) ]
instituteHomepage ( indexPage.content, accessSummary )
See Section 16, “buildCategoryTable(): Build categories table
and all personal and official reports”.
#-- 4 --
# [ indexPage +:= (links to letter-pages(accessSummary)) +
# (links to official-reports(accessSummary))
# letter-pages(accessSummary) := letter-content(accessSummary)
# personal-reports(accessSummary) :=
# personal-content(accessSummary)
# official-reports(accessSummary) :=
# official-content(accessSummary) ]
buildCategoryTable ( indexPage.content, accessSummary )
The last body content on the page is a link to the documentation.
#-- 5 --
# [ indexPage +:= link to the specification ]
indexPage.content.append (
E.p ( "For documentation describing how these pages "
"are built, see ",
E.a ( "the specification.",
href="http://www.nmt.edu/tcc/projects/tccwebstats4/" ) ) )