+ # fixme throw an error here
+ # render :action => 'mine'
+ end
+ end
+
+ def data
+ trace = Trace.find(params[:id])
+ if trace.public? or (@user and @user == trace.user)
+ send_data(File.open("/tmp/#{trace.id}.gpx",'r').read , :filename => "#{trace.id}.gpx", :type => 'text/plain', :disposition => 'inline')
+ end
+ end
+
+ def make_public
+ trace = Trace.find(params[:id])
+ if @user and trace.user == @user and !trace.public
+ trace.public = true
+ trace.save
+ flash[:notice] = 'Track made public'
+ redirect_to :controller => 'trace', :action => 'view', :id => params[:id]