Changeset 403
- Timestamp:
- 07/14/06 12:08:34
- Files:
-
- qPloneGoogleMaps/trunk/Extensions/Install.py (modified) (4 diffs)
- qPloneGoogleMaps/trunk/content/Map.py (modified) (1 diff)
- qPloneGoogleMaps/trunk/skins/qPloneGoogleMaps/map_view.pt (modified) (1 diff)
- qPloneGoogleMaps/trunk/skins/qPloneGoogleMaps/map_widget.pt (modified) (1 diff)
- qPloneGoogleMaps/trunk/skins/qPloneGoogleMaps/maps_markers.py (modified) (6 diffs)
- qPloneGoogleMaps/trunk/skins/qPloneGoogleMaps/marker_view.pt (modified) (1 diff)
- qPloneGoogleMaps/trunk/skins/qPloneGoogleMaps/portlet_maps.pt (modified) (1 diff)
- qPloneGoogleMaps/trunk/skins/qPloneGoogleMaps/portlet_overlays.pt (added)
- qPloneGoogleMaps/trunk/skins/qPloneGoogleMaps/switchOverlays.py (added)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
qPloneGoogleMaps/trunk/Extensions/Install.py
r402 r403 90 90 right_slots = list(right_slots) + [slot,] 91 91 self.right_slots = right_slots 92 out.write('Added maps portlet to right_slots property.\n')92 out.write('Added %s portlet to right_slots property.\n' % slot) 93 93 94 94 def removePortlet(self, out, slot): … … 99 99 right_slots.remove(slot) 100 100 self.right_slots = right_slots 101 out.write('Removed maps portlet from right slots property.\n')101 out.write('Removed %s portlet from right slots property.\n' % slot) 102 102 103 103 def setupSkin(self, out, skinFolder): … … 153 153 installContentTypes(self, out) 154 154 155 # add portlet to right slot155 # add portlets to right slot 156 156 addPortlet(self, out, 'here/portlet_maps/macros/portlet') 157 addPortlet(self, out, 'here/portlet_overlays/macros/portlet') 157 158 158 159 # add map view template to the topic portal type … … 174 175 removeCatalogColumn(self, 'geoLocation', out) 175 176 176 # remove portlet from right slot177 # remove portlets from right slot 177 178 removePortlet(self, out, 'here/portlet_maps/macros/portlet') 179 removePortlet(self, out, 'here/portlet_overlays/macros/portlet') 178 180 179 181 # remove map view template from the topic portal type qPloneGoogleMaps/trunk/content/Map.py
r402 r403 163 163 if el.portal_type == 'Overlay': 164 164 color = el.getMarkersColor() 165 markers = el.getMarkers()165 markers = el.getMarkers() 166 166 elif el.portal_type == 'Marker': 167 167 color = el.getColor() 168 168 markers = list(catalog(path='/'.join(el.getPhysicalPath()))) 169 169 else: continue 170 result[ color] = result.get(color, []) + markers170 result[(el.getId(),color)] = result.get(el.getId(), []) + markers 171 171 return result 172 172 qPloneGoogleMaps/trunk/skins/qPloneGoogleMaps/map_view.pt
r402 r403 22 22 </div> 23 23 24 <h1 tal:content="here/pretty_title_or_id" class="documentFirstHeading"> 25 Title or id 26 </h1> 27 24 28 <div metal:use-macro="here/document_byline/macros/byline"> 25 29 Get the byline - contains details about author and modification date. qPloneGoogleMaps/trunk/skins/qPloneGoogleMaps/map_widget.pt
r402 r403 39 39 tal:attributes="tabindex tabindex/next"></div> 40 40 <tal:block define="coord python:test(latitude and longitude, (latitude, longitude), None); 41 longlat python:test(here.getOverlayMarkers, here.getOverlayMarkers(), []);"41 longlat here/getOverlayMarkers|python:[]" 42 42 replace="structure python:context.edit_js(coord, longlat)" /> 43 43 </metal:fill> qPloneGoogleMaps/trunk/skins/qPloneGoogleMaps/maps_markers.py
r402 r403 5 5 ##bind script=script 6 6 ##bind subpath=traverse_subpath 7 ##parameters= longlat=[], node, controls='nothing', maptype='hybrid', overviewControls=None, typeControls=None, events=False, color='default', zoom=None, loc=(37.4419, -122.1419), mapevents=None, auto=' None'7 ##parameters= longlat=[], node, controls='nothing', maptype='hybrid', overviewControls=None, typeControls=None, events=False, color='default', zoom=None, loc=(37.4419, -122.1419), mapevents=None, auto='Full' 8 8 ##title= 9 9 ## … … 33 33 lat = [float(e.geoLocation[0]) for el in longlat.values() for e in el] 34 34 lon = [float(e.geoLocation[1]) for el in longlat.values() for e in el] 35 sMarkers = "\n".join(["""addMarker(%f, %f, "%s", "%s/view", "%s", "%s");""" % (float(e.geoLocation[0]), float(e.geoLocation[1]), e.Title, e.getURL(), processDesc(e.Description), el) for el, value in longlat.items() for e in value]) 35 #raise str(longlat.items()[0][1].items()[0][1]) 36 #{id:{color:[markers]}} 37 sMarkers = "\n".join([""" 38 addMarker(%(lt)f, %(lg)f, "%(title)s", "%(url)s/view", "%(desc)s", "%(c)s"); 39 typeof(overLays["%(id)s"])=='undefined'?overLays["%(id)s"]=[]:''; 40 overLays["%(id)s"].push([%(lt)f, %(lg)f, "%(title)s", "%(url)s/view", "%(desc)s", "%(c)s"]); 41 """ % {'lt':float(e.geoLocation[0]), 42 'lg':float(e.geoLocation[1]), 43 'title':e.Title, 44 'url':e.getURL(), 45 'desc':processDesc(e.Description), 46 'c':el[1], 47 'id':el[0]} for el, value in longlat.items() for e in value]) 36 48 elif longlat: 37 49 lat = [float(el.geoLocation[0]) for el in longlat] … … 39 51 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]) 40 52 41 if controls == 'large': sControls += "map.addControl(new GLargeMapControl()); "42 elif controls == 'small': sControls += "map.addControl(new GSmallMapControl()); "43 if typeControls: sControls += "map.addControl(new GMapTypeControl()); "53 if controls == 'large': sControls += "map.addControl(new GLargeMapControl());\n" 54 elif controls == 'small': sControls += "map.addControl(new GSmallMapControl());\n" 55 if typeControls: sControls += "map.addControl(new GMapTypeControl());\n" 44 56 if overviewControls: sControls += "map.addControl(new GOverviewMapControl());\n" 45 57 … … 89 101 //<![CDATA[ 90 102 91 function registerUnloadFunction(func){92 if ( window.addEventListener) window.addEventListener("unload", func, false);93 else if ( window.attachEvent) window.attachEvent("onunload", func);103 function addEvent(el, evt, func){ 104 if (el.addEventListener) el.addEventListener(evt, func, false); 105 else if (el.attachEvent) el.attachEvent("on"+evt, func); 94 106 }; 95 107 … … 97 109 if (GBrowserIsCompatible()) { 98 110 99 varmap = new GMap2(document.getElementById('%(node)s'));111 map = new GMap2(document.getElementById('%(node)s')); 100 112 %(controls)s 101 113 map.setCenter(new GLatLng(%(lt)f, %(ln)f), %(zoom)s, %(maptype)s); 102 var opt = map.getInfoWindow() ;114 var opt = map.getInfoWindow(), overLays = {}; 103 115 opt.maxWidth = 400; 104 116 … … 116 128 map.addOverlay(marker); 117 129 %(event)s 118 } 130 }; 119 131 %(mapevents)s 120 132 %(markers)s 121 133 %(defaults)s 134 135 if (typeof(getData) == 'function') { 136 var over_obj = getData(); 137 if (over_obj) { 138 for (var i=0; i < over_obj['boxes'].length; i++) addEvent(over_obj['boxes'][i], 'click', 139 function (){ 140 map.clearOverlays(); 141 var bs = getData(); 142 for (id in bs) { 143 if (bs[id] == true) { 144 for (var j=0; j < overLays[id].length; j++) { 145 var opts = overLays[id][j]; 146 //alert(opts); 147 addMarker(opts[0], opts[1], opts[2], opts[3], opts[4], opts[5]); 148 }; 149 } 150 }; 151 }); 152 } 153 }; 154 122 155 } 123 156 else window.alert("Google maps aren't compatible with current Browser."); 124 157 }; 125 158 126 registerPloneFunction(onLoadMap);127 registerUnloadFunction(GUnload);159 addEvent(window, 'load', onLoadMap); 160 addEvent(window, 'unload', GUnload); 128 161 129 162 //]]> qPloneGoogleMaps/trunk/skins/qPloneGoogleMaps/marker_view.pt
r402 r403 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(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 )" />11 <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')" /> 12 12 13 13 </metal:block> qPloneGoogleMaps/trunk/skins/qPloneGoogleMaps/portlet_maps.pt
r402 r403 12 12 tal:attributes="src string:http://maps.google.com/maps?file=api&v=2&key=${key}"> 13 13 </script> 14 <span tal:replace="structure python:here.maps_markers(longlat, loc=longlat[0].geoLocation, zoom=5, node='portlet_map', controls='small' )" />14 <span tal:replace="structure python:here.maps_markers(longlat, loc=longlat[0].geoLocation, zoom=5, node='portlet_map', controls='small', auto='None')" /> 15 15 16 16 <dl class="portlet" id="portlet-maps">
