Class: ExportEmailController

Inherits:
UmlautController show all
Defined in:
app/controllers/export_email_controller.rb

Instance Method Summary collapse

Methods included from UmlautConfigurable

set_default_configuration!

Instance Method Details

#emailObject



17
18
# File 'app/controllers/export_email_controller.rb', line 17

def email    
end

#load_objectsObject



12
13
14
15
# File 'app/controllers/export_email_controller.rb', line 12

def load_objects
  @svc_response = ServiceResponse.find(params[:id])
  @user_request = @svc_response.request if @svc_response
end

#send_emailObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'app/controllers/export_email_controller.rb', line 23

def send_email
  @email = params[:email]
  @fulltexts = @user_request.get_service_type('fulltext', { :refresh=>true })
  @holdings = @user_request.get_service_type('holding', { :refresh=>true })
  if valid_email?
    Emailer.citation(@email, @user_request, @fulltexts, @holdings).deliver 
    respond_to do |format|
      format.html {  render }
    end
  else
    @partial = "email"
    flash[:error] = email_validation_error
    redirect_to params_preserve_xhr(params.merge(:action => "email"))        
  end
end

#send_txtObject



39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
# File 'app/controllers/export_email_controller.rb', line 39

def send_txt
  @number = params[:number]
  # Remove any punctuation or spaces etc
  @number.gsub!(/[^\d]/, '') if @number
  @provider = params[:provider]
  @email = "#{@number}@#{@provider}" unless @number.nil? or @provider.nil?
  @holding_id = params[:holding]
  if valid_txt_number? && valid_txt_holding?
    Emailer.short_citation(@email, @user_request, holding_location(@holding_id), call_number(@holding_id)).deliver 
    render # send_txt.rhtml       
  else        
    flash[:error] = txt_validation_error        
    redirect_to params_preserve_xhr(params.merge(:action => "txt"))
  end    
end

#txtObject



20
21
# File 'app/controllers/export_email_controller.rb', line 20

def txt    
end