Next / Previous / Contents / TCC Help System / NM Tech homepage

22.4. PriIndex.htmlMain: First line of the primary index entry

cbchistlib.py
# - - -   P r i I n d e x . h t m l M a i n

    def htmlMain(self, parent):
        '''Add the first line of a primary entry.

          [ parent is an et.Element ->
              parent  +:=  main entry for self with a submit button
                  for self.circle ]
        '''
 

For the XHTML generated here, see Section 4.3.1, “Primary entry format”. See also Section 27, “latLonFormat(): Present the center coordinates in standard format” and Section 24, “yearBrackets(): Display a bracketed list of years worked”.

We start by adding a div to contain the whole entry. Each of these defines a page anchor (id value); for the logic that derives the name of the page anchor for a given circle center, see Section 52, “anchorName(): Format a page anchor”. We also work up the "ddmm-DDDMM" string, which is used in several places.

cbchistlib.py
        #-- 1
        # [ parent  +:=  a div, with an id derived from self.circle's
        #       center
        #   div  :=  that div element
        #   key  :=  the lat-lon key for self.circle ]
        div = subElement(parent,
            E.div(CLASS_PRI_DIV, id=anchorName(self.circle)))
        key = latLonKey(self.circle)

First into the div is a checkbox whose name is derived by Section 53, “latLonKey(): Generate the lat-lon key for a given circle”.

cbchistlib.py
        #-- 2
        # [ div  +:=  a checkbox whose name is regform.LAT_LON
        #       and whose value is (key) ]
        div.append(E.input(type='checkbox', value=key,
                           name=regform.LAT_LON))

Next comes the submit button to get the report for just one circle. On the button we place the circle name, with the coordinates as well because there are often multiple identical circle names with different coordinates.

cbchistlib.py
        #-- 3
        # [ div  +:=  a submit button whose name is
        #       (regform.S_ + (key)) and whose legend is
        #       circle's name, region list, and coordinates ]
        submitName = "%s%s" % (regform.S_, key)
        legend = ("%s, %s %s" %
                  (self.circle.cir_name, self.circle.allRegions(),
                   latLonFormat(self.circle.lat, self.circle.lon)))
        div.append(E.input(type='submit', name=submitName,
                           value=legend))

        #-- 4
        # [ div  +:=  a new span of class CLASS_YEAR_LIST containing
        #       the year list for self.effortList ]
        div.append (
            E.span(CLASS_YEAR_LIST,
                   yearBrackets(self.effortList)))