Fixed missing OpenStreetMap (OSM) map on Place Pages.

svn: r18573
This commit is contained in:
Rob G. Healey 2011-12-11 05:50:13 +00:00
parent e267ff95d6
commit f1ea8590d8

View File

@ -3228,8 +3228,6 @@ class PlacePage(BasePage):
self.bibli = Bibliography() self.bibli = Bibliography()
db = report.database db = report.database
place = db.get_place_from_handle(place_handle) place = db.get_place_from_handle(place_handle)
# if place exists, but has nothing, return
if not place: if not place:
return None return None
@ -3291,9 +3289,7 @@ class PlacePage(BasePage):
# add place map here # add place map here
if self.placemappages: if self.placemappages:
if (place and (place.lat and place.long)): if (place and (place.lat and place.long)):
latitude, longitude = conv_lat_lon(place.get_latitude(), place.get_longitude(), "D.D8")
# get reallatitude and reallongitude from place
latitude, longitude = conv_lat_lon(place.lat, place.long, "D.D8")
# add narrative-maps CSS... # add narrative-maps CSS...
fname = "/".join(["styles", "narrative-maps.css"]) fname = "/".join(["styles", "narrative-maps.css"])
@ -3318,33 +3314,33 @@ class PlacePage(BasePage):
# begin inline javascript code # begin inline javascript code
# because jsc is a docstring, it does NOT have to be properly indented # because jsc is a docstring, it does NOT have to be properly indented
with Html("script", type = "text/javascript") as jsc: with Html("script", type = "text/javascript") as jsc:
head += jsc
if self.mapservice == "Google": if self.mapservice == "Google":
jsc += google_jsc % (latitude, longitude) head += jsc
else:
# do not need to write on head, load into canvas
jsc += openstreetmap_jsc % (Utils.xml_lang()[3:5].lower(), longitude, latitude)
# there is no need to add an ending "</script>",
# as it will be added automatically!
# add fullclear for proper styling # Google adds Latitude/ Longitude to its maps...
canvas += fullclear jsc += google_jsc % (latitude, longitude)
else:
canvas += jsc
# OpenStreetMap (OSM) adds Longitude/ Latitude to its maps,
# and needs a country code in lowercase letters...
jsc += openstreetmap_jsc % (Utils.xml_lang()[3:5].lower(), longitude, latitude)
# add javascript function call to body element # add javascript function call to body element
if self.mapservice == "Google": body.attr +=' onload ="initialize();" '
body.attr ='onload ="initialize();" '
# source references
srcrefs = self.display_ind_sources(place)
if srcrefs is not None:
placedetail += srcrefs
# place references # place references
reflist = self.display_references(place_list[place.handle]) reflist = self.display_references(place_list[place.handle])
if reflist is not None: if reflist is not None:
placedetail += reflist placedetail += reflist
# source references
srcrefs = self.display_ind_sources(place)
if srcrefs is not None:
placedetail += srcrefs
# add clearline for proper styling # add clearline for proper styling
# add footer section # add footer section
footer = self.write_footer() footer = self.write_footer()