X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/936a005f9f3757508a06eaa930d5e5c4efcfbe40..a12b0878bc338cd5ec3c315c14148b1ea07b362a:/app/views/site/index.html.erb diff --git a/app/views/site/index.html.erb b/app/views/site/index.html.erb index e417c2695..fa790dbb1 100644 --- a/app/views/site/index.html.erb +++ b/app/views/site/index.html.erb @@ -20,6 +20,7 @@
@@ -66,7 +67,13 @@ if params['node'] or params['way'] or params['relation'] end # Decide on a lat lon to initialise the map with. Various ways of doing this -if params['minlon'] and params['minlat'] and params['maxlon'] and params['maxlat'] +if params['bbox'] + bbox = true + minlon, minlat, maxlon, maxlat = h(params['bbox']).split(",") + layers = h(params['layers']) + box = true if params['box']=="yes" + object_zoom = false +elsif params['minlon'] and params['minlat'] and params['maxlon'] and params['maxlat'] bbox = true minlon = h(params['minlon']) minlat = h(params['minlat']) @@ -116,6 +123,7 @@ end <%= javascript_include_tag '/openlayers/OpenLayers.js' %> <%= javascript_include_tag '/openlayers/OpenStreetMap.js' %> +<%= javascript_include_tag 'notes.js' %> <%= javascript_include_tag 'map.js' %> <%= render :partial => 'resize' %> @@ -126,6 +134,10 @@ end OpenLayers.Lang.setCode("<%= I18n.locale.to_s %>"); + <% if @user %> + var loginName = "<%= @user.display_name %>" + <% end %> + function mapInit(){ map = createMap("map"); @@ -133,6 +145,20 @@ end map.dataLayer = new OpenLayers.Layer("<%= I18n.t 'browse.start_rjs.data_layer_name' %>", { "visibility": false }); map.dataLayer.events.register("visibilitychanged", map.dataLayer, toggleData); map.addLayer(map.dataLayer); + + map.noteLayer = new OpenLayers.Layer.Notes("Notes", { + setCookie: false, + permalinkURL: "http://www.openstreetmap.org/", + visibility: <%= params[:notes] == "yes" %> + }); + map.addLayer(map.noteLayer); + + map.noteControl = new OpenLayers.Control.Notes(map.noteLayer); + map.addControl(map.noteControl); + + $("createnoteanchor").observe("click", addNote); + + map.events.register("zoomend", map, allowNoteReports); <% end %> <% unless object_zoom %> @@ -261,6 +287,19 @@ end <% end %> } + function addNote() { + map.noteControl.activate(); + map.noteControl.addTemporaryMarker(map.getCenter()); + } + + function allowNoteReports() { + if (map.getZoom() > 11) { + $("createnoteanchor").style.visibility = "visible"; + } else { + $("createnoteanchor").style.visibility = "hidden"; + } + } + document.observe("dom:loaded", mapInit); document.observe("dom:loaded", installEditHandler); document.observe("dom:loaded", handleResize);