NarrativeWeb: Refinements in creating family maps. Changes in style sheets to match work.
svn: r15647
This commit is contained in:
parent
fe1d68c475
commit
46ee43539f
@ -25,15 +25,17 @@
|
|||||||
Body element
|
Body element
|
||||||
------------------------------------------------- */
|
------------------------------------------------- */
|
||||||
body#FamilyMap {
|
body#FamilyMap {
|
||||||
background-color: #FFF;
|
background-color: #000;
|
||||||
color: #000;
|
color: #000;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
width: 965px;
|
width: 1060px;
|
||||||
padding: 0px 14px 0px 14px;
|
padding: 0px 4px 0px 4px;
|
||||||
}
|
}
|
||||||
body#FamilyMap a {
|
|
||||||
text-decoration: none;
|
/* References
|
||||||
color: #000;
|
------------------------------------------------- */
|
||||||
|
div#References {
|
||||||
|
background-color: #FFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Mapstraction
|
/* Mapstraction
|
||||||
@ -51,12 +53,6 @@ div#middle {
|
|||||||
width: 90%;
|
width: 90%;
|
||||||
margin: 10px 2% 10px 2%;
|
margin: 10px 2% 10px 2%;
|
||||||
}
|
}
|
||||||
div#middle div#location {
|
|
||||||
margin-top: 10px;
|
|
||||||
font: normal 12px sans-serif;
|
|
||||||
text-align: center;
|
|
||||||
width: 80%;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* geo-info Bubble
|
/* geo-info Bubble
|
||||||
------------------------------------------------- */
|
------------------------------------------------- */
|
||||||
@ -74,15 +70,7 @@ div#googlev3 {
|
|||||||
|
|
||||||
/* **************************************************************************************
|
/* **************************************************************************************
|
||||||
|
|
||||||
Individual Family Map
|
MiddleSection
|
||||||
------------------------------------------------- */
|
|
||||||
div#familymap {
|
|
||||||
height: 1000px;
|
|
||||||
width: 90%;
|
|
||||||
margin: 2% 5% 2% 5%;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* MiddleSection
|
|
||||||
------------------------------------------------- */
|
------------------------------------------------- */
|
||||||
div#middlesection {
|
div#middlesection {
|
||||||
float: center;
|
float: center;
|
||||||
@ -93,5 +81,12 @@ div#middlesection {
|
|||||||
div#familygooglev3 {
|
div#familygooglev3 {
|
||||||
height: 100%;
|
height: 100%;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border: double 2px #000;
|
border: double 4px #000;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Footer
|
||||||
|
------------------------------------------------- */
|
||||||
|
div#footer a {
|
||||||
|
text-decoration: none;
|
||||||
|
color: #FFF;
|
||||||
}
|
}
|
||||||
|
@ -116,9 +116,8 @@ img {
|
|||||||
background-color: #FFF;
|
background-color: #FFF;
|
||||||
color: #000;
|
color: #000;
|
||||||
overflow: auto;
|
overflow: auto;
|
||||||
width: 965px;
|
width: 1060px;
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
padding-bottom: .2em;
|
|
||||||
}
|
}
|
||||||
.content div.snapshot {
|
.content div.snapshot {
|
||||||
margin: 0;
|
margin: 0;
|
||||||
@ -544,6 +543,9 @@ div#Places table.infolist tbody tr td.ColumnLongitude {
|
|||||||
div#PlaceDetail table.infolist tbody tr td {
|
div#PlaceDetail table.infolist tbody tr td {
|
||||||
border-bottom: dashed 1px #000;
|
border-bottom: dashed 1px #000;
|
||||||
}
|
}
|
||||||
|
div#PlaceDetail div#References a {
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
#div#PlaceDetail table.infolist tbody tr td.ColumnAttribute,
|
#div#PlaceDetail table.infolist tbody tr td.ColumnAttribute,
|
||||||
div#PlaceDetail table.infolist tbody tr td.ColumnValue {
|
div#PlaceDetail table.infolist tbody tr td.ColumnValue {
|
||||||
color: #000;
|
color: #000;
|
||||||
|
@ -31,8 +31,8 @@ Style Name: Web_Navigation-Horizontal Stylesheet
|
|||||||
----------------------------------------------------- */
|
----------------------------------------------------- */
|
||||||
body {
|
body {
|
||||||
margin: 0 auto;
|
margin: 0 auto;
|
||||||
padding: 0px 14px 0px 14px;
|
padding: 0px 4px 0px 4px;
|
||||||
width: 965px;
|
width: 1060px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* lphabet Navigation
|
/* lphabet Navigation
|
||||||
|
@ -61,6 +61,7 @@ from unicodedata import normalize
|
|||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
import operator
|
import operator
|
||||||
|
from decimal import Decimal
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Set up logging
|
# Set up logging
|
||||||
@ -146,6 +147,7 @@ ALTERNATE_LOCATIONS = _("Alternate Locations")
|
|||||||
# initialize global variable
|
# initialize global variable
|
||||||
place_lat_long = []
|
place_lat_long = []
|
||||||
_individuallist = set()
|
_individuallist = set()
|
||||||
|
place_handle_list = set()
|
||||||
|
|
||||||
# Events that are usually a family event
|
# Events that are usually a family event
|
||||||
_EVENTMAP = [ gen.lib.EventType.MARRIAGE, gen.lib.EventType.MARR_ALT,
|
_EVENTMAP = [ gen.lib.EventType.MARRIAGE, gen.lib.EventType.MARR_ALT,
|
||||||
@ -545,7 +547,7 @@ class BasePage(object):
|
|||||||
self.place_list[place_handle] = [lnk]
|
self.place_list[place_handle] = [lnk]
|
||||||
|
|
||||||
place = db.get_place_from_handle(place_handle)
|
place = db.get_place_from_handle(place_handle)
|
||||||
self._append_to_place_lat_long(place)
|
self._append_to_place_lat_long(place, event)
|
||||||
|
|
||||||
# begin event table row
|
# begin event table row
|
||||||
trow = Html("tr")
|
trow = Html("tr")
|
||||||
@ -601,9 +603,12 @@ class BasePage(object):
|
|||||||
# return events table row to its callers
|
# return events table row to its callers
|
||||||
return trow
|
return trow
|
||||||
|
|
||||||
def _append_to_place_lat_long(self, place):
|
def _append_to_place_lat_long(self, place, event):
|
||||||
"""
|
"""
|
||||||
Create a list of places with coordinates.
|
Create a list of places with coordinates.
|
||||||
|
|
||||||
|
@param: place -- place object from database
|
||||||
|
@param: event -- event object from database
|
||||||
"""
|
"""
|
||||||
if not place:
|
if not place:
|
||||||
return
|
return
|
||||||
@ -622,8 +627,9 @@ class BasePage(object):
|
|||||||
place.long,
|
place.long,
|
||||||
"D.D8")
|
"D.D8")
|
||||||
|
|
||||||
place_lat_long.append([ latitude, longitude,
|
date = event.get_date_object()
|
||||||
placetitle, place.handle ])
|
place_lat_long.append([latitude, longitude,
|
||||||
|
placetitle, place.handle, date])
|
||||||
|
|
||||||
def _get_event_place(self, person):
|
def _get_event_place(self, person):
|
||||||
"""
|
"""
|
||||||
@ -644,7 +650,7 @@ class BasePage(object):
|
|||||||
if place_handle:
|
if place_handle:
|
||||||
|
|
||||||
place = db.get_place_from_handle(place_handle)
|
place = db.get_place_from_handle(place_handle)
|
||||||
self._append_to_place_lat_long(place)
|
self._append_to_place_lat_long(place, event)
|
||||||
|
|
||||||
def event_link(self, eventtype, handle, gid = None, up = False):
|
def event_link(self, eventtype, handle, gid = None, up = False):
|
||||||
""" creates a hyperlink for an event based on its type """
|
""" creates a hyperlink for an event based on its type """
|
||||||
@ -1864,14 +1870,21 @@ class BasePage(object):
|
|||||||
return hyper
|
return hyper
|
||||||
|
|
||||||
def place_link(self, handle, name, gid = None, up = False):
|
def place_link(self, handle, name, gid = None, up = False):
|
||||||
url = self.report.build_url_fname_html(handle, "plc", up)
|
|
||||||
|
|
||||||
hyper = Html("a", html_escape(name), href = url, title = name)
|
global place_handle_list
|
||||||
if not self.noid and gid:
|
found = any(handle == place_handle for place_handle in place_handle_list)
|
||||||
hyper += Html("span", " [%s]" % gid, class_ = "grampsid", inline = True)
|
if found:
|
||||||
|
url = self.report.build_url_fname_html(handle, "plc", up)
|
||||||
|
|
||||||
# return hyperlink to its callers
|
hyper = Html("a", html_escape(name), href = url, title = name)
|
||||||
return hyper
|
if not self.noid and gid:
|
||||||
|
hyper += Html("span", " [%s]" % gid, class_ = "grampsid", inline = True)
|
||||||
|
|
||||||
|
# return hyperlink to its callers
|
||||||
|
return hyper
|
||||||
|
|
||||||
|
else:
|
||||||
|
return name
|
||||||
|
|
||||||
def dump_place(self, place, table):
|
def dump_place(self, place, table):
|
||||||
"""
|
"""
|
||||||
@ -3893,17 +3906,20 @@ class IndividualPage(BasePage):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# sort on X coordinates to get min and max X GPS Coordinates
|
# sort on X coordinates to get min and max X GPS Coordinates
|
||||||
place_lat_long = sorted(place_lat_long, key = operator.itemgetter(0, 1, 2, 3))
|
place_lat_long = sorted(place_lat_long, key = operator.itemgetter(0, 1, 2))
|
||||||
BoundMinX = place_lat_long[0][0]
|
BoundMinX = place_lat_long[0][0]
|
||||||
BoundMaxX = place_lat_long[-1][0]
|
BoundMaxX = place_lat_long[-1][0]
|
||||||
|
|
||||||
# sort on Y coordinates to get min and max Y GPS Coordinates
|
# sort on Y coordinates to get min and max Y GPS Coordinates
|
||||||
place_lat_long = sorted(place_lat_long, key = operator.itemgetter(1, 0, 2, 3))
|
place_lat_long = sorted(place_lat_long, key = operator.itemgetter(1, 0, 2))
|
||||||
BoundMinY = place_lat_long[0][1]
|
BoundMinY = place_lat_long[0][1]
|
||||||
BoundMaxY = place_lat_long[-1][1]
|
BoundMaxY = place_lat_long[-1][1]
|
||||||
|
MinYint = int(Decimal(BoundMinY))
|
||||||
|
MaxYint = int(Decimal(BoundMaxY))
|
||||||
|
spanY = (MaxYint - MinYint)
|
||||||
|
|
||||||
# sort place_lat_long based on place_title for placement on map and references
|
# sort place_lat_long based on chronological date order
|
||||||
place_lat_long = sorted(place_lat_long, key = operator.itemgetter(2, 0, 1, 3))
|
place_lat_long = sorted(place_lat_long, key = operator.itemgetter(4, 2, 0))
|
||||||
|
|
||||||
of = self.report.create_file(person_handle, "maps")
|
of = self.report.create_file(person_handle, "maps")
|
||||||
self.up = True
|
self.up = True
|
||||||
@ -3916,89 +3932,117 @@ class IndividualPage(BasePage):
|
|||||||
|
|
||||||
# add googlev3 specific javascript code
|
# add googlev3 specific javascript code
|
||||||
head += Html("script", type = "text/javascript",
|
head += Html("script", type = "text/javascript",
|
||||||
src = "http://maps.google.com/maps/api/js?sensor=false", inline = True)
|
src = "http://maps.google.com/maps/api/js?sensor=true", inline = True)
|
||||||
|
|
||||||
# add mapstraction javascript code
|
# add mapstraction javascript code
|
||||||
fname = "/".join(["mapstraction", "mxn.js?(googlev3)"])
|
fname = "/".join(["mapstraction", "mxn.js?(googlev3)"])
|
||||||
url = self.report.build_url_fname(fname, None, self.up)
|
url = self.report.build_url_fname(fname, None, self.up)
|
||||||
head += Html("script", src = url, inline = True)
|
head += Html("script", src = url, inline = True)
|
||||||
|
|
||||||
|
# set map dimensions based on width of Y Coordinates
|
||||||
|
if (-20 <= spanY > -1) or (20 <= spanY > 1):
|
||||||
|
head += """
|
||||||
|
<script type = "text/css">
|
||||||
|
div#mapbody {
|
||||||
|
height: 600px;
|
||||||
|
width: 500px;
|
||||||
|
margin: 0% 2% 2% 2%;
|
||||||
|
}
|
||||||
|
</script>"""
|
||||||
|
else:
|
||||||
|
head += """
|
||||||
|
<script type = "text/css">
|
||||||
|
div#mapbody {
|
||||||
|
height: 1100px;
|
||||||
|
width: 1400px;
|
||||||
|
margin: 0% 2% 2% 2%;
|
||||||
|
}
|
||||||
|
</script>"""
|
||||||
|
|
||||||
# begin familymap division
|
# begin familymap division
|
||||||
with Html("div", id = "familymap") as familymap:
|
with Html("div", class_ = "content", id = "mapbody") as mapbody:
|
||||||
body += familymap
|
body += mapbody
|
||||||
|
|
||||||
|
# page message
|
||||||
|
msg = _("The place markers on this page represent a differemt location "
|
||||||
|
"based upon your spouse, your children (if any), and your personal "
|
||||||
|
"events and their places. The list has been sorted in chronological "
|
||||||
|
"order. The markers are numbered as you move your mouse pointer over "
|
||||||
|
"them and matching the same in References section below. Clicking "
|
||||||
|
"on the place’s name will take you to that place’s page.")
|
||||||
|
mapbody += Html("p", msg, id = "description")
|
||||||
|
|
||||||
# begin middle section division
|
# begin middle section division
|
||||||
with Html("div", id = "middlesection") as middlesection:
|
with Html("div", id = "middlesection") as middlesection:
|
||||||
familymap += middlesection
|
mapbody += middlesection
|
||||||
|
|
||||||
# begin inline javascript code
|
# begin inline javascript code
|
||||||
# because jsc is a string, it does NOT have to properly indented
|
# because jsc is a string, it does NOT have to properly indented
|
||||||
with Html("script", type = "text/javascript") as jsc:
|
with Html("script", type = "text/javascript") as jsc:
|
||||||
middlesection += jsc
|
middlesection += jsc
|
||||||
|
|
||||||
jsc += """
|
jsc += """
|
||||||
var map;
|
var map;
|
||||||
var latlon;
|
var latlon;
|
||||||
|
var coordinates = []
|
||||||
|
|
||||||
function initialize() {
|
function initialize() {
|
||||||
|
|
||||||
// create map object
|
// create map object
|
||||||
map = new mxn.Mapstraction('familygooglev3', 'googlev3');
|
map = new mxn.Mapstraction('familygooglev3', 'googlev3');
|
||||||
|
|
||||||
// add map controls to image
|
// add map controls to image
|
||||||
map.addControls({
|
map.addControls({
|
||||||
pan: true,
|
pan: true,
|
||||||
zoom: 'large',
|
zoom: 'large',
|
||||||
scale: true,
|
scale: true,
|
||||||
disableDoubleClickZoom: true,
|
disableDoubleClickZoom: true,
|
||||||
keyboardShortcuts: true,
|
keyboardShortcuts: true,
|
||||||
scrollwheel: false,
|
scrollwheel: false,
|
||||||
map_type: true
|
map_type: true
|
||||||
});"""
|
});"""
|
||||||
|
|
||||||
index = 0
|
index = 0
|
||||||
for (lat, long, placename, handle) in place_lat_long:
|
for (lat, long, p, h, d) in place_lat_long:
|
||||||
j = index + 1
|
j = index + 1
|
||||||
|
|
||||||
jsc += """
|
jsc += """
|
||||||
// Place name: %s
|
// Place name: %s
|
||||||
add_marker(%d, %s, %s);""" % ( placename,
|
add_marker(%d, %s, %s);""" % ( p, j, lat, long )
|
||||||
j, lat, long )
|
|
||||||
index += 1
|
index += 1
|
||||||
jsc += """
|
jsc += """
|
||||||
}"""
|
}"""
|
||||||
|
|
||||||
if len(place_lat_long) > 6:
|
if len(place_lat_long) > 6:
|
||||||
jsc += """
|
jsc += """
|
||||||
// boundary southWest equals bottom left GPS Coordinates
|
// boundary southWest equals bottom left GPS Coordinates
|
||||||
var southWest = new mxn.LatLonPoint(%s, %s);""" % (BoundMaxX, BoundMaxY)
|
var southWest = new mxn.LatLonPoint(%s, %s);""" % (BoundMinX, BoundMinY)
|
||||||
jsc += """
|
jsc += """
|
||||||
// boundary northEast equals top right GPS Coordinates
|
// boundary northEast equals top right GPS Coordinates
|
||||||
var northEast = new mxn.LatLonPoint(%s, %s);""" % (BoundMinX, BoundMinY)
|
var northEast = new mxn.LatLonPoint(%s, %s);""" % (BoundMaxX, BoundMaxY)
|
||||||
jsc += """
|
jsc += """
|
||||||
var bounds = new google.maps.LatLngBounds(southWest, northEast);
|
var bounds = new google.maps.LatLngBounds(southWest, northEast);
|
||||||
map.fitBounds(bounds);"""
|
map.fitBounds(bounds);"""
|
||||||
|
|
||||||
jsc += """
|
jsc += """
|
||||||
function add_marker(num, latitude, longitude) {
|
function add_marker(num, latitude, longitude) {
|
||||||
|
|
||||||
var marker;
|
var marker;
|
||||||
|
|
||||||
// create latitude/ longitude point for marker
|
// create latitude/ longitude point for marker
|
||||||
latlon = new mxn.LatLonPoint(latitude, longitude);
|
latlon = new mxn.LatLonPoint(latitude, longitude);
|
||||||
|
|
||||||
// create marker
|
// create marker
|
||||||
marker = new mxn.Marker(latlon);
|
marker = new mxn.Marker(latlon);
|
||||||
|
|
||||||
// add number to individual markers
|
// add number to individual markers
|
||||||
marker.setLabel(num.toString());
|
marker.setLabel(num.toString());
|
||||||
|
|
||||||
// set map center and zoom to each marker
|
// add marker to map
|
||||||
map.setCenterAndZoom(latlon, 7);
|
map.addMarker(marker, true);
|
||||||
|
|
||||||
// add marker to map
|
// set Center and Zoom
|
||||||
map.addMarker(marker, true);
|
map.setCenterAndZoom(latlon, 6);
|
||||||
|
}"""
|
||||||
}"""
|
|
||||||
# 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!
|
||||||
|
|
||||||
@ -4017,12 +4061,19 @@ class IndividualPage(BasePage):
|
|||||||
ordered = Html("ol")
|
ordered = Html("ol")
|
||||||
section += ordered
|
section += ordered
|
||||||
|
|
||||||
for (lat, long, name, handle) in place_lat_long:
|
# 0 = latitude, 1 = longitude, 2 = place title, 3 = handle, 4 = date
|
||||||
|
for (lat, long, pname, handle, date) in place_lat_long:
|
||||||
|
|
||||||
ordered.extend(
|
list = Html("li", self.place_link(handle, pname, up = True))
|
||||||
Html("li", self.place_link(handle, name, up = True))
|
ordered += list
|
||||||
)
|
|
||||||
|
|
||||||
|
if date:
|
||||||
|
ordered1 = Html("ol")
|
||||||
|
list += ordered1
|
||||||
|
|
||||||
|
list1 = Html("li", _dd.display(date), inline = True)
|
||||||
|
ordered1 += list1
|
||||||
|
|
||||||
# add body onload to initialize map
|
# add body onload to initialize map
|
||||||
body.attr = 'onload = "initialize();" id = "FamilyMap"'
|
body.attr = 'onload = "initialize();" id = "FamilyMap"'
|
||||||
|
|
||||||
@ -5470,6 +5521,8 @@ class NavWebReport(Report):
|
|||||||
|
|
||||||
def write_report(self):
|
def write_report(self):
|
||||||
global _individuallist
|
global _individuallist
|
||||||
|
global place_handle_list
|
||||||
|
|
||||||
_WRONGMEDIAPATH = []
|
_WRONGMEDIAPATH = []
|
||||||
if not self.use_archive:
|
if not self.use_archive:
|
||||||
dir_name = self.target_path
|
dir_name = self.target_path
|
||||||
@ -5528,6 +5581,10 @@ class NavWebReport(Report):
|
|||||||
for handle in ind_list:
|
for handle in ind_list:
|
||||||
_individuallist.add(handle)
|
_individuallist.add(handle)
|
||||||
|
|
||||||
|
# create place_handle_list for use in place_link()
|
||||||
|
for handle in self.database.get_place_handles():
|
||||||
|
place_handle_list.add(handle)
|
||||||
|
|
||||||
# copy all of the neccessary files
|
# copy all of the neccessary files
|
||||||
self.copy_narrated_files()
|
self.copy_narrated_files()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user