<% @title = _("FOI request – {{title}}", :title => h(@info_request.title)) %>

<%=@title%>

<% form_tag admin_request_move_request_path, { :class => "form form-horizontal" } do %> <%= hidden_field_tag 'info_request_id', @info_request.id %>
<%= chevron_down %>Request metadata
<% @info_request.for_admin_column do |name, value, type, column_name|%> <% end %>
<%= link_to 'Edit metadata', admin_request_edit_path(@info_request), :class => "btn" %>
Public page: <%= link_to request_url(@info_request), request_path(@info_request) %>
<%= name %>: <% if type == 'datetime' %> <%= I18n.l(value, :format => "%e %B %Y %H:%M:%S") %> (<%= _('{{length_of_time}} ago', :length_of_time => time_ago_in_words(value)) %>) <% else %> <%= h value %> <% end %> <% if column_name == 'described_state' %>
  • Initial request last sent at: <%= @info_request.calculate_status %>
  • Initial request last sent at: <%=@info_request.date_initial_request_last_sent_at.to_date %>
  • Date response required by: <%= @info_request.date_response_required_by %>
  • Very overdue after: <%= @info_request.date_very_overdue_after %>
<% end %>
Created by <% if @info_request.is_external? %> <%= link_to(eye, @info_request.external_url, :title => "view URL of original request on external website") %> <%= @info_request.public_body.name %> on behalf of <%= (@info_request.user_name || _('an anonymous user'))%> (using API) <% else %> <%= user_both_links(@info_request.user) %> <%= link_to _("move..."), "#", :class => "btn btn-mini btn-warning toggle-hidden" %>
url_name of new user: <%= text_field_tag 'user_url_name', "", { :size => 20 } %> <%= submit_tag "Move request to user", :class => "btn btn-info" %>
<% end %>
Public authority: <%= public_body_both_links(@info_request.public_body) %> <%= link_to "move...", "#", :class => "btn btn-mini btn-warning toggle-hidden" %>
url_name of new authority: <%= text_field_tag 'public_body_url_name', "", { :size => 20 } %> <%= submit_tag "Move request to authority", :class => "btn btn-info" %>
<%=_("Incoming email address")%> <%= link_to h(@info_request.incoming_email), "mailto:#{@info_request.incoming_email}" %>
<%=_("Tags")%> <%= render :partial => 'tags', :locals => { :info_request => @info_request} %>
<%= link_to 'Edit metadata', admin_request_edit_path(@info_request), :class => "btn" %>
<% end %>
Actions
<%= link_to 'Generate URL', admin_request_generate_upload_url_path(@info_request), :class => "btn" %>

(see also option to general URLs for individual incoming messages below)

<% form_tag admin_request_hide_path(@info_request), :class => "form form-inline", :id => "hide_request_form" do %>
<% if @info_request.is_external? %> <% else %> <% end %>
<% if ['hidden', 'requester_only'].include? @info_request.prominence %>

This request has already been hidden

<% else %> <% end %>
<% if !['hidden', 'requester_only'].include? @info_request.prominence %> <% if ! @info_request.is_external? %>
<%= text_field_tag "subject", "Your request on WhatDoTheyKnow.com hidden", {:id => "request_hidden_user_subject_field", :cols => 100} %>
<%= text_area_tag "explanation", h(@request_hidden_user_explanation), {:id => "request_hidden_user_explanation_field"} %>
<% end %>
<%= submit_tag _("Hide request"), :class => "btn" %>
<% end %> <% end %>

Events

<% for info_request_event in @info_request.info_request_events.find(:all, :order => "created_at, id") %>
<%= chevron_right %> <%= _("Event {{id}}", :id => info_request_event.id) %>: <%=h info_request_event.event_type.humanize %><% if !info_request_event.calculated_state.nil? %>; state: <%= info_request_event.calculated_state %><% end %> <%= info_request_event.created_at%>
<% info_request_event.for_admin_column do |name, value, type, column_name| %> <% end %>
<% if info_request_event.described_state != 'waiting_clarification' and info_request_event.event_type == 'response' %> <% form_tag admin_request_clarification_path, :class => "form form-inline admin-table-form admin-inline-form" do %> <%= hidden_field_tag 'info_request_event_id', info_request_event.id, :id => nil %> <%= submit_tag "Was clarification request", :class => "btn btn-mini btn-primary" %> <% end %> <% end %>
<%=h name%> <% if column_name == 'params_yaml' %> <%= info_request_event.params_yaml_as_html %> <% elsif value.nil? %> nil <% elsif %w(text string).include?(type) %> <%=h value.humanize %> <% elsif type == 'datetime' %> <%= admin_date value %> <% else %> <%=h value %> <% end %>
<% end %>

Outgoing messages

<% for outgoing_message in @info_request.outgoing_messages.find(:all, :order => 'created_at') %>
<%= chevron_right %> <% link_to admin_request_edit_outgoing_path(outgoing_message) do %> #<%= outgoing_message.id %> -- <%= outgoing_message.status.humanize %> <%= outgoing_message.message_type.humanize %> <% end %>
<%= truncate(outgoing_message.body, :length => 400) %>
<% outgoing_message.for_admin_column do |name, value, type, column_name| %> <% end %>
<% form_tag admin_request_resend_path, :class => "admin-table-form" do %> <%= hidden_field_tag 'outgoing_message_id', outgoing_message.id %> <%= submit_tag "Resend", :class => "btn" %> <% end %>
<%=name%> <% if column_name == 'body' %> <%= simple_format(truncate(outgoing_message.body, :length => 400, :omission => link_to("...", "#", :class => "toggle-hidden" ))) %>
<%= simple_format( outgoing_message.body ) %>
<% else %> <%= admin_value(value) %> <% end %>
<% end %>

Incoming messages

<% for incoming_message in @info_request.incoming_messages.find(:all, :order => 'created_at') %>
<%= chevron_right %> <%=incoming_message.id%> -- <%= h(incoming_message.mail_from) %> <%=_("at")%> <%=admin_value(incoming_message.sent_at)%>
<% if !incoming_message.cached_main_body_text_folded.nil? %> <%= truncate(incoming_message.cached_main_body_text_folded.gsub('FOLDED_QUOTED_SECTION', ''), :length => 400) %> <% end %>
<% incoming_message.for_admin_column do |name, value, type, column_name| %> <% end %>
<%= render :partial => 'incoming_message_actions', :locals => { :incoming_message => incoming_message } %>
<%=name%> <% if column_name =~ /^cached_.*?$/ %> <%= simple_format( truncate(value, :length => 400, :omission => link_to("...", "#", :class => "toggle-hidden"))) %>
<%= simple_format(value) %>
<% else %> <%= simple_format(value) %> <% end %>
<% end %>

Annotations

<% if @info_request.comments.size > 0 %>
<% for comment in @info_request.comments %>
<%= chevron_right %> <% link_to admin_request_edit_comment_path(comment) do %> #<%=comment.id%> -- <%=h(comment.user.name)%> <%=admin_value(comment.created_at)%> <% end %>
<%= truncate(comment.body, :length => 400) %>
<% comment.for_admin_column do |name, value, type, column_name |%> <% end %>
By <%= user_both_links(comment.user) %>
<%=name%> <% if column_name == 'body' && !comment.visible %> <%=h comment.send(column_name) %> <% else %> <%=h comment.send(column_name) %> <% end %>
<% end %>
<% else %>

None yet.

<% end %>

Mail server delivery logs

(Lines containing the request incoming email address, updated hourly.)

<% for mail_server_log_done_id, mail_server_logs in @info_request.mail_server_logs.group_by(&:mail_server_log_done_id) %>
<% for mail_server_log in mail_server_logs %><%=h mail_server_log.line%><% end %>
<% end %> <% if @info_request.mail_server_logs.size == 0 %>

None (perhaps this is an old or a very new request)

<% end %>

Censor rules

<%= render :partial => 'admin_censor_rule/show', :locals => { :censor_rules => @info_request.censor_rules, :info_request => @info_request } %>