<commit_before>{% extends 'foirequest/base.html' %}
{% load url from future %}
{% load i18n %}
{% load markup %}
{% load comments %}
{% load foirequest_tags follower_tags %}

{% block title %}{{ object.title }}{% endblock %}

{% block metadescription %}{{ object.description }}{% endblock %}


{% block extra_head %}
<link rel="self" type="text/html" href="{% url 'foirequest-show' slug=object.slug %}"/>
<link href="{% url 'foirequest-feed' slug=object.slug %}" rel="alternate nofollow" type="application/rss+xml" title="{% blocktrans with title=object.title %}RSS Feed for request '{{ title }}'{% endblocktrans %}">
<link rel="alternate nofollow" type="application/atom+xml" title="{% blocktrans with title=object.title %}Atom feed for request '{{ title }}'{% endblocktrans %}" href="{% url 'foirequest-feed_atom' slug=object.slug %}" /> 

{% endblock %}

{% block body %}
<h2>{{ object.title }}</h2>
<div class="clearfix">
  <div class="span-18">
{% if not object.is_foi %}
<div class="notice">
  {% blocktrans %}This request is not an FoI request. This site is only for requesting specific information from public bodies.{% endblocktrans %}
</div>
{% endif %}

<dl>
  <dt>{% blocktrans %}Request to:{% endblocktrans %}</dt>
  <dd>{% if object.public_body %}
  <a href="{{ object.public_body.get_absolute_url }}">{{ object.public_body.name }}</a>
  {% else %}
  {% blocktrans %}Not yet known{% endblocktrans %}
  {% endif %}</dd>
  {% if object.law %}
  {% if object.law.meta %}
  <dt>{% blocktrans %}Laws used:{% endblocktrans %}</dt>
  <dd>
    <ul>
    {% for law in object.law.combined.all %}
      <li>
        <a href="{% url 'publicbody-foilaw-show' slug=law.slug %}" class="target-new">{{ law.name }}</a>
      </li>
    {% endfor %}
    </ul>
  </dd>
  {% else %}
    <dt>{% blocktrans %}Law used:{% endblocktrans %}</dt>
    <dd><a href="{% url 'publicbody-foilaw-show' slug=object.law.slug %}" class="target-new">{{ object.law.name }}</a>
    </dd>
  {% endif %}
  {% else %}
    <dt>{% blocktrans %}Law used:{% endblocktrans %}</dt>
    <dd>{% blocktrans %}Not yet set{% endblocktrans %}</dd>
  {% endif %}
  <dt>{% blocktrans %}Status of this request:{% endblocktrans %}</dt>
  <dd>{{ object.readable_status }}</dd>
  {% if object.awaits_response %}
    <dt>{% blocktrans %}Due date:{% endblocktrans %}</dt>
  {% if object.is_overdue %}
  <dd class="red">
  {{ object.due_date|date:"DATE_FORMAT" }} - {% blocktrans with due=object.due_date|timesince %}{{ due }} ago{% endblocktrans %}
  {% else %}
    <dd>{{ object.due_date|date:"DATE_FORMAT" }} - {% blocktrans with due=object.due_date|timeuntil %}in {{ due }}{% endblocktrans %}
    {% endif %}
    (<a href="{% url 'help-foi_officers' %}#frist">{% blocktrans %}Details{% endblocktrans %}</a>)
    </dd>
  {% endif %}
{% if object.refusal_reason %}
  <dt>{% blocktrans %}Refusal Reason{% endblocktrans %}</dt>
  <dd>{{ object.refusal_reason }}</dd>
{% endif %}
{% if object.costs > 0 %}
  <dt>{% blocktrans %}Cost of information:{% endblocktrans %}</dt>
  <dd>{{ object.costs|floatformat:2 }} {{ froide.currency }}</dd>
  {% endif %}
{% if object.description %}
  <dt>{% blocktrans %}Summary of Request{% endblocktrans %}</dt>
  <dd>{{ object.get_description|urlizetrunc:40|linebreaks }}</dd>
  {% endif %}
{% if object.resolution %}
  <dt>{% blocktrans %}Summary of Resolution{% endblocktrans %}</dt>
  <dd>{{ object.resolution|urlizetrunc:40|linebreaks }}</dd>
{% endif %}

</dl>
{# Public Body Needed #}
{% if object.status == "publicbody_needed" %}
<div class="info">
  {% blocktrans %}This request was not sent yet, because it still needs a Public Body as a recipient.{% endblocktrans %}
</div>
{% if not object.public %}
<div class="notice">
  {% blocktrans %}This request is not public and will not receive suggestions for public bodies from users!{% endblocktrans %}
</div>
{% endif %}
{% endif %}
{# Unconfirmed Public Body #}
{% if object.public_body and not object.public_body.confirmed %}
<div class="notice">
  {% blocktrans %}The public body of this request has been created by the user and still needs to be confirmed.{% endblocktrans %}
</div>
{% endif %}
{# End Unconfirmed Public Body #}

<hr/>
</div>
<div class="span-6 last">
    {% if user.is_authenticated and user != object.user %}
    <form method="post" action="{% url 'foirequestfollower-follow' slug=object.slug %}" id="followrequest-form">
      {% csrf_token %}
    {% if followform %}
      {{ followform.as_p }}
      <input type="submit" value="{% trans "Follow request" %}"/>
    {% else %}
      {% followrequest object user "followform" %}
      {{ followform.as_p }}
      {% if followform.following %}
      <span class="help">{% blocktrans %}You are currently <span class="green">following</span> this request and you will get email updates.{% endblocktrans %}</span>
      <button class="button icon remove" type="submit"/>{% trans "Unfollow request" %}</button><br/>
      {% else %}
      <span class="help">{% blocktrans %}Follow this request and get notified by email when something changes.{% endblocktrans %}</span>
      <button class="button mail icon" type="submit"/>{% trans "Follow request" %}</button><br/>
      {% endif %}
    {% endif %}
    </form>
    {% endif %}
    <ul class="iconed-list">
      <li class="rss-icon">
          <a href="{% url 'foirequest-feed' slug=object.slug %}">{% trans "RSS Feed" %}</a>
      </li>
      <li class="atom-icon">
          <a href="{% url 'foirequest-feed_atom' slug=object.slug %}">{% trans "Atom Feed" %}</a>
      </li>
    </ul>
  {% if user.is_staff %}
    <h3>{% trans "Admin Tools" %}</h3>
    <a href="{% url 'admin:foirequest_foirequest_change' object.id %}">{% trans "View on Admin site" %}</a><br/>
    {% if object.checked %}
      {% trans "Marked as checked" %}<br/>
    {% else %}
    <form method="post" action="{% url 'foirequest-mark_checked' slug=object.slug %}">
      {% csrf_token %}
      <input class="button" type="submit" value="{% trans "Mark as checked" %}"/>
    </form>
    {% endif %}
    {% if not object.is_foi %}
      {% trans "Marked as NOT FoI" %}<br/>
    {% else %}
    <form method="post" action="{% url 'foirequest-mark_not_foi' slug=object.slug %}">
      {% csrf_token %}
      <input class="button" type="submit" value="{% trans "Mark as NOT FoI" %}"/>
    </form>
    {% endif %}
  {% endif %}
</div>
</div>
<div class="span-18">
<h4 id="messages">{% blocktrans %}Messages in this request{% endblocktrans %}</h4>

{% for message in object.messages %}
<div id="{{ message.get_html_id }}" class="message-container">
  <div class="message{% if not message.sender_user %} message-received{% endif %}{% if message.is_postal %} message-postal{% endif %}{% if message.is_escalation %} message-escalated{% endif %}">
  <table class="message-table">
    <tbody>
    <tr>
      <td class="key">{% blocktrans %}From{% endblocktrans %}</td>
      <td class="value-padding-right">
      {% if object.user == user %}
          {% if message.is_response %}
          {{ message.real_sender }} – {{ message.sender_public_body.name }} (<a href="#change-pb-{{ message.id }}" class="toggle">{% trans "change" %}</a>)
          <div id="change-pb-{{ message.id }}" style="display:none">
            {% with message_pb_form=message.get_public_body_sender_form %}
               <form method="post" action="{% url 'foirequest-set_message_sender' slug=object.slug message_id=message.id %}">
                 {% csrf_token %}
                 <label for="id_m{{ message.id }}-sender">{% blocktrans %}Set the Public Body that sent this message:{% endblocktrans %}</label> 
                  {{ message_pb_form.sender }}
                  <input type="submit" value="{% blocktrans %}Set Sending Public Body{% endblocktrans %}"/>
                </form>
              {% endwith %}
          </div>
          {% else %}
          {{ message.real_sender }}
          {% endif %}
      {% else %}
        {{ message.sender }}
        {% endif %}</td>
    </tr>
    <tr>
      <td class="key">{% blocktrans %}Subject{% endblocktrans %}</td>
      <td class="value-padding-right"><strong>{{ message.subject }}</strong></td>
    </tr>
    <tr>
      <td class="key">{% blocktrans %}Date{% endblocktrans %}</td>
      {% if message.is_postal %}
      <td>{{ message.timestamp|date:"DATE_FORMAT" }}</td>
      {% else %}
      <td>{{ message.timestamp|date:"DATETIME_FORMAT" }}</td>
      {% endif %}
    </tr>
    {% if not message.is_response %}
    <tr>
      <td class="key">{% blocktrans %}To{% endblocktrans %}</td>
      <td>{{ message.get_recipient }}</td>
    </tr>
    {% endif %}
    {% if message.status %}
    <tr>
      <td class="key">{% blocktrans %}Status{% endblocktrans %}</td>
      <td>{{ message.readable_status }}</td>
    </tr>
    {% endif %}
    {% if message.all_attachments %}
    <tr>
      <td class="key">{% blocktrans %}Attachments{% endblocktrans %}</td>
    <td>
      <ul>
    {% for attachment in message.all_attachments %}
    <li>
    <a href="{{ attachment.file.url }}">{{ attachment.name }} ({{ attachment.size|filesizeformat }})</a>{% if attachment.can_preview %} - <a class="target-new" href="{{ attachment.get_preview_url }}">{% blocktrans %}Preview in Browser{% endblocktrans %}</a>{% endif %}
    </li>
    {% endfor %}
  </ul>
    </td>
  </tr>
  {% endif %}
  {% if user == object.user and message.is_postal %}
  <tr>
    <td class="key">{% blocktrans %}Upload Attachments{% endblocktrans %}</td>
    {% with form=message.get_postal_attachment_form %}
    <td>
      <form method="post" action="{% url 'foirequest-add_postal_reply_attachment' slug=object.slug message_id=message.pk %}" enctype="multipart/form-data">{% csrf_token %}
      {{ form.scan }}
      <button type="submit" class="upload-button button icon add">{% blocktrans %}Upload Document{% endblocktrans %}</button><br/>
      {{ form.scan.help_text }}
      </form>
    </td>
    {% endwith %}
  {% endif %}
  </tbody>
</table>
{# Set status #}
{% if object.user == user and message.needs_status_input %}
<div id="set-status" class="section important-form">
  <form method="post" action="{% url 'foirequest-set_status' slug=object.slug %}#set-status">{% csrf_token %}
    {% if status_form %}
      {% include "foirequest/_set_status.html" %}
    {% else %}
      {% with status_form=object.get_status_form %}
        {% include "foirequest/_set_status.html" %}
      {% endwith %}
    {% endif %}
    <button class="button icon tag" type="submit">{% blocktrans %}Set status{% endblocktrans %}</button>
    </p>
  </form>
</div>
{% endif %}
{# End Set status #}
  <hr/>
  {% if forloop.counter0 == 0 %}
  <div class="message-content">{% highlight_request message %}</div>
  {% else %}
  {% if user == object.user %}
  <div class="message-content">{{ message.get_real_content|urlize }}</div>
  {% else %}
  <div class="message-content">{{ message.get_content|urlize }}</div>
  {% endif %}
  {% endif %}
</div>

{% if message.events %}
<div class="events">
  <ol>
  {% for event in message.events %}
  <li class="event" id="{{ event.get_html_id }}"><span title="{{ event.timestamp }}">{% blocktrans with time=event.timestamp|timesince %}{{ time }} ago{% endblocktrans %}</span>: {{ event.as_html }}</li>
  {% endfor %}
  </ol>
</div>
{% endif %}
<div class="comments-container">
  {% get_comment_list for message as comment_list %}
<div id="comments-{{ message.id }}" class="comments">
  {% include "comments/foirequest/list.html" %}
  <a class="toggle" href="#comment-form-{{ message.id }}">{% blocktrans %}Write a comment{% endblocktrans %}</a>
  <div class="comment-form" id="comment-form-{{ message.id }}">
  {% if user.is_authenticated %}
  {% with next=object.get_absolute_url %}
    {% render_comment_form for message %}
  {% endwith %}
  {% else %}
  <a href="{% url 'account-login' %}">{% blocktrans %}Please login to write a comment.{% endblocktrans %}</a><br/>
  {% endif %}
  </div>
</div>
</div>
</div>
{% empty %}
<p>{% blocktrans %}No messages yet{% endblocktrans %}</p>
{% endfor %}

{# Public Body Needed #}
{% if object.status == "publicbody_needed" %}
<div class="section">
  <p>{% blocktrans %}You can suggest a public body for this request.{% endblocktrans %}
  {% with suggestions=object.public_body_suggestions %}
  {% if suggestions %}
  <br/>{% blocktrans %}The following public bodies have already been suggested:{% endblocktrans %}
  {% endif %}
  </p>
      <ul>
      {% for suggestion in suggestions %}
      <li><strong>{{ suggestion.public_body.name }}</strong> - <a href="{{ suggestion.public_body.get_absolute_url }}" class="info-link">{% blocktrans %}Details{% endblocktrans %}</a>{% if suggestion.reason %}<br/>
      {% blocktrans %}Reason given by the user:{% endblocktrans %} {{ suggestion.reason }}
      {% endif %}
      </li>
      {% empty %}
        <li>{% blocktrans %}There are no suggestions yet{% endblocktrans %}</li>
      {% endfor %}
      </ul>
  {% endwith %}
  <form method="post" action="{% url 'foirequest-suggest_public_body' slug=object.slug %}">
    {% csrf_token %}
    {% with form=object.make_public_body_suggestion_form %}
    {{ form.public_body }}
    {{ form.reason.label_tag }} {{ form.reason }}
    {% endwith %}
    <br/><input type="submit" value="{% blocktrans %}Suggest this Public Body{% endblocktrans%}"/>
  </form>
</div>

{% if object.user == user %}
{% with suggestions_form=object.public_body_suggestions_form %}
  {% if suggestions_form %}
  <div class="section important-form">
    <p>{% blocktrans %}As the author of this request, please choose a public body from one of the suggestions:{% endblocktrans %}</p>
    <form method="post" action="{% url 'foirequest-set_public_body' slug=object.slug %}">
      {% csrf_token %}
      {{ suggestions_form }}
      <input type="submit" value="{% blocktrans %}Send this request to the selected Public Body{% endblocktrans %}"/>
    </form>
  </div>
  {% endif %}
  {% endwith %}
{% endif %}
{% endif %}
{# End Public Body Needed #}

{# Write Resolution #}
{% if object.user == user and object.status_is_final %}
<div class="section">
  {% if object.resolution %}
  <a href="#write-resolution" class="toggle">{% blocktrans %}Write a summary of the response{% endblocktrans %}</a>
  {% endif %}
  <div id="write-resolution"{% if object.resolution %} style="display: none"{% endif %}>
    <h3>{% blocktrans %}Resolution Summary{% endblocktrans %}</h3>
    <form method="post" action="{% url 'foirequest-set_resolution' slug=object.slug %}">{% csrf_token %}
      <p>{% blocktrans %}Please give a summary of the response.{% endblocktrans %}<br/>
      {% blocktrans %}Have you received the information you need? What have you learned from it?{% endblocktrans %}</p>
      <textarea rows="8" name="resolution">{{ object.resolution }}</textarea><br/>
      <input type="submit" value="{% blocktrans %}Save Summary{% endblocktrans %}"/>
    </form>
  </div>
</div>
{% endif %}
{# End Write Resolution #}

{# If Meta Law #}
{% if object.user == user and object.law.meta and object.reply_received %}
<div class="section">
  <form method="post" action="{% url 'foirequest-set_law' slug=object.slug %}">{% csrf_token %}
    <p>{% blocktrans %}This request was made under multiple information laws. If it is apparent from the reply under which law the request was answered, please choose this law below. If it is not obvious, leave it as it is.{% endblocktrans %}</p>
    {{ object.get_concrete_law_form.as_p }}
    <input type="submit" value="{% blocktrans %}Set Concrete Law{% endblocktrans %}"/>
  </form>
</div>
{% endif %}

{# Escalate #}
{% if object.has_been_refused and object.law.mediator %}
<div class="section">
  <a href="#escalate" class="toggle">{% blocktrans %}Send a letter to a mediator{% endblocktrans %}</a>
  <div id="escalate"{% if not escalation_form %} style="display:none"{% endif %}>
  <form method="post" action="{% url 'foirequest-escalation_message' slug=object.slug %}#escalate">{% csrf_token %}
    <p>{% blocktrans with entity=object.law.mediator.name law_name=object.law.name %}You can file a complaint to the {{ entity }} if you think your request was not properly handled under the {{ law_name }}.{% endblocktrans %}</p>
    <table class="no-stripes">
      {% if escalation_form %}
        {{ escalation_form.as_table }}
      {% else %}
        {% with escalation_form=object.get_escalation_message_form %}<commit_msg>Only put resolution in textarea if it's not None<commit_after>{% extends 'foirequest/base.html' %}
{% load url from future %}
{% load i18n %}
{% load markup %}
{% load comments %}
{% load foirequest_tags follower_tags %}

{% block title %}{{ object.title }}{% endblock %}

{% block metadescription %}{{ object.description }}{% endblock %}


{% block extra_head %}
<link rel="self" type="text/html" href="{% url 'foirequest-show' slug=object.slug %}"/>
<link href="{% url 'foirequest-feed' slug=object.slug %}" rel="alternate nofollow" type="application/rss+xml" title="{% blocktrans with title=object.title %}RSS Feed for request '{{ title }}'{% endblocktrans %}">
<link rel="alternate nofollow" type="application/atom+xml" title="{% blocktrans with title=object.title %}Atom feed for request '{{ title }}'{% endblocktrans %}" href="{% url 'foirequest-feed_atom' slug=object.slug %}" /> 

{% endblock %}

{% block body %}
<h2>{{ object.title }}</h2>
<div class="clearfix">
  <div class="span-18">
{% if not object.is_foi %}
<div class="notice">
  {% blocktrans %}This request is not an FoI request. This site is only for requesting specific information from public bodies.{% endblocktrans %}
</div>
{% endif %}

<dl>
  <dt>{% blocktrans %}Request to:{% endblocktrans %}</dt>
  <dd>{% if object.public_body %}
  <a href="{{ object.public_body.get_absolute_url }}">{{ object.public_body.name }}</a>
  {% else %}
  {% blocktrans %}Not yet known{% endblocktrans %}
  {% endif %}</dd>
  {% if object.law %}
  {% if object.law.meta %}
  <dt>{% blocktrans %}Laws used:{% endblocktrans %}</dt>
  <dd>
    <ul>
    {% for law in object.law.combined.all %}
      <li>
        <a href="{% url 'publicbody-foilaw-show' slug=law.slug %}" class="target-new">{{ law.name }}</a>
      </li>
    {% endfor %}
    </ul>
  </dd>
  {% else %}
    <dt>{% blocktrans %}Law used:{% endblocktrans %}</dt>
    <dd><a href="{% url 'publicbody-foilaw-show' slug=object.law.slug %}" class="target-new">{{ object.law.name }}</a>
    </dd>
  {% endif %}
  {% else %}
    <dt>{% blocktrans %}Law used:{% endblocktrans %}</dt>
    <dd>{% blocktrans %}Not yet set{% endblocktrans %}</dd>
  {% endif %}
  <dt>{% blocktrans %}Status of this request:{% endblocktrans %}</dt>
  <dd>{{ object.readable_status }}</dd>
  {% if object.awaits_response %}
    <dt>{% blocktrans %}Due date:{% endblocktrans %}</dt>
  {% if object.is_overdue %}
  <dd class="red">
  {{ object.due_date|date:"DATE_FORMAT" }} - {% blocktrans with due=object.due_date|timesince %}{{ due }} ago{% endblocktrans %}
  {% else %}
    <dd>{{ object.due_date|date:"DATE_FORMAT" }} - {% blocktrans with due=object.due_date|timeuntil %}in {{ due }}{% endblocktrans %}
    {% endif %}
    (<a href="{% url 'help-foi_officers' %}#frist">{% blocktrans %}Details{% endblocktrans %}</a>)
    </dd>
  {% endif %}
{% if object.refusal_reason %}
  <dt>{% blocktrans %}Refusal Reason{% endblocktrans %}</dt>
  <dd>{{ object.refusal_reason }}</dd>
{% endif %}
{% if object.costs > 0 %}
  <dt>{% blocktrans %}Cost of information:{% endblocktrans %}</dt>
  <dd>{{ object.costs|floatformat:2 }} {{ froide.currency }}</dd>
  {% endif %}
{% if object.description %}
  <dt>{% blocktrans %}Summary of Request{% endblocktrans %}</dt>
  <dd>{{ object.get_description|urlizetrunc:40|linebreaks }}</dd>
  {% endif %}
{% if object.resolution %}
  <dt>{% blocktrans %}Summary of Resolution{% endblocktrans %}</dt>
  <dd>{{ object.resolution|urlizetrunc:40|linebreaks }}</dd>
{% endif %}

</dl>
{# Public Body Needed #}
{% if object.status == "publicbody_needed" %}
<div class="info">
  {% blocktrans %}This request was not sent yet, because it still needs a Public Body as a recipient.{% endblocktrans %}
</div>
{% if not object.public %}
<div class="notice">
  {% blocktrans %}This request is not public and will not receive suggestions for public bodies from users!{% endblocktrans %}
</div>
{% endif %}
{% endif %}
{# Unconfirmed Public Body #}
{% if object.public_body and not object.public_body.confirmed %}
<div class="notice">
  {% blocktrans %}The public body of this request has been created by the user and still needs to be confirmed.{% endblocktrans %}
</div>
{% endif %}
{# End Unconfirmed Public Body #}

<hr/>
</div>
<div class="span-6 last">
    {% if user.is_authenticated and user != object.user %}
    <form method="post" action="{% url 'foirequestfollower-follow' slug=object.slug %}" id="followrequest-form">
      {% csrf_token %}
    {% if followform %}
      {{ followform.as_p }}
      <input type="submit" value="{% trans "Follow request" %}"/>
    {% else %}
      {% followrequest object user "followform" %}
      {{ followform.as_p }}
      {% if followform.following %}
      <span class="help">{% blocktrans %}You are currently <span class="green">following</span> this request and you will get email updates.{% endblocktrans %}</span>
      <button class="button icon remove" type="submit"/>{% trans "Unfollow request" %}</button><br/>
      {% else %}
      <span class="help">{% blocktrans %}Follow this request and get notified by email when something changes.{% endblocktrans %}</span>
      <button class="button mail icon" type="submit"/>{% trans "Follow request" %}</button><br/>
      {% endif %}
    {% endif %}
    </form>
    {% endif %}
    <ul class="iconed-list">
      <li class="rss-icon">
          <a href="{% url 'foirequest-feed' slug=object.slug %}">{% trans "RSS Feed" %}</a>
      </li>
      <li class="atom-icon">
          <a href="{% url 'foirequest-feed_atom' slug=object.slug %}">{% trans "Atom Feed" %}</a>
      </li>
    </ul>
  {% if user.is_staff %}
    <h3>{% trans "Admin Tools" %}</h3>
    <a href="{% url 'admin:foirequest_foirequest_change' object.id %}">{% trans "View on Admin site" %}</a><br/>
    {% if object.checked %}
      {% trans "Marked as checked" %}<br/>
    {% else %}
    <form method="post" action="{% url 'foirequest-mark_checked' slug=object.slug %}">
      {% csrf_token %}
      <input class="button" type="submit" value="{% trans "Mark as checked" %}"/>
    </form>
    {% endif %}
    {% if not object.is_foi %}
      {% trans "Marked as NOT FoI" %}<br/>
    {% else %}
    <form method="post" action="{% url 'foirequest-mark_not_foi' slug=object.slug %}">
      {% csrf_token %}
      <input class="button" type="submit" value="{% trans "Mark as NOT FoI" %}"/>
    </form>
    {% endif %}
  {% endif %}
</div>
</div>
<div class="span-18">
<h4 id="messages">{% blocktrans %}Messages in this request{% endblocktrans %}</h4>

{% for message in object.messages %}
<div id="{{ message.get_html_id }}" class="message-container">
  <div class="message{% if not message.sender_user %} message-received{% endif %}{% if message.is_postal %} message-postal{% endif %}{% if message.is_escalation %} message-escalated{% endif %}">
  <table class="message-table">
    <tbody>
    <tr>
      <td class="key">{% blocktrans %}From{% endblocktrans %}</td>
      <td class="value-padding-right">
      {% if object.user == user %}
          {% if message.is_response %}
          {{ message.real_sender }} – {{ message.sender_public_body.name }} (<a href="#change-pb-{{ message.id }}" class="toggle">{% trans "change" %}</a>)
          <div id="change-pb-{{ message.id }}" style="display:none">
            {% with message_pb_form=message.get_public_body_sender_form %}
               <form method="post" action="{% url 'foirequest-set_message_sender' slug=object.slug message_id=message.id %}">
                 {% csrf_token %}
                 <label for="id_m{{ message.id }}-sender">{% blocktrans %}Set the Public Body that sent this message:{% endblocktrans %}</label> 
                  {{ message_pb_form.sender }}
                  <input type="submit" value="{% blocktrans %}Set Sending Public Body{% endblocktrans %}"/>
                </form>
              {% endwith %}
          </div>
          {% else %}
          {{ message.real_sender }}
          {% endif %}
      {% else %}
        {{ message.sender }}
        {% endif %}</td>
    </tr>
    <tr>
      <td class="key">{% blocktrans %}Subject{% endblocktrans %}</td>
      <td class="value-padding-right"><strong>{{ message.subject }}</strong></td>
    </tr>
    <tr>
      <td class="key">{% blocktrans %}Date{% endblocktrans %}</td>
      {% if message.is_postal %}
      <td>{{ message.timestamp|date:"DATE_FORMAT" }}</td>
      {% else %}
      <td>{{ message.timestamp|date:"DATETIME_FORMAT" }}</td>
      {% endif %}
    </tr>
    {% if not message.is_response %}
    <tr>
      <td class="key">{% blocktrans %}To{% endblocktrans %}</td>
      <td>{{ message.get_recipient }}</td>
    </tr>
    {% endif %}
    {% if message.status %}
    <tr>
      <td class="key">{% blocktrans %}Status{% endblocktrans %}</td>
      <td>{{ message.readable_status }}</td>
    </tr>
    {% endif %}
    {% if message.all_attachments %}
    <tr>
      <td class="key">{% blocktrans %}Attachments{% endblocktrans %}</td>
    <td>
      <ul>
    {% for attachment in message.all_attachments %}
    <li>
    <a href="{{ attachment.file.url }}">{{ attachment.name }} ({{ attachment.size|filesizeformat }})</a>{% if attachment.can_preview %} - <a class="target-new" href="{{ attachment.get_preview_url }}">{% blocktrans %}Preview in Browser{% endblocktrans %}</a>{% endif %}
    </li>
    {% endfor %}
  </ul>
    </td>
  </tr>
  {% endif %}
  {% if user == object.user and message.is_postal %}
  <tr>
    <td class="key">{% blocktrans %}Upload Attachments{% endblocktrans %}</td>
    {% with form=message.get_postal_attachment_form %}
    <td>
      <form method="post" action="{% url 'foirequest-add_postal_reply_attachment' slug=object.slug message_id=message.pk %}" enctype="multipart/form-data">{% csrf_token %}
      {{ form.scan }}
      <button type="submit" class="upload-button button icon add">{% blocktrans %}Upload Document{% endblocktrans %}</button><br/>
      {{ form.scan.help_text }}
      </form>
    </td>
    {% endwith %}
  {% endif %}
  </tbody>
</table>
{# Set status #}
{% if object.user == user and message.needs_status_input %}
<div id="set-status" class="section important-form">
  <form method="post" action="{% url 'foirequest-set_status' slug=object.slug %}#set-status">{% csrf_token %}
    {% if status_form %}
      {% include "foirequest/_set_status.html" %}
    {% else %}
      {% with status_form=object.get_status_form %}
        {% include "foirequest/_set_status.html" %}
      {% endwith %}
    {% endif %}
    <button class="button icon tag" type="submit">{% blocktrans %}Set status{% endblocktrans %}</button>
    </p>
  </form>
</div>
{% endif %}
{# End Set status #}
  <hr/>
  {% if forloop.counter0 == 0 %}
  <div class="message-content">{% highlight_request message %}</div>
  {% else %}
  {% if user == object.user %}
  <div class="message-content">{{ message.get_real_content|urlize }}</div>
  {% else %}
  <div class="message-content">{{ message.get_content|urlize }}</div>
  {% endif %}
  {% endif %}
</div>

{% if message.events %}
<div class="events">
  <ol>
  {% for event in message.events %}
  <li class="event" id="{{ event.get_html_id }}"><span title="{{ event.timestamp }}">{% blocktrans with time=event.timestamp|timesince %}{{ time }} ago{% endblocktrans %}</span>: {{ event.as_html }}</li>
  {% endfor %}
  </ol>
</div>
{% endif %}
<div class="comments-container">
  {% get_comment_list for message as comment_list %}
<div id="comments-{{ message.id }}" class="comments">
  {% include "comments/foirequest/list.html" %}
  <a class="toggle" href="#comment-form-{{ message.id }}">{% blocktrans %}Write a comment{% endblocktrans %}</a>
  <div class="comment-form" id="comment-form-{{ message.id }}">
  {% if user.is_authenticated %}
  {% with next=object.get_absolute_url %}
    {% render_comment_form for message %}
  {% endwith %}
  {% else %}
  <a href="{% url 'account-login' %}">{% blocktrans %}Please login to write a comment.{% endblocktrans %}</a><br/>
  {% endif %}
  </div>
</div>
</div>
</div>
{% empty %}
<p>{% blocktrans %}No messages yet{% endblocktrans %}</p>
{% endfor %}

{# Public Body Needed #}
{% if object.status == "publicbody_needed" %}
<div class="section">
  <p>{% blocktrans %}You can suggest a public body for this request.{% endblocktrans %}
  {% with suggestions=object.public_body_suggestions %}
  {% if suggestions %}
  <br/>{% blocktrans %}The following public bodies have already been suggested:{% endblocktrans %}
  {% endif %}
  </p>
      <ul>
      {% for suggestion in suggestions %}
      <li><strong>{{ suggestion.public_body.name }}</strong> - <a href="{{ suggestion.public_body.get_absolute_url }}" class="info-link">{% blocktrans %}Details{% endblocktrans %}</a>{% if suggestion.reason %}<br/>
      {% blocktrans %}Reason given by the user:{% endblocktrans %} {{ suggestion.reason }}
      {% endif %}
      </li>
      {% empty %}
        <li>{% blocktrans %}There are no suggestions yet{% endblocktrans %}</li>
      {% endfor %}
      </ul>
  {% endwith %}
  <form method="post" action="{% url 'foirequest-suggest_public_body' slug=object.slug %}">
    {% csrf_token %}
    {% with form=object.make_public_body_suggestion_form %}
    {{ form.public_body }}
    {{ form.reason.label_tag }} {{ form.reason }}
    {% endwith %}
    <br/><input type="submit" value="{% blocktrans %}Suggest this Public Body{% endblocktrans%}"/>
  </form>
</div>

{% if object.user == user %}
{% with suggestions_form=object.public_body_suggestions_form %}
  {% if suggestions_form %}
  <div class="section important-form">
    <p>{% blocktrans %}As the author of this request, please choose a public body from one of the suggestions:{% endblocktrans %}</p>
    <form method="post" action="{% url 'foirequest-set_public_body' slug=object.slug %}">
      {% csrf_token %}
      {{ suggestions_form }}
      <input type="submit" value="{% blocktrans %}Send this request to the selected Public Body{% endblocktrans %}"/>
    </form>
  </div>
  {% endif %}
  {% endwith %}
{% endif %}
{% endif %}
{# End Public Body Needed #}

{# Write Resolution #}
{% if object.user == user and object.status_is_final %}
<div class="section">
  {% if object.resolution %}
  <a href="#write-resolution" class="toggle">{% blocktrans %}Write a summary of the response{% endblocktrans %}</a>
  {% endif %}
  <div id="write-resolution"{% if object.resolution %} style="display: none"{% endif %}>
    <h3>{% blocktrans %}Resolution Summary{% endblocktrans %}</h3>
    <form method="post" action="{% url 'foirequest-set_resolution' slug=object.slug %}">{% csrf_token %}
      <p>{% blocktrans %}Please give a summary of the response.{% endblocktrans %}<br/>
      {% blocktrans %}Have you received the information you need? What have you learned from it?{% endblocktrans %}</p>
      <textarea rows="8" name="resolution">{% if object.resolution %}{{ object.resolution }}{% endif %}</textarea><br/>
      <input type="submit" value="{% blocktrans %}Save Summary{% endblocktrans %}"/>
    </form>
  </div>
</div>
{% endif %}
{# End Write Resolution #}

{# If Meta Law #}
{% if object.user == user and object.law.meta and object.reply_received %}
<div class="section">
  <form method="post" action="{% url 'foirequest-set_law' slug=object.slug %}">{% csrf_token %}
    <p>{% blocktrans %}This request was made under multiple information laws. If it is apparent from the reply under which law the request was answered, please choose this law below. If it is not obvious, leave it as it is.{% endblocktrans %}</p>
    {{ object.get_concrete_law_form.as_p }}
    <input type="submit" value="{% blocktrans %}Set Concrete Law{% endblocktrans %}"/>
  </form>
</div>
{% endif %}

{# Escalate #}
{% if object.has_been_refused and object.law.mediator %}
<div class="section">
  <a href="#escalate" class="toggle">{% blocktrans %}Send a letter to a mediator{% endblocktrans %}</a>
  <div id="escalate"{% if not escalation_form %} style="display:none"{% endif %}>
  <form method="post" action="{% url 'foirequest-escalation_message' slug=object.slug %}#escalate">{% csrf_token %}
    <p>{% blocktrans with entity=object.law.mediator.name law_name=object.law.name %}You can file a complaint to the {{ entity }} if you think your request was not properly handled under the {{ law_name }}.{% endblocktrans %}</p>
    <table class="no-stripes">
      {% if escalation_form %}
        {{ escalation_form.as_table }}
      {% else %}
        {% with escalation_form=object.get_escalation_message_form %}
{'fraction_non_alphanumeric': 0.19340712808660745, 'fraction_numerical': 0.0014596764383894903, 'mean_word_length': 3.669175067442851, 'pattern_counts': {'":': 0, '<': 573, '<?xml version=': 0, '>': 575, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 4}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1554977', 'n_tokens_mistral': 11708, 'n_tokens_neox': 10423, 'n_words': 2791}