1 <% if OSM_STATUS == :database_offline or OSM_STATUS == :api_offline %>
2 <p>The OpenStreetMap database is currently offline while
3 essential database maintenance work is carried out.
5 <% elsif OSM_STATUS == :database_readonly or OSM_STATUS == :api_readonly %>
6 <p>The OpenStreetMap database is currently in read-only mode while
7 essential database maintenance work is carried out.
9 <% elsif !@user.data_public? %>
10 <p>You haven't set your edits to be public.</p>
11 <p>You can no longer edit the map unless you do so. You can set your edits as public from your
12 <%= link_to 'user page', {:controller => 'user', :action => 'account', :display_name => @user.display_name, :anchor => 'public'}%>.</p>
13 <p>(<a href="http://wiki.openstreetmap.org/index.php/Disabling_anonymous_edits">Find out why this is the case.</a>)</p>
15 <% content_for :greeting do %>
16 <% if @user and !@user.home_lon.nil? and !@user.home_lat.nil? %>
17 <%= link_to_function 'home', "setPosition(#{@user.home_lat}, #{@user.home_lon}, 10)" %> |
21 <%= render :partial => 'sidebar', :locals => { :onopen => "resizeMap();", :onclose => "resizeMap();" } %>
22 <%= render :partial => 'search' %>
25 session[:token] = @user.tokens.create.token unless session[:token]
27 # Decide on a lat lon to initialise potlatch with. Various ways of doing this
28 if params['lon'] and params['lat']
29 lon = h(params['lon'])
30 lat = h(params['lat'])
31 zoom = h(params['zoom'])
33 elsif params['mlon'] and params['mlat']
34 lon = h(params['mlon'])
35 lat = h(params['mlat'])
36 zoom = h(params['zoom'])
39 # The user may pass a gpx and zoom
41 zoom = h(params['zoom'])
43 #use gpx id to locate (dealt with below)
45 elsif cookies.key?("_osm_location")
46 lon,lat,zoom,layers = cookies["_osm_location"].split("|")
48 elsif @user and !@user.home_lon.nil? and !@user.home_lat.nil?
53 #catch all. Do nothing. lat=nil, lon=nil
54 #Currently this results in potlatch starting up at 0,0 (Atlantic ocean).
57 zoom='14' if zoom.nil?
61 You need a Flash player to use Potlatch, the
62 OpenStreetMap Flash editor. You can <a href="http://www.adobe.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash">download Flash Player from Adobe.com</a>.
64 <a href="http://wiki.openstreetmap.org/index.php/Editing">Several other options</a> are also available
65 for editing OpenStreetMap.
68 <%= javascript_include_tag 'swfobject.js' %>
69 <script type="text/javascript" defer="defer">
70 var brokenContentSize = $("content").offsetWidth == 0;
71 var fo = new SWFObject("/potlatch/potlatch.swf?d="+Math.round(Math.random()*1000), "potlatch", "100%", "100%", "6", "#FFFFFF");
72 // 700,600 for fixed size, 100%,100% for resizable
74 var winie=false; if (document.all && window.print) { winie=true; }
76 window.onbeforeunload=function() {
77 if (!changesaved && !winie) {
78 return "You have unsaved changes. (To save in Potlatch, you should deselect the current way or point.)";
82 function markChanged(a) { changesaved=a; }
84 function doSWF(lat,lon,sc) {
86 fo.addVariable('scale',sc);
87 fo.addVariable('token','<%= session[:token] %>');
88 if (lat) { fo.addVariable('lat',lat); }
89 if (lon) { fo.addVariable('long',lon); }
90 if (zoom) { fo.addVariable('zoom',zoom); }
91 <% if params['gpx'] %>fo.addVariable('gpx' ,'<%= h(params['gpx'] ) %>');<% end %>
92 <% if params['way'] %>fo.addVariable('way' ,'<%= h(params['way'] ) %>');<% end %>
93 <% if params['node'] %>fo.addVariable('node','<%= h(params['node']) %>');<% end %>
97 doSWF(<%= lat || 'null' %>,<%= lon || 'null' %>,<%= zoom %>);
99 function setPosition(lat, lon, zoom) {
100 doSWF(lat, lon, zoom);
103 function resizeContent() {
104 var content = $("content");
105 var rightMargin = parseInt(getStyle(content, "right"));
106 var bottomMargin = parseInt(getStyle(content, "bottom"));
108 content.style.width = document.documentElement.clientWidth - content.offsetLeft - rightMargin;
109 content.style.height = document.documentElement.clientHeight - content.offsetTop - bottomMargin;
112 function resizeMap() {
113 var sidebar_width = $("sidebar").offsetWidth;
115 if (sidebar_width > 0) {
116 sidebar_width = sidebar_width + 5
119 $("map").style.left = (sidebar_width) + "px";
120 $("map").style.width = ($("content").offsetWidth - sidebar_width) + "px";
121 $("map").style.height = ($("content").offsetHeight - 2) + "px";
124 function handleResize() {
125 if (brokenContentSize) {
132 function maximiseMap() {
133 $("left").style.display = "none";
134 $("greeting").style.display = "none";
135 $("tabnav").style.display = "none";
137 $("content").style.top = "10px";
138 $("content").style.left = "10px";
143 function minimiseMap() {
144 $("left").style.display = "";
145 $("greeting").style.display = "";
146 $("tabnav").style.display = "";
148 $("content").style.top = "35px";
149 $("content").style.left = "192px";
156 window.onload = handleResize;
157 window.onresize = handleResize;