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
|
<% @title = "FOI request - " + h(@info_request.title) %>
<%= javascript_include_tag :defaults %>
<h1><%=@title%></h1>
<p>
<% for column in InfoRequest.content_columns %>
<strong><%= column.human_name %>:</strong> <%=h @info_request.send(column.name) %>
<br/>
<% end %>
<strong>Created by:</strong> <%= user_both_links(@info_request.user) %> <br>
<strong>Public authority:</strong> <%= public_body_both_links(@info_request.public_body) %> <br>
<strong>Incoming email address:</strong> <%= link_to h(@info_request.incoming_email), "mailto:" + @info_request.incoming_email %> <br>
</p>
<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 %>
</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' %>
<pre><%= info_request_event.params_yaml %></pre>
<% elsif column.text? %>
<%=h (info_request_event.send(column.name) || '').gsub(/_/,' ') %>
<% else %>
<%=h info_request_event.send(column.name) %>
<% end %>
</td>
<% end %>
</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, 400,
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_.*?_text$/ %>
<td>
<div><%= simple_format( truncate(incoming_message.send(column), 400,
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 } %>
|