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 #use gpx id to locate (dealt with below)
41 elsif cookies.key?("_osm_location")
42 lon,lat,zoom,layers = cookies["_osm_location"].split("|")
44 elsif @user and !@user.home_lon.nil? and !@user.home_lat.nil?
49 #catch all. Do nothing. lat=nil, lon=nil
50 #Currently this results in potlatch starting up at 0,0 (Atlantic ocean).
53 zoom='14' if zoom.nil?
57 You need a Flash player to use Potlatch, the
58 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>.
60 <a href="http://wiki.openstreetmap.org/index.php/Editing">Several other options</a> are also available
61 for editing OpenStreetMap.
64 <%= javascript_include_tag 'swfobject.js' %>
65 <script type="text/javascript" defer="defer">
66 var brokenContentSize = $("content").offsetWidth == 0;
67 var fo = new SWFObject("/potlatch/potlatch.swf?d="+Math.round(Math.random()*1000), "potlatch", "100%", "100%", "6", "#FFFFFF");
68 // 700,600 for fixed size, 100%,100% for resizable
70 var winie=false; if (document.all && window.print) { winie=true; }
72 window.onbeforeunload=function() {
73 if (!changesaved && !winie) {
74 return "You have unsaved changes. (To save in Potlatch, you should deselect the current way or point.)";
78 function markChanged(a) { changesaved=a; }
80 function doSWF(lat,lon,sc) {
82 fo.addVariable('scale',sc);
83 fo.addVariable('token','<%= session[:token] %>');
84 if (lat) { fo.addVariable('lat',lat); }
85 if (lon) { fo.addVariable('long',lon); }
86 <% if params['gpx'] %>fo.addVariable('gpx' ,'<%= h(params['gpx'] ) %>');<% end %>
87 <% if params['way'] %>fo.addVariable('way' ,'<%= h(params['way'] ) %>');<% end %>
88 <% if params['node'] %>fo.addVariable('node','<%= h(params['node']) %>');<% end %>
92 doSWF(<%= lat || 'null' %>,<%= lon || 'null' %>,<%= zoom %>);
94 function setPosition(lat, lon, zoom) {
95 doSWF(lat, lon, zoom);
98 function resizeContent() {
99 var content = $("content");
100 var rightMargin = parseInt(getStyle(content, "right"));
101 var bottomMargin = parseInt(getStyle(content, "bottom"));
103 content.style.width = document.documentElement.clientWidth - content.offsetLeft - rightMargin;
104 content.style.height = document.documentElement.clientHeight - content.offsetTop - bottomMargin;
107 function resizeMap() {
108 var sidebar_width = $("sidebar").offsetWidth;
110 if (sidebar_width > 0) {
111 sidebar_width = sidebar_width + 5
114 $("map").style.left = (sidebar_width) + "px";
115 $("map").style.width = ($("content").offsetWidth - sidebar_width) + "px";
116 $("map").style.height = ($("content").offsetHeight - 2) + "px";
119 function handleResize() {
120 if (brokenContentSize) {
127 function maximiseMap() {
128 $("left").style.display = "none";
129 $("greeting").style.display = "none";
130 $("tabnav").style.display = "none";
132 $("content").style.top = "10px";
133 $("content").style.left = "10px";
138 function minimiseMap() {
139 $("left").style.display = "";
140 $("greeting").style.display = "";
141 $("tabnav").style.display = "";
143 $("content").style.top = "35px";
144 $("content").style.left = "192px";
151 window.onload = handleResize;
152 window.onresize = handleResize;