<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html lang="{{ app['locale'] }}">
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <title>{{ 'thesaurus:: Lier la branche de thesaurus' | trans }}</title>

        <link type="text/css" rel="stylesheet" href="/assets/thesaurus/css/thesaurus{% if not app.debug %}.min{% endif %}.css" />

        <script type="text/javascript">
            function clkBut(button)
            {
                switch(button)
                {
                    case "submit":
                        document.forms[0].submit();
                        break;
                    case "cancel":
                        self.close();
                        break;
                }
            }
            function loaded()
            {
                window.name="LINKFIELD";
            }
        </script>
    </head>
    <body onload="loaded();" class="dialog">
    <center>
        <form action="linkfield3.php" method="post" target="LINKFIELD">
            <input type="hidden" name="piv" value="{{ piv }}">
            <input type="hidden" name="bid" value="{{ bid }}">
            <input type="hidden" name="tid" value="{{ tid }}">
            <br/>
            <br/>
            <br/>
            <div style="width:70%; height:200px; overflow:scroll;" class="x3Dbox">
            {% for fieldname, branches in oldlinks %}
                {% if branches['old_branch'] %}
                    {% set old_branch = branches['old_branch'] %}
                    <b>{{ fieldname }}</b>
                    {% trans with {'%old_branch%' : old_branch} %}thesaurus:: Ce champ a ete modifie ; ancienne branche : %old_branch% }}{% endtrans %}
                    <br/>
                {% endif %}
                {{ 'thesaurus:: nouvelle branche' | trans }} : {{ branches['new_branch'] }}
                <br/>

                {% if branches['old_branch'] is not none and '' == branches['new_branch'] %}
                    <b>{{ fieldname }}</b>{{ 'thesaurus:: ce champ n\'est plus lie au thesaurus, les termes indexes et candidats seront supprimes' | trans }}
                    <br/>
                    <input type="hidden" name="f2unlk[]" value="{{ fieldname }}">
                {% endif %}
                {% if '' != branches['new_branch'] %}
                    {% if '' == branches['old_branch'] %}
                        <b>{{ fieldname }}</b>{{ 'thesaurus:: ce champ doit etre lie au thesaurus. La reindexation de la base est necessaire' | trans }}
                    {% else %}
                        <b>{{ fieldname }}</b>{{ 'thesaurus:: le lien au thesaurus doit etre modifie, la reindexation de la base est necessaire' | trans }}
                    {% endif %}
                    <br/>
                    <input type="hidden" name="fbranch[]" value="{{fieldname}}<{{ branches['new_branch'] }}"/>
                {% endif %}
            {% endfor %}
            </div>

            {% if need_reindex %}
                <input type="hidden" name="reindex" value="1">
                <div style='position:absolute; top:5px; left:0px; width:100%; text-align:center; color:red'>{{ 'thesaurus:: reindexation necessaire' | trans }}</div>
            {% else %}
                <div style='position:absolute; top:5px; left:0px; width:100%; text-align:center; color:green'>{{ 'thesaurus:: pas de reindexation' | trans }}</div>
            {% endif %}
            <br/>
            <input type="button" id="submit_button" value="{{ 'boutton::valider' | trans }}" onclick="clkBut('submit');">
            &nbsp;&nbsp;&nbsp;
            <input type="button" id="cancel_button" value="{{ 'boutton::annuler' | trans }}" onclick="clkBut('cancel');">
        </form>
    </center>
</body>
</html>
