<commit_before>{% extends "_layouts/cp" %}

{% set title = "Import"|t %}

{% set tabs = {
    overview: { label: "Import history"|t, url: url('import') },
    upload: { label: "Upload file"|t, url: url('import/upload') },
    map:    { label: "Map fields"|t, url: '', class: 'disabled' }
} %}

{% set selectedTab = 'upload' %}

{% includeJsResource 'import/js/import.js' %}

{% import "_includes/forms" as forms %}

{% set content %}
    <form id="import-form" method="post" action="" class="centered" accept-charset="UTF-8" enctype="multipart/form-data">
        <input type="hidden" name="action" value="import/uploadFile">
        
        {% set sections = craft.sections.getAllSections() %}
        
        <table class="data">
            <tr>
                <td>
                    <div class="field">
                        <div class="heading">
                            <label>{{ "Section"|t }}</label>
                            <div class="instructions">
                                <p>{{ "Choose the section you want to import to."|t }}</p>                
                            </div>
                        </div>
                    </div>
                </td>
                <td>
                    <div class="field">
                        <div class="input">
                            <div class="select">
                                <select name="importSection" id="sections">
                                {% for section in sections if section.type != 'single' %}
                                    <option value="{{ section.id }}">{{ section.name }}</option>
                                {% endfor %}
                                </select>
                            </div>
                        </div>
                    </div>
                </td>
            </tr>
            <tr>
                <td>
                    <div class="field">
                        <div class="heading">
                            <label>{{ "Entrytype"|t }}</label>
                            <div class="instructions">
                                <p>{{ "Choose the entrytype you want to import to."|t }}</p>                
                            </div>
                        </div>
                    </div>
                </td><commit_msg>Only list sections for which the user has permissions, also fixing an entrytype listing bug if the first found section was a single.<commit_after>{% extends "_layouts/cp" %}

{% set title = "Import"|t %}

{% set tabs = {
    overview: { label: "Import history"|t, url: url('import') },
    upload: { label: "Upload file"|t, url: url('import/upload') },
    map:    { label: "Map fields"|t, url: '', class: 'disabled' }
} %}

{% set selectedTab = 'upload' %}

{% includeJsResource 'import/js/import.js' %}

{% import "_includes/forms" as forms %}

{% set content %}
    <form id="import-form" method="post" action="" class="centered" accept-charset="UTF-8" enctype="multipart/form-data">
        <input type="hidden" name="action" value="import/uploadFile">
        
        {% set sections = {} %}
        {% for section in craft.sections.getEditableSections() if section.type != 'single' %}
            {% set sections = sections|merge([section]) %}
        {% endfor %}
        
        <table class="data">
            <tr>
                <td>
                    <div class="field">
                        <div class="heading">
                            <label>{{ "Section"|t }}</label>
                            <div class="instructions">
                                <p>{{ "Choose the section you want to import to."|t }}</p>                
                            </div>
                        </div>
                    </div>
                </td>
                <td>
                    <div class="field">
                        <div class="input">
                            <div class="select">
                                <select name="importSection" id="sections">
                                {% for section in sections %}
                                    <option value="{{ section.id }}">{{ section.name }}</option>
                                {% endfor %}
                                </select>
                            </div>
                        </div>
                    </div>
                </td>
            </tr>
            <tr>
                <td>
                    <div class="field">
                        <div class="heading">
                            <label>{{ "Entrytype"|t }}</label>
                            <div class="instructions">
                                <p>{{ "Choose the entrytype you want to import to."|t }}</p>                
                            </div>
                        </div>
                    </div>
                </td>
{'fraction_non_alphanumeric': 0.1416803953871499, 'fraction_numerical': 0.00041186161449752884, 'mean_word_length': 1.0502321654706628, 'pattern_counts': {'":': 0, '<': 87, '<?xml version=': 0, '>': 87, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5539705', 'n_tokens_mistral': 1264, 'n_tokens_neox': 1137, 'n_words': 294}