Translated using Weblate (Portuguese)
[phpmyadmin.git] / templates / gis_data_editor_form.twig
blob412561a65c427c8d78b65753bde2bc27aea4c1b1
1 <form id="gis_data_editor_form" action="gis_data_editor.php" method="post">
2     <input type="hidden" id="pmaThemeImage" value="{{ pma_theme_image }}">
3     <div id="gis_data_editor">
4         <h3>{{ 'Value for the column "%s"'|trans|format(field) }}</h3>
6         <input type="hidden" name="field" value="{{ field }}">
7         {# The input field to which the final result should be added and corresponding null checkbox #}
8         {% if input_name is not null %}
9             <input type="hidden" name="input_name" value="{{ input_name }}">
10         {% endif %}
11         {{ get_hidden_inputs() }}
13         {# Visualization section #}
14         <div id="placeholder"{{ srid != 0 ? ' class="hide"' }}>
15             {{ visualization|raw }}
16         </div>
18         <div id="openlayersmap" style="width: {{width}}px; height: {{height}}px;"{{ srid == 0 ? ' class="hide"' }}></div>
20         <div class="choice floatright">
21             <input type="checkbox" id="choice" value="useBaseLayer"{{ srid != 0 ? ' checked="checked"' }}>
22             <label for="choice">{% trans "Use OpenStreetMaps as Base Layer" %}</label>
23         </div>
25         <script language="javascript" type="text/javascript">{{ open_layers|raw }}</script>
26         {# End of visualization section #}
28         {# Header section - Inclueds GIS type selector and input field for SRID #}
29         <div id="gis_data_header">
30             <select name="gis_data[gis_type]" class="gis_type">
31                 {% for gis_type in gis_types %}
32                     <option value="{{ gis_type }}"{{ geom_type == gis_type ? ' selected="selected"' }}>
33                         {{ gis_type }}
34                     </option>
35                 {% endfor %}
36             </select>
38             <label for="srid">{% trans %}SRID:{% context %}Spatial Reference System Identifier{% endtrans %}</label>
39             <input name="gis_data[srid]" type="text" value="{{ srid }}">
40         </div>
41         {# End of header section #}
43         {# Data section #}
44         <div id="gis_data">
45             {% if geom_type == 'GEOMETRYCOLLECTION' %}
46                 <input type="hidden" name="gis_data[GEOMETRYCOLLECTION][geom_count]" value="{{ geom_count }}">
47             {% endif %}
49             {% for a in 0..geom_count - 1 %}
50               {% if gis_data[a] is not null %}
51                 {% if geom_type == 'GEOMETRYCOLLECTION' %}
52                     <br><br>
53                     {{ 'Geometry %d:'|trans|format(a + 1) }}
54                     <br>
55                     {% if gis_data[a]['gis_type'] is not null %}
56                         {% set type = gis_data[a]['gis_type'] %}
57                     {% else %}
58                         {% set type = gis_types[0] %}
59                     {% endif %}
60                     <select name="gis_data[{{ a }}][gis_type]" class="gis_type">
61                         {% for gis_type in gis_types|slice(0, 6) %}
62                             <option value="{{ gis_type }}"{{ type == gis_type ? ' selected="selected"' }}>
63                                 {{ gis_type }}
64                             </option>
65                         {% endfor %}
66                     </select>
67                 {% else %}
68                     {% set type = geom_type %}
69                 {% endif %}
71                 {% if type == 'POINT' %}
72                     <br>
73                     {% trans 'Point:' %}
74                     <label for="x">{% trans 'X' %}</label>
75                     <input name="gis_data[{{ a }}][POINT][x]" type="text" value="{{ gis_data[a]['POINT']['x'] }}">
76                     <label for="y">{% trans 'Y' %}</label>
77                     <input name="gis_data[{{ a }}][POINT][y]" type="text" value="{{ gis_data[a]['POINT']['y'] }}">
78                 {% elseif type == 'MULTIPOINT' or type == 'LINESTRING' %}
79                     {% set no_of_points = gis_data[a][type]['no_of_points'] ?? 1 %}
80                     {% if type == 'LINESTRING' and no_of_points < 2 %}
81                         {% set no_of_points = 2 %}
82                     {% endif %}
83                     {% if type == 'MULTIPOINT' and no_of_points < 1 %}
84                         {% set no_of_points = 1 %}
85                     {% endif %}
86                     {% if gis_data[a][type]['add_point'] is not null %}
87                         {% set no_of_points = no_of_points + 1 %}
88                     {% endif %}
89                     <input type="hidden" value="{{ no_of_points }}" name="gis_data[{{ a }}][{{ type }}][no_of_points]">
91                     {% for i in 0..no_of_points - 1 %}
92                         <br>
93                         {{ 'Point %d:'|trans|format(i + 1) }}
94                         <label for="x">{% trans 'X' %}</label>
95                         <input type="text" name="gis_data[{{ a }}][{{ type }}][{{ i }}][x]" value="{{ gis_data[a][type][i]['x'] }}">
96                         <label for="y">{% trans 'Y' %}</label>
97                         <input type="text" name="gis_data[{{ a }}][{{ type }}][{{ i }}][y]" value="{{ gis_data[a][type][i]['y'] }}">
98                     {% endfor %}
99                     <input type="submit" name="gis_data[{{ a }}][{{ type }}][add_point]" class="btn btn-secondary add addPoint" value="{% trans 'Add a point' %}">
100                 {% elseif type == 'MULTILINESTRING' or type == 'POLYGON' %}
101                     {% set no_of_lines = gis_data[a][type]['no_of_lines'] ?? 1 %}
102                     {% if no_of_lines < 1 %}
103                         {% set no_of_lines = 1 %}
104                     {% endif %}
105                     {% if gis_data[a][type]['add_line'] is not null %}
106                         {% set no_of_lines = no_of_lines + 1 %}
107                     {% endif %}
108                     <input type="hidden" value="{{ no_of_lines }}" name="gis_data[{{ a }}][{{ type }}][no_of_lines]">
110                     {% for i in 0..no_of_lines - 1 %}
111                         <br>
112                         {% if type == 'MULTILINESTRING' %}
113                             {{ 'Linestring %d:'|trans|format(i + 1) }}
114                         {% elseif i == 0 %}
115                             {% trans 'Outer ring:' %}
116                         {% else %}
117                             {{ 'Inner ring %d:'|trans|format(i) }}
118                         {% endif %}
120                         {% set no_of_points = gis_data[a][type][i]['no_of_points'] ?? 2 %}
121                         {% if type == 'MULTILINESTRING' and no_of_points < 2 %}
122                             {% set no_of_points = 2 %}
123                         {% endif %}
124                         {% if type == 'POLYGON' and no_of_points < 4 %}
125                             {% set no_of_points = 4 %}
126                         {% endif %}
127                         {% if gis_data[a][type][i]['add_point'] is not null %}
128                             {% set no_of_points = no_of_points + 1 %}
129                         {% endif %}
130                         <input type="hidden" value="{{ no_of_points }}" name="gis_data[{{ a }}][{{ type }}][{{ i }}][no_of_points]">
132                         {% for j in 0..no_of_points - 1 %}
133                             <br>
134                             {{ 'Point %d:'|trans|format(j + 1) }}
135                             <label for="x">{% trans 'X' %}</label>
136                             <input type="text" name="gis_data[{{ a }}][{{ type }}][{{ i }}][{{ j }}][x]" value="{{ gis_data[a][type][i][j]['x'] }}">
137                             <label for="y">{% trans 'Y' %}</label>
138                             <input type="text" name="gis_data[{{ a }}][{{ type }}][{{ i }}][{{ j }}][y]" value="{{ gis_data[a][type][i][j]['y'] }}">
139                         {% endfor %}
140                         <input type="submit" name="gis_data[{{ a }}][{{ type }}][{{ i }}][add_point]" class="btn btn-secondary add addPoint" value="{% trans 'Add a point' %}">
141                     {% endfor %}
142                     <br>
143                     <input type="submit" name="gis_data[{{ a }}][{{ type }}][add_line]" class="btn btn-secondary add addLine" value="
144                         {{- type == 'MULTILINESTRING' ? 'Add a linestring'|trans : 'Add an inner ring'|trans }}">
145                 {% elseif type == 'MULTIPOLYGON' %}
146                     {% set no_of_polygons = gis_data[a][type]['no_of_polygons'] ?? 1 %}
147                     {% if no_of_polygons < 1 %}
148                         {% set no_of_polygons = 1 %}
149                     {% endif %}
150                     {% if gis_data[a][type]['add_polygon'] is not null %}
151                         {% set no_of_polygons = no_of_polygons + 1 %}
152                     {% endif %}
153                     <input type="hidden" name="gis_data[{{ a }}][{{ type }}][no_of_polygons]" value="{{ no_of_polygons }}">
155                     {% for k in 0..no_of_polygons - 1 %}
156                         <br>
157                         {{ 'Polygon %d:'|trans|format(k + 1) }}
158                         {% set no_of_lines = gis_data[a][type][k]['no_of_lines'] ?? 1 %}
159                         {% if no_of_lines < 1 %}
160                             {% set no_of_lines = 1 %}
161                         {% endif %}
162                         {% if gis_data[a][type][k]['add_line'] is not null %}
163                             {% set no_of_lines = no_of_lines + 1 %}
164                         {% endif %}
165                         <input type="hidden" name="gis_data[{{ a }}][{{ type }}][{{ k }}][no_of_lines]" value="{{ no_of_lines }}">
167                         {% for i in 0..no_of_lines - 1 %}
168                             <br><br>
169                             {% if i == 0 %}
170                                 {% trans 'Outer ring:' %}
171                             {% else %}
172                                 {{ 'Inner ring %d:'|trans|format(i) }}
173                             {% endif %}
175                             {% set no_of_points = gis_data[a][type][k][i]['no_of_points'] ?? 4 %}
176                             {% if no_of_points < 4 %}
177                                 {% set no_of_points = 4 %}
178                             {% endif %}
179                             {% if gis_data[a][type][k][i]['add_point'] is not null %}
180                                 {% set no_of_points = no_of_points + 1 %}
181                             {% endif %}
182                             <input type="hidden" name="gis_data[{{ a }}][{{ type }}][{{ k }}][{{ i }}][no_of_points]" value="{{ no_of_points }}">
184                             {% for j in 0..no_of_points - 1 %}
185                                 <br>
186                                 {{ 'Point %d:'|trans|format(j + 1) }}
187                                 <label for="x">{% trans 'X' %}</label>
188                                 <input type="text" name="gis_data[{{ a }}][{{ type }}][{{ k }}][{{ i }}][{{ j }}][x]" value="{{ gis_data[a][type][k][i][j]['x'] }}">
189                                 <label for="y">{% trans 'Y' %}</label>
190                                 <input type="text" name="gis_data[{{ a }}][{{ type }}][{{ k }}][{{ i }}][{{ j }}][y]" value="{{ gis_data[a][type][k][i][j]['y'] }}">
191                             {% endfor %}
192                             <input type="submit" name="gis_data[{{ a }}][{{ type }}][{{ k }}][{{ i }}][add_point]" class="btn btn-secondary add addPoint" value="{% trans 'Add a point' %}">
193                         {% endfor %}
194                         <br>
195                         <input type="submit" name="gis_data[{{ a }}][{{ type }}][{{ k }}][add_line]" class="btn btn-secondary add addLine" value="{% trans 'Add an inner ring' %}">
196                         <br>
197                     {% endfor %}
198                     <br>
199                     <input type="submit" name="gis_data[{{ a }}][{{ type }}][add_polygon]" class="btn btn-secondary add addPolygon" value="{% trans 'Add a polygon' %}">
200                 {% endif %}
201               {% endif %}
202             {% endfor %}
203             {% if geom_type == 'GEOMETRYCOLLECTION' %}
204                 <br><br>
205                 <input type="submit" name="gis_data[GEOMETRYCOLLECTION][add_geom]" class="btn btn-secondary add addGeom" value="{% trans 'Add geometry' %}">
206             {% endif %}
207         </div>
208         {# End of data section #}
210         <br>
211         <input class="btn btn-primary" type="submit" name="gis_data[save]" value="{% trans 'Go' %}">
213         <div id="gis_data_output">
214             <h3>{% trans 'Output' %}</h3>
215             <p>
216                 {% trans 'Choose "GeomFromText" from the "Function" column and paste the string below into the "Value" field.' %}
217             </p>
218             <textarea id="gis_data_textarea" cols="95" rows="5">{{ result }}</textarea>
219         </div>
220     </div>
221 </form>