]> git.openstreetmap.org Git - rails.git/blob - app/views/site/edit.rhtml
more work on the data browser to show the changesets. Also showing the version number...
[rails.git] / app / views / site / edit.rhtml
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.
4 </p>
5 <% elsif OSM_STATUS == :api_readonly %>
6 <p>The OpenStreetMap database is currently in read-only mode while
7    essential database maintenance work is carried out.
8 </p>
9 <% elsif !@user.data_public? %>
10 <p>You haven't set your edits to be public.</p>
11 <p>You can't use the online editor 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}%>.</p>
13 <p>(<a href="http://wiki.openstreetmap.org/index.php/Disabling_anonymous_edits">Find out why this is the case.</a>)</p>
14 <% else %>
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)" %> |
18 <% end %>
19 <% end %>
20
21 <%= render :partial => 'sidebar', :locals => { :onopen => "resizeMap();", :onclose => "resizeMap();" } %>
22 <%= render :partial => 'search' %>
23
24 <% session[:token] = @user.tokens.create.token unless session[:token] %>
25
26 <% if params['mlon'] and params['mlat'] %>
27         <% lon =  h(params['mlon']) %>
28         <% lat =  h(params['mlat'])  %>
29         <% zoom =  h(params['zoom'] || '14') %>
30 <% elsif @user and params['lon'].nil? and params['lat'].nil? and params['gpx'].nil? %> 
31         <% lon =  @user.home_lon %>
32         <% lat =  @user.home_lat %>
33         <% zoom = '14' %>
34 <% else %>
35         <% lon =  h(params['lon'] || 'null') %>
36         <% lat =  h(params['lat'] || 'null') %>
37         <% zoom =  h(params['zoom'] || '14') %>
38 <% end %>
39
40 <div id="map">
41         You need a Flash player to use Potlatch, the
42     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>.
43
44     <a href="http://wiki.openstreetmap.org/index.php/Editing">Several other options</a> are also available
45     for editing OpenStreetMap.
46 </div>
47
48 <%= javascript_include_tag 'swfobject.js' %>
49 <script type="text/javascript" defer="defer">
50   var brokenContentSize = $("content").offsetWidth == 0;
51   var fo = new SWFObject("<%= compute_public_path("potlatch.swf", "potlatch") %>", "potlatch", "100%", "100%", "6", "#FFFFFF");
52   // 700,600 for fixed size, 100%,100% for resizable
53   var changesaved=true;
54   var winie=false; if (document.all && window.print) { winie=true; }
55   
56   window.onbeforeunload=function() {
57         if (!changesaved && !winie) {
58             return "You have unsaved changes. (To save in Potlatch, you should deselect the current way or point.)";
59         }
60   }
61
62   function doSWF(lat,lon,sc) {
63     if (sc < 11) sc = 11;
64     fo.addVariable('scale',sc);
65     fo.addVariable('token','<%= session[:token] %>');
66     if (lat) { fo.addVariable('lat',lat); }
67     if (lon) { fo.addVariable('long',lon); }
68     <% if params['gpx']  %>fo.addVariable('gpx' ,'<%= h(params['gpx'] ) %>');<% end %>
69     <% if params['way']  %>fo.addVariable('way' ,'<%= h(params['way'] ) %>');<% end %>
70     <% if params['node'] %>fo.addVariable('node','<%= h(params['node']) %>');<% end %>
71     fo.write("map");
72   }
73
74   doSWF(<%= lat || 'null' %>,<%= lon || 'null' %>,<%= zoom %>);
75
76   function setPosition(lat, lon, zoom) {
77     doSWF(lat, lon, zoom);
78   }
79
80   function resizeContent() {
81     var content = $("content");
82     var rightMargin = parseInt(getStyle(content, "right"));
83     var bottomMargin = parseInt(getStyle(content, "bottom"));
84
85     content.style.width = document.documentElement.clientWidth - content.offsetLeft - rightMargin;
86     content.style.height = document.documentElement.clientHeight - content.offsetTop - bottomMargin;
87   }
88   
89   function resizeMap() {
90     var sidebar_width = $("sidebar").offsetWidth;
91
92     if (sidebar_width > 0) {
93       sidebar_width = sidebar_width + 5
94     }
95
96     $("map").style.left = (sidebar_width) + "px";
97     $("map").style.width = ($("content").offsetWidth - sidebar_width) + "px";
98     $("map").style.height = ($("content").offsetHeight - 2) + "px";
99   }
100
101   function handleResize() {
102     if (brokenContentSize) {
103       resizeContent();
104     }
105
106     resizeMap();
107   }
108
109   function maximiseMap() {
110     $("left").style.display = "none";
111     $("greeting").style.display = "none";
112     $("tabnav").style.display = "none";
113
114     $("content").style.top = "10px";
115     $("content").style.left = "10px";
116
117     handleResize();
118   }
119   
120   function minimiseMap() {
121     $("left").style.display = "";
122     $("greeting").style.display = "";
123     $("tabnav").style.display = "";
124
125     $("content").style.top = "35px";
126     $("content").style.left = "192px";
127
128     handleResize();
129   }
130
131   handleResize();
132
133   window.onload = handleResize;
134   window.onresize = handleResize;
135 </script>
136 <% end %>