Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

Fixed #11249, #11261 -- Blocks may now be overridden again `google-ma…

…p.js` template; now use GMaps `setUIToDefault` to use default controls. Thanks to ludifan and Peter Landry for the ttickets and patch.

git-svn-id: http://code.djangoproject.com/svn/django/trunk@11124 bcc190cf-cafb-0310-a4f2-bffc1f526a37
  • Loading branch information...
commit cb9cf01ff292cc6e6b8489258d1c59a6e8631d52 1 parent fdcc0c7
Justin Bronn authored June 29, 2009
4  django/contrib/gis/maps/google/gmap.py
@@ -21,7 +21,7 @@ class GoogleMap(object):
21 21
     def __init__(self, key=None, api_url=None, version=None,
22 22
                  center=None, zoom=None, dom_id='map',
23 23
                  kml_urls=[], polylines=None, polygons=None, markers=None,
24  
-                 template='gis/google/google-single.js',
  24
+                 template='gis/google/google-map.js',
25 25
                  js_module='geodjango',
26 26
                  extra_context={}):
27 27
 
@@ -162,7 +162,7 @@ def __init__(self, *args, **kwargs):
162 162
 
163 163
         # This is the template used to generate the GMap load JavaScript for
164 164
         # each map in the set.
165  
-        self.map_template = kwargs.pop('map_template', 'gis/google/google-map.js')
  165
+        self.map_template = kwargs.pop('map_template', 'gis/google/google-single.js')
166 166
 
167 167
         # Running GoogleMap.__init__(), and resetting the template
168 168
         # value with default obtained above.
7  django/contrib/gis/templates/gis/google/google-base.js
... ...
@@ -1,7 +0,0 @@
1  
-{% block vars %}var geodjango = {};{% for icon in icons %} 
2  
-var {{ icon.varname }} = new GIcon(G_DEFAULT_ICON); 
3  
-{% if icon.image %}{{ icon.varname }}.image = "{{ icon.image }}";{% endif %}
4  
-{% if icon.shadow %}{{ icon.varname }}.shadow = "{{ icon.shadow }}";{% endif %} {% if icon.shadowsize %}{{ icon.varname }}.shadowSize = new GSize({{ icon.shadowsize.0 }}, {{ icon.shadowsize.1 }});{% endif %}
5  
-{% if icon.iconanchor %}{{ icon.varname }}.iconAnchor = new GPoint({{ icon.iconanchor.0 }}, {{ icon.iconanchor.1 }});{% endif %} {% if icon.iconsize %}{{ icon.varname }}.iconSize = new GSize({{ icon.iconsize.0 }}, {{ icon.iconsize.1 }});{% endif %}
6  
-{% if icon.infowindowanchor %}{{ icon.varname }}.infoWindowAnchor = new GPoint({{ icon.infowindowanchor.0 }}, {{ icon.infowindowanchor.1 }});{% endif %}{% endfor %}{% endblock %}
7  
-{% block functions %}{% endblock %}
12  django/contrib/gis/templates/gis/google/google-map.js
... ...
@@ -1,10 +1,16 @@
1 1
 {% autoescape off %}
  2
+{% block vars %}var geodjango = {};{% for icon in icons %} 
  3
+var {{ icon.varname }} = new GIcon(G_DEFAULT_ICON); 
  4
+{% if icon.image %}{{ icon.varname }}.image = "{{ icon.image }}";{% endif %}
  5
+{% if icon.shadow %}{{ icon.varname }}.shadow = "{{ icon.shadow }}";{% endif %} {% if icon.shadowsize %}{{ icon.varname }}.shadowSize = new GSize({{ icon.shadowsize.0 }}, {{ icon.shadowsize.1 }});{% endif %}
  6
+{% if icon.iconanchor %}{{ icon.varname }}.iconAnchor = new GPoint({{ icon.iconanchor.0 }}, {{ icon.iconanchor.1 }});{% endif %} {% if icon.iconsize %}{{ icon.varname }}.iconSize = new GSize({{ icon.iconsize.0 }}, {{ icon.iconsize.1 }});{% endif %}
  7
+{% if icon.infowindowanchor %}{{ icon.varname }}.infoWindowAnchor = new GPoint({{ icon.infowindowanchor.0 }}, {{ icon.infowindowanchor.1 }});{% endif %}{% endfor %}
  8
+{% endblock vars %}{% block functions %}
2 9
 {% block load %}{{ js_module }}.{{ dom_id }}_load = function(){
3 10
   if (GBrowserIsCompatible()) {
4 11
     {{ js_module }}.{{ dom_id }} = new GMap2(document.getElementById("{{ dom_id }}"));
5 12
     {{ js_module }}.{{ dom_id }}.setCenter(new GLatLng({{ center.1 }}, {{ center.0 }}), {{ zoom }});
6  
-    {% block controls %}{{ js_module }}.{{ dom_id }}.addControl(new GSmallMapControl());
7  
-    {{ js_module }}.{{ dom_id }}.addControl(new GMapTypeControl());{% endblock %}
  13
+    {% block controls %}{{ js_module }}.{{ dom_id }}.setUIToDefault();{% endblock %}
8 14
     {% if calc_zoom %}var bounds = new GLatLngBounds(); var tmp_bounds = new GLatLngBounds();{% endif %}
9 15
     {% for kml_url in kml_urls %}{{ js_module }}.{{ dom_id }}_kml{{ forloop.counter }} = new GGeoXml("{{ kml_url }}");
10 16
     {{ js_module }}.{{ dom_id }}.addOverlay({{ js_module }}.{{ dom_id }}_kml{{ forloop.counter }});{% endfor %}
@@ -26,4 +32,4 @@
26 32
     alert("Sorry, the Google Maps API is not compatible with this browser.");
27 33
   }
28 34
 }
29  
-{% endblock %}{% endautoescape %}
  35
+{% endblock load %}{% endblock functions %}{% endautoescape %}
2  django/contrib/gis/templates/gis/google/google-multi.js
... ...
@@ -1,4 +1,4 @@
1  
-{% extends "gis/google/google-base.js" %}
  1
+{% extends "gis/google/google-map.js" %}
2 2
 {% block functions %}
3 3
 {{ load_map_js }}
4 4
 {{ js_module }}.load = function(){
4  django/contrib/gis/templates/gis/google/google-single.js
... ...
@@ -1,2 +1,2 @@
1  
-{% extends "gis/google/google-base.js" %}
2  
-{% block functions %}{% include "gis/google/google-map.js" %}{% endblock %}
  1
+{% extends "gis/google/google-map.js" %}
  2
+{% block vars %}{# No vars here because used within GoogleMapSet #}{% endblock %}

0 notes on commit cb9cf01

Please sign in to comment.
Something went wrong with that request. Please try again.