From a52ab113f7659ccc3f1a15ea98d25e900c137b29 Mon Sep 17 00:00:00 2001 From: "Rob G. Healey" Date: Tue, 22 Nov 2011 11:18:07 +0000 Subject: [PATCH] Fixed errors created by my last commit# 18480. svn: r18484 --- src/plugins/webreport/NarrativeWeb.py | 101 +++++++++++++------- src/plugins/webstuff/css/narrative-maps.css | 27 ++++-- 2 files changed, 85 insertions(+), 43 deletions(-) diff --git a/src/plugins/webreport/NarrativeWeb.py b/src/plugins/webreport/NarrativeWeb.py index 504fd7742..d6246ab11 100644 --- a/src/plugins/webreport/NarrativeWeb.py +++ b/src/plugins/webreport/NarrativeWeb.py @@ -4874,22 +4874,27 @@ class IndividualPage(BasePage): # create the array, if there are more than one set of coordinates to be displayed? if number_markers > 1: - tracelife = """ + if self.googleopts == "FamilyLinks": + tracelife = """ var tracelife = [""" - titleArray = """ + # place titles Array for place maps... + titleArray = """ var titleArray = [""" - for index in xrange(0, (number_markers - 1)): - dataline = place_lat_long[index] - latitude, longitude, placetitle = dateline[0], dataline[1], dataline[2] - tracelife += """ new google.maps.LatLng(%s, %s),""" % (latitude, longitude) - titleArray += """ ['%s'],""" % placetitle + for index in xrange(0, (number_markers - 1)): + dataline = place_lat_long[index] + latitude, longitude, placetitle = dataline[0], dataline[1], dataline[2] + tracelife += """ + new google.maps.LatLng(%s, %s),""" % (latitude, longitude) + titleArray += """'%s',""" % placetitle - dataline = place_lat_long[-1] - latitude, longitude, placetitle = dataline[0], dataline[1], dataline[2] - tracelife += """ new google.maps.LatLng(%s, %s) ];""" % (latitude, longitude) - titleArray += """ ['%s'] ];""" % placetitle + dataline = place_lat_long[-1] + latitude, longitude, placetitle = dataline[0], dataline[1], dataline[2] + tracelife += """ + new google.maps.LatLng(%s, %s) ];""" % (latitude, longitude) + titleArray += """ + '%s' ];""" % placetitle of = self.report.create_file(person.get_handle(), "maps") self.up = True @@ -4914,18 +4919,19 @@ class IndividualPage(BasePage): src ="http://www.openlayers.org/api/OpenLayers.js", inline =True) # begin inline javascript code - # because jsc is a string, it does NOT have to properly indented + # because jsc is a docstring, it does NOT have to properly indented with Html("script", type ="text/javascript", indent =False) as jsc: + # Google Maps add their javascript inside of the head element... if self.mapservice == "Google": head += jsc # if the number of places is only 1, then use code from imported javascript? if number_markers == 1: - data = place_lat_long[0] - jsc += google_jsc % (data[0], data[1]) + dataline = place_lat_long[0] + latitude, longitude = dataline[0], dataline[1] + jsc += google_jsc % (latitude, longitude) - # Google Maps add their javascript inside of the head element... else: if self.googleopts == "FamilyLinks": jsc += """ @@ -4941,64 +4947,89 @@ class IndividualPage(BasePage): var map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); var flightPath = new google.maps.Polyline({ - path: lifeHistory, + path: %s, strokeColor: "#FF0000", strokeOpacity: 1.0, strokeWeight: 2 }); flightPath.setMap(map); - }""" % (latitude, longitude) + }""" % (midX_, midY_, zoomlevel, lifetrace) # Google Maps Markers only... elif self.googleopts == "Markers": if (not midX_ and not midY_): midX_, midY_ = conv_lat_lon(place_lat_long[0][0], place_lat_long[0][1], "D.D8") + jsc += """ //""" % (latitude, longitude, zoomlevel) + //]]>""" % zoomlevel # there is no need to add an ending "", # as it will be added automatically by libhtml()! + dont = """ +$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ + function setMarkers(map, locations) { + var bounds = new google.maps.LatLngBounds(); + for (var i = 0; i < locations.length; i++) { + var coordinates = locations[i]; + + var myLatLng = new google.maps.LatLng(coordinates[1], coordinates[2]); + var marker = new google.maps.Marker({ + position: myLatLng, + map: map, + title: coordinates[0] + }); + bounds.extend(locations[i]); + map.fitBounds(bounds); + }""" + with Html("div", class_ ="content", id ="FamilyMapDetail") as mapbackground: body += mapbackground diff --git a/src/plugins/webstuff/css/narrative-maps.css b/src/plugins/webstuff/css/narrative-maps.css index fc5e914b6..9daeece59 100644 --- a/src/plugins/webstuff/css/narrative-maps.css +++ b/src/plugins/webstuff/css/narrative-maps.css @@ -21,15 +21,26 @@ # $Id$ # ###################################################### */ - +body#FamilyMap { + background-color: #000; + margin-left: 7px; + margin-right: 7px; + width: 965px; +} div#map_canvas { - margin: 0 auto; - padding: 0px 0px 10px 10px; - border: solid 4px #000; - width: 965px; - height: 800px; + margin-left: 10px; + margin-right: 10px; + border: solid 4px #000; + width: 931px; + height: 800px; } button#drop { - padding: 10px; - border: solid 1px #000; + background-color: purple; + color: #FFF; + font: bold .8em sans-serif; + padding: 10px; + margin-top: 0px; + margin-bottom: 10px; + margin-left: 10px; + border: solid 2px green; }