[Checkins] SVN: keas.googlemap/trunk/src/keas/googlemap/ first attempt at getting maps to load from a dynamic page action. Still needs tweaking.

Paul Carduner paulcarduner at gmail.com
Tue Aug 12 04:34:00 EDT 2008


Log message for revision 89704:
  first attempt at getting maps to load from a dynamic page action.  Still needs tweaking.

Changed:
  U   keas.googlemap/trunk/src/keas/googlemap/README.txt
  U   keas.googlemap/trunk/src/keas/googlemap/apikey.py
  U   keas.googlemap/trunk/src/keas/googlemap/browser/README.txt
  U   keas.googlemap/trunk/src/keas/googlemap/browser/__init__.py
  U   keas.googlemap/trunk/src/keas/googlemap/browser/configure.zcml

-=-
Modified: keas.googlemap/trunk/src/keas/googlemap/README.txt
===================================================================
--- keas.googlemap/trunk/src/keas/googlemap/README.txt	2008-08-12 07:58:53 UTC (rev 89703)
+++ keas.googlemap/trunk/src/keas/googlemap/README.txt	2008-08-12 08:34:00 UTC (rev 89704)
@@ -141,7 +141,7 @@
   >>> viewlet.update()
   >>> print viewlet.render()
   <script type="text/javascript"
-          src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAA8SpDMoY3XpgN5DzYnmNsmhTwM0brOpm-All5BF6PoaKBxRWWERT3cHSc49vCxDS6hLf1VMPD_e-ekg">
+          src="http://maps.google.com/maps?file=api&v=2&key=ABQIAAAA8SpDMoY3XpgN5DzYnmNsmhTwM0brOpm-All5BF6PoaKBxRWWERT3cHSc49vCxDS6hLf1VMPD_e-ekg&async=2&callback=keas_googlemap_maploader">
   </script>
 
 If our request is under a host for which no apikey can be found, then

Modified: keas.googlemap/trunk/src/keas/googlemap/apikey.py
===================================================================
--- keas.googlemap/trunk/src/keas/googlemap/apikey.py	2008-08-12 07:58:53 UTC (rev 89703)
+++ keas.googlemap/trunk/src/keas/googlemap/apikey.py	2008-08-12 08:34:00 UTC (rev 89704)
@@ -53,5 +53,5 @@
         apikey = zope.component.queryUtility(interfaces.IGoogleMapAPIKey, domainName)
         if apikey is None:
             return '<!-- Google Maps API Key not found for %s -->' % domainName
-        srcURL = "http://maps.google.com/maps?file=api&v=2&key=%s" % apikey.key
+        srcURL = "http://maps.google.com/maps?file=api&v=2&key=%s&async=2&callback=keas_googlemap_maploader" % apikey.key
         return '<script type="text/javascript"\nsrc="%s">\n</script>' % srcURL

Modified: keas.googlemap/trunk/src/keas/googlemap/browser/README.txt
===================================================================
--- keas.googlemap/trunk/src/keas/googlemap/browser/README.txt	2008-08-12 07:58:53 UTC (rev 89703)
+++ keas.googlemap/trunk/src/keas/googlemap/browser/README.txt	2008-08-12 08:34:00 UTC (rev 89704)
@@ -54,14 +54,14 @@
   </div>
   <BLANKLINE>
   <script type="text/javascript">
-            $(document).ready( function() {
+            var keas_googlemap_maploader = function(){
                  keas.googlemap.initialize({id:'google-map',
                                             zoom:1,
                                             type:G_NORMAL_MAP,
-                                            markers:[]});} );
+                                            markers:[]});
+            };
             $(document).unload( function() {GUnload();} );
             </script>
-  <BLANKLINE>
 
 Adding Markers
 --------------
@@ -86,14 +86,14 @@
   </div>
   <BLANKLINE>
   <script type="text/javascript">
-            $(document).ready( function() {
+            var keas_googlemap_maploader = function(){
                  keas.googlemap.initialize({id:'google-map',
                                             zoom:1,
                                             type:G_NORMAL_MAP,
-                                            markers:[{latitude:37.231, longitude:-23.123, html:'\n<h1>My Marker</h1>\n<p>This is my marker</p>\n'},]});} );
+                                            markers:[{latitude:37.231, longitude:-23.123, html:'\n<h1>My Marker</h1>\n<p>This is my marker</p>\n'},]});
+            };
             $(document).unload( function() {GUnload();} );
             </script>
-  <BLANKLINE>
 
 To properly display markers, you will need to include the
 markermanager.js utility script from google.  There is a viewlet that

Modified: keas.googlemap/trunk/src/keas/googlemap/browser/__init__.py
===================================================================
--- keas.googlemap/trunk/src/keas/googlemap/browser/__init__.py	2008-08-12 07:58:53 UTC (rev 89703)
+++ keas.googlemap/trunk/src/keas/googlemap/browser/__init__.py	2008-08-12 08:34:00 UTC (rev 89704)
@@ -98,11 +98,12 @@
                                                                          jsString(marker.html))
         markerString += ']'
         return """
-          $(document).ready( function() {
+          var keas_googlemap_maploader = function(){
                keas.googlemap.initialize({id:'%(id)s',
                                           zoom:%(zoom)s,
                                           type:%(type)s,
-                                          markers:%(markers)s});} );
+                                          markers:%(markers)s});
+          };
           $(document).unload( function() {GUnload();} );
           """ % dict(id=self.id,
                      zoom=self.zoom,

Modified: keas.googlemap/trunk/src/keas/googlemap/browser/configure.zcml
===================================================================
--- keas.googlemap/trunk/src/keas/googlemap/browser/configure.zcml	2008-08-12 07:58:53 UTC (rev 89703)
+++ keas.googlemap/trunk/src/keas/googlemap/browser/configure.zcml	2008-08-12 08:34:00 UTC (rev 89704)
@@ -26,7 +26,7 @@
       class="keas.googlemap.browser.GoogleMapJavaScriptViewlet"
       permission="zope.Public"
       layer="keas.googlemap.browser.IGoogleMapBrowserLayer"
-      weight="5"
+      weight="3"
       />
 
   <viewlet



More information about the Checkins mailing list