export.twig 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424
  1. {{ page_settings_error_html|raw }}
  2. {{ page_settings_html|raw }}
  3. {% block message %}{% endblock %}
  4. <div class="exportoptions row" id="header">
  5. <h2>
  6. {{ get_image('b_export', 'Export'|trans) }}
  7. {% block title %}{% endblock %}
  8. </h2>
  9. </div>
  10. {% if templates.is_enabled %}
  11. <div class="exportoptions" id="export_templates">
  12. <h3>{% trans 'Export templates:' %}</h3>
  13. <div class="floatleft">
  14. <form method="post" action="{{ url('/export/template/create') }}" id="newTemplateForm" class="ajax">
  15. <h4>{% trans 'New template:' %}</h4>
  16. <input type="text" name="templateName" id="templateName" maxlength="64" placeholder="{% trans 'Template name' %}" required>
  17. <input class="btn btn-secondary" type="submit" name="createTemplate" id="createTemplate" value="{% trans 'Create' %}">
  18. </form>
  19. </div>
  20. <div class="floatleft" style="margin-left: 50px;">
  21. <form method="post" id="existingTemplatesForm" class="ajax">
  22. <h4>{% trans 'Existing templates:' %}</h4>
  23. <label for="template">{% trans 'Template:' %}</label>
  24. <select name="template" id="template" required>
  25. <option value="">-- {% trans 'Select a template' %} --</option>
  26. {% for template in templates.templates %}
  27. <option value="{{ template.getId() }}"{{ template.getId() == templates.selected ? ' selected' }}>
  28. {{ template.getName() }}
  29. </option>
  30. {% endfor %}
  31. </select>
  32. <input class="btn btn-secondary" type="submit" formaction="{{ url('/export/template/update') }}" name="updateTemplate" id="updateTemplate" value="{% trans 'Update' %}">
  33. <input class="btn btn-secondary" type="submit" formaction="{{ url('/export/template/delete') }}" name="deleteTemplate" id="deleteTemplate" value="{% trans 'Delete' %}">
  34. </form>
  35. </div>
  36. <div class="clearfloat"></div>
  37. </div>
  38. {% endif %}
  39. {% if sql_query is not empty %}
  40. <div class="exportoptions">
  41. {# l10n: Title of the option on the Export page #}
  42. <h3>{% trans 'SQL query:' %}</h3>
  43. <div class="floatleft">
  44. <div id="sqlqueryform">
  45. {# l10n: Button to show the SQL query on the export page #}
  46. <input class="btn btn-secondary" type="submit" id="showsqlquery" value="{% trans 'Show SQL query' %}">
  47. </div>
  48. <div class="d-none">
  49. <div id="export_sql_modal_content">
  50. <code class="sql">
  51. <pre id="sql_preview_query">{{ sql_query }}</pre>
  52. </code>
  53. </div>
  54. </div>
  55. </div>
  56. <div class="clearfloat"></div>
  57. </div>
  58. {% endif %}
  59. <form method="post" action="{{ url('/export') }}" name="dump" class="disableAjax">
  60. {{ get_hidden_inputs(hidden_inputs) }}
  61. {% if export_method != 'custom-no-form' %}
  62. <div class="exportoptions" id="quick_or_custom">
  63. <h3>{% trans 'Export method:' %}</h3>
  64. <ul>
  65. <li>
  66. <input type="radio" name="quick_or_custom" value="quick" id="radio_quick_export"
  67. {{- export_method == 'quick' ? ' checked' }}>
  68. <label for="radio_quick_export">
  69. {% trans 'Quick - display only the minimal options' %}
  70. </label>
  71. </li>
  72. <li>
  73. <input type="radio" name="quick_or_custom" value="custom" id="radio_custom_export"
  74. {{- export_method == 'custom' ? ' checked' }}>
  75. <label for="radio_custom_export">
  76. {% trans 'Custom - display all possible options' %}
  77. </label>
  78. </li>
  79. </ul>
  80. </div>
  81. {% endif %}
  82. <div class="exportoptions" id="format">
  83. <h3>{% trans 'Format:' %}</h3>
  84. {{ dropdown|raw }}
  85. </div>
  86. {% block selection_options %}{% endblock %}
  87. {% if rows is not empty %}
  88. <div class="exportoptions" id="rows">
  89. <h3>{% trans 'Rows:' %}</h3>
  90. <ul>
  91. <li>
  92. <input type="radio" name="allrows" value="0" id="radio_allrows_0"
  93. {{- rows.allrows is not null and rows.allrows == 0 ? ' checked' }}>
  94. <label for="radio_allrows_0">{% trans 'Dump some row(s)' %}</label>
  95. <ul>
  96. <li>
  97. <label for="limit_to">{% trans 'Number of rows:' %}</label>
  98. <input type="text" id="limit_to" name="limit_to" size="5" value="
  99. {%- if rows.limit_to is not null -%}
  100. {{- rows.limit_to -}}
  101. {%- elseif rows.unlim_num_rows is not empty and rows.unlim_num_rows != 0 -%}
  102. {{- rows.unlim_num_rows -}}
  103. {%- else %}
  104. {{- rows.number_of_rows -}}
  105. {%- endif -%}" onfocus="this.select()">
  106. </li>
  107. <li>
  108. <label for="limit_from">{% trans 'Row to begin at:' %}</label>
  109. <input type="text" id="limit_from" name="limit_from" size="5" value="
  110. {{- rows.limit_from is not null ? rows.limit_from : 0 }}" onfocus="this.select()">
  111. </li>
  112. </ul>
  113. </li>
  114. <li>
  115. <input type="radio" name="allrows" value="1" id="radio_allrows_1"
  116. {{- rows.allrows is null or rows.allrows == 1 ? ' checked' }}>
  117. <label for="radio_allrows_1">{% trans 'Dump all rows' %}</label>
  118. </li>
  119. </ul>
  120. </div>
  121. {% endif %}
  122. {% if has_save_dir %}
  123. <div class="exportoptions" id="output_quick_export">
  124. <h3>{% trans 'Output:' %}</h3>
  125. <ul>
  126. <li>
  127. <input type="checkbox" name="quick_export_onserver" value="saveit" id="checkbox_quick_dump_onserver"{{ export_is_checked ? ' checked' }}>
  128. <label for="checkbox_quick_dump_onserver">
  129. {{ 'Save on server in the directory <strong>%s</strong>'|trans|format(save_dir|e)|raw }}
  130. </label>
  131. </li>
  132. <li>
  133. <input type="checkbox" name="quick_export_onserver_overwrite" value="saveitover" id="checkbox_quick_dump_onserver_overwrite"
  134. {{- export_overwrite_is_checked ? ' checked' }}>
  135. <label for="checkbox_quick_dump_onserver_overwrite">
  136. {% trans 'Overwrite existing file(s)' %}
  137. </label>
  138. </li>
  139. </ul>
  140. </div>
  141. {% endif %}
  142. <div id="alias_modal" class="hide" title="{% trans 'Rename exported databases/tables/columns' %}">
  143. <table class="pma-table" id="alias_data">
  144. <thead>
  145. <tr>
  146. <th colspan="4">
  147. {% trans 'Defined aliases' %}
  148. </th>
  149. </tr>
  150. </thead>
  151. <tbody>
  152. {% for db, db_data in aliases %}
  153. {% if db_data.alias is defined and db_data.alias is not null %}
  154. <tr>
  155. <th>{% trans %}Database{% context %}Alias{% endtrans %}</th>
  156. <td>{{ db }}</td>
  157. <td>
  158. <input name="aliases[{{ db }}][alias]" value="{{ db_data.alias }}" type="text">
  159. </td>
  160. <td>
  161. <button class="alias_remove btn btn-secondary">{% trans 'Remove' %}</button>
  162. </td>
  163. </tr>
  164. {% endif %}
  165. {% for table, table_data in db_data.tables ?? [] %}
  166. {% if table_data.alias is defined and table_data.alias is not null %}
  167. <tr>
  168. <th>{% trans %}Table{% context %}Alias{% endtrans %}</th>
  169. <td>{{ db }}.{{ table }}</td>
  170. <td>
  171. <input name="aliases[{{ db }}][tables][{{ table }}][alias]" value="{{ table_data.alias }}" type="text">
  172. </td>
  173. <td>
  174. <button class="alias_remove btn btn-secondary">{% trans 'Remove' %}</button>
  175. </td>
  176. </tr>
  177. {% endif %}
  178. {% for column, column_name in table_data.columns ?? [] %}
  179. <tr>
  180. <th>{% trans %}Column{% context %}Alias{% endtrans %}</th>
  181. <td>{{ db }}.{{ table }}.{{ column }}</td>
  182. <td>
  183. <input name="aliases[{{ db }}][tables][{{ table }}][colums][{{ column }}]" value="{{ column_name }}" type="text">
  184. </td>
  185. <td>
  186. <button class="alias_remove btn btn-secondary">{% trans 'Remove' %}</button>
  187. </td>
  188. </tr>
  189. {% endfor %}
  190. {% endfor %}
  191. {% endfor %}
  192. </tbody>
  193. {# Empty row for javascript manipulations. #}
  194. <tfoot class="hide">
  195. <tr>
  196. <th></th>
  197. <td></td>
  198. <td>
  199. <input name="aliases_new" value="" type="text">
  200. </td>
  201. <td>
  202. <button class="alias_remove btn btn-secondary">{% trans 'Remove' %}</button>
  203. </td>
  204. </tr>
  205. </tfoot>
  206. </table>
  207. <table class="pma-table">
  208. <thead>
  209. <tr>
  210. <th colspan="4">{% trans 'Define new aliases' %}</th>
  211. </tr>
  212. </thead>
  213. <tr>
  214. <td>
  215. <label>{% trans 'Select database:' %}</label>
  216. </td>
  217. <td>
  218. <select id="db_alias_select"><option value=""></option></select>
  219. </td>
  220. <td>
  221. <input id="db_alias_name" placeholder="{% trans 'New database name' %}" disabled="1">
  222. </td>
  223. <td>
  224. <button id="db_alias_button" class="btn btn-secondary" disabled="1">{% trans 'Add' %}</button>
  225. </td>
  226. </tr>
  227. <tr>
  228. <td>
  229. <label>{% trans 'Select table:' %}</label>
  230. </td>
  231. <td>
  232. <select id="table_alias_select"><option value=""></option></select>
  233. </td>
  234. <td>
  235. <input id="table_alias_name" placeholder="{% trans 'New table name' %}" disabled="1">
  236. </td>
  237. <td>
  238. <button id="table_alias_button" class="btn btn-secondary" disabled="1">{% trans 'Add' %}</button>
  239. </td>
  240. </tr>
  241. <tr>
  242. <td>
  243. <label>{% trans 'Select column:' %}</label>
  244. </td>
  245. <td>
  246. <select id="column_alias_select"><option value=""></option></select>
  247. </td>
  248. <td>
  249. <input id="column_alias_name" placeholder="{% trans 'New column name' %}" disabled="1">
  250. </td>
  251. <td>
  252. <button id="column_alias_button" class="btn btn-secondary" disabled="1">{% trans 'Add' %}</button>
  253. </td>
  254. </tr>
  255. </table>
  256. </div>
  257. <div class="exportoptions" id="output">
  258. <h3>{% trans 'Output:' %}</h3>
  259. <ul id="ul_output">
  260. <li>
  261. <input type="checkbox" id="btn_alias_config"{{ has_aliases ? ' checked' }}>
  262. <label for="btn_alias_config">
  263. {% trans 'Rename exported databases/tables/columns' %}
  264. </label>
  265. </li>
  266. {% if export_type != 'server' %}
  267. <li>
  268. <input type="checkbox" name="lock_tables" value="something" id="checkbox_lock_tables"
  269. {{- (not repopulate and is_checked_lock_tables) or lock_tables ? ' checked' }}>
  270. <label for="checkbox_lock_tables">
  271. {{ 'Use %s statement'|trans|format('<code>LOCK TABLES</code>')|raw }}
  272. </label>
  273. </li>
  274. {% endif %}
  275. <li>
  276. <input type="radio" name="output_format" value="sendit" id="radio_dump_asfile"
  277. {{- not repopulate and is_checked_asfile ? ' checked' }}>
  278. <label for="radio_dump_asfile">
  279. {% trans 'Save output to a file' %}
  280. </label>
  281. <ul id="ul_save_asfile">
  282. {% if has_save_dir %}
  283. <li>
  284. <input type="checkbox" name="onserver" value="saveit" id="checkbox_dump_onserver"{{ is_checked_export ? ' checked' }}>
  285. <label for="checkbox_dump_onserver">
  286. {{ 'Save on server in the directory <strong>%s</strong>'|trans|format(save_dir|e)|raw }}
  287. </label>
  288. </li>
  289. <li>
  290. <input type="checkbox" name="onserver_overwrite" value="saveitover" id="checkbox_dump_onserver_overwrite"
  291. {{- is_checked_export_overwrite ? ' checked' }}>
  292. <label for="checkbox_dump_onserver_overwrite">
  293. {% trans 'Overwrite existing file(s)' %}
  294. </label>
  295. </li>
  296. {% endif %}
  297. <li>
  298. <label for="filename_template" class="desc">
  299. {% trans 'File name template:' %}
  300. {{ show_hint('This value is interpreted using the \'strftime\' function, so you can use time formatting strings. Additionally the following transformations will happen: %s Other text will be kept as is. See the FAQ 6.27 for details.'|trans|format(filename_hint)) }}
  301. </label>
  302. <input type="text" name="filename_template" id="filename_template" value="{{ filename_template }}">
  303. <input type="checkbox" name="remember_template" id="checkbox_remember_template"{{ is_checked_remember_file_template ? ' checked' }}>
  304. <label for="checkbox_remember_template">
  305. {% trans 'use this for future exports' %}
  306. </label>
  307. </li>
  308. {% if is_encoding_supported %}
  309. <li>
  310. <label for="select_charset" class="desc">
  311. {% trans 'Character set of the file:' %}
  312. </label>
  313. <select id="select_charset" name="charset" size="1">
  314. {% for charset in encodings %}
  315. <option value="{{ charset }}"
  316. {{- (export_charset is empty and charset == 'utf-8') or charset == export_charset ? ' selected' }}>
  317. {{- charset -}}
  318. </option>
  319. {% endfor %}
  320. </select>
  321. </li>
  322. {% endif %}
  323. {% if has_zip or has_gzip %}
  324. <li>
  325. <label for="compression" class="desc">
  326. {% trans 'Compression:' %}
  327. </label>
  328. <select id="compression" name="compression">
  329. <option value="none">{% trans 'None' %}</option>
  330. {% if has_zip %}
  331. <option value="zip"
  332. {{- selected_compression == 'zip' ? ' selected' }}>
  333. {% trans 'zipped' %}
  334. </option>
  335. {% endif %}
  336. {% if has_gzip %}
  337. <option value="gzip"
  338. {{- selected_compression == 'gzip' ? ' selected' }}>
  339. {% trans 'gzipped' %}
  340. </option>
  341. {% endif %}
  342. </select>
  343. </li>
  344. {% else %}
  345. <input type="hidden" name="compression" value="{{ selected_compression }}">
  346. {% endif %}
  347. {% if export_type == 'server' or export_type == 'database' %}
  348. <li>
  349. <input type="checkbox" id="checkbox_as_separate_files" name="as_separate_files" value="{{ export_type }}"
  350. {{- is_checked_as_separate_files ? ' checked' }}>
  351. <label for="checkbox_as_separate_files">
  352. {% if export_type == 'server' %}
  353. {% trans 'Export databases as separate files' %}
  354. {% elseif export_type == 'database' %}
  355. {% trans 'Export tables as separate files' %}
  356. {% endif %}
  357. </label>
  358. </li>
  359. {% endif %}
  360. </ul>
  361. </li>
  362. <li>
  363. <input type="radio" id="radio_view_as_text" name="output_format" value="astext"
  364. {{- repopulate or export_asfile == false ? ' checked' }}>
  365. <label for="radio_view_as_text">
  366. {% trans 'View output as text' %}
  367. </label>
  368. </li>
  369. </ul>
  370. <label for="maxsize">
  371. {{- 'Skip tables larger than %s MiB'|trans|format(
  372. '</label><input type="text" id="maxsize" name="maxsize" size="4">'
  373. )|raw }}
  374. </div>
  375. <div class="exportoptions" id="format_specific_opts">
  376. <h3>{% trans 'Format-specific options:' %}</h3>
  377. <p class="no_js_msg" id="scroll_to_options_msg">
  378. {% trans 'Scroll down to fill in the options for the selected format and ignore the options for other formats.' %}
  379. </p>
  380. {{ options|raw }}
  381. </div>
  382. {% if can_convert_kanji %}
  383. {# Japanese encoding setting #}
  384. <div class="exportoptions" id="kanji_encoding">
  385. <h3>{% trans 'Encoding Conversion:' %}</h3>
  386. {% include 'encoding/kanji_encoding_form.twig' %}
  387. </div>
  388. {% endif %}
  389. <div class="exportoptions justify-content-end" id="submit">
  390. <input id="buttonGo" class="btn btn-primary" type="submit" value="{% trans 'Go' %}" data-exec-time-limit="{{ exec_time_limit }}">
  391. </div>
  392. </form>