Adding source references to all major objects: person, event, attribute, address.

svn: r12916
This commit is contained in:
Rob G. Healey 2009-08-07 20:02:55 +00:00
parent 9b8d97455f
commit 9eeb2d8b92

View File

@ -24,7 +24,7 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
# #
# $Id:$ # $Id: $
""" """
Narrative Web Page generator. Narrative Web Page generator.
@ -1519,8 +1519,14 @@ class SurnamePage(BasePage):
if not first_family: if not first_family:
tcell += ',' tcell += ','
if partner_handle in report_handle_list: if partner_handle in report_handle_list:
<<<<<<< .mine
url = self.report.build_url_fname_html(
partner_handle, 'ppl', True)
tcell += self.individual_link(url, partner)
=======
url = self.report.build_url_fname_html(partner_handle, 'ppl', True) url = self.report.build_url_fname_html(partner_handle, 'ppl', True)
tcell += self.individual_link(url, partner) tcell += self.individual_link(url, partner)
>>>>>>> .r12915
else: else:
tcell += partner_name tcell += partner_name
else: else:
@ -2097,26 +2103,52 @@ class MediaPage(BasePage):
return None return None
# begin attributes division # begin attributes division
with Html('div', id='attributes') as section: with Html('div', class_='subsection', id='attributes') as section:
# section section title # section title
section += Html('h4', _('Attributes'), inline=True) section += Html('h4', _('Attributes'), inline=True)
# begin attrib table # begin attrib table
with Html('table', class_='infolist') as table: with Html('table', class_='infolist') as table:
section += table section += table
# begin table head
thead = Html('thead')
table += thead
trow = Html('tr')
thead += trow
for label, colclass in [
[_('Type'), 'Type'],
[_('Value'), 'Value'],
[_('Sources'), 'Sources'] ]:
trow += Html('th', label, class_='Column%s' % colclass, inline=True)
# begin table body # begin table body
tbody = Html('tbody') tbody = Html('tbody')
table += tbody
for attr in attrlist: for attr in attrlist:
atType = str( attr.get_type() ) trow = Html('tr')
trow = Html('tr') + (
Html('td', atType, class_='ColumnAttribute', inline=True),
Html('td', attr.get_value(), class_='ColumnValue', inline=True)
)
tbody += trow tbody += trow
table += tbody
attr_data_list = [
['Type', attr.get_type.xml_str()],
['Value', attr.get_value()],
['Sources', attr.get_source_references()]
]
# get source references
attr_data_list[2][1] = self.display_source_refs(attr_data_list[2][1])
for colclass, value in attr_data_list:
trow += Html('td', value, class_='Column%s' % colclass, inline=True)
# attach notes to section
notelist = self.display_note_list(attr.get_note_list())
if notelist is not None:
section += notelist
# return attributes division to its caller # return attributes division to its caller
return section return section
@ -3364,78 +3396,76 @@ class IndividualPage(BasePage):
place = '' place = ''
# begin table row for either: display_event_row() or format_event() # begin table row for either: display_event_row() or format_event()
with Html('tr') as trow: trow = Html('tr')
# Event/ Type # Event/ Type
evt_name = str(event.get_type()) evt_name = str(event.get_type())
if event_ref.get_role() == EventRoleType.PRIMARY: if event_ref.get_role() == EventRoleType.PRIMARY:
txt = u"%(evt_name)s" % locals() txt = u"%(evt_name)s" % locals()
else:
evt_role = event_ref.get_role()
txt = u"%(evt_name)s (%(evt_role)s)" % locals()
txt = txt or '&nbsp;'
trow += Html('td', txt, class_='ColumnValue', inline=True)
# Date
event_date = event.get_date_object()
if event_date:
txt = _dd.display(event_date)
else:
txt = '&nbsp;'
trow += Html('td', txt, class_='ColumnValue', inline=True)
# Place
place_handle = event.get_place_handle()
if place_handle:
lnk = (self.report.cur_fname, self.page_title, self.gid)
if place_handle in self.place_list:
if lnk not in self.place_list[place_handle]:
self.place_list[place_handle].append(lnk)
else: else:
evt_role = event_ref.get_role() self.place_list[place_handle] = [lnk]
txt = u"%(evt_name)s (%(evt_role)s)" % locals()
txt = txt or '&nbsp;'
trow += Html('td', txt, class_='ColumnValue', inline=True)
# Date place = self.place_link(place_handle,
event_date = event.get_date_object() ReportUtils.place_name(db, place_handle), up=True)
if event_date: else:
txt = _dd.display(event_date) place = None
else: txt = place or '&nbsp;'
txt = '&nbsp;' trow += Html('td', txt, class_='ColumnValue')
trow += Html('td', txt, class_='ColumnValue', inline=True)
# Place # Description
place_handle = event.get_place_handle() # Get the links in super script to the Source References section in the same page
if place_handle: sref_links = self.get_citation_links(event.get_source_references())
txt = ''.join(wrapper.wrap(event.get_description()))
txt = txt or '&nbsp;'
trow += Html('td', txt, class_='ColumnValue', inline=True \
if txt == '&nbsp;' else False)
lnk = (self.report.cur_fname, self.page_title, self.gid) # Sources
if place_handle in self.place_list: citation = self.get_citation_links(event.get_source_references())
if lnk not in self.place_list[place_handle]: txt = citation or '&nbsp;'
self.place_list[place_handle].append(lnk) trow += Html('td', txt, class_='ColumnValue', inline=True \
else: if txt == '&nbsp;' else False)
self.place_list[place_handle] = [lnk]
place = self.place_link(place_handle, # Notes
ReportUtils.place_name(db, # if the event or event reference has a note attached to it,
place_handle), # get the text and format it correctly
up=True) notelist = event.get_note_list()
else: notelist.extend(event_ref.get_note_list())
place = None tcell = Html('td', class_='ColumnValue')
txt = place or '&nbsp;' trow += tcell
trow += Html('td', txt, class_='ColumnValue') if not notelist:
tcell += '&nbsp;'
# Description else:
# Get the links in super script to the Source References section in the same page for notehandle in notelist:
sref_links = self.get_citation_links(event.get_source_references()) note = db.get_note_from_handle(notehandle)
txt = ''.join(wrapper.wrap(event.get_description())) if note:
txt = txt or '&nbsp;' note_text = self.get_note_format(note)
trow += Html('td', txt, class_='ColumnValue', inline=True \
if txt == '&nbsp;' else False)
# Sources
citation = self.get_citation_links(event.get_source_references())
txt = citation or '&nbsp;'
trow += Html('td', txt, class_='ColumnValue', inline=True \
if txt == '&nbsp;' else False)
# Notes
# if the event or event reference has a note attached to it,
# get the text and format it correctly
notelist = event.get_note_list()
notelist.extend(event_ref.get_note_list())
tcell = Html('td', class_='ColumnValue')
trow += tcell
if not notelist:
tcell += '&nbsp;'
else:
for notehandle in notelist:
note = db.get_note_from_handle(notehandle)
if note:
note_text = self.get_note_format(note)
# attach note # attach note
tcell += note_text tcell += note_text
# return events table row to its caller # return events table row to its caller
return trow return trow