{% load i18n %}
{% load thumbnail %}
{% load static %}
{% load front_tags %}

{% if nb_pj_pages %}
<ul class="prev_next_cont_proj" >
    <li>{% load navigation %}{% build_pagination nb_pj_pages current_project_page "projects_page clickable" %}</li>
    <input type="hidden" value="{{current_project_page}}" name="current_project_page" id="current_project_page">
</ul>
{% endif %}
<div class="projectscontentsheader projectcontentsheadertitle span-12 last" id="projectsheader">
{% trans "name" %}
</div>
<div class="span-12 last projectscontentstablediv" id="projectstablediv">
<table class="projectscontentstable">
    <tbody class="projectscontentsbody">
{% for project in projects %}

    <tr class="imageline {% cycle 'projectscontentsoddline' 'projectscontentsevenline'%}" >
        {% url 'ldt.ldt_utils.views.ldt_json.project_json_id' id=project.ldt_id as json_url_id %}
        {% if is_gecko %}
            <td class="cellimg"><div class="cellimgdiv"><a  href="{% url 'index_project_full' id=project.ldt_id %}">
            {% if project.change or project.owner == user %}
              {% if project.state != 2 %}
                <img src='{% static "ldt/img/page_edit.png" %}' alt="{% trans 'open ldt' %}" title="{% trans 'open ldt' %}"/>
              {% else %}
                <img src='{% static "ldt/img/page_eye.png" %}' alt="{% trans 'open ldt' %}" title="{% trans 'open ldt' %}"/>
              {% endif %}
            {% else %}
                <img src='{% static "ldt/img/page_eye.png" %}' alt="{% trans 'open ldt' %}" title="{% trans 'open ldt' %}"/>
            {% endif %}
            </a></div></td>
        {% else %}
            <td class="cellimg"><div class="cellimgdiv"><a href="{% url 'index_project' id=project.ldt_id %}" class="ldt_link_open_ldt">
            {% if project.change or project.owner == user %}
              {% if project.state != 2 %}
                <img src='{% static "ldt/img/page_edit.png" %}' alt="{% trans 'open ldt' %}" title="{% trans 'open ldt' %}"/>
              {% else %}
                <img src='{% static "ldt/img/page_eye.png" %}' alt="{% trans 'open ldt' %}" title="{% trans 'open ldt' %}"/>
              {% endif %}
            {% else %}
                <img src='{% static "ldt/img/page_eye.png" %}' alt="{% trans 'open ldt' %}" title="{% trans 'open ldt' %}"/>
            {% endif %}
            </a></div></td>
        {% endif %}

        <td class="cellimg"><div class="cellimgdiv"><img src='{% static "ldt/img/page_copy.png" %}' href="{% url 'ldt.ldt_utils.views.project.copy_project' ldt_id=project.ldt_id group_id=group_id %}" class="ldt_link_copy_project" alt="{% trans 'copy project' %}" title="{% trans 'copy project' %}"/></div></td>
        <td class="cellimg">
         <div class="cellimgdiv">
           <a href="{% url 'embed_config_v3' %}?json_url={{WEB_URL}}{{json_url_id}}&player_id=player_project_{{project.ldt_id}}&ldt_id={{project.ldt_id}}">
            <img src='{% static "ldt/img/plugin.png" %}' id="player_project_{{project.ldt_id}}" class="ldt_link_embed" alt="{% trans 'link json by id' %}" title="{% trans 'link json by id' %}"/>
           </a>
         </div>
        </td>
        <td class="cellimg">
        {% ifequal project.state 2 %}
        <img src='{% static "ldt/img/icon-yes.gif" %}' {% if project.change or project.owner == user %} alt="{% trans 'Project published, click to unpublish' %}" title="{% trans 'Project published, click to unpublish' %}" class="publishedproject qtiplink" {% else %} class="qtiplink" title="{% trans "You are not allowed to change this project" %}"{% endif %} id="project_{{project.ldt_id}}" /></div>
        {% else %}
        <img src='{% static "ldt/img/icon-no.gif" %}' {% if project.change or project.owner == user %} alt="{% trans 'Project not published, click to publish' %}" title="{% trans 'Project not published, click to publish' %}" class="unpublishedproject qtiplink" {% else %} class="qtiplink" title="{% trans "You are not allowed to change this project" %}"{% endif %}id="project_{{project.ldt_id}}" />
        {% endifequal %}
        </td>
        <td>{% thumbnail project.image "50x50" crop="center" format="PNG" as im %}<img src="{{ im.url }}" width="{{ im.width }}" height="{{ im.height }}" />{% empty %}&nbsp;{% endthumbnail %}</td>
        <td class="projecttitle">
        {% if project.state == 2 %}
        <span class="projecttitlelink infostooltip" data-title="{{ project.title }}" data-desc="{{ project.description|linebreaksbr }}" >{% if show_username %}{{ project.owner.username }} : {% endif %}{{ project.title }}</span>
        {% else %}
        	{% if project.change or project.owner == user %}
        	<a class="projecttitlelink" href="{% url 'ldt.ldt_utils.views.project.update_project' ldt_id=project.ldt_id %}"><span class="infostooltip" data-title="{{ project.title }}" data-desc="{{ project.description|linebreaksbr }}" >{% if show_username %}{{ project.owner.username }} : {% endif %}{{ project.title }}</span></a>
        	{% else %}
        	<a class="projecttitlelink"><span class="qtiplink" title="{% trans "You are not allowed to change this project" %}">{% if show_username %}{{ project.owner.username }} : {% endif %}{{ project.title }}</span></a>
        	{% endif %}
        {% endif %}
        </td>
    </tr>
{% endfor %}
    </tbody>
</table>
</div>
