{% macro block(record, highlight, searchEngine, prefix, entry_id)%}
    {% import 'common/thumbnail.html.twig' as thumbnail %}
    {% import 'common/doctype_icons.html.twig' as doctype_icons %}
    {% import 'common/drop_down_options.html.twig' as drop_down %}
    {% set th_size = app['authentication'].getUser().getPrefs('images_size')%}
    {% set sbas_id = record.get_sbas_id %}
    {% if entry_id %}
        <div style="width:{{th_size+30}}px;" sbas="{{sbas_id}}"
            id="{{ prefix|default('IMGT') }}_{{record.get_sbas_id}}_{{record.get_record_id}}"
            class="IMGT diapo type-{{record.get_type}}"
            onDblClick="openPreview('FEED',{{record.get_number()}},{{entry_id}});">
    {% elseif record.is_grouping() %}
        <div style="width:{{th_size+30}}px;" sbas="{{sbas_id}}"
            id="{{ prefix|default('IMGT') }}_{{record.get_sbas_id}}_{{record.get_record_id}}"
            class="IMGT diapo grouping type-{{record.get_type}}"
            onDblClick="openPreview('REG','0','{{record.get_serialize_key()}}');">
    {% else %}
        <div style="width:{{th_size+30}}px;" sbas="{{sbas_id}}"
            id="{{ prefix|default('IMGT') }}_{{record.get_sbas_id}}_{{record.get_record_id}}"
            class="IMGT diapo type-{{record.get_type}}"
            onDblClick="openPreview('RESULT',{{record.get_number}});">
    {% endif %}
        <div style="padding: 4px;">
            <div style="height:40px; position: relative; z-index: 95;margin-bottom:0;border-bottom:none;overflow:hidden;">
                <div class="title" style="max-height:100%" title="{{ record.get_title() }}">
                    {{ record.get_title() }}
                </div>
                <div class="status">
                {{record.get_status_icons|raw}}
                </div>
            </div>
            {% set rollover_gif = record.get_rollover_thumbnail() %}

            {% set user_technical_display = app['authentication'].getUser().getPrefs('technical_display') %}
            {% set user_rollover_thumbnail = app['authentication'].getUser().getPrefs('rollover_thumbnail') %}

            {% set extraclass = '' %}
            {% if user_rollover_thumbnail == 'caption' and searchEngine is not null %}
                {% set extraclass = extraclass ~ ' captionTips' %}
                {% set tooltipsrc = path('prod_tooltip_caption', { 'sbas_id' : record.get_sbas_id(), 'record_id' : record.get_record_id(), 'context' : 'answer', 'number' : record.get_number() }) %}
            {% elseif user_rollover_thumbnail == 'caption' and searchEngine is null %}
                {% set extraclass = extraclass ~ ' captionTips' %}
                {% set tooltipsrc = path('prod_tooltip_caption', { 'sbas_id' : record.get_sbas_id(), 'record_id' : record.get_record_id(), 'context' : 'publi' }) %}
            {% elseif user_rollover_thumbnail == 'preview' %}
                {% set extraclass = extraclass ~ ' captionTips' %}
                {% set tooltipsrc = path('prod_tooltip_preview', { 'sbas_id' : record.get_sbas_id(), 'record_id' : record.get_record_id() }) %}
            {% endif %}
            <div class="thumb {{extraclass}} " tooltipsrc="{{tooltipsrc}}" style="height:{{th_size}}px; z-index:90;">
                <div class="doc_infos">
                {% if app['authentication'].getUser().getPrefs('doctype_display') == '1' %}
                {{doctype_icons.format(record)}}
                {% endif %}
                <span class="duration">
                    {{record.get_formated_duration()}}
                </span>
                </div>
                <div class="{% if rollover_gif %}rollovable{% endif %}">
                {% set extraclass = '' %}
                {% if rollover_gif %}
                {% set extraclass = 'rollover-gif-out' %}
                {% endif %}
                {{thumbnail.format(record.get_thumbnail(), th_size, th_size, extraclass, true, true)}}
                {% if rollover_gif %}
                {{thumbnail.format(rollover_gif, th_size, th_size, 'rollover-gif-hover', true, true)}}
                {% endif %}
                </div>
            </div>
            <div style="height: 25px; position:relative; text-align:left;">
                <table class="bottom" style="width:100%; table-layout:fixed;">
                <tr>
                    <td style="text-align:left;text-overflow:ellipsis;overflow:hidden;">
                    {{record.get_collection_logo(app)|raw}}
                    </td>
                    {% set l_width = 30 %}
                    {% if user_rollover_thumbnail == 'preview' %}
                    {% set l_width = l_width + 20 %}
                    {% endif %}
                    {% if user_technical_display == '1' %}
                    {% set l_width = l_width + 20 %}
                    {% endif %}
                    <td style='text-align:right;width:{{l_width}}px;' valign='bottom'>
                    {{drop_down.prod(record, entry_id)}}
                    {% if record.has_preview() and app['authentication'].getUser().ACL().has_access_to_subdef(record, 'preview') %}
                    <div tooltipsrc="{{ path('prod_tooltip_preview', { 'sbas_id' : record.get_sbas_id(), 'record_id' : record.get_record_id() }) }}" class="previewTips"></div>
                    {% endif %}
                    {% if user_rollover_thumbnail == 'preview' %}
                    <div tooltipsrc="{{ path('prod_tooltip_caption', { 'sbas_id' : record.get_sbas_id(), 'record_id' : record.get_record_id(), 'context' : 'answer', 'number' : record.get_number() }) }}" class="captionRolloverTips"></div>
                    {% endif %}
                    {% if user_technical_display == '1' %}
                    <img class="infoTips" tooltipsrc="{{ path('prod_tooltip_technical_data', { 'sbas_id' : record.get_sbas_id(), 'record_id' : record.get_record_id() }) }}" src="/skins/icons/info.gif"/>
                    {% endif %}
                    </td>
                </tr>
                </table>
            </div>
        </div>

    </div>
{% endmacro %}
