1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
|
<% @show_tips = @xapian_requests.nil? || (@total_hits == 0) %>
<% if @query.nil? %>
<% @title = _("Search Freedom of Information requests, public authorities and users") %>
<% elsif @total_hits == 0 %>
<% @title = _('There were no requests matching your query.') %>
<% else %>
<% @title = _("Results page {{page_number}}", :page_number => @page.to_s) %>
<% end%>
<% @include_request_link_in_authority_listing = true %>
<h1><%=@title%></h1>
<%= render :partial => 'localised_datepicker' %>
<% if @advanced %>
<p><%= _('To use the advanced search, combine phrases and labels as described in the search tips below.') %></p>
<% form_tag(advanced_search_url, :method => "get") do %>
<%= label_tag(:query, _("Search for:")) %>
<%= text_field_tag(:query, params[:query], { :size => 40 }) %>
<%= submit_tag("Search") %>
<% end %>
<p><%= link_to(_("Simple search"), search_redirect_url) %></p>
<% else %>
<% form_tag(request.url, :method => "get") do %>
<div id="list-filter">
<div id="simple-search-box">
<%= label_tag(:query, _("Search for:")) %>
<%= text_field_tag(:query, params[:query], { :size => 40 }) %>
<%= submit_tag("Search") %>
</div>
<fieldset>
<legend>
<%= _("Filters:") %>
</legend>
<div id="common-subfilters">
<div id="variety-filter">
<ul>
<% for variety, label in [
["all", _("everything")],
["requests", _("requests")],
["users", _("users")],
["bodies", _("authorities")]]%>
<li>
<% if @variety_postfix != variety %>
<% if variety != "users" %>
<%= link_to label, search_url([params[:query], @common_query], variety, @sort_postfix), :method => :get %>
<% else %>
<%= link_to label, search_url(params[:query], variety, @sort_postfix), :method => :get %>
<% end %>
<% else %>
<%= label %>
<% end %>
</li>
<% end %>
</ul>
</div>
<% if false %>
<%-# Commented out for now as tags are of limited use when users can't see them. This will change in the future! -%>
<% if @variety_postfix != "users" %>
<div>
<%= label_tag(:query, _("Tags (separated by a space):")) %><%= text_field_tag(:tags, params[:tags], { :size => 20 }) %>
<% for tag in InfoRequest.get_tags %>
<%= tag.name_and_value %>
<% end %>
</div>
<% end %>
<% end %>
</div>
<% if @variety_postfix == "requests" %>
<div id="requests-subfilters">
<div>
<%= _("Only show:") %> <br />
<% [["successful", _("successful requests")],
["unsuccessful", _("unsuccessful requests")],
["awaiting", _("unresolved requests")],
["internal_review", _("internal reviews")]].each_with_index do |item, index|
status, title = item %>
<%= check_box_tag "latest_status[]", status, params[:latest_status].nil? ? false : params[:latest_status].include?(status), :id => "latest_status_#{index}" %>
<%= label_tag("latest_status_#{index}", title) %> <br/>
<% end %>
</div>
<div>
<%= _("Search for words in:") %> <br/>
<% [["sent", _("messages from users")],
["response", _("messages from authorities")],
["comment", _("comments")]].each_with_index do |item, index|
variety, title = item %>
<%= check_box_tag "request_variety[]", variety, params[:request_variety].nil? ? true : params[:request_variety].include?(variety), :id => "request_variety_#{index}" %>
<%= label_tag("request_variety_#{index}", title) %> <br/>
<% end %>
</div>
<div>
Search between dates:
<%= text_field_tag(:request_date_after, params[:request_date_after], {:class => "use-datepicker", :size => 10}) %> -
<%= text_field_tag(:request_date_before, params[:request_date_before], {:class => "use-datepicker", :size => 10}) %>
</div>
</div>
<% end %>
<%= submit_tag("Filter") %>
</fieldset>
</div>
<% end %>
<p><%= link_to(_("Advanced search"), advanced_search_url) %></p>
<% end %>
<% if !@query.nil? %>
<p>
<%=link_to_unless @sortby == 'relevant', _("Show most relevant results first"), search_url(@query, @variety_postfix, 'relevant', @advanced) %>
|
<%=link_to_unless @sortby == 'newest', _("Newest results first"), search_url(@query, @variety_postfix, 'newest', @advanced) %>
<% if @sortby == 'described' %>
| <%= _('Recently described results first') %>
<% end %>
</p>
<% end %>
<% if not @query.nil? %>
<% if @spelling_correction %>
<p id="did_you_mean"><%= _('Did you mean: {{correction}}', :correction => search_link(@spelling_correction, @variety_postfix, @sort_postfix, @advanced)) %></p>
<% end %>
<% if (!@bodies || @xapian_requests_hits == 0) && @track_thing && (@xapian_bodies_hits > 0 || @xapian_users_hits > 0 || @total_hits == 0)%>
<%= render :partial => 'track/tracking_links', :locals => { :track_thing => @track_thing, :own_request => false, :location => 'main' } %>
<% end %>
<% if @xapian_bodies_hits > 0 %>
<% if @xapian_bodies_hits == 1 && @page == 1 %>
<h1><%= _('One public authority matching your search', :user_search_query => h(@query)) %></h1>
<% else %>
<h1><%= _('Public authorities {{start_count}} to {{end_count}} of {{total_count}} for {{user_search_query}}', :start_count => ((@page-1)*@bodies_per_page+1).to_s, :end_count => [@page*@bodies_per_page, @xapian_bodies.matches_estimated].min.to_s, :total_count => @xapian_bodies.matches_estimated.to_s, :user_search_query => h(@query)) %></h1>
<% end %>
<% for result in @xapian_bodies.results %>
<%= render :partial => 'public_body/body_listing_single', :locals => { :public_body => result[:model] } %>
<% end %>
<%= will_paginate WillPaginate::Collection.new(@page, @bodies_per_page, @xapian_bodies.matches_estimated) %>
<% end %>
<% if @xapian_users_hits > 0 %>
<% if @xapian_users_hits == 1 && @page == 1 %>
<h1><%= _("One person matching ‘{{user_search_query}}’", :user_search_query => h(@query)) %></h1>
<% else %>
<h1><%= _("People {{start_count}} to {{end_count}} of {{total_count}} for ‘{{user_search_query}}’", :start_count => ((@page-1)*@users_per_page+1).to_s, :end_count => [@page*@users_per_page, @xapian_users.matches_estimated].min.to_s, :total_count => @xapian_users.matches_estimated.to_s, :user_search_query => h(@query)) %></h1>
<% end %>
<% for result in @xapian_users.results %>
<%= render :partial => 'user/user_listing_single', :locals => { :display_user => result[:model] } %>
<% end %>
<%= will_paginate WillPaginate::Collection.new(@page, @users_per_page, @xapian_users.matches_estimated) %>
<% end %>
<% if @xapian_requests_hits > 0 %>
<% if @xapian_requests_hits == 1 && @page == 1 %>
<h1><%= _("One FOI request matching your search", :user_search_query => h(@query)) %></h1>
<% else %>
<h1><%= _("FOI requests {{start_count}} to {{end_count}} of {{total_count}}", :start_count => ((@page-1)*@requests_per_page+1).to_s, :end_count => [@page*@requests_per_page, @xapian_requests.matches_estimated].min.to_s, :total_count => @xapian_requests.matches_estimated.to_s, :user_search_query => h(@query)) %></h1>
<% end %>
<% if @track_thing %>
<%= render :partial => 'track/tracking_links', :locals => { :track_thing => @track_thing, :own_request => false, :location => 'main' } %>
<% end %>
<% for result in @xapian_requests.results %>
<%= render :partial => 'request/request_listing_via_event', :locals => { :event => result[:model], :info_request => result[:model].info_request } %>
<% end %>
<%= will_paginate WillPaginate::Collection.new(@page, @requests_per_page, @xapian_requests.matches_estimated) %>
<% if @track_thing %>
<p></p>
<%= render :partial => 'track/tracking_links', :locals => { :track_thing => @track_thing, :own_request => false, :location => 'main' } %>
<% end %>
<% end %>
<% end %>
<% if @advanced %>
<div id="advanced-search-tips">
<a name="show-tips"></a>
<h2><%= _("Advanced search tips")%></h2>
<ul>
<li><%= _("Enter words that you want to find separated by spaces, e.g. <strong>climbing lane</strong>") %></li>
<li><%= _('Use OR (in capital letters) where you don\'t mind which word, e.g. <strong><code>commons OR lords</code></strong>') %>
<li><%= _('Use quotes when you want to find an exact phrase, e.g. <strong><code>"Liverpool City Council"</code></strong>') %></li>
<li><%= _('<strong><code>status:</code></strong> to select based on the status or historical status of the request, see the <a href="{{statuses_url}}">table of statuses</a> below.', :statuses_url => "#statuses") %></li>
<li><%= _('<strong><code>variety:</code></strong> to select type of thing to search for, see the <a href="{{varieties_url}}">table of varieties</a> below.', :varieties_url => "#varieties") %></li>
<li><%= _('<strong><code>requested_from:home_office</code></strong> to search requests from the Home Office, typing the name as in the URL.')%></li>
<li><%= _('<strong><code>requested_by:julian_todd</code></strong> to search requests made by Julian Todd, typing the name as in the URL.') %></li>
<li><%= _('<strong><code>commented_by:tony_bowden</code></strong> to search annotations made by Tony Bowden, typing the name as in the URL.')%></li>
<li><%= _('<strong><code>request:</code></strong> to restrict to a specific request, typing the title as in the URL.')%>
<li><%= _('<strong><code>filetype:pdf</code></strong> to find all responses with PDF attachments. Or try these: <code>{{list_of_file_extensions}}</code>', :list_of_file_extensions => IncomingMessage.get_all_file_extensions)%></li>
<li><%= _('Type <strong><code>01/01/2008..14/01/2008</code></strong> to only show things that happened in the first two weeks of January.')%></li>
<li><%= _('<strong><code>tag:charity</code></strong> to find all public bodies or requests with a given tag. You can include multiple tags,
and tag values, e.g. <code>tag:openlylocal AND tag:financial_transaction:335633</code>. Note that by default any of the tags
can be present, you have to put <code>AND</code> explicitly if you only want results them all present.')%></li>
<li><%= _('Read about <a href="{{advanced_search_url}}">advanced search operators</a>, such as proximity and wildcards.', :advanced_search_url => "http://www.xapian.org/docs/queryparser.html") %></li>
</ul>
<h2 id="statuses"><%= _('Table of statuses') %></h2>
<table class="status_table">
<tr><td><strong><%=search_link('status:waiting_response', nil, nil, true)%></strong></td><td><%= _('Waiting for the public authority to reply') %></td></tr>
<tr><td><strong><%=search_link('status:not_held', nil, nil, true)%></strong></td><td><%= _('The public authority does not have the information requested') %></td></tr>
<tr><td><strong><%=search_link('status:rejected', nil, nil, true)%></strong></td><td><%= _('The request was refused by the public authority') %></td></tr>
<tr><td><strong><%=search_link('status:partially_successful', nil, nil, true)%></strong></td><td><%= _('Some of the information requested has been received') %></td></tr>
<tr><td><strong><%=search_link('status:successful', nil, nil, true)%></strong></td><td><%= _('All of the information requested has been received') %></td></tr>
<tr><td><strong><%=search_link('status:waiting_clarification', nil, nil, true)%></strong></td><td><%= _('The public authority would like part of the request explained') %></td></tr>
<tr><td><strong><%=search_link('status:gone_postal', nil, nil, true)%></strong></td><td><%= _('The public authority would like to / has responded by post') %></td></tr>
<tr><td><strong><%=search_link('status:internal_review', nil, nil, true)%></strong></td><td><%= _('Waiting for the public authority to complete an internal review of their handling of the request') %></td></tr>
<tr><td><strong><%=search_link('status:error_message', nil, nil, true)%></strong></td><td><%= _('Received an error message, such as delivery failure.') %></td></tr>
<tr><td><strong><%=search_link('status:requires_admin', nil, nil, true)%></strong></td><td><%= _('A strange reponse, required attention by the {{site_name}} team', :site_name=>site_name) %></td></tr>
<tr><td><strong><%=search_link('status:user_withdrawn', nil, nil, true)%></strong></td><td><%= _('The requester has abandoned this request for some reason') %></td></tr>
</table>
<h2 id="varieties"><%= _('Table of varieties') %></h2>
<table class="status_table">
<tr><td><strong><%=search_link('variety:sent', nil, nil, true)%></strong></td><td><%= _('Original request sent') %></td></tr>
<tr><td><strong><%=search_link('variety:followup_sent', nil, nil, true)%></strong></td><td><%= _('Follow up message sent by requester') %></td></tr>
<tr><td><strong><%=search_link('variety:response', nil, nil, true)%></strong></td><td><%= _('Response from a public authority') %></td></tr>
<tr><td><strong><%=search_link('variety:comment', nil, nil, true)%></strong></td><td><%= _('Annotation added to request') %></td></tr>
<tr><td><strong><%=search_link('variety:authority', nil, nil, true)%></strong></td><td><%= _('A public authority') %></td></tr>
<tr><td><strong><%=search_link('variety:user', nil, nil, true)%></strong></td><td><%= _('A {{site_name}} user', :site_name=>site_name) %></td></tr>
</table>
</div>
<% end %>
|