Created same fix from Gramps33 for Source Pages.

svn: r18274
This commit is contained in:
Rob G. Healey 2011-10-10 05:34:38 +00:00
parent 4037105e4f
commit 663a7279ca

View File

@ -2148,19 +2148,19 @@ class BasePage(object):
@param: gid -- gramps id @param: gid -- gramps id
@param: up -- whether to add backward reference @param: up -- whether to add backward reference
""" """
name = html_escape(name)
name = html_escape( name ) if not repo_yes:
return name
# build local page url # build local page url
url = self.report.build_url_fname_html(handle, 'repo', up) url = self.report.build_url_fname_html(handle, 'repo', up)
# begin hyperlink # begin hyperlink
hyper = Html("a", name, href = url, title = html_escape(name)) hyper = Html("a", name, href =url, title =name)
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)
# return hyperlink to its callers return hyper
return hyper if repo_yes else name
def place_link(self, handle, name, gid = None, up = False): def place_link(self, handle, name, gid = None, up = False):
@ -3466,7 +3466,7 @@ class EventPage(BasePage):
body += eventdetail body += eventdetail
thumbnail = self.display_first_image_as_thumbnail(event_media_list, event) thumbnail = self.display_first_image_as_thumbnail(event_media_list, event)
if thumbnail: if thumbnail is not None:
eventdetail += thumbnail eventdetail += thumbnail
# display page title # display page title
@ -4125,9 +4125,9 @@ class SourcePage(BasePage):
source = db.get_source_from_handle(handle) source = db.get_source_from_handle(handle)
if not source: if not source:
return return None
BasePage.__init__(self, report, title, source.gramps_id) BasePage.__init__(self, report, title, source.get_gramps_id())
self.page_title = source.get_title() self.page_title = source.get_title()
inc_repos = self.report.options["inc_repository"] inc_repos = self.report.options["inc_repository"]
@ -4136,20 +4136,21 @@ class SourcePage(BasePage):
sourcepage, head, body = self.write_header(_('Sources')) sourcepage, head, body = self.write_header(_('Sources'))
# begin source detail division # begin source detail division
with Html("div", class_ = "content", id = "SourceDetail") as srcdetail: with Html("div", class_ = "content", id = "SourceDetail") as section:
body += srcdetail body += section
media_list = source.get_media_list() if self.create_media:
thumbnail = self.display_first_image_as_thumbnail(media_list, source) media_list = source.get_media_list()
if thumbnail is not None: thumbnail = self.display_first_image_as_thumbnail(media_list, source)
srcdetail += thumbnail if thumbnail is not None:
section += thumbnail
# add section title # add section title
srcdetail += Html("h3", html_escape(source.get_title()), inline = True) section += Html("h3", html_escape(source.get_title()), inline = True)
# begin sources table # begin sources table
with Html("table", class_ = "infolist source") as table: with Html("table", class_ = "infolist source") as table:
srcdetail += table section += table
tbody = Html("tbody") tbody = Html("tbody")
table += tbody table += tbody
@ -4159,7 +4160,7 @@ class SourcePage(BasePage):
grampsid = self.gid grampsid = self.gid
for (label, val) in [ for (label, val) in [
(GRAMPSID, grampsid), (_("Gramps ID"), grampsid),
(_("Author"), source.author), (_("Author"), source.author),
(_("Publication information"), source.pubinfo), (_("Publication information"), source.pubinfo),
(_("Abbreviation"), source.abbrev) ]: (_("Abbreviation"), source.abbrev) ]:
@ -4171,38 +4172,43 @@ class SourcePage(BasePage):
) )
tbody += trow tbody += trow
# additional media if self.create_media:
sourcemedia = self.display_additional_images_as_gallery(media_list, source) # additional media
if sourcemedia is not None: sourcemedia = self.display_additional_images_as_gallery(media_list, source)
srcdetail += sourcemedia if sourcemedia is not None:
section += sourcemedia
# additional notes # additional notes
notelist = self.display_note_list( source.get_note_list() ) notelist = self.display_note_list(source.get_note_list()
)
if notelist is not None: if notelist is not None:
srcdetail += notelist section += notelist
# source repository list # source repository list
repo_ref_list = source.get_reporef_list() repo_ref_list = source.get_reporef_list()
if repo_ref_list: if repo_ref_list:
with Html("div", id = "subsection", class_ = "Repositories") as reposection: with Html("div", id = "subsection", class_ = "Repositories") as reposection:
srcdetail += reposection section += reposection
reposection += Html("h4", _("Repositories"), inline = True) reposection += Html("h4", _("Repositories"), inline = True)
ordered = Html("ol") ordered = Html("ol")
reposection += ordered reposection += ordered
for repo_ref in repo_ref_list: for repo_ref in repo_ref_list:
repository = db.get_repository_from_handle( repo_ref.ref ) repository = db.get_repository_from_handle(repo_ref.ref)
list = Html("li", self.repository_link( repository.handle, list = Html("li", self.repository_link(repository.get_handle(),
repository.name, repository.name,
inc_repos, inc_repos,
repository.gramps_id, repository.get_gramps_id(),
up = True ) ) up =True)
)
ordered += list ordered += list
# references # references
references = self.display_references(src_list[source.handle]) references = self.display_references(src_list[source.get_handle()]
)
if references is not None: if references is not None:
srcdetail += references section += references
# add clearline for proper styling # add clearline for proper styling
# add footer section # add footer section
@ -5978,7 +5984,8 @@ class RepositoryPage(BasePage):
will create the individual Repository Pages will create the individual Repository Pages
""" """
def __init__(self, report, title, repo, handle, gid = None): def __init__(self, report, title, repo, handle):
gid = repo.get_gramps_id()
BasePage.__init__(self, report, title, gid) BasePage.__init__(self, report, title, gid)
db = report.database db = report.database
@ -5999,24 +6006,23 @@ class RepositoryPage(BasePage):
tbody = Html("tbody") tbody = Html("tbody")
table += tbody table += tbody
# GRAMPS ID # repo gramps id
if not self.noid and gid: if not self.noid and gid:
# repo gramps id
trow = Html("tr") + ( trow = Html("tr") + (
Html("td", GRAMPSID, class_ = "ColumnAttribute", inline = True), Html("td", _("Gramps ID"), class_ ="ColumnAttribute", inline =True),
Html("td", gid, class_ = "ColumnValue", inline = True) Html("td", gid, class_ ="ColumnValue", inline =True)
) )
tbody += trow tbody += trow
# repository type # repository type
trow = Html("tr") + ( trow = Html("tr") + (
Html("td", THEAD, class_ = "ColumnAttribute", inline = True), Html("td", _("Type"), class_ ="ColumnAttribute", inline =True),
Html("td", str(repo.type), class_ = "ColumnValue", inline = True) Html("td", str(repo.type), class_ ="ColumnValue", inline =True)
) )
tbody += trow tbody += trow
# repository: address(es) # repository: address(es)... repositort addresses do NOT have Sources
addresses = self.dump_addresses(repo.get_address_list(), False) addresses = self.dump_addresses(repo.get_address_list(), False)
if addresses is not None: if addresses is not None:
repositorydetail += addresses repositorydetail += addresses
@ -6742,10 +6748,7 @@ class NavWebReport(Report):
for index, key in enumerate(keys): for index, key in enumerate(keys):
(repo, handle) = repos_dict[key] (repo, handle) = repos_dict[key]
# RepositoryPage Class RepositoryPage(self, self.title, repo, handle)
RepositoryPage(self, self.title, repo, handle, repo.gramps_id)
# increment progress bar
self.progress.step() self.progress.step()
def addressbook_pages(self, ind_list): def addressbook_pages(self, ind_list):
@ -6895,6 +6898,9 @@ class NavWebReport(Report):
Imagine we run gramps on Windows (heaven forbits), we don't want to Imagine we run gramps on Windows (heaven forbits), we don't want to
see backslashes in the URL. see backslashes in the URL.
""" """
if not fname:
return ""
if constfunc.win(): if constfunc.win():
fname = fname.replace('\\',"/") fname = fname.replace('\\',"/")
subdirs = self.build_subdirs(subdir, fname, up) subdirs = self.build_subdirs(subdir, fname, up)