aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfrancis <francis>2008-10-29 12:07:00 +0000
committerfrancis <francis>2008-10-29 12:07:00 +0000
commit49b27a6e9a79d05ed16277e98c5e6f25b69936a1 (patch)
tree668199eefd3ce53d0c0aa96e7ccd9ef43c9a91f9
parent428dbc12e7a175ab180955aa3d831c2cb49f6203 (diff)
Link to download raw emails from admin interface.
-rw-r--r--app/controllers/admin_request_controller.rb11
-rw-r--r--app/views/admin_request/show_raw_email.rhtml2
2 files changed, 12 insertions, 1 deletions
diff --git a/app/controllers/admin_request_controller.rb b/app/controllers/admin_request_controller.rb
index 70db7cd8a..85a4f3d82 100644
--- a/app/controllers/admin_request_controller.rb
+++ b/app/controllers/admin_request_controller.rb
@@ -4,7 +4,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: admin_request_controller.rb,v 1.24 2008-10-02 23:11:40 francis Exp $
+# $Id: admin_request_controller.rb,v 1.25 2008-10-29 12:07:00 francis Exp $
class AdminRequestController < ApplicationController
layout "admin"
@@ -210,6 +210,8 @@ class AdminRequestController < ApplicationController
def show_raw_email
@raw_email = RawEmail.find(params[:id])
+ # For the holding pen, use domain of email to try and guess which public body it
+ # is associated with, so we can display that.
@holding_pen = false
if (@raw_email.incoming_message.info_request == InfoRequest.holding_pen_request)
@holding_pen = true
@@ -224,6 +226,13 @@ class AdminRequestController < ApplicationController
end
end
+ def download_raw_email
+ @raw_email = RawEmail.find(params[:id])
+
+ response.content_type = 'message/rfc822'
+ render :text => @raw_email.data
+ end
+
private
end
diff --git a/app/views/admin_request/show_raw_email.rhtml b/app/views/admin_request/show_raw_email.rhtml
index 40c1e3957..011341c99 100644
--- a/app/views/admin_request/show_raw_email.rhtml
+++ b/app/views/admin_request/show_raw_email.rhtml
@@ -20,5 +20,7 @@
<h2>Raw email</h2>
+<%= link_to "Download", "../download_raw_email/" + @raw_email.id.to_s %>
+
<pre><%=h(@raw_email.data).gsub!(/\n/, '<br>') %></pre>