1 {% extends 'page.html.twig' %}
4 <div class="ui icon yellow icon message with-transition">
5 <i class="exclamation triangle icon"></i>
7 {{ _T("Warning: Don't forget to backup your current database.") }}
10 <div class="ui basic fitted segment">
11 <div class="ui styled fluid accordion row">
12 <div class="active title">
13 <i class="jsonly displaynone icon dropdown"></i>
14 {{ _T('Existing files') }}
16 <div class="active content field">
17 <form class="ui form" action="{{ url_for('doImport') }}" method="post">
18 {% if existing|length > 0 %}
19 <p>{{ _T('The following files seems ready to import on the disk:') }}</p>
20 <table class="listing ui celled striped table">
23 <th>{{ _T('Name') }}</th>
24 <th>{{ _T('Date') }}</th>
25 <th>{{ _T('Size') }}</th>
26 <th class="actions_row">{{ _T('Actions') }}</th>
30 {% for import in existing %}
33 <input type="radio" name="import_file" id="file{{ loop.index }}" value="{{ import.name }}"{% if import_file is defined and import_file == import.name %} checked="checked"{% endif %}/>
34 <label for="file{{ loop.index }}">{{ import.name }}</label> (<a href="{{ url_for("getCsv", {"type": "import", "file": import.name}) }}">{{ _T('see') }}</a>)
36 <td data-title="{{ _T('Date') }}">
39 <td data-title="{{ _T('Size') }}">
42 <td class="actions_row">
44 href="{{ url_for("removeCsv", {"type": "import", "file": import.name}) }}"
47 <i class="ui trash red icon tooltip"></i>
48 <span class="ui special popup">{{ _T('Remove \'%file\' from disk')|replace({'%file': import.name}) }}</span>
55 <div class="ui basic center aligned segment">
56 <div class="ui tooltip toggle checkbox" title="{{ _T('Run the import process, but do *not* store anything in the database') }}">
57 <label for="dryrun">{{ _T('Dry run') }}</label>
58 <input type="checkbox" name="dryrun" id="dryrun" value="1"{% if dryrun is defined and dryrun == true %} checked="checked"{% endif %}/>
60 <button type="submit" name="import" id="import" class="ui labeled icon button">
61 <i class="ui file import blue icon"></i>
64 {% include "components/forms/csrf.html.twig" %}
67 <p>{{ _T('No import file actually exists.') }}<br/>{{ _T('Use upload form below to send a new file on server, or copy it directly in the imports directory.') }}</p>
73 <form class="ui form" action="{{ url_for('uploadImportFile') }}" method="post" enctype="multipart/form-data">
74 <div class="ui basic fitted segment">
75 <div class="ui styled fluid accordion row">
76 <div class="active title">
77 <i class="jsonly displaynone icon dropdown"></i>
78 {{ _T('Upload new file') }}
80 <div class="active content field">
81 <div class="field wide">
82 <div class="ui file action input">
83 <input type="file" name="new_file" accept="text/csv" id="new_file"/>
84 <label for="new_file" class="ui button">
85 <i class="blue file csv icon"></i>
86 {{ _T('Choose a file') }}
93 <div class="ui basic center aligned segment">
94 <div class="ui wrapping spaced buttons">
95 <button type="submit" name="upload" id="upload" class="ui primary labeled icon button">
96 <i class="upload icon" aria-hidd="true"></i>
97 {{ _T('Upload file') }}
100 href="{{ url_for('importModel') }}"
101 class="ui labeled icon button"
103 <i class="cogs icon" aria-hidden="true"></i>
104 {{ _T('Configure import model') }}
106 {% include "components/forms/csrf.html.twig" %}
112 {% block javascripts %}
113 <script type="text/javascript">
115 //bind import click to check if one is selected
116 $('#import').on('click', function(){
117 if ( $('input[name=import_file]:checked').length > 0 ) {
120 {% include "elements/js/modal.js.twig" with {
121 modal_title_twig: _T("No file selected")|e("js"),
122 modal_content_twig: _T("Please make sure to select one file to import.")|e("js"),
124 modal_deny_only: true,
125 modal_cancel_text: _T("Close")|e("js"),
126 modal_classname: "redalert",
132 $('#upload').click(function(){
133 var _selected = $('#new_file')[0].files.length;
134 if ( _selected == 0 ) {
135 {% include "elements/js/modal.js.twig" with {
136 modal_title_twig: _T("No file selected")|e("js"),
137 modal_content_twig: _T("Please make sure to select one file to upload.")|e("js"),
139 modal_deny_only: true,
140 modal_cancel_text: _T("Close")|e("js"),
141 modal_classname: "redalert",
149 {% include "elements/js/removal.js.twig" with {
150 single_action: "true"