Family LDS Ordinance information is now working in NarrativeWeb at display_ind_families().

svn: r12865
This commit is contained in:
Rob G. Healey 2009-08-03 05:21:00 +00:00
parent 850253ca41
commit 427a34f721

View File

@ -231,73 +231,86 @@ class BasePage(object):
self.linkhome = report.options['linkhome'] self.linkhome = report.options['linkhome']
self.create_media = report.options['gallery'] self.create_media = report.options['gallery']
def dump_LDS_ordinance(self, db, objt, table, title, ord_sealed): def dump_ordinance(self, db, ldsobj):
""" """
will dump the LDS Ordinance information for either will dump the LDS Ordinance information for either
a person or a family ... a person or a family ...
@param: db -- report database @param: db -- the database in use
@param: objt -- an individual or a family @param: ldsobject -- LDS object -- either person or family
@param: ird_sealed:
True -- Parents
False -- Spouse
""" """
objectldsord = ldsobj.lds_ord_list
if not objectldsord:
return None
numberofords = len(objectldsord)
# object LDS ordiannce list def create_LDS_header_row():
objectldsord = objt.lds_ord_list """ create the header row for this section """
if objectldsord:
numberofords = len(objectldsord) # begin HTML row
trow = Html('tr')
# if True, show Table Title for display_ind_families()? for label, colclass in [
if title: [_('Type'), 'LDSType' ],
trow = Html('tr', class_='TableTitle') + ( [_('Date'), 'LDSDate' ],
Html('th', _('Family LDS Ordinance'), inline=True) [_('Temple'), 'LDSTemple' ],
) [_('Place'), 'LDSPlace' ],
table += trow [_('Status'), 'LDSStatus' ],
[_('Sealed to '), 'LDSSealed'] ]:
# begin LDS ordinance data rows trow += Html('th', label, class_='Column%s' % colclass, inline=True)
first = True
# return row back to module
return trow
# begin LDS ordinance table and table head
with Html('table', class_='infolist ldsordlist') as table:
thead = Html('thead')
table += thead
# get LDS ord header row
thead += create_LDS_header_row()
# start table body
tbody = Html('tbody')
table += tbody
for row in range(1, (numberofords + 1)): for row in range(1, (numberofords + 1)):
# get ordinance for this row # get ordinance for this row
index = (row - 1) ord = objectldsord[(row - 1)]
ord = objectldsord[index]
# 0 = column class, 1 = ordinance data
lds_ord_data = [ lds_ord_data = [
(_('Type'), ord.type2xml()), ['LDSType', ord.type2xml()],
(_('Date'), _dd.display(ord.get_date_object())), ['LDSDate', ord.get_date_object()],
(_('Temple'), ord.get_temple()), ['LDSTemple', ord.get_temple()],
(_('Place'), ReportUtils.place_name(db, ord.get_place_handle())), ['LDSPlace', ord.get_place_handle()],
(_('Status'), ord.get_status()), ['LDSStatus', ord.get_status()],
(_('Sealed to'), ord.get_family_handle()) ] ['LDSSealed', ord.get_family_handle()]
]
# format date as in user preferences
lds_ord_data[1][1] = _dd.display(lds_ord_data[1][1])
# get place name from database
lds_ord_data[3][1] = ReportUtils.place_name(db, lds_ord_data[3][1])
# begin ordinance rows # begin ordinance rows
trow = Html('tr') trow = Html('tr')
table += trow tbody += trow
for col in range(1, (len(lds_ord_data) + 1)): for col in range(1, (len(lds_ord_data) + 1)):
# label is translatable for internationalism # column class for styling
index = (col - 1) colclass = lds_ord_data[(col - 1)][0]
label = lds_ord_data[index][0]
if col == len(lds_ord_data):
label += _(' to Parents') if ord_sealed else _(' to Spouse')
# actual column data # actual column data
value = lds_ord_data[index][1] value = lds_ord_data[(col - 1)][1]
value = value or ' ' value = value or ' '
# if first, create header row? trow += Html('td', value, class_='Column%s' % colclass,
if first: inline=True if value == ' ' else False)
tcell = Html('th', label, class_='ColumnAttribute', inline=True)
# table body row
else:
tcell = Html('td', value, class_='ColumnValue', inline=True)
trow += tcell
first = False
# return table to its callers # return table to its callers
return table return table
@ -3416,7 +3429,7 @@ class IndividualPage(BasePage):
section += table section += table
# ump individual LDS ordinance list # ump individual LDS ordinance list
self.dump_LDS_ordinance(db, self.person, table, False, True) # self.dump_LDS_ordinance(db, self.person, table, False, True)
# return section to its caller # return section to its caller
return section return section
@ -3749,14 +3762,20 @@ class IndividualPage(BasePage):
ordered += self.display_child_link(child_handle) ordered += self.display_child_link(child_handle)
# family LDS ordinance list # family LDS ordinance list
# table is passed in as a variable and returned back to it famldslist = family.lds_ord_list
# self.dump_LDS_ordinance(db, family, table, True, False) if famldslist:
trow = Html('tr') + (
Html('td', ' ', class_='ColumnType', inline=True),
Html('td', '&nbsp', class_='ColumnAttribute', inline=True),
Html('td', self.dump_ordinance(db, family), class_='ColumnValue')
)
table += trow
# get family attributes # get family attributes
attrlist = family.get_attribute_list() attrlist = family.get_attribute_list()
if attrlist: if attrlist:
trow = Html('tr') + ( trow = Html('tr') + (
Html('td', ' ', class_='ColumnAttribute', inline=True), Html('td', ' ', class_='ColumnType', inline=True),
Html('td', ' ', class_='ColumnAttribute', inline=True), Html('td', ' ', class_='ColumnAttribute', inline=True),
Html('td', _('Attributes'), class_='ColumnAttribute', inline=True) Html('td', _('Attributes'), class_='ColumnAttribute', inline=True)
) )
@ -3819,24 +3838,16 @@ class IndividualPage(BasePage):
else: else:
tcell += partner_name tcell += partner_name
# TODO: Fix this section of code # display family events; such as marriage and divorce events
# there is a table started underneath a table cell???
family_events = family.get_event_ref_list() family_events = family.get_event_ref_list()
if family_events:
# here is where the mess happens...
formatted_event = self.format_event(family_events)
if formatted_event is not None:
trow = Html('tr') + ( trow = Html('tr') + (
Html('td', ' ', class_='ColumnType', inline=True), Html('td', ' ', class_='ColumnType', inline=True),
Html('td', ' ', class_='ColumnAttribute', inline=True), Html('td', ' ', class_='ColumnAttribute', inline=True),
Html('td', self.format_event(family_events), class_='ColumnValue')
) )
table += trow table += trow
tcell = Html('td', class_='ColumnValue')
trow += tcell
tcell += formatted_event
# return table to its caller # return table to its caller
return table return table
@ -3904,9 +3915,6 @@ class IndividualPage(BasePage):
return trow return trow
def format_event(self, eventlist): def format_event(self, eventlist):
if not eventlist:
return None
db = self.report.database db = self.report.database
# begin eventlist table and table header # begin eventlist table and table header