NarrativeWeb is broken until further notice, please bare with me for a day or so.
svn: r12854
This commit is contained in:
parent
fe64fe1214
commit
9e5cc9d93a
@ -189,6 +189,12 @@ def name_to_md5(text):
|
|||||||
"""This creates an MD5 hex string to be used as filename."""
|
"""This creates an MD5 hex string to be used as filename."""
|
||||||
return md5(text).hexdigest()
|
return md5(text).hexdigest()
|
||||||
|
|
||||||
|
def conf_priv(obj):
|
||||||
|
if obj.get_privacy() != 0:
|
||||||
|
return ' priv="%d"' % obj.get_privacy()
|
||||||
|
else:
|
||||||
|
return ''
|
||||||
|
|
||||||
class BasePage(object):
|
class BasePage(object):
|
||||||
"""
|
"""
|
||||||
This is the base class to write certain HTML pages.
|
This is the base class to write certain HTML pages.
|
||||||
@ -225,6 +231,44 @@ 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_source_references(self, db, sourcelist):
|
||||||
|
""" Dump a list of source references """
|
||||||
|
|
||||||
|
ordered = Html('ol')
|
||||||
|
list = Html('li')
|
||||||
|
ordered += list
|
||||||
|
|
||||||
|
source_dict = {}
|
||||||
|
# Sort the sources
|
||||||
|
for handle in sourcelist:
|
||||||
|
|
||||||
|
# if source is not None, then add it?
|
||||||
|
source = db.get_source_from_handle(handle)
|
||||||
|
if source is not None:
|
||||||
|
key = source.get_title() + str(source.get_gramps_id())
|
||||||
|
source_dict[key] = (source, handle)
|
||||||
|
keys = sorted(source_dict, key=locale.strxfrm)
|
||||||
|
|
||||||
|
for cindex, key in enumerate(keys):
|
||||||
|
(source, handle) = source_dict[key]
|
||||||
|
source_title = source.get_title()
|
||||||
|
|
||||||
|
list += self.source_link(handle, title, cindex+1, source.gramps_id, True)
|
||||||
|
|
||||||
|
# return ordered list to its callers
|
||||||
|
return ordered
|
||||||
|
|
||||||
|
def source_link(self, handle, name, cindex, gid=None, up=False):
|
||||||
|
|
||||||
|
url = self.report.build_url_fname_html(handle, 'src', up)
|
||||||
|
# begin hyperlink
|
||||||
|
hyper = Html('a', html_escape(name), href=url, title=name)
|
||||||
|
if not self.noid and gid:
|
||||||
|
hyper += Html('span', '[%s]' % gid, class_='grampsid', inline=True)
|
||||||
|
|
||||||
|
# return hyperlink to its callers
|
||||||
|
return hyper
|
||||||
|
|
||||||
def get_note_format(self, note):
|
def get_note_format(self, note):
|
||||||
"""
|
"""
|
||||||
will get the note from the database, and will return either the
|
will get the note from the database, and will return either the
|
||||||
@ -403,28 +447,7 @@ class BasePage(object):
|
|||||||
with Html('div', class_='subsection', id='sourcerefs') as section:
|
with Html('div', class_='subsection', id='sourcerefs') as section:
|
||||||
section += Html('h4', _('Source References'), inline=True)
|
section += Html('h4', _('Source References'), inline=True)
|
||||||
|
|
||||||
ordered = Html('ol')
|
section += self.dump_source_references(db, sourcelist)
|
||||||
section += ordered
|
|
||||||
list = Html('li')
|
|
||||||
ordered += list
|
|
||||||
|
|
||||||
source_dict = {}
|
|
||||||
# Sort the sources
|
|
||||||
for handle in sourcelist:
|
|
||||||
|
|
||||||
# if source is not None, then add it?
|
|
||||||
source = db.get_source_from_handle(handle)
|
|
||||||
if source is not None:
|
|
||||||
key = source.get_title() + str(source.get_gramps_id())
|
|
||||||
print key
|
|
||||||
source_dict[key] = (source, handle)
|
|
||||||
keys = sorted(source_dict, key=locale.strxfrm)
|
|
||||||
|
|
||||||
for index, key in enumerate(keys):
|
|
||||||
(source, handle) = source_dict[key]
|
|
||||||
source_title = source.get_title()
|
|
||||||
|
|
||||||
list += self.source_link(handle, title, cindex+1, source.gramps_id, True)
|
|
||||||
|
|
||||||
# return division to its caller
|
# return division to its caller
|
||||||
return section
|
return section
|
||||||
@ -1028,17 +1051,6 @@ class BasePage(object):
|
|||||||
# return thumbnail division to its callers
|
# return thumbnail division to its callers
|
||||||
return thumbnail
|
return thumbnail
|
||||||
|
|
||||||
def source_link(self, handle, name, cindex, gid=None, up=False):
|
|
||||||
|
|
||||||
url = self.report.build_url_fname_html(handle, 'src', up)
|
|
||||||
# begin hyperlink
|
|
||||||
hyper = Html('a', html_escape(name), href=url, title=name)
|
|
||||||
if not self.noid and gid:
|
|
||||||
hyper += Html('span', '[%s]' % gid, class_='grampsid', inline=True)
|
|
||||||
|
|
||||||
# return hyperlink to its callers
|
|
||||||
return hyper
|
|
||||||
|
|
||||||
def repository_link(self, handle, name, cindex, gid=None, up=False):
|
def repository_link(self, handle, name, cindex, gid=None, up=False):
|
||||||
|
|
||||||
url = self.report.build_url_fname_html(handle, 'repo', up)
|
url = self.report.build_url_fname_html(handle, 'repo', up)
|
||||||
@ -2731,11 +2743,16 @@ class IndividualPage(BasePage):
|
|||||||
if sect5 is not None:
|
if sect5 is not None:
|
||||||
individualdetail += sect5
|
individualdetail += sect5
|
||||||
|
|
||||||
# display address(es)
|
# display LDS ordinance
|
||||||
sect6 = self.display_addresses()
|
sect6 = self.display_lds_ordinance(self.person)
|
||||||
if sect6 is not None:
|
if sect6 is not None:
|
||||||
individualdetail += sect6
|
individualdetail += sect6
|
||||||
|
|
||||||
|
# display address(es)
|
||||||
|
sect7 = self.display_addresses()
|
||||||
|
if sect7 is not None:
|
||||||
|
individualdetail += sect7
|
||||||
|
|
||||||
media_list = []
|
media_list = []
|
||||||
photo_list = self.person.get_media_list()
|
photo_list = self.person.get_media_list()
|
||||||
if len(photo_list) > 1:
|
if len(photo_list) > 1:
|
||||||
@ -2752,36 +2769,36 @@ class IndividualPage(BasePage):
|
|||||||
media_list += event.get_media_list()
|
media_list += event.get_media_list()
|
||||||
|
|
||||||
# display additional images as gallery
|
# display additional images as gallery
|
||||||
sect7 = self.display_additional_images_as_gallery(media_list)
|
sect8 = self.display_additional_images_as_gallery(media_list)
|
||||||
if sect7 is not None:
|
|
||||||
individualdetail += sect7
|
|
||||||
|
|
||||||
# display notes
|
|
||||||
sect8 = self.display_note_list(self.person.get_note_list())
|
|
||||||
if sect8 is not None:
|
if sect8 is not None:
|
||||||
individualdetail += sect8
|
individualdetail += sect8
|
||||||
|
|
||||||
# display web links
|
# display notes
|
||||||
sect9 = self.display_url_list(self.person.get_url_list())
|
sect9 = self.display_note_list(self.person.get_note_list())
|
||||||
if sect9 is not None:
|
if sect9 is not None:
|
||||||
individualdetail += sect9
|
individualdetail += sect9
|
||||||
|
|
||||||
# display sources
|
# display web links
|
||||||
sect10 = self.display_ind_sources()
|
sect10 = self.display_url_list(self.person.get_url_list())
|
||||||
if sect10 is not None:
|
if sect10 is not None:
|
||||||
individualdetail += sect10
|
individualdetail += sect10
|
||||||
|
|
||||||
# display pedigree
|
# display sources
|
||||||
sect11 = self.display_ind_pedigree()
|
sect11 = self.display_ind_sources()
|
||||||
if sect11 is not None:
|
if sect11 is not None:
|
||||||
individualdetail += sect11
|
individualdetail += sect11
|
||||||
|
|
||||||
# display ancestor tree
|
# display pedigree
|
||||||
if report.options['graph']:
|
sect12 = self.display_ind_pedigree()
|
||||||
sect12 = self.display_tree()
|
|
||||||
if sect12 is not None:
|
if sect12 is not None:
|
||||||
individualdetail += sect12
|
individualdetail += sect12
|
||||||
|
|
||||||
|
# display ancestor tree
|
||||||
|
if report.options['graph']:
|
||||||
|
sect13 = self.display_tree()
|
||||||
|
if sect13 is not None:
|
||||||
|
individualdetail += sect13
|
||||||
|
|
||||||
# add clearline for proper styling
|
# add clearline for proper styling
|
||||||
# create footer section
|
# create footer section
|
||||||
footer = self.write_footer()
|
footer = self.write_footer()
|
||||||
@ -3302,6 +3319,60 @@ class IndividualPage(BasePage):
|
|||||||
# return address division to its caller
|
# return address division to its caller
|
||||||
return section
|
return section
|
||||||
|
|
||||||
|
def display_lds_ordinance(self, obj, sealed=True):
|
||||||
|
"""
|
||||||
|
display LDS information for a person or family
|
||||||
|
|
||||||
|
@param: obj -- an individual
|
||||||
|
-- a family
|
||||||
|
|
||||||
|
@param: sealed -- True = Parents
|
||||||
|
-- False = Spouse
|
||||||
|
"""
|
||||||
|
|
||||||
|
ldsordlist = obj.get_lds_ord_list()
|
||||||
|
if not ldsordlist:
|
||||||
|
return None
|
||||||
|
|
||||||
|
db = self.report.database
|
||||||
|
|
||||||
|
# begin LDS Ordinance division and section title
|
||||||
|
with Html('div', class_='subsection', id='LDSOrdinance') as section:
|
||||||
|
section += Html('h4', _('Latter-Day Saints (LDS) Ordinance'), inline=True)
|
||||||
|
|
||||||
|
# begin LDS table
|
||||||
|
with Html('table', class_='infolist ldsinfo') as table:
|
||||||
|
section += table
|
||||||
|
|
||||||
|
# begin table head
|
||||||
|
thead = Html('thead')
|
||||||
|
table += thead
|
||||||
|
|
||||||
|
# get ordinance header row
|
||||||
|
trow = write_ord_header(sealed)
|
||||||
|
thead += trow
|
||||||
|
|
||||||
|
# begin table body
|
||||||
|
tbody = Html('tbody')
|
||||||
|
table += tbody
|
||||||
|
|
||||||
|
for ord in ldsordlist:
|
||||||
|
trow = write_ord_data_row(db, ord)
|
||||||
|
tbody += trow
|
||||||
|
|
||||||
|
# notes
|
||||||
|
notelist = self.display_note_list(ord.get_note_list())
|
||||||
|
if notelist is not None:
|
||||||
|
section += notelist
|
||||||
|
|
||||||
|
# source references
|
||||||
|
sourcerefs = self.write_source_refs(ord.get_source_references())
|
||||||
|
if sourcerefs is not None:
|
||||||
|
section += sourcerefs
|
||||||
|
|
||||||
|
# return section to its caller
|
||||||
|
return section
|
||||||
|
|
||||||
def display_child_link(self, child_handle):
|
def display_child_link(self, child_handle):
|
||||||
"""
|
"""
|
||||||
display child link ...
|
display child link ...
|
||||||
@ -3680,42 +3751,94 @@ class IndividualPage(BasePage):
|
|||||||
# there is a table started underneath a table cell???
|
# there is a table started underneath a table cell???
|
||||||
family_events = family.get_event_ref_list()
|
family_events = family.get_event_ref_list()
|
||||||
|
|
||||||
|
# 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', formatted_event, class_='ColumnValue')
|
||||||
)
|
)
|
||||||
table += trow
|
table += trow
|
||||||
|
|
||||||
# here is where the mess happens...
|
# family LDS ordiannce list
|
||||||
tcell = Html('td', class_='ColumnValue')
|
trow = write_ord_header(False)
|
||||||
trow += tcell
|
table += trow
|
||||||
formatted_event = self.format_event(family_events)
|
|
||||||
tcell += formatted_event
|
for ord in family.get_lds_ord_list():
|
||||||
|
trow = write_ord_data_row(db, ord)
|
||||||
|
table += trow
|
||||||
|
|
||||||
|
# get ordinance notes
|
||||||
|
notelist = ord.get_note_list()
|
||||||
|
if notelist:
|
||||||
|
trow = Html('tr') + (
|
||||||
|
Html('td', ' ', class_='ColumnAttribute', inline=True),
|
||||||
|
Html('td', _('Narrative'), class_='ColumnAttribute', inline=True)
|
||||||
|
)
|
||||||
|
table += trow
|
||||||
|
|
||||||
|
for notehandle in notelist:
|
||||||
|
note = db.get_note_from_handle(notehandle)
|
||||||
|
if note:
|
||||||
|
note_text = self.get_note_format(note)
|
||||||
|
trow = Html('tr') + (
|
||||||
|
Html('td', ' ', class_='ColumnAttribute', inline=True),
|
||||||
|
Html('td', ' ', class_='ColumnAttribute', inline=True),
|
||||||
|
Html('td', note_text, class_='ColumnValue Note', inline=True)
|
||||||
|
)
|
||||||
|
table += trow
|
||||||
|
|
||||||
|
# get ordinance source references
|
||||||
|
sourcerefs = ord.get_source_references()
|
||||||
|
if sourcerefs:
|
||||||
|
trow = Html('tr') + (
|
||||||
|
Html('td', ' ', class_='ColumnAttribute', inline=True),
|
||||||
|
Html('td', _('Source references'), class_='columnAttribute', inline=True)
|
||||||
|
)
|
||||||
|
table += trow
|
||||||
|
|
||||||
|
srcrefs = self.dump_source_references(db, sourcelist)
|
||||||
|
trow += srcrefs
|
||||||
|
|
||||||
# get attributes
|
# get attributes
|
||||||
|
attrlist = family.get_attribute_list()
|
||||||
|
if attrlist:
|
||||||
|
trow = Html('tr') + (
|
||||||
|
Html('td', ' ', class_='ColumnAttribute', inline=True),
|
||||||
|
Html('td', ' ', class_='ColumnAttribute', inline=True),
|
||||||
|
Html('td', _('Attributes'), class_='ColumnAttribute', inline=True)
|
||||||
|
)
|
||||||
|
table += trow
|
||||||
|
|
||||||
for attr in family.get_attribute_list():
|
for attr in family.get_attribute_list():
|
||||||
attrType = str(attr.get_type())
|
attrType = str(attr.get_type())
|
||||||
if attrType:
|
if attrType:
|
||||||
trow = Html('tr') + (
|
trow = Html('tr') + (
|
||||||
Html('td', ' ', class_='ColumnType', inline=True),
|
Html('td', ' ', class_='ColumnValue', inline=True),
|
||||||
Html('td', attrType, class_='ColumnAttribute', inline=True),
|
Html('td', attrType, class_='ColumnValue', inline=True),
|
||||||
Html('td', attr.get_value(), class_='ColumnValue', inline=True)
|
Html('td', attr.get_value(), class_='ColumnValue', inline=True)
|
||||||
)
|
)
|
||||||
table += trow
|
table += trow
|
||||||
|
|
||||||
# get family notes
|
# get family notes
|
||||||
notelist = family.get_note_list()
|
notelist = family.get_note_list()
|
||||||
|
if notelist:
|
||||||
|
|
||||||
|
trow = Html('tr') + (
|
||||||
|
Html('td', _('Narrative'), class_='ColumnAttribute', inline=True)
|
||||||
|
)
|
||||||
|
table += trow
|
||||||
|
|
||||||
for notehandle in notelist:
|
for notehandle in notelist:
|
||||||
|
trow = Html('tr')
|
||||||
|
table += trow
|
||||||
|
|
||||||
note = db.get_note_from_handle(notehandle)
|
note = db.get_note_from_handle(notehandle)
|
||||||
if note:
|
if note:
|
||||||
note_text = self.get_note_format(note)
|
note_text = self.get_note_format(note)
|
||||||
|
|
||||||
trow = Html('tr') + (
|
trow += Html('td', note_text, class_='ColumnValue')
|
||||||
Html('td', ' ', class_='ColumnType', inline=True),
|
|
||||||
Html('td', _('Narrative'), class_='ColumnAttribute', inline=True),
|
|
||||||
Html('td', note_text, class_='ColumnValue')
|
|
||||||
)
|
|
||||||
table += trow
|
|
||||||
|
|
||||||
# return table to its caller
|
# return table to its caller
|
||||||
return table
|
return table
|
||||||
@ -5099,7 +5222,42 @@ def add_birthdate(db, childlist):
|
|||||||
|
|
||||||
return sorted_children
|
return sorted_children
|
||||||
|
|
||||||
# ------------------------------------------
|
def write_ord_header(sealed):
|
||||||
|
|
||||||
|
ord_row = [_('Type'), _('Date'), _('Temple'), _('Place'), _('Status'),
|
||||||
|
_('Sealed to ') ]
|
||||||
|
|
||||||
|
# if True, then Parents else Spouse
|
||||||
|
ord_row[5] += 'Parents' if sealed else 'Spouse'
|
||||||
|
|
||||||
|
trow = Html('tr')
|
||||||
|
for column in ord_row:
|
||||||
|
trow += Html('th', column, class_='ColumnAttribute', inline=True)
|
||||||
|
|
||||||
|
# return table row to its callers
|
||||||
|
return trow
|
||||||
|
|
||||||
|
def write_ord_data_row(db, ord):
|
||||||
|
""" will dump the ordinance information either person or family """
|
||||||
|
|
||||||
|
# begin table row
|
||||||
|
trow = Html('tr')
|
||||||
|
|
||||||
|
for val in [
|
||||||
|
('Type', ord.type2xml()),
|
||||||
|
('Date', _dd.display(ord.get_date_object())),
|
||||||
|
('Temple', ord.get_temple()),
|
||||||
|
('Place', ReportUtils.place_name(db, ord.get_place_handle())),
|
||||||
|
('Status', ord.get_status()),
|
||||||
|
('Sealed', ord.get_family_handle()) ]:
|
||||||
|
|
||||||
|
value = val[1] or ' '
|
||||||
|
trow += Html('td', value, class_='ColumnValue %s' % val[0], inline=True)
|
||||||
|
|
||||||
|
# return table row to its callers
|
||||||
|
return trow
|
||||||
|
|
||||||
|
# -------------------------------------------
|
||||||
#
|
#
|
||||||
# Register Plugin
|
# Register Plugin
|
||||||
#
|
#
|
||||||
|
Loading…
x
Reference in New Issue
Block a user