{% macro bas_list(module, search_datas) %}
    {% set unique_id = module.getRandom() %}
    <div style="max-height: 57vh; overflow-x: hidden;">
    {% for base in search_datas['bases'] %}
        {% set sbas_id = base['sbas_id'] %}
        <div class="sbas_list sbas_{{sbas_id}}" style="margin-bottom: 10px;">
            <input type="hidden" name="reference" value="{{sbas_id}}"/>
            <div class="clksbas">
                <span class="toggle-collection deployer_toggle deployer_closed" data-toggle-content=".sbascont_{{sbas_id}}"></span>
                <label id="ADVSRCH_SBAS_LABEL_{{sbas_id}}" style="display: inline" class="checkbox custom_checkbox_label" for="sbasChkr_{{sbas_id}}_{{unique_id}}">
                    <input type="checkbox" checked style="display: none;" id="sbasChkr_{{sbas_id}}_{{unique_id}}" class="select-database sbasChkr_{{sbas_id}}"  data-database="{{sbas_id}}" />

                    <span class="base_indicator">
                        {{sbas_id|sbas_labels(app)}}
                    </span>
                    <span class="custom_checkbox">
                        <span class="infos_sbas_{{sbas_id}}">
                            {{base["collections"]|length}}/{{base['collections']|length}}
                        </span>
                    </span>
                </label>
            </div>
            <div class="sbascont sbascont_{{sbas_id}}" style="display:none; margin-bottom: 8px;">
                <ul class="basChild_{{sbas_id}} basChild_list">
                    {% for collection in base["collections"] %}
                        {% set base_id = collection["base_id"] %}
                        <li class="clkbas">
                            <label style="line-height: 18px;"
                                for="ck_{{base_id}}_{{unique_id}}" class="ck_{{base_id}} {% if collection["selected"] %}selected{% endif %} checkbox inline custom_checkbox_label">
                                <input class="ck_{{base_id}} checkbas check-filters"
                                id="ck_{{base_id}}_{{unique_id}}" type="checkbox"
                                data-save="true"
                                name="bases[]" value="{{base_id}}" {% if collection["selected"] %}checked="checked"{% endif %} />
                                <span class="custom_checkbox"></span>
                                {{base_id|get_collection_logo(app)|raw}} {{base_id|bas_labels(app)}}
                            </label>
                        </li>
                    {% endfor %}
                </ul>
            </div>
        </div>
    {% endfor %}
    </div>
{% endmacro %}

{% set jquery_theme = 'dark-hive' %}
{% set step = app.flash('step_by_step') %}

{% extends "common/index_bootstrap.html.twig" %}

{% block icon %}
    <link rel="shortcut icon" type="image/x-icon" href="/assets/prod/images/favicon.ico">
{% endblock %}

{% block rss %}
    {% for feed in feeds %}
        {% set link = app['feed.user-link-generator'].generate(feed, app.getAuthenticatedUser(), 'rss') %}
        <link rel="alternate" type="{{ link.getMimetype() }}" title="{{ link.getTitle() }}" href="{{ link.getURI() }}" />
        {% set link = app['feed.user-link-generator'].generate(feed, app.getAuthenticatedUser(), 'atom') %}
        <link rel="alternate" type="{{ link.getMimetype() }}" title="{{ link.getTitle() }}" href="{{ link.getURI() }}" />
    {% endfor %}
    {% set link = app['feed.aggregate-link-generator'].generate(aggregate, app.getAuthenticatedUser(), 'rss') %}
        <link rel="alternate" type="{{ link.getMimetype() }}" title="{{ link.getTitle() }}" href="{{ link.getURI() }}" />
    {% set link = app['feed.aggregate-link-generator'].generate(aggregate, app.getAuthenticatedUser(), 'atom') %}
        <link rel="alternate" type="{{ link.getMimetype() }}" title="{{ link.getTitle() }}" href="{{ link.getURI() }}" />
{% endblock %}

{% block stylesheet %}
    <link type="text/css" rel="stylesheet" href="/assets/production/production{% if not app.debug %}.min{% endif %}.css">
    <link id="skinCss" type="text/css" rel="stylesheet" href="/assets/production/skin-{{ cssfile  }}{% if not app.debug %}.min{% endif %}.css">
    <style title="color_selection" type="text/css">
        .diapo.selected,#reorder_box .diapo.selected, #EDIT_ALL .diapo.selected, .list.selected, .list.selected .diapo {
            color: {{"#" ~ app['settings'].getUserSetting(app.getAuthenticatedUser(), 'fontcolor-selection', 'FFFFFF')}};
            background-color: {{"#" ~ app['settings'].getUserSetting(app.getAuthenticatedUser(), 'background-selection', '404040')}};
        }
    </style>
{% endblock %}

{% block javascript %}
    <script type="text/javascript" src="/assets/production/commons{% if not app.debug %}.min{% endif %}.js"></script>
    <script type="text/javascript" src="/assets/production/production{% if not app.debug %}.min{% endif %}.js"></script>

    <script type="text/javascript">

        {% if app['settings'].getUserSetting(app.getAuthenticatedUser(), 'start_page') == 'QUERY' %}
        {% set initialAppState = 'default' %}
        {% elseif app['settings'].getUserSetting(app.getAuthenticatedUser(), 'start_page') == 'LAST_QUERY' %}
        {% set initialAppState = 'default' %}
        {% elseif app['settings'].getUserSetting(app.getAuthenticatedUser(), 'start_page') == 'PUBLI' %}
        {% set initialAppState = 'publication' %}
        {% endif %}
        {% set savedHiddenFacetsList = app['settings'].getUserSetting(app.getAuthenticatedUser(), 'hiddenFacetsList') %}

        window.prodApp = ProductionApplication.bootstrap({
            lang: "{{ app.locale }}",
            baseUrl: '{{ app['request'].getUriForPath('/') }}',
            basePath: '{{ app.request.basePath|e('js') }}',
            notify: {
                url: "{{ path('list_notifications') }}",
                moduleId: 1,
                userId: {{app.getAuthenticatedUser().getId()}}
            },
            debug: {% if app.debug %}true{% else %}false{% endif %},
            initialState: "{{ initialAppState }}",
            geonameServerUrl: '{{ app['geonames.server-uri'] }}',
            geocodingProviders: {{ geocodingProviders|json_encode()|raw}},
            thesaurusConfig: {
                replaceMessage: '{{ 'prod::thesaurusTab:dlg:Remplacement du candidat "%(from)s" par "%(to)s"' | trans }}',
                replaceInProgressMsg: '{{ 'prod::thesaurusTab:dlg:Remplacement en cours.' | trans }}',
                acceptMsg: '{{ 'prod::thesaurusTab:dlg:Acceptation en cours.' | trans }}',
                deleteMsg: '{{ 'prod::thesaurusTab:dlg:Suppression en cours.' | trans }}',
                candidateUniqueMsg: '{{ 'prod::thesaurusTab:dlg:accepter le terme candidat "%s" ?' | trans }}',
                candidateManyMsg: '{{ 'prod::thesaurusTab:dlg:accepter les %d termes candidats ?' | trans }}',
                acceptCandidateUniqueMsg: '{{ 'prod::thesaurusTab:wizard:clic-droit / accepter le terme candidat "%s"' | trans }}',
                acceptCandidateManyMsg: '{{ "prod::thesaurusTab:wizard:clic-droit / accepter les %s termes candidats" | trans }}',
                replaceCandidateUniqueMsg: '{{ "prod::thesaurusTab:dlg:remplacer le terme \"%s\" des fiches par :" | trans }}',
                replaceCandidateManyMsg: '{{ "prod::thesaurusTab:dlg:remplacer les %d termes des fiches par :" | trans }}',
                deleteCandidateUniqueMsg: '{{ 'prod::thesaurusTab:dlg:supprimer le terme "%s" des fiches ?' | trans }}',
                deleteCandidateManyMsg: '{{ 'prod::thesaurusTab:dlg:supprimer les %d termes des fiches ?' | trans }}',
                loadingMsg: '{{ 'prod::thesaurusTab:tree:loading' | trans }}',
                searchMsg: '{{ 'boutton::chercher' | trans }}',
                acceptSpecificTermMsg: '{{ 'prod::thesaurusTab:tmenu:Accepter comme terme specifique' | trans }}',
                acceptSynonymeMsg: '{{ 'prod::thesaurusTab:tmenu:Accepter comme synonyme' | trans }}',
                replaceWithMsg: '{{ 'prod::thesaurusTab:cmenu:Remplacer par...' | trans }}',
                removeActionMsg: '{{ 'boutton::supprimer' | trans }}',
                sbas: {{thesau_json_sbas|raw}},
                bas2sbas: {{thesau_json_bas2sbas|raw}},
                availableDatabases: [
                        {% for base in search_datas['bases'] %}{% if base['thesaurus'] %}{
                        id: {{base['sbas_id']}}
                    }{% if not loop.last %},{% endif %}{% endif %}{% endfor %}
                ],
                languagesCount: {{ thesau_languages|length }},
                langContextMenu: [
                    {% for lng_code, lng in thesau_languages %}
                    {
                        label:'{% trans with {'%lng_code%' : lng_code} %}prod::thesaurusTab:cmenu:Accepter en %lng_code%{% endtrans %}',
                        lngCode: '{{lng_code}}',
                    },
                    {% endfor %}
                ]
            },
            savedHiddenFacetsList: {{ savedHiddenFacetsList|json_encode()|raw }}
        });

        $(document).ready(function(){
            prodApp.appEvents.emit('workzone.doRemoveWarning', "{% if app['settings'].getUserSetting(app.getAuthenticatedUser(), "warning_on_delete_story") %}true{% else %}false{% endif %}");
            prodApp.appEvents.emit('search.updateFacetData');
            $('body').addClass('{{ cssfile }}');

        });
    </script>
    {% include "common/templates.html.twig" %}
{% endblock %}

{% block content %}
    {% set search_datas = module_prod.get_search_datas() %}
    <div style="position:absolute; top:0; left:0; right:0; bottom:0; background-color:#1a1a1a; z-index:32766;">
        <div id="loader" style="top:200px; margin:0 auto; -webkit-border-radius:5px; -moz-border-radius:5px; border-radius:5px; background-color:#CCCCCC; position:relative; margin:0 auto; text-align:center; width:400px; height:100px; padding:20px; z-index:32767;">
            <div style="margin:0 10px 10px; font-family:Helvetica,Arial,sans-serif; font-size:18px; color:#1A1A1A; text-align:left;">Phraseanet</div>
            <div style="text-align:center;">{{ 'Chargement' | trans }}</div>
            <div style="width:220px; height:19px; margin:20px auto;">
                <div id="loader_bar" style="height:19px;width:10%;background-image:url('/assets/common/images/icons/main-loader.gif')"></div>
            </div>
        </div>
    </div>
    <div id="desktop" class="PNB" style="overflow:hidden;">
        {% set ratio = app['settings'].getUserSetting(app.getAuthenticatedUser(), 'search_window') %}
        {% if ratio == 0 %}
            {% set ratio = '0.333' %}
        {% endif %}
        {% set w1 = (100 * ratio)|round %}
        {% set w2 = (100 - w1) %}
        <div id="idFrameC" class="PNB" style="right:auto;width:{{ w1 ~ '%' }}">
            <div class="PNB wrapper">
                <div class="tabs ui-tabs">
                    {% block tabs_panel %}
                        <div id="retractableButton"><i class="fa fa-angle-double-left" aria-hidden="true"></i></div>
                        {% include 'prod/tab_headers.html.twig' %}
                        <div id="baskets" class="PNB">
                            {% import 'prod/WorkZone/Macros.html.twig'  as  WorkZoneMacros %}
                            {{WorkZoneMacros.make_bloc(app, WorkZone)}}
                        </div>
                        {% if GV_thesaurus %}
                            <div id="proposals" class="PNB thesaurus-from-facets-action">
                                <input type="hidden" id="facet_except" value="{{ 'prod:workzone:facetstab:tooltips:facet_except_filter' | trans }}" />
                                <input type="hidden" id="facet_and" value="{{ 'prod:workzone:facetstab:tooltips:facet_and_filter' | trans }}" />
                                <input type="hidden" id="facet_remove" value="{{ 'prod:workzone:facetstab:tooltips:remove_facet_filter' | trans }}" />
                                <div class="filter-facet-setting look_box_settings">
                                    <div id="accordion">
                                        <div class="card">
                                            <div class="card-header" id="headingOne">
                                                <h5 class="mb-0" style="margin-left: 10px">
                                                    <button class="btn btn-facet-option collapsed" data-toggle="collapse" data-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
                                                        {{ 'prod:workzone:facetstab:search_and_facets_sort_options' | trans }} <span class="icomoon">&#xE96C;</span>
                                                    </button>
                                                </h5>
                                            </div>
                                            <div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion">
                                                <div class="card-body">
                                            <div class="left-facet-filter facet-filter">
                                                <h4>{{ 'index::advance_search: facet-order' | trans }}</h4>
                                                <form class="form-inline">
                                                    {% set order_facet = app['settings'].getUserSetting(app.getAuthenticatedUser(), 'order_facet') %}
                                                    <label class="select" for="orderFacet">
                                                        <select class="preferences-facet-order" name="orderFacet" style="margin-left: 5px">
                                                            <option {% if order_facet == constant('Alchemy\\Phrasea\\Core\\Configuration\\DisplaySettingService::ORDER_BY_BCT') %} selected="selected" {% endif %}
                                                                    value="{{ constant('Alchemy\\Phrasea\\Core\\Configuration\\DisplaySettingService::ORDER_BY_BCT') }}">{{ 'index::advance_search: facet-tech-order' | trans }}</option>
                                                            <option {% if order_facet == constant('Alchemy\\Phrasea\\Core\\Configuration\\DisplaySettingService::ORDER_ALPHA_ASC') %} selected="selected" {% endif %}
                                                                    value="{{ constant('Alchemy\\Phrasea\\Core\\Configuration\\DisplaySettingService::ORDER_ALPHA_ASC') }}">{{ 'Alphabetic asc' | trans }}</option>
                                                            <option {% if order_facet == constant('Alchemy\\Phrasea\\Core\\Configuration\\DisplaySettingService::ORDER_ALPHA_DESC') %} selected="selected" {% endif %}
                                                                    value="{{ constant('Alchemy\\Phrasea\\Core\\Configuration\\DisplaySettingService::ORDER_ALPHA_DESC') }}">{{ 'Alphabetic desc' | trans }}</option>
                                                        </select>
                                                    </label>
                                                </form>
                                            </div>
                                            <div class="right-facet-filter facet-filter">
                                                <h4>{{ 'index::advance_search: facet-values-order' | trans }}</h4>
                                                <form class="form-inline">
                                                    {% set facet_values_order = app['settings'].getUserSetting(app.getAuthenticatedUser(), 'facet_values_order') %}
                                                    <label class="select" for="facetValuesOrder">
                                                        <select class="preferences-facet-values-order" name="facetValuesOrder">
                                                            <option {% if facet_values_order == constant('Alchemy\\Phrasea\\Core\\Configuration\\DisplaySettingService::ORDER_BY_HITS') %} selected="selected" {% endif %}
                                                                    value="{{ constant('Alchemy\\Phrasea\\Core\\Configuration\\DisplaySettingService::ORDER_BY_HITS') }}">{{ 'index::advance_search: order-by-hits' | trans }}</option>
                                                            <option {% if facet_values_order == constant('Alchemy\\Phrasea\\Core\\Configuration\\DisplaySettingService::ORDER_BY_HITS_ASC') %} selected="selected" {% endif %}
                                                                    value="{{ constant('Alchemy\\Phrasea\\Core\\Configuration\\DisplaySettingService::ORDER_BY_HITS_ASC') }}">{{ 'index::advance_search: order-by-hits-asc' | trans }}</option>
                                                            <option {% if facet_values_order == constant('Alchemy\\Phrasea\\Core\\Configuration\\DisplaySettingService::ORDER_ALPHA_ASC') %} selected="selected" {% endif %}
                                                                    value="{{ constant('Alchemy\\Phrasea\\Core\\Configuration\\DisplaySettingService::ORDER_ALPHA_ASC') }}">{{ 'Alphabetic asc' | trans }}</option>
                                                        </select>
                                                    </label>
                                                </form>
                                            </div>
                                            </div>
                                            </div>
                                        </div>
                                    </div>
                                </div>
                                <button id="facets-back-btn" style="display:none;">back</button>
                            </div>
                            {% include 'prod/tab_thesaurus.html.twig' with {has_access_to_module: app.getAclForUser(app.getAuthenticatedUser()).has_access_to_module('thesaurus')} %}
                        {% endif %}
                    {% endblock %}
                    {% if plugins.workzone is not empty %}
                    <div id="plugins" class="PNB {{ plugins.workzone|length > 1 ? 'multiple-plugin' : 'single-plugin' }}" style="top:52px;">
                        {% for pluginId, plugin in plugins.workzone %}
                            {% include plugin.getWorkzoneTemplate() with {'app': app, 'plugin_id': pluginId} only %}
                        {% endfor %}
                    </div>
                    {% endif %}
                </div>
            </div>
            <div id="basket_menu" class="context-menu context-menu-theme-flat" style="display:none;">
                <ul style="list-style-type:none;margin:0;padding:0">
                    <li class="context-menu-item">
                        <div class="context-menu-item-inner">
                            <a title="{{ 'action:: nouveau panier' | trans }}" class="basket-create-action" href="#">
                                <img style="cursor:pointer;" src="/assets/common/images/icons/Basket-New.png"
                                     title="{{ 'action:: nouveau panier' | trans }}"/>
                                <span>{{ 'action:: nouveau panier' | trans }}</span>
                            </a>
                        </div>
                    </li>
                    <li class="context-menu-item">
                        <div class="context-menu-item-inner">
                            <a title="{{ 'Browse Baskets' | trans }}" class="basket-browse-action" href="#">
                                <img style="cursor:pointer;" src="/assets/common/images/icons/Basket-Browse.png"
                                     title="{{ 'Browse Baskets' | trans }}"/>
                                <span>{{ 'Browse Baskets' | trans }}</span>
                            </a>
                        </div>
                    </li>
                    <li class="context-menu-item divider"></li>
                    <li class="context-menu-item">
                        {% if app['conf'].get(['registry', 'modules', 'stories']) and app.getAclForUser(app.getAuthenticatedUser()).has_right(constant('\\ACL::CANADDRECORD')) %}
                            <div class="context-menu-item-inner">
                                <a title="{{ 'action:: nouveau reportage' | trans }}" class="story-create-action" href="#">
                                    <img style="cursor:pointer;" src="/assets/common/images/icons/Basket-New-Story.png"
                                         title="{{ 'action:: nouveau reportage' | trans }}"/>
                                    <span>{{ 'action:: nouveau reportage' | trans }}</span>
                                </a>
                            </div>
                       {% endif %}
                    </li>
                    <li class="context-menu-item divider"></li>
                    <li class="context-menu-item">
                        <div class="context-menu-item-inner basket-filter-action" data-sort="date">
                            <a title="{{ 'phraseanet:: tri par date' | trans }} " href="#">
                                <img style="cursor:pointer;" src="/assets/common/images/icons/Sort-Date.png"
                                     title="{{ 'phraseanet:: tri par date' | trans }}"/>
                                <span>{{ 'phraseanet:: tri par date' | trans }}</span>
                            </a>
                        </div>
                    </li>
                    <li class="context-menu-item">
                        <div class="context-menu-item-inner basket-filter-action" data-sort="name">
                            <a title="{{ 'phraseanet:: tri par nom' | trans }} " href="#">
                                <img style="cursor:pointer;" src="/assets/common/images/icons/Alphabetique.png"
                                     title="{{ 'phraseanet:: tri par nom' | trans }}"/>
                                <span>{{ 'phraseanet:: tri par nom' | trans }}</span>
                            </a>
                        </div>
                    </li>
                    <li class="context-menu-item">
                        <div class="context-menu-item-inner basket-preferences-action">
                            <a title="{{ 'Preferences' | trans }} " href="#">
                                <img style="cursor:pointer;" src="/assets/common/images/icons/Basket-Settings.png"
                                     title="{{ 'phraseanet:: Preferences' | trans }}"/>
                                <span>{{ 'Preferences' | trans }}</span>
                            </a>
                        </div>
                    </li>
                </ul>
            </div>
        </div>

        <div class="PNB" id="rightFrame" style="left:auto; width:{{ w2 ~ '%' }}">
            <div id="headBlock" class="PNB">
                <div class="searchFormWrapper">
                    {% if app['settings'].getUserSetting(app.getAuthenticatedUser(), 'start_page') == 'QUERY' %}
                        {% set startq = "{\"query\":{\"_ux_zone\":\"\",\"type\":\"CLAUSES\",\"must_match\":\"ALL\",\"enabled\":true,\"clauses\":[{\"_ux_zone\":\"FULLTEXT\",\"type\":\"FULLTEXT\",\"value\":\"" %}
                        {% set startq = startq ~ (app['settings'].getUserSetting(app.getAuthenticatedUser(), 'start_page_query') | replace({'"': '\\"'})) %}
                        {% set startq = startq ~ "\",\"enabled\":true}]}}" %}
                        <div id="FIRST_QUERY_CONTAINER" class="start-query" style="display: none" data-format="json">{{ startq | raw }}</div>
                    {% elseif app['settings'].getUserSetting(app.getAuthenticatedUser(), 'start_page') == 'LAST_QUERY' %}
                        {% set startq = app['settings'].getUserSetting(app.getAuthenticatedUser(), 'last_jsonquery') %}
                        {% if startq is empty %}
                            {% set startq = "{\"query\":{\"_ux_zone\":\"\",\"type\":\"CLAUSES\",\"must_match\":\"ALL\",\"enabled\":true,\"clauses\":[{\"_ux_zone\":\"FULLTEXT\",\"type\":\"FULLTEXT\",\"value\":\"" %}
                            {% set startq = startq ~ "\",\"enabled\":true}]}}" %}
                        {% endif %}
                        <div id="FIRST_QUERY_CONTAINER" class="last-query" style="display: none" data-format="json">{{ startq | raw }}</div>
                    {% endif %}
                    {#container fetched by js #}
                    <input type="hidden" name="advanced-search-title" id="advanced-search-title" value="{{ 'Advanced Search' | trans }}">

                    <form id="searchForm" method="POST" action="{{ path('prod_query') }}" name="phrasea_query" class="phrasea_query">
                        <input id="SENT_query" name="qry" type="hidden" value="{{app['settings'].getUserSetting(app.getAuthenticatedUser(), 'start_page_query')}}">
                        <input type="hidden" name="pag" id="formAnswerPage" value="">
                        <input type="hidden" name="sel" value="">

                        <div class="controls controls-row">
                            <div class="input-append advance_search_action">
                                <input id="EDIT_query" name="fake_qry" type="text" autocomplete="off" class="search query danger_indicator" value="{{app['settings'].getUserSetting(app.getAuthenticatedUser(), 'start_page_query')}}">
                                <a id="ADV_query" href="#" class="btn btn-inverse adv_trigger adv_search_button">
                                    <img src="/assets/common/images/icons/settings.png" title="{{ 'Advanced Search' | trans }}"/>
                                </a>
                                {% if geocodingProviders|length > 0 %}
                                <a id="geo_query" href="#" class="btn btn-inverse adv_trigger geo-search-action-btn">
                                    <img src="/assets/common/images/icons/map.png" title="{{ 'Geo Search' | trans }}"/>
                                </a>
                                {% endif %}
                                <button type="submit" class="btn btn-inverse" style="font-size:14px">{{ 'boutton::rechercher' | trans }}</button>
                            </div>
                            <div class="control-group pull-left search-header-block">
                            {% if GV_multiAndReport %}
                                <label for="mode_type_doc" class="radio inline custom_checkbox_label">
                                    <input type="radio" value="0" class="mode_type_doc" name="search_type" {% if GV_defaultQuery_type == 0 %}checked="checked"{% endif %} id="mode_type_doc"/>
                                    <span class="custom_radio" style="width:9px;height:9px;margin-top:2px;"></span>
                                    {{ 'phraseanet::type:: documents' | trans }}
                                </label>
                                <label for="mode_type_reg" class="radio inline custom_checkbox_label">
                                    <input type="radio" value="1" class="mode_type_reg" name="search_type" {% if GV_defaultQuery_type != 0 %}checked="checked"{% endif %} id="mode_type_reg"/>
                                    <span class="custom_radio" style="width:9px;height:9px;margin-top:2px;"></span>
                                    {{ 'phraseanet::type:: reportages' | trans }}
                                </label>
                            {% else %}
                                <input type="hidden" value="0" name="search_type" />
                            {% endif %}
                                <div id="recordtype_sel" class="custom_select_dark" style="display: inline-block;">
                                    <select name="record_type" class="input-small">
                                        <option value="">{{ 'Tout type' | trans }}</option>
                                        <option value="image">{{ 'Image' | trans }}</option>
                                        <option value="video">{{ 'Video' | trans }}</option>
                                        <option value="audio">{{ 'Audio' | trans }}</option>
                                        <option value="document">{{ 'Document' | trans }}</option>
                                        <option value="flash">{{ 'Flash' | trans }}</option>
                                    </select>
                                </div>
                            </div>
                            <div class="pull-right">
                                <input class="btn btn_lightgrey reset_button search-reset-action" style="display: none;" type="button" value="{{ 'Re-initialiser' | trans }}" />

                                <span class="btn btn-info btn-lg reload-search hidden " id="reload-search">{{ 'help::help-search: relaunch search without filter' | trans }}</span>

                            </div>
                        </div>

                        <div id="advancedSearchForm" class="controls controls-row adv_options" style="display:none;">
                            <table style="width:100%; height:100%; table-layout:fixed;">
                                <tr>
                                    <td style="width:50%; vertical-align:top;">
                                        {% set useTruncation = app['settings'].getUserSetting(app.getAuthenticatedUser(), 'use_truncation') %}
                                        <label class="checkbox inline" for="ADVSRCH_USE_TRUNCATION">
                                            <input id="ADVSRCH_USE_TRUNCATION" type="checkbox"
                                                   class="checkbox preferences-options-use-truncation" name="truncation"
                                                   {% if useTruncation == '1' or useTruncation == NULL %}checked="checked"{% endif %}>
                                            {{ 'index:advanced-preferences:: use truncation' | trans }}
                                        </label>
                                        <div id="ADVSRCH_SBAS_ZONE" class="sbasglob">
                                            <label class="base-section-title">
                                                <span class="danger_indicator">{{ 'Selected base(s)' | trans }}</span>
                                            </label>
                                            <div class="btn-toolbar">
                                                <input class="btn btn_dark toggle-database" type="button"
                                                    value="{{ 'boutton:: selectionner toutes les bases' | trans }}"
                                                       data-state="true" />
                                                <input class="btn btn_dark toggle-database" type="button" data-state="false"
                                                    value="{{ 'boutton:: selectionner aucune base' | trans }}" />
                                            </div>
                                            {{_self.bas_list(module_prod, search_datas)}}
                                        </div>
                                    </td>
                                    <td style="width:50%; vertical-align:top;">
                                        <div id="sbasfiltercont">
                                            <div id="ADVSRCH_OPTIONS_ZONE">
                                                <div id="ADVSRCH_SORT_ZONE">
                                                    {% set sortByDefault =  app['phraseanet.SE'].getDefaultSort()%}
                                                    {% set sortOrderDefault =  app['phraseanet.SE'].getDefaultSortDirection()%}

                                                    {% set sortByPreference = sortByDefault %}
                                                    {% if search_datas.elasticSort.by is defined %}
                                                        {% set sortByPreference = search_datas.elasticSort.by %}
                                                    {% endif %}

                                                    {% set sortOrderPreference = sortOrderDefault %}
                                                    {% if search_datas.elasticSort.order is defined %}
                                                        {% set sortOrderPreference = search_datas.elasticSort.order %}
                                                    {% endif %}
                                                    <span>{{ 'Trier par' | trans }}</span>
                                                    <select name="sort" class="input-medium check-filters" data-save="true">
                                                        {% set isSelected = (sortByPreference == constant('\\Alchemy\\Phrasea\\SearchEngine\\SearchEngineOptions::SORT_CREATED_ON')) %}
                                                        {% set isDefault = (sortByDefault == constant('\\Alchemy\\Phrasea\\SearchEngine\\SearchEngineOptions::SORT_CREATED_ON')) %}
                                                        <option value="{{ constant('\\Alchemy\\Phrasea\\SearchEngine\\SearchEngineOptions::SORT_CREATED_ON') }}" {% if isSelected %}selected="selected"{% endif %}{% if isDefault %} class="default-selection"{% endif %}>{{ "Date Added"|trans }}</option>
                                                        {% set isSelected = (sortByPreference == constant('\\Alchemy\\Phrasea\\SearchEngine\\SearchEngineOptions::SORT_UPDATED_ON')) %}
                                                        {% set isDefault = (sortByDefault == constant('\\Alchemy\\Phrasea\\SearchEngine\\SearchEngineOptions::SORT_UPDATED_ON')) %}
                                                        <option value="{{ constant('\\Alchemy\\Phrasea\\SearchEngine\\SearchEngineOptions::SORT_UPDATED_ON') }}" {% if isSelected %}selected="selected"{% endif %}{% if isDefault %} class="default-selection"{% endif %}>{{ "Date Updated"|trans }}</option>
                                                        {% set isSelected = (sortByPreference == constant('\\Alchemy\\Phrasea\\SearchEngine\\SearchEngineOptions::SORT_RELEVANCE')) %}
                                                        {% set isDefault = (sortByDefault == constant('\\Alchemy\\Phrasea\\SearchEngine\\SearchEngineOptions::SORT_RELEVANCE')) %}
                                                        <option value="{{ constant('\\Alchemy\\Phrasea\\SearchEngine\\SearchEngineOptions::SORT_RELEVANCE') }}" {% if isSelected %}selected="selected"{% endif %}{% if isDefault %} class="default-selection"{% endif %}>{{ "Relevance"|trans }}</option>
                                                        <optgroup label="{{ 'By field'|trans }}">
                                                        {% for fieldname, sort in search_datas['sort'] %}
                                                            {% set b = (sortOrderPreference == fieldname) %}
                                                            <option value="{{ fieldname }}"
                                                                    {% if b %}selected="selected"{% endif %}
                                                                    class="{% if b %}default-selection {% endif %}dbx db_{{sort['sbas']|join(' db_')}}"
                                                                    >{{ fieldname }}</option>
                                                        {% endfor %}
                                                        </optgroup>
                                                    </select>
                                                    <select name="ord" class="input-medium check-filters" data-save="true">
                                                        {% for ord, ord_name in app['phraseanet.SE'].getAvailableOrder() %}
                                                            {% set isSelected = (sortOrderPreference == ord) %}
                                                            {% set isDefault = (sortOrderDefault == ord) %}
                                                            <option value="{{ ord }}" {% if isSelected %}selected="selected"{% endif %}{% if isDefault %} class="default-selection"{% endif %}>{{ ord_name }}</option>
                                                        {% endfor %}
                                                    </select>
                                                </div>

                                                <div id="ADVSRCH_FIELDS_ZONE">
                                                    <label class="status-section-title">
                                                        <span class="danger_indicator">{{ 'Les termes apparaissent dans le(s) champs' | trans }}</span>
                                                        <img id="info-box-trigger" src="/assets/common/images/icons/Info-white.png" width="18" height="18">
                                                        <div id="info-box">
                                                            <p>{{ 'prod::advancesearch:tooltips:field_restriction_explanation' | trans }}</p>
                                                        </div>
                                                    </label>
                                                    <label for="multiple-terms" class="radio inline custom_checkbox_label">
                                                        <input type="radio" class="multiple_terms" name="must_match" value="ALL" checked="checked" id="multiple-terms"/>
                                                        <span class="custom_radio"></span>
                                                        {{ 'All these conditions' | trans }}
                                                    </label>
                                                    <label for="single-terms" class="radio inline custom_checkbox_label">
                                                        <input type="radio" class="single_terms" name="must_match" value="ONE" id="single-terms"/>
                                                        <span class="custom_radio"></span>
                                                        {{ 'One of these conditions' | trans }}
                                                    </label>

                                                    <div class="term_select">
                                                        <div class="term_select_wrapper_template" style="display: none;">
                                                        <select class="term_select_field" style="vertical-align:middle; width:30%;">
                                                                <option value="">{{ 'Select a field' | trans }}</option>
                                                                {% for field_id, field in search_datas['fields'] %}
                                                                   {# {% if field['type'] != 'date' %}#}
                                                                        <option class="dbx db_{{field['sbas']|join(' db_')}}" data-fieldtype="{{ field['type'] }}-FIELD" value="{{field_id}}">{{field['fieldname']}}</option>
                                                                    {#{% endif %}#}
                                                                {% endfor %}
                                                            </select>
                                                            <select class="term_select_op" disabled style="vertical-align:middle; width: 23%;">
                                                                <option value=":">{{ 'Contains' | trans }}</option>
                                                                <option value="=">{{ 'Equals' | trans }}</option>
                                                            </select>
                                                            <input class="term_select_value" disabled style="vertical-align:middle; width: 32%;" placeholder="{{ 'Ex : Paris, bleu, montagne' | trans }}">
                                                            <input class="term_deleter" style="margin-bottom: 4px;">
                                                        </div>

                                                        <button class="add_new_term"><span>&plus;</span> Add</button>
                                                    </div>

                                                   {# <div style="display:none;">
                                                        <select class="term_select_multiple" size="8" multiple onchange="prodApp.appEvents.emit('search.doCheckFilters', true);" name="fields[]" style="vertical-align:middle; width:99%;">
                                                            <option value="phraseanet--all--fields">{{ 'rechercher dans tous les champs' | trans }}</option>
                                                            {% for field_id, field in search_datas['fields'] %}
                                                                {% if field['type'] != 'date' %}
                                                                    <option class="dbx db_{{field['sbas']|join(' db_')}}" value="{{field_id}}">{{field['fieldname']}}</option>
                                                                {% endif %}
                                                            {% endfor %}
                                                        </select>
                                                    </div>#}
                                                </div>

                                                <div id="ADVSRCH_DATE_ZONE">
                                                {% if app['phraseanet.SE'].getAvailableDateFields() | length > 0 %}
                                                    <hr />
                                                    <label class="status-section-title">
                                                        <span class="danger_indicator">{{ 'Date(s) from field(s)' | trans }}</span>
                                                        <img id="info-box-trigger" src="/assets/common/images/icons/Info-white.png" width="18" height="18">
                                                        <div id="info-box">
                                                            <p>
                                                                {{ 'prod::advancesearch:tooltips:datefield_restriction_explanation' | trans }}
                                                            </p>
                                                        </div>
                                                    </label>
                                                    <span>
                                                        <select name="date_field" class="date-field input-medium check-filters" data-save="true" style="width: 166px;">
                                                            <option selected="selected"
                                                                    value="">{{ 'Rechercher dans un champ date' | trans }}</option>
                                                            {% for fieldname, date in search_datas['dates'] %}
                                                                <option
                                                                    class="dbx db_{{date['sbas']|join(' db_')}}" value="{{ fieldname }}">{{ fieldname }}</option>
                                                            {% endfor %}
                                                             <option value="updated_on">{{ 'updated_on' | trans }}</option>
                                                            <option value="created_on">{{ 'created_on' | trans }}</option>
                                                        </select>
                                                    </span>
                                                    <span id="ADVSRCH_DATE_SELECTORS"  style="display: inline-block;height: 26px;line-height: 26px;">
                                                        {{ 'phraseanet::time:: de' | trans }}
                                                        <div class="input-prepend">
                                                            <span class="add-on">
                                                                <i class="fa fa-calendar" aria-hidden="true"></i>
                                                            </span>
                                                            <input onchange="prodApp.appEvents.emit('search.doCheckFilters', true);" class="datepicker input-small" type="text" name="date_min" placeholder="{% trans %}YYYY/MM/DD{% endtrans %}" style="margin: 0;position: relative; z-index: 10001;" />
                                                        </div>
                                                        {{ 'phraseanet::time:: a' | trans }}
                                                        <div class="input-prepend">
                                                            <span class="add-on">
                                                                <i class="fa fa-calendar" aria-hidden="true"></i>
                                                            </span>
                                                            <input onchange="prodApp.appEvents.emit('search.doCheckFilters', true);" class="datepicker input-small" type="text" name="date_max" placeholder="{% trans %}YYYY/MM/DD{% endtrans %}" style="margin: 0;position: relative; z-index: 10001;" />
                                                        </div>
                                                    </span>
                                                {% endif %}
                                                </div>

                                                <div id="ADVSRCH_SB_ZONE">
                                                {% if search_status|length > 0 %}
                                                    <hr />
                                                    <label class="status-section-title">
                                                        <span class="danger_indicator">{{ 'Status des documents a rechercher' | trans }}</span>
                                                    </label>
                                                    {% for databox_id, databox in search_status %}
                                                    {% if databox.status|length > 0 %}
                                                    <table style="width: 100%;" id="ADVSRCH_SB_ZONE_{{databox_id}}" class="field_{{databox_id}}">
                                                        <thead>
                                                            <tr>
                                                                <td colspan="2">
                                                                    <span class="toggle-collection deployer_toggle deployer_closed" data-toggle-content="#ADVSRCH_SB_{{databox_id}}"></span>
                                                                    <span>{{ databox['name'] }}</span>
                                                                </td>
                                                            </tr>
                                                        </thead>
                                                        <tbody id="ADVSRCH_SB_{{databox_id}}" style="display: none; margin-top: 15px;">
                                                            {% for status_bit, status in databox.status %}
                                                            <tr>
                                                                <td>

                                                                    <label class="checkbox inline custom_checkbox_label">
                                                                        {% if status['img_off'] %}
                                                                            <img src="{{status['img_off']}}" title="{{status['labels_off_i18n'][app['locale']]}}" />
                                                                        {% endif %}
                                                                        <input type="checkbox"  class="field_switch field_{{databox_id}}"
                                                                               value="0"
                                                                               data-sbas_id="{{databox_id}}" data-sb="{{status_bit}}"
                                                                               name="status[{{databox_id}}][{{status_bit}}]"
                                                                        />
                                                                        <span class="custom_checkbox"></span>
                                                                        {{status['labels_off_i18n'][app['locale']]}}
                                                                    </label>
                                                                </td>
                                                                <td>
                                                                    <label class="checkbox inline custom_checkbox_label">
                                                                        {% if status['img_on'] %}
                                                                            <img src="{{status['img_on']}}" title="{{status['labels_on_i18n'][app['locale']]}}" />
                                                                        {% endif %}
                                                                        <input type="checkbox" class="field_switch field_{{databox_id}}"
                                                                               value="1"
                                                                               data-sbas_id="{{databox_id}}" data-sb="{{status_bit}}"
                                                                               name="status[{{databox_id}}][{{status_bit}}]"
                                                                        />
                                                                        <span class="custom_checkbox"></span>
                                                                        {{status['labels_on_i18n'][app['locale']]}}
                                                                    </label>
                                                                </td>
                                                            </tr>
                                                            {% endfor %}
                                                        </tbody>
                                                    </table>
                                                    {% endif %}
                                                    {% endfor %}
                                                {% endif %}
                                                </div>
                                            </div>
                                        </div>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </form>
                </div>
            </div>

            <div id="idFrameT" class="PNB ui-corner-top">
                <div class="tools PNB10 btn-toolbar">
                    {% include "prod/toolbar.html.twig" with {acl: app.getAclForUser(app.getAuthenticatedUser())} %}
                    <a href="#" id="settings" class="open-preferences" data-action="">{{ 'Preferences' | trans }} </a>
                </div>
                <div id="answers" class=" PNB10"></div>
                <div id="answers_status">
                    <div class="infos">
                        <span id="tool_results">

                        </span>
                    </div>
                </div>
            </div>
        </div>
    </div>

    <div>
        <form style="visibility:hidden;display:none;" name="formDownload" action="{{ path('check_download') }}" method="post" target="HFrameZ" >
            <input type="hidden" name="act" value="DOWNLOAD" />
            <input type="hidden" name="lst" value="" />
            <input type="hidden" name="fromchu" value="" />
            <input type="hidden" name="type" value="" />
            <input type="checkbox" name="obj[]" value="document" />
            <input type="checkbox" name="obj[]" value="preview" />
            <input type="checkbox" name="obj[]" value="caption" />
            <input type="hidden" name="SSTTID" value="" />
        </form>
        <form style="visibility:hidden;display:none;" name="formZ" action="???" method="post">
            <input type="hidden" name="act" value="???" />
            <input type="hidden" name="p0" value="?" />
            <input type="hidden" name="p1" value="?" />
        </form>
        <div id="idFrameW0">
            <div class="pbarBck">
                <div id="idProgressBar0" class="pbarFrt" style="width:0%;"></div>
            </div>
        </div>
    </div>

{% endblock %}

{% block extra_content %}

    <div id="MESSAGE"></div>
    <div id="MESSAGE-push"></div>
    <div id="MESSAGE-publi"></div>
    <div id="DIALOG"></div>
    <div id="keyboard-dialog" class="{% if app['settings'].getUserSetting(app.getAuthenticatedUser(), 'keyboard_infos') != '0' %}auto{% endif %}" style="display:none;" title="{{ 'raccourci :: a propos des raccourcis claviers' | trans }}">
        <div>
            <h1>{{ 'Raccourcis claviers en cours de recherche :' | trans }}</h1>
            <ul>
                <li>{{ 'Raccourcis:: ctrl-a : tout selectionner' | trans }}</li>
                <li>{{ 'Raccourcis:: ctrl-p : imprimer la selection' | trans }}</li>
                <li>{{ 'Raccourcis:: ctrl-e : editer la selection' | trans }}</li>
                <li>{{ 'Raccourcis::fleche gauche : page precedente' | trans }}</li>
                <li>{{ 'Raccourcis::fleche droite : page suivante' | trans }}</li>
                <li>{{ 'Raccourcis::fleche haut : scroll vertical' | trans }}</li>
                <li>{{ 'Raccourcis::fleche bas : scroll vertical' | trans }}</li>
            </ul>
        </div>
        <div>
            <h1>{{ 'Raccourcis claviers de la zone des paniers :' | trans }}</h1>
            <ul>
                <li>{{ 'Raccourcis:: ctrl-a : tout selectionner' | trans }}</li>
                <li>{{ 'Raccourcis:: ctrl-p : imprimer la selection' | trans }}</li>
                <li>{{ 'Raccourcis:: ctrl-e : editer la selection' | trans }}</li>
            </ul>
        </div>
        <div>
            <h1>{{ 'Raccourcis claviers en cours de editing :' | trans }}</h1>
            <ul>
                <li>{{ 'Raccourcis::tab/shift-tab se ballade dans les champs' | trans }}</li>
            </ul>
        </div>
        <div>
            <h1>{{ 'Raccourcis claviers en cours de preview :' | trans }}</h1>
            <ul>
                <li>{{ 'Raccourcis::fleche gauche : en avant' | trans }}</li>
                <li>{{ 'Raccourcis::fleche gauche : en arriere' | trans }}</li>
                <li>{{ 'Raccourcis::espace : arreter/demarrer le diaporama' | trans }}</li>
            </ul>
        </div>
        <div>
            <ul>
                <li>{{ 'Vous pouvez quitter la plupart des fenetres survolantes via la touche echap' | trans }}</li>
            </ul>
        </div>
        <div>
            <ul>
                <li>
                    <label class="checkbox" for="keyboard-stop">
                        <input id="keyboard-stop" type="checkbox"/>
                        {{ 'raccourcis :: ne plus montrer cette aide' | trans }}
                    </label>
                </li>
            </ul>
        </div>
    </div>

    {{cgus_agreement|raw}}

    <div style="display:none;position:relative;" id="look_box" title="{{ 'Preferences' | trans }}" >
        <div class="tabs">
            <ul>
                <li><a href="#look_box_screen">{{ 'Affichage' | trans }}</a></li>
                <li><a href="#look_box_settings">{{ 'Configuration' | trans }}</a></li>
            </ul>
            <div id="look_box_screen">
                <div class="box">
                    <div class="" style="float:left; width:100%;margin-top:20px;">
                        {% set mod = app['settings'].getUserSetting(app.getAuthenticatedUser(), 'advanced_search_reload') %}
                        <label class="checkbox inline" for="user_settings_advanced_search_reload">
                            <input name="advanced_search_reload" type="checkbox" style="margin: 3px 0 0 -18px;" class="checkbox preferences-options-search-reload" value="1" id="user_settings_advanced_search_reload" {% if mod == '1' %}checked="checked"{% endif %}/>
                            {{ 'Use latest search settings on Production loading' | trans }}
                        </label>
                    </div>
                </div>
                <div class="box">
                    <h1>{{  'Language selection' | trans }}</h1>
                    <label class="inline" for="language">
                        <select onchange="window.location = $(this).val();" id="language">
                            {% for code, language in app.getAvailableLanguages() %}
                                {% if code == app['locale'] %}
                                <option selected="selected" disabled="disabled">{{ language }}</option>
                            {% else %}
                                <option value="{{ path('set_locale', {'locale' : code, 'redirect' : '/prod' }) }}"><a href="{{ path('set_locale', {'locale' : code, 'redirect' : '/prod' }) }}" data-country-code="{{ code }}">{{ language }}</a></option>
                                {% endif %}
                            {% endfor %}
                        </select>
                    </label>
                </div>
                <div class="box">
                    <div class="" style="float:left; width:49%;">
                        <h1>{{ 'Mode de presentation' | trans }}</h1>
                        {% set mod = app['settings'].getUserSetting(app.getAuthenticatedUser(), 'view') %}
                        <label class="radio inline" for="thumbs_view">
                            <input name="view_type" type="radio" style="margin: 3px 0 0 -18px;" class="radio preferences-options-presentation-thumbnail" value="thumbs" id="thumbs_view" {% if mod == 'thumbs' %}checked="checked"{% endif %}/>
                            {{ 'reponses:: mode vignettes' | trans }}
                        </label>
                        <label class="radio inline" for="list_view">
                            <input name="view_type" type="radio" style="margin: 3px 0 0 -18px;" class="radio preferences-options-presentation-list" value="list" id="list_view" {% if mod == 'list' %}checked="checked"{% endif %}/>
                            {{ 'reponses:: mode liste' | trans }}
                        </label>
                    </div>
                    <div style="float:right; width:49%;">
                        <h1>{{ 'Theme' | trans }}</h1>
                        <div id="theme-container"></div>
                    </div>
                </div>
                <div class="box">
                    {% set rollover_thumbnail = app['settings'].getUserSetting(app.getAuthenticatedUser(), 'rollover_thumbnail') %}
                    <h1>{{ 'Presentation de vignettes'  | trans }}</h1>
                    <label class="radio" for="rollover_caption">
                        <input name="rollover_thumbnail" type="radio" class="radio preferences-options-rollover-caption" value="caption" id="rollover_caption" {% if rollover_thumbnail == 'caption' %}checked="checked" {% endif %}/>
                        {{ 'Iconographe (description au rollover)' | trans }}
                    </label>
                    <label class="radio" for="rollover_preview">
                        <input name="rollover_thumbnail" type="radio" class="radio preferences-options-rollover-preview" value="preview" id="rollover_preview" {% if rollover_thumbnail == 'preview' %}checked="checked" {% endif %}/>
                        {{ 'Graphiste (preview au rollover)' | trans }}
                    </label>
                </div>
                <div class="box">
                    {% set technical_display = app['settings'].getUserSetting(app.getAuthenticatedUser(), 'technical_display') %}
                    <h1>{{'Display technical data'  | trans }}</h1>
                    <label class="radio" for="technical_show">
                        <input name="technical_display" type="radio" class="radio preferences-options-technical-display" value="1" id="technical_show" {% if technical_display == '1' %}checked="checked"{% endif %}/>
                        {{ 'In the answer grid' | trans }}
                    </label>
                    <label class="radio" for="technical_group">
                        <input name="technical_display" type="radio" class="radio preferences-options-technical-display" value="group" id="technical_group" {% if technical_display == 'group' %}checked="checked"{% endif %}/>
                        {{ 'After metadata' | trans }}
                    </label>
                    <label class="radio" for="technical_hide">
                        <input name="technical_display" type="radio" class="radio preferences-options-technical-display" value="0" id="technical_hide" {% if technical_display == '0' %}checked="checked"{% endif %}/>
                        {{ 'Do not display' | trans }}
                    </label>
                </div>
                <div class="box">
                    {% set doctype_display = app['settings'].getUserSetting(app.getAuthenticatedUser(), 'doctype_display') %}
                    <h1>{{'Type de documents'  | trans }}</h1>
                    <label class="checkbox" for="doctype_display_show">
                        <input name="doctype_display" type="checkbox" class="checkbox preferences-options-doctype-display" value="1" id="doctype_display_show" {% if doctype_display != '0' %}checked="checked"{% endif %}/>
                        {{ 'Afficher une icone' | trans }}
                    </label>

                </div>
                <div class="box">
                    <div class="" style="float:left; width:49%;">
                        <h1>{{ 'reponses:: images par pages :' | trans }}</h1>
                        <div class="box">
                            <div id="nperpage_slider" class="ui-corner-all" style="width:100px; display:inline-block;"></div>
                            <input type="text" readonly style="width:35px;" value="{{app['settings'].getUserSetting(app.getAuthenticatedUser(), 'images_per_page')}}" id="nperpage_value"/>
                        </div>
                    </div>
                    <div style="float:right; width:49%;">
                        <h1>{{ 'reponses:: taille des images :' | trans }}</h1>
                        <div class="box">
                            <div id="sizeAns_slider" class="ui-corner-all" style="width:100px;display:inline-block;"></div>
                            <input type="hidden" value="{{app['settings'].getUserSetting(app.getAuthenticatedUser(), 'images_size')}}" id="sizeAns_value"/>
                        </div>
                    </div>
                </div>
                <div class="box">
                    <h1>{{ 'Couleur de selection' | trans }}</h1>
                    <div id="backcolorpickerHolder" class="colorpickerbox">
                        <div class="submiter">{{ 'choisir' | trans }}</div>
                    </div>
                </div>
            </div>
            <div id="look_box_settings">
                <div class="row-fluid">
                    <div class="box">
                        <h1>{{ 'Affichage au demarrage' | trans }}</h1>
                        <form class="form-inline">
                            {% set start_page_pref = app['settings'].getUserSetting(app.getAuthenticatedUser(), 'start_page') %}
                            <select class="span4 preferences-options-start-page" name="start_page">
                                <option value="LAST_QUERY" {% if start_page_pref == 'LAST_QUERY' %}selected="selected"{% endif %} >
                                    {{ 'Ma derniere question' | trans }}
                                </option>
                                <option value="QUERY" {% if start_page_pref == 'QUERY' %}selected="selected"{% endif %} >
                                    {{ 'Une question personnelle' | trans }}
                                </option>
                                <option value="PUBLI" {% if start_page_pref == 'PUBLI' %}selected="selected"{% endif %} >
                                    {{ 'Publications' | trans }}
                                </option>
                                <option value="HELP" {% if start_page_pref == 'HELP' %}}selected="selected"{% endif %} >
                                    {{ 'Aide' | trans }}
                                </option>
                            </select>
                            <input type="text" class="span4" name="start_page_value" value="{{ app['settings'].getUserSetting(app.getAuthenticatedUser(), 'start_page_query')}}" style="display:{% if start_page_pref == 'QUERY' %}inline{% else %}none{% endif %}" />
                            <input type="button" class="btn btn-inverse preferences-options-submit" value="{{'boutton::valider'  | trans }}" />
                        </form>
                    </div>
                </div>
                <div class="box">
                    <h1>{{ 'Collection order' | trans }}</h1>
                    <form class="form-inline">
                        {% set order_collection_by = app['settings'].getUserSetting(app.getAuthenticatedUser(), 'order_collection_by') %}
                        <label class="select" for="orderByName">
                            <select class="preferences-options-collection-order" name="orderByName">
                                <option {% if order_collection_by == constant('Alchemy\\Phrasea\\Core\\Configuration\\DisplaySettingService::ORDER_BY_ADMIN') %} selected="selected" {% endif %}
                                        value="{{ constant('Alchemy\\Phrasea\\Core\\Configuration\\DisplaySettingService::ORDER_BY_ADMIN') }}">{{ 'Defined by admin' | trans }}</option>
                                <option {% if order_collection_by == constant('Alchemy\\Phrasea\\Core\\Configuration\\DisplaySettingService::ORDER_ALPHA_ASC') %} selected="selected" {% endif %}
                                        value="{{ constant('Alchemy\\Phrasea\\Core\\Configuration\\DisplaySettingService::ORDER_ALPHA_ASC') }}">{{ 'Alphabetic asc' | trans }}</option>
                                <option {% if order_collection_by == constant('Alchemy\\Phrasea\\Core\\Configuration\\DisplaySettingService::ORDER_ALPHA_DESC') %} selected="selected" {% endif %}
                                        value="{{ constant('Alchemy\\Phrasea\\Core\\Configuration\\DisplaySettingService::ORDER_ALPHA_DESC') }}">{{ 'Alphabetic desc' | trans }}</option>
                            </select>
                        </label>
                    </form>
                </div>
                <div class="box">
                    <h1>{{ 'index::advance_search: facet' | trans }}</h1>
                    {% set facetFilter = app['settings'].getUserSetting(app.getAuthenticatedUser(), 'facet') %}
                    <label class="checkbox inline" for="ADVSRCH_FILTER_FACET" style="margin-bottom: 1em">
                        <input id="ADVSRCH_FILTER_FACET" type="checkbox" name="filter_facet" {% if facetFilter == 'true' %}checked="checked"{% endif %}>
                        {{ 'index::advance_search: disable-facet' | trans }}
                    </label>
                    <h1>{{ 'index::advance_search: hidden-facet-values-order' | trans }}</h1>
                    <div class="hiddenFiltersListContainer"></div>
                </div>
            </div>
        </div>
    </div>

    <div id="PREVIEWBOX" class="PNB10 ui-dialog " style="overflow:hidden;">
        <div id="PREVIEWTITLE" style="height:55px;bottom:auto;" class="PNB">
            <div class="PNB10 ui-corner-top" id='PREVIEWTITLEWRAPPER'>
                <div style="padding-top: 0px; padding-left: 5px;">
                    <span id="PREVIEWTITLE_COLLLOGO"> </span>
                    &nbsp;
                    <span id="PREVIEWTITLE_COLLNAME"> </span>
                    &nbsp;
                    <span id="SPANTITLE"> </span>
                </div>
            </div>
        </div>
        <div class="PNB" style="right:180px;">
            <div class="PNB" style="top:55px;">
                <div id="PREVIEWLEFT" class="preview_col PNB" style="width:60%;right:auto;overflow:hidden;">
                    <div id="PREVIEWCURRENT" class="ui-corner-bottom PNB10" style="top:11px;height:116px;bottom:auto;">
                        <div id="PREVIEWCURRENTGLOB" style=""></div>
                    </div>
                    <div class="PNB10" style="top:146px;">
                        <button id="left-btn" class="invisible-btn preview-navigate-action" data-direction="backward">
                            <i class="fa fa-caret-left" aria-hidden="true"></i>
                        </button>
                        <button id="right-btn" class="invisible-btn preview-navigate-action" data-direction="forward">
                            <i class="fa fa-caret-right" aria-hidden="true"></i>
                        </button>
                    </div>
                    <div id="PREVIEWIMGCONT" class="dblclick preview_col_cont PNB10" style="overflow:hidden;top:146px;"></div>
                </div>
                <div class="gui_vsplitter gui_vsplitter2" style="left:60%;">

                </div>
                <div id="PREVIEWRIGHT" class="preview_col PNB" style="top:0px;left:60%;overflow:hidden;">
                    <div id="PREVIEWIMGDESC" class="PNB10">
                        <ul class="PNB" style="height:30px;bottom:auto;">
                            <li><a href="#PREVIEWIMGDESCINNER-BOX">{{ 'preview:: Description' | trans }}</a></li>
                            <li><a href="#HISTORICOPS-BOX">{{ 'preview:: Historique' | trans }}</a></li>
                            {% if GV_google_api is not empty %}
                            <li><a href="#popularity-BOX">{{ 'preview:: Popularite' | trans }}</a></li>
                            {% endif %}
                        </ul>
                        <div id="PREVIEWIMGDESCINNER-BOX" class="descBoxes PNB">
                            <div id="PREVIEWIMGDESCINNER" class="PNB10"></div>
                        </div>
                        <div id="HISTORICOPS-BOX" class="descBoxes PNB">
                            <div id="HISTORICOPS" class="PNB10"></div>
                        </div>
                        {% if GV_google_api is not empty %}
                        <div id="popularity-BOX" class="descBoxes PNB">
                            <div id="popularity" class="PNB10"></div>
                        </div>
                        {% endif %}
                    </div>
                </div>
            </div>
        </div>
        <div class="PNB" style="width:180px;left:auto;">
            <div class="PNB10 ui-corner-all" style="height:20px;">

                <button type="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-icon-only ui-dialog-titlebar-close close-preview-action" role="button" aria-disabled="false" title="close">
                    <span class="ui-button-icon-primary ui-icon ui-icon-closethick"></span><span class="ui-button-text">close</span>
                </button>
            </div>
            <div id="PREVIEWOTHERS" style="top:95px;" class="PNB10 ui-corner-all">
            <div id="PREVIEWOTHERSINNER" style=""></div>
            </div>
        </div>
    </div>

    <div id="EDITWINDOW" style="display:none;" class="PNB10">
        <div id="idFrameE" class="PNB"></div>
    </div>

    <div id="basket_preferences" style="display:none;">
        <div class="box">
            <h1>{{ 'Presentation de vignettes de panier' | trans }}</h1>
            <div>
                {% set basket_status_display = app['settings'].getUserSetting(app.getAuthenticatedUser(), 'basket_status_display') %}
                <label for="basket_status_display" class="checkbox">
                    <input
                    name="basket_status_display" type="checkbox" class="checkbox preferences-options-basket-status" value="1"
                    id="basket_status_display" {% if basket_status_display == '1' %}checked="checked"{% endif %} />
                    {{ 'Afficher les status' | trans }}
                </label>
            </div>
            <div>
                {% set basket_caption_display = app['settings'].getUserSetting(app.getAuthenticatedUser(), 'basket_caption_display') %}
                <label for="basket_caption_display" class="checkbox">
                    <input
                    name="basket_caption_display" type="checkbox" class="checkbox preferences-options-basket-caption" value="1"
                    id="basket_caption_display" {% if basket_caption_display == '1' %}checked="checked"{% endif %} />
                    {{ 'Afficher la fiche descriptive' | trans }}
                </label>
            </div>
            <div>
                {% set basket_title_display = app['settings'].getUserSetting(app.getAuthenticatedUser(), 'basket_title_display') %}
                <label for="basket_title_display" class="checkbox">
                    <input
                    name="basket_title_display" type="checkbox" class="checkbox preferences-options-basket-title" value="1"
                    id="basket_title_display" {% if basket_title_display == '1' %}checked="checked"{% endif %} />
                    {{ 'Afficher le titre' | trans }}
                </label>
            </div>
        </div>
    </div>

    <div id="dialog_publicator" title="{{ 'action : bridge' | trans }}" style="display:none;"></div>
    <div id="modal_feed" title="{{ 'action : publier' | trans }}" style="display:none;"></div>
    <div id="dialog_dwnl" title="{{ 'action : exporter' | trans }}" style="display:none;"></div>
    <script type="text/javascript" id="bitly_loader"></script>
    <script type="text/javascript">
        $(document).ready(function(){
            $('#right-btn').mouseenter(function() {
                $('#right-btn i').stop(true, true).fadeIn(200).delay(500).fadeOut(200);
            });
            $('#left-btn').mouseenter(function() {
                $('#left-btn i').stop(true, true).fadeIn(200).delay(500).fadeOut(200);
            });
        });
    </script>
{% endblock %}
