1 |
4779c9ce
|
Anděl Ondřej
|
<div id="edit-modal" class="modal fade" role="dialog">
|
2 |
|
|
<div class="modal-dialog modal-dialog-centered modal-lg" role="document">
|
3 |
|
|
<div class="modal-content">
|
4 |
|
|
<div class="modal-header">
|
5 |
|
|
<h4 class="modal-title"></h4>
|
6 |
|
|
<button type="button" class="close" data-dismiss="modal">×</button>
|
7 |
|
|
</div>
|
8 |
|
|
<div class="modal-body">
|
9 |
|
|
<div class="container">
|
10 |
|
|
<div class="row my-1">
|
11 |
|
|
<div class="col-xs-12 col-sm-4">
|
12 |
d99d8a5b
|
Anděl Ondřej
|
<label for="lemma">Lemma: <b class="required">*</b></label>
|
13 |
4779c9ce
|
Anděl Ondřej
|
</div>
|
14 |
|
|
<div class="col-xs-12 col-sm-8">
|
15 |
a5559649
|
Anděl Ondřej
|
<input class="min-wdth" id="lemma"/>
|
16 |
4779c9ce
|
Anděl Ondřej
|
</div>
|
17 |
|
|
</div>
|
18 |
|
|
<div class="row my-1">
|
19 |
|
|
<div class="col-xs-12 col-sm-4">
|
20 |
d99d8a5b
|
Anděl Ondřej
|
<label for="word">Slovo: <b class="required">*</b></label>
|
21 |
4779c9ce
|
Anděl Ondřej
|
</div>
|
22 |
|
|
<div class="col-xs-12 col-sm-8">
|
23 |
a5559649
|
Anděl Ondřej
|
<input class="min-wdth" id="word"/>
|
24 |
4779c9ce
|
Anděl Ondřej
|
</div>
|
25 |
|
|
</div>
|
26 |
|
|
<div class="row my-1">
|
27 |
|
|
<div class="col-xs-12 col-sm-4">
|
28 |
10e26305
|
Anděl Ondřej
|
<label for="manuscript-m">Rukopisy:</label>
|
29 |
4779c9ce
|
Anděl Ondřej
|
</div>
|
30 |
|
|
<div class="col-xs-12 col-sm-8">
|
31 |
10e26305
|
Anděl Ondřej
|
<select id="manuscript-m" multiple>
|
32 |
4779c9ce
|
Anděl Ondřej
|
<option value = "0">rukopis Vídeňský</option>
|
33 |
|
|
<option value = "1">zlomky Hanušovy</option>
|
34 |
|
|
<option value = "2">zlomky Hradecké</option>
|
35 |
|
|
<option value = "3">rukopis Cambridžský</option>
|
36 |
|
|
<option value = "4">rukopis Františkánský</option>
|
37 |
|
|
<option value = "5">zlomek Olomoucký</option>
|
38 |
|
|
<option value = "6">fragment Strahovský</option>
|
39 |
|
|
<option value = "7">zlomky Klementinsko-Křižovnické</option>
|
40 |
|
|
<option value = "8">zlomky Mnichovské</option>
|
41 |
|
|
<option value = "9">rukopis Lobkovický</option>
|
42 |
|
|
<option value = "10">rukopis Pelclův</option>
|
43 |
|
|
<option value = "11">rukopis Cerronský</option>
|
44 |
|
|
<option value = "12">rukopis Fürstenberský</option>
|
45 |
|
|
<option value = "13">rukopis Zebererův</option>
|
46 |
|
|
<option value = "14">vydání Pavla Ješína z Bezdězi, Praha 1620</option>
|
47 |
|
|
<option value = "15">básně připsané při Pulkavově kronice v rukopisu Litoměřickém</option>
|
48 |
10e26305
|
Anděl Ondřej
|
</select>
|
49 |
4779c9ce
|
Anděl Ondřej
|
</div>
|
50 |
|
|
</div>
|
51 |
|
|
<div class="row my-1">
|
52 |
|
|
<div class="col-xs-12 col-sm-4">
|
53 |
d99d8a5b
|
Anděl Ondřej
|
<label for="position">Pozice: <b class="required">*</b></label>
|
54 |
4779c9ce
|
Anděl Ondřej
|
</div>
|
55 |
|
|
<div class="col-xs-12 col-sm-8">
|
56 |
|
|
<input class="min-wdth" id="position" title="Jedotlivé oddíly zadávejte oddělené lomítkem (bez mezery)" />
|
57 |
|
|
</div>
|
58 |
|
|
</div>
|
59 |
|
|
<div class="row my-1">
|
60 |
|
|
<div class="col-xs-12 col-sm-4">
|
61 |
|
|
<label for="namedentity">Vlastní jméno:</label>
|
62 |
|
|
</div>
|
63 |
|
|
<div class="col-xs-12 col-sm-8">
|
64 |
|
|
<input type="checkbox" id="namedentity"/>
|
65 |
|
|
</div>
|
66 |
|
|
</div>
|
67 |
|
|
<div class="row my-1">
|
68 |
|
|
<div class="col-xs-12 col-sm-4">
|
69 |
|
|
<label for="context">Kontext:</label>
|
70 |
|
|
</div>
|
71 |
|
|
<div class="col-xs-12 col-sm-8">
|
72 |
|
|
<input class="min-wdth" id="context"/>
|
73 |
|
|
</div>
|
74 |
|
|
</div>
|
75 |
a5559649
|
Anděl Ondřej
|
<div class="row my-1">
|
76 |
|
|
<div class="col-xs-12 col-sm-4">
|
77 |
|
|
<label for="description">Poznámka 1:</label>
|
78 |
|
|
</div>
|
79 |
|
|
<div class="col-xs-12 col-sm-8">
|
80 |
|
|
<input class="min-wdth" id="description"/>
|
81 |
|
|
</div>
|
82 |
|
|
</div>
|
83 |
|
|
<div class="row my-1">
|
84 |
|
|
<div class="col-xs-12 col-sm-4">
|
85 |
|
|
<label for="description2">Poznámka 2:</label>
|
86 |
|
|
</div>
|
87 |
|
|
<div class="col-xs-12 col-sm-8">
|
88 |
|
|
<input class="min-wdth" id="description2"/>
|
89 |
|
|
</div>
|
90 |
|
|
</div>
|
91 |
|
|
<div class="row my-1">
|
92 |
|
|
<div class="col-xs-12 col-sm-4">
|
93 |
|
|
<label for="description3">Poznámka 3:</label>
|
94 |
|
|
</div>
|
95 |
|
|
<div class="col-xs-12 col-sm-8">
|
96 |
|
|
<input class="min-wdth" id="description3"/>
|
97 |
|
|
</div>
|
98 |
|
|
</div>
|
99 |
4779c9ce
|
Anděl Ondřej
|
<div class="row my-1">
|
100 |
|
|
<div class="col-xs-12 col-sm-4">
|
101 |
d99d8a5b
|
Anděl Ondřej
|
<label for="wordclass">Slovní druh: <b class="required">*</b></label>
|
102 |
4779c9ce
|
Anděl Ondřej
|
</div>
|
103 |
|
|
<div class="col-xs-12 col-sm-8">
|
104 |
|
|
<select class="min-wdth" onchange="changeWordType()" id="wordclass">
|
105 |
a5559649
|
Anděl Ondřej
|
<option selected="selected" value = "">nevybráno</option>
|
106 |
|
|
<option value = "N">substantivum</option>
|
107 |
|
|
<option value = "A">adjektivum</option>
|
108 |
|
|
<option value = "P">pronomen</option>
|
109 |
|
|
<option value = "C">numeralie</option>
|
110 |
|
|
<option value = "V">verbum</option>
|
111 |
|
|
<option value = "D">adverbium</option>
|
112 |
|
|
<option value = "R">prepozice</option>
|
113 |
|
|
<option value = "J">konjunkce</option>
|
114 |
|
|
<option value = "T">partikule</option>
|
115 |
|
|
<option value = "I">interjekce</option>
|
116 |
4779c9ce
|
Anděl Ondřej
|
</select>
|
117 |
|
|
</div>
|
118 |
|
|
</div>
|
119 |
|
|
|
120 |
|
|
<!-- conditional render -->
|
121 |
|
|
<div class="row my-1" id="person-wrapper">
|
122 |
|
|
<div class="col-xs-12 col-sm-4">
|
123 |
|
|
<label for="person">Osoba:</label>
|
124 |
|
|
</div>
|
125 |
|
|
<div class="col-xs-12 col-sm-8">
|
126 |
|
|
<select class="min-wdth" id="person">
|
127 |
a5559649
|
Anděl Ondřej
|
<option selected="selected" value = "">nevybráno</option>
|
128 |
4779c9ce
|
Anděl Ondřej
|
<option value = "1">1.</option>
|
129 |
|
|
<option value = "2">2.</option>
|
130 |
|
|
<option value = "3">3.</option>
|
131 |
|
|
</select>
|
132 |
|
|
</div>
|
133 |
|
|
</div>
|
134 |
|
|
<div class="row my-1" id="case-wrapper">
|
135 |
|
|
<div class="col-xs-12 col-sm-4">
|
136 |
|
|
<label for="case">Pád:</label>
|
137 |
|
|
</div>
|
138 |
|
|
<div class="col-xs-12 col-sm-8">
|
139 |
|
|
<select class="min-wdth" id="case">
|
140 |
a5559649
|
Anděl Ondřej
|
<option selected="selected" value = "">nevybráno</option>
|
141 |
|
|
<option value = "1">nominativ</option>
|
142 |
|
|
<option value = "2">genitiv</option>
|
143 |
|
|
<option value = "3">dativ</option>
|
144 |
|
|
<option value = "4">akuzativ</option>
|
145 |
|
|
<option value = "5">vokativ</option>
|
146 |
|
|
<option value = "6">lokál</option>
|
147 |
|
|
<option value = "7">instrumentál</option>
|
148 |
4779c9ce
|
Anděl Ondřej
|
</select>
|
149 |
|
|
</div>
|
150 |
|
|
</div>
|
151 |
|
|
<div class="row my-1" id="countability-wrapper">
|
152 |
|
|
<div class="col-xs-12 col-sm-4">
|
153 |
|
|
<label for="countability">Číslo:</label>
|
154 |
|
|
</div>
|
155 |
|
|
<div class="col-xs-12 col-sm-8">
|
156 |
|
|
<select class="min-wdth" id="countability">
|
157 |
a5559649
|
Anděl Ondřej
|
<option selected="selected" value = "">nevybráno</option>
|
158 |
|
|
<option value = "S">singulár</option>
|
159 |
|
|
<option value = "P">plurál</option>
|
160 |
|
|
<option value = "D">duál</option>
|
161 |
4779c9ce
|
Anděl Ondřej
|
</select>
|
162 |
|
|
</div>
|
163 |
|
|
</div>
|
164 |
a5559649
|
Anděl Ondřej
|
<div class="row my-1" id="mood-wrapper">
|
165 |
4779c9ce
|
Anděl Ondřej
|
<div class="col-xs-12 col-sm-4">
|
166 |
a5559649
|
Anděl Ondřej
|
<label for="mood">Způsob:</label>
|
167 |
4779c9ce
|
Anděl Ondřej
|
</div>
|
168 |
|
|
<div class="col-xs-12 col-sm-8">
|
169 |
a5559649
|
Anděl Ondřej
|
<select class="min-wdth" id="mood" onchange="moodChange()">
|
170 |
|
|
<option selected="selected" value = "">nevybráno</option>
|
171 |
|
|
<option value = "d">indikativ</option>
|
172 |
|
|
<option value = "i">imperativ</option>
|
173 |
|
|
<option value = "c">kondicionál</option>
|
174 |
4779c9ce
|
Anděl Ondřej
|
</select>
|
175 |
|
|
</div>
|
176 |
|
|
</div>
|
177 |
a5559649
|
Anděl Ondřej
|
<div class="row my-1" id="time-wrapper">
|
178 |
4779c9ce
|
Anděl Ondřej
|
<div class="col-xs-12 col-sm-4">
|
179 |
a5559649
|
Anděl Ondřej
|
<label for="time">Čas:</label>
|
180 |
4779c9ce
|
Anděl Ondřej
|
</div>
|
181 |
|
|
<div class="col-xs-12 col-sm-8">
|
182 |
a5559649
|
Anděl Ondřej
|
<select class="min-wdth" id="time">
|
183 |
|
|
<option selected="selected" value = "">nevybráno</option>
|
184 |
|
|
<option value = "P">prézens</option>
|
185 |
|
|
<option value = "A">aorist</option>
|
186 |
|
|
<option value = "R">préteritum</option>
|
187 |
|
|
<option value = "I">imperfektum</option>
|
188 |
|
|
<option value = "H">plusquamperfektum</option>
|
189 |
|
|
<option value = "F">futurum</option>
|
190 |
4779c9ce
|
Anděl Ondřej
|
</select>
|
191 |
|
|
</div>
|
192 |
|
|
</div>
|
193 |
a5559649
|
Anděl Ondřej
|
<div class="row my-1" id="v-type-wrapper">
|
194 |
4779c9ce
|
Anděl Ondřej
|
<div class="col-xs-12 col-sm-4">
|
195 |
a5559649
|
Anděl Ondřej
|
<label for="v-type">Slovesný rod:</label>
|
196 |
4779c9ce
|
Anděl Ondřej
|
</div>
|
197 |
|
|
<div class="col-xs-12 col-sm-8">
|
198 |
a5559649
|
Anděl Ondřej
|
<select class="min-wdth" id="v-type">
|
199 |
|
|
<option selected="selected" value = "">nevybráno</option>
|
200 |
|
|
<option value = "A">aktivum</option>
|
201 |
|
|
<option value = "P">pasivum</option>
|
202 |
4779c9ce
|
Anděl Ondřej
|
</select>
|
203 |
|
|
</div>
|
204 |
|
|
</div>
|
205 |
a5559649
|
Anděl Ondřej
|
<div class="row my-1" id="vid-wrapper">
|
206 |
4779c9ce
|
Anděl Ondřej
|
<div class="col-xs-12 col-sm-4">
|
207 |
a5559649
|
Anděl Ondřej
|
<label for="vid">Slovesný vid:</label>
|
208 |
4779c9ce
|
Anděl Ondřej
|
</div>
|
209 |
|
|
<div class="col-xs-12 col-sm-8">
|
210 |
a5559649
|
Anděl Ondřej
|
<select class="min-wdth" id="vid">
|
211 |
|
|
<option selected="selected" value = "">nevybráno</option>
|
212 |
|
|
<option value = "P">perfektivum</option>
|
213 |
|
|
<option value = "I">imperfektivum </option>
|
214 |
4779c9ce
|
Anděl Ondřej
|
</select>
|
215 |
|
|
</div>
|
216 |
|
|
</div>
|
217 |
a5559649
|
Anděl Ondřej
|
<div class="row my-1" id="irregular-wrapper">
|
218 |
4779c9ce
|
Anděl Ondřej
|
<div class="col-xs-12 col-sm-4">
|
219 |
a5559649
|
Anděl Ondřej
|
<label for="irregular">Neurčitý slovesný tvar:</label>
|
220 |
4779c9ce
|
Anděl Ondřej
|
</div>
|
221 |
|
|
<div class="col-xs-12 col-sm-8">
|
222 |
a5559649
|
Anděl Ondřej
|
<select class="min-wdth" id="irregular" onchange="irregularChange()">
|
223 |
|
|
<option selected="selected" value = "">nevybráno</option>
|
224 |
|
|
<option value = "f">infinitiv</option>
|
225 |
|
|
<option value = "S">supinum</option>
|
226 |
|
|
<option value = "e">přech. přítomný</option>
|
227 |
|
|
<option value = "m">přech. minulý</option>
|
228 |
|
|
<option value = "A">part. perf. akt.</option>
|
229 |
|
|
<option value = "P">part. perf. pas.</option>
|
230 |
4779c9ce
|
Anděl Ondřej
|
</select>
|
231 |
|
|
</div>
|
232 |
|
|
</div>
|
233 |
a5559649
|
Anděl Ondřej
|
<div class="row my-1" id="gender-wrapper">
|
234 |
4779c9ce
|
Anděl Ondřej
|
<div class="col-xs-12 col-sm-4">
|
235 |
a5559649
|
Anděl Ondřej
|
<label for="gender">Rod:</label>
|
236 |
4779c9ce
|
Anděl Ondřej
|
</div>
|
237 |
|
|
<div class="col-xs-12 col-sm-8">
|
238 |
a5559649
|
Anděl Ondřej
|
<select class="min-wdth" id="gender">
|
239 |
|
|
<option selected="selected" value = "">nevybráno</option>
|
240 |
|
|
<option value = "M">maskulinum</option>
|
241 |
|
|
<option value = "F">femininum</option>
|
242 |
|
|
<option value = "N">neutrum</option>
|
243 |
4779c9ce
|
Anděl Ondřej
|
</select>
|
244 |
|
|
</div>
|
245 |
|
|
</div>
|
246 |
a5559649
|
Anděl Ondřej
|
<div class="row my-1" id="shape-wrapper">
|
247 |
4779c9ce
|
Anděl Ondřej
|
<div class="col-xs-12 col-sm-4">
|
248 |
a5559649
|
Anděl Ondřej
|
<label for="shape">Tvar:</label>
|
249 |
4779c9ce
|
Anděl Ondřej
|
</div>
|
250 |
|
|
<div class="col-xs-12 col-sm-8">
|
251 |
a5559649
|
Anděl Ondřej
|
<select class="min-wdth" id="shape">
|
252 |
|
|
<option selected="selected" value = "">nevybráno</option>
|
253 |
|
|
<option value = "C">složený</option>
|
254 |
|
|
<option value = "N">jmenný</option>
|
255 |
4779c9ce
|
Anděl Ondřej
|
</select>
|
256 |
|
|
</div>
|
257 |
|
|
</div>
|
258 |
a5559649
|
Anděl Ondřej
|
<div class="row my-1" id="grade-wrapper">
|
259 |
4779c9ce
|
Anděl Ondřej
|
<div class="col-xs-12 col-sm-4">
|
260 |
a5559649
|
Anděl Ondřej
|
<label for="grade">Stupeň:</label>
|
261 |
4779c9ce
|
Anděl Ondřej
|
</div>
|
262 |
|
|
<div class="col-xs-12 col-sm-8">
|
263 |
a5559649
|
Anděl Ondřej
|
<select class="min-wdth" id="grade">
|
264 |
|
|
<option selected="selected" value = "">nevybráno</option>
|
265 |
|
|
<option value = "1">pozitiv</option>
|
266 |
|
|
<option value = "2">komparativ</option>
|
267 |
|
|
<option value = "3">superlativ</option>
|
268 |
4779c9ce
|
Anděl Ondřej
|
</select>
|
269 |
|
|
</div>
|
270 |
|
|
</div>
|
271 |
a5559649
|
Anděl Ondřej
|
<div class="row my-1" id="type-wrapper">
|
272 |
4779c9ce
|
Anděl Ondřej
|
<div class="col-xs-12 col-sm-4">
|
273 |
a5559649
|
Anděl Ondřej
|
<label for="type">Druh:</label>
|
274 |
4779c9ce
|
Anděl Ondřej
|
</div>
|
275 |
|
|
<div class="col-xs-12 col-sm-8">
|
276 |
a5559649
|
Anděl Ondřej
|
<select class="min-wdth" id="type">
|
277 |
|
|
<option selected="selected" value = "">nevybráno</option>
|
278 |
|
|
<option value = "P">personalia</option>
|
279 |
|
|
<option value = "S">posesiva</option>
|
280 |
|
|
<option value = "D">demonstrativa</option>
|
281 |
|
|
<option value = "Q">interogativa</option>
|
282 |
|
|
<option value = "J">relativa</option>
|
283 |
|
|
<option value = "Z">indefinita</option>
|
284 |
|
|
<option value = "L">limitativa</option>
|
285 |
|
|
<option value = "W">negativa</option>
|
286 |
4779c9ce
|
Anděl Ondřej
|
</select>
|
287 |
|
|
</div>
|
288 |
|
|
</div>
|
289 |
|
|
<div class="row my-1" id="k-type-wrapper">
|
290 |
|
|
<div class="col-xs-12 col-sm-4">
|
291 |
|
|
<label for="k-type">Typ:</label>
|
292 |
|
|
</div>
|
293 |
|
|
<div class="col-xs-12 col-sm-8">
|
294 |
|
|
<select class="min-wdth" id="k-type">
|
295 |
a5559649
|
Anděl Ondřej
|
<option selected="selected" value = "">nevybráno</option>
|
296 |
|
|
<option value = "V">větná</option>
|
297 |
|
|
<option value = "C">členská</option>
|
298 |
|
|
<option value = "N">navazovací</option>
|
299 |
|
|
<option value = "P">spojení s přechodníkem</option>
|
300 |
4779c9ce
|
Anděl Ondřej
|
</select>
|
301 |
|
|
</div>
|
302 |
|
|
</div>
|
303 |
|
|
</div>
|
304 |
|
|
</div>
|
305 |
|
|
<div class="modal-footer">
|
306 |
|
|
<button type="button" id="submit-but" class="btn btn-default" data-dismiss="modal"></button>
|
307 |
|
|
<button type="button" class="btn btn-default" data-dismiss="modal">Zavřít</button>
|
308 |
|
|
</div>
|
309 |
|
|
</div>
|
310 |
|
|
</div>
|
311 |
|
|
</div>
|
312 |
|
|
|
313 |
|
|
<script>
|
314 |
|
|
$('#edit-modal').on('show.bs.modal', function (event) {
|
315 |
|
|
const button = $(event.relatedTarget);
|
316 |
|
|
const pseudo_id = button.data('pseudo-id');// Extract info from data-* attributes
|
317 |
|
|
const title = button.data('title');// Extract info from data-* attributes
|
318 |
176259e4
|
Anděl Ondřej
|
var $multis = $('#manuscript-m').multiSelect({
|
319 |
a5559649
|
Anděl Ondřej
|
'noneText': 'nevybráno',
|
320 |
10e26305
|
Anděl Ondřej
|
});
|
321 |
4779c9ce
|
Anděl Ondřej
|
|
322 |
|
|
let modal = $(this);
|
323 |
|
|
modal.find('.modal-title').text(title);
|
324 |
|
|
modal.find('#mood').change(() => moodMChange(modal));
|
325 |
|
|
modal.find('#irregular').change(() => irregularMChange(modal));
|
326 |
|
|
|
327 |
|
|
if(title === "Nový záznam"){
|
328 |
|
|
prefill(modal);
|
329 |
|
|
changeWordType();
|
330 |
|
|
modal.find('#submit-but').text("Založit");
|
331 |
|
|
modal.find('#submit-but').click(() => createData(modal));
|
332 |
d99d8a5b
|
Anděl Ondřej
|
|
333 |
|
|
enableSubmit(modal);
|
334 |
|
|
modal.find("#lemma").change(() => enableSubmit(modal));
|
335 |
|
|
modal.find("#word").change(() => enableSubmit(modal));
|
336 |
|
|
modal.find("#position").change(() => enableSubmit(modal));
|
337 |
|
|
modal.find("#wordclass").change(() => enableSubmit(modal));
|
338 |
4779c9ce
|
Anděl Ondřej
|
} else {
|
339 |
|
|
const data_obj = data[pseudo_id];
|
340 |
|
|
modal.find('#submit-but').text("Upravit");
|
341 |
|
|
modal.find('#submit-but').click(() => editData(data_obj, modal));
|
342 |
28f99b6a
|
Anděl Ondřej
|
prefill(modal, data_obj);
|
343 |
4779c9ce
|
Anděl Ondřej
|
changeWordType();
|
344 |
|
|
prefill(modal, data_obj);
|
345 |
|
|
moodMChange(modal);
|
346 |
|
|
irregularMChange(modal);
|
347 |
d99d8a5b
|
Anděl Ondřej
|
|
348 |
|
|
enableSubmit(modal);
|
349 |
|
|
modal.find("#lemma").change(() => enableSubmit(modal));
|
350 |
|
|
modal.find("#word").change(() => enableSubmit(modal));
|
351 |
|
|
modal.find("#position").change(() => enableSubmit(modal));
|
352 |
|
|
modal.find("#wordclass").change(() => enableSubmit(modal));
|
353 |
4779c9ce
|
Anděl Ondřej
|
}
|
354 |
|
|
});
|
355 |
|
|
|
356 |
|
|
function changeWordType() {
|
357 |
|
|
let modal = $('#edit-modal');
|
358 |
|
|
const value = modal.find("#wordclass")[0].value;
|
359 |
|
|
let movedNode;
|
360 |
|
|
let beforeNode;
|
361 |
|
|
switch (value) {
|
362 |
|
|
case "N":
|
363 |
|
|
setElementVisibility([
|
364 |
|
|
true,
|
365 |
|
|
true,
|
366 |
|
|
true,
|
367 |
|
|
false,
|
368 |
|
|
false,
|
369 |
|
|
false,
|
370 |
|
|
false,
|
371 |
|
|
false,
|
372 |
|
|
false,
|
373 |
|
|
false,
|
374 |
|
|
false,
|
375 |
|
|
false,
|
376 |
|
|
false
|
377 |
|
|
], modal);
|
378 |
|
|
movedNode = modal.find("#case-wrapper");
|
379 |
|
|
beforeNode = modal.find("#countability-wrapper");
|
380 |
|
|
beforeNode.before(movedNode);
|
381 |
|
|
break;
|
382 |
|
|
case "A":
|
383 |
|
|
setElementVisibility([
|
384 |
|
|
true,
|
385 |
|
|
true,
|
386 |
|
|
true,
|
387 |
|
|
true,
|
388 |
|
|
true,
|
389 |
|
|
false,
|
390 |
|
|
false,
|
391 |
|
|
false,
|
392 |
|
|
false,
|
393 |
|
|
false,
|
394 |
|
|
false,
|
395 |
|
|
false,
|
396 |
|
|
false
|
397 |
|
|
], modal);
|
398 |
|
|
movedNode = modal.find("#case-wrapper");
|
399 |
|
|
beforeNode = modal.find("#countability-wrapper");
|
400 |
|
|
beforeNode.before(movedNode);
|
401 |
|
|
break;
|
402 |
|
|
case "P":
|
403 |
|
|
setElementVisibility([
|
404 |
|
|
true,
|
405 |
|
|
true,
|
406 |
|
|
true,
|
407 |
|
|
false,
|
408 |
|
|
false,
|
409 |
|
|
true,
|
410 |
|
|
false,
|
411 |
|
|
false,
|
412 |
|
|
false,
|
413 |
|
|
false,
|
414 |
|
|
false,
|
415 |
|
|
false,
|
416 |
|
|
false
|
417 |
|
|
], modal);
|
418 |
|
|
movedNode = modal.find("#case-wrapper");
|
419 |
|
|
beforeNode = modal.find("#countability-wrapper");
|
420 |
|
|
beforeNode.before(movedNode);
|
421 |
|
|
break;
|
422 |
|
|
case "C":
|
423 |
|
|
setElementVisibility([
|
424 |
|
|
true,
|
425 |
|
|
true,
|
426 |
|
|
true,
|
427 |
|
|
false,
|
428 |
|
|
false,
|
429 |
|
|
false,
|
430 |
|
|
false,
|
431 |
|
|
false,
|
432 |
|
|
false,
|
433 |
|
|
false,
|
434 |
|
|
false,
|
435 |
|
|
false,
|
436 |
|
|
false
|
437 |
|
|
], modal);
|
438 |
|
|
movedNode = modal.find("#case-wrapper");
|
439 |
|
|
beforeNode = modal.find("#countability-wrapper");
|
440 |
|
|
beforeNode.before(movedNode);
|
441 |
|
|
break;
|
442 |
|
|
case "V":
|
443 |
|
|
setElementVisibility([
|
444 |
|
|
true,
|
445 |
|
|
true,
|
446 |
|
|
true,
|
447 |
|
|
false,
|
448 |
|
|
false,
|
449 |
|
|
false,
|
450 |
|
|
true,
|
451 |
|
|
true,
|
452 |
|
|
true,
|
453 |
|
|
true,
|
454 |
|
|
true,
|
455 |
|
|
true,
|
456 |
|
|
false
|
457 |
|
|
], modal);
|
458 |
|
|
movedNode = modal.find("#case-wrapper");
|
459 |
|
|
beforeNode = modal.find("#vid-wrapper");
|
460 |
|
|
beforeNode.after(movedNode);
|
461 |
|
|
break;
|
462 |
|
|
case "D":
|
463 |
|
|
setElementVisibility([
|
464 |
|
|
false,
|
465 |
|
|
false,
|
466 |
|
|
false,
|
467 |
|
|
false,
|
468 |
|
|
true,
|
469 |
|
|
false,
|
470 |
|
|
false,
|
471 |
|
|
false,
|
472 |
|
|
false,
|
473 |
|
|
false,
|
474 |
|
|
false,
|
475 |
|
|
false,
|
476 |
|
|
false
|
477 |
|
|
], modal);
|
478 |
|
|
break;
|
479 |
|
|
case "R":
|
480 |
|
|
setElementVisibility([
|
481 |
|
|
true,
|
482 |
|
|
false,
|
483 |
|
|
false,
|
484 |
|
|
false,
|
485 |
|
|
false,
|
486 |
|
|
false,
|
487 |
|
|
false,
|
488 |
|
|
false,
|
489 |
|
|
false,
|
490 |
|
|
false,
|
491 |
|
|
false,
|
492 |
|
|
false,
|
493 |
|
|
false
|
494 |
|
|
], modal);
|
495 |
|
|
break;
|
496 |
|
|
case "J":
|
497 |
|
|
setElementVisibility([
|
498 |
|
|
false,
|
499 |
|
|
false,
|
500 |
|
|
false,
|
501 |
|
|
false,
|
502 |
|
|
false,
|
503 |
|
|
false,
|
504 |
|
|
false,
|
505 |
|
|
false,
|
506 |
|
|
false,
|
507 |
|
|
false,
|
508 |
|
|
false,
|
509 |
|
|
false,
|
510 |
|
|
true
|
511 |
|
|
], modal);
|
512 |
|
|
break;
|
513 |
|
|
case "I":
|
514 |
|
|
setElementVisibility([
|
515 |
|
|
false,
|
516 |
|
|
false,
|
517 |
|
|
false,
|
518 |
|
|
false,
|
519 |
|
|
false,
|
520 |
|
|
false,
|
521 |
|
|
false,
|
522 |
|
|
false,
|
523 |
|
|
false,
|
524 |
|
|
false,
|
525 |
|
|
false,
|
526 |
|
|
false,
|
527 |
|
|
false
|
528 |
|
|
], modal);
|
529 |
|
|
break;
|
530 |
|
|
case "T":
|
531 |
|
|
setElementVisibility([
|
532 |
|
|
false,
|
533 |
|
|
false,
|
534 |
|
|
false,
|
535 |
|
|
false,
|
536 |
|
|
false,
|
537 |
|
|
false,
|
538 |
|
|
false,
|
539 |
|
|
false,
|
540 |
|
|
false,
|
541 |
|
|
false,
|
542 |
|
|
false,
|
543 |
|
|
false,
|
544 |
|
|
false
|
545 |
|
|
], modal);
|
546 |
|
|
break;
|
547 |
|
|
default:
|
548 |
|
|
setElementVisibility([
|
549 |
|
|
false,
|
550 |
|
|
false,
|
551 |
|
|
false,
|
552 |
|
|
false,
|
553 |
|
|
false,
|
554 |
|
|
false,
|
555 |
|
|
false,
|
556 |
|
|
false,
|
557 |
|
|
false,
|
558 |
|
|
false,
|
559 |
|
|
false,
|
560 |
|
|
false,
|
561 |
|
|
false
|
562 |
|
|
], modal);
|
563 |
|
|
break;
|
564 |
|
|
}
|
565 |
|
|
}
|
566 |
|
|
|
567 |
|
|
const dynamicFields = [
|
568 |
|
|
"#case-wrapper",
|
569 |
|
|
"#countability-wrapper",
|
570 |
|
|
"#gender-wrapper",
|
571 |
|
|
"#shape-wrapper",
|
572 |
|
|
"#grade-wrapper",
|
573 |
|
|
"#type-wrapper",
|
574 |
|
|
"#mood-wrapper",
|
575 |
|
|
"#irregular-wrapper",
|
576 |
|
|
"#person-wrapper",
|
577 |
|
|
"#time-wrapper",
|
578 |
|
|
"#vid-wrapper",
|
579 |
|
|
"#v-type-wrapper",
|
580 |
|
|
"#k-type-wrapper"
|
581 |
|
|
];
|
582 |
|
|
|
583 |
|
|
const staticFields = [
|
584 |
|
|
"#word",
|
585 |
|
|
"#lemma",
|
586 |
10e26305
|
Anděl Ondřej
|
"#manuscript-m",
|
587 |
4779c9ce
|
Anděl Ondřej
|
"#position",
|
588 |
|
|
"#namedentity",
|
589 |
|
|
"#context",
|
590 |
a5559649
|
Anděl Ondřej
|
"#description",
|
591 |
|
|
"#description2",
|
592 |
|
|
"#description3",
|
593 |
4779c9ce
|
Anděl Ondřej
|
"#wordclass"
|
594 |
|
|
];
|
595 |
|
|
|
596 |
|
|
function setElementVisibility(visibility, modal) {
|
597 |
|
|
for(let i = 0; i < dynamicFields.length && i < visibility.length; i++){
|
598 |
|
|
if(visibility[i] === true){
|
599 |
|
|
modal.find(dynamicFields[i]).show();
|
600 |
|
|
} else {
|
601 |
|
|
modal.find(dynamicFields[i]).hide();
|
602 |
|
|
}
|
603 |
|
|
modal.find(dynamicFields[i].replace("-wrapper", "")).val("");
|
604 |
|
|
}
|
605 |
|
|
}
|
606 |
|
|
|
607 |
|
|
function prefill(modal, data = null){
|
608 |
|
|
staticFields.forEach((item) => {
|
609 |
|
|
modal.find(item).val("");
|
610 |
|
|
});
|
611 |
|
|
|
612 |
|
|
modal.find("#namedentity").prop('checked', false);
|
613 |
|
|
|
614 |
|
|
dynamicFields.forEach((item) => {
|
615 |
|
|
modal.find(item.replace("-wrapper", "")).val("");
|
616 |
|
|
});
|
617 |
|
|
|
618 |
|
|
if(data !== null){
|
619 |
|
|
modal.find("#context").val(data.context);
|
620 |
a5559649
|
Anděl Ondřej
|
modal.find("#description").val(data.description);
|
621 |
|
|
modal.find("#description2").val(data.description2);
|
622 |
|
|
modal.find("#description3").val(data.description3);
|
623 |
4779c9ce
|
Anděl Ondřej
|
modal.find("#namedentity").prop('checked', data.namedentity === 1);
|
624 |
|
|
|
625 |
|
|
let position = data.position1;
|
626 |
|
|
position += ((data.position2 !== null && data.position2.length > 0) ? ("/" + data.position2) : "");
|
627 |
|
|
position += ((data.positiondetail !== null && data.positiondetail.length > 0) ? ("/" + data.positiondetail) : "");
|
628 |
|
|
modal.find("#position").val(position);
|
629 |
|
|
|
630 |
|
|
modal.find("#word").val(data.word);
|
631 |
|
|
modal.find("#lemma").val(data.lemma.lemma);
|
632 |
176259e4
|
Anděl Ondřej
|
modal.find("#manuscript-m").val(data.manuscript);//TODO not sure if this one works... kinda does what it wants
|
633 |
4779c9ce
|
Anděl Ondřej
|
|
634 |
|
|
//dynamic setting
|
635 |
|
|
const morphem = data.tag.tag;
|
636 |
|
|
const wordclass = morphem.charAt(0);
|
637 |
|
|
modal.find("#wordclass").val(wordclass);
|
638 |
|
|
modal.find("#case").val((morphem.charAt(1) !== '-') ? morphem.charAt(1) : "");
|
639 |
|
|
modal.find("#countability").val((morphem.charAt(2) !== '-') ? morphem.charAt(2) : "");
|
640 |
|
|
modal.find("#gender").val((morphem.charAt(3) !== '-') ? morphem.charAt(3) : "");
|
641 |
|
|
modal.find("#grade").val((morphem.charAt(4) !== '-') ? morphem.charAt(4) : "");
|
642 |
|
|
modal.find("#shape").val((morphem.charAt(5) !== '-') ? morphem.charAt(5) : "");
|
643 |
|
|
|
644 |
|
|
if(morphem.charAt(7) !== '-'){
|
645 |
|
|
if(wordclass === 'J'){
|
646 |
|
|
modal.find("#k-type").val(morphem.charAt(7));
|
647 |
|
|
} else if(wordclass === 'P'){
|
648 |
|
|
modal.find("#type").val(morphem.charAt(7));
|
649 |
|
|
} else if(wordclass === 'V'){
|
650 |
|
|
if(codeToMood[morphem.charAt(7)] !== undefined) {
|
651 |
|
|
modal.find("#mood").val(morphem.charAt(7));
|
652 |
|
|
} else {
|
653 |
|
|
modal.find("#irregular").val(morphem.charAt(7));
|
654 |
|
|
}
|
655 |
|
|
}
|
656 |
|
|
}
|
657 |
|
|
|
658 |
|
|
modal.find("#person").val((morphem.charAt(8) !== '-') ? morphem.charAt(8) : "");
|
659 |
|
|
modal.find("#time").val((morphem.charAt(9) !== '-') ? morphem.charAt(9) : "");
|
660 |
|
|
modal.find("#v-type").val((morphem.charAt(10) !== '-') ? morphem.charAt(10) : "");
|
661 |
|
|
modal.find("#vid").val((morphem.charAt(11) !== '-') ? morphem.charAt(11) : "");
|
662 |
|
|
}
|
663 |
|
|
}
|
664 |
|
|
|
665 |
d99d8a5b
|
Anděl Ondřej
|
function enableSubmit(modal) {
|
666 |
|
|
if (
|
667 |
|
|
modal.find("#lemma")[0].value === "" ||
|
668 |
|
|
modal.find("#word")[0].value === "" ||
|
669 |
|
|
modal.find("#position")[0].value === "" ||
|
670 |
|
|
modal.find("#wordclass")[0].value === ""
|
671 |
|
|
) {
|
672 |
|
|
modal.find("#submit-but").prop("disabled", true);
|
673 |
|
|
} else {
|
674 |
|
|
modal.find("#submit-but").prop("disabled", false);
|
675 |
|
|
}
|
676 |
|
|
}
|
677 |
|
|
|
678 |
4779c9ce
|
Anděl Ondřej
|
function editData(data, modal){
|
679 |
|
|
const formData = prepareFormData(modal);
|
680 |
|
|
formData.append("id", data.id);
|
681 |
|
|
|
682 |
|
|
formData.append("ending", data.ending);
|
683 |
|
|
formData.append("finished", data.finished);
|
684 |
|
|
formData.append("prefix", data.prefix);
|
685 |
|
|
formData.append("suffix", data.suffix);
|
686 |
|
|
|
687 |
|
|
var xhr = new XMLHttpRequest();
|
688 |
|
|
xhr.open("POST", "./controller/UpdateController.php");
|
689 |
|
|
xhr.send(formData);
|
690 |
28f99b6a
|
Anděl Ondřej
|
setTimeout(function(){
|
691 |
|
|
location.reload();
|
692 |
|
|
}, 500);
|
693 |
4779c9ce
|
Anděl Ondřej
|
}
|
694 |
|
|
|
695 |
|
|
function prepareFormData(modal) {
|
696 |
|
|
const formData = new FormData();
|
697 |
|
|
|
698 |
|
|
formData.append("namedentity", (modal.find("#namedentity")[0].checked) ? "1" : "0");
|
699 |
|
|
|
700 |
|
|
const position = modal.find("#position")[0].value.split("/");
|
701 |
|
|
formData.append("position1", position[0]);
|
702 |
|
|
formData.append("position2", (position[1] !== undefined) ? position[1] : "");
|
703 |
|
|
formData.append("positiondetail", (position[2] !== undefined) ? position[2] : "");
|
704 |
|
|
|
705 |
|
|
formData.append("word", modal.find("#word")[0].value);
|
706 |
|
|
formData.append("lemma", modal.find("#lemma")[0].value);
|
707 |
176259e4
|
Anděl Ondřej
|
|
708 |
|
|
//this is to get data from manuscript --> possible better?
|
709 |
|
|
var elements = modal.find("#manuscript-m").data('multiSelectContainer').find('input:checked');
|
710 |
|
|
let ms_value = [];
|
711 |
|
|
Object.values(elements).forEach((item) => {
|
712 |
|
|
if(item.value !== undefined){
|
713 |
|
|
ms_value.push(""+item.value);
|
714 |
|
|
}
|
715 |
|
|
});
|
716 |
|
|
|
717 |
|
|
formData.append("manuscript", ms_value.join());
|
718 |
4779c9ce
|
Anděl Ondřej
|
formData.append("context", modal.find("#context")[0].value);
|
719 |
a5559649
|
Anděl Ondřej
|
formData.append("description", modal.find("#description")[0].value);
|
720 |
|
|
formData.append("description2", modal.find("#description2")[0].value);
|
721 |
|
|
formData.append("description3", modal.find("#description3")[0].value);
|
722 |
4779c9ce
|
Anděl Ondřej
|
|
723 |
|
|
//morphem creation
|
724 |
|
|
let morphem = "";
|
725 |
|
|
const wordClass = modal.find("#wordclass")[0].value;
|
726 |
28f99b6a
|
Anděl Ondřej
|
morphem += ((wordClass.length > 0) ? wordClass : "-");
|
727 |
4779c9ce
|
Anděl Ondřej
|
morphem += ((modal.find("#case")[0].value.length > 0) ? modal.find("#case")[0].value : "-");
|
728 |
|
|
morphem += ((modal.find("#countability")[0].value.length > 0) ? modal.find("#countability")[0].value : "-");
|
729 |
|
|
morphem += ((modal.find("#gender")[0].value.length > 0) ? modal.find("#gender")[0].value : "-");
|
730 |
|
|
morphem += ((modal.find("#grade")[0].value.length > 0) ? modal.find("#grade")[0].value : "-");
|
731 |
|
|
morphem += ((modal.find("#shape")[0].value.length > 0) ? modal.find("#shape")[0].value : "-");
|
732 |
|
|
morphem += "-";
|
733 |
|
|
|
734 |
|
|
if(wordClass === "J"){
|
735 |
|
|
morphem += ((modal.find("#k-type")[0].value.length > 0) ? modal.find("#k-type")[0].value : "-");
|
736 |
|
|
} else if(wordClass === "P") {
|
737 |
|
|
morphem += ((modal.find("#type")[0].value.length > 0) ? modal.find("#type")[0].value : "-");
|
738 |
|
|
} else if(wordClass === "V"){
|
739 |
|
|
const value1 = modal.find("#mood")[0].value;
|
740 |
|
|
const value2 = modal.find("#irregular")[0].value;
|
741 |
|
|
if(value1.length > 0){
|
742 |
|
|
morphem += value1;
|
743 |
|
|
} else if(value2.length > 0){
|
744 |
|
|
morphem += value2;
|
745 |
|
|
} else {
|
746 |
|
|
morphem += "-";
|
747 |
|
|
}
|
748 |
|
|
} else {
|
749 |
|
|
morphem += "-";
|
750 |
|
|
}
|
751 |
|
|
|
752 |
|
|
morphem += ((modal.find("#person")[0].value.length > 0) ? modal.find("#person")[0].value : "-");
|
753 |
|
|
morphem += ((modal.find("#time")[0].value.length > 0) ? modal.find("#time")[0].value : "-");
|
754 |
|
|
morphem += ((modal.find("#v-type")[0].value.length > 0) ? modal.find("#v-type")[0].value : "-");
|
755 |
|
|
morphem += ((modal.find("#vid")[0].value.length > 0) ? modal.find("#vid")[0].value : "-");
|
756 |
|
|
formData.append("tag", morphem);
|
757 |
|
|
formData.append("pos", wordclassToNum[wordClass]);
|
758 |
|
|
|
759 |
|
|
return formData;
|
760 |
|
|
}
|
761 |
|
|
|
762 |
|
|
function moodMChange(modal) {
|
763 |
|
|
if(modal.find("#mood")[0].value !== ""){
|
764 |
|
|
modal.find("#irregular").prop('disabled', true);
|
765 |
|
|
modal.find("#irregular").prop('title', "Neurčitý slovesný tvar smí být nastaven pouze není-li nastaven způsob");
|
766 |
|
|
} else {
|
767 |
|
|
modal.find("#irregular").prop('disabled', false);
|
768 |
|
|
modal.find("#irregular").prop('title', "");
|
769 |
|
|
}
|
770 |
|
|
}
|
771 |
|
|
|
772 |
|
|
function irregularMChange(modal) {
|
773 |
|
|
if(modal.find("#irregular")[0].value !== ""){
|
774 |
|
|
modal.find("#mood").prop('disabled', true);
|
775 |
|
|
modal.find("#mood").prop('title', "Způsob smí být nastaven pouze není-li nastaven neurčitý slovesný tvar");
|
776 |
|
|
} else {
|
777 |
|
|
modal.find("#mood").prop('disabled', false);
|
778 |
|
|
modal.find("#mood").prop('title', "");
|
779 |
|
|
}
|
780 |
|
|
}
|
781 |
|
|
|
782 |
|
|
function createData(modal){
|
783 |
|
|
const formData = prepareFormData(modal);
|
784 |
|
|
|
785 |
|
|
formData.append("finished", false);
|
786 |
|
|
|
787 |
|
|
var xhr = new XMLHttpRequest();
|
788 |
176259e4
|
Anděl Ondřej
|
xhr.open("POST", "./controller/InsertController.php");
|
789 |
4779c9ce
|
Anděl Ondřej
|
xhr.send(formData);
|
790 |
28f99b6a
|
Anděl Ondřej
|
setTimeout(function(){
|
791 |
|
|
location.reload();
|
792 |
|
|
}, 500);
|
793 |
4779c9ce
|
Anděl Ondřej
|
}
|
794 |
|
|
</script>
|