src/plugins/NarrativeWeb.py: Add addresses to individual page.

svn: r7928
This commit is contained in:
Brian Matherly 2007-01-18 04:31:08 +00:00
parent 1d9356620a
commit f358133c55
2 changed files with 50 additions and 15 deletions

View File

@ -7,6 +7,7 @@
2007-01-17 Brian Matherly <brian@gramps-project.org> 2007-01-17 Brian Matherly <brian@gramps-project.org>
* src/ReportBase/_ReportDialog.py: 0000832: Please enable cm/inch toggle in * src/ReportBase/_ReportDialog.py: 0000832: Please enable cm/inch toggle in
custom size for relationship graph custom size for relationship graph
* src/plugins/NarrativeWeb.py: Add addresses to individual page.
2007-01-17 Richard Taylor <rjt-gramps@thegrindstone.me.uk> 2007-01-17 Richard Taylor <rjt-gramps@thegrindstone.me.uk>
* src/NameDisplay.py (_format_str_base): enable new implementation * src/NameDisplay.py (_format_str_base): enable new implementation

View File

@ -1386,6 +1386,7 @@ class IndividualPage(BasePage):
self.display_attr_list(of, self.person.get_attribute_list()) self.display_attr_list(of, self.person.get_attribute_list())
self.display_ind_parents(of) self.display_ind_parents(of)
self.display_ind_relationships(of) self.display_ind_relationships(of)
self.display_addresses(of)
if not self.restrict: if not self.restrict:
media_list = [] media_list = []
@ -1712,6 +1713,32 @@ class IndividualPage(BasePage):
of.write('</table>\n') of.write('</table>\n')
of.write('</div>\n') of.write('</div>\n')
def display_addresses(self,of):
if self.restrict:
return
alist = self.person.get_address_list()
if len(alist) == 0:
return
of.write('<div id="addresses">\n')
of.write('<h4>%s</h4>\n' % _('Addresses'))
of.write('<table class="infolist">\n')
for addr in alist:
location = ", ".join([addr.get_street(),addr.get_city(),
addr.get_state(),addr.get_country()])
location += self.get_citation_links( addr.get_source_references() )
date = _dd.display(addr.get_date_object())
of.write('<tr><td class="field">%s</td>\n' % date)
of.write('<td class="data">%s</td>\n' % location)
of.write('</tr>\n')
of.write('</table>\n')
of.write('</div>\n')
def display_child_link(self, of, child_handle): def display_child_link(self, of, child_handle):
use_link = child_handle in self.ind_list use_link = child_handle in self.ind_list
child = self.db.get_person_from_handle(child_handle) child = self.db.get_person_from_handle(child_handle)
@ -1936,22 +1963,7 @@ class IndividualPage(BasePage):
of.write('</div>\n') of.write('</div>\n')
def format_event(self,event): def format_event(self,event):
gid_list = []
lnk = (self.cur_name, self.page_title, self.gid) lnk = (self.cur_name, self.page_title, self.gid)
for sref in event.get_source_references():
if self.exclude_private and sref.private:
continue
handle = sref.get_reference_handle()
gid_list.append(sref)
if self.src_list.has_key(handle):
if lnk not in self.src_list[handle]:
self.src_list[handle].append(lnk)
else:
self.src_list[handle] = [lnk]
self.src_refs.append(sref)
descr = event.get_description() descr = event.get_description()
place_handle = event.get_place_handle() place_handle = event.get_place_handle()
if place_handle: if place_handle:
@ -1984,12 +1996,34 @@ class IndividualPage(BasePage):
text = place text = place
else: else:
text = '\n' text = '\n'
text += self.get_citation_links( event.get_source_references() )
return text
def get_citation_links(self, source_ref_list):
gid_list = []
lnk = (self.cur_name, self.page_title, self.gid)
text = ""
for sref in source_ref_list:
if self.exclude_private and sref.private:
continue
handle = sref.get_reference_handle()
gid_list.append(sref)
if self.src_list.has_key(handle):
if lnk not in self.src_list[handle]:
self.src_list[handle].append(lnk)
else:
self.src_list[handle] = [lnk]
self.src_refs.append(sref)
if len(gid_list) > 0: if len(gid_list) > 0:
text = text + " <sup>" text = text + " <sup>"
for ref in gid_list: for ref in gid_list:
index = self.src_refs.index(ref)+1 index = self.src_refs.index(ref)+1
text = text + ' <a href="#sref%d">%d</a>' % (index,index) text = text + ' <a href="#sref%d">%d</a>' % (index,index)
text = text + "</sup>" text = text + "</sup>"
return text return text
#------------------------------------------------------------------------ #------------------------------------------------------------------------