aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/models/contact_validator.rb4
-rw-r--r--app/models/incoming_message.rb4
-rw-r--r--app/models/info_request.rb5
-rw-r--r--app/models/info_request_event.rb4
-rw-r--r--app/models/outgoing_message.rb4
-rw-r--r--app/models/post_redirect.rb4
-rw-r--r--app/models/public_body.rb35
-rw-r--r--app/models/public_body_tag.rb4
-rw-r--r--app/models/track_thing.rb4
-rw-r--r--app/models/track_things_sent_email.rb4
-rw-r--r--app/models/user.rb4
-rw-r--r--app/models/user_info_request_sent_alert.rb4
-rw-r--r--app/views/admin_public_body/_form.rhtml16
-rw-r--r--app/views/admin_public_body/show.rhtml3
-rw-r--r--app/views/body/show.rhtml9
-rw-r--r--app/views/request/new.rhtml7
16 files changed, 82 insertions, 33 deletions
diff --git a/app/models/contact_validator.rb b/app/models/contact_validator.rb
index f07d643fa..78c30e553 100644
--- a/app/models/contact_validator.rb
+++ b/app/models/contact_validator.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 56
+# Schema version: 59
#
# Table name: contact_validators
#
@@ -15,7 +15,7 @@
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: contact_validator.rb,v 1.16 2008-07-09 07:39:08 francis Exp $
+# $Id: contact_validator.rb,v 1.17 2008-07-16 23:45:41 francis Exp $
class ContactValidator < ActiveRecord::BaseWithoutTable
column :name, :string
diff --git a/app/models/incoming_message.rb b/app/models/incoming_message.rb
index 0917d4ac6..385657704 100644
--- a/app/models/incoming_message.rb
+++ b/app/models/incoming_message.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 56
+# Schema version: 59
#
# Table name: incoming_messages
#
@@ -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.119 2008-07-10 13:32:01 francis Exp $
+# $Id: incoming_message.rb,v 1.120 2008-07-16 23:45:41 francis Exp $
# TODO
# Move some of the (e.g. quoting) functions here into rblib, as they feel
diff --git a/app/models/info_request.rb b/app/models/info_request.rb
index 400b3a11e..60e2a15d8 100644
--- a/app/models/info_request.rb
+++ b/app/models/info_request.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 56
+# Schema version: 59
#
# Table name: info_requests
#
@@ -14,6 +14,7 @@
# prominence :string(255) default("normal"), not null
# url_title :text not null
# stop_new_responses :boolean default(false), not null
+# law_used :string(255) default("foi"), not null
#
# models/info_request.rb:
@@ -22,7 +23,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.120 2008-07-15 17:24:25 francis Exp $
+# $Id: info_request.rb,v 1.121 2008-07-16 23:45:41 francis Exp $
require 'digest/sha1'
require File.join(File.dirname(__FILE__),'../../vendor/plugins/acts_as_xapian/lib/acts_as_xapian')
diff --git a/app/models/info_request_event.rb b/app/models/info_request_event.rb
index dfb930358..a5eb308c6 100644
--- a/app/models/info_request_event.rb
+++ b/app/models/info_request_event.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 56
+# Schema version: 59
#
# Table name: info_request_events
#
@@ -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.46 2008-05-21 10:51:24 francis Exp $
+# $Id: info_request_event.rb,v 1.47 2008-07-16 23:45:41 francis Exp $
class InfoRequestEvent < ActiveRecord::Base
belongs_to :info_request
diff --git a/app/models/outgoing_message.rb b/app/models/outgoing_message.rb
index 6cc8b2368..74a3f0f6d 100644
--- a/app/models/outgoing_message.rb
+++ b/app/models/outgoing_message.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 56
+# Schema version: 59
#
# Table name: outgoing_messages
#
@@ -21,7 +21,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: outgoing_message.rb,v 1.54 2008-07-10 08:26:08 francis Exp $
+# $Id: outgoing_message.rb,v 1.55 2008-07-16 23:45:41 francis Exp $
class OutgoingMessage < ActiveRecord::Base
belongs_to :info_request
diff --git a/app/models/post_redirect.rb b/app/models/post_redirect.rb
index fa00bb8ac..487b5b74d 100644
--- a/app/models/post_redirect.rb
+++ b/app/models/post_redirect.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 56
+# Schema version: 59
#
# Table name: post_redirects
#
@@ -26,7 +26,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: post_redirect.rb,v 1.34 2008-06-12 14:17:30 francis Exp $
+# $Id: post_redirect.rb,v 1.35 2008-07-16 23:45:41 francis Exp $
require 'openssl' # for random bytes function
diff --git a/app/models/public_body.rb b/app/models/public_body.rb
index 39c442710..073304852 100644
--- a/app/models/public_body.rb
+++ b/app/models/public_body.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 56
+# Schema version: 59
#
# Table name: public_bodies
#
@@ -13,6 +13,8 @@
# created_at :datetime not null
# updated_at :datetime not null
# url_name :text not null
+# home_page :text default(""), not null
+# notes :text default(""), not null
#
# models/public_body.rb:
@@ -21,7 +23,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.84 2008-07-10 08:45:46 francis Exp $
+# $Id: public_body.rb,v 1.85 2008-07-16 23:45:41 francis Exp $
require 'csv'
require 'set'
@@ -109,7 +111,6 @@ class PublicBody < ActiveRecord::Base
end
end
-
acts_as_versioned
self.non_versioned_columns << 'created_at' << 'updated_at'
class Version
@@ -202,6 +203,30 @@ class PublicBody < ActiveRecord::Base
end
end
+ # Calculate home page, or nil if not known
+ def calculated_home_page
+ # manual override for ones we calculate wrongly
+ if self.home_page != ''
+ return self.home_page
+ end
+
+ # extract the domain name
+ url = self.request_email
+ url =~ /@(.*)/
+ if $1.nil?
+ return nil
+ end
+ url = $1
+
+ # remove special email domains for UK Government addresses
+ url.sub!(".gsi.", ".")
+ url.sub!(".x.", ".")
+ url.sub!(".pnn.", ".")
+
+ # add standard URL prefix
+ return "http://www." + url
+ end
+
# Are all requests to this body under the Environmental Information Regulations?
def eir_only?
return self.has_tag?('eir_only')
@@ -222,6 +247,8 @@ class PublicBody < ActiveRecord::Base
:name => 'Internal admin authority',
:short_name => "",
:request_email => MySociety::Config.get("CONTACT_EMAIL", 'contact@localhost'),
+ :home_page => "",
+ :notes => "",
:last_edit_editor => "internal_admin",
:last_edit_comment => "Made by PublicBody.internal_admin_body"
)
@@ -286,7 +313,7 @@ class PublicBody < ActiveRecord::Base
else
# New public body
notes.push "line " + line.to_s + ": new authority '" + name + "' with email " + email
- public_body = PublicBody.new(:name => name, :request_email => email, :short_name => "", :last_edit_editor => editor, :last_edit_comment => 'Created from spreadsheet')
+ public_body = PublicBody.new(:name => name, :request_email => email, :short_name => "", :home_page => "", :notes => "", :last_edit_editor => editor, :last_edit_comment => 'Created from spreadsheet')
public_body.tag_string = tag
public_body.save!
end
diff --git a/app/models/public_body_tag.rb b/app/models/public_body_tag.rb
index 414b903fb..927ad01f6 100644
--- a/app/models/public_body_tag.rb
+++ b/app/models/public_body_tag.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 56
+# Schema version: 59
#
# Table name: public_body_tags
#
@@ -15,7 +15,7 @@
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: public_body_tag.rb,v 1.13 2008-05-21 10:51:24 francis Exp $
+# $Id: public_body_tag.rb,v 1.14 2008-07-16 23:45:41 francis Exp $
class PublicBodyTag < ActiveRecord::Base
validates_presence_of :public_body
diff --git a/app/models/track_thing.rb b/app/models/track_thing.rb
index 3d4e782af..ec7fe271c 100644
--- a/app/models/track_thing.rb
+++ b/app/models/track_thing.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 56
+# Schema version: 59
#
# Table name: track_things
#
@@ -21,7 +21,7 @@
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: track_thing.rb,v 1.24 2008-05-27 01:25:09 francis Exp $
+# $Id: track_thing.rb,v 1.25 2008-07-16 23:45:41 francis Exp $
class TrackThing < ActiveRecord::Base
belongs_to :tracking_user, :class_name => 'User'
diff --git a/app/models/track_things_sent_email.rb b/app/models/track_things_sent_email.rb
index 850f64880..f9fea165a 100644
--- a/app/models/track_things_sent_email.rb
+++ b/app/models/track_things_sent_email.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 56
+# Schema version: 59
#
# Table name: track_things_sent_emails
#
@@ -18,7 +18,7 @@
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: track_things_sent_email.rb,v 1.7 2008-05-21 10:51:24 francis Exp $
+# $Id: track_things_sent_email.rb,v 1.8 2008-07-16 23:45:41 francis Exp $
class TrackThingsSentEmail < ActiveRecord::Base
belongs_to :info_request_event
diff --git a/app/models/user.rb b/app/models/user.rb
index aa7014a54..5f7f45d04 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 56
+# Schema version: 59
#
# Table name: users
#
@@ -21,7 +21,7 @@
# Copyright (c) 2007 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: user.rb,v 1.57 2008-07-08 09:41:04 francis Exp $
+# $Id: user.rb,v 1.58 2008-07-16 23:45:41 francis Exp $
require 'digest/sha1'
diff --git a/app/models/user_info_request_sent_alert.rb b/app/models/user_info_request_sent_alert.rb
index e314f541e..e940df2a0 100644
--- a/app/models/user_info_request_sent_alert.rb
+++ b/app/models/user_info_request_sent_alert.rb
@@ -1,5 +1,5 @@
# == Schema Information
-# Schema version: 56
+# Schema version: 59
#
# Table name: user_info_request_sent_alerts
#
@@ -17,7 +17,7 @@
# Copyright (c) 2008 UK Citizens Online Democracy. All rights reserved.
# Email: francis@mysociety.org; WWW: http://www.mysociety.org/
#
-# $Id: user_info_request_sent_alert.rb,v 1.17 2008-07-14 12:06:51 francis Exp $
+# $Id: user_info_request_sent_alert.rb,v 1.18 2008-07-16 23:45:41 francis Exp $
class UserInfoRequestSentAlert < ActiveRecord::Base
belongs_to :user
diff --git a/app/views/admin_public_body/_form.rhtml b/app/views/admin_public_body/_form.rhtml
index fa84a2e96..504b01fa0 100644
--- a/app/views/admin_public_body/_form.rhtml
+++ b/app/views/admin_public_body/_form.rhtml
@@ -1,10 +1,19 @@
<%= error_messages_for 'public_body' %>
<!--[form:public_body]-->
+
<p><label for="public_body_name">Name</label><br/>
<%= text_field 'public_body', 'name', :size => 60 %></p>
+
<p><label for="public_body_short_name">Short name (only put in abbreviations which are really used, otherwise leave blank. Short or long name is used in the URL - don't worry about breaking URLs through renaming, as the history is used to redirect)</label><br/>
<%= text_field 'public_body', 'short_name', :size => 60 %></p>
+
+<p><label for="public_body_request_email">Request email (set to <strong>blank</strong> (empty string) if can't find an address; to <strong>not_apply</strong> if FOI no longer / never did apply to authority)</label><br/>
+<%= text_field 'public_body', 'request_email', :size => 40 %></p>
+
+<p><label for="public_body_home_page">Home page (set to <strong>blank</strong> to guess it from the email)</label><br/>
+<%= text_field 'public_body', 'home_page', :size => 60 %></p>
+
<p><label for="public_body_tag_string">Tags (space separated:
<% for category, description in PublicBody.categories_by_tag %>
<% if category != "other" %>
@@ -14,12 +23,11 @@
)</label><br/>
<%= text_field 'public_body', 'tag_string', :size => 80 %></p>
-
-<p><label for="public_body_request_email">Request email (set to <strong>blank</strong> (empty string) if can't find an address; to <strong>not_apply</strong> if FOI no longer / never did apply to authority)</label><br/>
-<%= text_field 'public_body', 'request_email', :size => 40 %></p>
+<p><label for="public_body_notes">Notes</label> (for users to consider when making FOI requests to the authority)<br/>
+<%= text_area 'public_body', 'notes', :rows => 4, :cols => 60 %></p>
<p><label for="public_body_last_edit_comment">Comment for this edit</label> (put URL or other source of new info)<br/>
-<%= text_area 'public_body', 'last_edit_comment', :rows => 3, :cols => 60 %></p>
+<%= text_area 'public_body', 'last_edit_comment', :rows => 2, :cols => 60 %></p>
<!--[eoform:public_body]-->
<p><strong>Privacy note:</strong> The email addresses are assumed public data,
diff --git a/app/views/admin_public_body/show.rhtml b/app/views/admin_public_body/show.rhtml
index baa3a9918..9791a9155 100644
--- a/app/views/admin_public_body/show.rhtml
+++ b/app/views/admin_public_body/show.rhtml
@@ -7,7 +7,8 @@
<b><%= column.human_name %>:</b> <%=h @public_body.send(column.name) %>
<br/>
<% end %>
-<b>Tags:</b> <%=h @public_body.tag_string %>
+<b>Calculated home page:</b> <%= link_to(h(@public_body.calculated_home_page), @public_body.calculated_home_page) %>
+<br/><b>Tags:</b> <%=h @public_body.tag_string %>
<br/>
</p>
diff --git a/app/views/body/show.rhtml b/app/views/body/show.rhtml
index 380141340..c7dc49dbf 100644
--- a/app/views/body/show.rhtml
+++ b/app/views/body/show.rhtml
@@ -9,17 +9,22 @@
<p class="subtitle">
<%=@public_body.type_of_authority(true)%> in the UK<% if not @public_body.short_name.empty? %>, also called <%= h(@public_body.short_name) %><% end %>
+(<%= link_to "home page", @public_body.calculated_home_page %>)
</p>
+<% if @public_body.notes != "" %>
+<p><%=@public_body.notes%></p>
+<% end %>
+
<% 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)%>
+<%= link_to "Make new EIR request to " + h(@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)%>
+<%= link_to "Make new FOI request to " + h(@public_body.short_or_long_name), new_request_to_body_url(:public_body_id => @public_body.id.to_s)%>
<% end %>
</p>
diff --git a/app/views/request/new.rhtml b/app/views/request/new.rhtml
index d8b18df81..1ba68c99a 100644
--- a/app/views/request/new.rhtml
+++ b/app/views/request/new.rhtml
@@ -39,6 +39,13 @@
</li>
</ul>
+ <% if @info_request.public_body.notes != "" %>
+ <h1>Please note for this authorite</h1>
+ <ul>
+ <li><%=@info_request.public_body.notes %></li>
+ </ul>
+ <% end %>
+
<% if @info_request.public_body.eir_only? %>
<h1>Please ask for environmental information only</h1>