From 772e4b15b08556bb34d9c0eafe0450dbc69c48d1 Mon Sep 17 00:00:00 2001
From: Brian Matherly
Date: Wed, 7 Mar 2007 03:11:41 +0000
Subject: [PATCH] * src/plugins/NarrativeWeb.py: *
src/ReportBase/_ReportUtils.py: Fix 0000956: Event order within GRAMPS not
replicated in web report
svn: r8277
---
ChangeLog | 5 ++++
src/ReportBase/_ReportUtils.py | 15 ++++++-----
src/plugins/NarrativeWeb.py | 48 ++++++++++++++--------------------
3 files changed, 33 insertions(+), 35 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index 722631cca..2f63de301 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2007-03-06 Brian Matherly
+ * src/plugins/NarrativeWeb.py:
+ * src/ReportBase/_ReportUtils.py:
+ Fix 0000956: Event order within GRAMPS not replicated in web report
+
2007-03-05 Brian Matherly
* src/plugins/NarrativeWeb.py: Fix 0000954: e-mail address causes Narrative
Web plugin to generate bad links
diff --git a/src/ReportBase/_ReportUtils.py b/src/ReportBase/_ReportUtils.py
index 025a7d8a8..4679fcbd9 100644
--- a/src/ReportBase/_ReportUtils.py
+++ b/src/ReportBase/_ReportUtils.py
@@ -1162,6 +1162,14 @@ def sanitize_person(db,person):
# set complete flag
new_person.set_marker(person.get_marker())
+ # copy event list
+ for event_ref in person.get_event_ref_list():
+ if event_ref and event_ref.get_privacy() == False:
+ event = db.get_event_from_handle(event_ref.ref)
+ if not event.get_privacy():
+ new_person.add_event_ref(event_ref)
+
+ # Copy birth and death after event list to maintain the order.
# copy birth event
event_ref = person.get_birth_ref()
if event_ref and event_ref.get_privacy() == False:
@@ -1176,13 +1184,6 @@ def sanitize_person(db,person):
if not event.get_privacy():
new_person.set_death_ref(event_ref)
- # copy event list
- for event_ref in person.get_event_ref_list():
- if event_ref and event_ref.get_privacy() == False:
- event = db.get_event_from_handle(event_ref.ref)
- if not event.get_privacy():
- new_person.add_event_ref(event_ref)
-
# copy address list
for address in person.get_address_list():
if not address.get_privacy():
diff --git a/src/plugins/NarrativeWeb.py b/src/plugins/NarrativeWeb.py
index 870922e10..04e7e861f 100644
--- a/src/plugins/NarrativeWeb.py
+++ b/src/plugins/NarrativeWeb.py
@@ -1159,6 +1159,15 @@ class SourcesPage(BasePage):
self.display_header(of, db, _('Sources'), author)
handle_list = list(handle_set)
+ source_dict = {}
+
+ #Sort the sources
+ for handle in handle_list:
+ source = db.get_source_from_handle(handle)
+ key = source.get_title() + str(source.get_gramps_id())
+ source_dict[key] = (source, handle)
+ keys = source_dict.keys()
+ keys.sort(strcoll_case_sensitive)
msg = _("This page contains an index of all the sources in the "
"database, sorted by their title. Clicking on a source's "
@@ -1169,8 +1178,8 @@ class SourcesPage(BasePage):
of.write('
\n\n')
index = 1
- for handle in handle_list:
- source = db.get_source_from_handle(handle)
+ for key in keys:
+ (source, handle) = source_dict[key]
of.write('%d. | \n' % index)
of.write('')
self.source_link(of,handle,source.get_title(),source.gramps_id)
@@ -1687,11 +1696,9 @@ class IndividualPage(BasePage):
of.write(' |
\n
\n\n')
def display_ind_events(self,of):
- birth_ref = self.person.get_birth_ref()
- death_ref = self.person.get_death_ref()
evt_ref_list = self.person.get_primary_event_ref_list()
- if not birth_ref and not death_ref and not evt_ref_list:
+ if not evt_ref_list:
return
if self.restrict:
return
@@ -1700,30 +1707,15 @@ class IndividualPage(BasePage):
of.write('%s
\n' % _('Events'))
of.write('\n')
- # Birth
- if birth_ref:
- event = self.db.get_event_from_handle(birth_ref.ref)
- of.write('%s | \n' % _('Birth'))
- of.write('%s | \n' % self.format_event(event))
- of.write('
\n')
-
- # Death
- if death_ref:
- event = self.db.get_event_from_handle(death_ref.ref)
- of.write('%s | \n' % _('Death'))
- of.write('%s | \n' % self.format_event(event))
- of.write('
\n')
-
for event_ref in evt_ref_list:
- if event_ref != birth_ref and event_ref != death_ref:
- event = self.db.get_event_from_handle(event_ref.ref)
- if event:
- evt_name = str(event.get_type())
- of.write('%s | \n' % evt_name)
- of.write('\n')
- of.write(self.format_event(event))
- of.write(' | \n')
- of.write('
\n')
+ event = self.db.get_event_from_handle(event_ref.ref)
+ if event:
+ evt_name = str(event.get_type())
+ of.write('%s | \n' % evt_name)
+ of.write('\n')
+ of.write(self.format_event(event))
+ of.write(' | \n')
+ of.write('
\n')
of.write('
\n')
of.write('\n')