Fixed display_addresses() in NarrativeWeb.py. Added stylesheet elements for it.

svn: r12870
This commit is contained in:
Rob G. Healey 2009-08-04 08:58:17 +00:00
parent 2fc66c1830
commit 077271dc97
2 changed files with 76 additions and 49 deletions

View File

@ -977,19 +977,41 @@ table.ldsordlist tbody tr td.ColumnLDSSources {
/* Subsections : Addresses /* Subsections : Addresses
----------------------------------------------------- */ ----------------------------------------------------- */
div#addresses { div#Addresses {
padding-bottom:0; padding-bottom:0;
} }
div#addresses table.infolist tbody tr td { div#Addresses table.infolist {
font-size:.35cm;
background-color:#FFF;
}
div#Addresses table.infolist tbody tr td {
border-bottom:solid 1px #000;
padding-top:.4em; padding-top:.4em;
padding-bottom:.4em; padding-bottom:.4em;
} }
div#addresses table.infolist tbody tr td.ColumnAttribute { div#Addresses table.infolist tbody tr td.ColumnDate {
width:30%; width:15%;
border-bottom:solid 1px #453619;
} }
div#addresses table.infolist tbody tr td.ColumnValue { div#Addresses table.infolist tbody tr td.ColumnStreetAddress {
border-bottom:solid 1px #453619; width:30%;
}
div#Addresses table.infolist tbody tr td.ColumnCity {
width:8%;
}
div#Addresses table.infolist tbody tr td.ColumnCounty {
with:8%;
}
div#Addresses table.infolist tbody tr td.ColumnState {
width:12%;
}
div#Addresses table.infolist tbody tr td.ColumnCntry {
width:5%;
}
div#Addresses table.infolist tbody tr td.ColumnPostalcode {
width:10%;
}
div#Addresses table.infolist tbody tr td.ColumnPhone {
width:15%;
} }
/* Subsections : Gallery /* Subsections : Gallery

View File

@ -237,7 +237,7 @@ class BasePage(object):
a person or a family ... a person or a family ...
@param: db -- the database in use @param: db -- the database in use
@param: ldsobject -- LDS object -- either person or family @param: ldsobject -- either person or family
""" """
objectldsord = ldsobj.lds_ord_list objectldsord = ldsobj.lds_ord_list
if not objectldsord: if not objectldsord:
@ -476,11 +476,32 @@ class BasePage(object):
False -- person False -- person
""" """
if len(obj.get_address_list()) == 0: def create_address_header(spec):
return None """ create header row for address """
trow = Html('tr')
addr_header = [
[_('Date'), 'Date'],
[_('Street'), 'StreetAddress'],
[_('City'), 'City'],
[_('County'), 'County'],
[_('State/ Province'), 'State'],
[_('Cntry'), 'Cntry'],
[_('Postal Code'), 'Postalcode'],
[_('Phone'), 'Phone'] ]
# if spec = True -- an individual's address else repository
if spec:
addr_header.append([_('Sources'), 'Sources'])
for (label, colclass) in addr_header:
trow += Html('th', label, class_='Column%s' % colclass, inline=True)
# return table header row back to module
return trow
# begin summaryarea division # begin summaryarea division
with Html('div', id='summaryarea') as summaryarea: with Html('div', id='summaryarea') as summaryarea:
# begin address table # begin address table
with Html('table', class_='infolist repolist') as table: with Html('table', class_='infolist repolist') as table:
@ -490,20 +511,8 @@ class BasePage(object):
thead = Html('thead') thead = Html('thead')
table += thead table += thead
trow = Html('tr') # add header row
thead += trow thead += create_address_header(spec)
for (label, colclass) in [
(_('Date'), 'date'),
(_('Street'), 'streetaddress'),
(_('City'), 'city'),
(_('County'), 'county'),
(_('State/ Province'), 'state'),
(_('Country'), 'country') ,
(_('Postal Code'), 'postalcode'),
(_('Phone'), 'phone') ]:
trow += Html('th', label, class_='ColumnAttribute %s' % colclass, inline=True)
# begin table body # begin table body
tbody = Html('tbody') tbody = Html('tbody')
@ -515,39 +524,35 @@ class BasePage(object):
trow = Html('tr') trow = Html('tr')
tbody += trow tbody += trow
date = _dd.display(address.get_date_object()) addrcollist = [
['Date', address.get_date_object()],
['Street', address.get_street()],
['City', address.get_city()],
['County', address.get_county()],
['State', address.get_state()],
['Cntry', address.get_country()],
['Postal', address.get_postal_code()],
['Phone', address.get_phone()] ]
for (label, value) in [ # date as listed in preferences
(_('date'), date), addrcollist[0][1] = _dd.display(addrcollist[0][1])
(_('streetaddress'), address.get_street()),
(_('city'), address.get_city()),
(_('county'), address.get_county()),
(_('State'), address.get_state()),
(_('country'), address.get_country()),
(_('postalcode'), address.get_postal_code()),
(_('phone'), address.get_phone()) ]:
tcell = Html('td', class_='ColumnValue %s' % label, inline=True) # get source citation list
trow += tcell if spec:
addrcollist.append([_('Sources'), address.get_source_references()])
addrcollist[8][1] = self.get_citation_links(addrcollist[8][1])
if value: for (colclass, data) in addrcollist:
tcell += value
else: data = data or ' '
tcell += ' ' trow += Html('td', data, class_='Column%s' % colclass,
inline=True if data == ' ' else False)
# address: note list # address: note list
notelist = self.display_note_list(address.get_note_list()) notelist = self.display_note_list(address.get_note_list())
if notelist is not None: if notelist is not None:
summaryarea += notelist summaryarea += notelist
# address: source references
# if True, then an individual's address
# if False, then a repositories address
if spec:
sourcerefs = self.write_source_refs(address.get_source_references())
if sourcerefs is not None:
summaryarea += sourcerefs
# return summaryarea division to its callers # return summaryarea division to its callers
return summaryarea return summaryarea