1 <%= javascript_include_tag 'openlayers.js' %>
 
   2 <%= javascript_include_tag 'map.js' %>
 
   4 <div id="changeset_list_map">
 
   7 <script type="text/javascript">
 
   8   OpenLayers.Lang.setCode("<%= I18n.locale.to_s %>");
 
  12   function highlightChangeset(id) {
 
  13     var feature = vectors.getFeatureByFid(id);
 
  14     var bounds = feature.geometry.getBounds();
 
  16     if (bounds.containsBounds(map.getExtent())) {
 
  17       bounds = map.getExtent().scale(1.1);
 
  20     if (highlight) vectors.removeFeatures(highlight);
 
  22     highlight = new OpenLayers.Feature.Vector(bounds.toGeometry(), {}, {
 
  24       strokeColor: "#ee9900",
 
  29     vectors.addFeatures(highlight);
 
  31     $("#tr-changeset-" + id).addClass("selected");
 
  34   function unHighlightChangeset(id) {
 
  35     vectors.removeFeatures(highlight);
 
  37     $("#tr-changeset-" + id).removeClass("selected");
 
  41     var map = createMap("changeset_list_map", {
 
  43         new OpenLayers.Control.Navigation(),
 
  44         new OpenLayers.Control.PanZoom(),
 
  45         new OpenLayers.Control.PanZoomBar()
 
  49     var bounds = new OpenLayers.Bounds();
 
  51     <% @edits.each do |edit| %>
 
  52     <% if edit.has_valid_bbox? %>
 
  53     <% bbox = edit.bbox.to_unscaled %>
 
  54     var minlon = <%= bbox.min_lon %>;
 
  55     var minlat = <%= bbox.min_lat %>;
 
  56     var maxlon = <%= bbox.max_lon %>;
 
  57     var maxlat = <%= bbox.max_lat %>;
 
  58     var bbox = new OpenLayers.Bounds(minlon, minlat, maxlon, maxlat);
 
  62     addBoxToMap(bbox, "<%= edit.id %>", true);
 
  67       "featureselected": function(feature) {
 
  68         highlightChangeset(feature.feature.fid);
 
  70       "featureunselected": function(feature) {
 
  71         unHighlightChangeset(feature.feature.fid);
 
  75     var selectControl = new OpenLayers.Control.SelectFeature(vectors, {
 
  79     map.addControl(selectControl);
 
  80     selectControl.activate();
 
  83       setMapExtent(new OpenLayers.Bounds(<%= @bbox %>));
 
  89   Event.observe(window, "load", init);