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 %>
8 <span id="loading"><%= t 'browse.map.loading' %></span>
9 <%= link_to(t("browse.map.larger.area"), { :controller => :site, :action => :index, :box => "yes" }, { :id => "area_larger_map", :class => "geolink bbox" }) %>
11 <%= link_to(h(t("browse.map.edit.area")) + content_tag(:span, "▾", :class => "menuicon"), { :controller => :site, :action => :edit }, { :id => "area_edit", :class => "geolink bbox" }) %>
12 <% unless map.instance_of? Changeset %>
14 <%= link_to(t("browse.map.larger." + map.class.to_s.downcase), { :controller => :site, :action => :index }, { :id => "object_larger_map", :class => "geolink object" }) %>
16 <%= link_to(h(t("browse.map.edit." + map.class.to_s.downcase)) + content_tag(:span, "▾", :class => "menuicon"), { :controller => :site, :action => :edit }, { :id => "object_edit", :class => "geolink object" }) %>
19 <%= t 'browse.map.deleted' %>
23 <div id="area_edit_menu" class="menu">
25 <% Editors::ALL_EDITORS.each do |editor| %>
26 <li><%= link_to t('layouts.edit_with', :editor => t("editor.#{editor}.description")), { :controller => :site, :action => :edit, :editor => editor }, { :id => "#{editor}_area_edit", :class => "geolink bbox" } %></li>
31 <div id="object_edit_menu" class="menu">
33 <% Editors::ALL_EDITORS.each do |editor| %>
34 <li><%= link_to t('layouts.edit_with', :editor => t("editor.#{editor}.description")), { :controller => :site, :action => :edit, :editor => editor }, { :id => "#{editor}_object_edit", :class => "geolink object" } %></li>
39 <% if map.instance_of? Changeset or (map.instance_of? Node and map.version > 1) or map.visible %>
40 <script type="text/javascript">
41 function remoteEditHandler(event, bbox, select) {
42 var left = bbox.left - 0.0001;
43 var top = bbox.top + 0.0001;
44 var right = bbox.right + 0.0001;
45 var bottom = bbox.bottom - 0.0001;
48 $("#linkloader").load(function () { loaded = true; });
51 $("#linkloader").attr("src", "http://127.0.0.1:8111/load_and_zoom?left=" + left + "&top=" + top + "&right=" + right + "&bottom=" + bottom + "&select=" + select);
53 $("#linkloader").attr("src", "http://127.0.0.1:8111/load_and_zoom?left=" + left + "&top=" + top + "&right=" + right + "&bottom=" + bottom);
56 setTimeout(function () {
57 if (!loaded) alert("<%=j t('site.index.remote_failed') %>");
64 var map = createMap("small_map", {
65 controls: [ new OpenLayers.Control.Navigation() ]
68 <% if map.instance_of? Changeset -%>
69 <% bbox = map.bbox.to_unscaled %>
70 var minlon = <%= bbox.min_lon %>;
71 var minlat = <%= bbox.min_lat %>;
72 var maxlon = <%= bbox.max_lon %>;
73 var maxlat = <%= bbox.max_lat %>;
74 var bbox = new OpenLayers.Bounds(minlon, minlat, maxlon, maxlat);
75 var centre = bbox.getCenterLonLat();
77 map.zoomToExtent(proj(bbox));
81 $("#browse_map .geolink").show();
83 $("#remote_area_edit").click(function (event) {
84 return remoteEditHandler(event, bbox);
87 <% if preferred_editor == "remote" -%>
88 $("#area_edit").click(function (event) {
89 return remoteEditHandler(event, bbox);
93 updatelinks(centre.lon, centre.lat, 16, null, minlon, minlat, maxlon, maxlat);
95 var obj_type = "<%= map.class.name.downcase %>";
96 var obj_id = <%= map.id %>;
97 var obj_version = <%= map.version %>;
98 var obj_visible = <%= map.visible %>;
99 var url = "/api/<%= API_VERSION %>/<%= map.class.name.downcase %>/<%= map.id %>";
101 if (obj_type != "node") {
103 } else if (!obj_visible) {
104 var previous_version = obj_version - 1;
105 url += "/" + previous_version;
108 $("#object_larger_map").hide();
109 $("#object_edit").hide();
111 addObjectToMap(url, true, function(extent) {
112 $("#loading").hide();
113 $("#browse_map .geolink").show();
116 extent.transform(map.getProjectionObject(), map.displayProjection);
118 var centre = extent.getCenterLonLat();
120 $("#remote_area_edit").click(function (event) {
121 return remoteEditHandler(event, extent);
124 <% if preferred_editor == "remote" -%>
125 $("#area_edit").click(function (event) {
126 return remoteEditHandler(event, extent);
130 $("#remote_object_edit").click(function (event) {
131 return remoteEditHandler(event, extent, "<%= map.class.to_s.downcase + map.id.to_s %>");
134 <% if preferred_editor == "remote" -%>
135 $("#object_edit").click(function (event) {
136 return remoteEditHandler(event, extent, "<%= map.class.to_s.downcase + map.id.to_s %>");
140 $("#object_larger_map").show();
141 $("#object_edit").show();
143 updatelinks(centre.lon, centre.lat, 16, null, extent.left, extent.bottom, extent.right, extent.top, "<%= map.class.to_s.downcase %>", <%= map.id %>);
145 $("#small_map").hide();
150 createMenu("area_edit", "area_edit_menu", "right");
151 createMenu("object_edit", "object_edit_menu", "right");
154 window.onload = init;