diff options
22 files changed, 137 insertions, 38 deletions
diff --git a/app/controllers/request_controller.rb b/app/controllers/request_controller.rb index 0d0ba505b..71a6e66f1 100644 --- a/app/controllers/request_controller.rb +++ b/app/controllers/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: request_controller.rb,v 1.91 2008-05-21 10:51:24 francis Exp $ +# $Id: request_controller.rb,v 1.92 2008-05-27 01:19:44 francis Exp $ class RequestController < ApplicationController @@ -137,7 +137,7 @@ class RequestController < ApplicationController @info_request.save! # XXX send_message needs the database id, so we send after saving, which isn't ideal if the request broke here. @outgoing_message.send_message - flash[:notice] = "Your Freedom of Information request has been created and sent on its way!" + flash[:notice] = "Your " + @info_request.law_used_full + " request has been created and sent on its way!" redirect_to request_url(@info_request) else # do nothing - as "authenticated?" has done the redirect to signin page for us diff --git a/app/models/info_request.rb b/app/models/info_request.rb index 14cd503ba..cc1aef022 100644 --- a/app/models/info_request.rb +++ b/app/models/info_request.rb @@ -22,7 +22,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: info_request.rb,v 1.114 2008-05-21 22:37:33 francis Exp $ +# $Id: info_request.rb,v 1.115 2008-05-27 01:19:45 francis Exp $ require 'digest/sha1' require File.join(File.dirname(__FILE__),'../../vendor/plugins/acts_as_xapian/lib/acts_as_xapian') @@ -59,10 +59,19 @@ class InfoRequest < ActiveRecord::Base 'backpage', ] + validates_inclusion_of :law_used, :in => [ + 'foi', # Freedom of Information Act + 'eir', # Environmental Information Regulations + ] + def after_initialize if self.described_state.nil? self.described_state = 'waiting_response' end + # FOI or EIR? + if not self.public_body.nil? and self.public_body.eir_only? + self.law_used = 'eir' + end end # Central function to do all searches @@ -128,12 +137,51 @@ public # Subject lines for emails about the request def email_subject_request - 'Freedom of Information request - ' + self.title + self.law_used_full + ' request - ' + self.title end def email_subject_followup - 'Re: Freedom of Information request - ' + self.title + 'Re: ' + self.law_used_full + ' request - ' + self.title end + # Two sorts of laws for requests, FOI or EIR + def law_used_full + if self.law_used == 'foi' + return "Freedom of Information" + elsif self.law_used == 'eir' + return "Environmental Information Regulations" + else + raise "Unknown law used '" + self.law_used + "'" + end + end + def law_used_short + if self.law_used == 'foi' + return "FOI" + elsif self.law_used == 'eir' + return "EIR" + else + raise "Unknown law used '" + self.law_used + "'" + end + end + def law_used_act + if self.law_used == 'foi' + return "Freedom of Information Act" + elsif self.law_used == 'eir' + return "Environmental Information Regulations" + else + raise "Unknown law used '" + self.law_used + "'" + end + end + def law_used_with_a + if self.law_used == 'foi' + return "A Freedom of Information request" + elsif self.law_used == 'eir' + return "An Environmental Information Regulations request" + else + raise "Unknown law used '" + self.law_used + "'" + end + end + + # Return info request corresponding to an incoming email address, or nil if # none found. Checks the hash to ensure the email came from the public body - # only they are sent the email address with the has in it. (We don't check @@ -344,7 +392,7 @@ public return self.public_body.request_email end def recipient_name_and_email - return "FOI requests at " + self.public_body.short_or_long_name + " <" + self.recipient_email + ">" + return self.law_used_short + " requests at " + self.public_body.short_or_long_name + " <" + self.recipient_email + ">" end # History of some things that have happened diff --git a/app/models/public_body.rb b/app/models/public_body.rb index 9b7c97c4c..c13f7d08f 100644 --- a/app/models/public_body.rb +++ b/app/models/public_body.rb @@ -21,7 +21,7 @@ # Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved. # Email: francis@mysociety.org; WWW: http://www.mysociety.org/ # -# $Id: public_body.rb,v 1.72 2008-05-21 22:37:33 francis Exp $ +# $Id: public_body.rb,v 1.73 2008-05-27 01:19:45 francis Exp $ require 'csv' require 'set' @@ -127,6 +127,14 @@ class PublicBody < ActiveRecord::Base def tag_string return self.public_body_tags.map { |t| t.name }.join(' ') end + def has_tag?(tag) + for public_body_tag in self.public_body_tags + if public_body_tag.name == tag + return true + end + end + return false + end # Find all public bodies with a particular tag def self.find_by_tag(tag) @@ -148,6 +156,12 @@ class PublicBody < ActiveRecord::Base end end + # Are all requests to this body under the Environmental Information Regulations? + def eir_only? + return self.has_tag?('eir_only') + end + + class ImportCSVDryRun < StandardError end diff --git a/app/views/admin_request/list.rhtml b/app/views/admin_request/list.rhtml index b23d31237..ce2d53b39 100644 --- a/app/views/admin_request/list.rhtml +++ b/app/views/admin_request/list.rhtml @@ -1,4 +1,4 @@ -<% @title = 'Listing FOI requests' %> +<% @title = 'Listing FOI/EIR requests' %> <h1><%=@title%></h1> diff --git a/app/views/body/show.rhtml b/app/views/body/show.rhtml index 9fe4e1ebf..5c868bd7f 100644 --- a/app/views/body/show.rhtml +++ b/app/views/body/show.rhtml @@ -11,18 +11,36 @@ <%=@public_body.type_of_authority.capitalize%> in the UK<% if not @public_body.short_name.empty? %>, also called <%= h(@public_body.short_name) %><% end %> </p> +<% if @public_body.eir_only? %> +<p>You can only request information about the environment from this authority.</p> +<% end %> + <p> +<% if @public_body.eir_only? %> +<%= link_to "Make new EIR request to " + @public_body.short_or_long_name, new_request_to_body_url(:public_body_id => @public_body.id.to_s)%> +<% else %> <%= link_to "Make new FOI request to " + @public_body.short_or_long_name, new_request_to_body_url(:public_body_id => @public_body.id.to_s)%> +<% end %> </p> <% if @public_body.info_requests.empty? %> - <h2>Freedom of Information requests made to this authority</h2> - <p>Nobody has made any Freedom of Information requests to this public authority using this site.</p> + <% if @public_body.eir_only? %> + <h2>Environmental Information Regulations requests made to this authority</h2> + <p>Nobody has made any Environmental Information Regulations requests to this public authority using this site.</p> + <% else %> + <h2>Freedom of Information requests made to this authority</h2> + <p>Nobody has made any Freedom of Information requests to this public authority using this site.</p> + <% end %> <% else %> <h2> - <%=pluralize(@public_body.info_requests.size, "Freedom of Information request") %> made to this authority + <% if @public_body.eir_only? %> + <%=pluralize(@public_body.info_requests.size, "Environmental Information Regulations request") %> made to this authority + <% else %> + <%=pluralize(@public_body.info_requests.size, "Freedom of Information request") %> made to this authority + <% end %> </h2> <%= render :partial => 'request/request_listing', :locals => { :info_requests => @public_body.info_requests } %> <% end %> + diff --git a/app/views/request/_followup.rhtml b/app/views/request/_followup.rhtml index fe7b09ea5..e3c74b982 100644 --- a/app/views/request/_followup.rhtml +++ b/app/views/request/_followup.rhtml @@ -26,7 +26,7 @@ The response was due on <strong><%= simple_date(@info_request.date_response_required_by) %></strong> (<%= link_to "more info", about_url + "#quickly_response" %>). You can say - that under the Freedom of Information Act they should have replied by now. + that under the <%=h(@info_request.law_used_act)%> they should have replied by now. </p> <% end %> diff --git a/app/views/request/new.rhtml b/app/views/request/new.rhtml index 1c64b9c8a..3ccfa09c9 100644 --- a/app/views/request/new.rhtml +++ b/app/views/request/new.rhtml @@ -1,4 +1,4 @@ -<% @title = "Make an FOI request to '" + h(@info_request.public_body.name) + "'" %> +<% @title = "Make an " + h(@info_request.law_used_short) + " request to '" + h(@info_request.public_body.name) + "'" %> <% if @existing_request %> <div class="errorExplanation" id="errorExplanation"><ul> @@ -16,7 +16,7 @@ <% form_for(:info_request, @info_request, :html => { :id => 'write_form' } ) do |f| %> <div id="request_advice"> - <h1>Read this before writing your Freedom of Information request</h1> + <h1>Read this before writing your <%=h(@info_request.law_used_full)%> request</h1> <ul> <li>Use a <strong>search engine first</strong> to check that the information isn't already published. </li> @@ -52,7 +52,13 @@ </p> <div class="form_item_note"> (a one line summary of the information you are requesting, - e.g. 'Crime statistics by ward level for Wales') + e.g. + <% if @info_request.law_used == 'eir' %> + 'Pollution levels over time for the River Tyne' + <% else %> + 'Crime statistics by ward level for Wales' + <% end %> + ) </div> <% fields_for :outgoing_message do |o| %> diff --git a/app/views/request/new_bad_contact.rhtml b/app/views/request/new_bad_contact.rhtml index 51ca87652..7211165e4 100644 --- a/app/views/request/new_bad_contact.rhtml +++ b/app/views/request/new_bad_contact.rhtml @@ -2,7 +2,7 @@ <h1><%=@title%></h1> -<p>Unfortunately, we do not have a working Freedom of Information email +<p>Unfortunately, we do not have a working <%=h @info_request.law_used_full %> address for <%=h @info_request.public_body.name %>. You may be able to find one on their website, or by phoning them up and asking. If you mange to find one, then please <a href="/help/contact">send it to us</a>. diff --git a/app/views/request/preview.rhtml b/app/views/request/preview.rhtml index bac3a0a64..30ecbf031 100644 --- a/app/views/request/preview.rhtml +++ b/app/views/request/preview.rhtml @@ -1,4 +1,4 @@ -<% @title = "Preview new FOI request to '" + h(@info_request.public_body.name) + "'" %> +<% @title = "Preview new " + h(@info_request.law_used_short) + " request to '" + h(@info_request.public_body.name) + "'" %> <% form_for(:info_request, @info_request, :html => { :id => 'preview_form' } ) do |f| %> @@ -30,7 +30,7 @@ <%= hidden_field_tag(:submitted_new_request, 1) %> <%= hidden_field_tag(:preview, 0 ) %> <%= submit_tag "Re-edit this request", :name => 'reedit' %> - <%= submit_tag "Send public Freedom of Information request", :name => 'submit' %> + <%= submit_tag "Send public " + h(@info_request.law_used_full) + " request", :name => 'submit' %> </p> <% end %> diff --git a/app/views/request/show.rhtml b/app/views/request/show.rhtml index f8cca83c0..2de035805 100644 --- a/app/views/request/show.rhtml +++ b/app/views/request/show.rhtml @@ -37,7 +37,7 @@ <div id="request_main"> <h1><%=@title%></h1> - <p class="subtitle">A Freedom of Information request to + <p class="subtitle"><%=h @info_request.law_used_with_a%> to <%= public_body_link(@info_request.public_body) %> by <%= user_link(@info_request.user) %> diff --git a/app/views/request/show_response.rhtml b/app/views/request/show_response.rhtml index 45c3f02d4..5c0e18b19 100644 --- a/app/views/request/show_response.rhtml +++ b/app/views/request/show_response.rhtml @@ -19,11 +19,11 @@ <% end %> <% else %> <% if @incoming_message.nil? %> - <h2>Last message sent for FOI request '<%= request_link @info_request %>'</h2> + <h2>Last message sent for <%=h(@info_request.law_used_short)%> request '<%= request_link @info_request %>'</h2> <% elsif @incoming_message.recently_arrived %> - <h2>New response to FOI request '<%= request_link @info_request %>'</h2> + <h2>New response to <%=h(@info_request.law_used_short)%> request '<%= request_link @info_request %>'</h2> <% else %> - <h2>Response to FOI request '<%= request_link @info_request %>'</h2> + <h2>Response to <%=h(@info_request.law_used_short)%> request '<%= request_link @info_request %>'</h2> <% end %> <% end %> diff --git a/app/views/request_mailer/bounced_message.rhtml b/app/views/request_mailer/bounced_message.rhtml index cdb8e8ddf..88af70e78 100644 --- a/app/views/request_mailer/bounced_message.rhtml +++ b/app/views/request_mailer/bounced_message.rhtml @@ -1,3 +1,3 @@ -An incoming email arrived which was not to a known FOI request. Find the message attached. +An incoming email arrived which was not to a known FOI/EIR request. Find the message attached. This message was sent by mysociety/foi/models/request_mailer.rb. diff --git a/app/views/request_mailer/initial_request.rhtml b/app/views/request_mailer/initial_request.rhtml index afcb84e35..9d5395098 100644 --- a/app/views/request_mailer/initial_request.rhtml +++ b/app/views/request_mailer/initial_request.rhtml @@ -1,8 +1,8 @@ <%= @outgoing_message.body.strip %> ------------------------------------------------------------------- -Is <%= @info_request.public_body.request_email%> the wrong address for Freedom -of Information requests to <%= @info_request.public_body.name%>? If so please -let us know by emailing <%=@contact_email%> - we'll make sure future ones go to -the right place. +Is <%= @info_request.public_body.request_email%> the wrong address for +<%= @info_request.law_used_full %> requests to <%= @info_request.public_body.name%>? +If so please let us know by emailing <%=@contact_email%> - we'll make sure +future ones go to the right place. ------------------------------------------------------------------- diff --git a/app/views/request_mailer/new_response.rhtml b/app/views/request_mailer/new_response.rhtml index c55289b04..647cf6af4 100644 --- a/app/views/request_mailer/new_response.rhtml +++ b/app/views/request_mailer/new_response.rhtml @@ -1,4 +1,4 @@ -You have a new response to the Freedom of Information request +You have a new response to the <%= @info_request.law_used_full %> request '<%= @info_request.title %>' that you made to <%= @info_request.public_body.name %>. diff --git a/app/views/request_mailer/new_response_reminder_alert.rhtml b/app/views/request_mailer/new_response_reminder_alert.rhtml index fe1bf2d40..f3cbc523b 100644 --- a/app/views/request_mailer/new_response_reminder_alert.rhtml +++ b/app/views/request_mailer/new_response_reminder_alert.rhtml @@ -1,5 +1,5 @@ Please let us know whether there was information in the recent -response to your Freedom of Information request. To do this, +response to your <%= @info_request.law_used_full %> request. To do this, click on the link below. <%=@url%> diff --git a/app/views/request_mailer/not_clarified_alert.rhtml b/app/views/request_mailer/not_clarified_alert.rhtml index 8752d0606..b8a481851 100644 --- a/app/views/request_mailer/not_clarified_alert.rhtml +++ b/app/views/request_mailer/not_clarified_alert.rhtml @@ -1,5 +1,5 @@ <%=@info_request.public_body.name%> has asked you to explain -part of your FOI request. To do this, click on the link below. +part of your <%=@info_request.law_used_short%> request. To do this, click on the link below. <%=@url%> diff --git a/app/views/request_mailer/overdue_alert.rhtml b/app/views/request_mailer/overdue_alert.rhtml index 019bbae4e..ca8cbdf44 100644 --- a/app/views/request_mailer/overdue_alert.rhtml +++ b/app/views/request_mailer/overdue_alert.rhtml @@ -1,7 +1,7 @@ <%= @info_request.public_body.name %> are late. -They have not replied to your FOI request '<%= @info_request.title %>' within -the 20 working days they are allowed by law. +They have not replied to your <%=@info_request.law_used_short%> request '<%= @info_request.title %>' +within the 20 working days they are allowed by law. Click on the link below to send a message to <%= @info_request.public_body.name %> reminding them to reply to your request. diff --git a/app/views/request_mailer/requires_admin.rhtml b/app/views/request_mailer/requires_admin.rhtml index 209e2f334..882ef73ce 100644 --- a/app/views/request_mailer/requires_admin.rhtml +++ b/app/views/request_mailer/requires_admin.rhtml @@ -1,6 +1,6 @@ -A user has reported an FOI response as being unusual, or out of the scope of -the system. Take a look, and contact the user to let them know what you are -going to do about it. +A user has reported an <%=@info_request.law_used_short%> response as being +unusual, or out of the scope of the system. Take a look, and contact the user +to let them know what you are going to do about it. Request '<%=@info_request.title%>': <%= @url %> diff --git a/app/views/request_mailer/stopped_responses.rhtml b/app/views/request_mailer/stopped_responses.rhtml index 43c6a2900..5c4fe704d 100644 --- a/app/views/request_mailer/stopped_responses.rhtml +++ b/app/views/request_mailer/stopped_responses.rhtml @@ -1,6 +1,6 @@ The email that you, on behalf of <%= @info_request.public_body.name%>, sent to -<%= @info_request.user.name %> to reply to a Freedom of Information request has -not been delivered. +<%= @info_request.user.name %> to reply to an <%= @info_request.law_used_short %> +request has not been delivered. This is because '<%= @info_request.title %>' is an old request that has been marked to no longer receive responses. diff --git a/db/migrate/057_add_law_used.rb b/db/migrate/057_add_law_used.rb new file mode 100644 index 000000000..ec4efd0bc --- /dev/null +++ b/db/migrate/057_add_law_used.rb @@ -0,0 +1,9 @@ +class AddLawUsed < ActiveRecord::Migration + def self.up + add_column :info_requests, :law_used, :string, :null => false, :default => 'foi' + end + + def self.down + remove_column :info_requests, :law_used + end +end diff --git a/db/schema.rb b/db/schema.rb index 1bcf94dfa..66758a69c 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -9,7 +9,7 @@ # # It's strongly recommended to check this file into your version control system. -ActiveRecord::Schema.define(:version => 56) do +ActiveRecord::Schema.define(:version => 57) do create_table "acts_as_xapian_jobs", :force => true do |t| t.string "model", :null => false @@ -50,6 +50,7 @@ ActiveRecord::Schema.define(:version => 56) do t.string "prominence", :default => "normal", :null => false t.text "url_title", :null => false t.boolean "stop_new_responses", :default => false, :null => false + t.string "law_used", :default => "foi", :null => false end add_index "info_requests", ["created_at"], :name => "index_info_requests_on_created_at" @@ -1,3 +1,6 @@ +EIR: +app/models/track_thing.rb: + FOI requests to use to test it ============================== |