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
|
<% @title = "FOI request - " + h(@info_request.title) %>
<%= javascript_include_tag :defaults %>
<h1><%=@title%></h1>
<% form_tag '../move_request', { :class => "inline" } do %>
<p>
<%= hidden_field_tag 'info_request_id', @info_request.id %>
<% for column in InfoRequest.content_columns %>
<strong><%= column.human_name %>:</strong> <%=h @info_request.send(column.name) %>
<% if column.name == 'described_state' %>
<strong>Calculated status:</strong> <%= @info_request.calculate_status %>
<br/><strong>Initial request last sent at:</strong> <%=@info_request.date_initial_request_last_sent_at.to_date %>
<strong>Date response required by:</strong> <%= @info_request.date_response_required_by %>
<strong>Very overdue after:</strong> <%= @info_request.date_very_overdue_after %>
<% end %>
<% if ![ 'allow_new_responses_from' ].include?(column.name) %>
<br/>
<% end %>
<% end %>
<strong>Created by:</strong> <%= user_both_links(@info_request.user) %>
<span>
<span>
(<%= link_to_function("move...", "$(this).up(1).childElements().invoke('toggle')") %>)
</span>
<span style="display:none;">
<strong>url_name of new user:</strong>
<%= text_field_tag 'user_url_name', "", { :size => 20 } %>
<%= submit_tag "Move request to user" %>
</span>
</span>
<br>
<strong>Public authority:</strong> <%= public_body_both_links(@info_request.public_body) %>
<span>
<span>
(<%= link_to_function("move...", "$(this).up(1).childElements().invoke('toggle')") %>)
</span>
<span style="display:none;">
<strong>url_name of new authority:</strong>
<%= text_field_tag 'public_body_url_name', "", { :size => 20 } %>
<%= submit_tag "Move request to authority" %>
</span>
</span>
<br>
<strong>Incoming email address:</strong> <%= link_to h(@info_request.incoming_email), "mailto:" + @info_request.incoming_email %> <br>
<b>Tags:</b> <%= render :partial => 'tags', :locals => { :info_request => @info_request} %> <br>
</p>
<% end %>
<p>
<%= link_to 'Public page', main_url(request_url(@info_request)) %>
| <%= link_to 'Edit', '../edit/' + @info_request.id.to_s %>
| <%= link_to 'FOI officer upload URL', '../generate_upload_url/' + @info_request.id.to_s %> (see also links on incoming messages below)
</p>
<h2>Events</h2>
<table>
<tr>
<th>Id</th>
<% for column in InfoRequestEvent.content_columns %>
<th><%= column.human_name %></th>
<% end %>
<th>Actions</th>
</tr>
<% for info_request_event in @info_request.info_request_events.find(:all, :order => "created_at, id") %>
<tr class="<%= cycle('odd', 'even') %>">
<td><%=h info_request_event.id %></td>
<% for column in InfoRequestEvent.content_columns %>
<td>
<% if column.name == 'params_yaml' %>
<%= info_request_event.params_yaml_as_html %>
<% elsif column.text? %>
<%=h (info_request_event.send(column.name) || '').gsub(/_/,' ') %>
<% else %>
<%=h info_request_event.send(column.name) %>
<% end %>
</td>
<% end %>
<td>
<% if info_request_event.described_state != 'waiting_clarification' and info_request_event.event_type == 'response' %>
<% form_tag '../mark_event_as_clarification' do %>
<div>
<%= hidden_field_tag 'info_request_event_id', info_request_event.id %>
<%= submit_tag "Was clarification request" %>
</div>
<% end %>
<% end %>
</td>
</tr>
<% end %>
</table>
<h2>Outgoing messages</h2>
<table>
<tr>
<th>Id</th>
<% for column in OutgoingMessage.content_columns %>
<th><%= column.human_name %></th>
<% end %>
<th>Actions</th>
</tr>
<% for outgoing_message in @info_request.outgoing_messages.find(:all, :order => 'created_at') %>
<tr class="<%= cycle('odd', 'even') %>">
<td><%=h outgoing_message.id %></td>
<% for column in OutgoingMessage.content_columns.map { |c| c.name } %>
<% if column == 'body' %>
<td>
<div><%= simple_format( truncate(outgoing_message.body, :length => 400,
:omission => link_to_function("...", "$(this).up('td').childElements().invoke('toggle')")
)) %></div>
<div style="display:none;"><%= simple_format( outgoing_message.body ) %></div>
</td>
<% else %>
<td><%= simple_format( outgoing_message.send(column) ) %></td>
<% end %>
<% end %>
<td>
<% form_tag '../resend' do %>
<div>
<%= hidden_field_tag 'outgoing_message_id', outgoing_message.id %>
<%= submit_tag "Resend" %>
</div>
<% end %>
<%= link_to "Edit", '../edit_outgoing/' + outgoing_message.id.to_s %>
</td>
</tr>
<% end %>
</table>
<h2>Incoming messages</h2>
<table>
<tr>
<th>Id</th>
<% for column in IncomingMessage.content_columns %>
<th><%= column.human_name %></th>
<% end %>
<th>Actions</th>
</tr>
<% for incoming_message in @info_request.incoming_messages.find(:all, :order => 'created_at') %>
<tr class="<%= cycle('odd', 'even') %>" id="incoming-<%=incoming_message.id.to_s%>">
<td><%=h incoming_message.id %></td>
<% for column in IncomingMessage.content_columns.map { |c| c.name } %>
<% if column =~ /^cached_.*?$/ %>
<td>
<div><%= simple_format( truncate(incoming_message.send(column), :length => 400,
:omission => link_to_function("...", "$(this).up('td').childElements().invoke('toggle')")
)) %></div>
<div style="display:none;"><%= simple_format( incoming_message.send(column) ) %></div>
</td>
<% else %>
<td><%= simple_format( incoming_message.send(column) ) %></td>
<% end %>
<% end %>
<td>
<% if !incoming_message.raw_email_id.nil? %>
<p>
<%= link_to "View raw email", "../show_raw_email/" + incoming_message.raw_email_id.to_s %>
</p>
<% end %>
<%= render :partial => 'incoming_message_actions', :locals => { :incoming_message => incoming_message } %>
</td>
</tr>
<% end %>
</table>
<h2>Annotations</h2>
<% if @info_request.comments.size > 0 %>
<table>
<tr>
<th>Id</th>
<th>Posted by</th>
<% for column in Comment.content_columns %>
<th><%= column.human_name %></th>
<% end %>
<th>Actions</th>
</tr>
<% for comment in @info_request.comments %>
<tr class="<%= cycle('odd', 'even') %>">
<td><%=h comment.id %></td>
<td><%= user_both_links(comment.user) %></td>
<% for column in Comment.content_columns.map { |c| c.name } %>
<% if column == 'body' && !comment.visible %>
<td><s><%=h comment.send(column) %></s></td>
<% else %>
<td><%=h comment.send(column) %></td>
<% end %>
<% end %>
<td>
<%= link_to "Edit", '../edit_comment/' + comment.id.to_s %>
</td>
</tr>
<% end %>
</table>
<% else %>
<p>None yet.</p>
<% end %>
<h2>Exim delivery logs</h2>
<p><i>(Lines containing the request incoming email address, updated hourly.)</i></p>
<% for exim_log_done_id, exim_logs in @info_request.exim_logs.group_by(&:exim_log_done_id) %>
<!-- <h3><%=h exim_logs[0].exim_log_done.filename %></h3> -->
<pre><% for exim_log in exim_logs %><%=h exim_log.line%><% end %></pre>
<% end %>
<% if @info_request.exim_logs.size == 0 %>
<p>None (perhaps this is an old or a very new request)</p>
<% end %>
<h2>Censor rules</h2>
<%= render :partial => 'admin_censor_rule/show', :locals => { :censor_rules => @info_request.censor_rules, :info_request => @info_request } %>
|