* src/ReportUtils.py: use today for age calculation if not
death date exists. * src/plugins/NavWebPage.py: handle privacy if requested svn: r4064
This commit is contained in:
parent
25c2598147
commit
352d7d4196
@ -1,3 +1,8 @@
|
||||
2005-02-20 Don Allingham <dallingham@users.sourceforge.net>
|
||||
* src/ReportUtils.py: use today for age calculation if not
|
||||
death date exists.
|
||||
* src/plugins/NavWebPage.py: handle privacy if requested
|
||||
|
||||
2005-02-19 Don Allingham <dallingham@users.sourceforge.net>
|
||||
|
||||
* src/ChooseParents.py: readonly fixes
|
||||
|
@ -27,8 +27,11 @@
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import Date
|
||||
import DateHandler
|
||||
import RelLib
|
||||
from NameDisplay import displayer as _nd
|
||||
import time
|
||||
from gettext import gettext as _
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -168,6 +171,10 @@ def draw_vertical_bar_graph(doc, format, start_x, start_y, height, width, data):
|
||||
doc.draw_bar(data[index][0],start,bottom-size,start+box_width,bottom)
|
||||
start += box_width * 1.5
|
||||
|
||||
|
||||
_t = time.localtime(time.time())
|
||||
_TODAY = DateHandler.parser.parse("%04d-%02d-%02d" % (_t[0],_t[1],_t[2]))
|
||||
|
||||
def estimate_age(db, person, end_handle=None, start_handle=None):
|
||||
"""
|
||||
Estimates the age of a person based off the birth and death
|
||||
@ -202,11 +209,14 @@ def estimate_age(db, person, end_handle=None, start_handle=None):
|
||||
dhandle = person.get_death_handle()
|
||||
|
||||
# if either of the events is not defined, return an error message
|
||||
if not bhandle or not dhandle:
|
||||
if not bhandle:
|
||||
return (-1,-1)
|
||||
|
||||
bdata = db.get_event_from_handle(bhandle).get_date_object()
|
||||
ddata = db.get_event_from_handle(dhandle).get_date_object()
|
||||
if dhandle:
|
||||
ddata = db.get_event_from_handle(dhandle).get_date_object()
|
||||
else:
|
||||
ddata = _TODAY
|
||||
|
||||
# if the date is not valid, return an error message
|
||||
if not bdata.get_valid() or not ddata.get_valid():
|
||||
@ -263,21 +273,31 @@ def sanitize_person(db,person):
|
||||
|
||||
# copy gender
|
||||
new_person.set_gender(person.get_gender())
|
||||
|
||||
new_person.set_gramps_id(person.get_gramps_id())
|
||||
new_person.set_handle(person.get_handle())
|
||||
|
||||
# copy names if not private
|
||||
name = person.get_primary_name()
|
||||
if name.get_privacy() or person.get_privacy():
|
||||
name = RelLib.Name()
|
||||
name.set_first_name(_('Private'))
|
||||
name.set_surname(_('Private'))
|
||||
else:
|
||||
name = person.get_primary_name()
|
||||
new_person.set_nick_name(person.get_nick_name())
|
||||
|
||||
new_person.set_primary_name(name)
|
||||
# copy Family reference list
|
||||
for handle in person.get_family_handle_list():
|
||||
new_person.add_family_handle(handle)
|
||||
|
||||
# copy Family reference list
|
||||
for item in person.get_parent_family_handle_list():
|
||||
new_person.add_parent_family_handle(item[0],item[1],item[2])
|
||||
|
||||
|
||||
if person.get_privacy():
|
||||
return new_person
|
||||
|
||||
new_person.set_primary_name(name)
|
||||
|
||||
for name in person.get_alternate_names():
|
||||
if not name.get_privacy():
|
||||
new_person.add_alternate_name(name)
|
||||
@ -322,10 +342,6 @@ def sanitize_person(db,person):
|
||||
for obj in person.get_media_list():
|
||||
new_person.add_media_reference(RelLib.MediaRef(obj))
|
||||
|
||||
# copy Family reference list
|
||||
for handle in person.get_family_handle_list():
|
||||
new_person.add_family_handle(handle)
|
||||
|
||||
# LDS ordinances
|
||||
ordinance = person.get_lds_baptism()
|
||||
if ordinance:
|
||||
|
@ -131,44 +131,44 @@ class BasePage:
|
||||
def lnkfmt(self,text):
|
||||
return text.replace(' ','%20')
|
||||
|
||||
def display_footer(self,ofile):
|
||||
ofile.write('<br>\n')
|
||||
ofile.write('<br>\n')
|
||||
ofile.write('<hr>\n')
|
||||
ofile.write('<div class="footer">Generated by ')
|
||||
ofile.write('<a href="http://gramps.sourceforge.net">GRAMPS</a> ')
|
||||
ofile.write('on 13 December 2004.')
|
||||
ofile.write('</div>\n')
|
||||
ofile.write('</body>\n')
|
||||
ofile.write('</html>\n')
|
||||
def display_footer(self,of):
|
||||
of.write('<br>\n')
|
||||
of.write('<br>\n')
|
||||
of.write('<hr>\n')
|
||||
of.write('<div class="footer">Generated by ')
|
||||
of.write('<a href="http://gramps.sourceforge.net">GRAMPS</a> ')
|
||||
of.write('on 13 December 2004.')
|
||||
of.write('</div>\n')
|
||||
of.write('</body>\n')
|
||||
of.write('</html>\n')
|
||||
|
||||
def display_header(self,ofile,title,author=""):
|
||||
ofile.write('<!DOCTYPE HTML PUBLIC ')
|
||||
ofile.write('"-//W3C//DTD HTML 4.01 Transitional//EN">\n')
|
||||
ofile.write('<html>\n<head>\n')
|
||||
ofile.write('<title>%s</title>\n' % self.title_str)
|
||||
ofile.write('<meta http-equiv="Content-Type" content="text/html; ')
|
||||
ofile.write('charset=ISO-8859-1">\n')
|
||||
ofile.write('<link href="%s" ' % _NARRATIVE)
|
||||
ofile.write('rel="stylesheet" type="text/css">\n')
|
||||
ofile.write('<link href="favicon.png" rel="Shortcut Icon">\n')
|
||||
ofile.write('</head>\n')
|
||||
ofile.write('<body>\n')
|
||||
ofile.write('<div class="navheader">\n')
|
||||
ofile.write(' <div class="navbyline">By: %s</div>\n' % author)
|
||||
ofile.write(' <h1 class="navtitle">%s</h1>\n' % self.title_str)
|
||||
ofile.write(' <hr>\n')
|
||||
ofile.write(' <div class="nav">\n')
|
||||
ofile.write(' <a href="index.html">Home</a> \n')
|
||||
ofile.write(' <a href="introduction.html">Introduction</a> \n')
|
||||
ofile.write(' <a href="surnames.html">Surnames</a> \n')
|
||||
ofile.write(' <a href="individuals.html">Individuals</a> \n')
|
||||
ofile.write(' <a href="sources.html">Sources</a> \n')
|
||||
ofile.write(' <a href="places.html">Places</a> \n')
|
||||
ofile.write(' <a href="download.html">Download</a> \n')
|
||||
ofile.write(' <a href="contact.html">Contact</a> \n')
|
||||
ofile.write(' </div>\n')
|
||||
ofile.write(' </div>\n')
|
||||
def display_header(self,of,title,author=""):
|
||||
of.write('<!DOCTYPE HTML PUBLIC ')
|
||||
of.write('"-//W3C//DTD HTML 4.01 Transitional//EN">\n')
|
||||
of.write('<html>\n<head>\n')
|
||||
of.write('<title>%s</title>\n' % self.title_str)
|
||||
of.write('<meta http-equiv="Content-Type" content="text/html; ')
|
||||
of.write('charset=ISO-8859-1">\n')
|
||||
of.write('<link href="%s" ' % _NARRATIVE)
|
||||
of.write('rel="stylesheet" type="text/css">\n')
|
||||
of.write('<link href="favicon.png" rel="Shortcut Icon">\n')
|
||||
of.write('</head>\n')
|
||||
of.write('<body>\n')
|
||||
of.write('<div class="navheader">\n')
|
||||
of.write(' <div class="navbyline">By: %s</div>\n' % author)
|
||||
of.write(' <h1 class="navtitle">%s</h1>\n' % self.title_str)
|
||||
of.write(' <hr>\n')
|
||||
of.write(' <div class="nav">\n')
|
||||
of.write(' <a href="index.html">Home</a> \n')
|
||||
of.write(' <a href="introduction.html">Introduction</a> \n')
|
||||
of.write(' <a href="surnames.html">Surnames</a> \n')
|
||||
of.write(' <a href="individuals.html">Individuals</a> \n')
|
||||
of.write(' <a href="sources.html">Sources</a> \n')
|
||||
of.write(' <a href="places.html">Places</a> \n')
|
||||
of.write(' <a href="download.html">Download</a> \n')
|
||||
of.write(' <a href="contact.html">Contact</a> \n')
|
||||
of.write(' </div>\n')
|
||||
of.write(' </div>\n')
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -181,18 +181,18 @@ class IndividualListPage(BasePage):
|
||||
BasePage.__init__(self,title)
|
||||
page_name = os.path.join(html_dir,"individuals.html")
|
||||
|
||||
ofile = open(page_name, "w")
|
||||
self.display_header(ofile,_('Individuals'),
|
||||
of = open(page_name, "w")
|
||||
self.display_header(of,_('Individuals'),
|
||||
db.get_researcher().get_name())
|
||||
|
||||
ofile.write('<h3>%s</h3>\n' % _('Individuals'))
|
||||
ofile.write('<p>%s</p>\n' % _('Index of individuals, sorted by last name.'))
|
||||
ofile.write('<blockquote>\n')
|
||||
ofile.write('<table class="infolist" cellspacing="0" ')
|
||||
ofile.write('cellpadding="0" border="0">\n')
|
||||
ofile.write('<tr><td class="field"><u><b>%s</b></u></td>\n' % _('Surname'))
|
||||
ofile.write('<td class="field"><u><b>%s</b></u></td>\n' % _('Name'))
|
||||
ofile.write('</tr>\n')
|
||||
of.write('<h3>%s</h3>\n' % _('Individuals'))
|
||||
of.write('<p>%s</p>\n' % _('Index of individuals, sorted by last name.'))
|
||||
of.write('<blockquote>\n')
|
||||
of.write('<table class="infolist" cellspacing="0" ')
|
||||
of.write('cellpadding="0" border="0">\n')
|
||||
of.write('<tr><td class="field"><u><b>%s</b></u></td>\n' % _('Surname'))
|
||||
of.write('<td class="field"><u><b>%s</b></u></td>\n' % _('Name'))
|
||||
of.write('</tr>\n')
|
||||
|
||||
self.sort = Sort.Sort(db)
|
||||
person_handle_list.sort(self.sort.by_last_name)
|
||||
@ -202,22 +202,22 @@ class IndividualListPage(BasePage):
|
||||
person = db.get_person_from_handle(person_handle)
|
||||
n = person.get_primary_name().get_surname()
|
||||
if n != last_surname:
|
||||
ofile.write('<tr><td colspan="2"> </td></tr>\n')
|
||||
ofile.write('<tr><td class="category">')
|
||||
of.write('<tr><td colspan="2"> </td></tr>\n')
|
||||
of.write('<tr><td class="category">')
|
||||
if n != last_surname:
|
||||
ofile.write('<a name="%s">%s</a>' % (self.lnkfmt(n),n))
|
||||
of.write('<a name="%s">%s</a>' % (self.lnkfmt(n),n))
|
||||
else:
|
||||
ofile.write(' ')
|
||||
ofile.write('</td><td class="data">')
|
||||
ofile.write(person.get_primary_name().get_first_name())
|
||||
ofile.write(' <a href="%s.html">' % person.gramps_id)
|
||||
ofile.write("<sup>[%s]</sup>" % person.gramps_id)
|
||||
ofile.write('</a></td></tr>\n')
|
||||
of.write(' ')
|
||||
of.write('</td><td class="data">')
|
||||
of.write(person.get_primary_name().get_first_name())
|
||||
of.write(' <a href="%s.html">' % person.gramps_id)
|
||||
of.write("<sup>[%s]</sup>" % person.gramps_id)
|
||||
of.write('</a></td></tr>\n')
|
||||
last_surname = n
|
||||
|
||||
ofile.write('</table>\n</blockquote>\n')
|
||||
self.display_footer(ofile)
|
||||
ofile.close()
|
||||
of.write('</table>\n</blockquote>\n')
|
||||
self.display_footer(of)
|
||||
of.close()
|
||||
return
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
@ -230,22 +230,22 @@ class PlaceListPage(BasePage):
|
||||
def __init__(self, db, title, place_handles, html_dir, src_list):
|
||||
BasePage.__init__(self,title)
|
||||
page_name = os.path.join(html_dir,"places.html")
|
||||
ofile = open(page_name, "w")
|
||||
self.display_header(ofile,_('Places'),
|
||||
of = open(page_name, "w")
|
||||
self.display_header(of,_('Places'),
|
||||
db.get_researcher().get_name())
|
||||
|
||||
ofile.write('<h3>%s</h3>\n' % _('Places'))
|
||||
ofile.write('<p>%s</p>\n' % _('Index of all the places in the '
|
||||
of.write('<h3>%s</h3>\n' % _('Places'))
|
||||
of.write('<p>%s</p>\n' % _('Index of all the places in the '
|
||||
'project.'))
|
||||
|
||||
ofile.write('<blockquote>\n')
|
||||
ofile.write('<table class="infolist" cellspacing="0" ')
|
||||
ofile.write('cellpadding="0" border="0">\n')
|
||||
ofile.write('<tr><td class="field"><u>')
|
||||
ofile.write('<b>%s</b></u></td>\n' % _('Letter'))
|
||||
ofile.write('<td class="field"><u>')
|
||||
ofile.write('<b>%s</b></u></td>\n' % _('Place'))
|
||||
ofile.write('</tr>\n')
|
||||
of.write('<blockquote>\n')
|
||||
of.write('<table class="infolist" cellspacing="0" ')
|
||||
of.write('cellpadding="0" border="0">\n')
|
||||
of.write('<tr><td class="field"><u>')
|
||||
of.write('<b>%s</b></u></td>\n' % _('Letter'))
|
||||
of.write('<td class="field"><u>')
|
||||
of.write('<b>%s</b></u></td>\n' % _('Place'))
|
||||
of.write('</tr>\n')
|
||||
|
||||
self.sort = Sort.Sort(db)
|
||||
handle_list = list(place_handles)
|
||||
@ -262,25 +262,25 @@ class PlaceListPage(BasePage):
|
||||
|
||||
if n[0] != last_letter:
|
||||
last_letter = n[0]
|
||||
ofile.write('<tr><td colspan="2"> </td></tr>\n')
|
||||
ofile.write('<tr><td class="category">%s</td>' % last_letter)
|
||||
ofile.write('<td class="data">')
|
||||
ofile.write(n)
|
||||
ofile.write(' <sup><a href="%s.html">' % place.gramps_id)
|
||||
ofile.write('[%s]' % place.gramps_id)
|
||||
ofile.write('</a></sup></td></tr>')
|
||||
of.write('<tr><td colspan="2"> </td></tr>\n')
|
||||
of.write('<tr><td class="category">%s</td>' % last_letter)
|
||||
of.write('<td class="data">')
|
||||
of.write(n)
|
||||
of.write(' <sup><a href="%s.html">' % place.gramps_id)
|
||||
of.write('[%s]' % place.gramps_id)
|
||||
of.write('</a></sup></td></tr>')
|
||||
elif n != last_letter:
|
||||
last_surname = n
|
||||
ofile.write('<tr><td class="category"> </td>')
|
||||
ofile.write('<td class="data">')
|
||||
ofile.write(n)
|
||||
ofile.write(' <sup><a href="%s">' % place.gramps_id)
|
||||
ofile.write('[%s]' % place.gramps_id)
|
||||
ofile.write('</a></sup></td></tr>')
|
||||
of.write('<tr><td class="category"> </td>')
|
||||
of.write('<td class="data">')
|
||||
of.write(n)
|
||||
of.write(' <sup><a href="%s">' % place.gramps_id)
|
||||
of.write('[%s]' % place.gramps_id)
|
||||
of.write('</a></sup></td></tr>')
|
||||
|
||||
ofile.write('</table>\n</blockquote>\n')
|
||||
self.display_footer(ofile)
|
||||
ofile.close()
|
||||
of.write('</table>\n</blockquote>\n')
|
||||
self.display_footer(of)
|
||||
of.close()
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -293,24 +293,24 @@ class SurnameListPage(BasePage):
|
||||
BasePage.__init__(self,title)
|
||||
page_name = os.path.join(html_dir,"surnames.html")
|
||||
|
||||
ofile = open(page_name, "w")
|
||||
self.display_header(ofile,_('Surnames'),
|
||||
of = open(page_name, "w")
|
||||
self.display_header(of,_('Surnames'),
|
||||
db.get_researcher().get_name())
|
||||
|
||||
ofile.write('<h3>%s</h3>\n' % _('Surnames'))
|
||||
ofile.write('<p>%s</p>\n' % _('Index of all the surnames in the '
|
||||
of.write('<h3>%s</h3>\n' % _('Surnames'))
|
||||
of.write('<p>%s</p>\n' % _('Index of all the surnames in the '
|
||||
'project. The links lead to a list '
|
||||
'of individuals in the database with '
|
||||
'this same surname.'))
|
||||
|
||||
ofile.write('<blockquote>\n')
|
||||
ofile.write('<table class="infolist" cellspacing="0" ')
|
||||
ofile.write('cellpadding="0" border="0">\n')
|
||||
ofile.write('<tr><td class="field"><u>')
|
||||
ofile.write('<b>%s</b></u></td>\n' % _('Letter'))
|
||||
ofile.write('<td class="field"><u>')
|
||||
ofile.write('<b>%s</b></u></td>\n' % _('Surname'))
|
||||
ofile.write('</tr>\n')
|
||||
of.write('<blockquote>\n')
|
||||
of.write('<table class="infolist" cellspacing="0" ')
|
||||
of.write('cellpadding="0" border="0">\n')
|
||||
of.write('<tr><td class="field"><u>')
|
||||
of.write('<b>%s</b></u></td>\n' % _('Letter'))
|
||||
of.write('<td class="field"><u>')
|
||||
of.write('<b>%s</b></u></td>\n' % _('Surname'))
|
||||
of.write('</tr>\n')
|
||||
|
||||
self.sort = Sort.Sort(db)
|
||||
person_handle_list.sort(self.sort.by_last_name)
|
||||
@ -326,22 +326,22 @@ class SurnameListPage(BasePage):
|
||||
|
||||
if n[0] != last_letter:
|
||||
last_letter = n[0]
|
||||
ofile.write('<tr><td class="category">%s</td>' % last_letter)
|
||||
ofile.write('<td class="data">')
|
||||
ofile.write('<a href="individuals.html#%s">' % self.lnkfmt(n))
|
||||
ofile.write(n)
|
||||
ofile.write('</a></td></tr>')
|
||||
of.write('<tr><td class="category">%s</td>' % last_letter)
|
||||
of.write('<td class="data">')
|
||||
of.write('<a href="individuals.html#%s">' % self.lnkfmt(n))
|
||||
of.write(n)
|
||||
of.write('</a></td></tr>')
|
||||
elif n != last_surname:
|
||||
last_surname = n
|
||||
ofile.write('<tr><td class="category"> </td>')
|
||||
ofile.write('<td class="data">')
|
||||
ofile.write('<a href="individuals.html#%s">' % self.lnkfmt(n))
|
||||
ofile.write(n)
|
||||
ofile.write('</a></td></tr>')
|
||||
of.write('<tr><td class="category"> </td>')
|
||||
of.write('<td class="data">')
|
||||
of.write('<a href="individuals.html#%s">' % self.lnkfmt(n))
|
||||
of.write(n)
|
||||
of.write('</a></td></tr>')
|
||||
|
||||
ofile.write('</table>\n</blockquote>\n')
|
||||
self.display_footer(ofile)
|
||||
ofile.close()
|
||||
of.write('</table>\n</blockquote>\n')
|
||||
self.display_footer(of)
|
||||
of.close()
|
||||
return
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
@ -355,14 +355,14 @@ class IntroductionPage(BasePage):
|
||||
BasePage.__init__(self,title)
|
||||
page_name = os.path.join(html_dir,"introduction.html")
|
||||
|
||||
ofile = open(page_name, "w")
|
||||
self.display_header(ofile,_('Introduction'),
|
||||
of = open(page_name, "w")
|
||||
self.display_header(of,_('Introduction'),
|
||||
db.get_researcher().get_name())
|
||||
|
||||
ofile.write('<h3>%s</h3>\n' % _('Introduction'))
|
||||
of.write('<h3>%s</h3>\n' % _('Introduction'))
|
||||
|
||||
self.display_footer(ofile)
|
||||
ofile.close()
|
||||
self.display_footer(of)
|
||||
of.close()
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -375,14 +375,14 @@ class HomePage(BasePage):
|
||||
BasePage.__init__(self,title)
|
||||
page_name = os.path.join(html_dir,"index.html")
|
||||
|
||||
ofile = open(page_name, "w")
|
||||
self.display_header(ofile,_('Home'),
|
||||
of = open(page_name, "w")
|
||||
self.display_header(of,_('Home'),
|
||||
db.get_researcher().get_name())
|
||||
|
||||
ofile.write('<h3>%s</h3>\n' % _('Home'))
|
||||
of.write('<h3>%s</h3>\n' % _('Home'))
|
||||
|
||||
self.display_footer(ofile)
|
||||
ofile.close()
|
||||
self.display_footer(of)
|
||||
of.close()
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -395,26 +395,26 @@ class SourcesPage(BasePage):
|
||||
BasePage.__init__(self,title)
|
||||
page_name = os.path.join(html_dir,"sources.html")
|
||||
|
||||
ofile = open(page_name, "w")
|
||||
self.display_header(ofile,_('Sources'),
|
||||
of = open(page_name, "w")
|
||||
self.display_header(of,_('Sources'),
|
||||
db.get_researcher().get_name())
|
||||
|
||||
handle_list = list(handle_set)
|
||||
|
||||
ofile.write('<h3>%s</h3>\n<p>' % _('Sources'))
|
||||
ofile.write(_('All sources cited in the project.'))
|
||||
ofile.write('</p>\n<blockquote>\n<table class="infolist">\n')
|
||||
of.write('<h3>%s</h3>\n<p>' % _('Sources'))
|
||||
of.write(_('All sources cited in the project.'))
|
||||
of.write('</p>\n<blockquote>\n<table class="infolist">\n')
|
||||
|
||||
index = 1
|
||||
for handle in handle_list:
|
||||
ofile.write('<tr><td class="category">%d.</td>\n' % index)
|
||||
ofile.write('<td class="data">')
|
||||
ofile.write('</td></tr>\n')
|
||||
of.write('<tr><td class="category">%d.</td>\n' % index)
|
||||
of.write('<td class="data">')
|
||||
of.write('</td></tr>\n')
|
||||
|
||||
ofile.write('</table>\n<blockquote>\n')
|
||||
of.write('</table>\n<blockquote>\n')
|
||||
|
||||
self.display_footer(ofile)
|
||||
ofile.close()
|
||||
self.display_footer(of)
|
||||
of.close()
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -427,14 +427,14 @@ class DownloadPage(BasePage):
|
||||
BasePage.__init__(self,title)
|
||||
page_name = os.path.join(html_dir,"download.html")
|
||||
|
||||
ofile = open(page_name, "w")
|
||||
self.display_header(ofile,_('Download'),
|
||||
of = open(page_name, "w")
|
||||
self.display_header(of,_('Download'),
|
||||
db.get_researcher().get_name())
|
||||
|
||||
ofile.write('<h3>%s</h3>\n' % _('Download'))
|
||||
of.write('<h3>%s</h3>\n' % _('Download'))
|
||||
|
||||
self.display_footer(ofile)
|
||||
ofile.close()
|
||||
self.display_footer(of)
|
||||
of.close()
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -447,14 +447,14 @@ class ContactPage(BasePage):
|
||||
BasePage.__init__(self,title)
|
||||
page_name = os.path.join(html_dir,"contact.html")
|
||||
|
||||
ofile = open(page_name, "w")
|
||||
self.display_header(ofile,_('Contact'),
|
||||
of = open(page_name, "w")
|
||||
self.display_header(of,_('Contact'),
|
||||
db.get_researcher().get_name())
|
||||
|
||||
ofile.write('<h3>%s</h3>\n' % _('Contact'))
|
||||
of.write('<h3>%s</h3>\n' % _('Contact'))
|
||||
|
||||
self.display_footer(ofile)
|
||||
ofile.close()
|
||||
self.display_footer(of)
|
||||
of.close()
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -481,26 +481,26 @@ class IndividualPage(BasePage):
|
||||
self.sort_name = _nd.sorted(self.person)
|
||||
self.name = _nd.sorted(self.person)
|
||||
|
||||
ofile = open(os.path.join(dirpath,"%s.html" % person.gramps_id), "w")
|
||||
self.display_header(ofile, title,
|
||||
of = open(os.path.join(dirpath,"%s.html" % person.gramps_id), "w")
|
||||
self.display_header(of, title,
|
||||
self.db.get_researcher().get_name())
|
||||
self.display_ind_general(ofile)
|
||||
self.display_ind_events(ofile)
|
||||
self.display_ind_relationships(ofile)
|
||||
self.display_ind_narrative(ofile)
|
||||
self.display_ind_sources(ofile)
|
||||
self.display_ind_pedigree(ofile)
|
||||
self.display_footer(ofile)
|
||||
ofile.close()
|
||||
self.display_ind_general(of)
|
||||
self.display_ind_events(of)
|
||||
self.display_ind_relationships(of)
|
||||
self.display_ind_narrative(of)
|
||||
self.display_ind_sources(of)
|
||||
self.display_ind_pedigree(of)
|
||||
self.display_footer(of)
|
||||
of.close()
|
||||
|
||||
def display_ind_sources(self,ofile):
|
||||
def display_ind_sources(self,of):
|
||||
sreflist = self.person.get_source_references()
|
||||
if not sreflist:
|
||||
return
|
||||
ofile.write('<h4>%s</h4>\n' % _('Sources'))
|
||||
ofile.write('<hr>\n')
|
||||
ofile.write('<table class="infolist" cellpadding="0" ')
|
||||
ofile.write('cellspacing="0" border="0">\n')
|
||||
of.write('<h4>%s</h4>\n' % _('Sources'))
|
||||
of.write('<hr>\n')
|
||||
of.write('<table class="infolist" cellpadding="0" ')
|
||||
of.write('cellspacing="0" border="0">\n')
|
||||
|
||||
index = 1
|
||||
for sref in sreflist:
|
||||
@ -511,7 +511,7 @@ class IndividualPage(BasePage):
|
||||
title = source.get_title()
|
||||
publisher = source.get_publication_info()
|
||||
date = _dd.display(sref.get_date())
|
||||
ofile.write('<tr><td class="field">%d. ' % index)
|
||||
of.write('<tr><td class="field">%d. ' % index)
|
||||
values = []
|
||||
if author:
|
||||
values.append(author)
|
||||
@ -521,11 +521,11 @@ class IndividualPage(BasePage):
|
||||
values.append(publisher)
|
||||
if date:
|
||||
values.append(date)
|
||||
ofile.write(', '.join(values))
|
||||
ofile.write('</td></tr>\n')
|
||||
ofile.write('</table>\n')
|
||||
of.write(', '.join(values))
|
||||
of.write('</td></tr>\n')
|
||||
of.write('</table>\n')
|
||||
|
||||
def display_ind_pedigree(self,ofile):
|
||||
def display_ind_pedigree(self,of):
|
||||
|
||||
parent_handle_list = self.person.get_parent_family_handle_list()
|
||||
if parent_handle_list:
|
||||
@ -540,36 +540,36 @@ class IndividualPage(BasePage):
|
||||
father = None
|
||||
mother = None
|
||||
|
||||
ofile.write('<h4>%s</h4>\n' % _('Pedigree'))
|
||||
ofile.write('<hr>\n<br>\n')
|
||||
ofile.write('<table class="pedigree">\n')
|
||||
ofile.write('<tr><td>\n')
|
||||
of.write('<h4>%s</h4>\n' % _('Pedigree'))
|
||||
of.write('<hr>\n<br>\n')
|
||||
of.write('<table class="pedigree">\n')
|
||||
of.write('<tr><td>\n')
|
||||
if father or mother:
|
||||
ofile.write('<blockquote class="pedigreeind">\n')
|
||||
of.write('<blockquote class="pedigreeind">\n')
|
||||
if father:
|
||||
self.pedigree_person(ofile,father)
|
||||
self.pedigree_person(of,father)
|
||||
if mother:
|
||||
self.pedigree_person(ofile,mother)
|
||||
ofile.write('<blockquote class="pedigreeind">\n')
|
||||
self.pedigree_person(of,mother)
|
||||
of.write('<blockquote class="pedigreeind">\n')
|
||||
if family:
|
||||
for child_handle in family.get_child_handle_list():
|
||||
if child_handle == self.person.handle:
|
||||
ofile.write('| <strong>%s</strong><br>\n' % self.name)
|
||||
self.pedigree_family(ofile)
|
||||
of.write('| <strong>%s</strong><br>\n' % self.name)
|
||||
self.pedigree_family(of)
|
||||
else:
|
||||
child = self.db.get_person_from_handle(child_handle)
|
||||
self.pedigree_person(ofile,child)
|
||||
self.pedigree_person(of,child)
|
||||
else:
|
||||
ofile.write('| <strong>%s</strong><br>\n' % self.name)
|
||||
self.pedigree_family(ofile)
|
||||
of.write('| <strong>%s</strong><br>\n' % self.name)
|
||||
self.pedigree_family(of)
|
||||
|
||||
ofile.write('</blockquote>\n')
|
||||
of.write('</blockquote>\n')
|
||||
if father or mother:
|
||||
ofile.write('</blockquote>\n')
|
||||
ofile.write('</td>\n</tr>\n</table>\n')
|
||||
of.write('</blockquote>\n')
|
||||
of.write('</td>\n</tr>\n</table>\n')
|
||||
|
||||
|
||||
def display_ind_general(self,ofile):
|
||||
def display_ind_general(self,of):
|
||||
photolist = self.person.get_media_list()
|
||||
if photolist:
|
||||
photo_handle = photolist[0].get_reference_handle()
|
||||
@ -577,62 +577,62 @@ class IndividualPage(BasePage):
|
||||
|
||||
newpath = self.person.gramps_id + os.path.splitext(photo.get_path())[1]
|
||||
shutil.copyfile(photo.get_path(),os.path.join(self.dirpath,newpath))
|
||||
ofile.write('<div class="snapshot">\n')
|
||||
ofile.write('<a href="%s">' % newpath)
|
||||
ofile.write('<img class="thumbnail" border="0" src="%s" ' % newpath)
|
||||
ofile.write('height="100"></a>')
|
||||
ofile.write('</div>\n')
|
||||
of.write('<div class="snapshot">\n')
|
||||
of.write('<a href="%s">' % newpath)
|
||||
of.write('<img class="thumbnail" border="0" src="%s" ' % newpath)
|
||||
of.write('height="100"></a>')
|
||||
of.write('</div>\n')
|
||||
|
||||
ofile.write('<div class="summaryarea">\n')
|
||||
ofile.write('<h3>%s</h3>\n' % self.sort_name)
|
||||
ofile.write('<table class="infolist" cellpadding="0" cellspacing="0" ')
|
||||
ofile.write('border="0">\n')
|
||||
of.write('<div class="summaryarea">\n')
|
||||
of.write('<h3>%s</h3>\n' % self.sort_name)
|
||||
of.write('<table class="infolist" cellpadding="0" cellspacing="0" ')
|
||||
of.write('border="0">\n')
|
||||
|
||||
# Gender
|
||||
ofile.write('<tr><td class="field">%s</td>\n' % _('Gender'))
|
||||
of.write('<tr><td class="field">%s</td>\n' % _('Gender'))
|
||||
gender = self.gender_map[self.person.gender]
|
||||
ofile.write('<td class="data">%s</td>\n' % gender)
|
||||
ofile.write('</tr>\n')
|
||||
of.write('<td class="data">%s</td>\n' % gender)
|
||||
of.write('</tr>\n')
|
||||
|
||||
# Birth
|
||||
handle = self.person.get_birth_handle()
|
||||
if handle:
|
||||
event = self.db.get_event_from_handle(handle)
|
||||
ofile.write('<tr><td class="field">%s</td>\n' % _('Birth'))
|
||||
ofile.write('<td class="data">%s</td>\n' % self.format_event(event))
|
||||
ofile.write('</tr>\n')
|
||||
of.write('<tr><td class="field">%s</td>\n' % _('Birth'))
|
||||
of.write('<td class="data">%s</td>\n' % self.format_event(event))
|
||||
of.write('</tr>\n')
|
||||
|
||||
# Death
|
||||
handle = self.person.get_death_handle()
|
||||
if handle:
|
||||
event = self.db.get_event_from_handle(handle)
|
||||
ofile.write('<tr><td class="field">%s</td>\n' % _('Death'))
|
||||
ofile.write('<td class="data">%s</td>\n' % self.format_event(event))
|
||||
ofile.write('</tr>\n')
|
||||
of.write('<tr><td class="field">%s</td>\n' % _('Death'))
|
||||
of.write('<td class="data">%s</td>\n' % self.format_event(event))
|
||||
of.write('</tr>\n')
|
||||
|
||||
ofile.write('</table>\n')
|
||||
ofile.write('</div>\n')
|
||||
of.write('</table>\n')
|
||||
of.write('</div>\n')
|
||||
|
||||
def display_ind_events(self,ofile):
|
||||
ofile.write('<h4>%s</h4>\n' % _('Events'))
|
||||
ofile.write('<hr>\n')
|
||||
ofile.write('<table class="infolist" cellpadding="0" cellspacing="0" ')
|
||||
ofile.write('border="0">\n')
|
||||
def display_ind_events(self,of):
|
||||
of.write('<h4>%s</h4>\n' % _('Events'))
|
||||
of.write('<hr>\n')
|
||||
of.write('<table class="infolist" cellpadding="0" cellspacing="0" ')
|
||||
of.write('border="0">\n')
|
||||
|
||||
for event_id in self.person.get_event_list():
|
||||
event = self.db.get_event_from_handle(event_id)
|
||||
|
||||
ofile.write('<tr><td class="field">%s</td>\n' % event.get_name())
|
||||
ofile.write('<td class="data">\n')
|
||||
ofile.write(self.format_event(event))
|
||||
ofile.write('</td>\n')
|
||||
ofile.write('</tr>\n')
|
||||
of.write('<tr><td class="field">%s</td>\n' % event.get_name())
|
||||
of.write('<td class="data">\n')
|
||||
of.write(self.format_event(event))
|
||||
of.write('</td>\n')
|
||||
of.write('</tr>\n')
|
||||
|
||||
ofile.write('</table>\n')
|
||||
of.write('</table>\n')
|
||||
|
||||
def display_ind_narrative(self,ofile):
|
||||
ofile.write('<h4>%s</h4>\n' % _('Narrative'))
|
||||
ofile.write('<hr>\n')
|
||||
def display_ind_narrative(self,of):
|
||||
of.write('<h4>%s</h4>\n' % _('Narrative'))
|
||||
of.write('<hr>\n')
|
||||
|
||||
noteobj = self.person.get_note_object()
|
||||
if noteobj:
|
||||
@ -643,73 +643,73 @@ class IndividualPage(BasePage):
|
||||
text = "<pre>" + "<br>".join(text.split("\n"))
|
||||
else:
|
||||
text = "</p><p>".join(text.split("\n"))
|
||||
ofile.write('<p>%s</p>\n' % text)
|
||||
of.write('<p>%s</p>\n' % text)
|
||||
|
||||
|
||||
def display_parent(self,ofile,handle,title):
|
||||
def display_parent(self,of,handle,title):
|
||||
use_link = handle in self.ind_list
|
||||
person = self.db.get_person_from_handle(handle)
|
||||
ofile.write('<td class="field">%s</td>\n' % title)
|
||||
ofile.write('<td class="data">')
|
||||
ofile.write(_nd.display(person))
|
||||
of.write('<td class="field">%s</td>\n' % title)
|
||||
of.write('<td class="data">')
|
||||
of.write(_nd.display(person))
|
||||
if use_link:
|
||||
val = person.gramps_id
|
||||
ofile.write(' <sup><a href="%s.html">[%s]</a></sup>' % (val,val))
|
||||
ofile.write('</td>\n')
|
||||
of.write(' <sup><a href="%s.html">[%s]</a></sup>' % (val,val))
|
||||
of.write('</td>\n')
|
||||
|
||||
def display_ind_relationships(self,ofile):
|
||||
def display_ind_relationships(self,of):
|
||||
parent_list = self.person.get_parent_family_handle_list()
|
||||
family_list = self.person.get_family_handle_list()
|
||||
|
||||
if not parent_list and not family_list:
|
||||
return
|
||||
|
||||
ofile.write('<h4>%s</h4>\n' % _("Relationships"))
|
||||
ofile.write('<hr>\n')
|
||||
ofile.write('<table class="infolist" cellpadding="0" cellspacing="0" border="0">\n')
|
||||
of.write('<h4>%s</h4>\n' % _("Relationships"))
|
||||
of.write('<hr>\n')
|
||||
of.write('<table class="infolist" cellpadding="0" cellspacing="0" border="0">\n')
|
||||
|
||||
if parent_list:
|
||||
for (family_handle,mrel,frel) in parent_list:
|
||||
family = self.db.get_family_from_handle(family_handle)
|
||||
|
||||
ofile.write('<tr><td colspan="3"> </td></tr>\n')
|
||||
ofile.write('<tr><td class="category">%s</td>\n' % _("Parents"))
|
||||
of.write('<tr><td colspan="3"> </td></tr>\n')
|
||||
of.write('<tr><td class="category">%s</td>\n' % _("Parents"))
|
||||
|
||||
father_handle = family.get_father_handle()
|
||||
if father_handle:
|
||||
self.display_parent(ofile,father_handle,_('Father'))
|
||||
ofile.write('</tr><tr><td> </td>\n')
|
||||
self.display_parent(of,father_handle,_('Father'))
|
||||
of.write('</tr><tr><td> </td>\n')
|
||||
mother_handle = family.get_mother_handle()
|
||||
if mother_handle:
|
||||
self.display_parent(ofile,mother_handle,_('Mother'))
|
||||
ofile.write('</tr>\n')
|
||||
ofile.write('<tr><td colspan="3"> </td></tr>\n')
|
||||
self.display_parent(of,mother_handle,_('Mother'))
|
||||
of.write('</tr>\n')
|
||||
of.write('<tr><td colspan="3"> </td></tr>\n')
|
||||
|
||||
if family_list:
|
||||
ofile.write('<tr><td class="category">%s</td>\n' % _("Spouses"))
|
||||
of.write('<tr><td class="category">%s</td>\n' % _("Spouses"))
|
||||
first = True
|
||||
for family_handle in family_list:
|
||||
family = self.db.get_family_from_handle(family_handle)
|
||||
self.display_spouse(ofile,family,first)
|
||||
self.display_spouse(of,family,first)
|
||||
first = False
|
||||
childlist = family.get_child_handle_list()
|
||||
if childlist:
|
||||
ofile.write('<tr><td> </td>\n')
|
||||
ofile.write('<td class="field">%s</td>\n' % _("Children"))
|
||||
ofile.write('<td class="data">\n')
|
||||
of.write('<tr><td> </td>\n')
|
||||
of.write('<td class="field">%s</td>\n' % _("Children"))
|
||||
of.write('<td class="data">\n')
|
||||
for child_handle in childlist:
|
||||
use_link = child_handle in self.ind_list
|
||||
child = self.db.get_person_from_handle(child_handle)
|
||||
if use_link:
|
||||
ofile.write('<a href="%s.html">' % child.get_gramps_id())
|
||||
ofile.write(_nd.display(child))
|
||||
of.write('<a href="%s.html">' % child.get_gramps_id())
|
||||
of.write(_nd.display(child))
|
||||
if use_link:
|
||||
ofile.write('</a>\n')
|
||||
ofile.write("<br>\n")
|
||||
ofile.write('</td>\n</tr>\n')
|
||||
ofile.write('</table>\n')
|
||||
of.write('</a>\n')
|
||||
of.write("<br>\n")
|
||||
of.write('</td>\n</tr>\n')
|
||||
of.write('</table>\n')
|
||||
|
||||
def display_spouse(self,ofile,family,first=True):
|
||||
def display_spouse(self,of,family,first=True):
|
||||
gender = self.person.get_gender()
|
||||
reltype = family.get_relationship()
|
||||
|
||||
@ -730,52 +730,52 @@ class IndividualPage(BasePage):
|
||||
else:
|
||||
name = _("unknown")
|
||||
if not first:
|
||||
ofile.write('<tr><td> </td></tr>\n')
|
||||
ofile.write('<td> </td>')
|
||||
ofile.write('<td class="field">%s</td>\n' % relstr)
|
||||
ofile.write('<td class="data">')
|
||||
of.write('<tr><td> </td></tr>\n')
|
||||
of.write('<td> </td>')
|
||||
of.write('<td class="field">%s</td>\n' % relstr)
|
||||
of.write('<td class="data">')
|
||||
use_link = spouse_id in self.ind_list
|
||||
if use_link:
|
||||
ofile.write('<a href="%s.html">' % spouse.get_gramps_id())
|
||||
ofile.write(name)
|
||||
of.write('<a href="%s.html">' % spouse.get_gramps_id())
|
||||
of.write(name)
|
||||
if use_link:
|
||||
ofile.write('</a>')
|
||||
of.write('</a>')
|
||||
|
||||
ofile.write('</td>\n</tr>\n')
|
||||
of.write('</td>\n</tr>\n')
|
||||
|
||||
for event_id in family.get_event_list():
|
||||
event = self.db.get_event_from_handle(event_id)
|
||||
|
||||
ofile.write('<tr><td> </td>\n')
|
||||
ofile.write('<td class="field">%s</td>\n' % event.get_name())
|
||||
ofile.write('<td class="data">\n')
|
||||
ofile.write(self.format_event(event))
|
||||
ofile.write('</td>\n</tr>\n')
|
||||
of.write('<tr><td> </td>\n')
|
||||
of.write('<td class="field">%s</td>\n' % event.get_name())
|
||||
of.write('<td class="data">\n')
|
||||
of.write(self.format_event(event))
|
||||
of.write('</td>\n</tr>\n')
|
||||
|
||||
def pedigree_person(self,ofile,person,bullet='|'):
|
||||
def pedigree_person(self,of,person,bullet='|'):
|
||||
person_link = person.handle in self.ind_list
|
||||
ofile.write('%s ' % bullet)
|
||||
of.write('%s ' % bullet)
|
||||
if person_link:
|
||||
ofile.write('<a href="%s.html">' % person.gramps_id)
|
||||
ofile.write(_nd.display(person))
|
||||
of.write('<a href="%s.html">' % person.gramps_id)
|
||||
of.write(_nd.display(person))
|
||||
if person_link:
|
||||
ofile.write('</a>')
|
||||
ofile.write('<br>\n')
|
||||
of.write('</a>')
|
||||
of.write('<br>\n')
|
||||
|
||||
def pedigree_family(self,ofile):
|
||||
def pedigree_family(self,of):
|
||||
for family_handle in self.person.get_family_handle_list():
|
||||
rel_family = self.db.get_family_from_handle(family_handle)
|
||||
spouse_handle = ReportUtils.find_spouse(self.person,rel_family)
|
||||
if spouse_handle:
|
||||
spouse = self.db.get_person_from_handle(spouse_handle)
|
||||
self.pedigree_person(ofile,spouse,'•')
|
||||
self.pedigree_person(of,spouse,'•')
|
||||
childlist = rel_family.get_child_handle_list()
|
||||
if childlist:
|
||||
ofile.write('<blockquote class="pedigreeind">\n')
|
||||
of.write('<blockquote class="pedigreeind">\n')
|
||||
for child_handle in childlist:
|
||||
child = self.db.get_person_from_handle(child_handle)
|
||||
self.pedigree_person(ofile,child)
|
||||
ofile.write('</blockquote>\n')
|
||||
self.pedigree_person(of,child)
|
||||
of.write('</blockquote>\n')
|
||||
|
||||
def format_event(self,event):
|
||||
descr = event.get_description()
|
||||
@ -929,6 +929,9 @@ class WebReport(Report.Report):
|
||||
|
||||
for person_handle in ind_list:
|
||||
person = self.database.get_person_from_handle(person_handle)
|
||||
if not self.private:
|
||||
person = ReportUtils.sanitize_person(self.database,person)
|
||||
|
||||
idoc = IndividualPage(self.database, person, self.title,
|
||||
dir_name, ind_list, place_list, source_list)
|
||||
self.progress_bar_step()
|
||||
@ -1218,19 +1221,8 @@ class WebReportDialog(Report.ReportDialog):
|
||||
"""Create the object that will produce the web pages."""
|
||||
|
||||
try:
|
||||
MyReport = WebReport(self.database,self.person,self.options_class)
|
||||
"""
|
||||
self.target_path,
|
||||
self.max_gen, self.photos, self.filter,
|
||||
self.restrict, self.private, self.srccomments,
|
||||
self.include_link, self.include_mini_tree,
|
||||
self.selected_style,
|
||||
self.img_dir_text,self.template_name,
|
||||
self.use_id,self.id_link,self.use_gendex,self.use_places,
|
||||
self.html_ext,self.include_alpha_links,
|
||||
self.separate_alpha,self.n_cols,
|
||||
self.birth_dates,self.year_only)
|
||||
"""
|
||||
MyReport = WebReport(self.database,self.person,
|
||||
self.options_class)
|
||||
MyReport.write_report()
|
||||
except Errors.FilterError, msg:
|
||||
(m1,m2) = msg.messages()
|
||||
|
Loading…
Reference in New Issue
Block a user