# - - - b u i l d R e g i o n s F o r m
def buildRegionsForm(page, db):
'''Main page construction logic for the regional index form.
[ (page is a tp.TCCPage instance) and
(db is a pycbc.CBCDatabase instance) ->
if RegArgs() is consistent with db ->
page := page modified to display a page that allows
the user to select history reports from the set of
circles in db selected by RegArgs()
else -> raise ScriptError ]
'''
This function builds the body of the regional index page. There are three principal parts:
Section 8.6, “regx.cgi: buildRegionTitles(): Set up
the titles for the selected region”.
Section 8.7, “regx.cgi: startForm(): Set up the form
and static controls”. This builds the static part
of the form, containing the button and the various controls that affect the output
of the detail page.
Section 8.8, “regx.cgi: buildIndexSection(): Add the
primary and secondary index entries”. This builds the
bulk of the regional index, containing the primary and
secondary entries for the circles in the region.
#-- 1
# [ if RegArgs().reg_code is a region code in db ->
# page := page with its titles change to show the
# corresponding region
# else -> raise ScriptError ]
buildRegionTitles(page, db)
#-- 2
# [ page := page with the regional index form added except for
# the index entries ]
form = startForm(page)
#-- 3
# [ form := form with index entries added falling within the
# year range specified by RegArgs() ]
buildIndexSection(form, db, RegArgs().firstYear, RegArgs().lastYear,
RegArgs().isOverlap)