1 $(document).ready(function () {
2 function remoteEditHandler(bbox, select) {
3 var left = bbox.left - 0.0001;
4 var top = bbox.top + 0.0001;
5 var right = bbox.right + 0.0001;
6 var bottom = bbox.bottom - 0.0001;
9 $("#linkloader").load(function () { loaded = true; });
12 $("#linkloader").attr("src", "http://127.0.0.1:8111/load_and_zoom?left=" + left + "&top=" + top + "&right=" + right + "&bottom=" + bottom + "&select=" + select);
14 $("#linkloader").attr("src", "http://127.0.0.1:8111/load_and_zoom?left=" + left + "&top=" + top + "&right=" + right + "&bottom=" + bottom);
17 setTimeout(function () {
18 if (!loaded) alert(I18n.t('site.index.remote_failed'));
24 var map = createMap("small_map", {
25 controls: [ new OpenLayers.Control.Navigation() ]
28 var params = $("#small_map").data();
29 if (params.type == "changeset") {
30 var bbox = new OpenLayers.Bounds(params.minlon, params.minlat, params.maxlon, params.maxlat);
31 var centre = bbox.getCenterLonLat();
33 map.zoomToExtent(proj(bbox));
37 $("#browse_map .geolink").show();
39 $("a[data-editor=remote]").click(function () {
40 return remoteEditHandler(bbox);
43 updatelinks(centre.lon, centre.lat, 16, null, params.minlon, params.minlat, params.maxlon, params.maxlat);
44 } else if (params.type == "note") {
45 var centre = new OpenLayers.LonLat(params.lon, params.lat);
47 setMapCenter(centre, 16);
48 addMarkerToMap(centre);
50 var bbox = getMapExtent();
53 $("#browse_map .geolink").show();
55 $("a[data-editor=remote]").click(function () {
56 return remoteEditHandler(bbox);
59 updatelinks(centre.lon, centre.lat, 16, null, bbox.left, bbox.bottom, bbox.right, bbox.top)
61 $("#object_larger_map").hide();
62 $("#object_edit").hide();
64 var object = {type: params.type, id: params.id};
66 if (!params.visible) {
67 object.version = params.version - 1;
70 addObjectToMap(object, true, function(extent) {
72 $("#browse_map .geolink").show();
75 extent = unproj(extent);
77 var centre = extent.getCenterLonLat();
79 $("a.bbox[data-editor=remote]").click(function () {
80 return remoteEditHandler(extent);
83 $("a.object[data-editor=remote]").click(function () {
84 return remoteEditHandler(extent, params.type + params.id);
87 $("#object_larger_map").show();
88 $("#object_edit").show();
90 updatelinks(centre.lon, centre.lat, 16, null, extent.left, extent.bottom, extent.right, extent.top, object);
92 $("#small_map").hide();
97 createMenu("area_edit", "area_edit_menu", "right");
98 createMenu("object_edit", "object_edit_menu", "right");