Changeset 418
- Timestamp:
- 07/20/06 10:54:57
- Files:
-
- qPloneGoogleMaps/trunk/TODO.txt (modified) (1 diff)
- qPloneGoogleMaps/trunk/browser/map_view.pt (modified) (2 diffs)
- qPloneGoogleMaps/trunk/skins/qPloneGoogleMaps/edit_js.py (modified) (5 diffs)
- qPloneGoogleMaps/trunk/skins/qPloneGoogleMaps/map_view.pt (modified) (2 diffs)
- qPloneGoogleMaps/trunk/skins/qPloneGoogleMaps/map_widget.pt (modified) (2 diffs)
- qPloneGoogleMaps/trunk/skins/qPloneGoogleMaps/maps_markers.py (modified) (6 diffs)
- qPloneGoogleMaps/trunk/skins/qPloneGoogleMaps/maps_view.pt (modified) (2 diffs)
- qPloneGoogleMaps/trunk/skins/qPloneGoogleMaps/marker_view.pt (modified) (2 diffs)
- qPloneGoogleMaps/trunk/skins/qPloneGoogleMaps/overlay_view.pt (modified) (2 diffs)
- qPloneGoogleMaps/trunk/skins/qPloneGoogleMaps/prefs_mapkeys_set.cpy (modified) (1 diff)
- qPloneGoogleMaps/trunk/skins/qPloneGoogleMaps/topic_maps_view.pt (modified) (2 diffs)
- qPloneGoogleMaps/trunk/skins/qPloneGoogleMaps/view_js.py (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
qPloneGoogleMaps/trunk/TODO.txt
r417 r418 6 6 # * folder view 7 7 8 # * marker functionality8 # * marker functionality 9 9 10 # * map field and widget10 # * map field and widget 11 11 12 # * navigation portlet view (turn on/off overlay functionality)12 # * navigation portlet view (turn on/off overlay functionality) 13 13 14 # * automatic selecting map api key14 # * automatic selecting map api key 15 15 16 * google maps adaptor for edit_location form16 # * google maps adaptor for edit_location form 17 17 18 * IE compatibility 18 # * IE compatibility 19 20 * adding markers via map layer qPloneGoogleMaps/trunk/browser/map_view.pt
r417 r418 9 9 tal:attributes="src string:http://maps.google.com/maps?file=api&v=2&key=${key}"> 10 10 </script> 11 <span tal:replace="structure python:here.maps_markers(longlat=here.getOverlayMarkers(), node='map ', controls=here.getMapControl(), loc=here.geoLocation(), typeControls=here.getTypeControl(), overviewControls=here.getOverviewControl(), events=True, maptype=here.getMapType(), color=False, zoom=here.getZoom())" />11 <span tal:replace="structure python:here.maps_markers(longlat=here.getOverlayMarkers(), node='mapView', controls=here.getMapControl(), loc=here.geoLocation(), typeControls=here.getTypeControl(), overviewControls=here.getOverviewControl(), events=True, maptype=here.getMapType(), color=False, zoom=here.getZoom())" /> 12 12 </metal:block> 13 13 </head> … … 93 93 </tal:gmarker>--> 94 94 95 <div id="map " style="position: relative; height: 480px;"95 <div id="mapView" style="position: relative; height: 480px;" 96 96 tal:define="height here/getHeight" 97 97 tal:attributes="style string:height:${height}px"></div> qPloneGoogleMaps/trunk/skins/qPloneGoogleMaps/edit_js.py
r417 r418 22 22 sGlobVars = """ 23 23 autoCenter = [%f, %f]; 24 autoZoom = map .getBoundsZoomLevel(new GLatLngBounds(new GLatLng(%f, %f), new GLatLng(%f, %f)));""" % ((min(lat)+max(lat))/2, (min(lon)+max(lon))/2, min(lat), min(lon), max(lat), max(lon))24 autoZoom = map3.getBoundsZoomLevel(new GLatLngBounds(new GLatLng(%f, %f), new GLatLng(%f, %f)));""" % ((min(lat)+max(lat))/2, (min(lon)+max(lon))/2, min(lat), min(lon), max(lat), max(lon)) 25 25 26 26 if result: … … 29 29 var point = new GLatLng(parseFloat(%f), parseFloat(%f)); 30 30 var marker = new GMarker(point); 31 map .addOverlay(marker);""" % (map_center[0], map_center[1])31 map3.addOverlay(marker);""" % (map_center[0], map_center[1]) 32 32 33 33 return """ … … 40 40 var lat = document.getElementById("maplatitude"), 41 41 lng = document.getElementById("maplongitude"), 42 map = new GMap2(document.getElementById("map"));43 this.mp = map ;44 map .addControl(new GLargeMapControl());45 map .addControl(new GMapTypeControl());46 map .addControl(new GOverviewMapControl());47 map .setCenter(new GLatLng(parseFloat(%(lat)f), parseFloat(%(lng)f)), 6, G_HYBRID_MAP);42 map3 = new GMap2(document.getElementById("mapView")); 43 this.mp = map3; 44 map3.addControl(new GLargeMapControl()); 45 map3.addControl(new GMapTypeControl()); 46 map3.addControl(new GOverviewMapControl()); 47 map3.setCenter(new GLatLng(parseFloat(%(lat)f), parseFloat(%(lng)f)), 6, G_HYBRID_MAP); 48 48 %(globvars)s 49 49 %(marker)s … … 52 52 var point = new GLatLng(lat, lng); 53 53 var marker = new GMarker(point) 54 map .addOverlay(marker);54 map3.addOverlay(marker); 55 55 }; 56 56 57 GEvent.addListener(map , 'click', function(marker, point) {57 GEvent.addListener(map3, 'click', function(marker, point) { 58 58 if (!marker){ 59 map .clearOverlays();59 map3.clearOverlays(); 60 60 addMarker(point.y, point.x); 61 61 lat.value = point.y; … … 63 63 } 64 64 }); 65 return {'widgetMap':map , 'autoZoom':autoZoom, 'autoCenter':autoCenter};65 return {'widgetMap':map3, 'autoZoom':autoZoom, 'autoCenter':autoCenter}; 66 66 } 67 67 else { qPloneGoogleMaps/trunk/skins/qPloneGoogleMaps/map_view.pt
r417 r418 9 9 tal:attributes="src string:http://maps.google.com/maps?file=api&v=2&key=${here/getMapKey}"> 10 10 </script> 11 <span tal:replace="structure python:here.maps_markers(longlat=here.getOverlayMarkers(), node='map ', controls=here.getMapControl(), loc=here.geoLocation(), typeControls=here.getTypeControl(), overviewControls=here.getOverviewControl(), events=True, maptype=here.getMapType(), color=False, zoom=here.getZoom(), mapevents=True, auto=here.getAuto())" />11 <span tal:replace="structure python:here.maps_markers(longlat=here.getOverlayMarkers(), node='mapView', controls=here.getMapControl(), loc=here.geoLocation(), typeControls=here.getTypeControl(), overviewControls=here.getOverviewControl(), events=True, maptype=here.getMapType(), color=False, zoom=here.getZoom(), mapevents=True, auto=here.getAuto())" /> 12 12 </metal:block> 13 13 </head> … … 36 36 </p> 37 37 38 <div id="map " style="position: relative; height: 480px;"></div>38 <div id="mapView" style="position: relative; height: 480px;"></div> 39 39 <!-- tal:define="height here/getHeight" 40 40 tal:attributes="style string:height:${height}px"></div>--> qPloneGoogleMaps/trunk/skins/qPloneGoogleMaps/map_widget.pt
r417 r418 14 14 tal:replace="structure string:Latitude: ${lat} <br /> Longitude: ${lng}" /> 15 15 <tal:block replace="structure python:here.view_js(result)" /> 16 <div id="map " style="position: relative; height: 480px"16 <div id="mapView" style="position: relative; height: 480px" 17 17 xmlns:v="urn:schemas-microsoft-com:vml"></div> 18 18 </metal:view_macro> … … 35 35 value longitude"/> 36 36 </metal:coordinates> 37 <div id="map " style="position: relative; height: 480px"37 <div id="mapView" style="position: relative; height: 480px" 38 38 xmlns:v="urn:schemas-microsoft-com:vml" 39 39 tal:attributes="tabindex tabindex/next"></div> qPloneGoogleMaps/trunk/skins/qPloneGoogleMaps/maps_markers.py
r417 r418 49 49 sMarkers = "\n".join(["""addMarker(%f, %f, "%s", "%s/view", "%s", "%s");""" % (float(el.geoLocation[0]), float(el.geoLocation[1]), el.Title, el.getURL(), processDesc(el.Description), color) for el in longlat]) 50 50 51 if controls == 'large': sControls += "map .addControl(new GLargeMapControl());\n"52 elif controls == 'small': sControls += "map .addControl(new GSmallMapControl());\n"53 if typeControls: sControls += "map .addControl(new GMapTypeControl());\n"54 if overviewControls: sControls += "map .addControl(new GOverviewMapControl());\n"51 if controls == 'large': sControls += "map1.addControl(new GLargeMapControl());\n" 52 elif controls == 'small': sControls += "map1.addControl(new GSmallMapControl());\n" 53 if typeControls: sControls += "map1.addControl(new GMapTypeControl());\n" 54 if overviewControls: sControls += "map1.addControl(new GOverviewMapControl());\n" 55 55 56 56 #if mapevents: … … 60 60 if (!marker){ 61 61 var m = new GMarker(point); 62 map .addOverlay(m);62 map1.addOverlay(m); 63 63 m.openInfoWindowHtml(%s); 64 64 var ok_buttons = document.getElementsByName('ok'); 65 65 var c_buttons = document.getElementsByName('cancel'); 66 66 for (var i=0; i < ok_buttons.length; i++) { 67 ok_buttons[i].addEventListener('click', function(){map .closeInfoWindow()}, false);68 c_buttons[i].addEventListener('click', function(){map .closeInfoWindow();map.removeOverlay(m);}, false);69 GEvent.addEvent(m, 'infowindowclose', function(){map .removeOverlay(m);}, false);67 ok_buttons[i].addEventListener('click', function(){map1.closeInfoWindow()}, false); 68 c_buttons[i].addEventListener('click', function(){map1.closeInfoWindow();map1.removeOverlay(m);}, false); 69 GEvent.addEvent(m, 'infowindowclose', function(){map1.removeOverlay(m);}, false); 70 70 }; 71 //map .removeOverlay(m);72 infowindow = map .getInfoWindow();71 //map1.removeOverlay(m); 72 infowindow = map1.getInfoWindow(); 73 73 infowindow.reset(point); 74 74 //window.alert(infowindow instanceof null); 75 //GEvent.addListener(infowindow, 'closeclick', function(){map .removeOverlay(m)});75 //GEvent.addListener(infowindow, 'closeclick', function(){map1.removeOverlay(m)}); 76 76 } 77 77 }; 78 GEvent.addListener(map , 'click', listener);""" % sMarkerForm78 GEvent.addListener(map1, 'click', listener);""" % sMarkerForm 79 79 80 80 if events: … … 86 86 sDefaults = """ 87 87 var centerPoint = new GLatLng(%f, %f), 88 autoZoom = map .getBoundsZoomLevel(new GLatLngBounds(new GLatLng(%f, %f), new GLatLng(%f, %f)));88 autoZoom = map1.getBoundsZoomLevel(new GLatLngBounds(new GLatLng(%f, %f), new GLatLng(%f, %f))); 89 89 """ % ((min(lat)+max(lat))/2, (min(lon)+max(lon))/2, min(lat), min(lon), max(lat), max(lon)) 90 if auto == 'Zoom': sDefaults += """map .setZoom(autoZoom);"""91 elif auto == 'Center': sDefaults += """map .setCenter(centerPoint);"""92 elif auto == 'Full': sDefaults += """map .setCenter(centerPoint, autoZoom);"""93 sDefaults += """map .savePosition();"""90 if auto == 'Zoom': sDefaults += """map1.setZoom(autoZoom);""" 91 elif auto == 'Center': sDefaults += """map1.setCenter(centerPoint);""" 92 elif auto == 'Full': sDefaults += """map1.setCenter(centerPoint, autoZoom);""" 93 sDefaults += """map1.savePosition();""" 94 94 95 95 if not zoom: zoom = 6 … … 102 102 if (GBrowserIsCompatible()) { 103 103 104 map = new GMap2(document.getElementById('%(node)s'));104 map1 = new GMap2(document.getElementById('%(node)s')); 105 105 %(controls)s 106 map .setCenter(new GLatLng(%(lt)f, %(ln)f), %(zoom)s, %(maptype)s);107 var opt = map .getInfoWindow(), overLays = {};106 map1.setCenter(new GLatLng(%(lt)f, %(ln)f), %(zoom)s, %(maptype)s); 107 var opt = map1.getInfoWindow(), overLays = {}; 108 108 opt.maxWidth = 400; 109 109 … … 119 119 var point = new GLatLng(lat, lng); 120 120 var marker = new GMarker(point, icon) 121 map .addOverlay(marker);121 map1.addOverlay(marker); 122 122 %(event)s 123 123 }; … … 132 132 for (var i=0; i < over_obj['boxes'].length; i++) registerEventListener(over_obj['boxes'][i], 'click', 133 133 function (){ 134 map .clearOverlays();134 map1.clearOverlays(); 135 135 var bs = getData(); 136 136 for (id in bs) { qPloneGoogleMaps/trunk/skins/qPloneGoogleMaps/maps_view.pt
r417 r418 10 10 <span tal:define="brain python:here.portal_catalog(path='/'.join(here.getPhysicalPath())); 11 11 longlat python:test(len(brain)==1 and brain[0].portal_type != 'Map' and brain[0].geoLocation, brain, [])" 12 tal:replace="structure python:here.maps_markers(longlat, node='map ', events=True, controls='large', typeControls=True, overviewControls=True, zoom=6, loc=longlat[0].geoLocation, auto=None)" />12 tal:replace="structure python:here.maps_markers(longlat, node='mapView', events=True, controls='large', typeControls=True, overviewControls=True, zoom=6, loc=longlat[0].geoLocation, auto=None)" /> 13 13 </metal:block> 14 14 </head> … … 40 40 </div> 41 41 42 <div id="map " style="position: relative; height: 480px;"></div>42 <div id="mapView" style="position: relative; height: 480px;"></div> 43 43 </metal:body> 44 44 </metal:main_macro> qPloneGoogleMaps/trunk/skins/qPloneGoogleMaps/marker_view.pt
r417 r418 8 8 tal:attributes="src string:http://maps.google.com/maps?file=api&v=2&key=${here/getMapKey}"> 9 9 </script> 10 <span tal:replace="structure python:here.maps_markers(here.portal_catalog(path='/'.join(here.getPhysicalPath())), node='map ', events=True, loc=here.geoLocation(), controls='large', typeControls=True, overviewControls=True, color=here.getColor(), zoom=6, auto='None')" />10 <span tal:replace="structure python:here.maps_markers(here.portal_catalog(path='/'.join(here.getPhysicalPath())), node='mapView', events=True, loc=here.geoLocation(), controls='large', typeControls=True, overviewControls=True, color=here.getColor(), zoom=6, auto='None')" /> 11 11 12 12 </metal:block> … … 42 42 </div> 43 43 44 <div id="map " style="position: relative; height: 480px;"></div>44 <div id="mapView" style="position: relative; height: 480px;"></div> 45 45 46 46 </tal:main-macro> qPloneGoogleMaps/trunk/skins/qPloneGoogleMaps/overlay_view.pt
r417 r418 8 8 tal:attributes="src string:http://maps.google.com/maps?file=api&v=2&key=${here/getMapKey}"> 9 9 </script> 10 <span tal:replace="structure python:here.maps_markers(here.getMarkers(), node='map ', events=True, color=here.getMarkersColor(), loc=here.geoLocation(), controls=here.getMapControl(), typeControls=here.getTypeControl(), overviewControls=here.getOverviewControl(), maptype=here.getMapType(),)" />10 <span tal:replace="structure python:here.maps_markers(here.getMarkers(), node='mapView', events=True, color=here.getMarkersColor(), loc=here.geoLocation(), controls=here.getMapControl(), typeControls=here.getTypeControl(), overviewControls=here.getOverviewControl(), maptype=here.getMapType(),)" /> 11 11 </metal:block> 12 12 </head> … … 38 38 </div> 39 39 40 <div id="map " style="position: relative; height: 480px;"></div>40 <div id="mapView" style="position: relative; height: 480px;"></div> 41 41 </metal:body> 42 42 </metal:main_macro> qPloneGoogleMaps/trunk/skins/qPloneGoogleMaps/prefs_mapkeys_set.cpy
r417 r418 5 5 ##bind script=script 6 6 ##bind subpath=traverse_subpath 7 ##parameters= map_api_keys , RESPONSE=None7 ##parameters= map_api_keys 8 8 ##title= 9 9 ## qPloneGoogleMaps/trunk/skins/qPloneGoogleMaps/topic_maps_view.pt
r417 r418 11 11 content folderContents|python:contentsMethod(); 12 12 longlat python:[el for el in content if el.geoLocation]" 13 tal:replace="structure python:here.maps_markers(longlat, node='map ', events=True, controls='large', typeControls=True, overviewControls=True)" />13 tal:replace="structure python:here.maps_markers(longlat, node='mapView', events=True, controls='large', typeControls=True, overviewControls=True)" /> 14 14 </metal:block> 15 15 </head> … … 41 41 </div> 42 42 43 <div id="map " style="position: relative; height: 480px;"></div>43 <div id="mapView" style="position: relative; height: 480px;"></div> 44 44 45 45 </metal:body> qPloneGoogleMaps/trunk/skins/qPloneGoogleMaps/view_js.py
r417 r418 16 16 var point = new GLatLng(parseFloat(%f), parseFloat(%f)); 17 17 var marker = new GMarker(point); 18 map .addOverlay(marker);""" % (map_center[0], map_center[1])18 map2.addOverlay(marker);""" % (map_center[0], map_center[1]) 19 19 20 20 return """ … … 25 25 function onMapLoad() { 26 26 if (GBrowserIsCompatible()) { 27 var map = new GMap2(document.getElementById("map"));28 map .addControl(new GLargeMapControl());29 map .addControl(new GMapTypeControl());30 map .addControl(new GOverviewMapControl());31 map .setCenter(new GLatLng(%(lat)f, %(lng)f), 6, G_HYBRID_MAP);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 32 %(marker)s 33 33 }
