app/controllers/jobs_controller.rb
# this is not really infile streaming any more, but should allow users to download
# their co-ordinates in a useful manner
this is not really infile streaming any more, but should allow users to download
their co-ordinates in a useful manner
this is not really infile streaming any more but should allow users to download their co - ordinates in a useful manner
def download_coords
    @job = Job.find(params[:id])
    continue = 0
    if @job.public
      continue = 1
    elsif !current_user
      authenticate_user!
    elsif !check_user(@job)
      flash[:alert] =  'Job not available'
      redirect_to :jobs and return
    else
      continue = 1
    end
    if continue == 1 
      output = "# coordinates for job #{@job.id}, prepared at #{Time.now}\n"
      output += @job.parameters[:coords]
      send_data output, :filename => "#{@job.id}.txt", :disposition => 'attachment', :type => 'text/plain'
    else
      flash[:alert] =  'Job not available, sorry'
      redirect_to :jobs and return
    end
  end
def download_coords @job = Job . find ( params [ :id ] ) continue = 0 if @job . public continue = 1 elsif ! current_user authenticate_user! elsif ! check_user ( @job ) flash [ :alert ] = 'Job not available' redirect_to :jobs and return else continue = 1 end if continue == 1 output = "# coordinates for job #{@job.id}, prepared at #{Time.now}\n" output += @job . parameters [ :coords ] send_data output , :filename => "#{@job.id}.txt" , :disposition => 'attachment' , :type => 'text/plain' else flash [ :alert ] = 'Job not available, sorry' redirect_to :jobs and return end end
this is not really infile streaming any more, but should allow users to download
their co-ordinates in a useful manner
this is not really infile streaming any more but should allow users to download their co - ordinates in a useful manner
# download here