+
+ 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
+ end
+ rescue ActiveRecord::RecordNotFound
+ render :nothing => true, :status => :not_found
+ end
+
+ def edit
+ @trace = Trace.find(params[:id])
+
+ if @user and @trace.user == @user
+ if params[:trace]
+ @trace.description = params[:trace][:description]
+ @trace.tagstring = params[:trace][:tagstring]
+ if @trace.save
+ redirect_to :action => 'view'
+ end
+ end
+ else
+ render :nothing => true, :status => :forbidden
+ end
+ rescue ActiveRecord::RecordNotFound
+ render :nothing => true, :status => :not_found
+ end
+
+ def delete
+ trace = Trace.find(params[:id])
+
+ if @user and trace.user == @user
+ if request.post? and trace.visible?
+ trace.visible = false
+ trace.save
+ flash[:notice] = 'Track scheduled for deletion'
+ redirect_to :controller => 'traces', :action => 'mine'
+ else
+ render :nothing => true, :status => :bad_request
+ end