Added references section to Family Map Page. Adjusted the zoom level, and modified style sheet elements.
svn: r15600
This commit is contained in:
parent
8900ce7f6d
commit
c0d86a8993
@ -22,7 +22,14 @@
|
|||||||
# $Id: $
|
# $Id: $
|
||||||
#
|
#
|
||||||
#
|
#
|
||||||
Mapstraction
|
Maps Division section
|
||||||
|
------------------------------------------------- */
|
||||||
|
div#maps {
|
||||||
|
margin: 0 auto;
|
||||||
|
padding: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Mapstraction
|
||||||
------------------------------------------------- */
|
------------------------------------------------- */
|
||||||
div#mapstraction {
|
div#mapstraction {
|
||||||
height: 580px;
|
height: 580px;
|
||||||
@ -64,23 +71,17 @@ div#googlev3 {
|
|||||||
------------------------------------------------- */
|
------------------------------------------------- */
|
||||||
div#familymap {
|
div#familymap {
|
||||||
background-color: #FFF;
|
background-color: #FFF;
|
||||||
height: 800px;
|
height: 1000px;
|
||||||
width: 965px;
|
width: 965px;
|
||||||
padding: 1% 14px 1% 14px;
|
padding: 0% 14px 0% 14px;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* MiddleSection
|
/* MiddleSection
|
||||||
------------------------------------------------- */
|
------------------------------------------------- */
|
||||||
div#middlesection {
|
div#middlesection {
|
||||||
float: center;
|
float: center;
|
||||||
width: 80%;
|
width: 90%;
|
||||||
margin: 10px 0px 6px 0px;
|
margin: 1% 5% 1% 5%;
|
||||||
padding: 0% 10% 0% 10%;
|
|
||||||
}
|
|
||||||
div#middlesection a {
|
|
||||||
text-align: center;
|
|
||||||
float: center;
|
|
||||||
nargin: 60px;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Family GoogleV3
|
/* Family GoogleV3
|
||||||
|
@ -60,6 +60,7 @@ from textwrap import TextWrapper
|
|||||||
from unicodedata import normalize
|
from unicodedata import normalize
|
||||||
from collections import defaultdict
|
from collections import defaultdict
|
||||||
|
|
||||||
|
import operator
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
# Set up logging
|
# Set up logging
|
||||||
@ -556,11 +557,7 @@ class BasePage(object):
|
|||||||
latitude, longitude = conv_lat_lon( place.lat,
|
latitude, longitude = conv_lat_lon( place.lat,
|
||||||
place.long,
|
place.long,
|
||||||
"D.D8")
|
"D.D8")
|
||||||
|
place_exists(latitude, longitude, place_title)
|
||||||
# add latitude, longitude, and place name
|
|
||||||
data = [latitude, longitude, place_title]
|
|
||||||
if data not in place_lat_long:
|
|
||||||
place_lat_long.append(data)
|
|
||||||
|
|
||||||
# begin event table row
|
# begin event table row
|
||||||
trow = Html("tr")
|
trow = Html("tr")
|
||||||
@ -616,41 +613,34 @@ class BasePage(object):
|
|||||||
# return events table row to its callers
|
# return events table row to its callers
|
||||||
return trow
|
return trow
|
||||||
|
|
||||||
def _get_event_places(self, db, handlelist):
|
def _get_event_places(self, db, person_ref_list):
|
||||||
"""
|
"""
|
||||||
retrieve from a list of people their events, and places of event
|
retrieve from a list of people their events, and places of event
|
||||||
|
|
||||||
@param:db -- report database
|
@param:db -- report database
|
||||||
@param: person handle list
|
@param: person_reference list
|
||||||
"""
|
"""
|
||||||
if not handlelist:
|
|
||||||
return
|
|
||||||
|
|
||||||
global place_lat_long
|
global place_lat_long
|
||||||
|
|
||||||
for handle in handlelist:
|
for person_ref in person_ref_list:
|
||||||
person = db.get_person_from_handle(handle)
|
person = db.get_person_from_handle(person_ref.ref)
|
||||||
if person:
|
|
||||||
|
|
||||||
event_ref_list = person.get_event_ref_list()
|
event_ref_list = person.get_event_ref_list()
|
||||||
for event_ref in event_ref_list:
|
for event_ref in event_ref_list:
|
||||||
event = db.get_event_from_handle(event_ref.ref)
|
event = db.get_event_from_handle(event_ref.ref)
|
||||||
if event:
|
|
||||||
place_handle = event.get_place_handle()
|
place_handle = event.get_place_handle()
|
||||||
|
|
||||||
place = db.get_place_from_handle(place_handle)
|
place = db.get_place_from_handle(place_handle)
|
||||||
if (place and (place.lat and place.long)):
|
if (place and (place.lat and place.long)):
|
||||||
place_title = ReportUtils.place_name(db, place_handle)
|
place_title = ReportUtils.place_name(db, place_handle)
|
||||||
|
|
||||||
# get rellatitude and reallongitude from place object
|
# 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 latitude, longitude, and place name
|
# latitude, longitude, place name
|
||||||
data = [latitude, longitude, place_title]
|
place_exists(latitude, longitude, place_title)
|
||||||
if data not in place_lat_long:
|
|
||||||
place_lat_long.append(data)
|
|
||||||
|
|
||||||
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 """
|
||||||
@ -2027,7 +2017,7 @@ class IndividualListPage(BasePage):
|
|||||||
|
|
||||||
# show surname and first name
|
# show surname and first name
|
||||||
trow += ( Html("th", _("Surname"), class_ = "ColumnSurname", inline = True) +
|
trow += ( Html("th", _("Surname"), class_ = "ColumnSurname", inline = True) +
|
||||||
Html("th", _("First Name|Name"), class_ = "ColumnName", inline = True)
|
Html("th", _("Name"), class_ = "ColumnName", inline = True)
|
||||||
)
|
)
|
||||||
|
|
||||||
if showbirth:
|
if showbirth:
|
||||||
@ -2200,7 +2190,7 @@ class SurnamePage(BasePage):
|
|||||||
thead += trow
|
thead += trow
|
||||||
|
|
||||||
# Name Column
|
# Name Column
|
||||||
trow += Html("th", _("First Name|Name"), class_ = "ColumnName", inline = True)
|
trow += Html("th", _("Name"), class_ = "ColumnName", inline = True)
|
||||||
|
|
||||||
if showbirth:
|
if showbirth:
|
||||||
trow += Html("th", BIRTH, class_ = "ColumnBirth", inline = True)
|
trow += Html("th", BIRTH, class_ = "ColumnBirth", inline = True)
|
||||||
@ -3905,11 +3895,13 @@ class IndividualPage(BasePage):
|
|||||||
@param: person_handle -- used for naming the map file as self.html_dir/maps/ ...
|
@param: person_handle -- used for naming the map file as self.html_dir/maps/ ...
|
||||||
"""
|
"""
|
||||||
global place_lat_long
|
global place_lat_long
|
||||||
|
|
||||||
# if there is no latitude/ longitude data, then return
|
# if there is no latitude/ longitude data, then return
|
||||||
if not place_lat_long:
|
if not place_lat_long:
|
||||||
return
|
return
|
||||||
|
|
||||||
|
# sort place_lat_long by its coordinates and not place name
|
||||||
|
place_lat_long = sorted(place_lat_long, key = operator.itemgetter(0, 1))
|
||||||
|
|
||||||
of = self.report.create_file(person_handle, "maps")
|
of = self.report.create_file(person_handle, "maps")
|
||||||
self.up = True
|
self.up = True
|
||||||
familymappage, head, body = self.write_header(_("Family Map"))
|
familymappage, head, body = self.write_header(_("Family Map"))
|
||||||
@ -3928,9 +3920,13 @@ class IndividualPage(BasePage):
|
|||||||
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)
|
||||||
|
|
||||||
|
# begin maps division
|
||||||
|
with Html("div", class_ = "content", id = "maps") as maps:
|
||||||
|
body += maps
|
||||||
|
|
||||||
# begin familymap division
|
# begin familymap division
|
||||||
with Html("div", id = "familymap") as familymap:
|
with Html("div", id = "familymap") as familymap:
|
||||||
body += familymap
|
maps += familymap
|
||||||
|
|
||||||
# begin middle division
|
# begin middle division
|
||||||
with Html("div", id = "middlesection") as middlesection:
|
with Html("div", id = "middlesection") as middlesection:
|
||||||
@ -3944,6 +3940,10 @@ class IndividualPage(BasePage):
|
|||||||
jsc += """
|
jsc += """
|
||||||
var map;
|
var map;
|
||||||
var latlon;
|
var latlon;
|
||||||
|
var latitude;
|
||||||
|
var longitude;
|
||||||
|
var place_name;
|
||||||
|
var index;
|
||||||
|
|
||||||
function initialize() {
|
function initialize() {
|
||||||
|
|
||||||
@ -3963,19 +3963,23 @@ class IndividualPage(BasePage):
|
|||||||
|
|
||||||
jsc += """
|
jsc += """
|
||||||
// center map and set zoom
|
// center map and set zoom
|
||||||
map.setCenterAndZoom(latlon, 7);
|
map.setCenterAndZoom(latlon, 7);"""
|
||||||
|
index = 0
|
||||||
var marker;"""
|
|
||||||
|
|
||||||
for (latitude, longitude, place_name) in place_lat_long:
|
for (latitude, longitude, place_name) in place_lat_long:
|
||||||
|
j = index + 1
|
||||||
jsc += """
|
jsc += """
|
||||||
latlon = new mxn.LatLonPoint(%s, %s);""" % (latitude, longitude)
|
add_marker(%d, %s, %s, "%s");""" % (j, latitude, longitude, place_name)
|
||||||
|
index += 1
|
||||||
|
jsc += """
|
||||||
|
}
|
||||||
|
|
||||||
jsc += """
|
function add_marker(num, latitude, longitude, place_name) {
|
||||||
|
var marker;
|
||||||
marker = new mxn.Marker(latlon);
|
marker = new mxn.Marker(latlon);
|
||||||
map.addMarker(marker, true);"""
|
marker.setTitle(num.toString());
|
||||||
|
marker.setInfoBubble('div id = "geo-info">' + place_name + '</div>');
|
||||||
|
|
||||||
jsc += """
|
map.addMarker(marker, true);
|
||||||
}"""
|
}"""
|
||||||
# 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!
|
||||||
@ -3983,6 +3987,18 @@ class IndividualPage(BasePage):
|
|||||||
# familygooglev3 division
|
# familygooglev3 division
|
||||||
middlesection += Html("div", id = "familygooglev3", inline = True)
|
middlesection += Html("div", id = "familygooglev3", inline = True)
|
||||||
|
|
||||||
|
# add references division and title
|
||||||
|
with Html("div", class_ = "subsection", id = "References") as section:
|
||||||
|
maps += section
|
||||||
|
section += Html("h4", _("References"), inline = True)
|
||||||
|
|
||||||
|
# begin ordered list
|
||||||
|
ordered = Html("ol")
|
||||||
|
section += ordered
|
||||||
|
|
||||||
|
for (latitude, longitude, place_name) in place_lat_long:
|
||||||
|
ordered += Html("li", place_name, inline = True)
|
||||||
|
|
||||||
# add body onload to initialize map
|
# add body onload to initialize map
|
||||||
body.attr = 'onload = "initialize();"'
|
body.attr = 'onload = "initialize();"'
|
||||||
|
|
||||||
@ -4506,10 +4522,6 @@ class IndividualPage(BasePage):
|
|||||||
tcell1 = Html("td", title, class_ = "ColumnAttribute", inline = True)
|
tcell1 = Html("td", title, class_ = "ColumnAttribute", inline = True)
|
||||||
tcell2 = Html("td", class_ = "ColumnValue")
|
tcell2 = Html("td", class_ = "ColumnValue")
|
||||||
|
|
||||||
# get events and place of event if possible
|
|
||||||
# add to global variable if any
|
|
||||||
self._get_event_places(db, person.handle)
|
|
||||||
|
|
||||||
gid = person.gramps_id
|
gid = person.gramps_id
|
||||||
if handle in self.ind_list:
|
if handle in self.ind_list:
|
||||||
url = self.report.build_url_fname_html(handle, "ppl", True)
|
url = self.report.build_url_fname_html(handle, "ppl", True)
|
||||||
@ -4571,6 +4583,10 @@ class IndividualPage(BasePage):
|
|||||||
else:
|
else:
|
||||||
first = False
|
first = False
|
||||||
|
|
||||||
|
# get child events and places of event if possible
|
||||||
|
# add to global variable if any
|
||||||
|
self._get_event_places(db, child_ref_list)
|
||||||
|
|
||||||
father_handle = family.get_father_handle()
|
father_handle = family.get_father_handle()
|
||||||
if father_handle:
|
if father_handle:
|
||||||
trow = Html("tr")
|
trow = Html("tr")
|
||||||
@ -4591,10 +4607,6 @@ class IndividualPage(BasePage):
|
|||||||
childlist = [child_ref.ref for child_ref in child_ref_list]
|
childlist = [child_ref.ref for child_ref in child_ref_list]
|
||||||
sibling.update(childlist)
|
sibling.update(childlist)
|
||||||
|
|
||||||
# get child events and places of event if possible
|
|
||||||
# add to global variable if any
|
|
||||||
self._get_event_places(db, childlist)
|
|
||||||
|
|
||||||
# now that we have all siblings in families of the person,
|
# now that we have all siblings in families of the person,
|
||||||
# display them...
|
# display them...
|
||||||
if sibling:
|
if sibling:
|
||||||
@ -5187,7 +5199,7 @@ class AddressBookListPage(BasePage):
|
|||||||
Html("th", label, class_="Column" + colclass, inline=True)
|
Html("th", label, class_="Column" + colclass, inline=True)
|
||||||
for (label, colclass) in [
|
for (label, colclass) in [
|
||||||
[" ", "RowLabel"],
|
[" ", "RowLabel"],
|
||||||
[_("First and Last Name|Name"), "Name"],
|
[_("Name"), "Name"],
|
||||||
[_("Address"), "Address"],
|
[_("Address"), "Address"],
|
||||||
[_("Residence"), "Residence"],
|
[_("Residence"), "Residence"],
|
||||||
[_("Web Links"), "WebLinks"] ]
|
[_("Web Links"), "WebLinks"] ]
|
||||||
@ -6837,3 +6849,12 @@ def build_event_data(db, ind_list):
|
|||||||
|
|
||||||
# return event_handle_list and event types to its caller
|
# return event_handle_list and event types to its caller
|
||||||
return event_handle_list, event_types
|
return event_handle_list, event_types
|
||||||
|
|
||||||
|
def place_exists(lat, lon, place_name):
|
||||||
|
""" will determine if place already exists in list or not """
|
||||||
|
|
||||||
|
global place_lat_long
|
||||||
|
|
||||||
|
found = any(p[2] == place_name for p in place_lat_long)
|
||||||
|
if not found:
|
||||||
|
place_lat_long.append([lat, lon, place_name])
|
||||||
|
Loading…
x
Reference in New Issue
Block a user