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);
45 $("#object_larger_map").hide();
46 $("#object_edit").hide();
48 var object = {type: params.type, id: params.id};
50 if (!params.visible) {
51 object.version = params.version - 1;
54 addObjectToMap(object, true, function(extent) {
56 $("#browse_map .geolink").show();
59 extent.transform(map.getProjectionObject(), map.displayProjection);
61 var centre = extent.getCenterLonLat();
63 $("a.bbox[data-editor=remote]").click(function () {
64 return remoteEditHandler(extent);
67 $("a.object[data-editor=remote]").click(function () {
68 return remoteEditHandler(extent, params.type + params.id);
71 $("#object_larger_map").show();
72 $("#object_edit").show();
74 updatelinks(centre.lon, centre.lat, 16, null, extent.left, extent.bottom, extent.right, extent.top, object);
76 $("#small_map").hide();
81 createMenu("area_edit", "area_edit_menu", "right");
82 createMenu("object_edit", "object_edit_menu", "right");