- osm_layer.events.register("loadend", osm_layer, function() {
- $("loading").innerHTML = "";
-
- if (this.features.length) {
- var extent = this.features[0].geometry.getBounds();
-
- for (var i = 1; i < this.features.length; i++) {
- extent.extend(this.features[i].geometry.getBounds());
- }
-
- if (extent) {
- this.map.zoomToExtent(extent);
- } else {
- this.map.zoomToMaxExtent();
- }
-
- var center = getMapCenter();
- $("area_larger_map").href = '/?lat='+center.lat+'&lon='+center.lon+'&zoom='+this.map.getZoom();
- $("area_larger_map").innerHTML = "<%= t 'browse.map.larger.area' %>";
- <% unless map.instance_of? Changeset %>
- $("object_larger_map").href = '/?<%= map.class.to_s.downcase %>=<%= map.id %>';
- $("object_larger_map").innerHTML = "<%= t('browse.map.larger.' + map.class.to_s.downcase) %>";
- <% end %>
+ var centre = extent.getCenterLonLat();
+
+ $("#remote_area_edit").click(function (event) {
+ return remoteEditHandler(event, extent);
+ });
+
+ <% if preferred_editor == "remote" -%>
+ $("#area_edit").click(function (event) {
+ return remoteEditHandler(event, extent);
+ });
+ <% end -%>
+
+ $("#remote_object_edit").click(function (event) {
+ return remoteEditHandler(event, extent, "<%= map.class.to_s.downcase + map.id.to_s %>");
+ });
+
+ <% if preferred_editor == "remote" -%>
+ $("#object_edit").click(function (event) {
+ return remoteEditHandler(event, extent, "<%= map.class.to_s.downcase + map.id.to_s %>");
+ });
+ <% end -%>
+
+ $("#object_larger_map").show();
+ $("#object_edit").show();
+
+ updatelinks(centre.lon, centre.lat, 16, null, extent.left, extent.bottom, extent.right, extent.top, "<%= map.class.to_s.downcase %>", <%= map.id %>);