Prepare for version 5.1.3
[phpmyadmin.git] / templates / import.twig
blob05fb7109cfe847594c754f77b1ae420ff97536ea
1 {{ page_settings_error_html|raw }}
2 {{ page_settings_html|raw }}
4 <iframe id="import_upload_iframe" name="import_upload_iframe" width="1" height="1" class="hide"></iframe>
5 <div id="import_form_status" class="hide"></div>
6 <div id="importmain" class="container-fluid">
7     <img src="{{ theme_image_path }}ajax_clock_small.gif" width="16" height="16" alt="ajax clock" class="hide">
9     <script type="text/javascript">
10         //<![CDATA[
11         {% include 'import/javascript.twig' with {
12             'upload_id': upload_id,
13             'handler': handler,
14             'theme_image_path': theme_image_path
15         } only %}
16         //]]>
17     </script>
19     <form id="import_file_form"
20         action="{{ url('/import') }}"
21         method="post"
22         enctype="multipart/form-data"
23         name="import"
24         class="ajax"
25         {%- if handler != 'PhpMyAdmin\\Plugins\\Import\\Upload\\UploadNoplugin' %}
26             target="import_upload_iframe"
27         {%- endif %}>
29         {{ get_hidden_inputs(hidden_inputs) }}
31         <div class="exportoptions" id="header">
32             <h2>
33                 {{ get_image('b_import', 'Import'|trans) }}
34                 {% block title %}{% endblock %}
35             </h2>
36         </div>
38         <div class="importoptions">
39             <h3>{% trans 'File to import:' %}</h3>
41             {# We don't have show anything about compression, when no supported #}
42             {% if compressions is not empty %}
43                 <div class="formelementrow" id="compression_info">
44                     <p>
45                         {{ 'File may be compressed (%s) or uncompressed.'|trans|format(compressions|join(', ')) }}
46                         <br>
47                         {% trans 'A compressed file\'s name must end in <strong>.[format].[compression]</strong>. Example: <strong>.sql.zip</strong>' %}
48                     </p>
49                 </div>
50             {% endif %}
52             <div class="formelementrow" id="upload_form">
53                 {% if is_upload and upload_dir is not empty %}
54                     <ul>
55                         <li>
56                             <input type="radio" name="file_location" id="radio_import_file" required="required">
57                             <label for="radio_import_file">{% trans 'Browse your computer:' %}</label>
59                             <div id="upload_form_status" class="hide"></div>
60                             <div id="upload_form_status_info" class="hide"></div>
62                             <input type="file" name="import_file" id="input_import_file" aria-label="{% trans 'Browse your computer' %}">
64                             {{ get_formatted_maximum_upload_size(max_upload_size) }}
66                             <input type="hidden" name="MAX_FILE_SIZE" value="{{ max_upload_size }}">
68                             <p>{% trans 'You may also drag and drop a file on any page.' %}</p>
69                         </li>
70                         <li>
71                           <input type="radio" name="file_location" id="radio_local_import_file"
72                             {{- timeout_passed_global is not empty and local_import_file is not empty ? ' checked' }}>
73                           <label for="radio_local_import_file">
74                             {{ 'Select from the web server upload directory [strong]%s[/strong]:'|trans|format(user_upload_dir)|sanitize }}
75                           </label>
77                           {% if local_files is same as(false) %}
78                             {{ 'The directory you set for upload work cannot be reached.'|trans|error }}
79                           {% elseif local_files is not empty %}
80                             <select size="1" name="local_import_file" id="select_local_import_file" aria-label="{% trans 'Select file to import' %}">
81                               <option value=""></option>
82                               {{ local_files|raw }}
83                             </select>
84                           {% else %}
85                             <em>{% trans 'There are no files to upload!' %}</em>
86                           {% endif %}
87                         </li>
88                     </ul>
89                 {% elseif is_upload %}
90                     <label for="input_import_file">{% trans 'Browse your computer:' %}</label>
92                     <div id="upload_form_status" class="hide"></div>
93                     <div id="upload_form_status_info" class="hide"></div>
95                     <input type="file" name="import_file" id="input_import_file">
97                     {{ get_formatted_maximum_upload_size(max_upload_size) }}
99                     <input type="hidden" name="MAX_FILE_SIZE" value="{{ max_upload_size }}">
101                     <p>{% trans 'You may also drag and drop a file on any page.' %}</p>
102                 {% elseif upload_dir is not empty %}
103                   <label for="select_local_import_file">
104                     {{ 'Select from the web server upload directory [strong]%s[/strong]:'|trans|format(user_upload_dir)|sanitize }}
105                   </label>
107                   {% if local_files is same as(false) %}
108                     {{ 'The directory you set for upload work cannot be reached.'|trans|error }}
109                   {% elseif local_files is not empty %}
110                     <select size="1" name="local_import_file" id="select_local_import_file">
111                       <option value=""></option>
112                       {{ local_files|raw }}
113                     </select>
114                   {% else %}
115                     <em>{% trans 'There are no files to upload!' %}</em>
116                   {% endif %}
117                 {% else %}
118                     {{ 'File uploads are not allowed on this server.'|trans|notice }}
119                 {% endif %}
120             </div>
122             <div class="formelementrow" id="charaset_of_file">
123                 {# Charset of file #}
124                 <label for="charset_of_file">{% trans 'Character set of the file:' %}</label>
125                 {% if is_encoding_supported %}
126                     <select id="charset_of_file" name="charset_of_file" size="1">
127                         {% for charset in encodings %}
128                             <option value="{{ charset }}"
129                                 {% if (import_charset is empty and charset == 'utf-8')
130                                     or charset == import_charset %}
131                                     selected="selected"
132                                 {% endif %}>
133                                 {{ charset }}
134                             </option>
135                         {% endfor %}
136                     </select>
137                 {% else %}
138                   <select lang="en" dir="ltr" name="charset_of_file" id="charset_of_file">
139                     <option value=""></option>
140                     {% for charset in charsets %}
141                       <option value="{{ charset.name }}" title="{{ charset.description }}"
142                         {{- charset.name == 'utf8' ? ' selected' }}>
143                         {{- charset.name -}}
144                       </option>
145                     {% endfor %}
146                   </select>
147                 {% endif %}
148             </div>
149         </div>
151         <div class="importoptions">
152             <h3>{% trans 'Partial import:' %}</h3>
154             {% if timeout_passed is defined and timeout_passed %}
155                 <div class="formelementrow">
156                     <input type="hidden" name="skip" value="{{ offset }}">
157                     {{ 'Previous import timed out, after resubmitting will continue from position %d.'|trans|format(offset) }}
158                 </div>
159             {% endif %}
161             <div class="formelementrow">
162                 <input type="checkbox" name="allow_interrupt" value="yes" id="checkbox_allow_interrupt"
163                     {{ checkbox_check('Import', 'allow_interrupt') }}>
164                 <label for="checkbox_allow_interrupt">
165                     {% trans 'Allow the interruption of an import in case the script detects it is close to the PHP timeout limit. <em>(This might be a good way to import large files, however it can break transactions.)</em>' %}
166                 </label>
167             </div>
169             {% if not (timeout_passed is defined and timeout_passed) %}
170                 <div class="formelementrow">
171                     <label for="text_skip_queries">
172                         {% trans 'Skip this number of queries (for SQL) starting from the first one:' %}
173                     </label>
174                     <input type="number" name="skip_queries" value="
175                         {{- get_default_plugin('Import', 'skip_queries') -}}
176                         " id="text_skip_queries" min="0">
177                 </div>
178             {% else %}
179                 {# If timeout has passed,
180                    do not show the Skip dialog to avoid the risk of someone
181                    entering a value here that would interfere with "skip" #}
182                 <input type="hidden" name="skip_queries" value="
183                     {{- get_default_plugin('Import', 'skip_queries') -}}
184                     " id="text_skip_queries">
185             {% endif %}
186         </div>
188         <div class="importoptions">
189             <h3>{% trans 'Other options:' %}</h3>
190             <div class="formelementrow">
191                 <input type="hidden" name="fk_checks" value="0">
192                 <input type="checkbox" name="fk_checks" id="fk_checks" value="1"{{ is_foreign_key_check ? ' checked' }}>
193                 <label for="fk_checks">{% trans 'Enable foreign key checks' %}</label>
194             </div>
195         </div>
197         <div class="importoptions">
198             <h3>{% trans 'Format:' %}</h3>
199             {{ get_choice('Import', 'format', import_list) }}
200             <div id="import_notification"></div>
201         </div>
203         <div class="importoptions" id="format_specific_opts">
204             <h3>{% trans 'Format-specific options:' %}</h3>
205             <p class="no_js_msg" id="scroll_to_options_msg">
206                 {% trans 'Scroll down to fill in the options for the selected format and ignore the options for other formats.' %}
207             </p>
208             {{ get_options('Import', import_list) }}
209         </div>
210         <div class="clearfloat"></div>
212         {# Japanese encoding setting #}
213         {% if can_convert_kanji %}
214             <div class="importoptions" id="kanji_encoding">
215                 <h3>{% trans 'Encoding Conversion:' %}</h3>
216                 {% include 'encoding/kanji_encoding_form.twig' %}
217             </div>
218         {% endif %}
220         <div class="importoptions justify-content-end" id="submit">
221             <input id="buttonGo" class="btn btn-primary" type="submit" value="{% trans 'Go' %}">
222         </div>
223     </form>
224 </div>