diff options
-rw-r--r-- | app/models/incoming_message.rb | 18 | ||||
-rw-r--r-- | app/models/info_request_event.rb | 11 | ||||
-rw-r--r-- | app/views/general/search.rhtml | 1 | ||||
-rw-r--r-- | app/views/layouts/default.rhtml | 2 | ||||
-rw-r--r-- | todo.txt | 16 |
5 files changed, 38 insertions, 10 deletions
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb index 0d4a07d00..5e57694c2 100644 --- a/app/models/incoming_message.rb +++ b/app/models/incoming_message.rb @@ -19,7 +19,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.137 2008-08-29 21:40:55 francis Exp $ +# $Id: incoming_message.rb,v 1.138 2008-08-29 22:39:36 francis Exp $ # TODO # Move some of the (e.g. quoting) functions here into rblib, as they feel @@ -822,6 +822,22 @@ class IncomingMessage < ActiveRecord::Base return nil end + + # Returns space separated list of file extensions of attachments to this message. Defaults to + # the normal extension for known mime type, otherwise uses other extensions. + def get_present_file_extensions + ret = {} + for attachment in self.get_attachments_for_display + ext = mimetype_to_extension(attachment.content_type) + ext = File.extname(attachment.filename).gsub(/^[.]/, "") if ext.nil? && !attachment.filename.nil? + ret[ext] = 1 if !ext.nil? + end + return ret.keys.join(" ") + end + # Return space separated list of all file extensions known + def IncomingMessage.get_all_file_extentions + return $file_extension_to_mime_type.keys.join(" ") + end end diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb index 48015500a..08e0fa0b8 100644 --- a/app/models/info_request_event.rb +++ b/app/models/info_request_event.rb @@ -20,7 +20,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: info_request_event.rb,v 1.52 2008-08-20 23:56:21 francis Exp $ +# $Id: info_request_event.rb,v 1.53 2008-08-29 22:39:36 francis Exp $ class InfoRequestEvent < ActiveRecord::Base belongs_to :info_request @@ -69,7 +69,8 @@ class InfoRequestEvent < ActiveRecord::Base [ :requested_by, 'B', "requested_by" ], [ :requested_from, 'F', "requested_from" ], [ :request, 'R', "request" ], - [ :variety, 'V', "variety" ] + [ :variety, 'V', "variety" ], + [ :filetype, 'T', "filetype" ] ], :if => :indexed_by_search, :eager_load => [ :incoming_message, :outgoing_message, :comment, { :info_request => [ :user, :public_body ] } ] @@ -115,6 +116,12 @@ class InfoRequestEvent < ActiveRecord::Base end return '' end + def filetype + if self.event_type == 'response' + return self.incoming_message.get_present_file_extensions + end + return '' + end def indexed_by_search if ['sent', 'followup_sent', 'response', 'comment'].include?(self.event_type) if info_request.prominence == 'backpage' diff --git a/app/views/general/search.rhtml b/app/views/general/search.rhtml index 7fb4660c5..93b3c8332 100644 --- a/app/views/general/search.rhtml +++ b/app/views/general/search.rhtml @@ -94,6 +94,7 @@ <li><strong>requested_from:home_office</strong> to restrict to requests from the <%= link_to "Home Office", show_public_body_url(:url_name => 'home_office') %>, typing the name as in the URL. <li><strong>requested_by:julian_todd</strong> to restrict to requests made by <%= link_to "Julian Todd", show_user_url(:url_name => 'julian_todd') %>, typing the name as in the URL. <li><strong>request:</strong> to restrict to a specific request, typing the title as in the URL. + <li><strong>filetype:pdf</strong> to find all responses in PDF format. Or try these: <%= IncomingMessage.get_all_file_extentions%>. <li>Type <strong>01/01/2008..14/01/2008</strong> to only show things that happened in the first two weeks of January. <li>Read about <a href="http://www.xapian.org/docs/queryparser.html">advanced search operators</a>, such as proximity and wildcards. </ul> diff --git a/app/views/layouts/default.rhtml b/app/views/layouts/default.rhtml index e4f9e898f..198e34452 100644 --- a/app/views/layouts/default.rhtml +++ b/app/views/layouts/default.rhtml @@ -40,7 +40,7 @@ <div id="navigation_search"> <% form_tag({:controller => "general", :action => "search_redirect"}, {:id => "navigation_search_form"}) do %> <p> - <%= text_field_tag 'query', params[:query], { :size => 25, :id => "navigation_search_query" } %> + <%= text_field_tag 'query', params[:query], { :size => 40, :id => "navigation_search_query" } %> <%= submit_tag "Search" %> </p> <% end %> @@ -9,14 +9,8 @@ Site move: Next ==== -Test: Check where followups are going to now Test: Check new .zips are being indexed -VSD files vsdump - example in zip file -http://www.whatdotheyknow.com/request/dog_control_orders#incoming-3510 -doing file RESPONSE/Internal documents/Briefing with Contact Islington/Contact Islington Flowchart Jul 08.vsd content type -Search for other extensions that we have now - Comments interleaved with body - Annotation thing too far down when much sidebar e.g. http://localhost:3000/request/heya#outgoing-199 - Put classification box above annotation one? @@ -58,9 +52,19 @@ Search FAQ etc. Icon for annotations in search results +Comments etc. do not sort in right order - by date, but not by time + Later ===== +Random request :) + +VSD files vsdump - example in zip file + http://www.whatdotheyknow.com/request/dog_control_orders#incoming-3510 + doing file RESPONSE/Internal documents/Briefing with Contact Islington/Contact Islington Flowchart Jul 08.vsd content type +Search for other extensions that we have now + (call IncomingMessage.find_all_unknown_mime_types to find them) + From an email, isn't stripping spaces right. "Met Office sent a response to Andrew Montford (14 August 2008)" Also should group by the request id for search queries (so all appear |