Description:
fix pdf to use inline display of browsers
Commit status:
[Not Reviewed]
References:
Diff options:
Comments:
0 Commit comments
0 Inline Comments
Unresolved TODOs:
There are no unresolved TODOs
r468:f6bcf3e1570d - - 2 files changed: 2 inserted, 1 deleted
@@ -39,37 +39,37 | |||
|
39 | 39 | redirect_to :action => 'index' and return |
|
40 | 40 | end |
|
41 | 41 | |
|
42 | 42 | puts "SENDING: #{filename}" |
|
43 | 43 | |
|
44 | 44 | send_file_to_user(filename, base_filename) |
|
45 | 45 | end |
|
46 | 46 | |
|
47 | 47 | protected |
|
48 | 48 | |
|
49 | 49 | def send_file_to_user(filename, base_filename) |
|
50 | 50 | if defined?(USE_APACHE_XSENDFILE) and USE_APACHE_XSENDFILE |
|
51 | 51 | response.headers['Content-Type'] = "application/force-download" |
|
52 | 52 | response.headers['Content-Disposition'] = "attachment; filename=\"#{File.basename(filename)}\"" |
|
53 | 53 | response.headers["X-Sendfile"] = filename |
|
54 | 54 | response.headers['Content-length'] = File.size(filename) |
|
55 | 55 | render :nothing => true |
|
56 | 56 | else |
|
57 | 57 | if params[:ext]=='pdf' |
|
58 | 58 | content_type = 'application/pdf' |
|
59 | 59 | else |
|
60 | 60 | content_type = 'application/octet-stream' |
|
61 | 61 | end |
|
62 | 62 | |
|
63 | - send_file filename, :stream => false, :filename => base_filename, :type => content_type | |
|
63 | + send_file filename, :stream => false, :disposition => 'inline', :filename => base_filename, :type => content_type | |
|
64 | 64 | end |
|
65 | 65 | end |
|
66 | 66 | |
|
67 | 67 | def check_viewability |
|
68 | 68 | @user = User.find(session[:user_id]) |
|
69 | 69 | if @user==nil or !GraderConfiguration.show_tasks_to?(@user) |
|
70 | 70 | redirect_to :controller => 'main', :action => 'list' |
|
71 | 71 | return false |
|
72 | 72 | end |
|
73 | 73 | end |
|
74 | 74 | |
|
75 | 75 | end |
You need to be logged in to leave comments.
Login now