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



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

def email    

end

#load_objectsObject



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

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

#send_emailObject



26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# File 'app/controllers/export_email_controller.rb', line 26

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



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'app/controllers/export_email_controller.rb', line 44

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, 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



22
23
24
# File 'app/controllers/export_email_controller.rb', line 22

def txt    

end