Fix bug in Narrative Web source page. Small performance enhancements in display_source_refs.

svn: r13626
This commit is contained in:
Gerald Britton 2009-11-18 18:41:53 +00:00
parent c495226344
commit 50029fbb16

View File

@ -1375,9 +1375,12 @@ class BasePage(object):
# Add this source and its references to the page # Add this source and its references to the page
source = db.get_source_from_handle(shandle) source = db.get_source_from_handle(shandle)
title = source.get_title() title = source.get_title()
list = Html("li", inline = True) + ( list = Html("li") + (
Html("a", self.source_link(source.handle, title, source.gramps_id, True), Html("a",
name = "sref%d" % cindex) self.source_link(source.handle, title, source.gramps_id,
up=True),
name="sref%d" % cindex,
inline=True)
) )
ordered += list ordered += list
@ -1389,23 +1392,27 @@ class BasePage(object):
confidence = Utils.confidence.get(sref.confidence, _('Unknown')) confidence = Utils.confidence.get(sref.confidence, _('Unknown'))
if confidence == _('Normal'): if confidence == _('Normal'):
confidence = None confidence = None
for (label, data) in [(DHEAD, format_date(sref.date)),
(_PAGE, sref.page),
(_CONFIDENCE, confidence)]:
if data:
tmp.append("%s: %s" % (label, data))
notelist = sref.get_note_list() tmp.extend("%s: %s" % (label, data)
for notehandle in notelist: for (label, data) in [(DHEAD, format_date(sref.date)),
note = db.get_note_from_handle(notehandle) (_PAGE, sref.page),
note_text = self.get_note_format(note) (_CONFIDENCE, confidence)]
tmp.append("%s: %s" % (_TEXT, note_text)) if data)
if len(tmp):
list1 = Html("li", inline = True) + ( tmp.extend(_TEXT + ': ' +
Html("a", ';   '.join(tmp), name = "sref%d%s" % (cindex, key)) self.get_note_format(
db.get_note_from_handle(handle)
) for handle in sref.get_note_list())
if tmp:
list1 = Html("li", inline=True) + (
Html("a", ';   '.join(tmp),
name = "sref%d%s" % (cindex, key))
) )
ordered1 += list1 ordered1 += list1
list += ordered1 if citation_ref_list:
list += ordered1
ordered += list ordered += list
section += ordered section += ordered
@ -2987,9 +2994,11 @@ class SourceListPage(BasePage):
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 += Html("td", self.source_link(handle, "", source.get_title(), source.gramps_id), trow += Html("td",
class_ = "ColumnName") self.source_link(handle, source.get_title(),
source.gramps_id),
class_ = "ColumnName")
# add clearline for proper styling # add clearline for proper styling
# add footer section # add footer section
@ -5497,7 +5506,7 @@ 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 ( Utils.win ): if Utils.win():
fname = fname.replace('\\',"/") fname = fname.replace('\\',"/")
subdirs = self.build_subdirs(subdir, fname, up) subdirs = self.build_subdirs(subdir, fname, up)
return "/".join(subdirs + [fname]) return "/".join(subdirs + [fname])