diff --git a/data/css/Web_Basic-Ash.css b/data/css/Web_Basic-Ash.css index abc4ea3eb..776f559d7 100644 --- a/data/css/Web_Basic-Ash.css +++ b/data/css/Web_Basic-Ash.css @@ -749,6 +749,9 @@ div.grampsstylednote p { a.familymap { display: block; } +a.family_map { + margin-left: 15px; +} /* Subsection : References ----------------------------------------------------- */ diff --git a/data/css/Web_Basic-Blue.css b/data/css/Web_Basic-Blue.css index eeff39371..54480fd34 100644 --- a/data/css/Web_Basic-Blue.css +++ b/data/css/Web_Basic-Blue.css @@ -595,6 +595,9 @@ div#IndividualDetail table.infolist tbody tr td.ColumnAttribute { #familymap a.familymap { margin-left:20px; } +a.family_map { + margin-left: 20px; +} /* Surnames ----------------------------------------------------- */ diff --git a/data/css/Web_Basic-Cypress.css b/data/css/Web_Basic-Cypress.css index 839e8810e..3f0a900dd 100644 --- a/data/css/Web_Basic-Cypress.css +++ b/data/css/Web_Basic-Cypress.css @@ -810,6 +810,9 @@ div.grampsstylednote p { a.familymap { display: block; } +a.family_map { + margin-left: 15px; +} /* Subsection : Source References ----------------------------------------------------- */ diff --git a/data/css/Web_Basic-Lilac.css b/data/css/Web_Basic-Lilac.css index 2ad98dc71..542b5fd58 100644 --- a/data/css/Web_Basic-Lilac.css +++ b/data/css/Web_Basic-Lilac.css @@ -807,6 +807,9 @@ div.grampsstylednote p { a.familymap { display: block; } +a.family_map { + margin-left: 15px; +} /* Subsection : Source References ----------------------------------------------------- */ diff --git a/data/css/Web_Basic-Peach.css b/data/css/Web_Basic-Peach.css index 468ebb8e2..34ea6381d 100644 --- a/data/css/Web_Basic-Peach.css +++ b/data/css/Web_Basic-Peach.css @@ -808,6 +808,9 @@ div.grampsstylednote p { a.familymap { display: block; } +a.family_map { + margin-left: 15px; +} /* Subsection : Source References ----------------------------------------------------- */ diff --git a/data/css/Web_Basic-Spruce.css b/data/css/Web_Basic-Spruce.css index 8f0c573a1..200f4d38c 100644 --- a/data/css/Web_Basic-Spruce.css +++ b/data/css/Web_Basic-Spruce.css @@ -809,6 +809,9 @@ div.grampsstylednote p { a.familymap { display: block; } +a.family_map { + margin-left: 15px; +} /* Subsection : Source References ----------------------------------------------------- */ diff --git a/data/css/Web_Mainz.css b/data/css/Web_Mainz.css index f7a04a679..fbf7f6cc1 100644 --- a/data/css/Web_Mainz.css +++ b/data/css/Web_Mainz.css @@ -736,6 +736,9 @@ h4 + div.grampsstylednote, a.familymap { margin-left: 10px; margin-right: 10px; } +a.family_map { + margin-left: 10px; +} i.NoteType { font-weight: bold; font-size: .8em; diff --git a/data/css/Web_Nebraska.css b/data/css/Web_Nebraska.css index b9076f784..53a18ff3c 100644 --- a/data/css/Web_Nebraska.css +++ b/data/css/Web_Nebraska.css @@ -594,6 +594,9 @@ table.IndividualList tbody tr td.ColumnName a:hover { #familymap a.familymap { margin-left:20px; } +a.family_map { + margin-left: 20px; +} /* Subsections : Attributes ----------------------------------------------------- */ diff --git a/gramps/plugins/webreport/basepage.py b/gramps/plugins/webreport/basepage.py index a5b8dbb5f..cf8d300f3 100644 --- a/gramps/plugins/webreport/basepage.py +++ b/gramps/plugins/webreport/basepage.py @@ -2421,9 +2421,10 @@ class BasePage: # pylint: disable=C1001 @param: handle -- The family handle @param: url -- url to be linked """ - dummy_handle = handle + self.report.fam_link[handle] = url return Html("a", self._("Family Map"), href=url, - title=self._("Family Map"), class_="familymap", inline=True) + title=self._("Family Map"), class_="familymap", + inline=True) def display_spouse(self, partner, family, place_lat_long): """ diff --git a/gramps/plugins/webreport/family.py b/gramps/plugins/webreport/family.py index 2c0525046..ca3c1da90 100644 --- a/gramps/plugins/webreport/family.py +++ b/gramps/plugins/webreport/family.py @@ -49,7 +49,7 @@ import logging # Gramps module #------------------------------------------------ from gramps.gen.const import GRAMPS_LOCALE as glocale -from gramps.gen.lib import (EventType, Family) +from gramps.gen.lib import (EventType, Family, Name) from gramps.gen.plug.report import Bibliography from gramps.plugins.lib.libhtml import Html @@ -57,9 +57,11 @@ from gramps.plugins.lib.libhtml import Html # specific narrative web import #------------------------------------------------ from gramps.plugins.webreport.basepage import BasePage +from gramps.gen.display.name import displayer as _nd from gramps.plugins.webreport.common import (get_first_letters, _KEYPERSON, alphabet_navigation, sort_people, primary_difference, first_letter, + html_escape, FULLCLEAR, get_index_letter) _ = glocale.translation.sgettext @@ -381,6 +383,37 @@ class FamilyPages(BasePage): self.display_attr_list(attrlist, attrtable) relationshipdetail += attrsection + # for use in family map pages... + if self.report.options["familymappages"]: + name_format = self.report.options['name_format'] + fhandle = mhandle = father = mother = None + relationshipdetail += Html("h4", _("Family map"), inline=True) + mapdetail = Html("br") + fhandle = family.get_father_handle() + for handle, dummy_url in self.report.fam_link.items(): + if fhandle == handle: + father = self.r_db.get_person_from_handle(fhandle) + break + if father: + primary_name = father.get_primary_name() + name = Name(primary_name) + name.set_display_as(name_format) + fname = html_escape(_nd.display_name(name)) + mapdetail += self.family_map_link_for_parent(fhandle, fname) + mapdetail += Html("br") + mhandle = family.get_mother_handle() + for handle, dummy_url in self.report.fam_link.items(): + if mhandle == handle: + mother = self.r_db.get_person_from_handle(mhandle) + break + if mother: + primary_name = mother.get_primary_name() + name = Name(primary_name) + name.set_display_as(name_format) + mname = html_escape(_nd.display_name(name)) + mapdetail += self.family_map_link_for_parent(mhandle, mname) + relationshipdetail += mapdetail + # source references srcrefs = self.display_ind_sources(family) if srcrefs: @@ -394,3 +427,15 @@ class FamilyPages(BasePage): # send page out for processing # and close the file self.xhtml_writer(familydetailpage, output_file, sio, ldatec) + + def family_map_link_for_parent(self, handle, name): + """ + Creates a link to the family map for the father or the mother + + @param: handle -- The person handle + @param: name -- The name for this person to display + """ + url = self.report.fam_link[handle] + title = self._("Family Map for %s") % name + return Html("a", title, href=url, + title=title, class_="family_map", inline=True) diff --git a/gramps/plugins/webreport/narrativeweb.py b/gramps/plugins/webreport/narrativeweb.py index d72eba76d..8e1e44a35 100644 --- a/gramps/plugins/webreport/narrativeweb.py +++ b/gramps/plugins/webreport/narrativeweb.py @@ -270,6 +270,7 @@ class NavWebReport(Report): self.bkref_dict = None self.rel_class = None self.tab = None + self.fam_link = {} if self.options['securesite']: self.secure_mode = HTTPS else: