{% extends "base.html" %}
{% load i18n %}
{% block headers %}
<script type="text/javascript" src="{{ MEDIA_URL }}js/jquery.js"></script>
<script type="text/javascript" charset="utf-8">
//<![CDATA[{{ MEDIA_URL }}
var rj;
var ax_error = false;
//]]>
</script>
<script type="text/javascript" language="javascript" src="{{ MEDIA_URL }}js/jquery.address.js"></script>
<script type="text/javascript" language="javascript" src="{{ MEDIA_URL }}js/ajax-csrf-tokenize.js"></script>
<script type="text/javascript" language="javascript" src="{{ MEDIA_URL }}js/lists.js"></script>
{% endblock headers %}
{% block submenu %}
<ul>
{% ifequal list_kind 1 %}
  <li><a id="list-link" href="{% url lists-start 2 %}">{% trans "Blacklist" %}</a></li>
{%else%}
  <li><a id="list-link" href="{% url lists-start 1 %}">{% trans "Whitelist" %}</a></li>
{%endifequal%}
  <li><a id="list-add" href="{% url add-to-list %}">{% trans "Add to List" %}</a></li>
</ul>
{% endblock submenu %}
{% block title %}{% trans "List management" %}{% endblock title %}
{% block heading %}
{% ifequal list_kind 1 %}{% trans "Whitelist" %}{%else%}{% trans "Blacklist" %}{%endifequal%}{%if is_paginated%}{% load pagination_heading %} :: {% pagination_heading %}{%endif%}
{% endblock heading %}
{% block content %}
    <div class="Grid_heading">
        {% load lists_sorter %}
        <div class="Lists_grid_hash">
        {% lists_sorter "id" "#" %}
        </div>
        <div class="Lists_grid_To">
        {% lists_sorter "to_address" "To" %}
        </div>
        <div class="Lists_grid_From">
        {% lists_sorter "from_address" "From" %}
        </div>
        <div class="Lists_grid_Action">{% trans "Action" %}</div>
    </div>
    {% if object_list %}
        {% load messages_extras %}
        {% for listitem in object_list %}
        <div id="list-id-{{ listitem.id }}" class="{% cycle 'LightBlue' 'LightGray' %}_div">
            <div class="Lists_hash">{{ listitem.id }}</div>
            <div class="Lists_to">{{ listitem.to_address }}</div>
            <div class="Lists_from">{{ listitem.from_address }}</div>
            <div class="Lists_action">
            {% ifequal listitem.from_address "127.0.0.1" %} 
            {% trans "=builtin=" %}
            {% else %}
            <a href="{% url list-del listitem.id %}"><img src="{{ MEDIA_URL }}imgs/action_delete.png" title="Delete" alt="Delete" /></a>
            {% endifequal %}
            </div>
        </div>
        {% endfor %}
    {% else %}
    <div class="spanrow">{% trans "No records returned" %}</div>
    {% endif %}
{% endblock content %}
{% block paging %}
        <div class="content_footer">
            <div id="filterbox" style="display:{% ifnotequal order_by "id" %}block{%else%}none{%endifnotequal%};">
                <form id="lists_filter_form" method="post" action="/{{ app }}/{{ list_kind }}/{{ direction }}/{{ order_by }}/">
                    {% trans "Filter " %}<span id="filterlabel">
                    {%ifequal order_by "to_address"%}<b>To:</b>{%endifequal%}{%ifequal order_by "from_address"%}<b>{% trans "From:" %}</b>{%endifequal%}</span>
                    <select id="id_query_type" name="query_type">
                        <option value="1"{%ifequal query_type 1%} selected="selected"{%endifequal%}>{% trans "containing" %}</option>
                        <option value="2"{%ifequal query_type 2%} selected="selected"{%endifequal%}>{% trans "excluding" %}</option>
                    </select>
                    <input id="id_search_for" name="search_for" type="text" value="{{search_for}}" size="25" />
                    <input id="id_lists_filter_submit" type="submit" value="{% trans "GO" %}" />
                </form>
            </div>
            <div id="paginator">{% load generic_paginator %}{% generic_paginator 3 %}</div>
        </div>
{% endblock paging %}


