Merge 14059:14394 from trunk.
This commit is contained in:
commit
1f8a68371a
13 changed files with 51 additions and 35 deletions
|
@ -304,20 +304,37 @@ class TraceController < ApplicationController
|
|||
private
|
||||
|
||||
def do_create(file, tags, description, public)
|
||||
# Sanitise the user's filename
|
||||
name = file.original_filename.gsub(/[^a-zA-Z0-9.]/, '_')
|
||||
|
||||
# Get a temporary filename...
|
||||
filename = "/tmp/#{rand}"
|
||||
|
||||
# ...and save the uploaded file to that location
|
||||
File.open(filename, "w") { |f| f.write(file.read) }
|
||||
|
||||
@trace = Trace.new({:name => name, :tagstring => tags,
|
||||
:description => description, :public => public})
|
||||
@trace.inserted = false
|
||||
@trace.user = @user
|
||||
@trace.timestamp = Time.now.getutc
|
||||
# Create the trace object, falsely marked as already
|
||||
# inserted to stop the import daemon trying to load it
|
||||
@trace = Trace.new({
|
||||
:name => name,
|
||||
:tagstring => tags,
|
||||
:description => description,
|
||||
:public => public,
|
||||
:inserted => true,
|
||||
:user => @user,
|
||||
:timestamp => Time.now.getutc
|
||||
})
|
||||
|
||||
# Save the trace object
|
||||
if @trace.save
|
||||
# Rename the temporary file to the final name
|
||||
FileUtils.mv(filename, @trace.trace_name)
|
||||
|
||||
# Clear the inserted flag to make the import daemon load the trace
|
||||
@trace.inserted = false
|
||||
@trace.save!
|
||||
else
|
||||
# Remove the file as we have failed to update the database
|
||||
FileUtils.rm_f(filename)
|
||||
end
|
||||
|
||||
|
|
|
@ -102,7 +102,7 @@
|
|||
<% end %>
|
||||
|
||||
<% if false %>
|
||||
<div id="donate">
|
||||
<div id="donate" class="notice">
|
||||
Support OpenStreetMap by
|
||||
<a href="http://donate.openstreetmap.org/">donating</a>
|
||||
to the Hardware Upgrade Fund.
|
||||
|
@ -116,6 +116,12 @@
|
|||
<%= yield :left_menu %>
|
||||
</div>
|
||||
|
||||
<div id="sotm" class="notice">
|
||||
Come to the 2009 OpenStreetMap
|
||||
Conference, <a href="http://www.stateofthemap.org">The State
|
||||
of the Map</a>, July 10-12 in Amsterdam!
|
||||
</div>
|
||||
|
||||
<%= yield :optionals %>
|
||||
|
||||
<center>
|
||||
|
|
|
@ -9,7 +9,8 @@
|
|||
|
||||
if (zoomlevel<7 ) { var imgname = 'keymapnik6.png'; }
|
||||
else if (zoomlevel<13) { var imgname = 'keymapnik'+zoomlevel+'.png'; }
|
||||
else { var imgname = 'keymapnik13.png'; }
|
||||
else if (zoomlevel<15) { var imgname = 'keymapnik13.png'; }
|
||||
else { var imgname = 'keymapnik15.png'; }
|
||||
|
||||
updateSidebar("Map key", "<p><img src='images/"+imgname+"' /><\/p>");
|
||||
openSidebar({ width: "210px" });
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue