You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

99 lines
4.0 KiB

  1. {# Get inputbox based on different column types (Foreign key, geometrical, enum) #}
  2. {% if foreigners and Relation_searchColumnInForeigners(foreigners, column_name) %}
  3. {% if foreign_data['disp_row'] is iterable %}
  4. <select name="criteriaValues[{{ column_index }}]"
  5. id="{{ column_id }}{{ column_index }}">
  6. {{ Relation_foreignDropdown(
  7. foreign_data['disp_row'],
  8. foreign_data['foreign_field'],
  9. foreign_data['foreign_display'],
  10. '',
  11. foreign_max_limit
  12. ) }}
  13. </select>
  14. {% elseif foreign_data['foreign_link'] == true %}
  15. <input type="text"
  16. id="{{ column_id }}{{ column_index }}"
  17. name="criteriaValues[{{ column_index }}]"
  18. id="field_{{ column_name_hash }}[{{ column_index }}]"
  19. class="textfield"
  20. {% if criteria_values[column_index] is defined %}
  21. value="{{ criteria_values[column_index] }}"
  22. {% endif %} />
  23. <a class="ajax browse_foreign"
  24. href="browse_foreigners.php
  25. {{- Url_getCommon({'db': db, 'table': table}) -}}
  26. &amp;field={{ column_name|url_encode }}&amp;fieldkey=
  27. {{- column_index }}&amp;fromsearch=1">
  28. {{ titles['Browse']|replace({"'": "\\'"})|raw }}
  29. </a>
  30. {% endif %}
  31. {% elseif column_type in Util_getGISDatatypes() %}
  32. <input type="text"
  33. name="criteriaValues[{{ column_index }}]"
  34. size="40"
  35. class="textfield"
  36. id="field_{{ column_index }}" />
  37. {% if in_fbs %}
  38. {% set edit_url = 'gis_data_editor.php' ~ Url_getCommon() %}
  39. {% set edit_str = Util_getIcon('b_edit', 'Edit/Insert'|trans) %}
  40. <span class="open_search_gis_editor">
  41. {{ Util_linkOrButton(edit_url, edit_str, [], '_blank') }}
  42. </span>
  43. {% endif %}
  44. {% elseif column_type starts with 'enum'
  45. or (column_type starts with 'set' and in_zoom_search_edit) %}
  46. {% set in_zoom_search_edit = false %}
  47. {% set value = column_type|e|slice(5, -1)|replace({'&#039;': ''})|split(', ') %}
  48. {% set cnt_value = value|length %}
  49. {#
  50. Enum in edit mode --> dropdown
  51. Enum in search mode --> multiselect
  52. Set in edit mode --> multiselect
  53. Set in search mode --> input (skipped here, so the 'else' section would handle it)
  54. #}
  55. {% if (column_type starts with 'enum' and not in_zoom_search_edit)
  56. or (column_type starts with 'set' and in_zoom_search_edit) %}
  57. <select name="criteriaValues[{{ column_index }}]"
  58. id="{{ column_id }}{{ column_index }}">
  59. {% else %}
  60. <select name="criteriaValues[{{ column_index }}]"
  61. id="{{ column_id }}{{ column_index }}"
  62. multiple="multiple"
  63. size="{{ min(3, cnt_value) }}">
  64. {% endif %}
  65. {# Add select options #}
  66. <option value=""></option>
  67. {% for i in 0..cnt_value - 1 %}
  68. {% if criteria_values[column_index] is defined
  69. and criteria_values[column_index] is iterable
  70. and value[i] in criteria_values[column_index] %}
  71. <option value="{{ value[i]|raw }}" selected>
  72. {{ value[i]|raw }}
  73. </option>
  74. {% else %}
  75. <option value="{{ value[i]|raw }}">
  76. {{ value[i]|raw }}
  77. </option>
  78. {% endif %}
  79. {% endfor %}
  80. </select>
  81. {% else %}
  82. {% set the_class = 'textfield' %}
  83. {% if column_type == 'date' %}
  84. {% set the_class = the_class ~ ' datefield' %}
  85. {% elseif column_type == 'datetime' or column_type starts with 'timestamp' %}
  86. {% set the_class = the_class ~ ' datetimefield' %}
  87. {% elseif column_type starts with 'bit' %}
  88. {% set the_class = the_class ~ ' bit' %}
  89. {% endif %}
  90. <input type="text"
  91. name="criteriaValues[{{ column_index }}]"
  92. size="40"
  93. class="{{ the_class }}"
  94. id="{{ column_id }}{{ column_index }}"
  95. {% if criteria_values[column_index] is defined %}
  96. value="{{ criteria_values[column_index] }}"
  97. {%- endif %} />
  98. {% endif %}