Last change
on this file since 2111 was
1,
checked in by myroslav, 19 years ago
|
Building directory structure
|
-
Property svn:eol-style set to
native
|
File size:
1.3 KB
|
Line | |
---|
1 | ## Script (Python) "view_js" |
---|
2 | ##bind container=container |
---|
3 | ##bind context=context |
---|
4 | ##bind namespace= |
---|
5 | ##bind script=script |
---|
6 | ##bind subpath=traverse_subpath |
---|
7 | ##parameters= result=None |
---|
8 | ##title= |
---|
9 | ## |
---|
10 | |
---|
11 | map_center = (0,0) |
---|
12 | sMarker = "" |
---|
13 | if result: |
---|
14 | map_center = result |
---|
15 | sMarker = """ |
---|
16 | var point = new GLatLng(parseFloat(%f), parseFloat(%f)); |
---|
17 | var marker = new GMarker(point); |
---|
18 | map2.addOverlay(marker);""" % (map_center[0], map_center[1]) |
---|
19 | |
---|
20 | return """ |
---|
21 | <script src="http://maps.google.com/maps?file=api&v=2&key=%(key)s" type="text/javascript"></script> |
---|
22 | <script type="text/javascript"> |
---|
23 | //<![CDATA[ |
---|
24 | |
---|
25 | function onMapLoad() { |
---|
26 | if (GBrowserIsCompatible()) { |
---|
27 | var map2 = new GMap2(document.getElementById("mapView")); |
---|
28 | map2.addControl(new GLargeMapControl()); |
---|
29 | map2.addControl(new GMapTypeControl()); |
---|
30 | map2.addControl(new GOverviewMapControl()); |
---|
31 | map2.setCenter(new GLatLng(%(lat)f, %(lng)f), 6, G_HYBRID_MAP); |
---|
32 | %(marker)s |
---|
33 | } |
---|
34 | else window.alert("Google maps aren't compatible with current Browser."); |
---|
35 | } |
---|
36 | |
---|
37 | registerEventListener(window, 'load', onMapLoad) |
---|
38 | registerEventListener(window, 'unload', GUnload); |
---|
39 | |
---|
40 | //]]> |
---|
41 | </script> """ % { |
---|
42 | 'key' : context.getMapKey(), |
---|
43 | 'lat' : map_center[0], |
---|
44 | 'lng' : map_center[1], |
---|
45 | 'marker' : sMarker, |
---|
46 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.