Completion of Feature Request#5026; Use object instead of iframe. Allow only googlemap or (openstreetmap or wikimapia together). Google map will override openstreetmap and wikimapia.
svn: r17930
This commit is contained in:
@ -1134,7 +1134,7 @@ class BasePage(object):
|
|||||||
const.PROGRAM_NAME, const.VERSION, const.URL_HOMEPAGE)
|
const.PROGRAM_NAME, const.VERSION, const.URL_HOMEPAGE)
|
||||||
|
|
||||||
_META2 = 'name="author" content="%s"' % self.author
|
_META2 = 'name="author" content="%s"' % self.author
|
||||||
_META3 = 'name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no" '
|
_META3 = 'name ="viewport" content ="width=device-width, initial-scale=1.0, user-scalable=yes" '
|
||||||
|
|
||||||
page, head, body = Html.page('%s - %s' %
|
page, head, body = Html.page('%s - %s' %
|
||||||
(html_escape(self.title_str),
|
(html_escape(self.title_str),
|
||||||
@ -2579,56 +2579,54 @@ class PlacePage(BasePage):
|
|||||||
# call_generate_page(report, title, place_handle, src_list, head, body, place, placedetail)
|
# call_generate_page(report, title, place_handle, src_list, head, body, place, placedetail)
|
||||||
|
|
||||||
# add place map here
|
# add place map here
|
||||||
if self.placemappages:
|
if ((self.placemappages or self.openstreetmap or self.wikimapia) and
|
||||||
if ((self.googlemap or self.openstreetmap or self.wikimapia) and
|
(place and (place.lat and place.long) ) ):
|
||||||
(place and (place.lat and place.long) ) ):
|
|
||||||
|
|
||||||
# get reallatitude and reallongitude from place
|
# get reallatitude and reallongitude from place
|
||||||
latitude, longitude = conv_lat_lon( place.lat,
|
latitude, longitude = conv_lat_lon( place.lat,
|
||||||
place.long,
|
place.long,
|
||||||
"D.D8")
|
"D.D8")
|
||||||
|
|
||||||
# add Mapstraction CSS
|
# add Mapstraction CSS
|
||||||
fname = "/".join(["styles", "mapstraction.css"])
|
fname = "/".join(["styles", "mapstraction.css"])
|
||||||
url = self.report.build_url_fname(fname, None, self.up)
|
url = self.report.build_url_fname(fname, None, self.up)
|
||||||
head += Html("link", href = url, type = "text/css", media = "screen", rel = "stylesheet")
|
head += Html("link", href = url, type = "text/css", media = "screen", rel = "stylesheet")
|
||||||
|
|
||||||
# add googlev3 specific javascript code
|
# add googlev3 specific javascript code
|
||||||
if self.googlemap:
|
if (self.googlemap and (not self.openstreetmap and not self.wikimapia) ):
|
||||||
head += Html("script", type ="text/javascript",
|
head += Html("script", type ="text/javascript",
|
||||||
src ="http://maps.googleapis.com/maps/api/js?sensor=false", inline =True)
|
src ="http://maps.googleapis.com/maps/api/js?sensor=false", inline =True)
|
||||||
|
|
||||||
# Place Map division
|
# Place Map division
|
||||||
with Html("div", id = "mapstraction") as mapstraction:
|
with Html("div", id = "mapstraction") as mapstraction:
|
||||||
placedetail += mapstraction
|
placedetail += mapstraction
|
||||||
|
|
||||||
# section title
|
# section title
|
||||||
mapstraction += Html("h4", _("Place Map"), inline = True)
|
mapstraction += Html("h4", _("Place Map"), inline = True)
|
||||||
|
|
||||||
# begin middle division
|
# begin middle division
|
||||||
with Html("div", id = "middle") as middle:
|
with Html("div", id = "middle") as middle:
|
||||||
mapstraction += middle
|
mapstraction += middle
|
||||||
|
|
||||||
if self.openstreetmap:
|
if (self.openstreetmap or self.wikimapia):
|
||||||
url = 'http://www.openstreetmap.com/?lat=%s&lon=%s&zoom=11&layers=M' % (
|
url = 'http://www.openstreetmap.com/?lat=%s&lon=%s&zoom=11&layers=M' % (
|
||||||
latitude, longitude)
|
latitude, longitude)
|
||||||
middle += Html("iframe", src = url, inline = True)
|
middle += Html("object", data = url, inline = True)
|
||||||
|
|
||||||
elif self.wikimapia:
|
url = 'http://wikimapia.org/#lat=%s&lon=%s&z=11&l=0&m=a&v=2' % (
|
||||||
url = 'http://wikimapia.org/#lat=%s&lon=%s&z=11&l=0&m=a&v=2' % (
|
latitude, longitude)
|
||||||
latitude, longitude)
|
middle += Html("object", data = url, inline = True)
|
||||||
middle += Html("iframe", src = url, inline = True)
|
|
||||||
|
|
||||||
else:
|
elif self.googlemap:
|
||||||
# begin inline javascript code
|
# begin inline javascript code
|
||||||
# because jsc is a string, it does NOT have to be properly indented
|
# because jsc is a string, 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
|
head += jsc
|
||||||
|
|
||||||
jsc += """
|
jsc += """
|
||||||
var myLatlng = new google.maps.LatLng(%s, %s);""" % (latitude, longitude)
|
var myLatlng = new google.maps.LatLng(%s, %s);""" % (latitude, longitude)
|
||||||
|
|
||||||
jsc += """
|
jsc += """
|
||||||
var marker;
|
var marker;
|
||||||
var map;
|
var map;
|
||||||
|
|
||||||
@ -2658,11 +2656,8 @@ class PlacePage(BasePage):
|
|||||||
marker.setAnimation(google.maps.Animation.BOUNCE);
|
marker.setAnimation(google.maps.Animation.BOUNCE);
|
||||||
}
|
}
|
||||||
}"""
|
}"""
|
||||||
# there is no need to add an ending "</script>",
|
# there is no need to add an ending "</script>",
|
||||||
# as it will be added automatically!
|
# as it will be added automatically!
|
||||||
|
|
||||||
# add map_canvas division...
|
|
||||||
middle += Html('div', id ='map_canvas')
|
|
||||||
|
|
||||||
# add fullclear for proper styling
|
# add fullclear for proper styling
|
||||||
middle += fullclear
|
middle += fullclear
|
||||||
|
Reference in New Issue
Block a user