<%= javascript_include_tag '/openlayers/OpenStreetMap.js' %>
<%= javascript_include_tag 'map.js' %>
<td align="right">
- <% if map.visible %>
+ <% if map.instance_of? Changeset or map.visible %>
<div id="small_map" style="width:250px; height: 300px; border: solid 1px black">
</div>
<span id="loading">Loading...</span>
</td>
<script type="text/javascript">
function init() {
+ var map = createMap("small_map", {
+ controls: [ new OpenLayers.Control.Navigation() ]
+ });
+
+ <% if map.instance_of? Changeset %>
+ var minlon = <%= map.min_lon / GeoRecord::SCALE.to_f %>;
+ var minlat = <%= map.min_lat / GeoRecord::SCALE.to_f %>;
+ var maxlon = <%= map.max_lon / GeoRecord::SCALE.to_f %>;
+ var maxlat = <%= map.max_lat / GeoRecord::SCALE.to_f %>;
+ var bbox = new OpenLayers.Bounds(minlon, minlat, maxlon, maxlat);
+
+ setMapExtent(bbox);
+ addBoxToMap(bbox);
+
+ $("loading").innerHTML = "";
+
+ $("larger_map").href = '/?minlon='+minlon+'&minlat='+minlat+'&maxlon='+maxlon+'&maxlat='+maxlat+'&box=yes';
+ $("larger_map").innerHTML = "View Larger Map";
+ <% else %>
var obj_type = "<%= map.class.name.downcase %>";
var obj_id = <%= map.id %>;
var url = "/api/<%= "#{API_VERSION}" %>/<%= map.class.name.downcase %>/<%= map.id %>";
url += "/full";
}
- var map = createMap("small_map", {
- controls: [ new OpenLayers.Control.Navigation() ]
- });
-
var osm_layer = new OpenLayers.Layer.GML("OSM", url, {
format: OpenLayers.Format.OSM,
projection: new OpenLayers.Projection("EPSG:4326")
osm_layer.loadGML();
osm_layer.loaded = true;
+ <% end %>
}
window.onload = init;