Committing changes only for the purpose of getting help.

svn: r18640
This commit is contained in:
Rob G. Healey 2011-12-20 09:17:00 +00:00
parent 4b5c061554
commit 54b3aea146
3 changed files with 246 additions and 150 deletions

View File

@ -96,8 +96,7 @@ import gen.mime
from gen.display.name import displayer as _nd from gen.display.name import displayer as _nd
from DateHandler import displayer as _dd from DateHandler import displayer as _dd
from gen.proxy import PrivateProxyDb, LivingProxyDb from gen.proxy import PrivateProxyDb, LivingProxyDb
from libhtmlconst import (_CHARACTER_SETS, _CC, _COPY_OPTIONS, from libhtmlconst import _CHARACTER_SETS, _CC, _COPY_OPTIONS
openstreetmap_jsc, google_jsc)
# import HTML Class from src/plugins/lib/libhtml.py # import HTML Class from src/plugins/lib/libhtml.py
from libhtml import Html from libhtml import Html
@ -112,6 +111,29 @@ from gui.pluginmanager import GuiPluginManager
#------------------------------------------------ #------------------------------------------------
# constants # constants
#------------------------------------------------ #------------------------------------------------
# javascript code for Google single Marker...
google_jsc = """
var map;
function initialize() {
var mapOptions = {
scaleControl: true,
panControl: true,
backgroundColor: '#000000',
zoom: 14,
center: new google.maps.LatLng(0, 0),
mapTypeId: google.maps.MapTypeId.ROADMAP
}
map = new google.maps.Map(document.getElementById("place_canvas"), mapOptions);
var marker = new google.maps.Marker({
position: new google.maps.LatLng(%s, %s),
draggable: true,
map: map,
title: %s
});
google.maps.event.addDomListener(window, 'load', initialize);
}"""
# javascript code for Google's FamilyLinks... # javascript code for Google's FamilyLinks...
familylinks = """ familylinks = """
@ -231,6 +253,29 @@ canada_map = """
map.addLayers([wms, dm_wms]); map.addLayers([wms, dm_wms]);
""" """
# javascript code for OpenStreetMap single marker
openstreetmap_jsc = """
OpenLayers.Lang.setCode("%s");
function initialize(){
var map = new OpenLayers.Map('place_canvas');
var wms = new OpenLayers.Layer.WMS(
"OpenLayers WMS",
"http://vmap0.tiles.osgeo.org/wms/vmap0",
{'layers':'basic'});
map.addLayer(wms);
map.setCenter(new OpenLayers.LonLat(0, 0), 0);
var markers = new OpenLayers.Layer.Markers("Markers");
map.addLayer(markers);
marker = new OpenLayers.Marker(new OpenLayers.LonLat(%s, %s);
markers.addMarker(marker);
map.addControl(new OpenLayers.Control.LayerSwitcher());
}"""
# javascript for OpenStreetMap's markers... # javascript for OpenStreetMap's markers...
osm_markers = """ osm_markers = """
OpenLayers.Lang.setCode("%s"); OpenLayers.Lang.setCode("%s");
@ -1997,8 +2042,7 @@ class BasePage(object):
if bibli.get_citation_count() == 0: if bibli.get_citation_count() == 0:
return None return None
db = self.report.database with Html("div", class_ = "subsection", id = "sourcerefs") as section:
with Html("div", id = "sourcerefs", class_ = "subsection") as section:
section += Html("h4", _("Source References"), inline = True) section += Html("h4", _("Source References"), inline = True)
ordered = Html("ol") ordered = Html("ol")
@ -2033,7 +2077,8 @@ class BasePage(object):
confidence = Utils.confidence.get(sref.confidence, _('Unknown')) confidence = Utils.confidence.get(sref.confidence, _('Unknown'))
if confidence == _('Normal'): if confidence == _('Normal'):
confidence = None confidence = None
for (label, data) in [[DHEAD, _dd.display(sref.date)], for (label, data) in [
[_("Date"), _dd.display(sref.date)],
[_("Page"), sref.page], [_("Page"), sref.page],
[_("Confidence"), confidence] ]: [_("Confidence"), confidence] ]:
if data: if data:
@ -3253,11 +3298,11 @@ class PlacePage(BasePage):
# add MapService specific javascript code # add MapService specific javascript code
if self.mapservice == "Google": if self.mapservice == "Google":
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)
else: else:
head += Html("script", type ="text/javascript", head += Html("script", type = "text/javascript",
src ="http://www.openlayers.org/api/OpenLayers.js", inline =True) src = "http://www.openlayers.org/api/OpenLayers.js", inline = True)
# section title # section title
placedetail += Html("h4", _("Place Map"), inline =True) placedetail += Html("h4", _("Place Map"), inline =True)
@ -3274,7 +3319,7 @@ class PlacePage(BasePage):
head += jsc head += jsc
# Google adds Latitude/ Longitude to its maps... # Google adds Latitude/ Longitude to its maps...
jsc += google_jsc % (latitude, longitude) jsc += google_jsc % (latitude, longitude, place.get_title())
else: else:
canvas += jsc canvas += jsc
@ -3284,7 +3329,10 @@ class PlacePage(BasePage):
jsc += openstreetmap_jsc % (Utils.xml_lang()[3:5].lower(), longitude, latitude) jsc += openstreetmap_jsc % (Utils.xml_lang()[3:5].lower(), longitude, latitude)
# add javascript function call to body element # add javascript function call to body element
body.attr +=' onload ="initialize();" ' if self.mapservice == "Google":
pass
else:
body.attr +=' onload ="initialize();" '
# place references # place references
reflist = self.display_references(place_list[place.handle]) reflist = self.display_references(place_list[place.handle])
@ -4202,16 +4250,15 @@ class SourcePage(BasePage):
if not self.noid and self.gid: if not self.noid and self.gid:
source_gid = source.get_gramps_id() source_gid = source.get_gramps_id()
for (label, val) in [ for (label, value) in [
(_("Gramps ID"), source_gid), (_("Gramps ID"), source_gid),
(_("Author"), source.author), (_("Author"), source.author),
(_("Publication information"), source.pubinfo), (_("Publication information"), source.pubinfo),
(_("Abbreviation"), source.abbrev) ]: (_("Abbreviation"), source.abbrev) ]:
if value:
if val:
trow = Html("tr") + ( trow = Html("tr") + (
Html("td", label, class_ = "ColumnAttribute", inline = True), Html("td", label, class_ = "ColumnAttribute", inline = True),
Html("td", val, class_ = "ColumnValue", inline = True) Html("td", value, class_ = "ColumnValue", inline = True)
) )
tbody += trow tbody += trow
@ -4229,22 +4276,38 @@ class SourcePage(BasePage):
# source repository list # source repository list
repo_ref_list = source.get_reporef_list() repo_ref_list = source.get_reporef_list()
if repo_ref_list: if repo_ref_list:
with Html("div", id = "subsection", class_ = "references") as repo_references: with Html("div", class_ ="subsection", id ="repositories") as repositories:
sourcedetail += repo_references sourcedetail += repositories
repo_references += Html("h4", _("Repositories"), inline = True) repositories += Html("h4", _("Repositories"), inline = True)
ordered = Html("ol") with Html("table", class_ ="infolist") as table:
repo_references += ordered repositories += table
for repo_ref in repo_ref_list: thead = Html("thead")
repository = self.dbase_.get_repository_from_handle(repo_ref.ref) table += thead
list = Html("li", self.repository_link(repository.get_handle(),
repository.name, trow = Html("tr") + (
inc_repos, Html("th", _("Number"), class_ ="ColumnRowLabel", inline =True),
repository.get_gramps_id(), Html("th", _("Name"), class_ ="ColumnName", inline =True)
up =True)
) )
ordered += list thead += trow
tbody = Html("tbody")
table += tbody
index = 1
for repo_ref in repo_ref_list:
repository = self.dbase_.get_repository_from_handle(repo_ref.ref)
if repository:
trow = Html("tr") + (
Html("td", index, class_ ="ColumnRowLabel", inline =True),
Html("td", self.repository_link(repo_ref.ref,
repository.get_name(),
inc_repos,
repository.get_gramps_id(),
up =True))
)
tbody += trow
# get source and its citation references # get source and its citation references
the_lists = Utils.get_source_and_citation_referents(handle, self.dbase_) the_lists = Utils.get_source_and_citation_referents(handle, self.dbase_)
@ -4256,135 +4319,160 @@ class SourcePage(BasePage):
sourcedetail += section sourcedetail += section
section += Html("h4", _("Citation References"), inline =True) section += Html("h4", _("Citation References"), inline =True)
# ordered list (ol)
ordered = Html("ol")
section += ordered
for (citation_handle, refs) in citation_referents_list: for (citation_handle, refs) in citation_referents_list:
citation = self.dbase_.get_citation_from_handle(citation_handle) citation = self.dbase_.get_citation_from_handle(citation_handle)
if citation:
list = Html("li", citation.get_page(), inline =True)
ordered += list
ordered = Html("ol") # if citation references?
section += ordered if refs:
(ppl_list, fml_list, event_list, place_list, source_list, media_list, repo_list) = refs
list = Html("li", citation.get_page(), inline =True) # Citation Referents have Person objects...
ordered += list if ppl_list:
ppl_list = set([phandle for phandle in ppl_list])
if refs: ordered1 = Html("ol", _("Person(s)"))
(ppl_list, fml_list, event_list, place_list, source_list, media_list, repo_list) = refs for person_handle in ppl_list:
_obj = self.dbase_.get_person_from_handle(person_handle)
if _obj:
list1 = Html("li")
ordered1 = Html("ol") use_link = check_person_database(person_handle, ppl_handle_list)
list += ordered1 if use_link:
url = self.report.build_url_fname_html(person_handle, "ppl", up = True)
list1 += self.person_link(url, _obj, _NAME_STYLE_DEFAULT,
gid=_obj.get_gramps_id())
else:
list1 += self.get_name(_obj)
ordered1 += list1
list += ordered1
for person_handle in ppl_list: # Citation Referents have Family objects...
_obj = self.dbase_.get_person_from_handle(person_handle) if fml_list:
if _obj: ffml_list = set([fhandle for fhandle in fml_list])
list1 = Html("li") ordered2 = Html("ol", _("Families"))
ordered1 += list1 for fhandle in families:
_obj = self.dbase_.get_family_from_handle(fhandle)
if _obj:
list2 = tml("li")
use_link = check_person_database(person_handle, ppl_handle_list) father_handle = _obj.get_father_handle()
if use_link: mother_handle = _obj.get_mother_handle()
url = self.report.build_url_fname_html(person_handle, "ppl", up = True) if father_handle:
list1 += Html("a", self.person_link(url, _obj, _NAME_STYLE_DEFAULT, father = self.dbase_.get_person_from_handle(father_handle)
gid=_obj.get_gramps_id()), class_ ="person") father_name = self.get_name(father)
else: if mother_handle:
list1 += self.get_name(_obj) mother = self.dbase_.get_person_from_handle(mother_handle)
mother_name = self.get_name(mother)
if mother and father:
use_link = check_person_database(father_handle, ppl_handle_list)
if use_link:
url = self.report.build_url_fname_html(father_handle, "ppl", up = True)
hlink = Html("span", self.person_link(father, father_handle,
_NAME_STYLE_DEFAULT), class_ = "father fatherNmother")
else:
hlink = father_name
for fhandle in fml_list: use_link = check_person_database(mother_handle, ppl_handle_list)
_obj = self.dbase_.get_family_from_handle(fhandle) if use_link:
if _obj: url = self.report.build_url_fname_html(mother_handle, "ppl", up = True)
list1 = Html("li") hlink += Html("span", self.person_link(mother, mother_handle,
ordered1 += list1 _NAME_STYLE_DEFAULT), class_ = "Nmother")
else:
hlink += mother_name
father_handle = _obj.get_father_handle() elif mother:
mother_handle = _obj.get_mother_handle() use_link = check_person_database(mother_handle, ppl_handle_list)
if father_handle: if use_link:
father = self.dbase_.get_person_from_handle(father_handle) url = self.report.build_url_fname_html(mother_handle, "ppl", up = True)
father_name = self.get_name(father) hlink = Html("span", self.person_link(mother, mother_handle,
if mother_handle: _NAME_STYLE_DEFAULT), class_ = "Nmother")
mother = self.dbase_.get_person_from_handle(mother_handle) else:
mother_name = self.get_name(mother) hlink = mother_name
if mother and father:
use_link = check_person_database(father_handle, ppl_handle_list)
if use_link:
url = self.report.build_url_fname_html(father_handle, "ppl", up = True)
hlink = Html("span", self.person_link(father, father_handle,
_NAME_STYLE_DEFAULT), class_ = "father fatherNmother")
else:
hlink = father_name
use_link = check_person_database(mother_handle, ppl_handle_list) elif father:
if use_link: use_link = check_person_database(father_handle, ppl_handle_list)
url = self.report.build_url_fname_html(mother_handle, "ppl", up = True) if use_link:
hlink = Html("span", self.person_link(mother, mother_handle, url = self.report.build_url_fname_html(father_handle, "ppl", up = True)
_NAME_STYLE_DEFAULT), class_ = "Nmother") hlink = Html("span", self.person_link(father, father_handle,
else: _NAME_STYLE_DEFAULT), class_ = "father")
hlink = mother_name else:
hlink = father_name
list2 += hlink
ordered2 += list2
list += ordered2
elif mother: # Citation Referents have Event objects...
use_link = check_person_database(mother_handle, ppl_handle_list) if event_list:
if use_link: event_list = set([evt_handle for evt_handle in event_list])
url = self.report.build_url_fname_html(mother_handle, "ppl", up = True)
hlink = Html("span", self.person_link(mother, mother_handle,
_NAME_STYLE_DEFAULT), class_ = "Nmother")
else:
hlink = mother_name
elif father: ordered3 = Html("ol", _("Events"))
use_link = check_person_database(father_handle, ppl_handle_list) for evt_handle in event_list:
if use_link: _obj = self.dbase_.get_event_from_handle(evt_handle)
url = self.report.build_url_fname_html(father_handle, "ppl", up = True) if _obj:
hlink = Html("span", self.person_link(father, father_handle, list3 = Html("li") + self.event_link(_obj.get_type(), evt_handle,
_NAME_STYLE_DEFAULT), class_ = "father") gid = _obj.get_gramps_id(), up =True)
else: ordered3 += list3
hlink = father_name list += ordered3
list1 += hlink
for evt_handle in event_list: # Citation Referents have Place objects...
_obj = self.dbase_.get_event_from_handle(evt_handle) if place_list:
if _obj: place_list = set([plc_handle for plc_handle in place_list])
list1 = Html("li") ordered4 = Html("ol", _("Place"))
ordered1 += list1 for plc_handle in place_list:
_obj = self.dbase_.get_place_from_handle(plc_handle)
if _obj:
list4 = Html("li") + self.place_link(plc_handle, _obj.get_title(), up = True)
ordered4 += list4
list += ordered4
list1 += Html("a", self.event_link(_obj.get_type(), evt_handle, # Citation Referents have Source objects...
gid = _obj.get_gramps_id(), up =True)) if source_list:
source_list = set([src_handle for src_handle in source_list])
for plc_handle in place_list: ordered5 = Html("ol", _("Sources"))
_obj = self.dbase_.get_place_from_handle(plc_handle) for src_handle in source_list:
if _obj: _obj = self.dbase_.get_source_from_handle(src_handle)
if _obj:
list5 = Html("li") + self.source_link(_obj, up = True)
ordered5 += list5
list += ordered5
list1 = Html("li") # Citation Referents have Media objects...
ordered1 += list1 if media_list:
media_list = set([mhandle for mhandle in media_list])
list1 += self.place_link(plc_handle, _obj.get_title(), up = True) ordered6 = Html("ol", _("Sources"))
for mhandle in media_list:
_obj = self.dbase_.get_object_from_handle(mhandle)
if _obj:
real_path, newpath = self.report.prepare_copy_media(_obj)
ewpath = self.report.build_url_fname(newpath, up = True)
for src_handle in source_list: list6 = Html("li") + self.media_link(mhandle,
_obj = self.dbase_.get_source_from_handle(src_handle) newpath, _obj.get_description(), up = True)
if _obj: ordered6 += list6
list += ordered6
list1 = Html("li") # Citation Referents have Repository objects...
ordered1 += list1 if repo_list:
repo_list = set([rhandle for rhandle in repo_list])
list1 += self.source_link(_obj, up = True) ordered7 = Html("ol", _("Media"))
for repo_handle in repo_list:
for mhandle in media_list: _obj = self.dbase_.get_repository_from_handle(repo_handle)
_obj = self.dbase_.get_object_from_handle(mhandle) if _obj:
if _obj: list7 = Html("li") + self.repository_link(repo_handle, _obj.get_name(), up = True)
ordered7 += list7
list1 = Html("li") list += ordered7
ordered1 += list1
real_path, newpath = self.report.prepare_copy_media(_obj)
ewpath = self.report.build_url_fname(newpath, up = True)
list1 += self.media_link(mhandle,
newpath, _obj.get_description(), up=True, usedescr = True)
for repo_handle in repo_list:
_obj = self.dbase_.get_repository_from_handle(repo_handle)
if _obj:
list1 = Html("li")
ordered1 += list1
list1 += self.repository_link(repo_handle, _obj.get_name(), up = True)
# add clearline for proper styling # add clearline for proper styling
# add footer section # add footer section
@ -5159,7 +5247,7 @@ class IndividualPage(BasePage):
# are we using Google? # are we using Google?
if self.mapservice == "Google": if self.mapservice == "Google":
jsc += google_jsc % (latitude, longitude) jsc += google_jsc % (latitude, longitude, placetitle)
# we are using OpenStreetMap? # we are using OpenStreetMap?
else: else:
@ -5339,8 +5427,9 @@ class IndividualPage(BasePage):
return [bv, gv, bh, gh] return [bv, gv, bh, gh]
def draw_connected_box(self, center1, center2, col, handle): def draw_connected_box(self, center1, center2, col, handle):
db = self.report.database """
draws the connected box for Ancestor Tree on the Individual Page
"""
box = [] box = []
if not handle: if not handle:
return box return box
@ -5372,8 +5461,9 @@ class IndividualPage(BasePage):
return tree return tree
def draw_tree(self, gen_nr, maxgen, max_size, old_center, new_center, phandle): def draw_tree(self, gen_nr, maxgen, max_size, old_center, new_center, phandle):
db = self.report.database """
draws the Abcestor Tree
"""
tree = [] tree = []
if gen_nr > maxgen: if gen_nr > maxgen:
return tree return tree
@ -5473,11 +5563,9 @@ class IndividualPage(BasePage):
""" """
Display an individual's pedigree Display an individual's pedigree
""" """
db = self.report.database
birthorder = self.report.options["birthorder"] birthorder = self.report.options["birthorder"]
# Define helper functions # Define helper functions
def children_ped(ol): def children_ped(ol):
if family: if family:
childlist = family.get_child_ref_list() childlist = family.get_child_ref_list()
@ -5489,7 +5577,7 @@ class IndividualPage(BasePage):
children = sorted(children) children = sorted(children)
for birthdate, handle in children: for birthdate, handle in children:
if handle == self.person.handle: if handle == self.person.get_handle():
child_ped(ol) child_ped(ol)
else: else:
child = self.dbase_.get_person_from_handle(handle) child = self.dbase_.get_person_from_handle(handle)
@ -5504,7 +5592,6 @@ class IndividualPage(BasePage):
if family: if family:
pedfam += Html("ol", class_ = "spouselist") + family pedfam += Html("ol", class_ = "spouselist") + family
return ol + pedfam return ol + pedfam
# End of helper functions # End of helper functions
parent_handle_list = self.person.get_parent_family_handle_list() parent_handle_list = self.person.get_parent_family_handle_list()
@ -7185,11 +7272,13 @@ class NavWebReport(Report):
"web pages.")) "web pages."))
self.warn_dir = False self.warn_dir = False
#################################################
#
# Creates the NarrativeWeb Report Menu Options
# Defines options and provides handling interface.
#
#################################################
class NavWebOptions(MenuReportOptions): class NavWebOptions(MenuReportOptions):
"""
Defines options and provides handling interface.
"""
def __init__(self, name, dbase): def __init__(self, name, dbase):
self.__db = dbase self.__db = dbase
self.__archive = None self.__archive = None

View File

@ -126,9 +126,9 @@ h4 {
font: normal 1em serif; font: normal 1em serif;
background-color: #00029D; background-color: #00029D;
color: #FFF; color: #FFF;
padding: .2em 0 .2em 20px; padding: 0px 0px 0px 20px;
border-width: 4px 0px 4px 0px; border-width: 4px 0px 4px 0px;
border-style: grooved; border-style: solid;
border-color: #13A926; border-color: #13A926;
} }
h5, h6 { h5, h6 {

View File

@ -27,7 +27,14 @@ Style Name: Web_Navigation-Horizontal.css
# $Id$ # $Id$
Navigation Menus Body Element
---------------------------------------------------=== */
body {
padding: 0px 7px;
width: 979px;
}
/* Navigation Menus
----------------------------------------------------- */ ----------------------------------------------------- */
div#navigation, div#subnavigation, div#alphabet { div#navigation, div#subnavigation, div#alphabet {
width: 100%; width: 100%;