import.twig 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  1. <iframe id="import_upload_iframe" name="import_upload_iframe" width="1" height="1" class="hide"></iframe>
  2. <div id="import_form_status" class="hide"></div>
  3. <div id="importmain">
  4. <img src="{{ pma_theme_image }}ajax_clock_small.gif" width="16" height="16" alt="ajax clock" class="hide" />
  5. <script type="text/javascript">
  6. //<![CDATA[
  7. {% include 'display/import/javascript.twig' with {
  8. 'upload_id': upload_id,
  9. 'handler': handler,
  10. 'pma_theme_image': pma_theme_image
  11. } only %}
  12. //]]>
  13. </script>
  14. <form id="import_file_form"
  15. action="import.php"
  16. method="post"
  17. enctype="multipart/form-data"
  18. name="import"
  19. class="ajax"
  20. {%- if handler != 'PhpMyAdmin\\Plugins\\Import\\Upload\\UploadNoplugin' %}
  21. target="import_upload_iframe"
  22. {%- endif %}>
  23. <input type="hidden" name="{{ id_key }}" value="{{ upload_id }}" />
  24. {% if import_type == 'server' %}
  25. {{ Url_getHiddenInputs('', '', 1) }}
  26. {% elseif import_type == 'database' %}
  27. {{ Url_getHiddenInputs(db, '', 1) }}
  28. {% else %}
  29. {{ Url_getHiddenInputs(db, table, 1) }}
  30. {% endif %}
  31. <input type="hidden" name="import_type" value="{{ import_type }}" />
  32. <div class="exportoptions" id="header">
  33. <h2>
  34. {{ Util_getImage('b_import', 'Import'|trans) }}
  35. {% if import_type == 'server' %}
  36. {% trans 'Importing into the current server' %}
  37. {% elseif import_type == 'database' %}
  38. {{ 'Importing into the database "%s"'|trans|format(db) }}
  39. {% else %}
  40. {{ 'Importing into the table "%s"'|trans|format(table) }}
  41. {% endif %}
  42. </h2>
  43. </div>
  44. <div class="importoptions">
  45. <h3>{% trans 'File to import:' %}</h3>
  46. {# We don't have show anything about compression, when no supported #}
  47. {% if compressions is not empty %}
  48. <div class="formelementrow" id="compression_info">
  49. <p>
  50. {{ 'File may be compressed (%s) or uncompressed.'|trans|format(compressions|join(', ')) }}
  51. <br>
  52. {% trans 'A compressed file\'s name must end in <strong>.[format].[compression]</strong>. Example: <strong>.sql.zip</strong>' %}
  53. </p>
  54. </div>
  55. {% endif %}
  56. <div class="formelementrow" id="upload_form">
  57. {% if is_upload and upload_dir is not empty %}
  58. <ul>
  59. <li>
  60. <input type="radio" name="file_location" id="radio_import_file" required="required" />
  61. {{ Util_getBrowseUploadFileBlock(max_upload_size) }}
  62. {% trans 'You may also drag and drop a file on any page.' %}
  63. </li>
  64. <li>
  65. <input type="radio" name="file_location" id="radio_local_import_file"
  66. {%- if timeout_passed_global is not empty and local_import_file is not empty %}
  67. checked="checked"
  68. {%- endif %} />
  69. {{ Util_getSelectUploadFileBlock(
  70. import_list,
  71. upload_dir
  72. ) }}
  73. </li>
  74. </ul>
  75. {% elseif is_upload %}
  76. {{ Util_getBrowseUploadFileBlock(max_upload_size) }}
  77. <p>{% trans 'You may also drag and drop a file on any page.' %}</p>
  78. {% elseif not is_upload %}
  79. {{ Message_notice('File uploads are not allowed on this server.'|trans) }}
  80. {% elseif upload_dir is not empty %}
  81. {{ Util_getSelectUploadFileBlock(
  82. import_list,
  83. upload_dir
  84. ) }}
  85. {% endif %}
  86. </div>
  87. <div class="formelementrow" id="charaset_of_file">
  88. {# Charset of file #}
  89. <label for="charset_of_file">{% trans 'Character set of the file:' %}</label>
  90. {% if is_encoding_supported %}
  91. <select id="charset_of_file" name="charset_of_file" size="1">
  92. {% for charset in encodings %}
  93. <option value="{{ charset }}"
  94. {% if (import_charset is empty and charset == 'utf-8')
  95. or charset == import_charset %}
  96. selected="selected"
  97. {% endif %}>
  98. {{ charset }}
  99. </option>
  100. {% endfor %}
  101. </select>
  102. {% else %}
  103. {{ Charsets_getCharsetDropdownBox(
  104. dbi,
  105. disable_is,
  106. 'charset_of_file',
  107. 'charset_of_file',
  108. 'utf8',
  109. false
  110. ) }}
  111. {% endif %}
  112. </div>
  113. </div>
  114. <div class="importoptions">
  115. <h3>{% trans 'Partial import:' %}</h3>
  116. {% if timeout_passed is defined and timeout_passed %}
  117. <div class="formelementrow">
  118. <input type="hidden" name="skip" value="{{ offset }}" />
  119. {{ 'Previous import timed out, after resubmitting will continue from position %d.'|trans|format(offset) }}
  120. </div>
  121. {% endif %}
  122. <div class="formelementrow">
  123. <input type="checkbox" name="allow_interrupt" value="yes" id="checkbox_allow_interrupt"
  124. {{ Plugins_checkboxCheck('Import', 'allow_interrupt') }} />
  125. <label for="checkbox_allow_interrupt">
  126. {% 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>' %}
  127. </label>
  128. </div>
  129. {% if not (timeout_passed is defined and timeout_passed) %}
  130. <div class="formelementrow">
  131. <label for="text_skip_queries">
  132. {% trans 'Skip this number of queries (for SQL) starting from the first one:' %}
  133. </label>
  134. <input type="number" name="skip_queries" value="
  135. {{- Plugins_getDefault('Import', 'skip_queries') -}}
  136. " id="text_skip_queries" min="0" />
  137. </div>
  138. {% else %}
  139. {# If timeout has passed,
  140. do not show the Skip dialog to avoid the risk of someone
  141. entering a value here that would interfere with "skip" #}
  142. <input type="hidden" name="skip_queries" value="
  143. {{- Plugins_getDefault('Import', 'skip_queries') -}}
  144. " id="text_skip_queries" />
  145. {% endif %}
  146. </div>
  147. <div class="importoptions">
  148. <h3>{% trans 'Other options:' %}</h3>
  149. <div class="formelementrow">
  150. {{ Util_getFKCheckbox() }}
  151. </div>
  152. </div>
  153. <div class="importoptions">
  154. <h3>{% trans 'Format:' %}</h3>
  155. {{ Plugins_getChoice('Import', 'format', import_list) }}
  156. <div id="import_notification"></div>
  157. </div>
  158. <div class="importoptions" id="format_specific_opts">
  159. <h3>{% trans 'Format-specific options:' %}</h3>
  160. <p class="no_js_msg" id="scroll_to_options_msg">
  161. {% trans 'Scroll down to fill in the options for the selected format and ignore the options for other formats.' %}
  162. </p>
  163. {{ Plugins_getOptions('Import', import_list) }}
  164. </div>
  165. <div class="clearfloat"></div>
  166. {# Japanese encoding setting #}
  167. {% if can_convert_kanji %}
  168. <div class="importoptions" id="kanji_encoding">
  169. <h3>{% trans 'Encoding Conversion:' %}</h3>
  170. {% include 'encoding/kanji_encoding_form.twig' %}
  171. </div>
  172. {% endif %}
  173. <div class="importoptions" id="submit">
  174. <input type="submit" value="{% trans 'Go' %}" id="buttonGo" />
  175. </div>
  176. </form>
  177. </div>