attachment view

This commit is contained in:
Eugene Korbut 2009-02-08 06:18:14 +10:00
parent 9c9ccc429d
commit f5edf91670
2 changed files with 8 additions and 8 deletions

View file

@ -438,11 +438,11 @@ class WebmailController < ApplicationController
else else
disposition = "attachment" disposition = "attachment"
end end
@headers['Content-Length'] = part.body.size headers['Content-Length'] = part.body.size
@response.headers['Accept-Ranges'] = 'bytes' response.headers['Accept-Ranges'] = 'bytes'
@headers['Content-type'] = part.content_type.strip headers['Content-type'] = part.content_type.strip
@headers['Content-Disposition'] = disposition << %(; filename="#{part.header['content-type']['name']}") headers['Content-Disposition'] = disposition << %(; filename="#{part.header['content-type']['name']}")
render_text part.body render :text => part.body
end end
def get_parts(mail) def get_parts(mail)

View file

@ -126,13 +126,13 @@ module Mail2Screen
if filename == "" if filename == ""
"" ""
else else
"<span class='attachment'>&nbsp;<a href='/webmail/webmail/download?msg_id=#{msg_id}&ctype=" << CGI.escape(filename) << "'>#{filename}</a></span>" "<span class='attachment'>&nbsp;<a href='/webmail/download?msg_id=#{msg_id}&ctype=" << CGI.escape(filename) << "'>#{filename}</a></span>"
end end
end end
def add_image(content_type, msg_id) def add_image(content_type, msg_id)
filename = (content_type.nil? or content_type['name'].nil? ? "" : content_type['name']) filename = (content_type.nil? or content_type['name'].nil? ? "" : content_type['name'])
"<hr/><span class='attachment'><br/><img src='/webmail/webmail/download?msg_id=#{msg_id}&ctype=" << CGI.escape(filename) << "' alt='#{filename}'/></span>" "<hr/><span class='attachment'><br/><img src='/webmail/download?msg_id=#{msg_id}&ctype=" << CGI.escape(filename) << "' alt='#{filename}'/></span>"
end end
def friendly_address(addr) def friendly_address(addr)
@ -164,4 +164,4 @@ module Mail2Screen
} unless addresses.nil? } unless addresses.nil?
return ret return ret
end end
end end