* src/plugins/NavWebPage.py: wrap content with div, fix encoding problems
svn: r4929
This commit is contained in:
parent
41b9c54f0a
commit
fc8a94c7aa
@ -1,3 +1,6 @@
|
||||
2005-07-14 Don Allingham <don@gramps-project.org>
|
||||
* src/plugins/NavWebPage.py: wrap content with div, fix encoding problems
|
||||
|
||||
2005-07-13 Don Allingham <don@gramps-project.org>
|
||||
* src/Sort.py: don't use upper case, let locale.strcoll figure this
|
||||
out (correctly) for us
|
||||
|
@ -128,11 +128,11 @@ class BasePage:
|
||||
def create_file(self,name):
|
||||
if self.archive:
|
||||
self.string_io = StringIO()
|
||||
of = codecs.EncodedFile(self.string_io,self.encoding)
|
||||
of = codecs.EncodedFile(self.string_io,'utf-8',self.encoding)
|
||||
self.cur_name = name + "." + self.ext
|
||||
else:
|
||||
page_name = os.path.join(self.html_dir,name + "." + self.ext)
|
||||
of = codecs.EncodedFile(open(page_name, "w"),self.encoding)
|
||||
of = codecs.EncodedFile(open(page_name, "w"),'utf-8',self.encoding)
|
||||
return of
|
||||
|
||||
def close_file(self,of):
|
||||
@ -152,51 +152,53 @@ class BasePage:
|
||||
|
||||
msg = _('Generated by <a href="http://gramps-project.org">'
|
||||
'GRAMPS</a> on %(date)s' % { 'date' : value })
|
||||
|
||||
of.write(u'<br><br><hr>\n')
|
||||
of.write(u'<div class="footer">%s</div>\n' % msg)
|
||||
of.write(u'</body>\n')
|
||||
of.write(u'</html>\n')
|
||||
|
||||
of.write('</div>\n')
|
||||
of.write('<div class="footer">%s</div>\n' % msg)
|
||||
of.write('<br><br><hr>\n')
|
||||
of.write('</body>\n')
|
||||
of.write('</html>\n')
|
||||
|
||||
def display_header(self,of,title,author=""):
|
||||
|
||||
if author:
|
||||
author = author.replace(',,,','')
|
||||
year = time.localtime(time.time())[0]
|
||||
cright = _(u'Copyright © %(person)s %(year)d') % {
|
||||
cright = _('Copyright © %(person)s %(year)d') % {
|
||||
'person' : author,
|
||||
'year' : year }
|
||||
|
||||
of.write(u'<!DOCTYPE HTML PUBLIC ')
|
||||
of.write(u'"-//W3C//DTD HTML 4.01 Transitional//EN">\n')
|
||||
of.write(u'<html>\n<head>\n')
|
||||
of.write(u'<title>%s</title>\n' % self.title_str)
|
||||
of.write(u'<meta http-equiv="Content-Type" content="text/html; ')
|
||||
of.write(u'charset=%s">\n' % self.encoding)
|
||||
of.write(u'<link href="%s" ' % _NARRATIVE)
|
||||
of.write(u'rel="stylesheet" type="text/css">\n')
|
||||
of.write(u'<link href="favicon.png" rel="Shortcut Icon">\n')
|
||||
of.write(u'</head>\n')
|
||||
of.write(u'<body>\n')
|
||||
of.write(u'<div class="navheader">\n')
|
||||
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=%s">\n' % self.encoding)
|
||||
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')
|
||||
if author:
|
||||
of.write(u' <div class="navbyline">%s</div>\n' % cright)
|
||||
of.write(u' <h1 class="navtitle">%s</h1>\n' % self.title_str)
|
||||
of.write(u' <hr>\n')
|
||||
of.write(u' <div class="nav">\n')
|
||||
of.write(u' <a href="index.%s">%s</a> \n' % (self.ext,_('Home')))
|
||||
of.write(' <div class="navbyline">%s</div>\n' % cright)
|
||||
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.%s">%s</a> \n' % (self.ext,_('Home')))
|
||||
if self.use_intro:
|
||||
of.write(u' <a href="introduction.%s">%s</a> \n' % (self.ext,_('Introduction')))
|
||||
of.write(u' <a href="surnames.%s">%s</a> \n' % (self.ext,_('Surnames')))
|
||||
of.write(u' <a href="individuals.%s">%s</a> \n' % (self.ext,_('Individuals')))
|
||||
of.write(u' <a href="sources.%s">%s</a> \n' % (self.ext,_('Sources')))
|
||||
of.write(u' <a href="places.%s">%s</a> \n' % (self.ext,_('Places')))
|
||||
of.write(' <a href="introduction.%s">%s</a> \n' % (self.ext,_('Introduction')))
|
||||
of.write(' <a href="surnames.%s">%s</a> \n' % (self.ext,_('Surnames')))
|
||||
of.write(' <a href="individuals.%s">%s</a> \n' % (self.ext,_('Individuals')))
|
||||
of.write(' <a href="sources.%s">%s</a> \n' % (self.ext,_('Sources')))
|
||||
of.write(' <a href="places.%s">%s</a> \n' % (self.ext,_('Places')))
|
||||
if self.inc_download:
|
||||
of.write(u' <a href="download.%s">%s</a> \n' % (self.ext,_('Download')))
|
||||
of.write(' <a href="download.%s">%s</a> \n' % (self.ext,_('Download')))
|
||||
if self.use_contact:
|
||||
of.write(u' <a href="contact.%s">%s</a> \n' % (self.ext,_('Contact')))
|
||||
of.write(u' </div>\n')
|
||||
of.write(u' </div>\n')
|
||||
of.write(' <a href="contact.%s">%s</a> \n' % (self.ext,_('Contact')))
|
||||
of.write(' </div>\n')
|
||||
of.write(' </div>\n')
|
||||
of.write(' <div class="content">\n')
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -216,14 +218,14 @@ class IndividualListPage(BasePage):
|
||||
"database, sorted by their last names. Selecting person's name "
|
||||
"will take you to that person's individual page.")
|
||||
|
||||
of.write(u'<h3>%s</h3>\n' % _('Individuals'))
|
||||
of.write(u'<p>%s</p>\n' % msg)
|
||||
of.write(u'<blockquote>\n')
|
||||
of.write(u'<table class="infolist" cellspacing="0" ')
|
||||
of.write(u'cellpadding="0" border="0">\n')
|
||||
of.write(u'<tr><td class="field"><u><b>%s</b></u></td>\n' % _('Surname'))
|
||||
of.write(u'<td class="field"><u><b>%s</b></u></td>\n' % _('Name'))
|
||||
of.write(u'</tr>\n')
|
||||
of.write('<h3>%s</h3>\n' % _('Individuals'))
|
||||
of.write('<p>%s</p>\n' % msg)
|
||||
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')
|
||||
|
||||
flist = sets.Set(person_handle_list)
|
||||
|
||||
@ -231,23 +233,23 @@ class IndividualListPage(BasePage):
|
||||
|
||||
for (surname,handle_list) in person_handle_list:
|
||||
first = True
|
||||
of.write(u'<tr><td colspan="2"> </td></tr>\n')
|
||||
of.write('<tr><td colspan="2"> </td></tr>\n')
|
||||
for person_handle in handle_list:
|
||||
person = db.get_person_from_handle(person_handle)
|
||||
of.write(u'<tr><td class="category">')
|
||||
of.write('<tr><td class="category">')
|
||||
if first:
|
||||
of.write(u'<a name="%s">%s</a>' % (self.lnkfmt(surname),surname))
|
||||
of.write('<a name="%s">%s</a>' % (self.lnkfmt(surname),surname))
|
||||
else:
|
||||
of.write(u' ')
|
||||
of.write(u'</td><td class="data">')
|
||||
of.write(u' <a href="%s.%s">' % (person.handle,self.ext))
|
||||
of.write(' ')
|
||||
of.write('</td><td class="data">')
|
||||
of.write(' <a href="%s.%s">' % (person.handle,self.ext))
|
||||
of.write(person.get_primary_name().get_first_name())
|
||||
if not self.noid:
|
||||
of.write(u" [%s]" % person.gramps_id)
|
||||
of.write(u'</a></td></tr>\n')
|
||||
of.write('</a></td></tr>\n')
|
||||
first = False
|
||||
|
||||
of.write(u'</table>\n</blockquote>\n')
|
||||
of.write('</table>\n</blockquote>\n')
|
||||
self.display_footer(of)
|
||||
self.close_file(of)
|
||||
|
||||
@ -268,17 +270,17 @@ class PlaceListPage(BasePage):
|
||||
"database, sorted by their title. Clicking on a place's "
|
||||
"title will take you to that place's page.")
|
||||
|
||||
of.write(u'<h3>%s</h3>\n' % _('Places'))
|
||||
of.write(u'<p>%s</p>\n' % msg )
|
||||
of.write('<h3>%s</h3>\n' % _('Places'))
|
||||
of.write('<p>%s</p>\n' % msg )
|
||||
|
||||
of.write(u'<blockquote>\n')
|
||||
of.write(u'<table class="infolist" cellspacing="0" ')
|
||||
of.write(u'cellpadding="0" border="0">\n')
|
||||
of.write(u'<tr><td class="field"><u>')
|
||||
of.write(u'<b>%s</b></u></td>\n' % _('Letter'))
|
||||
of.write(u'<td class="field"><u>')
|
||||
of.write(u'<b>%s</b></u></td>\n' % _('Place'))
|
||||
of.write(u'</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)
|
||||
@ -295,26 +297,26 @@ class PlaceListPage(BasePage):
|
||||
|
||||
if n[0] != last_letter:
|
||||
last_letter = n[0]
|
||||
of.write(u'<tr><td colspan="2"> </td></tr>\n')
|
||||
of.write(u'<tr><td class="category">%s</td>' % last_letter)
|
||||
of.write(u'<td class="data">')
|
||||
of.write(u'<a href="%s.%s">' % (place.handle,self.ext))
|
||||
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('<a href="%s.%s">' % (place.handle,self.ext))
|
||||
of.write(n)
|
||||
if not self.noid:
|
||||
of.write(u' [%s]' % place.gramps_id)
|
||||
of.write(u'</a></td></tr>')
|
||||
of.write(' [%s]' % place.gramps_id)
|
||||
of.write('</a></td></tr>')
|
||||
last_surname = n
|
||||
elif n != last_surname:
|
||||
of.write(u'<tr><td class="category"> </td>')
|
||||
of.write(u'<td class="data">')
|
||||
of.write(u'<a href="%s.%s">' % (place.handle,self.ext))
|
||||
of.write('<tr><td class="category"> </td>')
|
||||
of.write('<td class="data">')
|
||||
of.write('<a href="%s.%s">' % (place.handle,self.ext))
|
||||
of.write(n)
|
||||
if not self.noid:
|
||||
of.write(u' [%s]' % place.gramps_id)
|
||||
of.write(u'</a></td></tr>')
|
||||
of.write(' [%s]' % place.gramps_id)
|
||||
of.write('</a></td></tr>')
|
||||
last_surname = n
|
||||
|
||||
of.write(u'</table>\n</blockquote>\n')
|
||||
of.write('</table>\n</blockquote>\n')
|
||||
self.display_footer(of)
|
||||
self.close_file(of)
|
||||
|
||||
@ -333,14 +335,14 @@ class PlacePage(BasePage):
|
||||
self.display_header(of,place_name,
|
||||
db.get_researcher().get_name())
|
||||
|
||||
of.write(u'<div class="summaryarea">\n')
|
||||
of.write(u'<h3>%s</h3>\n' % place_name)
|
||||
of.write(u'<table class="infolist" cellpadding="0" cellspacing="0" ')
|
||||
of.write(u'border="0">\n')
|
||||
of.write('<div class="summaryarea">\n')
|
||||
of.write('<h3>%s</h3>\n' % place_name)
|
||||
of.write('<table class="infolist" cellpadding="0" cellspacing="0" ')
|
||||
of.write('border="0">\n')
|
||||
|
||||
of.write(u'<tr><td class="field">%s</td>\n' % _('GRAMPS ID'))
|
||||
of.write(u'<td class="data">%s</td>\n' % place.gramps_id)
|
||||
of.write(u'</tr>\n')
|
||||
of.write('<tr><td class="field">%s</td>\n' % _('GRAMPS ID'))
|
||||
of.write('<td class="data">%s</td>\n' % place.gramps_id)
|
||||
of.write('</tr>\n')
|
||||
|
||||
if place.main_loc:
|
||||
ml = place.main_loc
|
||||
@ -348,22 +350,22 @@ class PlacePage(BasePage):
|
||||
(_('County'),ml.county),(_('State/Province'),ml.state),
|
||||
(_('Postal Code'),ml.postal),(_('Country'),ml.country)]:
|
||||
if val[1]:
|
||||
of.write(u'<tr><td class="field">%s</td>\n' % val[0])
|
||||
of.write(u'<td class="data">%s</td>\n' % val[1])
|
||||
of.write(u'</tr>\n')
|
||||
of.write('<tr><td class="field">%s</td>\n' % val[0])
|
||||
of.write('<td class="data">%s</td>\n' % val[1])
|
||||
of.write('</tr>\n')
|
||||
|
||||
if place.long:
|
||||
of.write(u'<tr><td class="field">%s</td>\n' % _('Longitude'))
|
||||
of.write(u'<td class="data">%s</td>\n' % place.long)
|
||||
of.write(u'</tr>\n')
|
||||
of.write('<tr><td class="field">%s</td>\n' % _('Longitude'))
|
||||
of.write('<td class="data">%s</td>\n' % place.long)
|
||||
of.write('</tr>\n')
|
||||
|
||||
if place.lat:
|
||||
of.write(u'<tr><td class="field">%s</td>\n' % _('Latitude'))
|
||||
of.write(u'<td class="data">%s</td>\n' % place.lat)
|
||||
of.write(u'</tr>\n')
|
||||
of.write('<tr><td class="field">%s</td>\n' % _('Latitude'))
|
||||
of.write('<td class="data">%s</td>\n' % place.lat)
|
||||
of.write('</tr>\n')
|
||||
|
||||
of.write(u'</table>\n')
|
||||
of.write(u'</div>\n')
|
||||
of.write('</table>\n')
|
||||
of.write('</div>\n')
|
||||
|
||||
photolist = place.get_media_list()
|
||||
if photolist:
|
||||
@ -372,11 +374,11 @@ class PlacePage(BasePage):
|
||||
|
||||
try:
|
||||
newpath = self.copy_media(photo)
|
||||
of.write(u'<div class="snapshot">\n')
|
||||
of.write(u'<a href="%s">' % newpath)
|
||||
of.write(u'<img class="thumbnail" border="0" src="%s" ' % newpath)
|
||||
of.write(u'height="100"></a>')
|
||||
of.write(u'</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')
|
||||
except (IOError,OSError),msg:
|
||||
ErrorDialog(str(msg))
|
||||
|
||||
@ -393,7 +395,7 @@ class PlacePage(BasePage):
|
||||
text = u"<pre>" + u"<br>".join(text.split("\n"))
|
||||
else:
|
||||
text = u"</p><p>".join(text.split("\n"))
|
||||
of.write(u'<p>%s</p>\n' % text)
|
||||
of.write('<p>%s</p>\n' % text)
|
||||
|
||||
self.display_footer(of)
|
||||
self.close_file(of)
|
||||
@ -411,21 +413,21 @@ class SurnameListPage(BasePage):
|
||||
self.display_header(of,_('Surnames'),
|
||||
db.get_researcher().get_name())
|
||||
|
||||
of.write(u'<h3>%s</h3>\n' % _('Surnames'))
|
||||
of.write(u'<p>%s</p>\n' % _(
|
||||
of.write('<h3>%s</h3>\n' % _('Surnames'))
|
||||
of.write('<p>%s</p>\n' % _(
|
||||
'This page contains an index of all the '
|
||||
'surnames in the database. Selecting a link '
|
||||
'will lead to a list of individuals in the '
|
||||
'database with this same surname.'))
|
||||
|
||||
of.write(u'<blockquote>\n')
|
||||
of.write(u'<table class="infolist" cellspacing="0" ')
|
||||
of.write(u'cellpadding="0" border="0">\n')
|
||||
of.write(u'<tr><td class="field"><u>')
|
||||
of.write(u'<b>%s</b></u></td>\n' % _('Letter'))
|
||||
of.write(u'<td class="field"><u>')
|
||||
of.write(u'<b>%s</b></u></td>\n' % _('Surname'))
|
||||
of.write(u'</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')
|
||||
|
||||
person_handle_list = sort_people(db,person_handle_list)
|
||||
last_letter = ''
|
||||
@ -437,20 +439,20 @@ class SurnameListPage(BasePage):
|
||||
|
||||
if surname[0] != last_letter:
|
||||
last_letter = surname[0]
|
||||
of.write(u'<tr><td class="category">%s</td>' % last_letter)
|
||||
of.write(u'<td class="data">')
|
||||
of.write(u'<a href="individuals.%s#%s">' % (self.ext,self.lnkfmt(surname)))
|
||||
of.write('<tr><td class="category">%s</td>' % last_letter)
|
||||
of.write('<td class="data">')
|
||||
of.write('<a href="individuals.%s#%s">' % (self.ext,self.lnkfmt(surname)))
|
||||
of.write(surname)
|
||||
of.write(u'</a></td></tr>')
|
||||
of.write('</a></td></tr>')
|
||||
elif surname != last_surname:
|
||||
of.write(u'<tr><td class="category"> </td>')
|
||||
of.write(u'<td class="data">')
|
||||
of.write(u'<a href="individuals.%s#%s">' % (self.ext,self.lnkfmt(surname)))
|
||||
of.write('<tr><td class="category"> </td>')
|
||||
of.write('<td class="data">')
|
||||
of.write('<a href="individuals.%s#%s">' % (self.ext,self.lnkfmt(surname)))
|
||||
of.write(surname)
|
||||
of.write(u'</a></td></tr>')
|
||||
of.write('</a></td></tr>')
|
||||
last_surname = surname
|
||||
|
||||
of.write(u'</table>\n</blockquote>\n')
|
||||
of.write('</table>\n</blockquote>\n')
|
||||
self.display_footer(of)
|
||||
self.close_file(of)
|
||||
return
|
||||
@ -470,19 +472,32 @@ class IntroductionPage(BasePage):
|
||||
self.display_header(of,_('Introduction'),
|
||||
db.get_researcher().get_name())
|
||||
|
||||
of.write(u'<h3>%s</h3>\n' % _('Introduction'))
|
||||
of.write('<h3>%s</h3>\n' % _('Introduction'))
|
||||
|
||||
if note_id:
|
||||
obj = db.get_object_from_gramps_id(note_id)
|
||||
obj = db.get_object_from_handle(note_id)
|
||||
|
||||
if obj:
|
||||
mime_type = obj.get_mime_type()
|
||||
if mime_type and mime_type.startswith("image"):
|
||||
try:
|
||||
newpath = self.copy_media(obj)
|
||||
of.write('<div align="center">\n')
|
||||
of.write('<img border="0" ')
|
||||
of.write('src="%s" />' % newpath)
|
||||
of.write('</div>\n')
|
||||
except (IOError,OSError),msg:
|
||||
ErrorDialog(str(msg))
|
||||
|
||||
note_obj = obj.get_note_object()
|
||||
text = note_obj.get()
|
||||
if note_obj.get_format():
|
||||
of.write(u'<pre>\n%s\n</pre>\n' % text)
|
||||
else:
|
||||
of.write(u'<p>')
|
||||
of.write(u'</p><p>'.join(text.split('\n')))
|
||||
of.write(u'</p>')
|
||||
if note_obj:
|
||||
text = note_obj.get()
|
||||
if note_obj.get_format():
|
||||
of.write('<pre>\n%s\n</pre>\n' % text)
|
||||
else:
|
||||
of.write('<p>')
|
||||
of.write('</p><p>'.join(text.split('\n')))
|
||||
of.write('</p>')
|
||||
|
||||
self.display_footer(of)
|
||||
self.close_file(of)
|
||||
@ -512,22 +527,22 @@ class HomePage(BasePage):
|
||||
if mime_type and mime_type.startswith("image"):
|
||||
try:
|
||||
newpath = self.copy_media(obj)
|
||||
of.write(u'<div align="center">\n')
|
||||
of.write(u'<img border="0" ')
|
||||
of.write(u'src="%s" />' % newpath)
|
||||
of.write(u'</div>\n')
|
||||
of.write('<div align="center">\n')
|
||||
of.write('<img border="0" ')
|
||||
of.write('src="%s" />' % newpath)
|
||||
of.write('</div>\n')
|
||||
except (IOError,OSError),msg:
|
||||
ErrorDialog(str(msg))
|
||||
|
||||
|
||||
note_obj = obj.get_note_object()
|
||||
if note_obj:
|
||||
text = note_obj.get()
|
||||
if note_obj.get_format():
|
||||
of.write(u'<pre>\n%s\n</pre>\n' % text)
|
||||
of.write('<pre>\n%s\n</pre>\n' % text)
|
||||
else:
|
||||
of.write(u'<p>')
|
||||
of.write(u'</p><p>'.join(text.split('\n')))
|
||||
of.write(u'</p>')
|
||||
of.write('<p>')
|
||||
of.write('</p><p>'.join(text.split('\n')))
|
||||
of.write('</p>')
|
||||
|
||||
self.display_footer(of)
|
||||
self.close_file(of)
|
||||
@ -548,20 +563,20 @@ class SourcesPage(BasePage):
|
||||
|
||||
handle_list = list(handle_set)
|
||||
|
||||
of.write(u'<h3>%s</h3>\n<p>' % _('Sources'))
|
||||
of.write('<h3>%s</h3>\n<p>' % _('Sources'))
|
||||
of.write(_('All sources cited in the project.'))
|
||||
of.write(u'</p>\n<blockquote>\n<table class="infolist">\n')
|
||||
of.write('</p>\n<blockquote>\n<table class="infolist">\n')
|
||||
|
||||
index = 1
|
||||
for handle in handle_list:
|
||||
source = db.get_source_from_handle(handle)
|
||||
of.write(u'<tr><td class="category">%d.</td>\n' % index)
|
||||
of.write(u'<td class="data">')
|
||||
of.write('<tr><td class="category">%d.</td>\n' % index)
|
||||
of.write('<td class="data">')
|
||||
of.write(source.get_title())
|
||||
of.write(u'</td></tr>\n')
|
||||
of.write('</td></tr>\n')
|
||||
index += 1
|
||||
|
||||
of.write(u'</table>\n<blockquote>\n')
|
||||
of.write('</table>\n<blockquote>\n')
|
||||
|
||||
self.display_footer(of)
|
||||
self.close_file(of)
|
||||
@ -580,7 +595,7 @@ class DownloadPage(BasePage):
|
||||
self.display_header(of,_('Download'),
|
||||
db.get_researcher().get_name())
|
||||
|
||||
of.write(u'<h3>%s</h3>\n' % _('Download'))
|
||||
of.write('<h3>%s</h3>\n' % _('Download'))
|
||||
|
||||
self.display_footer(of)
|
||||
self.close_file(of)
|
||||
@ -599,8 +614,8 @@ class ContactPage(BasePage):
|
||||
self.display_header(of,_('Contact'),
|
||||
db.get_researcher().get_name())
|
||||
|
||||
of.write(u'<div class="summaryarea">\n')
|
||||
of.write(u'<h3>%s</h3>\n' % _('Contact'))
|
||||
of.write('<div class="summaryarea">\n')
|
||||
of.write('<h3>%s</h3>\n' % _('Contact'))
|
||||
|
||||
note_id = options.handler.options_dict['NWEBcontact']
|
||||
obj = db.get_object_from_handle(note_id)
|
||||
@ -609,25 +624,25 @@ class ContactPage(BasePage):
|
||||
if mime_type and mime_type.startswith("image"):
|
||||
try:
|
||||
newpath = self.copy_media(obj)
|
||||
of.write(u'<div class="rightwrap">\n')
|
||||
of.write(u'<table cellspacing="0" cellpadding="0" border="0"><tr>')
|
||||
of.write(u'<td height="205">')
|
||||
of.write(u'<img border="0" height="200" ')
|
||||
of.write(u'src="%s" />' % newpath)
|
||||
of.write(u'</td></tr></table>\n')
|
||||
of.write(u'</div>\n')
|
||||
of.write('<div class="rightwrap">\n')
|
||||
of.write('<table cellspacing="0" cellpadding="0" border="0"><tr>')
|
||||
of.write('<td height="205">')
|
||||
of.write('<img border="0" height="200" ')
|
||||
of.write('src="%s" />' % newpath)
|
||||
of.write('</td></tr></table>\n')
|
||||
of.write('</div>\n')
|
||||
except (IOError,OSError),msg:
|
||||
ErrorDialog(str(msg))
|
||||
|
||||
r = db.get_researcher()
|
||||
|
||||
of.write(u'<blockquote></td>\n')
|
||||
of.write(u'%s<br>\n' % r.name)
|
||||
of.write(u'%s<br>\n' % r.addr)
|
||||
of.write(u'%s, %s, %s<br>\n' % (r.city,r.state,r.postal))
|
||||
of.write(u'%s<br>\n' % r.country)
|
||||
of.write(u'%s<br>\n' % r.email)
|
||||
of.write(u'</blockquote>\n')
|
||||
of.write('<blockquote></td>\n')
|
||||
of.write('%s<br>\n' % r.name)
|
||||
of.write('%s<br>\n' % r.addr)
|
||||
of.write('%s, %s, %s<br>\n' % (r.city,r.state,r.postal))
|
||||
of.write('%s<br>\n' % r.country)
|
||||
of.write('%s<br>\n' % r.email)
|
||||
of.write('</blockquote>\n')
|
||||
|
||||
nobj = obj.get_note_object()
|
||||
if nobj:
|
||||
@ -638,9 +653,9 @@ class ContactPage(BasePage):
|
||||
text = u"<pre>" + u"<br>".join(text.split("\n"))
|
||||
else:
|
||||
text = u"</p><p>".join(text.split("\n"))
|
||||
of.write(u'<p>%s</p>\n' % text)
|
||||
of.write('<p>%s</p>\n' % text)
|
||||
else:
|
||||
of.write(u'<br><br><br><br>\n')
|
||||
of.write('<br><br><br><br>\n')
|
||||
|
||||
self.display_footer(of)
|
||||
self.close_file(of)
|
||||
@ -685,10 +700,10 @@ class IndividualPage(BasePage):
|
||||
sreflist = self.person.get_source_references()
|
||||
if not sreflist:
|
||||
return
|
||||
of.write(u'<h4>%s</h4>\n' % _('Sources'))
|
||||
of.write(u'<hr>\n')
|
||||
of.write(u'<table class="infolist" cellpadding="0" ')
|
||||
of.write(u'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:
|
||||
@ -699,7 +714,7 @@ class IndividualPage(BasePage):
|
||||
title = source.get_title()
|
||||
publisher = source.get_publication_info()
|
||||
date = _dd.display(sref.get_date_object())
|
||||
of.write(u'<tr><td class="field">%d. ' % index)
|
||||
of.write('<tr><td class="field">%d. ' % index)
|
||||
values = []
|
||||
if author:
|
||||
values.append(author)
|
||||
@ -709,9 +724,9 @@ class IndividualPage(BasePage):
|
||||
values.append(publisher)
|
||||
if date:
|
||||
values.append(date)
|
||||
of.write(u', '.join(values))
|
||||
of.write(u'</td></tr>\n')
|
||||
of.write(u'</table>\n')
|
||||
of.write(', '.join(values))
|
||||
of.write('</td></tr>\n')
|
||||
of.write('</table>\n')
|
||||
|
||||
def display_ind_pedigree(self,of):
|
||||
|
||||
@ -728,33 +743,33 @@ class IndividualPage(BasePage):
|
||||
father = None
|
||||
mother = None
|
||||
|
||||
of.write(u'<h4>%s</h4>\n' % _('Pedigree'))
|
||||
of.write(u'<hr>\n<br>\n')
|
||||
of.write(u'<table class="pedigree">\n')
|
||||
of.write(u'<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:
|
||||
of.write(u'<blockquote class="pedigreeind">\n')
|
||||
of.write('<blockquote class="pedigreeind">\n')
|
||||
if father:
|
||||
self.pedigree_person(of,father)
|
||||
if mother:
|
||||
self.pedigree_person(of,mother)
|
||||
of.write(u'<blockquote class="pedigreeind">\n')
|
||||
of.write('<blockquote class="pedigreeind">\n')
|
||||
if family:
|
||||
for child_handle in family.get_child_handle_list():
|
||||
if child_handle == self.person.handle:
|
||||
of.write(u'| <strong>%s</strong><br>\n' % self.name)
|
||||
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(of,child)
|
||||
else:
|
||||
of.write(u'| <strong>%s</strong><br>\n' % self.name)
|
||||
of.write('| <strong>%s</strong><br>\n' % self.name)
|
||||
self.pedigree_family(of)
|
||||
|
||||
of.write(u'</blockquote>\n')
|
||||
of.write('</blockquote>\n')
|
||||
if father or mother:
|
||||
of.write(u'</blockquote>\n')
|
||||
of.write(u'</td>\n</tr>\n</table>\n')
|
||||
of.write('</blockquote>\n')
|
||||
of.write('</td>\n</tr>\n</table>\n')
|
||||
|
||||
def display_ind_general(self,of):
|
||||
photolist = self.person.get_media_list()
|
||||
@ -764,72 +779,72 @@ class IndividualPage(BasePage):
|
||||
|
||||
try:
|
||||
newpath = self.copy_media(photo)
|
||||
of.write(u'<div class="snapshot">\n')
|
||||
of.write(u'<a href="%s">' % newpath)
|
||||
of.write(u'<img class="thumbnail" border="0" src="%s" ' % newpath)
|
||||
of.write(u'height="100"></a>')
|
||||
of.write(u'</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')
|
||||
except (IOError,OSError),msg:
|
||||
ErrorDialog(str(msg))
|
||||
|
||||
of.write(u'<div class="summaryarea">\n')
|
||||
of.write(u'<h3>%s</h3>\n' % self.sort_name)
|
||||
of.write(u'<table class="infolist" cellpadding="0" cellspacing="0" ')
|
||||
of.write(u'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')
|
||||
|
||||
of.write(u'<tr><td class="field">%s</td>\n' % _('GRAMPS ID'))
|
||||
of.write(u'<td class="data">%s</td>\n' % self.person.gramps_id)
|
||||
of.write(u'</tr>\n')
|
||||
of.write('<tr><td class="field">%s</td>\n' % _('GRAMPS ID'))
|
||||
of.write('<td class="data">%s</td>\n' % self.person.gramps_id)
|
||||
of.write('</tr>\n')
|
||||
|
||||
# Gender
|
||||
of.write(u'<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]
|
||||
of.write(u'<td class="data">%s</td>\n' % gender)
|
||||
of.write(u'</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)
|
||||
of.write(u'<tr><td class="field">%s</td>\n' % _('Birth'))
|
||||
of.write(u'<td class="data">%s</td>\n' % self.format_event(event))
|
||||
of.write(u'</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)
|
||||
of.write(u'<tr><td class="field">%s</td>\n' % _('Death'))
|
||||
of.write(u'<td class="data">%s</td>\n' % self.format_event(event))
|
||||
of.write(u'</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')
|
||||
|
||||
of.write(u'</table>\n')
|
||||
of.write(u'</div>\n')
|
||||
of.write('</table>\n')
|
||||
of.write('</div>\n')
|
||||
|
||||
def display_ind_events(self,of):
|
||||
if len(self.person.get_event_list()) == 0:
|
||||
return
|
||||
|
||||
of.write(u'<h4>%s</h4>\n' % _('Events'))
|
||||
of.write(u'<hr>\n')
|
||||
of.write(u'<table class="infolist" cellpadding="0" cellspacing="0" ')
|
||||
of.write(u'border="0">\n')
|
||||
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)
|
||||
|
||||
of.write(u'<tr><td class="field">%s</td>\n' % event.get_name())
|
||||
of.write(u'<td class="data">\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(u'</td>\n')
|
||||
of.write(u'</tr>\n')
|
||||
of.write(u'</table>\n')
|
||||
of.write('</td>\n')
|
||||
of.write('</tr>\n')
|
||||
of.write('</table>\n')
|
||||
|
||||
def display_ind_narrative(self,of):
|
||||
noteobj = self.person.get_note_object()
|
||||
if noteobj:
|
||||
of.write(u'<h4>%s</h4>\n' % _('Narrative'))
|
||||
of.write(u'<hr>\n')
|
||||
of.write('<h4>%s</h4>\n' % _('Narrative'))
|
||||
of.write('<hr>\n')
|
||||
format = noteobj.get_format()
|
||||
text = noteobj.get()
|
||||
|
||||
@ -837,23 +852,23 @@ class IndividualPage(BasePage):
|
||||
text = u"<pre>" + u"<br>".join(text.split("\n"))
|
||||
else:
|
||||
text = u"</p><p>".join(text.split("\n"))
|
||||
of.write(u'<p>%s</p>\n' % text)
|
||||
of.write('<p>%s</p>\n' % text)
|
||||
|
||||
|
||||
def display_parent(self,of,handle,title):
|
||||
use_link = handle in self.ind_list
|
||||
person = self.db.get_person_from_handle(handle)
|
||||
of.write(u'<td class="field">%s</td>\n' % title)
|
||||
of.write(u'<td class="data">')
|
||||
of.write('<td class="field">%s</td>\n' % title)
|
||||
of.write('<td class="data">')
|
||||
val = person.gramps_id
|
||||
if use_link:
|
||||
of.write('<a href="%s.%s">' % (person.handle,self.ext))
|
||||
of.write(_nd.display(person))
|
||||
if not self.noid:
|
||||
of.write(u' [%s]' % (val))
|
||||
of.write(' [%s]' % (val))
|
||||
if use_link:
|
||||
of.write('</a>')
|
||||
of.write(u'</td>\n')
|
||||
of.write('</td>\n')
|
||||
|
||||
def display_ind_relationships(self,of):
|
||||
parent_list = self.person.get_parent_family_handle_list()
|
||||
@ -862,30 +877,30 @@ class IndividualPage(BasePage):
|
||||
if not parent_list and not family_list:
|
||||
return
|
||||
|
||||
of.write(u'<h4>%s</h4>\n' % _("Relationships"))
|
||||
of.write(u'<hr>\n')
|
||||
of.write(u'<table class="infolist" cellpadding="0" ')
|
||||
of.write(u'cellspacing="0" border="0">\n')
|
||||
of.write('<h4>%s</h4>\n' % _("Relationships"))
|
||||
of.write('<hr>\n')
|
||||
of.write('<table class="infolist" cellpadding="0" ')
|
||||
of.write('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)
|
||||
|
||||
of.write(u'<tr><td colspan="3"> </td></tr>\n')
|
||||
of.write(u'<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(of,father_handle,_('Father'))
|
||||
of.write(u'</tr><tr><td> </td>\n')
|
||||
of.write('</tr><tr><td> </td>\n')
|
||||
mother_handle = family.get_mother_handle()
|
||||
if mother_handle:
|
||||
self.display_parent(of,mother_handle,_('Mother'))
|
||||
of.write(u'</tr>\n')
|
||||
of.write(u'<tr><td colspan="3"> </td></tr>\n')
|
||||
of.write('</tr>\n')
|
||||
of.write('<tr><td colspan="3"> </td></tr>\n')
|
||||
|
||||
if family_list:
|
||||
of.write(u'<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)
|
||||
@ -893,23 +908,23 @@ class IndividualPage(BasePage):
|
||||
first = False
|
||||
childlist = family.get_child_handle_list()
|
||||
if childlist:
|
||||
of.write(u'<tr><td> </td>\n')
|
||||
of.write(u'<td class="field">%s</td>\n' % _("Children"))
|
||||
of.write(u'<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)
|
||||
gid = child.get_gramps_id()
|
||||
if use_link:
|
||||
of.write(u'<a href="%s.%s">' % (child.handle,self.ext))
|
||||
of.write('<a href="%s.%s">' % (child.handle,self.ext))
|
||||
of.write(_nd.display(child))
|
||||
if not self.noid:
|
||||
of.write(u' [%s]' % gid)
|
||||
of.write(' [%s]' % gid)
|
||||
if use_link:
|
||||
of.write(u'</a>\n')
|
||||
of.write('</a>\n')
|
||||
of.write(u"<br>\n")
|
||||
of.write(u'</td>\n</tr>\n')
|
||||
of.write(u'</table>\n')
|
||||
of.write('</td>\n</tr>\n')
|
||||
of.write('</table>\n')
|
||||
|
||||
def display_spouse(self,of,family,first=True):
|
||||
gender = self.person.get_gender()
|
||||
@ -932,41 +947,41 @@ class IndividualPage(BasePage):
|
||||
else:
|
||||
name = _("unknown")
|
||||
if not first:
|
||||
of.write(u'<tr><td> </td></tr>\n')
|
||||
of.write(u'<td> </td>')
|
||||
of.write(u'<td class="field">%s</td>\n' % relstr)
|
||||
of.write(u'<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">')
|
||||
if spouse_id:
|
||||
use_link = spouse_id in self.ind_list
|
||||
gid = spouse.get_gramps_id()
|
||||
if use_link:
|
||||
of.write(u'<a href="%s.%s">' % (spouse.handle,self.ext))
|
||||
of.write('<a href="%s.%s">' % (spouse.handle,self.ext))
|
||||
of.write(name)
|
||||
if not self.noid:
|
||||
of.write(u' [%s]' % (gid))
|
||||
of.write(' [%s]' % (gid))
|
||||
if use_link:
|
||||
of.write(u'</a>')
|
||||
of.write('</a>')
|
||||
|
||||
of.write(u'</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)
|
||||
|
||||
of.write(u'<tr><td> </td>\n')
|
||||
of.write(u'<td class="field">%s</td>\n' % event.get_name())
|
||||
of.write(u'<td class="data">\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(u'</td>\n</tr>\n')
|
||||
of.write('</td>\n</tr>\n')
|
||||
|
||||
def pedigree_person(self,of,person,bullet='|'):
|
||||
person_link = person.handle in self.ind_list
|
||||
of.write(u'%s ' % bullet)
|
||||
of.write('%s ' % bullet)
|
||||
if person_link:
|
||||
of.write(u'<a href="%s.%s">' % (person.handle,self.ext))
|
||||
of.write('<a href="%s.%s">' % (person.handle,self.ext))
|
||||
of.write(_nd.display(person))
|
||||
if person_link:
|
||||
of.write(u'</a>')
|
||||
of.write(u'<br>\n')
|
||||
of.write('</a>')
|
||||
of.write('<br>\n')
|
||||
|
||||
def pedigree_family(self,of):
|
||||
for family_handle in self.person.get_family_handle_list():
|
||||
@ -977,11 +992,11 @@ class IndividualPage(BasePage):
|
||||
self.pedigree_person(of,spouse,'•')
|
||||
childlist = rel_family.get_child_handle_list()
|
||||
if childlist:
|
||||
of.write(u'<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(of,child)
|
||||
of.write(u'</blockquote>\n')
|
||||
of.write('</blockquote>\n')
|
||||
|
||||
def format_event(self,event):
|
||||
for sref in event.get_source_references():
|
||||
@ -1418,10 +1433,10 @@ class WebReportOptions(ReportOptions.ReportOptions):
|
||||
store = gtk.ListStore(str,str)
|
||||
for data in media_list:
|
||||
if data[1] == self.inc_contact:
|
||||
intro_node = store.append(row=data)
|
||||
contact_node = store.append(row=data)
|
||||
else:
|
||||
store.append(row=data)
|
||||
self.contact = GrampsNoteComboBox(store,intro_node)
|
||||
self.contact = GrampsNoteComboBox(store,contact_node)
|
||||
|
||||
dialog.add_frame_option(title,_('Home Media/Note ID'),
|
||||
self.home_note)
|
||||
|
Loading…
x
Reference in New Issue
Block a user