{% extends 'html/main.html' %}


{% block title %}{% trans %}Audit{% endtrans %}{% endblock %}


{% block content %}
	<header>
		<div class="pwic_ph1"><a href="/{{pwic.project|urlencode}}/special">{{pwic.emojis.finger_left}} {% trans %}Audit of the activities{% endtrans %}</a></div>
		<div class="pwic_ph2">[{{pwic.project|escape}}] {{pwic.project_description|escape}}</div>
	</header>

	<article>
		<div class="pwic_action_bar">
			<a href="/{{pwic.project|urlencode}}/special/env">{{pwic.emojis.pill}} {% trans %}Settings{% endtrans %}</a>
			{% if not pwic.env.no_help %}
				<a href="/special/help#help_setup">{{pwic.emojis.help}} {% trans %}Help{% endtrans %}</a>
			{% endif %}
		</div>


		<h1>{% trans %}Server information{% endtrans %}</h1>
		<p>{{ gettext('The server has started on %(date)s at %(time)s.')|format(date=pwic.up.date|escape, time=pwic.up.time|escape) }}</p>
		<p>{{ gettext('The current time on the server is %(date)s at %(time)s.')|format(date=pwic.systime.date|escape, time=pwic.systime.time|escape) }}</p>
		<p>{{ gettext('You are connected in %(protocol)s.')|format(protocol=pwic.protocol|escape) }}</p>


        <h1>{% trans %}Environment variables{% endtrans %}</h1>
        <table id="audit_envs">
            <tr>
                <th>{% trans %}Key{% endtrans %}</th>
                <th>{% trans %}Scope{% endtrans %}</th>
                <th>{% trans %}Value{% endtrans %}</th>
            </tr>
        </table>


		{% if pwic.audits|count > 0 %}
			<h1>{{ gettext('Audit of the last %(n)d days')|format(n=pwic.range) }}</h1>
			<table>
				<tr>
					<th>{% trans %}Date{% endtrans %}</th>
					<th>{% trans %}Time{% endtrans %}</th>
					<th>{% trans %}Author{% endtrans %}</th>
					<th>{% trans %}Event{% endtrans %}</th>
					<th class="pwic_desktop">{% trans %}Project{% endtrans %}</th>
					<th>{% trans %}Page{% endtrans %}</th>
					<th class="pwic_desktop">{% trans %}Reference{% endtrans %}</th>
					<th class="pwic_desktop">{% trans %}String{% endtrans %}</th>
				</tr>

				{% for audit in pwic.audits %}
					<tr>
						<td class="pwic_nowrap">{{audit.date|escape}}</td>
						<td>{{audit.time|escape}}</td>
						<td><a class="pwic_break" href="/special/user/{{audit.author|urlencode}}" rel="nofollow">{{audit.author|escape}}</a></td>
						<td>{{audit.event|escape}}</td>
						<td class="pwic_desktop">
							{% if audit.project != '' %}
								<a href="/{{audit.project|urlencode}}">{{audit.project|escape}}</a>
							{% endif %}
						</td>
						<td>
							{% if audit.page != '' %}
								<a href="/{{audit.project|urlencode}}/{{audit.page|urlencode}}">{{audit.page|escape}}</a>
							{% endif %}
						</td>
						<td class="pwic_desktop">
							{% if audit.reference > 0 %}
								{% if audit.event[-9:] == '-revision' %}
									<a href="/{{audit.project|urlencode}}/{{audit.page|urlencode}}/rev{{audit.reference|urlencode}}">{{audit.reference|escape}}</a>
								{% elif audit.event[-9:] == '-document' %}
									<a href="/special/document/{{audit.reference|urlencode}}?attachment" target="_blank">{{audit.reference|escape}}</a>
								{% else %}
									?
								{% endif %}
							{% endif %}
						</td>
						<td class="pwic_desktop">
							{% if audit.string != '' %}
								{{audit.string|escape}}
							{% elif audit.user != '' %}
								<a class="pwic_break" href="/special/user/{{audit.user|urlencode}}" rel="nofollow">{{audit.user|escape}}</a>
							{% endif %}
						</td>
					</tr>
				{% endfor %}
			</table>
		{% endif %}

        {% include 'js/page-audit.js' %}
	</article>
{% endblock %}
