form.twig 8.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184
  1. {% include 'secondary_tabs.twig' with {
  2. 'url_params': {
  3. 'db': db
  4. },
  5. 'sub_tabs': [
  6. {
  7. 'link': 'db_multi_table_query.php',
  8. 'text': 'Multi-table query'|trans
  9. },
  10. {
  11. 'link': 'db_qbe.php',
  12. 'text': 'Query by example'|trans
  13. }
  14. ]
  15. } only %}
  16. {% include 'div_for_slider_effect.twig' with {
  17. 'id': 'query_div',
  18. 'message': 'Query window'|trans,
  19. 'initial_sliders_state': 'open',
  20. } only %}
  21. <form action="" id="query_form">
  22. <input type="hidden" id="db_name" value="{{ db }}">
  23. <fieldset>
  24. {% for table in tables %}
  25. <div style="display:none" id="{{ table.hash }}">
  26. <option value="*">*</option>
  27. {% for column in table.columns %}
  28. <option value="{{ column }}">{{ column }}</option>
  29. {% endfor %}
  30. </div>
  31. {% endfor %}
  32. {% for id in 0..default_no_of_columns %}
  33. {% if id == 0 %}<div style="display:none" id="new_column_layout">{% endif %}
  34. <fieldset style="display:inline" class="column_details">
  35. <select style="display:inline" class="tableNameSelect">
  36. <option value="">{% trans 'select table' %}</option>
  37. {% for table in tables|keys %}
  38. <option value="{{ table }}">{{ table }}</option>
  39. {% endfor %}
  40. </select>
  41. <span>.</span>
  42. <select style="display:inline" class="columnNameSelect">
  43. <option value="">{% trans 'select column' %}</option>
  44. </select>
  45. <br>
  46. <input type="checkbox" checked="checked" class="show_col">
  47. <span>{% trans 'Show' %}</span>
  48. <br>
  49. <input type="text" placeholder="{% trans 'Table alias' %}" class="table_alias">
  50. <input type="text" placeholder="{% trans 'Column alias' %}" class="col_alias">
  51. <br>
  52. <input type="checkbox"
  53. title="{% trans 'Use this column in criteria' %}"
  54. class="criteria_col">
  55. {% include 'div_for_slider_effect.twig' with {
  56. 'id': 'criteria_div' ~ id,
  57. 'initial_sliders_state': 'closed',
  58. 'message': 'criteria'|trans
  59. } %}
  60. <div>
  61. <table>
  62. <tr class="sort_order" style="background:none">
  63. <td>{% trans 'Sort' %}</td>
  64. <td><input type="radio" name="sort[{{ id }}]">{% trans 'Ascending' %}</td>
  65. <td><input type="radio" name="sort[{{ id }}]">{% trans 'Descending' %}</td>
  66. </tr>
  67. <tr class="logical_operator" style="background:none;display:none">
  68. <td>{% trans 'Add as' %}</td>
  69. <td>
  70. <input type="radio"
  71. name="logical_op[{{ id }}]"
  72. value="AND"
  73. class="logical_op"
  74. checked="checked">
  75. AND
  76. </td>
  77. <td>
  78. <input type="radio"
  79. name="logical_op[{{ id }}]"
  80. value="OR"
  81. class="logical_op">
  82. OR
  83. </td>
  84. </tr>
  85. <tr style="background:none">
  86. <td>Op </td>
  87. <td>
  88. <select class="criteria_op">
  89. <option value="=">=</option>
  90. <option value=">">&gt;</option>
  91. <option value=">=">&gt;=</option>
  92. <option value="<">&lt;</option>
  93. <option value="<=">&lt;=</option>
  94. <option value="!=">!=</option>
  95. <option value="LIKE">LIKE</option>
  96. <option value="LIKE %...%">LIKE %...%</option>
  97. <option value="NOT LIKE">NOT LIKE</option>
  98. <option value="IN (...)">IN (...)</option>
  99. <option value="NOT IN (...)">NOT IN (...)</option>
  100. <option value="BETWEEN">BETWEEN</option>
  101. <option value="NOT BETWEEN">NOT BETWEEN</option>
  102. <option value="IS NULL">IS NULL</option>
  103. <option value="IS NOT NULL">IS NOT NULL</option>
  104. <option value="REGEXP">REGEXP</option>
  105. <option value="REGEXP ^...$">REGEXP ^...$</option>
  106. <option value="NOT REGEXP">NOT REGEXP</option>
  107. </select>
  108. </td>
  109. <td>
  110. <select class="criteria_rhs">
  111. <option value="text">{% trans 'Text' %}</option>
  112. <option value="anotherColumn">{% trans 'Another column' %}</option>
  113. </select>
  114. </td>
  115. </tr>
  116. <tr class="rhs_table" style="display:none;background:none">
  117. <td></td>
  118. <td>
  119. <select class="tableNameSelect">
  120. <option value="">{% trans 'select table' %}</option>
  121. {% for table in tables|keys %}
  122. <option value="{{ table }}">{{ table }}</option>
  123. {% endfor %}
  124. </select><span>.</span>
  125. </td>
  126. <td>
  127. <select style="display:inline" class="columnNameSelect">
  128. <option value="">{% trans 'select column' %}</option>
  129. </select>
  130. </td>
  131. </tr>
  132. <tr style="background:none" class="rhs_text">
  133. <td></td>
  134. <td colspan="2">
  135. <input type="text"
  136. style="width:91%"
  137. class="rhs_text_val"
  138. placeholder="{% trans 'Enter criteria as free text' %}">
  139. </td>
  140. </tr>
  141. </table>
  142. </div>
  143. </div>
  144. <a href="#"
  145. title="{% trans 'Remove this column' %}"
  146. style="float:right;color:red"
  147. class="removeColumn">
  148. X
  149. </a>
  150. </fieldset>
  151. {% if id == 0 %}</div>{% endif %}
  152. {% endfor %}
  153. <fieldset style="display:inline">
  154. <input class="btn btn-secondary" type="button" value="{% trans '+ Add column' %}" id="add_column_button">
  155. </fieldset>
  156. <fieldset>
  157. {% apply spaceless %}
  158. <textarea id="MultiSqlquery"
  159. cols="80"
  160. rows="4"
  161. style="float:left"
  162. name="sql_query"
  163. dir="ltr">
  164. </textarea>
  165. {% endapply %}
  166. </fieldset>
  167. </fieldset>
  168. <fieldset class="tblFooters">
  169. <input class="btn btn-secondary" type="button" id="update_query_button" value="{% trans 'Update query' %}">
  170. <input class="btn btn-primary" type="button" id="submit_query" value="{% trans 'Submit query' %}">
  171. </fieldset>
  172. </form>
  173. </div>{# Slider div #}
  174. <div id="sql_results"></div>