{% block tag_table %}
{% load static %}
	<table id="tag_table"><tr class="nodrop nodrag">
        {% if ordered_tags %}<th>#</th>{% endif %}
        {% if valid != "2" and ordered_tags %}
        <th><img src="{% static 'hdabo/img/arrow_up_down.png' %}"/></th>
        {% endif %}
        <th>id</th>
        <th>label</th>
        {% comment %}<th>original_label</th>{% endcomment %}
        <th class="text_centered">Lien W</th>
        <th class="text_centered">pLien W</th>
        <th class="text_centered">Lien D</th>
        <th>Catégorie</th>
        {% if ordered_tags %}<th class="large_25 text_centered">Supprimer<br/>le lien W</th>{% endif %}
        <th>Alias</th>
        {% if ordered_tags %}<th class="large_25 text_centered">Retirer le tag</th>{% endif %}</tr>
    {% if ordered_tags %}
    	{# ordered_tags is a list of TaggedSheet #}
        {% for t in ordered_tags %}
            <tr class="imageline {% cycle 'hdabooddline' 'hdaboevenline' %}" id="{{forloop.counter}}">
            <td>{{forloop.counter}}</td>
            {% if valid != "2" %}
            <td class="updown_td text_centered"><img src="{% static 'hdabo/img/arrow_up_down.png' %}" class="updown" alt="updown" id={{t.tag.id}} pos="{{forloop.counter0}}"></td>
            {% endif %}
            <td>{{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 '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 'hdabo/img/wikipedia_search.png' %}" ></a>
	            {% endif %}
	        </td>
	        <td class="text_centered">
                {% if t.wikipedia_revision_id  %}
                <a href="{{t.wikipedia_verion_permalink}}" target="_blank"><img src="{% static 'hdabo/img/clock_arrow.png' %}" ></a>
                {% else %}
                &nbsp;
                {% endif %}
	        </td>
	        <td class="text_centered">
	            {% if t.tag.dbpedia_uri and t.tag.dbpedia_uri != ""  %}
	            <a href="{{t.tag.dbpedia_uri}}" target="_blank"><img src="{% static 'hdabo/img/arrow_green_right.png' %}" ></a>
	            {% else %}
	            &nbsp;
	            {% endif %}
            </td>
            <td class="tag_category" id="{{t.tag.id}}">{% if t.tag.category %}{{ t.tag.category }}{% endif %}</td>
            <td class="text_centered"><img src="{% static 'hdabo/img/red_cross.png' %}" class="remove_wp_link" id="{{t.tag.id}}" alt="{{t.tag.label}}" /></td>
            <td>{% if t.tag.alias %}{{t.tag.alias}}{% endif %}</td>
            <td class="text_centered"><img src="{% static '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>{{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 'hdabo/img/arrow_right.png' %}" ></a>
	            {% else %}
	            <a href="http://fr.wikipedia.org/w/index.php?search={{t.label}}" target="_blank"><img src="{% static 'hdabo/img/wikipedia_search.png' %}" ></a>
	            {% endif %}
	        </td>
	        <td class="text_centered">
                {% if t.wikipedia_revision_id  %}
                <a href="{{t.wikipedia_verion_permalink}}" target="_blank"><img src="{% static 'hdabo/img/clock_arrow.png' %}" ></a>
                {% else %}
                &nbsp;
                {% endif %}
            </td>	        
	        <td class="text_centered">
                {% if t.dbpedia_uri and t.dbpedia_uri != ""  %}
                <a href="{{t.dbpedia_uri}}" target="_blank"><img src="{% static 'hdabo/img/arrow_green_right.png' %}" ></a>
                {% else %}
                &nbsp;
                {% endif %}
            </td>
            <td>{% if t.category %}{{ t.category }}{% endif %}</td>
            <td>{% if t.alias %}{{ t.alias }}{% endif %}</td></tr>
        {% endfor %}
    {% endif %}
    </table>
{% endblock %}
