0006802: In Narrative Web report most Family Maps are missing. Problem due to single apostrophe (closing single quotation mark) which needs to be escaped.

svn: r23188
This commit is contained in:
Tim G L Lyons 2013-09-24 11:29:51 +00:00
parent 2ad8bb0df2
commit 3e2456b59a

View File

@ -3535,7 +3535,8 @@ class PlacePages(BasePage):
head += jsc head += jsc
# Google adds Latitude/ Longitude to its maps... # Google adds Latitude/ Longitude to its maps...
jsc += google_jsc % (latitude, longitude, placetitle) jsc += google_jsc % (latitude, longitude,
placetitle.replace("'", "\\'"))
else: else:
# OpenStreetMap (OSM) adds Longitude/ Latitude to its maps, # OpenStreetMap (OSM) adds Longitude/ Latitude to its maps,
@ -5503,7 +5504,7 @@ class PersonPages(BasePage):
individualdetail += self.display_ind_associations(assocs) individualdetail += self.display_ind_associations(assocs)
# for use in family map pages... # for use in family map pages...
if len(place_lat_long): if len(place_lat_long) > 0:
if self.report.options["familymappages"]: if self.report.options["familymappages"]:
# save of, string_io and cur_fname before creating a new page # save of, string_io and cur_fname before creating a new page
sof = of sof = of
@ -5638,13 +5639,17 @@ class PersonPages(BasePage):
# are we creating Drop Markers or Markers? # are we creating Drop Markers or Markers?
elif self.googleopts in ["Drop", "Markers"]: elif self.googleopts in ["Drop", "Markers"]:
tracelife += """ tracelife += """
['%s', %s, %s, %d],""" % (placetitle, latitude, longitude, seq_) ['%s', %s, %s, %d],""" % (placetitle.replace("'", "\\'"), latitude, longitude, seq_)
# are we using OpenStreetMap? # are we using OpenStreetMap?
else: else:
tracelife += """ tracelife += """
[%s, %s],""" % (longitude, latitude) [%s, %s],""" % (longitude, latitude)
seq_ += 1 seq_ += 1
# FIXME: The last element in the place_lat_long list is treated
# specially, and the code above is apparently repeated so as to
# avoid a comma at the end, and get the right closing. This is very
# ugly.
latitude, longitude, placetitle, handle ,date, etype = place_lat_long[-1] latitude, longitude, placetitle, handle ,date, etype = place_lat_long[-1]
# are we using Google? # are we using Google?
@ -5660,7 +5665,7 @@ class PersonPages(BasePage):
elif self.googleopts in ["Drop", "Markers"]: elif self.googleopts in ["Drop", "Markers"]:
tracelife += """ tracelife += """
['%s', %s, %s, %d] ['%s', %s, %s, %d]
];""" % (placetitle, latitude, longitude, seq_) ];""" % (placetitle.replace("'", "\\'"), latitude, longitude, seq_)
# are we using OpenStreetMap? # are we using OpenStreetMap?
elif self.mapservice == "OpenStreetMap": elif self.mapservice == "OpenStreetMap":
@ -5699,11 +5704,25 @@ class PersonPages(BasePage):
# are we using Google? # are we using Google?
if self.mapservice == "Google": if self.mapservice == "Google":
jsc += google_jsc % (latitude, longitude, placetitle) # FIXME: Horrible hack, because when there is only a
# single marker, the javascript for place is used,
# which has a 'place_canvas' division, instead of a
# 'map_canvas' division.
jsc += google_jsc.replace("place_canvas",
"map_canvas") % \
(latitude, longitude,
placetitle.replace("'", "\\'"))
# we are using OpenStreetMap? # we are using OpenStreetMap?
else: else:
jsc += openstreetmap_jsc % (xml_lang()[3:5].lower(), longitude, latitude) # FIXME: Horrible hack, because when there is only a
# single marker, the javascript for place is used,
# which has a 'place_canvas' division, instead of a
# 'map_canvas' division.
jsc += openstreetmap_jsc.replace("place_canvas",
"map_canvas") % \
(xml_lang()[3:5].lower(),
longitude, latitude)
# there is more than one marker... # there is more than one marker...
else: else: