Feature request#5026: Ability to select another map provider than Google on NarrativeWeb report; thank you Jerome Rapinet.

svn: r17925
This commit is contained in:
Rob G. Healey
2011-07-13 22:53:03 +00:00
parent e59edcffb0
commit e2b4233aec

View File

@ -2526,12 +2526,17 @@ class PlacePage(BasePage):
self.up = True
self.page_title = place.get_title()
placepage, head, body = self.write_header(_("Places"))
self.placemappages = self.report.options['placemappages']
self.googlemap = self.report.options['placemappages']
self.openstreetmap = self.report.options['openstreetmap']
self.wikimapia = self.report.options['wikimapia']
# begin PlaceDetail Division
with Html("div", class_ = "content", id = "PlaceDetail") as placedetail:
body += placedetail
if self.create_media:
media_list = place.get_media_list()
thumbnail = self.display_first_image_as_thumbnail(media_list, place)
if thumbnail is not None:
@ -2573,7 +2578,8 @@ class PlacePage(BasePage):
# add place map here
if self.placemappages:
if (place and (place.lat and place.long)):
if ((self.googlemap or self.openstreetmap or self.wikimapia) and
(place and (place.lat and place.long) ) ):
# get reallatitude and reallongitude from place
latitude, longitude = conv_lat_lon( place.lat,
@ -2586,6 +2592,7 @@ class PlacePage(BasePage):
head += Html("link", href = url, type = "text/css", media = "screen", rel = "stylesheet")
# add googlev3 specific javascript code
if self.googlemap:
head += Html("script", type = "text/javascript",
src = "http://maps.google.com/maps/api/js?sensor=false", inline = True)
@ -2605,6 +2612,17 @@ class PlacePage(BasePage):
with Html("div", id = "middle") as middle:
mapstraction += middle
if self.openstreetmap:
url = 'http://www.openstreetmap.com/?lat=%s&lon=%s&zoom=11&layers=M' % (
latitude, longitude)
middle += Html("iframe", src = url, inline = True)
if self.wikimapia:
url = 'http://wikimapia.org/#lat=%s&lon=%s&z=11&l=0&m=a&v=2' % (
latitude, longitude)
middle += Html("iframe", src = url, inline = True)
if self.googlemap:
# begin inline javascript code
# because jsc is a string, it does NOT have to properly indented
with Html("script", type = "text/javascript") as jsc:
@ -3916,6 +3934,7 @@ class IndividualPage(BasePage):
self.up = True
indivdetpage, head, body = self.write_header(self.sort_name)
self.familymappages = self.report.options['familymappages']
self.fgooglemap = self.report.options['familymappages']
# attach the ancestortree style sheet if ancestor graph is being created?
if self.report.options["ancestortree"]:
@ -4097,6 +4116,16 @@ class IndividualPage(BasePage):
url = self.report.build_url_fname(fname, None, self.up)
head += Html("link", href = url, type = "text/css", media = "screen", rel = "stylesheet")
#if self.fopenstreetmap:
#url = 'http://www.openstreetmap.com/?lat=%s&lon=%s&zoom=11&layers=M' % (latitude, longitude)
#middlesection += Html("iframe", src = url, inline = True)
#if self.fwikimapia:
#url = 'http://wikimapia.org/#lat=%s&lon=%s&z=11&l=0&m=a&v=2' % (latitude, longitude)
#middlesection += Html("iframe", src = url, inline = True)
if self.fgooglemap:
# add googlev3 specific javascript code
head += Html("script", type = "text/javascript",
src = "http://maps.google.com/maps/api/js?sensor=false", inline = True)
@ -4106,6 +4135,11 @@ class IndividualPage(BasePage):
url = self.report.build_url_fname(fname, None, self.up)
head += Html("script", src = url, type = "text/javascript", inline = True)
# add mapstraction javascript code
fname = "/".join(["mapstraction", "mxn.js?(googlev3)"])
url = self.report.build_url_fname(fname, None, self.up)
head += Html("script", src = url, type = "text/javascript", inline = True)
# set map dimensions based on span of Y Coordinates
ymap = ""
if spanY in smallset:
@ -4796,6 +4830,10 @@ class IndividualPage(BasePage):
db = self.report.database
self.familymappages = self.report.options['familymappages']
self.fgooglemap = self.report.options['familymappages']
#self.fopenstreetmap = self.report.options['fopenstreetmap']
#self.fwikimapia = self.report.options['fwikimapia']
# begin parents division
with Html("div", class_ = "subsection", id = "parents") as section:
@ -5664,7 +5702,13 @@ class NavWebReport(Report):
# Place Map tab options
self.placemappages = self.options['placemappages']
self.googlemap = self.options['placemappages']
self.openstreetmap = self.options['openstreetmap']
self.wikimapia = self.options['wikimapia']
self.familymappages = self.options['familymappages']
self.fgooglemap = self.options['familymappages']
#self.fopenstreetmap = self.options['fopenstreetmap']
#self.fwikimapia = self.options['fwikimapia']
if self.use_home:
self.index_fname = "index"
@ -6707,19 +6751,46 @@ class NavWebOptions(MenuReportOptions):
category_name = _("Place Maps")
addopt = partial(menu.add_option, category_name)
placemappages = BooleanOption(_("Include Place map on Place Pages"), False)
placemappages.set_help(_("Whether to include a place map on the Place Pages, "
placemappages = BooleanOption(_("Include Place map on Place Pages (Google maps)"), False)
placemappages.set_help(_("Whether to include a Google map on the Place Pages, "
"where Latitude/ Longitude are available."))
addopt( "placemappages", placemappages )
openstreetmap = BooleanOption(_("Include Place map on Place Pages (OpenStreetMap)"), False)
openstreetmap.set_help(_("Whether to include a OpenStreet map on the Place Pages, "
"where Latitude/ Longitude are available."))
addopt( "openstreetmap", openstreetmap )
wikimapia = BooleanOption(_("Include Place map on Place Pages (Wikimapia)"), False)
wikimapia.set_help(_("Whether to include a Wikimapia map on the Place Pages, "
"where Latitude/ Longitude are available."))
addopt( "wikimapia", wikimapia )
familymappages = BooleanOption(_("Include Individual Page Map with "
"all places shown on map"), False)
familymappages.set_help(_("Whether or not to add an individual page map "
"all places shown on map (Google Maps)"), False)
familymappages.set_help(_("Whether or not to add an individual Google map "
"showing all the places on this page. "
"This will allow you to see how your family "
"traveled around the country."))
addopt( "familymappages", familymappages )
#fopenstreetmap = BooleanOption(_("Include Individual Page Map with "
#"all places shown on map (OpenStreetMap)"), False)
#fopenstreetmap.set_help(_("Whether or not to add an individual OpenStreet map "
#"showing all the places on this page. "
#"This will allow you to see how your family "
#"traveled around the country."))
#addopt( "fopenstreetmap", fopenstreetmap )
#fwikimapia = BooleanOption(_("Include Individual Page Map with "
#"all places shown on map (Wikimapia)"), False)
#fwikimapia.set_help(_("Whether or not to add an individual Wikimapia map "
#"showing all the places on this page. "
#"This will allow you to see how your family "
#"traveled around the country."))
#addopt( "fwikimapia", fwikimapia )
def __archive_changed(self):
"""
Update the change of storage: archive or directory