database_tables.twig 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128
  1. {% for t_n in table_names %}
  2. {% set i = loop.index0 %}
  3. {% set t_n_url = table_names_url[i] %}
  4. <input name="t_x[{{ t_n_url|url_encode }}]" type="hidden" id="t_x_{{ t_n_url|url_encode }}_" />
  5. <input name="t_y[{{ t_n_url|url_encode }}]" type="hidden" id="t_y_{{ t_n_url|url_encode }}_" />
  6. <input name="t_v[{{ t_n_url|url_encode }}]" type="hidden" id="t_v_{{ t_n_url|url_encode }}_" />
  7. <input name="t_h[{{ t_n_url|url_encode }}]" type="hidden" id="t_h_{{ t_n_url|url_encode }}_" />
  8. <table id="{{ t_n_url|url_encode }}"
  9. cellpadding="0"
  10. cellspacing="0"
  11. class="designer_tab"
  12. style="position:absolute; left:
  13. {{- tab_pos[t_n] is defined ? tab_pos[t_n]['X'] : random(range(20, 700)) }}px; top:
  14. {{- tab_pos[t_n] is defined ? tab_pos[t_n]['Y'] : random(range(20, 550)) }}px; display:
  15. {{- tab_pos[t_n] is defined or display_page == -1 ? 'block' : 'none' }}; z-index: 1;">
  16. <thead>
  17. <tr class="header">
  18. {% if has_query %}
  19. <td class="select_all">
  20. <input class="select_all_1"
  21. type="checkbox"
  22. style="margin: 0;"
  23. value="select_all_{{ t_n_url|url_encode }}"
  24. id="select_all_{{ t_n_url|url_encode }}"
  25. title="select all"
  26. designer_url_table_name="{{ t_n_url|url_encode }}"
  27. designer_out_owner="{{ owner_out[i]|raw }}">
  28. </td>
  29. {% endif %}
  30. <td class="small_tab"
  31. title="{% trans 'Show/hide columns' %}"
  32. id="id_hide_tbody_{{ t_n_url|url_encode }}"
  33. table_name="{{ t_n_url|url_encode }}">
  34. {{ tab_pos[t_n] is not defined or tab_pos[t_n]['V'] is not empty ? 'v' : '&gt;' }}
  35. </td>
  36. <td class="small_tab_pref small_tab_pref_1"
  37. table_name_small="{{ table_names_small_url[i] }}">
  38. <img src="{{ theme.getImgPath('designer/exec_small.png') }}"
  39. title="{% trans 'See table structure' %}" />
  40. </td>
  41. <td id="id_zag_{{ t_n_url|url_encode }}"
  42. class="tab_zag nowrap tab_zag_noquery"
  43. table_name="{{ t_n_url|url_encode }}"
  44. query_set="{{ has_query ? 1 : 0 }}">
  45. <span class="owner">
  46. {{ owner_out[i]|raw }}
  47. </span>
  48. {{ table_names_small_out[i]|raw }}
  49. </td>
  50. {% if has_query %}
  51. <td class="tab_zag tab_zag_query"
  52. id="id_zag_{{ t_n_url|url_encode }}_2"
  53. table_name="{{ t_n_url|url_encode }}">
  54. </td>
  55. {% endif %}
  56. </tr>
  57. </thead>
  58. <tbody id="id_tbody_{{ t_n_url|url_encode }}"
  59. {{- tab_pos[t_n] is defined and tab_pos[t_n]['V'] is empty ? ' style="display: none"' }}>
  60. {% set display_field = Relation_getDisplayField(get_db, table_names_small[i]) %}
  61. {% for j in 0..tab_column[t_n]['COLUMN_ID']|length - 1 %}
  62. {% set tmp_column = t_n ~ '.' ~ tab_column[t_n]['COLUMN_NAME'][j] %}
  63. {% set click_field_param = [
  64. table_names_small_url[i],
  65. tab_column[t_n]['COLUMN_NAME'][j]|url_encode
  66. ] %}
  67. {% if not Util_isForeignKeySupported(table_types[i]) %}
  68. {% set click_field_param = click_field_param|merge([tables_pk_or_unique_keys[tmp_column] is defined ? 1 : 0]) %}
  69. {% else %}
  70. {# if foreign keys are supported, it's not necessary that the
  71. index is a primary key #}
  72. {% set click_field_param = click_field_param|merge([tables_all_keys[tmp_column] is defined ? 1 : 0]) %}
  73. {% endif %}
  74. {% set click_field_param = click_field_param|merge([db]) %}
  75. <tr id="id_tr_{{ table_names_small_url[i] }}.{{ tab_column[t_n]['COLUMN_NAME'][j] }}" class="tab_field
  76. {{- display_field == tab_column[t_n]['COLUMN_NAME'][j] ? '_3' }}" click_field_param="
  77. {{- click_field_param|join(',') }}">
  78. {% if has_query %}
  79. <td class="select_all">
  80. <input class="select_all_store_col"
  81. value="{{ t_n_url|url_encode }}{{ tab_column[t_n]['COLUMN_NAME'][j]|url_encode }}"
  82. type="checkbox"
  83. id="select_{{ t_n_url|url_encode }}._{{ tab_column[t_n]['COLUMN_NAME'][j]|url_encode }}"
  84. style="margin: 0;"
  85. title="select_{{ tab_column[t_n]['COLUMN_NAME'][j]|url_encode }}"
  86. store_column_param="{{ table_names_small_out[i]|url_encode }},
  87. {{- owner_out[i] }},
  88. {{- tab_column[t_n]['COLUMN_NAME'][j]|url_encode }}">
  89. </td>
  90. {% endif %}
  91. <td width="10px" colspan="3" id="{{ t_n_url|url_encode }}.
  92. {{- tab_column[t_n]['COLUMN_NAME'][j]|url_encode }}">
  93. <div class="nowrap">
  94. {% if tables_pk_or_unique_keys[t_n ~ '.' ~ tab_column[t_n]['COLUMN_NAME'][j]] is defined %}
  95. <img src="{{ theme.getImgPath('designer/FieldKey_small.png') }}" alt="*" />
  96. {% else %}
  97. {% set type = 'designer/Field_small' %}
  98. {% if strstr(tab_column[t_n]['TYPE'][j], 'char')
  99. or strstr(tab_column[t_n]['TYPE'][j], 'text') %}
  100. {% set type = type ~ '_char' %}
  101. {% elseif strstr(tab_column[t_n]['TYPE'][j], 'int')
  102. or strstr(tab_column[t_n]['TYPE'][j], 'float')
  103. or strstr(tab_column[t_n]['TYPE'][j], 'double')
  104. or strstr(tab_column[t_n]['TYPE'][j], 'decimal') %}
  105. {% set type = type ~ '_int' %}
  106. {% elseif strstr(tab_column[t_n]['TYPE'][j], 'date')
  107. or strstr(tab_column[t_n]['TYPE'][j], 'time')
  108. or strstr(tab_column[t_n]['TYPE'][j], 'year') %}
  109. {% set type = type ~ '_date' %}
  110. {% endif %}
  111. <img src="{{ theme.getImgPath(type) }}.png" alt="*" />
  112. {% endif %}
  113. {{ tab_column[t_n]['COLUMN_NAME'][j] }} : {{ tab_column[t_n]['TYPE'][j] }}
  114. </div>
  115. </td>
  116. {% if has_query %}
  117. <td class="small_tab_pref small_tab_pref_click_opt"
  118. click_option_param="designer_optionse,
  119. {{- tab_column[t_n]['COLUMN_NAME'][j]|url_encode }},
  120. {{- table_names_small_out[i] }}">
  121. <img src="{{ theme.getImgPath('designer/exec_small.png') }}" title="options" />
  122. </td>
  123. {% endif %}
  124. </tr>
  125. {% endfor %}
  126. </tbody>
  127. </table>
  128. {% endfor %}