From 0116f4040d5fe3af8cf2a241384f2b68225182b7 Mon Sep 17 00:00:00 2001
From: Don Allingham %s
\n' % _('Narrative'))
- of.write('
\n')
format = noteobj.get_format()
text = noteobj.get()
- if format:
- text = u"" + u"
".join(text.split("\n"))
- else:
- text = u"
".join(text.split("\n")) - of.write('
%s
\n' % text) + if text: + of.write('" + u"
".join(text.split("\n")) + else: + text = u"".join(text.split("\n")) + of.write('
%s
\n' % text) def display_url_list(self,of,urllist=None): if not urllist: @@ -246,6 +247,22 @@ class BasePage: index = index + 1 of.write('\n') + def display_references(self,of,db,handlelist): + if not handlelist: + return + of.write('%s
\n' % _('References')) + of.write('
\n') + of.write('
| %d. %s' % (index,handle,self.ext,_nd.display(person))) + of.write(' |
' % _('Sources')) - of.write(_('All sources cited in the project.')) + of.write(msg) of.write('
\n\n\n') index = 1 @@ -650,8 +671,9 @@ class SourcesPage(BasePage): source = db.get_source_from_handle(handle) of.write('
\n\n') + of.write('' % (handle,self.ext)) + of.write('%s [%s]' % (source.get_title(),source.gramps_id)) + of.write('\n') index += 1 of.write(' %d. \n' % index) of.write('') - of.write(source.get_title()) - of.write(' \n') @@ -659,6 +681,46 @@ class SourcesPage(BasePage): self.display_footer(of) self.close_file(of) +#------------------------------------------------------------------------ +# +# +# +#------------------------------------------------------------------------ +class SourcePage(BasePage): + + def __init__(self, db, title, handle, src_list, options, archive, media_list): + source = db.get_source_from_handle( handle) + BasePage.__init__(self, title, options, archive, media_list) + of = self.create_file(source.get_handle()) + source_name = source.get_title() + self.display_header(of,source_name,db.get_researcher().get_name()) + + self.display_first_image_as_thumbnail(of, db, source.get_media_list()) + + of.write('\n') + of.write('\n') + + # TODO: Add more information + + self.display_note_object(of, source.get_note_object()) + self.display_references(of,db,src_list[source.handle]) + self.display_footer(of) + self.close_file(of) + #------------------------------------------------------------------------ # # @@ -672,13 +734,17 @@ class GalleryPage(BasePage): of = self.create_file("gallery") self.display_header(of, _('Gallery'), db.get_researcher().get_name()) - handle_list = list(handle_set) - of.write('%s
\n' % source_name) + of.write('\n') + + for (label,val) in [(_('GRAMPS ID'),source.gramps_id), + (_('Author'),source.author), + (_('Publication information'),source.pubinfo), + (_('Abbreviation'),source.abbrev)]: + if val: + of.write('
\n') + of.write('\n') + + of.write(' %s \n' % label) + of.write('%s \n' % val) + of.write('%s
\n' % _('Gallery')) - of.write(_('All media images cited in the project.')) + + of.write(_("This page contains an index of all the media objects in the " + "database, sorted by their title. Clicking on the title will " + "take you to that media object's page")) of.write('
\n\n\n') + self.db = db + index = 1 + media_list.sort(self.by_media_title) for handle in media_list: media = db.get_object_from_handle(handle) of.write('
%d. \n' % index) @@ -694,6 +760,15 @@ class GalleryPage(BasePage): self.display_footer(of) self.close_file(of) + def by_media_title(self,a_id,b_id): + """Sort routine for comparing two events by their dates. """ + if not (a_id and b_id): + return False + a = self.db.get_object_from_handle(a_id) + b = self.db.get_object_from_handle(b_id) + return cmp(a.desc,b.desc) + + #------------------------------------------------------------------------ # # @@ -1086,12 +1161,26 @@ class IndividualPage(BasePage): of.write('\n') def format_event(self,event): + gid_list = [] for sref in event.get_source_references(): - self.src_list.add(sref.get_base_handle()) + handle = sref.get_base_handle() + gid_list.append(handle) + + if self.src_list.has_key(handle): + if self.person.handle not in self.src_list[handle]: + self.src_list[handle].append(self.person.handle) + else: + self.src_list[handle] = [self.person.handle] + descr = event.get_description() place_handle = event.get_place_handle() if place_handle: - self.place_list.add(place_handle) + if self.place_list.has_key(place_handle): + if self.person.handle not in self.place_list[place_handle]: + self.place_list[place_handle].append(self.person.handle) + else: + self.place_list[place_handle] = [self.person.handle] + place = '%s' % (place_handle,self.ext,ReportUtils.place_name(self.db,place_handle)) date = _dd.display(event.get_date_object()) @@ -1111,6 +1200,12 @@ class IndividualPage(BasePage): text = place else: text = '\n' + if len(gid_list) > 0: + text = text + " " + for handle in gid_list: + src = self.db.get_source_from_handle(handle) + text = text + ' [%s]' % (handle,self.ext,src.gramps_id) + text = text + "" return text #------------------------------------------------------------------------ @@ -1257,8 +1352,8 @@ class WebReport(Report.Report): if self.use_intro: IntroductionPage(self.database, self.title, self.options_class, archive, photo_list) - place_list = sets.Set() - source_list = sets.Set() + place_list = {} + source_list = {} for person_handle in ind_list: person = self.database.get_person_from_handle(person_handle) @@ -1284,14 +1379,18 @@ class WebReport(Report.Report): PlaceListPage(self.database, self.title, place_list, source_list,self.options_class, archive, photo_list) - for place in place_list: - PlacePage(self.database, self.title, place, source_list, + for place in place_list.keys(): + PlacePage(self.database, self.title, place, source_list, place_list, self.options_class, archive, photo_list) - SourcesPage(self.database,self.title, source_list, self.options_class, + SourcesPage(self.database,self.title, source_list.keys(), self.options_class, archive, photo_list) - GalleryPage(self.database,self.title, source_list, self.options_class, + for key in list(source_list): + SourcePage(self.database,self.title, key, source_list, self.options_class, + archive, photo_list) + + GalleryPage(self.database, self.title, source_list, self.options_class, archive, photo_list) for photo_handle in photo_list: