Simplified the python and style sheet code for Place Maps.

svn: r15570
This commit is contained in:
Rob G. Healey 2010-06-15 08:26:38 +00:00
parent d6fa234f9b
commit 82cb3ff0cc
2 changed files with 3 additions and 46 deletions

View File

@ -31,25 +31,15 @@ div#mapstraction {
/* Middle
------------------------------------------------- */
div#middle {
float: center;
height: 400px;
width: 60%;
margin: 10px 0px 10px 0px;
padding: 0% 20% 0% 20%;
text-align: center;
}
div#middle div#geo-info {
font: bold 6px serif;
}
div#middle a {
color: #000;
background: none;
text-decoration: none;
}
div#middle a:hover {
text-decoration: underline;
font: bold 6px sans-serif;
}
/* GoogleV3
@ -57,5 +47,4 @@ div#middle a:hover {
div#googlev3 {
height: 400px;
width: 500px;
margin-bottom: 6px;
}

View File

@ -356,13 +356,9 @@ class BasePage(object):
head += Html("script", type = "text/javascript",
src = "http://maps.google.com/maps/api/js?sensor=false", inline = True)
# add openlayers specific javascript code
head += Html("script", src = "http://openlayers.org/api/OpenLayers.js", inline = True)
# add mapstraction javascript code
fname = "/".join(["mapstraction", "mxn.js"])
fname = "/".join(["mapstraction", "mxn.js?(googlev3)"])
url = self.report.build_url_fname(fname, None, self.up)
url += "?(googlev3,openlayers)"
head += Html("script", src = url, inline = True)
# Place Map division
@ -410,46 +406,18 @@ class BasePage(object):
//add a marker
add_marker();
}
function add_marker() {
// add marker
var marker;
marker = new mxn.Marker(latlon);
// openlayers mapstraction problem here : drift if anchor.
if ( provider == 'googlev3' ) {
marker.setIcon('../../../images/gramps-geo-' +icon+ '.png',
[22,22],
[0,22]);
} else {
marker.setIcon('../../../images/gramps-geo-' +icon+ '.png',
[22,22]);
};
map.addMarker(marker,true);
}
function changeprovider() {
if ( pprovider == 'googlev3') {
provider = 'openlayers';
icon = 'mainmap';
} else {
provider = 'googlev3';
icon = 'altmap';
};
mao.swap(provider, provider);
add_marker();
}
//]]>"""
# there is no need to add an ending "</script>" as it will be added automatically!
middle += Html("div", id = "googlev3", inline = True)
middle += Html("div", id = "openlayers", inline = True)
middle += Html("a", _("change provider"), attr = 'onclick = "changeprovider();"',
href = "#", inline = True)
# return placedetail division back to its callers
return placedetail, head