1 <iframe id="linkloader" style="display: none">
5 <% if map.instance_of? Changeset or (map.instance_of? Node and map.version > 1) or map.visible %>
7 if map.instance_of? Changeset
8 bbox = map.bbox.to_unscaled
12 :minlon => bbox.min_lon,
13 :minlat => bbox.min_lat,
14 :maxlon => bbox.max_lon,
15 :maxlat => bbox.max_lat
19 :type => map.class.name.downcase,
21 :version => map.version,
22 :visible => map.visible
26 <%= content_tag "div", "", :id => "small_map", :data => data %>
27 <span id="loading"><%= t 'browse.map.loading' %></span>
29 <%= link_to t("browse.map.larger.area"),
30 root_path(:box => "yes"),
31 :id => "area_larger_map",
32 :class => "geolink bbox" %>
34 <%= link_to h(t("browse.map.edit.area")) + content_tag(:span, "▾", :class => "menuicon"),
37 :data => { :editor => preferred_editor },
38 :class => "geolink bbox" %>
40 <% unless map.instance_of? Changeset %>
42 <%= link_to t("browse.map.larger." + map.class.to_s.downcase),
44 :id => "object_larger_map",
45 :class => "geolink object" %>
47 <%= link_to h(t("browse.map.edit." + map.class.to_s.downcase)) + content_tag(:span, "▾", :class => "menuicon"),
50 :data => { :editor => preferred_editor },
51 :class => "geolink object" %>
55 <%= t 'browse.map.deleted' %>
59 <div id="area_edit_menu" class="menu">
61 <% Editors::ALL_EDITORS.each do |editor| %>
62 <li><%= link_to t('layouts.edit_with', :editor => t("editor.#{editor}.description")),
63 edit_path(:editor => editor),
64 :data => {:editor => editor},
65 :class => "geolink bbox" %></li>
70 <div id="object_edit_menu" class="menu">
72 <% Editors::ALL_EDITORS.each do |editor| %>
73 <li><%= link_to t('layouts.edit_with', :editor => t("editor.#{editor}.description")),
74 edit_path(:editor => editor),
75 :data => {:editor => editor},
76 :class => "geolink object" %></li>
81 <% if map.instance_of? Changeset or (map.instance_of? Node and map.version > 1) or map.visible %>
82 <script type="text/javascript">
83 function remoteEditHandler(event, bbox, select) {
84 var left = bbox.left - 0.0001;
85 var top = bbox.top + 0.0001;
86 var right = bbox.right + 0.0001;
87 var bottom = bbox.bottom - 0.0001;
90 $("#linkloader").load(function () { loaded = true; });
93 $("#linkloader").attr("src", "http://127.0.0.1:8111/load_and_zoom?left=" + left + "&top=" + top + "&right=" + right + "&bottom=" + bottom + "&select=" + select);
95 $("#linkloader").attr("src", "http://127.0.0.1:8111/load_and_zoom?left=" + left + "&top=" + top + "&right=" + right + "&bottom=" + bottom);
98 setTimeout(function () {
99 if (!loaded) alert(I18n.t('site.index.remote_failed'));
106 var map = createMap("small_map", {
107 controls: [ new OpenLayers.Control.Navigation() ]
110 var params = $("#small_map").data();
111 if (params.type == "changeset") {
112 var bbox = new OpenLayers.Bounds(params.minlon, params.minlat, params.maxlon, params.maxlat);
113 var centre = bbox.getCenterLonLat();
115 map.zoomToExtent(proj(bbox));
118 $("#loading").hide();
119 $("#browse_map .geolink").show();
121 $("a[data-editor=remote]").click(function (event) {
122 return remoteEditHandler(event, bbox);
125 updatelinks(centre.lon, centre.lat, 16, null, params.minlon, params.minlat, params.maxlon, params.maxlat);
127 var url = "/api/" + OSM.API_VERSION + "/" + params.type + "/" + params.id;
129 if (params.type != "node") {
131 } else if (!params.visible) {
132 var previous_version = params.version - 1;
133 url += "/" + previous_version;
136 $("#object_larger_map").hide();
137 $("#object_edit").hide();
139 addObjectToMap(url, true, function(extent) {
140 $("#loading").hide();
141 $("#browse_map .geolink").show();
144 extent.transform(map.getProjectionObject(), map.displayProjection);
146 var centre = extent.getCenterLonLat();
148 $("a.bbox[data-editor=remote]").click(function (event) {
149 return remoteEditHandler(event, extent);
152 $("a.object[data-editor=remote]").click(function (event) {
153 return remoteEditHandler(event, extent, params.type + params.id);
156 $("#object_larger_map").show();
157 $("#object_edit").show();
159 updatelinks(centre.lon, centre.lat, 16, null, extent.left, extent.bottom, extent.right, extent.top, params.type, params.id);
161 $("#small_map").hide();
166 createMenu("area_edit", "area_edit_menu", "right");
167 createMenu("object_edit", "object_edit_menu", "right");
170 window.onload = init;