Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
webreport.BasePage: Show other roles for an event.
Browse files Browse the repository at this point in the history
V-Smeets committed Jan 21, 2024
1 parent 892fc27 commit ec9a00c
Showing 2 changed files with 27 additions and 1 deletion.
20 changes: 19 additions & 1 deletion gramps/plugins/webreport/basepage.py
Original file line number Diff line number Diff line change
@@ -92,7 +92,7 @@
from gramps.gen.display.name import displayer as _nd
from gramps.gen.display.place import displayer as _pd
from gramps.plugins.lib.libhtmlconst import _CC
from gramps.gen.utils.db import get_birth_or_fallback, get_death_or_fallback
from gramps.gen.utils.db import get_birth_or_fallback, get_death_or_fallback, find_witnessed_people
from gramps.gen.datehandler import parser as _dp
from gramps.plugins.lib.libhtml import Html, xml_lang
from gramps.plugins.lib.libhtmlbackend import HtmlBackend, process_spaces
@@ -210,6 +210,7 @@ def __init__(self, report, the_lang, the_title, gid=None):
self.create_thumbs_index = report.options["create_thumbs_index"]
self.inc_families = report.options["inc_families"]
self.inc_events = report.options["inc_events"]
self.inc_other_roles = report.options["inc_other_roles"]
self.usecms = report.options["usecms"]
self.prevnext = report.options["prevnext"]
self.target_uri = report.options["cmsuri"]
@@ -923,6 +924,21 @@ def display_event_row(
if notelist:
htmllist.extend(self.dump_notes(notelist, Event))

if self.inc_other_roles:
witnessed_person_handles = find_witnessed_people(self.r_db, self.person)
for witnessed_person_handle in witnessed_person_handles:
witnessed_person = self.r_db.get_person_from_handle(witnessed_person_handle)
for witnessed_person_event_ref in witnessed_person.get_event_ref_list():
witnessed_person_event = self.r_db.get_event_from_handle(witnessed_person_event_ref.ref)
if witnessed_person_event != event:
continue
witnessed_person_name = self.new_person_link(witnessed_person_handle, uplink, witnessed_person)
htmllist.extend(Html("p",
_("(%(str1)s) %(str2)s") % {
'str1' : Html("b", witnessed_person_event_ref.get_role()),
'str2' : witnessed_person_name
}))

trow2 += Html("td", htmllist, class_="ColumnNotes", colspan=3)

trow += trow2
@@ -1878,6 +1894,7 @@ def display_nav_links(self, currentsection, cal=0):
(self.report.surname_fname, self._("Surnames"), True),
("families", self._("Families"), self.report.inc_families),
("events", self._("Events"), self.report.inc_events),
("other_roles", self._("Other roles"), self.report.inc_other_roles),
("places", self._("Places"), self.report.inc_places),
("sources", self._("Sources"), self.report.inc_sources),
("repositories", self._("Repositories"), inc_repos),
@@ -2058,6 +2075,7 @@ def display_drop_menu(self):

navs1 = [
("events", self._("Events"), self.report.inc_events),
("other_roles", self._("Other roles"), self.report.inc_other_roles),
("places", self._("Places"), True),
("sources", self._("Sources"), True),
("repositories", self._("Repositories"), inc_repos),
8 changes: 8 additions & 0 deletions gramps/plugins/webreport/narrativeweb.py
Original file line number Diff line number Diff line change
@@ -215,6 +215,9 @@ def __init__(self, database, options, user):
# create an event pages or not?
self.inc_events = self.options["inc_events"]

# Include other roles to an event?
self.inc_other_roles = self.options['inc_other_roles']

# create places pages or not?
self.inc_places = self.options["inc_places"]

@@ -2541,6 +2544,11 @@ def __add_advanced_options_2(self, menu):
inc_events.set_help(_("Add a complete events list and relevant pages or not"))
addopt("inc_events", inc_events)

inc_other_roles = BooleanOption(_('Include other roles'), False)
inc_other_roles.set_help(
_('Include persons with other roles to an event'))
addopt("inc_other_roles", inc_other_roles)

inc_places = BooleanOption(_("Include place pages"), False)
inc_places.set_help(_("Whether or not to include the place pages."))
addopt("inc_places", inc_places)

0 comments on commit ec9a00c

Please sign in to comment.