Commits

Bruno Renié  committed 65e6dcc

Fixed #3 -- Added 'escapejs' here and there to prevent further javascript bugs with french installations

  • Participants
  • Parent commits 416123f

Comments (0)

Files changed (8)

 build
 .swp
 dist
+media
+2010-06-02 Bruno Renié <bruno@renie.fr>
+
+    * #3 - Various things no longer break with French installations
+
 2010-06-01 Bruno Renié <bruno@renie.fr> -- 0.4.3
 
     * #2 - Popups are enabled by default on KML and GPX insertion.

File geoportal/templates/geoportal/gml.html

 	{{ format }}.styleMap = new OpenLayers.StyleMap(OpenLayers.Util.applyDefaults({
 			fillColor: '#{{ color }}',
 			strokeColor: '#{{ color }}',
-			fillOpacity: {{ opacity }},
-			{% if style %}strokeOpacity: {{ opacity }},{% endif %}
+			fillOpacity: {{ opacity|escapejs }},
+			{% if style %}strokeOpacity: {{ opacity|escapejs }},{% endif %}
 			strokeWidth: {{ width }},
 		},
 		OpenLayers.Feature.Vector.style['default'])

File geoportal/templates/geoportal/map.html

 		{% endfor %}
 		var styleMap = new OpenLayers.StyleMap(OpenLayers.Util.applyDefaults({
 				fillColor: "#{{ options.color }}",
-				fillOpacity: {{ options.opacity }},
+				fillOpacity: {{ options.opacity|escapejs }},
 				{% if is_linestring %}strokeWidth: 3,{% endif %}
 				strokeColor: '#{{ options.color }}'},
 			OpenLayers.Feature.Vector.style["default"]))

File geoportal/templates/geoportal/widget.html

 	{{ map_var }}.clearFeatures = function (){
 		{{ map_var }}.deleteFeatures();
 		document.getElementById('{{ field_name }}').value = '';
-		var center = new OpenLayers.LonLat({{ default_lon }}, {{ default_lat }});
+		var center = new OpenLayers.LonLat({{ default_lon|escapejs }}, {{ default_lat|escapejs }});
 		center = center.transform(new OpenLayers.Projection('EPSG:{{ srid }}'), {{ map_var }}.viewer.map.getProjection());
 		{{ map_var }}.viewer.map.setCenter(center, {{ default_zoom }});
 	}
 		{% endfor %}
 		var styleMap = new OpenLayers.StyleMap(OpenLayers.Util.applyDefaults({
 				fillColor: "#{{ color }}",
-				fillOpacity: {{ opacity }},
+				fillOpacity: {{ opacity|escapejs }},
 				{% if is_linestring %}strokeWidth: 3,{% endif %}
 				strokeColor: '#{{ color }}'},
 			OpenLayers.Feature.Vector.style["default"]))
 				{{ map_var }}.viewer.map.zoomTo({{ point_zoom }});
 			}
 		} else {
-			var center = new OpenLayers.LonLat({{ default_lon }}, {{ default_lat }});
+			var center = new OpenLayers.LonLat({{ default_lon|escapejs }}, {{ default_lat|escapejs }});
 			center = center.transform(new OpenLayers.Projection('EPSG:{{ srid }}'), {{ map_var }}.viewer.map.getProjection());
 			{{ map_var }}.viewer.map.setCenter(center, {{ default_zoom }});
 		}

File geoportal/templates/gis/admin/geoportal.js

 {{ module }}.clearFeatures = function (){
   {{ module }}.deleteFeatures();
   document.getElementById('{{ id }}').value = '';
-  var center = new OpenLayers.LonLat({{ default_lon }}, {{ default_lat }});
+  var center = new OpenLayers.LonLat({{ default_lon|escapejs }}, {{ default_lat|escapejs }});
   center = center.transform(new OpenLayers.Projection('EPSG:{{ srid }}'), {{ module }}.map.getProjection());
   {{ module }}.map.setCenter(center, {{ default_zoom }});
 }
 // Add Select control
-{{ module }}.addSelectControl = function(){   
+{{ module }}.addSelectControl = function(){
   var select = new OpenLayers.Control.SelectFeature({{ module }}.layers.vector, {'toggle' : true, 'clickout' : true});
   viewer_{{ id }}.map.addControl(select);
   select.activate();
     viewer_{{ id }}.addGeoportalLayer('{{ layer.name }}', {opacity: {{ layer.opacity }}, name: '{{ layer.switcher_name }}', buffer: 1, transitionEffect: 'resize'});
     {% endfor %}{{ module }}.map = viewer_{{ id }}.map;
     {% if is_linestring %}OpenLayers.Feature.Vector.style["default"]["strokeWidth"] = 3; // Default too thin for linestrings. {% endif %}
-    OpenLayers.Feature.Vector.style["default"]["fillOpacity"] = {{ feature_opacity }};
+    OpenLayers.Feature.Vector.style["default"]["fillOpacity"] = {{ feature_opacity|escapejs }};
     OpenLayers.Feature.Vector.style["default"]["strokeColor"] = "#{{ feature_color }}";
     OpenLayers.Feature.Vector.style["default"]["fillColor"] = "#{{ feature_color }}";
     {{ module }}.layers.vector = new OpenLayers.Layer.Vector(" {{ field_name }}");
           {{ module }}.map.zoomTo({{ point_zoom }}); 
       }
     } else {
-      var center = new OpenLayers.LonLat({{ default_lon }}, {{ default_lat }});
+      var center = new OpenLayers.LonLat({{ default_lon|escapejs }}, {{ default_lat|escapejs }});
       center = center.transform(new OpenLayers.Projection('EPSG:{{ srid }}'), {{ module }}.map.getProjection());
       {{ module }}.map.setCenter(center, {{ default_zoom }});
     }

File geoportal/tests.py

         rendered = tmpl.render(context)
         self.assertFalse("new OpenLayers.Popup.FramedCloud" in rendered)
 
+
 class TestForm(geoportal.forms.Form):
     name = geoportal.forms.CharField(max_length=255)
     point = geoportal.forms.PointField()
 
 setup(
     name='django-geoportail',
-    version='0.4.2',
+    version='0.4.3',
     author=u'Bruno Renie',
     author_email='bruno@renie.fr',
     packages=find_packages(),