aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/request_controller.rb4
-rw-r--r--app/models/incoming_message.rb10
2 files changed, 7 insertions, 7 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb
index d2500dc21..6488ad726 100644
--- a/app/controllers/request_controller.rb
+++ b/app/controllers/request_controller.rb
@@ -578,11 +578,11 @@ class RequestController < ApplicationController
# the same cache code in cache_attachments above will display them.
image_dir = File.dirname(ActionController::Base.cache_store.cache_path + "/views" + url_for(params.merge(:only_path => true)))
FileUtils.mkdir_p(image_dir)
- html, wrapper_class = @attachment.body_as_html(image_dir)
+ html, wrapper_id = @attachment.body_as_html(image_dir)
view_html_stylesheet = render_to_string :partial => "request/view_html_stylesheet"
html.sub!(/<head>/i, "<head>" + view_html_stylesheet)
- html.sub!(/<body[^>]*>/i, '<body><prefix-here><div id="wrapper" class="' + wrapper_class + '"><div id="view_html_content">')
+ html.sub!(/<body[^>]*>/i, '<body><prefix-here><div id="' + wrapper_id + '"><div id="view_html_content">')
html.sub!(/<\/body[^>]*>/i, '</div></div></body>')
view_html_prefix = render_to_string :partial => "request/view_html_prefix"
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb
index 242fc3ebf..4bab7b6ec 100644
--- a/app/models/incoming_message.rb
+++ b/app/models/incoming_message.rb
@@ -341,7 +341,7 @@ class FOIAttachment
# For "View as HTML" of attachment
def body_as_html(dir)
html = nil
- wrapper_class = "default_output"
+ wrapper_id = "wrapper"
# simple cases, can never fail
if self.content_type == 'text/plain'
@@ -349,7 +349,7 @@ class FOIAttachment
text = CGI.escapeHTML(text)
text = MySociety::Format.make_clickable(text)
html = text.gsub(/\n/, '<br>')
- return "<html><head></head><body>" + html + "</body></html>", wrapper_class
+ return "<html><head></head><body>" + html + "</body></html>", wrapper_id
end
# the extractions will also produce image files, which go in the
@@ -368,7 +368,7 @@ class FOIAttachment
elsif self.content_type == 'application/vnd.ms-excel'
IO.popen("/usr/bin/xlhtml -a " + tempfile.path + "", "r") do |child|
html = child.read()
- wrapper_class = "xhtml_output"
+ wrapper_id = "wrapper_xlhtml"
end
elsif self.content_type == 'application/pdf'
IO.popen("/usr/bin/pdftohtml -nodrm -zoom 1.0 -stdout -enc UTF-8 -noframes " + tempfile.path + "", "r") do |child|
@@ -398,10 +398,10 @@ class FOIAttachment
body_without_tags = body.gsub(/\s+/,"").gsub(/\<[^\>]*\>/, "")
contains_images = html.match(/<img/mi) ? true : false
if !$?.success? || html.size == 0 || (body_without_tags.size == 0 && !contains_images)
- return "<html><head></head><body><p>Sorry, the conversion to HTML failed. Please use the download link at the top right.</p></body></html>"
+ return "<html><head></head><body><p>Sorry, the conversion to HTML failed. Please use the download link at the top right.</p></body></html>", wrapper_id
end
- return html, wrapper_class
+ return html, wrapper_id
end
end