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
disposition = "attachment"
end
@headers['Content-Length'] = part.body.size
@response.headers['Accept-Ranges'] = 'bytes'
@headers['Content-type'] = part.content_type.strip
@headers['Content-Disposition'] = disposition << %(; filename="#{part.header['content-type']['name']}")
render_text part.body
headers['Content-Length'] = part.body.size
response.headers['Accept-Ranges'] = 'bytes'
headers['Content-type'] = part.content_type.strip
headers['Content-Disposition'] = disposition << %(; filename="#{part.header['content-type']['name']}")
render :text => part.body
end
def get_parts(mail)

View file

@ -126,13 +126,13 @@ module Mail2Screen
if filename == ""
""
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
def add_image(content_type, msg_id)
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
def friendly_address(addr)
@ -164,4 +164,4 @@ module Mail2Screen
} unless addresses.nil?
return ret
end
end
end