{% block tag_table %}
	<table id="tag_table"><tr>
        <th>#</th>
        {% if valid != "2" and ordered_tags %}
        <th class="updown_td">M</th>
        <th class="updown_td">D</th>
        {% endif %}
        <th>id</th>
        <th>label</th>
        {% comment %}<th>original_label</th>{% endcomment %}
        <th class="text_centered">Lien W</th>
        <th>Facette</th>
        <th class="large_25 text_centered">Lien W activé</th>
        <th class="large_25 text_centered">Supprimer<br/>le lien W</th>
        <th>Alias</th>
        <th class="large_25 text_centered">Retirer le tag de la liste</th></tr>
    {% if ordered_tags %}
    	{# ordered_tags is a list of TaggedSheet #}
        {% for t in ordered_tags %}
            <tr class="imageline {% cycle 'hdabooddline' 'hdaboevenline' %}">
            <td>{{forloop.counter}}</td>
            {% if valid != "2" %}
            <td class="updown_td">{% if not forloop.first %}<img src="{{STATIC_URL}}hdabo/img/arrow_up.png" class="up" alt="up" id={{t.tag.id}} pos="{{forloop.counter0}}">{% endif %}</td>
            <td class="updown_td">{% if not forloop.last %}<img src="{{STATIC_URL}}hdabo/img/arrow_down.png" class="down" alt="down" id={{t.tag.id}} pos="{{forloop.counter0}}">{% endif %}</td>
            {% endif %}
            <td class="reset_wp_info">{{t.tag.id}}</td>
            <td class="{{t.tag.url_status_text}} wikipediatag" id="{{t.tag.id}}" >{{t.tag.label}}</td>
            {% comment %}<td>{{t.tag.original_label}}</td>{% endcomment %}
            <td class="text_centered">
	            {% if t.tag.wikipedia_url and t.tag.wikipedia_url != ""  %}
	            <a href="{{t.tag.wikipedia_url}}" target="_blank"><img src="{{STATIC_URL}}hdabo/img/arrow_right.png" ></a>
	            {% else %}
	            <a href="http://fr.wikipedia.org/w/index.php?search={{t.tag.label}}" target="_blank"><img src="{{STATIC_URL}}hdabo/img/wikipedia_search.png" ></a>
	            {% endif %}</td>
            <td><select name="facette">
				<option value="" selected></option>
				<option value="datation">Datation</option>
				<option value="localisation">Localisation</option>
				<option value="createur">Créateur</option>
				<option value="ecole">Ecole/Mouvement</option>
				<option value="discipline">Discipline artistique</option>
				</select></td>
            <td class="text_centered"><input type="checkbox" class="activate_wp_cb" id="{{t.tag.id}}" alt="{{t.tag.label}}" {% if t.tag.wikipedia_activated %}checked{% endif %} /></td>
            <td class="text_centered"><img src="{{STATIC_URL}}hdabo/img/red_cross.png" class="remove_wp_link" id="{{t.tag.id}}" alt="{{t.tag.label}}" /></td>
            <td>{{t.tag.alias}}</td>
            <td class="text_centered"><img src="{{STATIC_URL}}hdabo/img/tag_remove.png" class="remove_tag_from_list" id="{{t.tag.id}}" alt="{{t.tag.label}}" /></td></tr>
        {% endfor %}
    {% else %}
    	{# ds is a DataSheet #}
        {% for t in ds.tags.all %}
            <tr class="imageline {% cycle 'hdabooddline' 'hdaboevenline' %}">
            <td>{{forloop.counter}}</td>
            {% if valid != "2" and ordered_tags %}
            <td class="updown_td">{% if not forloop.first %}<img src="{{STATIC_URL}}hdabo/img/arrow_up.png" class="up" alt="up" id="{{t.id}}" pos="{{forloop.counter0}}">{% endif %}</td>
            <td class="updown_td">{% if not forloop.last %}<img src="{{STATIC_URL}}hdabo/img/arrow_down.png" class="down" alt="down" id="{{t.id}}" pos="{{forloop.counter0}}">{% endif %}</td>
            {% endif %}
            <td>{{t.id}}</td>
            <td class="{{t.url_status_text}}">{{t.label}}</td>
            {% comment %}<td>{{t.original_label}}</td>{% endcomment %}
            <td class="text_centered">
	            {% if t.wikipedia_url and t.wikipedia_url != ""  %}
	            <a href="{{t.wikipedia_url}}" target="_blank"><img src="{{STATIC_URL}}hdabo/img/arrow_right.png" ></a>
	            {% else %}
	            <a href="http://fr.wikipedia.org/w/index.php?search={{t.label}}" target="_blank"><img src="{{STATIC_URL}}hdabo/img/wikipedia_search.png" ></a>
	            {% endif %}</td>
            <td>facette</td>
            <td class="text_centered"><input type="checkbox" class="activate_wp_cb" id="{{t.id}}" {% if t.wikipedia_activated %}checked{% endif %} /></td>
            <td class="text_centered"><img src="{{STATIC_URL}}hdabo/img/red_cross.png" class="remove_wp_link" id="{{t.id}}" /></td>
            <td>{{t.alias}}</td>
            <td class="text_centered"><img src="{{STATIC_URL}}hdabo/img/tag_remove.png" class="remove_tag_from_list" id="{{t.id}}" alt="{{t.label}}" /></td></tr>
        {% endfor %}
    {% endif %}
    </table>
{% endblock %}
