/
column_row.twig
128 lines (122 loc) · 8.93 KB
/
column_row.twig
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
<tr class="noclick">
<td class="text-center">
{{ field_title|raw }}
<input type="hidden" name="fields_name[multi_edit][{{ row_id }}][{{ column.md5 }}]" value="{{ column.field }}">
</td>
{% if show_field_types_in_data_edit_view %}
<td class="text-center{{ column.trueType not in ['set', 'enum'] ? ' text-nowrap' }}">
<span class="column_type" dir="ltr">{{ column.pmaType }}</span>
</td>
{% endif %}
{% if show_function_fields %}
{% if is_column_binary %}
<td class="text-center">{{ t('Binary') }}</td>
{% elseif 'enum' in column.trueType or 'set' in column.trueType %}
<td class="text-center">--</td>
{% else %}
<td>
<select name="funcs[multi_edit][{{ row_id }}][{{ column.md5 }}]" onchange="return verificationsAfterFieldChange('{{ column.md5|escape('js') }}', '{{ row_id|escape('js') }}', '{{ column.pmaType }}')" id="field_{{ id_index }}_1">
{{ function_options|raw }}
</select>
</td>
{% endif %}
{% endif %}
<td>
{% if column.isNull %}
<input type="hidden" name="fields_null_prev[multi_edit][{{ row_id }}][{{ column.md5 }}]"{{ real_null_value and not column.firstTimestamp ? ' value="on"' }}>
<input type="checkbox" class="checkbox_null" name="fields_null[multi_edit][{{ row_id }}][{{ column.md5 }}]" id="field_{{ id_index }}_2" aria-label="{{ t('Use the NULL value for this column.') }}"{{ real_null_value ? ' checked' }}>
<input type="hidden" class="nullify_code" name="nullify_code[multi_edit][{{ row_id }}][{{ column.md5 }}]" value="{{ nullify_code }}">
<input type="hidden" class="hashed_field" name="hashed_field[multi_edit][{{ row_id }}][{{ column.md5 }}]" value="{{ column.md5 }}">
<input type="hidden" class="multi_edit" name="multi_edit[multi_edit][{{ row_id }}][{{ column.md5 }}]" value="{{ ('[multi_edit][' ~ row_id ~ ']') }}">
{% endif %}
</td>
<td data-type="{{ type }}" data-decimals="{{ decimals }}">
{# Will be used by table/change.js to set the default value for the "Continue insertion" feature. #}
<span class="default_value hide">{{ special_chars|raw }}</span>
{% if transformed_value is not empty %}
{{ transformed_value|raw }}
{% else %}
{% if is_value_foreign_link %}
{{ backup_field|raw }}
<input type="hidden" name="fields_type[multi_edit][{{ row_id }}][{{ column.md5 }}]" value="foreign">
<input type="text" name="fields[multi_edit][{{ row_id }}][{{ column.md5 }}]" class="textfield" tabindex="{{ id_index }}" onchange="return verificationsAfterFieldChange('{{ column.md5|escape('js') }}', '{{ row_id|escape('js') }}', '{{ column.pmaType }}')" id="field_{{ id_index }}_3" value="{{ data }}">
<a class="ajax browse_foreign" href="{{ url('/browse-foreigners') }}" data-post="{{ get_common({'db': db, 'table': table, 'field': column.field, 'rownumber': row_id, 'data': data}) }}">{{ get_icon('b_browse', t('Browse foreign values')) }}</a>
{% elseif foreign_dropdown is not empty %}
{{ backup_field|raw }}
<input type="hidden" name="fields_type[multi_edit][{{ row_id }}][{{ column.md5 }}]" value="{{ column.isBinary ? 'hex' : 'foreign' }}">
<select name="fields[multi_edit][{{ row_id }}][{{ column.md5 }}]" class="textfield" tabindex="{{ id_index }}" id="field_{{ id_index }}_3" onchange="return verificationsAfterFieldChange('{{ column.md5|escape('js') }}', '{{ row_id|escape('js') }}', '{{ column.pmaType }}')">
{{ foreign_dropdown|raw }}
</select>
{% elseif (longtext_double_textarea and 'longtext' in column.pmaType) or 'json' in column.pmaType or 'text' in column.pmaType %}
{{ backup_field|raw }}
<textarea name="fields[multi_edit][{{ row_id }}][{{ column.md5 }}]" id="field_{{ id_index }}_3" data-type="{{ data_type }}" dir="{{ text_dir }}" rows="{{ textarea_rows }}" cols="{{ textarea_cols }}" tabindex="{{ id_index }}"
{{- max_length ? ' data-maxlength="' ~ max_length ~ '"' }}{{ column.isChar ? ' class="char charField"' }} onchange="return verificationsAfterFieldChange('{{ column.md5|escape('js') }}', '{{ row_id|escape('js') }}', '{{ column.pmaType }}')">
{#- We need to duplicate the first \n or otherwise we will lose the first newline entered in a VARCHAR or TEXT column -#}
{{- special_chars starts with "\r\n" ? "\n" }}{{ special_chars|raw -}}
</textarea>
{% if 'text' in column.pmaType and special_chars|length > 32000 %}
</td>
<td>
{{ t('Because of its length,<br> this column might not be editable.')|raw }}
{% endif %}
{% elseif column.pmaType == 'enum' %}
{{ backup_field|raw }}
<input type="hidden" name="fields_type[multi_edit][{{ row_id }}][{{ column.md5 }}]" value="enum">
{% if column.type|length > 20 %}
<select name="fields[multi_edit][{{ row_id }}][{{ column.md5 }}]" class="textfield" tabindex="{{ id_index }}" id="field_{{ id_index }}_3" onchange="return verificationsAfterFieldChange('{{ column.md5|escape('js') }}', '{{ row_id|escape('js') }}', '{{ column.pmaType }}')">
<option value=""></option>
{% for enum_value in enum_values %}
<option value="{{ enum_value }}"{{ enum_value == enum_selected_value ? ' selected' }}>{{ enum_value }}</option>
{% endfor %}
</select>
{% else %}
{% for enum_value in enum_values %}
<input type="radio" name="fields[multi_edit][{{ row_id }}][{{ column.md5 }}]" value="{{ enum_value }}" class="textfield" tabindex="{{ id_index }}" id="field_{{ id_index }}_3_{{ loop.index0 }}" onchange="return verificationsAfterFieldChange('{{ column.md5|escape('js') }}', '{{ row_id|escape('js') }}', '{{ column.pmaType }}')"{{ enum_value == enum_selected_value ? ' checked' }}>
<label for="field_{{ id_index }}_3_{{ loop.index0 }}">{{ enum_value }}</label>
{% endfor %}
{% endif %}
{% elseif column.pmaType == 'set' %}
{{ backup_field|raw }}
<input type="hidden" name="fields_type[multi_edit][{{ row_id }}][{{ column.md5 }}]" value="set">
<select name="fields[multi_edit][{{ row_id }}][{{ column.md5 }}][]" class="textfield" tabindex="{{ id_index }}" size="{{ set_select_size }}" id="field_{{ id_index }}_3" onchange="return verificationsAfterFieldChange('{{ column.md5|escape('js') }}', '{{ row_id|escape('js') }}', '{{ column.pmaType }}')" multiple>
{% for set_value in set_values %}
<option value="{{ set_value }}"{{ set_value in data|split(',') ? ' selected' }}>{{ set_value }}</option>
{% endfor %}
</select>
{% elseif column.isBinary or column.isBlob %}
{% if is_column_protected_blob %}
{{ t('Binary - do not edit') }}
({{ blob_value }} {{ blob_value_unit }})
<input type="hidden" name="fields[multi_edit][{{ row_id }}][{{ column.md5 }}]" value="">
<input type="hidden" name="fields_type[multi_edit][{{ row_id }}][{{ column.md5 }}]" value="protected">
{% elseif column.isBlob or (column.length > limit_chars) %}
{{ backup_field|raw }}
<input type="hidden" name="fields_type[multi_edit][{{ row_id }}][{{ column.md5 }}]" value="hex">
<textarea name="fields[multi_edit][{{ row_id }}][{{ column.md5 }}]" id="field_{{ id_index }}_3" data-type="HEX" dir="{{ text_dir }}" rows="{{ textarea_rows }}" cols="{{ textarea_cols }}" tabindex="{{ id_index }}"
{{- max_length ? ' data-maxlength="' ~ max_length ~ '"' }}{{ column.isChar ? ' class="char charField"' }} onchange="return verificationsAfterFieldChange('{{ column.md5|escape('js') }}', '{{ row_id|escape('js') }}', '{{ column.pmaType }}')">
{#- We need to duplicate the first \n or otherwise we will lose the first newline entered in a VARCHAR or TEXT column -#}
{{- special_chars starts with "\r\n" ? "\n" }}{{ special_chars|raw -}}
</textarea>
{% else %}
{{ backup_field|raw }}
<input type="hidden" name="fields_type[multi_edit][{{ row_id }}][{{ column.md5 }}]" value="hex">
{{ input_field_html|raw }}
{% endif %}
{% if is_upload and column.isBlob %}
<br>
{# We don't want to prevent users from using browser's default drag-drop feature on some page(s), so we add noDragDrop class to the input #}
<input type="file" name="fields_upload[multi_edit][{{ row_id }}][{{ column.md5 }}]" class="textfield noDragDrop" id="field_{{ id_index }}_3" size="10" onchange="return verificationsAfterFieldChange('{{ column.md5|escape('js') }}', '{{ row_id|escape('js') }}', '{{ column.pmaType }}')">
{{ max_upload_size }}
{% endif %}
{{ select_option_for_upload|raw }}
{% else %}
{{ value|raw }}
{% endif %}
{% if column.pmaType in gis_data_types %}
<span class="open_gis_editor" data-row-id="{{ row_id }}">
{{ link_or_button('#', null, get_icon('b_edit', t('Edit/Insert'))) }}
</span>
{% endif %}
{% endif %}
</td>
</tr>