- do_create(name, params[:trace][:tagstring], params[:trace][:description], params[:trace][:public]) do |f|
- f.write(params[:trace][:gpx_file].read)
+ redirect_to :action => 'mine'
+ end
+ else
+ @trace = Trace.new({:name => "Dummy",
+ :tagstring => params[:trace][:tagstring],
+ :description => params[:trace][:description],
+ :public => params[:trace][:public],
+ :inserted => false, :user => @user,
+ :timestamp => Time.now.getutc})
+ @trace.valid?
+ @trace.errors.add(:gpx_file, "can't be blank")
+ end
+ end
+ @title = t 'trace.create.upload_trace'
+ end
+
+ def data
+ trace = Trace.find(params[:id])
+
+ if trace.visible? and (trace.public? or (@user and @user == trace.user))
+ if request.format == Mime::XML
+ send_file(trace.xml_file, :filename => "#{trace.id}.xml", :type => Mime::XML.to_s, :disposition => 'attachment')
+ else
+ send_file(trace.trace_name, :filename => "#{trace.id}#{trace.extension_name}", :type => trace.mime_type, :disposition => 'attachment')
+ end
+ else
+ render :nothing => true, :status => :not_found