Added a flag to get_note_format to set the up variable so that the backend will build_link correctly. This should be refactored, but it at least does the right thing for now.

svn: r15362
This commit is contained in:
Doug Blank 2010-05-08 15:21:11 +00:00
parent 19089b6f51
commit a2c515f5da
2 changed files with 19 additions and 12 deletions

View File

@ -185,7 +185,7 @@ class HtmlBackend(DocBackend):
if self.build_link: if self.build_link:
obj_class, prop, handle = value[9:].split("/", 3) obj_class, prop, handle = value[9:].split("/", 3)
if prop in ["handle", "gramps_id"]: if prop in ["handle", "gramps_id"]:
value = self.build_link(prop, handle, obj_class, up=True) value = self.build_link(prop, handle, obj_class)
if not value: if not value:
return self.STYLETAG_MARKUP[DocBackend.UNDERLINE] return self.STYLETAG_MARKUP[DocBackend.UNDERLINE]
else: else:

View File

@ -388,11 +388,12 @@ class BasePage(object):
# return citation list text to its callers # return citation list text to its callers
return text return text
def get_note_format(self, note): def get_note_format(self, note, link_prefix_up):
""" """
will get the note from the database, and will return either the will get the note from the database, and will return either the
styled text or plain note styled text or plain note
""" """
self.report.link_prefix_up = link_prefix_up
# retrieve the body of the note # retrieve the body of the note
note_text = note.get() note_text = note.get()
@ -462,7 +463,8 @@ class BasePage(object):
Html("i", str(db.get_note_from_handle(notehandle).type)) Html("i", str(db.get_note_from_handle(notehandle).type))
) )
ul.extend( ul.extend(
self.get_note_format(db.get_note_from_handle(notehandle)) self.get_note_format(db.get_note_from_handle(notehandle),
True)
) )
# return note list to its callers # return note list to its callers
@ -939,7 +941,8 @@ class BasePage(object):
footer_note = self.report.options['footernote'] footer_note = self.report.options['footernote']
if footer_note: if footer_note:
note = self.get_note_format( note = self.get_note_format(
db.get_note_from_gramps_id(footer_note) db.get_note_from_gramps_id(footer_note),
False
) )
user_footer = Html("div", id = 'user_footer') user_footer = Html("div", id = 'user_footer')
footer += user_footer footer += user_footer
@ -1057,7 +1060,8 @@ class BasePage(object):
header_note = self.report.options['headernote'] header_note = self.report.options['headernote']
if header_note: if header_note:
note = self.get_note_format( note = self.get_note_format(
self.report.database.get_note_from_gramps_id(header_note) self.report.database.get_note_from_gramps_id(header_note),
False
) )
user_header = Html("div", id = 'user_header') user_header = Html("div", id = 'user_header')
headerdiv += user_header headerdiv += user_header
@ -1477,7 +1481,7 @@ class BasePage(object):
note = db.get_note_from_handle(notehandle) note = db.get_note_from_handle(notehandle)
if note: if note:
note_text = self.get_note_format(note) note_text = self.get_note_format(note, True)
# add section title # add section title
section += Html("h4", _("Narrative"), inline=True) section += Html("h4", _("Narrative"), inline=True)
@ -1636,7 +1640,8 @@ class BasePage(object):
tmp.extend("%s: %s" % tmp.extend("%s: %s" %
(db.get_note_from_handle(handle).type, (db.get_note_from_handle(handle).type,
self.get_note_format( self.get_note_format(
db.get_note_from_handle(handle) db.get_note_from_handle(handle),
True
)) for handle in sref.get_note_list()) )) for handle in sref.get_note_list())
if tmp: if tmp:
@ -3102,7 +3107,7 @@ class IntroductionPage(BasePage):
note_id = report.options['intronote'] note_id = report.options['intronote']
if note_id: if note_id:
note = db.get_note_from_gramps_id(note_id) note = db.get_note_from_gramps_id(note_id)
note_text = self.get_note_format(note) note_text = self.get_note_format(note, False)
# attach note # attach note
section += note_text section += note_text
@ -3139,7 +3144,7 @@ class HomePage(BasePage):
note_id = report.options['homenote'] note_id = report.options['homenote']
if note_id: if note_id:
note = db.get_note_from_gramps_id(note_id) note = db.get_note_from_gramps_id(note_id)
note_text = self.get_note_format(note) note_text = self.get_note_format(note, False)
# attach note # attach note
section += note_text section += note_text
@ -3571,7 +3576,7 @@ class ContactPage(BasePage):
note_id = report.options['contactnote'] note_id = report.options['contactnote']
if note_id: if note_id:
note = db.get_note_from_gramps_id(note_id) note = db.get_note_from_gramps_id(note_id)
note_text = self.get_note_format(note) note_text = self.get_note_format(note, False)
# attach note # attach note
summaryarea += note_text summaryarea += note_text
@ -4040,7 +4045,7 @@ class IndividualPage(BasePage):
for notehandle in notelist: for notehandle in notelist:
note = db.get_note_from_handle(notehandle) note = db.get_note_from_handle(notehandle)
if note: if note:
note_text = self.get_note_format(note) note_text = self.get_note_format(note, True)
# attach note # attach note
unordered += note_text unordered += note_text
@ -4979,6 +4984,7 @@ class NavWebReport(Report):
""" """
Report.__init__(self, database, options) Report.__init__(self, database, options)
menu = options.menu menu = options.menu
self.link_prefix_up = True
self.options = {} self.options = {}
for optname in menu.get_all_option_names(): for optname in menu.get_all_option_names():
@ -5560,7 +5566,7 @@ class NavWebReport(Report):
def build_url_fname_html(self, fname, subdir = None, up = False): def build_url_fname_html(self, fname, subdir = None, up = False):
return self.build_url_fname(fname, subdir, up) + self.ext return self.build_url_fname(fname, subdir, up) + self.ext
def build_link(self, prop, handle, obj_class, up = False): def build_link(self, prop, handle, obj_class):
""" """
Build a link to an item. Build a link to an item.
""" """
@ -5575,6 +5581,7 @@ class NavWebReport(Report):
else: else:
raise AttributeError("invalid gramps_id lookup " raise AttributeError("invalid gramps_id lookup "
"in table name '%s'" % obj_class) "in table name '%s'" % obj_class)
up = self.link_prefix_up
# handle, ppl # handle, ppl
if obj_class == "Person": if obj_class == "Person":
if handle in self.person_handles: if handle in self.person_handles: