various fixes

svn: r9252
This commit is contained in:
Stéphane Charette 2007-10-26 06:15:50 +00:00
parent 224c185a24
commit 36ad798989
2 changed files with 386 additions and 69 deletions

View File

@ -1,3 +1,11 @@
2007-10-26 Stéphane Charette <stephanecharette@gmail.com>
* src/plugins/NarrativeWeb.py: various: EOL should be <br> not <p>,
date is now displayed in the user's locale, source references no
longer skipped on media pages, allow half-sibling to be shown, allow
columns to be configurable, event notes are no longer skipped, progress
indicator no longer gets stuck at 100% for long periods of time with
large databases
2007-10-26 Benny Malengier <benny.malengier@gramps-project.org> 2007-10-26 Benny Malengier <benny.malengier@gramps-project.org>
* src/plugins/rel_nl.py: various improvements * src/plugins/rel_nl.py: various improvements

View File

@ -74,6 +74,7 @@ import Errors
import Utils import Utils
import ImgManip import ImgManip
import GrampsLocale import GrampsLocale
import DateHandler
from QuestionDialog import ErrorDialog, WarningDialog from QuestionDialog import ErrorDialog, WarningDialog
from NameDisplay import displayer as _nd from NameDisplay import displayer as _nd
from DateHandler import displayer as _dd from DateHandler import displayer as _dd
@ -147,6 +148,12 @@ class BasePage:
self.encoding = options.handler.options_dict['NWEBencoding'] self.encoding = options.handler.options_dict['NWEBencoding']
self.css = options.handler.options_dict['NWEBcss'] self.css = options.handler.options_dict['NWEBcss']
self.noid = options.handler.options_dict['NWEBnoid'] self.noid = options.handler.options_dict['NWEBnoid']
self.linkhome = options.handler.options_dict['NWEBlinkhome']
self.showbirth = options.handler.options_dict['NWEBshowbirth']
self.showdeath = options.handler.options_dict['NWEBshowdeath']
self.showspouse = options.handler.options_dict['NWEBshowspouse']
self.showparents = options.handler.options_dict['NWEBshowparents']
self.showhalfsiblings = options.handler.options_dict['NWEBshowhalfsiblings']
self.use_intro = options.handler.options_dict['NWEBintronote'] != u"" self.use_intro = options.handler.options_dict['NWEBintronote'] != u""
self.use_contact = options.handler.options_dict['NWEBcontact'] != u"" self.use_contact = options.handler.options_dict['NWEBcontact'] != u""
self.use_gallery = options.handler.options_dict['NWEBgallery'] self.use_gallery = options.handler.options_dict['NWEBgallery']
@ -158,7 +165,7 @@ class BasePage:
self.graphgens = options.handler.options_dict['NWEBgraphgens'] self.graphgens = options.handler.options_dict['NWEBgraphgens']
self.use_home = self.options.handler.options_dict['NWEBhomenote'] != "" self.use_home = self.options.handler.options_dict['NWEBhomenote'] != ""
self.page_title = "" self.page_title = ""
self.warn_dir = True self.warn_dir = True
def store_file(self,archive,html_dir,from_path,to_path): def store_file(self,archive,html_dir,from_path,to_path):
if archive: if archive:
@ -316,12 +323,22 @@ class BasePage:
of.write(' </div>\n') of.write(' </div>\n')
of.write('<div id="navheader">\n') of.write('<div id="navheader">\n')
value = unicode(time.strftime('%x',time.localtime(time.time())), value = DateHandler.parser.parse(time.strftime('%b %d %Y'))
GrampsLocale.codeset) value = _dd.display(value)
msg = _('Generated by <a href="http://gramps-project.org">' msg = _('Generated by <a href="http://gramps-project.org">'
'GRAMPS</a> on %(date)s') % { 'date' : value } 'GRAMPS</a> on %(date)s') % { 'date' : value }
if self.linkhome:
home_person_handle = db.get_default_handle()
if home_person_handle:
home_person = db.get_default_person()
home_person_url = self.build_name(
self.build_path(home_person_handle, "ppl", up),
home_person.handle)
home_person_name = home_person.get_primary_name().get_regular_name()
msg += _('<br>for <a href="%s">%s</a>') % (home_person_url, home_person_name)
of.write('<div class="navbyline">%s</div>\n' % msg) of.write('<div class="navbyline">%s</div>\n' % msg)
of.write('<h1 class="navtitle">%s</h1>\n' % self.title_str) of.write('<h1 class="navtitle">%s</h1>\n' % self.title_str)
of.write('<div class="nav">\n') of.write('<div class="nav">\n')
@ -345,6 +362,8 @@ class BasePage:
self.show_link(of,intro_page,_('Introduction'),path) self.show_link(of,intro_page,_('Introduction'),path)
self.show_link(of,surname_page,_('Surnames'),path) self.show_link(of,surname_page,_('Surnames'),path)
self.show_link(of,'individuals',_('Individuals'),path) self.show_link(of,'individuals',_('Individuals'),path)
# some people want count to be displayed -- make it easy for them to uncomment
# self.show_link(of,'surnames_count',_('Count'),path)
self.show_link(of,'sources',_('Sources'),path) self.show_link(of,'sources',_('Sources'),path)
self.show_link(of,'places',_('Places'),path) self.show_link(of,'places',_('Places'),path)
if self.use_gallery: if self.use_gallery:
@ -444,7 +463,7 @@ class BasePage:
if format: if format:
text = u"<pre>%s</pre>" % text text = u"<pre>%s</pre>" % text
else: else:
text = u"</p><p>".join(text.split("\n")) text = u"<br>".join(text.split("\n"))
of.write('<p>%s</p>\n' % text) of.write('<p>%s</p>\n' % text)
of.write('</div>\n') of.write('</div>\n')
@ -475,6 +494,46 @@ class BasePage:
of.write('</table>\n') of.write('</table>\n')
of.write('</div>\n') of.write('</div>\n')
def display_source_refs(self,of,db,sreflist):
if not sreflist:
return
of.write('<div id="sourcerefs">\n')
of.write('<h4>%s</h4>\n' % _('Source References'))
of.write('<table class="infolist">\n')
index = 1
for sref in sreflist:
lnk = (self.cur_name, self.page_title, self.gid)
shandle = sref.get_reference_handle()
if not shandle:
continue
if self.src_list.has_key(shandle):
if lnk not in self.src_list[shandle]:
self.src_list[shandle].append(lnk)
else:
self.src_list[shandle] = [lnk]
source = self.db.get_source_from_handle(shandle)
title = source.get_title()
of.write('<tr><td class="field">')
of.write('<a name="sref%d"></a>%d.</td>' % (index,index))
of.write('<td class="field">')
self.source_link(of,source.handle,title,source.gramps_id,True)
tmp = []
confidence = Utils.confidence.get(sref.confidence, _('Unknown'))
for (label,data) in [(_('Date'),_dd.display(sref.date)),
(_('Page'),sref.page),
(_('Confidence'),confidence),
(_('Text'),sref.text)]:
if data:
tmp.append("%s: %s" % (label,data))
if len(tmp) > 0:
of.write('<br />' + '<br />'.join(tmp))
of.write('</td></tr>\n')
index += 1
of.write('</table>\n')
of.write('</div>\n')
def display_references(self,of,db,handlelist): def display_references(self,of,db,handlelist):
if not handlelist: if not handlelist:
return return
@ -602,37 +661,123 @@ class IndividualListPage(BasePage):
of.write('<table class="infolist">\n<thead><tr>\n') of.write('<table class="infolist">\n<thead><tr>\n')
of.write('<th>%s</th>\n' % _('Surname')) of.write('<th>%s</th>\n' % _('Surname'))
of.write('<th>%s</th>\n' % _('Name')) of.write('<th>%s</th>\n' % _('Name'))
of.write('<th>%s</th>\n' % _('Birth date')) column_count = 2
if self.showbirth:
of.write('<th>%s</th>\n' % _('Birth'))
column_count += 1
if self.showdeath:
of.write('<th>%s</th>\n' % _('Death'))
column_count += 1
if self.showspouse:
of.write('<th>%s</th>\n' % _('Partner'))
column_count += 1
if self.showparents:
of.write('<th>%s</th>\n' % _('Parents'))
column_count += 1
of.write('</tr></thead>\n<tbody>\n') of.write('</tr></thead>\n<tbody>\n')
person_handle_list = sort_people(db,person_handle_list) person_handle_list = sort_people(db,person_handle_list)
for (surname,handle_list) in person_handle_list: for (surname,handle_list) in person_handle_list:
first = True first = True
of.write('<tr><td colspan="2">&nbsp;</td></tr>\n') of.write('<tr><td colspan="%d">&nbsp;</td></tr>\n' % column_count)
for person_handle in handle_list: for person_handle in handle_list:
person = db.get_person_from_handle(person_handle) person = db.get_person_from_handle(person_handle)
if self.exclude_private: if self.exclude_private:
person = ReportUtils.sanitize_person(db,person) person = ReportUtils.sanitize_person(db,person)
# surname column
of.write('<tr><td class="category">') of.write('<tr><td class="category">')
if first: if first:
of.write('<a name="%s">%s</a>' % (self.lnkfmt(surname),surname)) of.write('<a name="%s">%s</a>' % (self.lnkfmt(surname),surname))
else: else:
of.write('&nbsp;') of.write('&nbsp;')
of.write('</td><td class="data">') of.write('</td>')
# firstname column
of.write('<td class="data">')
path = self.build_path(person.handle,"ppl",False) path = self.build_path(person.handle,"ppl",False)
self.person_link(of, self.build_name(path,person.handle), self.person_link(of, self.build_name(path,person.handle),
_nd.display_given(person), person.gramps_id,False) _nd.display_given(person), person.gramps_id,False)
of.write('</td><td class="field">') of.write('</td>')
if person.handle in restrict_list: # birth column
of.write(_('restricted')) if self.showbirth:
else: of.write('<td class="field">')
birth_ref = person.get_birth_ref() if person.handle in restrict_list:
if birth_ref: of.write(_('restricted'))
birth = db.get_event_from_handle(birth_ref.ref) else:
of.write(_dd.display(birth.get_date_object())) birth_ref = person.get_birth_ref()
of.write('</td></tr>\n') if birth_ref:
birth = db.get_event_from_handle(birth_ref.ref)
of.write(_dd.display(birth.get_date_object()))
of.write('</td>')
# death column
if self.showdeath:
of.write('<td class="field">')
if person.handle in restrict_list:
of.write(_('restricted'))
else:
death_ref = person.get_death_ref()
if death_ref:
death = db.get_event_from_handle(death_ref.ref)
of.write(_dd.display(death.get_date_object()))
of.write('</td>')
# spouse (partner) column
if self.showspouse:
of.write('<td class="field">')
if person.handle in restrict_list:
of.write(_('restricted'))
else:
family_list = person.get_family_handle_list()
first_family = True
spouse_name = None
if family_list:
for family_handle in family_list:
family = db.get_family_from_handle(family_handle)
spouse_id = ReportUtils.find_spouse(person, family)
if spouse_id:
spouse = db.get_person_from_handle(spouse_id)
if self.exclude_private:
spouse = ReportUtils.sanitize_person(db, spouse)
spouse_name = spouse.get_primary_name().get_regular_name()
if not first_family:
of.write(', ')
of.write('%s' % spouse_name)
first_family = False
of.write('</td>')
# parents column
if self.showparents:
of.write('<td class="field">')
parent_handle_list = person.get_parent_family_handle_list()
if parent_handle_list:
parent_handle = parent_handle_list[0]
family = db.get_family_from_handle(parent_handle)
father_name = ''
mother_name = ''
father_id = family.get_father_handle()
mother_id = family.get_mother_handle()
father = db.get_person_from_handle(father_id)
mother = db.get_person_from_handle(mother_id)
if father and self.exclude_private:
father = ReportUtils.sanitize_person(db, father)
father_name = father.get_primary_name().get_regular_name()
if mother and self.exclude_private:
mother = ReportUtils.sanitize_person(db, mother)
mother_name = mother.get_primary_name().get_regular_name()
if mother and father:
of.write('%s, %s' % (father_name, mother_name))
elif mother:
of.write('%s' % mother_name)
elif father:
of.write('%s' % father_name)
of.write('</td>')
# finished writing all columns
of.write('</tr>\n')
first = False first = False
of.write('</tbody>\n</table>\n') of.write('</tbody>\n</table>\n')
@ -662,10 +807,19 @@ class SurnamePage(BasePage):
of.write('<p>%s</p>\n' % msg) of.write('<p>%s</p>\n' % msg)
of.write('<table class="infolist">\n<thead><tr>\n') of.write('<table class="infolist">\n<thead><tr>\n')
of.write('<th>%s</th>\n' % _('Name')) of.write('<th>%s</th>\n' % _('Name'))
of.write('<th>%s</th>\n' % _('Birth date')) if self.showbirth:
of.write('<th>%s</th>\n' % _('Birth'))
if self.showdeath:
of.write('<th>%s</th>\n' % _('Death'))
if self.showspouse:
of.write('<th>%s</th>\n' % _('Partner'))
if self.showparents:
of.write('<th>%s</th>\n' % _('Parents'))
of.write('</tr></thead>\n<tbody>\n') of.write('</tr></thead>\n<tbody>\n')
for person_handle in person_handle_list: for person_handle in person_handle_list:
# firstname column
person = db.get_person_from_handle(person_handle) person = db.get_person_from_handle(person_handle)
if self.exclude_private: if self.exclude_private:
person = ReportUtils.sanitize_person(db,person) person = ReportUtils.sanitize_person(db,person)
@ -674,16 +828,85 @@ class SurnamePage(BasePage):
self.person_link(of, self.build_name(path,person.handle), self.person_link(of, self.build_name(path,person.handle),
person.get_primary_name().get_first_name(), person.get_primary_name().get_first_name(),
person.gramps_id,False) person.gramps_id,False)
of.write('</td><td class="field">') of.write('</td>')
if person.handle in restrict_list:
of.write(_('restricted')) # birth column
else: if self.showbirth:
birth_ref = person.get_birth_ref() of.write('<td class="field">')
if birth_ref: if person.handle in restrict_list:
birth = db.get_event_from_handle(birth_ref.ref) of.write(_('restricted'))
birth_date = _dd.display(birth.get_date_object()) else:
of.write(birth_date) birth_ref = person.get_birth_ref()
of.write('</td></tr>\n') if birth_ref:
birth = db.get_event_from_handle(birth_ref.ref)
of.write(_dd.display(birth.get_date_object()))
of.write('</td>')
# death column
if self.showdeath:
of.write('<td class="field">')
if person.handle in restrict_list:
of.write(_('restricted'))
else:
death_ref = person.get_death_ref()
if death_ref:
death = db.get_event_from_handle(death_ref.ref)
of.write(_dd.display(death.get_date_object()))
of.write('</td>')
# spouse (partner) column
if self.showspouse:
of.write('<td class="field">')
if person.handle in restrict_list:
of.write(_('restricted'))
else:
family_list = person.get_family_handle_list()
first_family = True
spouse_name = None
if family_list:
for family_handle in family_list:
family = db.get_family_from_handle(family_handle)
spouse_id = ReportUtils.find_spouse(person, family)
if spouse_id:
spouse = db.get_person_from_handle(spouse_id)
if self.exclude_private:
spouse = ReportUtils.sanitize_person(db, spouse)
spouse_name = spouse.get_primary_name().get_regular_name()
if not first_family:
of.write(', ')
of.write('%s' % spouse_name)
first_family = False
of.write('</td>')
# parents column
if self.showparents:
of.write('<td class="field">')
parent_handle_list = person.get_parent_family_handle_list()
if parent_handle_list:
parent_handle = parent_handle_list[0]
family = db.get_family_from_handle(parent_handle)
father_name = ''
mother_name = ''
father_id = family.get_father_handle()
mother_id = family.get_mother_handle()
father = db.get_person_from_handle(father_id)
mother = db.get_person_from_handle(mother_id)
if father and self.exclude_private:
father = ReportUtils.sanitize_person(db, father)
father_name = father.get_primary_name().get_regular_name()
if mother and self.exclude_private:
mother = ReportUtils.sanitize_person(db, mother)
mother_name = mother.get_primary_name().get_regular_name()
if mother and father:
of.write('%s, %s' % (father_name, mother_name))
elif mother:
of.write('%s' % mother_name)
elif father:
of.write('%s' % father_name)
of.write('</td>')
# finished writing all columns
of.write('</tr>\n')
of.write('<tbody>\n</table>\n') of.write('<tbody>\n</table>\n')
self.display_footer(of,db) self.display_footer(of,db)
self.close_file(of) self.close_file(of)
@ -922,10 +1145,17 @@ class MediaPage(BasePage):
self.display_note_object(of, photo.get_note_object()) self.display_note_object(of, photo.get_note_object())
self.display_attr_list(of, ReportUtils.sanitize_list( photo.get_attribute_list(), self.exclude_private)) self.display_attr_list(of, ReportUtils.sanitize_list( photo.get_attribute_list(), self.exclude_private))
self.display_media_sources(of,db,photo)
self.display_references(of,db,media_list) self.display_references(of,db,media_list)
self.display_footer(of,db) self.display_footer(of,db)
self.close_file(of) self.close_file(of)
def display_media_sources(self,of,db,photo):
self.db = db
self.src_list = {}
sreflist = photo.get_source_references()
self.display_source_refs(of,db,sreflist)
def display_attr_list(self,of,attrlist=None): def display_attr_list(self,of,attrlist=None):
if not attrlist: if not attrlist:
return return
@ -1105,7 +1335,7 @@ class IntroductionPage(BasePage):
of.write('<pre>\n%s\n</pre>\n' % text) of.write('<pre>\n%s\n</pre>\n' % text)
else: else:
of.write('<p>') of.write('<p>')
of.write('</p><p>'.join(text.split('\n'))) of.write('<br>'.join(text.split('\n')))
of.write('</p>') of.write('</p>')
self.display_footer(of,db) self.display_footer(of,db)
@ -1152,7 +1382,7 @@ class HomePage(BasePage):
of.write('<pre>\n%s\n</pre>\n' % text) of.write('<pre>\n%s\n</pre>\n' % text)
else: else:
of.write('<p>') of.write('<p>')
of.write('</p><p>'.join(text.split('\n'))) of.write('<br>'.join(text.split('\n')))
of.write('</p>') of.write('</p>')
self.display_footer(of,db) self.display_footer(of,db)
@ -1391,11 +1621,11 @@ class ContactPage(BasePage):
if nobj: if nobj:
format = nobj.get_format() format = nobj.get_format()
text = nobj.get() text = nobj.get()
if format: if format:
text = u"<pre>%s</pre>" % text text = u"<pre>%s</pre>" % text
else: else:
text = u"</p><p>".join(text.split("\n")) text = u"<br>".join(text.split("\n"))
of.write('<p>%s</p>\n' % text) of.write('<p>%s</p>\n' % text)
of.write('</div>\n') of.write('</div>\n')
@ -1598,42 +1828,7 @@ class IndividualPage(BasePage):
sreflist = self.src_refs + self.person.get_source_references() sreflist = self.src_refs + self.person.get_source_references()
if not sreflist or self.restrict: if not sreflist or self.restrict:
return return
of.write('<div id="sourcerefs">\n') self.display_source_refs(of,self.db,sreflist)
of.write('<h4>%s</h4>\n' % _('Source References'))
of.write('<table class="infolist">\n')
index = 1
for sref in sreflist:
lnk = (self.cur_name, self.page_title, self.gid)
shandle = sref.get_reference_handle()
if not shandle:
continue
if self.src_list.has_key(shandle):
if lnk not in self.src_list[shandle]:
self.src_list[shandle].append(lnk)
else:
self.src_list[shandle] = [lnk]
source = self.db.get_source_from_handle(shandle)
title = source.get_title()
of.write('<tr><td class="field">')
of.write('<a name="sref%d"></a>%d.</td>' % (index,index))
of.write('<td class="field">')
self.source_link(of,source.handle,title,source.gramps_id,True)
tmp = []
confidence = Utils.confidence.get(sref.confidence, _('Unknown'))
for (label,data) in [(_('Date'),_dd.display(sref.date)),
(_('Page'),sref.page),
(_('Confidence'),confidence),
(_('Text'),sref.text)]:
if data:
tmp.append("%s: %s" % (label,data))
if len(tmp) > 0:
of.write('<br />' + '<br />'.join(tmp))
of.write('</td></tr>\n')
index += 1
of.write('</table>\n')
of.write('</div>\n')
def display_ind_pedigree(self,of): def display_ind_pedigree(self,of):
@ -1844,6 +2039,7 @@ class IndividualPage(BasePage):
# Get the mother and father relationships # Get the mother and father relationships
frel = "" frel = ""
mrel = "" mrel = ""
sibling = set()
child_handle = self.person.get_handle() child_handle = self.person.get_handle()
child_ref_list = ReportUtils.sanitize_list( family.get_child_ref_list(), child_ref_list = ReportUtils.sanitize_list( family.get_child_ref_list(),
self.exclude_private ) self.exclude_private )
@ -1867,6 +2063,7 @@ class IndividualPage(BasePage):
of.write('<tr>\n') of.write('<tr>\n')
self.display_parent(of,mother_handle,_('Mother'),mrel) self.display_parent(of,mother_handle,_('Mother'),mrel)
of.write('</tr>\n') of.write('</tr>\n')
first = False first = False
if len(child_ref_list) > 1: if len(child_ref_list) > 1:
of.write('<tr>\n') of.write('<tr>\n')
@ -1874,9 +2071,53 @@ class IndividualPage(BasePage):
of.write('<td class="data">\n') of.write('<td class="data">\n')
for child_ref in child_ref_list: for child_ref in child_ref_list:
child_handle = child_ref.ref child_handle = child_ref.ref
sibling.add(child_handle) # remember that we've already "seen" this child
if child_handle != self.person.handle: if child_handle != self.person.handle:
self.display_child_link(of,child_handle) self.display_child_link(of,child_handle)
of.write('</td>\n</tr>\n') of.write('</td>\n</tr>\n')
# Also try to identify half-siblings
other_siblings = set()
# if we have a known father...
if father_handle and self.showhalfsiblings:
# 1) get all of the families in which this father is involved
# 2) get all of the children from those families
# 3) if the children are not already listed as siblings...
# 4) then remember those children since we're going to list them
father = self.db.get_person_from_handle(father_handle)
for family_handle in father.get_family_handle_list():
family = self.db.get_family_from_handle(family_handle)
step_child_ref_list = ReportUtils.sanitize_list(family.get_child_ref_list(), self.exclude_private)
for step_child_ref in step_child_ref_list:
step_child_handle = step_child_ref.ref
if step_child_handle not in sibling:
if step_child_handle != self.person.handle:
# we have a new step/half sibling
other_siblings.add(step_child_ref.ref)
# do the same thing with the mother (see "father" just above):
if mother_handle and self.showhalfsiblings:
mother = self.db.get_person_from_handle(mother_handle)
for family_handle in mother.get_family_handle_list():
family = self.db.get_family_from_handle(family_handle)
step_child_ref_list = ReportUtils.sanitize_list(family.get_child_ref_list(), self.exclude_private)
for step_child_ref in step_child_ref_list:
step_child_handle = step_child_ref.ref
if step_child_handle not in sibling:
if step_child_handle != self.person.handle:
# we have a new step/half sibling
other_siblings.add(step_child_ref.ref)
# now that we have all of the step-siblings/half-siblings, print them out
if len(other_siblings) > 0:
of.write('<tr>\n')
of.write('<td class="field">%s</td>\n' % _("Other Siblings"))
of.write('<td class="data">\n')
for child_handle in other_siblings:
self.display_child_link(of, child_handle)
of.write('</td>\n</tr>\n')
of.write('<tr><td colspan="3">&nbsp;</td></tr>\n') of.write('<tr><td colspan="3">&nbsp;</td></tr>\n')
of.write('</table>\n') of.write('</table>\n')
of.write('</div>\n') of.write('</div>\n')
@ -1979,7 +2220,7 @@ class IndividualPage(BasePage):
if format: if format:
of.write( u"<pre>%s</pre>" % text ) of.write( u"<pre>%s</pre>" % text )
else: else:
of.write( u"</p><p>".join(text.split("\n"))) of.write( u"<br>".join(text.split("\n")))
of.write('</td>\n</tr>\n') of.write('</td>\n</tr>\n')
def pedigree_person(self,of,person,is_spouse=False): def pedigree_person(self,of,person,is_spouse=False):
@ -2054,6 +2295,21 @@ class IndividualPage(BasePage):
else: else:
text = '\n' text = '\n'
text += self.get_citation_links( event.get_source_references() ) text += self.get_citation_links( event.get_source_references() )
# if the event has a note attached to it, get the text and format it correctly
note_obj = event.get_note_object()
if note_obj:
note_text = note_obj.get()
if note_text != '':
if note_obj.get_format():
text += '<pre>\n'
text += note_text
text += '</pre>\n'
else:
text += '<p>'
text += u"<br>".join(note_text.split("\n"))
text += '</p>'
return text return text
def get_citation_links(self, source_ref_list): def get_citation_links(self, source_ref_list):
@ -2118,6 +2374,12 @@ class WebReport(Report):
NWEBintronote NWEBintronote
NWEBhomenote NWEBhomenote
NWEBnoid NWEBnoid
NWEBlinkhome
NWEBshowbirth
NWEBshowdeath
NWEBshowspouse
NWEBshowparents
NWEBshowhalfsiblings
""" """
self.database = database self.database = database
@ -2137,6 +2399,12 @@ class WebReport(Report):
self.restrict_years = options.handler.options_dict['NWEBrestrictyears'] self.restrict_years = options.handler.options_dict['NWEBrestrictyears']
self.exclude_private = not options.handler.options_dict['NWEBincpriv'] self.exclude_private = not options.handler.options_dict['NWEBincpriv']
self.noid = options.handler.options_dict['NWEBnoid'] self.noid = options.handler.options_dict['NWEBnoid']
self.linkhome = options.handler.options_dict['NWEBlinkhome']
self.showbirth = options.handler.options_dict['NWEBshowbirth']
self.showdeath = options.handler.options_dict['NWEBshowdeath']
self.showspouse = options.handler.options_dict['NWEBshowspouse']
self.showparents = options.handler.options_dict['NWEBshowparents']
self.showhalfsiblings = options.handler.options_dict['NWEBshowhalfsiblings']
self.title = options.handler.options_dict['NWEBtitle'] self.title = options.handler.options_dict['NWEBtitle']
self.sort = Sort.Sort(self.database) self.sort = Sort.Sort(self.database)
self.inc_gallery = options.handler.options_dict['NWEBgallery'] self.inc_gallery = options.handler.options_dict['NWEBgallery']
@ -2293,7 +2561,10 @@ class WebReport(Report):
def person_pages(self, ind_list, restrict_list, place_list, source_list, archive): def person_pages(self, ind_list, restrict_list, place_list, source_list, archive):
self.progress.set_pass(_('Creating individual pages'),len(ind_list)) self.progress.set_pass(_('Creating individual pages'),len(ind_list) + 1)
self.progress.step() # otherwise the progress indicator sits at 100%
# for a short while from the last step we did,
# which was to apply the privacy filter
IndividualListPage( IndividualListPage(
self.database, self.title, ind_list, restrict_list, self.database, self.title, ind_list, restrict_list,
@ -2453,6 +2724,12 @@ class WebReportOptions(ReportOptions):
'NWEBincpriv' : 0, 'NWEBincpriv' : 0,
'NWEBnonames' : 0, 'NWEBnonames' : 0,
'NWEBnoid' : 0, 'NWEBnoid' : 0,
'NWEBlinkhome' : 0,
'NWEBshowbirth' : 1,
'NWEBshowdeath' : 0,
'NWEBshowspouse' : 0,
'NWEBshowparents' : 0,
'NWEBshowhalfsiblings' : 0,
'NWEBcontact' : '', 'NWEBcontact' : '',
'NWEBgallery' : 1, 'NWEBgallery' : 1,
'NWEBheader' : '', 'NWEBheader' : '',
@ -2560,6 +2837,24 @@ class WebReportOptions(ReportOptions):
self.inc_download = gtk.CheckButton(download_msg) self.inc_download = gtk.CheckButton(download_msg)
self.inc_download.set_active(self.options_dict['NWEBdownload']) self.inc_download.set_active(self.options_dict['NWEBdownload'])
self.linkhome = gtk.CheckButton(_('Include link to home person on every page'))
self.linkhome.set_active(self.options_dict['NWEBlinkhome'])
self.showbirth = gtk.CheckButton(_('Include a column for birth dates on the index pages'))
self.showbirth.set_active(self.options_dict['NWEBshowbirth'])
self.showdeath = gtk.CheckButton(_('Include a column for death dates on the index pages'))
self.showdeath.set_active(self.options_dict['NWEBshowdeath'])
self.showspouse = gtk.CheckButton(_('Include a column for partners on the index pages'))
self.showspouse.set_active(self.options_dict['NWEBshowspouse'])
self.showparents = gtk.CheckButton(_('Include a column for parents on the index pages'))
self.showparents.set_active(self.options_dict['NWEBshowparents'])
self.showhalfsiblings = gtk.CheckButton(_('Include half-brothers and half-sisters as siblings'))
self.showhalfsiblings.set_active(self.options_dict['NWEBshowhalfsiblings'])
# FIXME: document this: # FIXME: document this:
# 0 -- no images of any kind # 0 -- no images of any kind
# 1 -- no living images, but some images # 1 -- no living images, but some images
@ -2667,6 +2962,14 @@ class WebReportOptions(ReportOptions):
dialog.add_frame_option(title,None,self.restrict_living) dialog.add_frame_option(title,None,self.restrict_living)
dialog.add_frame_option(title,None,self.hbox) dialog.add_frame_option(title,None,self.hbox)
title = _("Advanced Options")
dialog.add_frame_option(title,None,self.linkhome)
dialog.add_frame_option(title,None,self.showbirth)
dialog.add_frame_option(title,None,self.showdeath)
dialog.add_frame_option(title,None,self.showspouse)
dialog.add_frame_option(title,None,self.showparents)
dialog.add_frame_option(title,None,self.showhalfsiblings)
def restrict_toggled(self,obj): def restrict_toggled(self,obj):
self.restrict_years.set_sensitive(obj.get_active()) self.restrict_years.set_sensitive(obj.get_active())
@ -2678,6 +2981,12 @@ class WebReportOptions(ReportOptions):
self.options_dict['NWEBrestrictyears'] = int(self.restrict_years.get_text()) self.options_dict['NWEBrestrictyears'] = int(self.restrict_years.get_text())
self.options_dict['NWEBincpriv'] = int(not self.no_private.get_active()) self.options_dict['NWEBincpriv'] = int(not self.no_private.get_active())
self.options_dict['NWEBnoid'] = int(self.noid.get_active()) self.options_dict['NWEBnoid'] = int(self.noid.get_active())
self.options_dict['NWEBlinkhome'] = int(self.linkhome.get_active())
self.options_dict['NWEBshowbirth'] = int(self.showbirth.get_active())
self.options_dict['NWEBshowdeath'] = int(self.showdeath.get_active())
self.options_dict['NWEBshowspouse'] = int(self.showspouse.get_active())
self.options_dict['NWEBshowparents'] = int(self.showparents.get_active())
self.options_dict['NWEBshowhalfsiblings'] = int(self.showhalfsiblings.get_active())
self.options_dict['NWEBcontact'] = unicode(self.contact.get_handle()) self.options_dict['NWEBcontact'] = unicode(self.contact.get_handle())
self.options_dict['NWEBgallery'] = int(self.include_gallery.get_active()) self.options_dict['NWEBgallery'] = int(self.include_gallery.get_active())
self.options_dict['NWEBheader'] = unicode(self.header.get_handle()) self.options_dict['NWEBheader'] = unicode(self.header.get_handle())