This function builds the two-column table with links to the reports for personal and official pages.
This is also the logical place to build both the personal letter pages as well all the access report pages, one for each personal account or official directory.
# - - - c a t e g o r y T a b l e
def buildCategoryTable ( parent, accessSummary ):
'''Build all the personal/official reports and their indices.
[ (parent is an et.Element) and
(accessSummary is an AccessSummary) ->
parent +:= (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) ]
'''
The index table is really only 2 rows × 2 columns.
The first row contains the headings. Each of the two cells
of the second row is structured as a vertical stack of
unadorned div elements.
Thus, the overall flow of this procedure is:
Build the table and its first (heading) row.
Build a td element for the first cell of
the second row. Iterate through all the first
characters of personal pages using Section 40, “AccessSummary.genPersonalLetters():
First letters of personal accounts”. For
each letter, do all these steps:
Add a div containing a link to
a personal index page for this letter.
Create the personal index page for this letter.
Iterate through all the personal account names for
this letter using Section 41, “AccessSummary.genPersonals():
Generate accounts with the same first letter”.
For each account name, add a link on the personal index page that points to the personal access report, and also generate that personal access report page.
Write the personal index page.
Build a td element for the second cell
of the second row. Iterate through all the official
directories using Section 42, “AccessSummary.genOfficials():
Generate names of official directories”.
For each official directory, add a div
containing a link to its report page, and also build
the report page itself.
#-- 1 --
# [ parent +:= a new 'table' element for the category report
# personalCell := the 'td' element for personal letter
# index links
# officialCell := the 'td' element for official letter
# index links ]
table = E.table ( TABLE_ATTRS,
E.thead (
E.tr (
E.th ( "Personal pages starting with ",
E.tt ( '"%s~"' % NMT_WEB_PATH.url ) ),
E.th ( "Official pages starting with ",
E.tt ( '"%s"' % NMT_WEB_PATH.url ) ) ) ) )
parent.append ( table )
tbody = et.SubElement ( table, 'tbody' )
tr = et.SubElement ( tbody, 'tr' )
personalCell = et.SubElement ( tr, 'td', valign='top' )
officialCell = et.SubElement ( tr, 'td', valign='top' )
For the logic that builds the links to the letter pages,
the letter pages themselves, and all the personal
access report pages, see Section 17, “buildPersonalSide(): Letter and
personal pages”.
#-- 2 --
# [ personalCell +:= links to letter-pages(accessSummary)
# letter-pages(accessSummary) := letter-content(accessSummary)
# personal-reports(accessSummary) :=
# personal-content(accessSummary) ]
buildPersonalSide ( personalCell, accessSummary )
For the logic that builds the links to the official access
report pages and the report pages themselves, see
Section 21, “buildOfficialSide(): Build access
reports for official directories”.
#-- 3 --
# [ officialCell +:= links to official-reports(accessSummary)
# official-reports(accessSummary) :=
# official-content(accessSummary) ]
buildOfficialSide ( officialCell, accessSummary )