editor_form.twig 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. <form class="rte_form{{ not is_ajax ? ' disableAjax' }}" action="{{ url('/database/routines') }}" method="post">
  2. <input name="{{ is_edit_mode ? 'edit_item' : 'add_item' }}" type="hidden" value="1">
  3. {% if is_edit_mode %}
  4. <input name="item_original_name" type="hidden" value="{{ routine.item_original_name }}">
  5. <input name="item_original_type" type="hidden" value="{{ routine.item_original_type }}">
  6. {% endif %}
  7. {{ get_hidden_inputs(db) }}
  8. <div class="card">
  9. <div class="card-header">
  10. {% trans 'Details' %}
  11. {% if not is_edit_mode %}
  12. {{ show_mysql_docu('CREATE_PROCEDURE') }}
  13. {% endif %}
  14. </div>
  15. <div class="card-body">
  16. <table class="rte_table table table-borderless table-sm">
  17. <tr>
  18. <td>{% trans 'Routine name' %}</td>
  19. <td>
  20. <input type="text" name="item_name" maxlength="64" value="{{ routine.item_name }}">
  21. </td>
  22. </tr>
  23. <tr>
  24. <td>{% trans 'Type' %}</td>
  25. <td>
  26. {% if is_ajax %}
  27. <select name="item_type">
  28. <option value="PROCEDURE"{{ routine.item_type == 'PROCEDURE' ? ' selected' }}>PROCEDURE</option>
  29. <option value="FUNCTION"{{ routine.item_type == 'FUNCTION' ? ' selected' }}>FUNCTION</option>
  30. </select>
  31. {% else %}
  32. <input name="item_type" type="hidden" value="{{ routine.item_type }}">
  33. <div class="fw-bold text-center w-50">
  34. {{ routine['item_type'] }}
  35. </div>
  36. <input type="submit" class="btn btn-secondary" name="routine_changetype" value="{{ 'Change to %s'|trans|format(routine.item_type_toggle) }}">
  37. {% endif %}
  38. </td>
  39. </tr>
  40. <tr>
  41. <td>{% trans 'Parameters' %}</td>
  42. <td>
  43. <table class="routine_params_table table table-borderless table-sm">
  44. <thead>
  45. <tr>
  46. <td></td>
  47. <th class="routine_direction_cell{{ routine.item_type == 'FUNCTION' ? ' hide' }}">{% trans 'Direction' %}</th>
  48. <th>{% trans 'Name' %}</th>
  49. <th>{% trans 'Type' %}</th>
  50. <th>{% trans 'Length/Values' %}</th>
  51. <th colspan="2">{% trans 'Options' %}</th>
  52. <th class="routine_param_remove hide"></th>
  53. </tr>
  54. </thead>
  55. <tbody>
  56. {{ parameter_rows|raw }}
  57. </tbody>
  58. </table>
  59. </td>
  60. </tr>
  61. <tr>
  62. <td></td>
  63. <td>
  64. {% if is_ajax %}
  65. <button type="button" class="btn btn-primary" id="addRoutineParameterButton">{% trans 'Add parameter' %}</button>
  66. {% else %}
  67. <input type="submit" class="btn btn-primary" name="routine_addparameter" value="{% trans 'Add parameter' %}">
  68. <input type="submit" class="btn btn-secondary" name="routine_removeparameter" value="{% trans 'Remove last parameter' %}"{{ not routine.item_num_params ? ' disabled' }}>
  69. {% endif %}
  70. </td>
  71. </tr>
  72. <tr class="routine_return_row{{ routine.item_type == 'PROCEDURE' ? ' hide' }}">
  73. <td>{% trans 'Return type' %}</td>
  74. <td>
  75. <select name="item_returntype">
  76. {{ get_supported_datatypes(true, routine.item_returntype) }}
  77. </select>
  78. </td>
  79. </tr>
  80. <tr class="routine_return_row{{ routine.item_type == 'PROCEDURE' ? ' hide' }}">
  81. <td>{% trans 'Return length/values' %}</td>
  82. <td>
  83. <input type="text" name="item_returnlength" value="{{ routine.item_returnlength }}">
  84. </td>
  85. <td class="hide no_len">---</td>
  86. </tr>
  87. <tr class="routine_return_row{{ routine.item_type == 'PROCEDURE' ? ' hide' }}">
  88. <td>{% trans 'Return options' %}</td>
  89. <td>
  90. <div>
  91. <select lang="en" dir="ltr" name="item_returnopts_text">
  92. <option value="">{% trans 'Charset' %}</option>
  93. <option value=""></option>
  94. {% for charset in charsets %}
  95. <option value="{{ charset.getName() }}" title="{{ charset.getDescription() }}"{{ routine.item_returnopts_text == charset.getName() ? ' selected' }}>{{ charset.getName() }}</option>
  96. {% endfor %}
  97. </select>
  98. </div>
  99. <div>
  100. <select name="item_returnopts_num">
  101. <option value=""></option>
  102. {% for numeric_option in numeric_options %}
  103. <option value="{{ numeric_option }}"{{ routine.item_returnopts_num == numeric_option ? ' selected' }}>{{ numeric_option }}</option>
  104. {% endfor %}
  105. </select>
  106. </div>
  107. <div class="hide no_opts">---</div>
  108. </td>
  109. </tr>
  110. <tr>
  111. <td>{% trans 'Definition' %}</td>
  112. <td>
  113. <textarea name="item_definition" rows="15" cols="40">{{ routine.item_definition }}</textarea>
  114. </td>
  115. </tr>
  116. <tr>
  117. <td>{% trans 'Is deterministic' %}</td>
  118. <td>
  119. <input type="checkbox" name="item_isdeterministic"{{ routine.item_isdeterministic|raw }}>
  120. </td>
  121. </tr>
  122. {% if is_edit_mode %}
  123. <tr>
  124. <td>
  125. {% trans 'Adjust privileges' %}
  126. {{ show_docu('faq', 'faq6-39') }}
  127. </td>
  128. <td>
  129. {% if has_privileges %}
  130. <input type="checkbox" name="item_adjust_privileges" value="1" checked>
  131. {% else %}
  132. <input type="checkbox" name="item_adjust_privileges" value="1" title="{% trans 'You do not have sufficient privileges to perform this operation; Please refer to the documentation for more details.' %}" disabled>
  133. {% endif %}
  134. </td>
  135. </tr>
  136. {% endif %}
  137. <tr>
  138. <td>{% trans 'Definer' %}</td>
  139. <td>
  140. <input type="text" name="item_definer" value="{{ routine.item_definer }}">
  141. </td>
  142. </tr>
  143. <tr>
  144. <td>{% trans 'Security type' %}</td>
  145. <td>
  146. <select name="item_securitytype">
  147. <option value="DEFINER"{{ routine.item_securitytype_definer|raw }}>DEFINER</option>
  148. <option value="INVOKER"{{ routine.item_securitytype_invoker|raw }}>INVOKER</option>
  149. </select>
  150. </td>
  151. </tr>
  152. <tr>
  153. <td>{% trans 'SQL data access' %}</td>
  154. <td>
  155. <select name="item_sqldataaccess">
  156. {% for value in sql_data_access %}
  157. <option value="{{ value }}"{{ routine.item_sqldataaccess == value ? ' selected' }}>{{ value }}</option>
  158. {% endfor %}
  159. </select>
  160. </td>
  161. </tr>
  162. <tr>
  163. <td>{% trans 'Comment' %}</td>
  164. <td>
  165. <input type="text" name="item_comment" maxlength="64" value="{{ routine.item_comment }}">
  166. </td>
  167. </tr>
  168. </table>
  169. </div>
  170. {% if is_ajax %}
  171. <input type="hidden" name="{{ is_edit_mode ? 'editor_process_edit' : 'editor_process_add' }}" value="true">
  172. <input type="hidden" name="ajax_request" value="true">
  173. {% else %}
  174. <div class="card-footer">
  175. <input class="btn btn-primary" type="submit" name="{{ is_edit_mode ? 'editor_process_edit' : 'editor_process_add' }}" value="{% trans 'Go' %}">
  176. </div>
  177. {% endif %}
  178. </div>
  179. </form>