aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/models/incoming_message.rb30
-rw-r--r--public/images/icon_application_vnd.ms-excel_large.png (renamed from public/images/icon_application_msexcel_large.png)bin2891 -> 2891 bytes
-rw-r--r--public/images/icon_application_vnd.ms-powerpoint_large.pngbin0 -> 2495 bytes
-rw-r--r--public/images/icon_application_vnd.ms-word_large.png (renamed from public/images/icon_application_msword_large.png)bin2775 -> 2775 bytes
-rw-r--r--todo.txt8
5 files changed, 28 insertions, 10 deletions
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb
index 390467bb5..65fc8efb5 100644
--- a/app/models/incoming_message.rb
+++ b/app/models/incoming_message.rb
@@ -18,7 +18,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: incoming_message.rb,v 1.117 2008-07-08 09:41:04 francis Exp $
+# $Id: incoming_message.rb,v 1.118 2008-07-10 13:30:25 francis Exp $
# TODO
# Move some of the (e.g. quoting) functions here into rblib, as they feel
@@ -43,13 +43,14 @@ module TMail
end
# To add an image, create a file with appropriate name corresponding to the
-# mime type in public/images e.g. icon_application_msexcel_large.png
+# mime type in public/images e.g. icon_image_tiff_large.png
$file_extension_to_mime_type = {
"txt" => 'text/plain',
"pdf" => 'application/pdf',
- "doc" => 'application/msword',
"rtf" => 'application/rtf',
- "xls" => 'application/msexcel',
+ "doc" => 'application/vnd.ms-word',
+ "xls" => 'application/vnd.ms-excel',
+ "ppt" => 'application/vnd.ms-powerpoint',
"tif" => 'image/tiff',
"gif" => 'image/gif',
"jpg" => 'image/jpeg', # XXX add jpeg
@@ -366,11 +367,14 @@ class IncomingMessage < ActiveRecord::Base
end
end
# e.g. http://www.whatdotheyknow.com/request/93/response/250
- if curr_mail.content_type == 'application/vnd.ms-excel'
- curr_mail.content_type = 'application/msexcel'
+ if curr_mail.content_type == 'application/msexcel'
+ curr_mail.content_type = 'application/vnd.ms-excel'
end
- if curr_mail.content_type == 'application/vnd.ms-word'
- curr_mail.content_type = 'application/msword'
+ if curr_mail.content_type == 'application/mspowerpoint'
+ curr_mail.content_type = 'application/vnd.ms-powerpoint'
+ end
+ if curr_mail.content_type = 'application/msword'
+ curr_mail.content_type == 'application/vnd.ms-word'
end
# If the part is an attachment of email in text form
if curr_mail.content_type == 'message/rfc822'
@@ -629,7 +633,7 @@ class IncomingMessage < ActiveRecord::Base
tempfile = Tempfile.new('foiextract')
tempfile.print attachment.body
tempfile.flush
- if attachment.content_type == 'application/msword'
+ if attachment.content_type == 'application/vnd.ms-word'
system("/usr/bin/wvText " + tempfile.path + " " + tempfile.path + ".txt")
# Try catdoc if we get into trouble (e.g. for InfoRequestEvent 2701)
if not File.exists?(tempfile.path + ".txt")
@@ -648,7 +652,7 @@ class IncomingMessage < ActiveRecord::Base
IO.popen("/usr/bin/lynx -force_html -dump " + tempfile.path, "r") do |child|
text += child.read() + "\n\n"
end
- elsif attachment.content_type == 'application/msexcel'
+ elsif attachment.content_type == 'application/vnd.ms-excel'
# Bit crazy using strings - but xls2csv, xlhtml and py_xls2txt
# only extract text from cells, not from floating notes. catdoc
# may be fooled by weird character sets, but will probably do for
@@ -656,6 +660,12 @@ class IncomingMessage < ActiveRecord::Base
IO.popen("/usr/bin/strings " + tempfile.path, "r") do |child|
text += child.read() + "\n\n"
end
+ elsif attachment.content_type == 'application/vnd.ms-powerpoint'
+ # ppthtml seems to catch more text, but only outputs HTML when
+ # we want text, so just use catppt for now
+ IO.popen("/usr/bin/catppt " + tempfile.path, "r") do |child|
+ text += child.read() + "\n\n"
+ end
elsif attachment.content_type == 'application/pdf'
IO.popen("/usr/bin/pdftotext " + tempfile.path + " -", "r") do |child|
text += child.read() + "\n\n"
diff --git a/public/images/icon_application_msexcel_large.png b/public/images/icon_application_vnd.ms-excel_large.png
index 3f346f5ef..3f346f5ef 100644
--- a/public/images/icon_application_msexcel_large.png
+++ b/public/images/icon_application_vnd.ms-excel_large.png
Binary files differ
diff --git a/public/images/icon_application_vnd.ms-powerpoint_large.png b/public/images/icon_application_vnd.ms-powerpoint_large.png
new file mode 100644
index 000000000..82c225059
--- /dev/null
+++ b/public/images/icon_application_vnd.ms-powerpoint_large.png
Binary files differ
diff --git a/public/images/icon_application_msword_large.png b/public/images/icon_application_vnd.ms-word_large.png
index 91a696ab5..91a696ab5 100644
--- a/public/images/icon_application_msword_large.png
+++ b/public/images/icon_application_vnd.ms-word_large.png
Binary files differ
diff --git a/todo.txt b/todo.txt
index 3e2788eb5..75bd78879 100644
--- a/todo.txt
+++ b/todo.txt
@@ -30,6 +30,8 @@ pages.
Next
====
+It's terribly slow.
+
https://secure.mysociety.org/cvstrac/tktview?tn=1032
Add ppt icon
@@ -46,6 +48,8 @@ Advertise alerts on end pages with WDTK
Internal review marker
+Redo the RSS feeds
+
Antispam on contact form
Incoming email to unknown FOI is a bit rubbish
@@ -68,6 +72,10 @@ Needs tagline that v. quickly explains what site is on each page
Later
=====
+Catch query parser error, e.g. for this query
+ water NOT NEAR "water lane"
+Document such errors in acts_as_xapian
+
It's looking very nice! I had a look at the M27 request, as per your
earlier email, but I was a bit thrown by the date - is it the 27th
today, or last week, or more recently. Do you think it would be