main.twig 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418
  1. {# getHtmlForAddNewColumn #}
  2. <div id="add_col_div" class="topmargin">
  3. <a href="#">
  4. <span>{{ (total_rows > 0) ? '+' : '-' }}</span>{% trans 'Add new column' %}
  5. </a>
  6. <form id="add_new" class="new_central_col{{ (total_rows != 0) ? ' hide' : ''}}"
  7. method="post" action="db_central_columns.php">
  8. {{ get_hidden_inputs(db) }}
  9. <input type="hidden" name="add_new_column" value="add_new_column">
  10. <div class="responsivetable">
  11. <table>
  12. <thead>
  13. <tr>
  14. <th class=""></th>
  15. <th class="hide"></th>
  16. <th class="" title="" data-column="name">
  17. {% trans 'Name' %}
  18. <div class="sorticon"></div>
  19. </th>
  20. <th class="" title="" data-column="type">
  21. {% trans 'Type' %}
  22. <div class="sorticon"></div>
  23. </th>
  24. <th class="" title="" data-column="length">
  25. {% trans 'Length/Value' %}
  26. <div class="sorticon"></div>
  27. </th>
  28. <th class="" title="" data-column="default">
  29. {% trans 'Default' %}
  30. <div class="sorticon"></div>
  31. </th>
  32. <th class="" title="" data-column="collation">
  33. {% trans 'Collation' %}
  34. <div class="sorticon"></div>
  35. </th>
  36. <th class="" title="" data-column="attribute">
  37. {% trans 'Attribute' %}
  38. <div class="sorticon"></div>
  39. </th>
  40. <th class="" title="" data-column="isnull">
  41. {% trans 'Null' %}
  42. <div class="sorticon"></div>
  43. </th>
  44. <th class="" title="" data-column="extra">
  45. {% trans 'A_I' %}
  46. <div class="sorticon"></div>
  47. </th>
  48. </tr>
  49. </thead>
  50. <tbody>
  51. <tr>
  52. <td></td>
  53. <td name="col_name" class="nowrap">
  54. {% include 'columns_definitions/column_name.twig' with {
  55. 'column_number': 0,
  56. 'ci': 0,
  57. 'ci_offset': 0,
  58. 'column_meta': {},
  59. 'cfg_relation': {
  60. 'centralcolumnswork': false
  61. },
  62. 'max_rows': max_rows,
  63. } only %}
  64. </td>
  65. <td name="col_type" class="nowrap">
  66. {% include 'columns_definitions/column_type.twig' with {
  67. 'column_number': 0,
  68. 'ci': 1,
  69. 'ci_offset': 0,
  70. 'type_upper': '',
  71. 'column_meta': {}
  72. } only %}
  73. </td>
  74. <td class="nowrap" name="col_length">
  75. {% include 'columns_definitions/column_length.twig' with {
  76. 'column_number': 0,
  77. 'ci': 2,
  78. 'ci_offset': 0,
  79. 'length_values_input_size': 8,
  80. 'length_to_display': ''
  81. } only %}
  82. </td>
  83. <td class="nowrap" name="col_default">
  84. {% include 'columns_definitions/column_default.twig' with {
  85. 'column_number': 0,
  86. 'ci': 3,
  87. 'ci_offset': 0,
  88. 'type_upper': '',
  89. 'column_meta': {},
  90. 'char_editing': char_editing,
  91. } only %}
  92. </td>
  93. <td name="collation" class="nowrap">
  94. <select lang="en" dir="ltr" name="field_collation[0]" id="field_0_4">
  95. <option value=""></option>
  96. {% for charset in charsets %}
  97. <optgroup label="{{ charset.name }}" title="{{ charset.description }}">
  98. {% for collation in charset.collations %}
  99. <option value="{{ collation.name }}" title="{{ collation.description }}">
  100. {{- collation.name -}}
  101. </option>
  102. {% endfor %}
  103. </optgroup>
  104. {% endfor %}
  105. </select>
  106. </td>
  107. <td class="nowrap" name="col_attribute">
  108. {% include 'columns_definitions/column_attribute.twig' with {
  109. 'column_number': 0,
  110. 'ci': 5,
  111. 'ci_offset': 0,
  112. 'extracted_columnspec': {},
  113. 'column_meta': {},
  114. 'submit_attribute': false,
  115. 'attribute_types': attribute_types,
  116. } only %}
  117. </td>
  118. <td class="nowrap" name="col_isNull">
  119. {% include 'columns_definitions/column_null.twig' with {
  120. 'column_number': 0,
  121. 'ci': 6,
  122. 'ci_offset': 0,
  123. 'column_meta': {}
  124. } only %}
  125. </td>
  126. <td class="nowrap" name="col_extra">
  127. {% include 'columns_definitions/column_extra.twig' with {
  128. 'column_number': 0,
  129. 'ci': 7,
  130. 'ci_offset': 0,
  131. 'column_meta': {}
  132. } only %}
  133. </td>
  134. <td>
  135. <input id="add_column_save" class="btn btn-primary" type="submit" value="Save">
  136. </td>
  137. </tr>
  138. </tbody>
  139. </table>
  140. </div>
  141. </form>
  142. </div>
  143. {% if total_rows <= 0 %}
  144. <fieldset>
  145. {% trans 'The central list of columns for the current database is empty' %}
  146. </fieldset>
  147. {% else %}
  148. <table style="display:inline-block;max-width:49%" class="navigation nospacing nopadding">
  149. <tr>
  150. <td class="navigation_separator"></td>
  151. {% if pos - max_rows >= 0 %}
  152. <td>
  153. <form action="db_central_columns.php" method="post">
  154. {{ get_hidden_inputs(db) }}
  155. <input type="hidden" name="pos" value="{{ pos - max_rows }}">
  156. <input type="hidden" name="total_rows" value="{{ total_rows }}">
  157. <input class="btn btn-secondary ajax" type="submit" name="navig" value="&lt">
  158. </form>
  159. </td>
  160. {% endif %}
  161. {% if tn_nbTotalPage > 1 %}
  162. <td>
  163. <form action="db_central_columns.php" method="post">
  164. {{ get_hidden_inputs(db) }}
  165. <input type="hidden" name="total_rows" value="{{ total_rows }}">
  166. {{ tn_page_selector | raw }}
  167. </form>
  168. </td>
  169. {% endif %}
  170. {% if pos + max_rows < total_rows %}
  171. <td>
  172. <form action="db_central_columns.php" method="post">
  173. {{ get_hidden_inputs(db) }}
  174. <input type="hidden" name="pos" value="{{ pos + max_rows }}">
  175. <input type="hidden" name="total_rows" value="{{ total_rows }}">
  176. <input class="btn btn-secondary ajax" type="submit" name="navig" value="&gt">
  177. </form>
  178. </td>
  179. {% endif %}
  180. <td class="navigation_separator"></td>
  181. <td>
  182. <span>{% trans 'Filter rows' %}:</span>
  183. <input type="text" class="filter_rows" placeholder="{% trans 'Search this table' %}">
  184. </td>
  185. <td class="navigation_separator"></td>
  186. </tr>
  187. </table>
  188. {% endif %}
  189. {# getHtmlForAddColumn #}
  190. <table class="central_columns_add_column" class="navigation nospacing nopadding">
  191. <tr>
  192. <td class="navigation_separator largescreenonly"></td>
  193. <td class="central_columns_navigation">
  194. {{ get_icon('centralColumns_add', 'Add column' | trans)|raw }}
  195. <form id="add_column" action="db_central_columns.php" method="post">
  196. {{ get_hidden_inputs(db) | raw }}
  197. <input type="hidden" name="add_column" value="add">
  198. <input type="hidden" name="pos" value="{{ pos }}">
  199. <input type="hidden" name="total_rows" value="{{ total_rows }}">
  200. {# getHtmlForTableDropdown #}
  201. <select name="table-select" id="table-select">
  202. <option value="" disabled="disabled" selected="selected">
  203. {% trans 'Select a table' %}
  204. </option>
  205. {% for table in tables %}
  206. <option value="{{ table|e }}">{{ table|e }}</option>
  207. {% endfor %}
  208. </select>
  209. <select name="column-select" id="column-select">
  210. <option value="" selected="selected">{% trans 'Select a column.' %}</option>
  211. </select>
  212. <input class="btn btn-primary" type="submit" value="{% trans 'Add' %}">
  213. </form>
  214. </td>
  215. <td class="navigation_separator largescreenonly"></td>
  216. </tr>
  217. </table>
  218. {% if total_rows > 0 %}
  219. <form method="post" id="del_form" action="db_central_columns.php">
  220. {{ get_hidden_inputs(db) }}
  221. <input id="del_col_name" type="hidden" name="col_name" value="">
  222. <input type="hidden" name="pos" value="{{ pos }}">
  223. <input type="hidden" name="delete_save" value="delete">
  224. </form>
  225. <div id="tableslistcontainer">
  226. <form name="tableslistcontainer">
  227. <table id="table_columns" class="tablesorter" class="data">
  228. {% set class = 'column_heading' %}
  229. {% set title = 'Click to sort.' | trans %}
  230. <thead>
  231. <tr>
  232. <th class="{{ class }}"></th>
  233. <th class="hide"></th>
  234. <th class="column_action" colspan="2">{% trans 'Action' %}</th>
  235. <th class="{{ class }}" title="{{ title }}" data-column="name">
  236. {% trans 'Name' %}
  237. <div class="sorticon"></div>
  238. </th>
  239. <th class="{{ class }}" title="{{ title }}" data-column="type">
  240. {% trans 'Type' %}
  241. <div class="sorticon"></div>
  242. </th>
  243. <th class="{{ class }}" title="{{ title }}" data-column="length">
  244. {% trans 'Length/Value' %}
  245. <div class="sorticon"></div>
  246. </th>
  247. <th class="{{ class }}" title="{{ title }}" data-column="default">
  248. {% trans 'Default' %}
  249. <div class="sorticon"></div>
  250. </th>
  251. <th class="{{ class }}" title="{{ title }}" data-column="collation">
  252. {% trans 'Collation' %}
  253. <div class="sorticon"></div>
  254. </th>
  255. <th class="{{ class }}" title="{{ title }}" data-column="attribute">
  256. {% trans 'Attribute' %}
  257. <div class="sorticon"></div>
  258. </th>
  259. <th class="{{ class }}" title="{{ title }}" data-column="isnull">
  260. {% trans 'Null' %}
  261. <div class="sorticon"></div>
  262. </th>
  263. <th class="{{ class }}" title="{{ title }}" data-column="extra">
  264. {% trans 'A_I' %}
  265. <div class="sorticon"></div>
  266. </th>
  267. </tr>
  268. </thead>
  269. <tbody>
  270. {% set row_num = 0 %}
  271. {% for row in rows_list %}
  272. {# getHtmlForTableRow #}
  273. <tr data-rownum="{{ row_num }}" id="{{ 'f_' ~ row_num }}">
  274. {{ get_hidden_inputs(db) }}
  275. <input type="hidden" name="edit_save" value="save">
  276. <td class="nowrap">
  277. <input type="checkbox" class="checkall" name="selected_fld[]"
  278. value="{{ row['col_name'] }}" id="{{ 'checkbox_row_' ~ row_num }}">
  279. </td>
  280. <td id="{{ 'edit_' ~ row_num }}" class="edit center">
  281. <a href="#"> {{ get_icon('b_edit', 'Edit' | trans) | raw }}</a>
  282. </td>
  283. <td class="del_row" data-rownum = "{{ row_num }}">
  284. <a hrf="#">{{ get_icon('b_drop', 'Delete' | trans) }}</a>
  285. <input type="submit" data-rownum = "{{ row_num }}" class="btn btn-secondary edit_cancel_form" value="Cancel">
  286. </td>
  287. <td id="{{ 'save_' ~ row_num }}" class="hide">
  288. <input type="submit" data-rownum="{{ row_num }}" class="btn btn-primary edit_save_form" value="Save">
  289. </td>
  290. <td name="col_name" class="nowrap">
  291. <span>{{ row['col_name'] }}</span>
  292. <input name="orig_col_name" type="hidden" value="{{ row['col_name'] }}">
  293. {% include 'columns_definitions/column_name.twig' with {
  294. 'column_number': row_num,
  295. 'ci': 0,
  296. 'ci_offset': 0,
  297. 'column_meta': {
  298. 'Field': row['col_name']
  299. },
  300. 'cfg_relation': {
  301. 'centralcolumnswork': false
  302. },
  303. 'max_rows': max_rows
  304. } only %}
  305. </td>
  306. <td name = "col_type" class="nowrap">
  307. <span>{{ row['col_type'] }}</span>
  308. {% include 'columns_definitions/column_type.twig' with {
  309. 'column_number': row_num,
  310. 'ci': 1,
  311. 'ci_offset': 0,
  312. 'type_upper': types_upper[row_num],
  313. 'column_meta': {}
  314. } only %}
  315. </td>
  316. <td class="nowrap" name="col_length">
  317. <span>{{ (row['col_length']?(row['col_length']):'') }}</span>
  318. {% include 'columns_definitions/column_length.twig' with {
  319. 'column_number': row_num,
  320. 'ci': 2,
  321. 'ci_offset': 0,
  322. 'length_values_input_size': 8,
  323. 'length_to_display': row['col_length']
  324. } only %}
  325. </td>
  326. <td class="nowrap" name="col_default">
  327. {% if row['col_default'] is defined %}
  328. <span>{{ row['col_default'] }}</span>
  329. {% else %}
  330. <span>None</span>
  331. {% endif %}
  332. {% include 'columns_definitions/column_default.twig' with {
  333. 'column_number': row_num,
  334. 'ci': 3,
  335. 'ci_offset': 0,
  336. 'type_upper': types_upper[row_num],
  337. 'column_meta': rows_meta[row_num],
  338. 'char_editing': char_editing,
  339. } only %}
  340. </td>
  341. <td name="collation" class="nowrap">
  342. <span>{{ row['col_collation'] }}</span>
  343. <select lang="en" dir="ltr" name="field_collation[{{ row_num }}]" id="field_{{ row_num }}_4">
  344. <option value=""></option>
  345. {% for charset in charsets %}
  346. <optgroup label="{{ charset.name }}" title="{{ charset.description }}">
  347. {% for collation in charset.collations %}
  348. <option value="{{ collation.name }}" title="{{ collation.description }}"
  349. {{- collation.name == row['col_collation'] ? ' selected' }}>
  350. {{- collation.name -}}
  351. </option>
  352. {% endfor %}
  353. </optgroup>
  354. {% endfor %}
  355. </select>
  356. </td>
  357. <td class="nowrap" name="col_attribute">
  358. <span>{{ row['col_attribute']?(row['col_attribute']):"" }}</span>
  359. {% include 'columns_definitions/column_attribute.twig' with {
  360. 'column_number': row_num,
  361. 'ci': 5,
  362. 'ci_offset': 0,
  363. 'extracted_columnspec': {},
  364. 'column_meta': row['col_attribute'],
  365. 'submit_attribute': false,
  366. 'attribute_types': attribute_types,
  367. } only %}
  368. </td>
  369. <td class="nowrap" name="col_isNull">
  370. <span>{{ row['col_isNull'] ? 'Yes' | trans : 'No' | trans }}</span>
  371. {% include 'columns_definitions/column_null.twig' with {
  372. 'column_number': row_num,
  373. 'ci': 6,
  374. 'ci_offset': 0,
  375. 'column_meta': {
  376. 'Null': row['col_isNull']
  377. }
  378. } only %}
  379. </td>
  380. <td class="nowrap" name="col_extra">
  381. <span>{{ row['col_extra'] }}</span>
  382. {% include 'columns_definitions/column_extra.twig' with {
  383. 'column_number': row_num,
  384. 'ci': 7,
  385. 'ci_offset': 0,
  386. 'column_meta': {
  387. 'Extra': row['col_extra']
  388. }
  389. } only %}
  390. </td>
  391. </tr>
  392. {% set row_num = row_num + 1 %}
  393. {% endfor %}
  394. </tbody>
  395. </table>
  396. {# getTableFooter #}
  397. {% include 'select_all.twig' with {
  398. 'pma_theme_image': pmaThemeImage,
  399. 'text_dir' : text_dir,
  400. 'form_name' : 'tableslistcontainer',
  401. } only %}
  402. {{ get_button_or_image(
  403. 'edit_central_columns',
  404. 'mult_submit change_central_columns',
  405. 'Edit' | trans,
  406. 'b_edit',
  407. 'edit central columns'
  408. ) | raw }}
  409. {{ get_button_or_image(
  410. 'delete_central_columns',
  411. 'mult_submit',
  412. 'Delete' | trans,
  413. 'b_drop',
  414. 'remove_from_central_columns'
  415. ) | raw }}
  416. </form>
  417. </div>
  418. {% endif %}