Fixed error in get_citation_links(). Thanks for pointing it out to me.

svn: r18921
This commit is contained in:
Rob G. Healey 2012-02-17 23:52:36 +00:00
parent 73a32cfeec
commit 3353dc024b

View File

@ -787,11 +787,7 @@ class BasePage(object):
index, key = self.bibli.add_reference(citation) index, key = self.bibli.add_reference(citation)
id_ = "%d%s" % (index+1,key) id_ = "%d%s" % (index+1,key)
source = self.dbase_.get_source_from_handle(source_handle) text += ' <a href="#sref%s">%s</a>' % (id_, id_)
if source:
hyper = self.source_link(source, uplink = self.up)
text += ' [<a href = %s>%s</a>]' % (hyper, id_)
return text return text
def get_note_format(self, note, link_prefix_up): def get_note_format(self, note, link_prefix_up):
@ -1222,34 +1218,28 @@ class BasePage(object):
tbody += trow tbody += trow
return section return section
def source_link(self, source, cindex = None, uplink = False): def source_link(self, source_handle, source_title, source_gid, cindex = None, uplink = False):
""" """
creates a link to the source object creates a link to the source object
@param: source -- source object from database @param: source -- source object from database
@param: source_title -- title from the source object
@param: source_gid -- gramps id from the source object
@param: cindex - count index @param: cindex - count index
@param: up - rather to add back directories or not? @param: up - rather to add back directories or not?
""" """
url = self.report.build_url_fname_html(source_handle, "src", uplink)
url = self.report.build_url_fname_html(source.get_handle(), "src", uplink) hyper = Html("a", source_title,
gid = source.get_gramps_id()
title = html_escape(source.get_title())
# begin hyperlink
hyper = Html("a", title,
href = url, href = url,
title =_("Source Reference: %s") % title, title = source_title)
inline =True)
# if not None, add name reference to hyperlink element # if not None, add name reference to hyperlink element
if cindex: if cindex:
hyper.attr += ' name ="sref%d"' % cindex hyper.attr += ' name ="sref%d"' % cindex
# add GRAMPS ID # add GRAMPS ID
if not self.noid and gid: if not self.noid and source_gid:
hyper += Html("span", ' [%s]' % gid, class_ = "grampsid", inline = True) hyper += Html("span", ' [%s]' % source_gid, class_ = "grampsid", inline = True)
# return hyperlink to its callers
return hyper return hyper
def display_addr_list(self, addrlist, showsrc): def display_addr_list(self, addrlist, showsrc):
@ -2284,7 +2274,8 @@ class BasePage(object):
# Add this source and its references to the page # Add this source and its references to the page
source = self.dbase_.get_source_from_handle(shandle) source = self.dbase_.get_source_from_handle(shandle)
if source is not None: if source is not None:
list = Html("li", self.source_link(source, cindex, uplink = True)) list = Html("li", self.source_link(source.get_handle(), source.get_title(),
source.get_gramps_id(), cindex, uplink = self.up))
else: else:
list = Html("li", "None") list = Html("li", "None")
@ -4412,14 +4403,15 @@ class SourceListPage(BasePage):
table += tbody table += tbody
for index, key in enumerate(keys): for index, key in enumerate(keys):
source, handle = source_dict[key] source, source_handle = source_dict[key]
trow = Html("tr") + ( trow = Html("tr") + (
Html("td", index + 1, class_ ="ColumnRowLabel", inline =True) Html("td", index + 1, class_ ="ColumnRowLabel", inline =True)
) )
tbody += trow tbody += trow
trow.extend( trow.extend(
Html("td", self.source_link(source, None), class_ ="ColumnName") Html("td", self.source_link(source_handle, source.get_title(),
source.get_gramps_id()), class_ = "ColumnName")
) )
# add clearline for proper styling # add clearline for proper styling
@ -4739,7 +4731,9 @@ class SourcePage(BasePage):
source = self.dbase_.get_source_from_handle(source_handle) source = self.dbase_.get_source_from_handle(source_handle)
if source: if source:
unordered3.extend( unordered3.extend(
Html("li", self.source_link(source, uplink = self.up), inline = True) Html("li", self.source_link(source_handle,
source.get_title(), source.get_gramps_id(),
uplink = self.up), inline = True)
) )
list2 += unordered3 list2 += unordered3
@ -6646,7 +6640,8 @@ class RepositoryPage(BasePage):
source_nbr += 1 source_nbr += 1
if source_handle in source_list: if source_handle in source_list:
source_name = self.source_link(source, uplink = True) source_name = self.source_link(source_handle, source.get_title(),
source.get_gramps_id(), uplink = self.up)
else: else:
source_name = source.get_title() source_name = source.get_title()