import.twig 10 KB

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