index_form.twig 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219
  1. <form action="tbl_indexes.php"
  2. method="post"
  3. name="index_frm"
  4. id="index_frm"
  5. class="ajax">
  6. {{ Url_getHiddenInputs(form_params) }}
  7. <fieldset id="index_edit_fields">
  8. <div class="index_info">
  9. <div>
  10. <div class="label">
  11. <strong>
  12. <label for="input_index_name">
  13. {% trans 'Index name:' %}
  14. {{ Util_showHint('"PRIMARY" <b>must</b> be the name of and <b>only of</b> a primary key!'|trans) }}
  15. </label>
  16. </strong>
  17. </div>
  18. <input type="text"
  19. name="index[Key_name]"
  20. id="input_index_name"
  21. size="25"
  22. maxlength="64"
  23. value="{{ index.getName() }}"
  24. onfocus="this.select()" />
  25. </div>
  26. <div>
  27. <div class="label">
  28. <strong>
  29. <label for="select_index_choice">
  30. {% trans 'Index choice:' %}
  31. {{ Util_showMySQLDocu('ALTER_TABLE') }}
  32. </label>
  33. </strong>
  34. </div>
  35. {{ index.generateIndexChoiceSelector(create_edit_table)|raw }}
  36. </div>
  37. {{ Util_getDivForSliderEffect('indexoptions', 'Advanced Options'|trans) }}
  38. <div>
  39. <div class="label">
  40. <strong>
  41. <label for="input_key_block_size">
  42. {% trans 'Key block size:' %}
  43. </label>
  44. </strong>
  45. </div>
  46. <input type="text"
  47. name="index[Key_block_size]"
  48. id="input_key_block_size"
  49. size="30"
  50. value="{{ index.getKeyBlockSize() }}" />
  51. </div>
  52. <div>
  53. <div class="label">
  54. <strong>
  55. <label for="select_index_type">
  56. {% trans 'Index type:' %}
  57. {{ Util_showMySQLDocu('ALTER_TABLE') }}
  58. </label>
  59. </strong>
  60. </div>
  61. {{ index.generateIndexTypeSelector()|raw }}
  62. </div>
  63. <div>
  64. <div class="label">
  65. <strong>
  66. <label for="input_parser">
  67. {% trans 'Parser:' %}
  68. </label>
  69. </strong>
  70. </div>
  71. <input type="text"
  72. name="index[Parser]"
  73. id="input_parse"
  74. size="30"
  75. value="{{ index.getParser() }}" />
  76. </div>
  77. <div>
  78. <div class="label">
  79. <strong>
  80. <label for="input_index_comment">
  81. {% trans 'Comment:' %}
  82. </label>
  83. </strong>
  84. </div>
  85. <input type="text"
  86. name="index[Index_comment]"
  87. id="input_index_comment"
  88. size="30"
  89. maxlength="1024"
  90. value="{{ index.getComment() }}" />
  91. </div>
  92. </div>
  93. <!-- end of indexoptions div -->
  94. <div class="clearfloat"></div>
  95. <table id="index_columns">
  96. <thead>
  97. <tr>
  98. <th></th>
  99. <th>
  100. {% trans 'Column' %}
  101. </th>
  102. <th>
  103. {% trans 'Size' %}
  104. </th>
  105. </tr>
  106. </thead>
  107. {% set spatial_types = [
  108. 'geometry',
  109. 'point',
  110. 'linestring',
  111. 'polygon',
  112. 'multipoint',
  113. 'multilinestring',
  114. 'multipolygon',
  115. 'geomtrycollection'
  116. ] %}
  117. <tbody>
  118. {% for column in index.getColumns() %}
  119. <tr class="noclick">
  120. <td>
  121. <span class="drag_icon" title="{% trans 'Drag to reorder' %}"></span>
  122. </td>
  123. <td>
  124. <select name="index[columns][names][]">
  125. <option value="">
  126. -- {% trans 'Ignore' %} --
  127. </option>
  128. {% for field_name, field_type in fields %}
  129. {% if (index.getChoice() != 'FULLTEXT'
  130. or field_type matches '/(char|text)/i')
  131. and (index.getChoice() != 'SPATIAL'
  132. or field_type in spatial_types) %}
  133. <option value="{{ field_name }}"
  134. {%- if field_name == column.getName() %}
  135. selected="selected"
  136. {%- endif %}>
  137. {{ field_name }} [{{ field_type }}]
  138. </option>
  139. {% endif %}
  140. {% endfor %}
  141. </select>
  142. </td>
  143. <td>
  144. <input type="text"
  145. size="5"
  146. onfocus="this.select()"
  147. name="index[columns][sub_parts][]"
  148. value="{{ index.getChoice() != 'SPATIAL' ?
  149. column.getSubPart() }}" />
  150. </td>
  151. </tr>
  152. {% endfor %}
  153. {% if add_fields > 0 %}
  154. {% for i in range(1, add_fields) %}
  155. <tr class="noclick">
  156. <td>
  157. <span class="drag_icon" title="{% trans 'Drag to reorder' %}"></span>
  158. </td>
  159. <td>
  160. <select name="index[columns][names][]">
  161. <option value="">-- {% trans 'Ignore' %} --</option>
  162. {% set j = 0 %}
  163. {% for field_name, field_type in fields %}
  164. {% if create_edit_table %}
  165. {% set col_index = field_type[1] %}
  166. {% set field_type = field_type[0] %}
  167. {% endif %}
  168. {% set j = j + 1 %}
  169. <option value="{{ col_index is defined ?
  170. col_index : field_name }}"
  171. {{- j == i ? ' selected="selected"' }}>
  172. {{ field_name }} [{{ field_type }}]
  173. </option>
  174. {% endfor %}
  175. </select>
  176. </td>
  177. <td>
  178. <input type="text"
  179. size="5"
  180. onfocus="this.select()"
  181. name="index[columns][sub_parts][]"
  182. value="" />
  183. </td>
  184. </tr>
  185. {% endfor %}
  186. {% endif %}
  187. </tbody>
  188. </table>
  189. <div class="add_more">
  190. <div class="slider"></div>
  191. <div class="add_fields hide">
  192. <input type="submit"
  193. id="add_fields"
  194. value="{{ 'Add %s column(s) to index'|trans|format(1) }}" />
  195. </div>
  196. </div>
  197. </fieldset>
  198. <fieldset class="tblFooters">
  199. <button type="submit" id="preview_index_frm">{% trans 'Preview SQL' %}</button>
  200. <input type="submit" id="save_index_frm" value="{% trans 'Go' %}" />
  201. </fieldset>
  202. </form>