More work as been done on class SourcePage using the new Source/ Citation code that Tim committed. Alphabetizing of the Person referents to a Source has been done but the list is not running correctly yet.
svn: r18661
This commit is contained in:
parent
5b355aa92b
commit
874cd601d2
@ -1,3 +1,4 @@
|
|||||||
|
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
#!/usr/bin/env python
|
#!/usr/bin/env python
|
||||||
#
|
#
|
||||||
@ -966,23 +967,19 @@ class BasePage(object):
|
|||||||
self.append_to_place_lat_long(place, event, place_lat_long)
|
self.append_to_place_lat_long(place, event, place_lat_long)
|
||||||
|
|
||||||
def event_link(self, eventtype, handle, gid = None, up = False):
|
def event_link(self, eventtype, handle, gid = None, up = False):
|
||||||
""" creates a hyperlink for an event based on its type """
|
"""
|
||||||
|
creates a hyperlink for an event based on its type
|
||||||
|
"""
|
||||||
|
if not self.inc_events:
|
||||||
|
return eventtype
|
||||||
|
|
||||||
url = self.report.build_url_fname_html(handle, "evt", up)
|
url = self.report.build_url_fname_html(handle, "evt", up)
|
||||||
|
hyper = Html("a", eventtype, href = url, title = eventtype)
|
||||||
|
|
||||||
# if event pages are being created, then hyperlink the event type
|
if not self.noid and gid:
|
||||||
if self.inc_events:
|
hyper += Html("span", " [%s]" % gid, class_ = "grampsid", inline = True)
|
||||||
evt_hyper = Html("a", eventtype, href = url, title = eventtype)
|
|
||||||
if not self.noid and gid:
|
|
||||||
evt_hyper += Html("span", " [%s]" % gid, class_ = "grampsid",
|
|
||||||
inline = True)
|
|
||||||
|
|
||||||
# return event hyper link to its callers
|
return hyper
|
||||||
return evt_hyper
|
|
||||||
|
|
||||||
# return just the eventtype
|
|
||||||
else:
|
|
||||||
return eventtype
|
|
||||||
|
|
||||||
def format_family_events(self, event_ref_list, place_lat_long):
|
def format_family_events(self, event_ref_list, place_lat_long):
|
||||||
"""
|
"""
|
||||||
@ -2236,21 +2233,21 @@ class BasePage(object):
|
|||||||
person_name = person
|
person_name = person
|
||||||
|
|
||||||
# 1. start building link to image or person
|
# 1. start building link to image or person
|
||||||
hyper = Html("a", href=url, inline=True)
|
hyper = Html("a", href = url)
|
||||||
|
|
||||||
# 2. insert thumbnail if there is one, otherwise insert class = "noThumb"
|
# 2. insert thumbnail if there is one, otherwise insert class = "noThumb"
|
||||||
if thumbnailUrl:
|
if thumbnailUrl:
|
||||||
hyper += (Html("span", class_ = "thumbnail") +
|
hyper += Html("span", class_ = "thumbnail") + (
|
||||||
Html("img", src = thumbnailUrl, alt = "Image of " + person_name)
|
Html("img", src = thumbnailUrl, alt = "Image: " + person_name)
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
hyper.attr += ' class= "noThumb"'
|
hyper.attr += ' class = "noThumb"'
|
||||||
|
|
||||||
# 3. insert the person's name
|
# 3. insert the person's name
|
||||||
hyper += person_name
|
hyper += person_name
|
||||||
|
|
||||||
# 3. insert gramps id if requested and available
|
# 3. insert gramps id if requested and available
|
||||||
if not self.noid and gid:
|
if (not self.noid and gid):
|
||||||
hyper += Html("span", " [%s]" % gid, class_ = "grampsid", inline = True)
|
hyper += Html("span", " [%s]" % gid, class_ = "grampsid", inline = True)
|
||||||
|
|
||||||
else:
|
else:
|
||||||
@ -4227,11 +4224,13 @@ class SourcePage(BasePage):
|
|||||||
def __init__(self, report, title, source, handle, src_list, ppl_handle_list):
|
def __init__(self, report, title, source, handle, src_list, ppl_handle_list):
|
||||||
if not source:
|
if not source:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
self.page_title = source.get_title()
|
self.page_title = source.get_title()
|
||||||
self.dbase_ = report.database
|
self.dbase_ = report.database
|
||||||
BasePage.__init__(self, report, title, source.get_gramps_id())
|
BasePage.__init__(self, report, title, source.get_gramps_id())
|
||||||
|
|
||||||
inc_repos = self.report.options["inc_repository"]
|
self.inc_repositories = self.report.options["inc_repository"]
|
||||||
|
self.inc_events = self.report.options['inc_events']
|
||||||
|
|
||||||
of = self.report.create_file(source.get_handle(), "src")
|
of = self.report.create_file(source.get_handle(), "src")
|
||||||
self.up = True
|
self.up = True
|
||||||
@ -4285,42 +4284,44 @@ class SourcePage(BasePage):
|
|||||||
sourcedetail += notelist
|
sourcedetail += notelist
|
||||||
|
|
||||||
# source repository list
|
# source repository list
|
||||||
repo_ref_list = source.get_reporef_list()
|
if self.inc_repositories:
|
||||||
if repo_ref_list:
|
repo_ref_list = source.get_reporef_list()
|
||||||
with Html("div", class_ ="subsection", id ="repositories") as repositories:
|
if repo_ref_list:
|
||||||
sourcedetail += repositories
|
with Html("div", class_ ="subsection", id ="repositories") as repositories:
|
||||||
repositories += Html("h4", _("Repositories"), inline = True)
|
sourcedetail += repositories
|
||||||
|
repositories += Html("h4", _("Repositories"), inline = True)
|
||||||
|
|
||||||
with Html("table", class_ ="infolist") as table:
|
with Html("table", class_ ="infolist") as table:
|
||||||
repositories += table
|
repositories += table
|
||||||
|
|
||||||
thead = Html("thead")
|
thead = Html("thead")
|
||||||
table += thead
|
table += thead
|
||||||
|
|
||||||
trow = Html("tr") + (
|
trow = Html("tr") + (
|
||||||
Html("th", _("Number"), class_ ="ColumnRowLabel", inline =True),
|
Html("th", _("Number"), class_ ="ColumnRowLabel", inline =True),
|
||||||
Html("th", _("Name"), class_ ="ColumnName", inline =True)
|
Html("th", _("Name"), class_ ="ColumnName", inline =True)
|
||||||
)
|
)
|
||||||
thead += trow
|
thead += trow
|
||||||
|
|
||||||
tbody = Html("tbody")
|
tbody = Html("tbody")
|
||||||
table += tbody
|
table += tbody
|
||||||
|
|
||||||
index = 1
|
index = 1
|
||||||
for repo_ref in repo_ref_list:
|
for repo_ref in repo_ref_list:
|
||||||
repository = self.dbase_.get_repository_from_handle(repo_ref.ref)
|
repository = self.dbase_.get_repository_from_handle(repo_ref.ref)
|
||||||
if repository:
|
if repository:
|
||||||
trow = Html("tr") + (
|
trow = Html("tr") + (
|
||||||
Html("td", index, class_ ="ColumnRowLabel", inline =True),
|
Html("td", index, class_ ="ColumnRowLabel", inline =True),
|
||||||
Html("td", self.repository_link(repo_ref.ref,
|
Html("td", self.repository_link(repo_ref.ref,
|
||||||
repository.get_name(),
|
repository.get_name(),
|
||||||
inc_repos,
|
self.inc_repositories,
|
||||||
repository.get_gramps_id(),
|
repository.get_gramps_id(),
|
||||||
up =True))
|
up = True)
|
||||||
)
|
)
|
||||||
tbody += trow
|
)
|
||||||
|
tbody += trow
|
||||||
|
|
||||||
# get source and its citation references
|
# get the Source and its Citation Referents too...
|
||||||
the_lists = Utils.get_source_and_citation_referents(handle, self.dbase_)
|
the_lists = Utils.get_source_and_citation_referents(handle, self.dbase_)
|
||||||
if the_lists:
|
if the_lists:
|
||||||
(citation_list, citation_referents_list) = the_lists
|
(citation_list, citation_referents_list) = the_lists
|
||||||
@ -4337,7 +4338,7 @@ class SourcePage(BasePage):
|
|||||||
for (citation_handle, refs) in citation_referents_list:
|
for (citation_handle, refs) in citation_referents_list:
|
||||||
citation = self.dbase_.get_citation_from_handle(citation_handle)
|
citation = self.dbase_.get_citation_from_handle(citation_handle)
|
||||||
if citation:
|
if citation:
|
||||||
list = Html("li", citation.get_page(), inline =True)
|
list = Html("li", citation.get_page())
|
||||||
ordered += list
|
ordered += list
|
||||||
|
|
||||||
# if citation references?
|
# if citation references?
|
||||||
@ -4346,29 +4347,49 @@ class SourcePage(BasePage):
|
|||||||
|
|
||||||
# Citation Referents have Person objects...
|
# Citation Referents have Person objects...
|
||||||
if ppl_list:
|
if ppl_list:
|
||||||
ppl_list = set([phandle for phandle in ppl_list])
|
|
||||||
|
|
||||||
ordered1 = Html("ol", _("Person(s)"))
|
# only add the person handle if the individual is in the report database, and reove any duplication if any?
|
||||||
for person_handle in ppl_list:
|
ppl_list = [phandle for phandle in ppl_list if check_person_database(phandle, ppl_handle_list)]
|
||||||
_obj = self.dbase_.get_person_from_handle(person_handle)
|
|
||||||
if _obj:
|
# Sort the person list by the individual's surname...
|
||||||
list1 = Html("li")
|
ppl_list = sort_people(self.dbase_, ppl_list)
|
||||||
|
|
||||||
|
ordered1 = Html("ol")
|
||||||
|
list1 = Html("li", _("Person(s)"))
|
||||||
|
ordered1 += list1
|
||||||
|
|
||||||
|
for (surname, handle_list) in ppl_list:
|
||||||
|
|
||||||
|
ordered2 = Html("ol")
|
||||||
|
list1 += ordered2
|
||||||
|
|
||||||
|
list2 = Html("li", surname)
|
||||||
|
ordered2 += list2
|
||||||
|
|
||||||
|
ordered3 = Html("ol")
|
||||||
|
|
||||||
|
for person_handle in handle_list:
|
||||||
|
_obj = self.dbase_.get_person_from_handle(person_handle)
|
||||||
|
if _obj:
|
||||||
|
|
||||||
use_link = check_person_database(person_handle, ppl_handle_list)
|
|
||||||
if use_link:
|
|
||||||
url = self.report.build_url_fname_html(person_handle, "ppl", up = True)
|
url = self.report.build_url_fname_html(person_handle, "ppl", up = True)
|
||||||
list1 += self.person_link(url, _obj, _NAME_STYLE_DEFAULT,
|
list3 = Html("li") + self.person_link(url, _obj, _NAME_STYLE_DEFAULT,
|
||||||
gid=_obj.get_gramps_id())
|
gid = _obj.get_gramps_id())
|
||||||
else:
|
ordered3 += list3
|
||||||
list1 += self.get_name(_obj)
|
list2 += ordered3
|
||||||
ordered1 += list1
|
list += ordered1
|
||||||
list += ordered1
|
|
||||||
|
|
||||||
# Citation Referents have Family objects...
|
# Citation Referents have Family objects...
|
||||||
if fml_list:
|
if fml_list:
|
||||||
ffml_list = set([fhandle for fhandle in fml_list])
|
ffml_list = set([fhandle for fhandle in fml_list])
|
||||||
|
|
||||||
ordered2 = Html("ol", _("Families"))
|
ordered1 = Html("ol")
|
||||||
|
list1 = Html("li", _("Families"))
|
||||||
|
ordered1 += list1
|
||||||
|
|
||||||
|
ordered2 = Html("ol")
|
||||||
|
list1 += ordered2
|
||||||
|
|
||||||
for fhandle in families:
|
for fhandle in families:
|
||||||
_obj = self.dbase_.get_family_from_handle(fhandle)
|
_obj = self.dbase_.get_family_from_handle(fhandle)
|
||||||
if _obj:
|
if _obj:
|
||||||
@ -4417,73 +4438,103 @@ class SourcePage(BasePage):
|
|||||||
else:
|
else:
|
||||||
hlink = father_name
|
hlink = father_name
|
||||||
list2 += hlink
|
list2 += hlink
|
||||||
ordered2 += list2
|
ordered1 += list2
|
||||||
list += ordered2
|
list += ordered1
|
||||||
|
|
||||||
# Citation Referents have Event objects...
|
# Citation Referents have Event objects...
|
||||||
if event_list:
|
if event_list:
|
||||||
event_list = set([evt_handle for evt_handle in event_list])
|
event_list = set([evt_handle for evt_handle in event_list])
|
||||||
|
|
||||||
ordered3 = Html("ol", _("Events"))
|
ordered1 = Html("ol")
|
||||||
|
list1 = Html("li", _("Events"))
|
||||||
|
ordered1 += list1
|
||||||
|
|
||||||
|
ordered2 = Html("ol")
|
||||||
|
list1 += ordered2
|
||||||
|
|
||||||
for evt_handle in event_list:
|
for evt_handle in event_list:
|
||||||
_obj = self.dbase_.get_event_from_handle(evt_handle)
|
_obj = self.dbase_.get_event_from_handle(evt_handle)
|
||||||
if _obj:
|
if _obj:
|
||||||
list3 = Html("li") + self.event_link(_obj.get_type(), evt_handle,
|
list2 = Html("li") + self.event_link(_obj.get_type(), evt_handle,
|
||||||
gid = _obj.get_gramps_id(), up =True)
|
gid = _obj.get_gramps_id(), up =True)
|
||||||
ordered3 += list3
|
ordered2 += list2
|
||||||
list += ordered3
|
list += ordered1
|
||||||
|
|
||||||
# Citation Referents have Place objects...
|
# Citation Referents have Place objects...
|
||||||
if place_list:
|
if place_list:
|
||||||
place_list = set([plc_handle for plc_handle in place_list])
|
place_list = set([plc_handle for plc_handle in place_list])
|
||||||
|
|
||||||
ordered4 = Html("ol", _("Place"))
|
ordered1 = Html("ol")
|
||||||
|
list1 = Html("li", _("Places"))
|
||||||
|
ordered1 += list1
|
||||||
|
|
||||||
|
ordered2 = Html("ol")
|
||||||
|
list1 += ordered2
|
||||||
|
|
||||||
for plc_handle in place_list:
|
for plc_handle in place_list:
|
||||||
_obj = self.dbase_.get_place_from_handle(plc_handle)
|
_obj = self.dbase_.get_place_from_handle(plc_handle)
|
||||||
if _obj:
|
if _obj:
|
||||||
list4 = Html("li") + self.place_link(plc_handle, _obj.get_title(), up = True)
|
list2 = Html("li") + self.place_link(plc_handle, _obj.get_title(), up = True)
|
||||||
ordered4 += list4
|
ordered2 += list2
|
||||||
list += ordered4
|
list += ordered1
|
||||||
|
|
||||||
# Citation Referents have Source objects...
|
# Citation Referents have Source objects...
|
||||||
if source_list:
|
if source_list:
|
||||||
source_list = set([src_handle for src_handle in source_list])
|
source_list = set([src_handle for src_handle in source_list])
|
||||||
|
|
||||||
ordered5 = Html("ol", _("Sources"))
|
ordered1 = Html("ol")
|
||||||
|
list1 = Html("li", _("Sources"))
|
||||||
|
ordered1 += list1
|
||||||
|
|
||||||
|
ordered2 = Html("ol")
|
||||||
|
list1 += ordered2
|
||||||
|
|
||||||
for src_handle in source_list:
|
for src_handle in source_list:
|
||||||
_obj = self.dbase_.get_source_from_handle(src_handle)
|
_obj = self.dbase_.get_source_from_handle(src_handle)
|
||||||
if _obj:
|
if _obj:
|
||||||
list5 = Html("li") + self.source_link(_obj, up = True)
|
list2 = Html("li") + self.source_link(_obj, up = True)
|
||||||
ordered5 += list5
|
ordered2 += list2
|
||||||
list += ordered5
|
list += ordered1
|
||||||
|
|
||||||
# Citation Referents have Media objects...
|
# Citation Referents have Media objects...
|
||||||
if media_list:
|
if media_list:
|
||||||
media_list = set([mhandle for mhandle in media_list])
|
media_list = set([mhandle for mhandle in media_list])
|
||||||
|
|
||||||
ordered6 = Html("ol", _("Sources"))
|
ordered1 = Html("ol")
|
||||||
|
list1 = Html("li", _("Media"))
|
||||||
|
ordered1 += list1
|
||||||
|
|
||||||
|
ordered2 = Html("ol")
|
||||||
|
list1 += ordered2
|
||||||
|
|
||||||
for mhandle in media_list:
|
for mhandle in media_list:
|
||||||
_obj = self.dbase_.get_object_from_handle(mhandle)
|
_obj = self.dbase_.get_object_from_handle(mhandle)
|
||||||
if _obj:
|
if _obj:
|
||||||
real_path, newpath = self.report.prepare_copy_media(_obj)
|
real_path, newpath = self.report.prepare_copy_media(_obj)
|
||||||
ewpath = self.report.build_url_fname(newpath, up = True)
|
ewpath = self.report.build_url_fname(newpath, up = True)
|
||||||
|
|
||||||
list6 = Html("li") + self.media_link(mhandle,
|
list2 = Html("li") + self.media_link(mhandle,
|
||||||
newpath, _obj.get_description(), up = True)
|
newpath, _obj.get_description(), up = True)
|
||||||
ordered6 += list6
|
ordered2 += list2
|
||||||
list += ordered6
|
list += ordered1
|
||||||
|
|
||||||
# Citation Referents have Repository objects...
|
# Citation Referents have Repository objects...
|
||||||
if repo_list:
|
if repo_list:
|
||||||
repo_list = set([rhandle for rhandle in repo_list])
|
repo_list = set([rhandle for rhandle in repo_list])
|
||||||
|
|
||||||
ordered7 = Html("ol", _("Media"))
|
ordered1 = Html("ol")
|
||||||
|
list1 = Html("li", _("Repositories"))
|
||||||
|
ordered1 += list1
|
||||||
|
|
||||||
|
ordered2 = Html("ol")
|
||||||
|
list1 += ordered2
|
||||||
|
|
||||||
for repo_handle in repo_list:
|
for repo_handle in repo_list:
|
||||||
_obj = self.dbase_.get_repository_from_handle(repo_handle)
|
_obj = self.dbase_.get_repository_from_handle(repo_handle)
|
||||||
if _obj:
|
if _obj:
|
||||||
list7 = Html("li") + self.repository_link(repo_handle, _obj.get_name(), up = True)
|
list2 = Html("li") + self.repository_link(repo_handle, _obj.get_name(), up = True)
|
||||||
ordered7 += list7
|
ordered2 += list2
|
||||||
list += ordered7
|
list += ordered1
|
||||||
|
|
||||||
# add clearline for proper styling
|
# add clearline for proper styling
|
||||||
# add footer section
|
# add footer section
|
||||||
|
Loading…
Reference in New Issue
Block a user