1
|
<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
|
<label for="lemma">Lemma:</label>
|
13
|
</div>
|
14
|
<div class="col-xs-12 col-sm-8">
|
15
|
<input class="min-wdth" id="lemma"/>
|
16
|
</div>
|
17
|
</div>
|
18
|
<div class="row my-1">
|
19
|
<div class="col-xs-12 col-sm-4">
|
20
|
<label for="word">Slovo:</label>
|
21
|
</div>
|
22
|
<div class="col-xs-12 col-sm-8">
|
23
|
<input class="min-wdth" id="word"/>
|
24
|
</div>
|
25
|
</div>
|
26
|
<div class="row my-1">
|
27
|
<div class="col-xs-12 col-sm-4">
|
28
|
<label for="manuscript-m">Rukopisy:</label>
|
29
|
</div>
|
30
|
<div class="col-xs-12 col-sm-8">
|
31
|
<select id="manuscript-m" multiple>
|
32
|
<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
|
</select>
|
49
|
</div>
|
50
|
</div>
|
51
|
<div class="row my-1">
|
52
|
<div class="col-xs-12 col-sm-4">
|
53
|
<label for="position">Pozice:</label>
|
54
|
</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
|
<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
|
<div class="row my-1">
|
100
|
<div class="col-xs-12 col-sm-4">
|
101
|
<label for="wordclass">Slovní druh:</label>
|
102
|
</div>
|
103
|
<div class="col-xs-12 col-sm-8">
|
104
|
<select class="min-wdth" onchange="changeWordType()" id="wordclass">
|
105
|
<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
|
</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
|
<option selected="selected" value = "">nevybráno</option>
|
128
|
<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
|
<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
|
</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
|
<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
|
</select>
|
162
|
</div>
|
163
|
</div>
|
164
|
<div class="row my-1" id="mood-wrapper">
|
165
|
<div class="col-xs-12 col-sm-4">
|
166
|
<label for="mood">Způsob:</label>
|
167
|
</div>
|
168
|
<div class="col-xs-12 col-sm-8">
|
169
|
<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
|
</select>
|
175
|
</div>
|
176
|
</div>
|
177
|
<div class="row my-1" id="time-wrapper">
|
178
|
<div class="col-xs-12 col-sm-4">
|
179
|
<label for="time">Čas:</label>
|
180
|
</div>
|
181
|
<div class="col-xs-12 col-sm-8">
|
182
|
<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
|
</select>
|
191
|
</div>
|
192
|
</div>
|
193
|
<div class="row my-1" id="v-type-wrapper">
|
194
|
<div class="col-xs-12 col-sm-4">
|
195
|
<label for="v-type">Slovesný rod:</label>
|
196
|
</div>
|
197
|
<div class="col-xs-12 col-sm-8">
|
198
|
<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
|
</select>
|
203
|
</div>
|
204
|
</div>
|
205
|
<div class="row my-1" id="vid-wrapper">
|
206
|
<div class="col-xs-12 col-sm-4">
|
207
|
<label for="vid">Slovesný vid:</label>
|
208
|
</div>
|
209
|
<div class="col-xs-12 col-sm-8">
|
210
|
<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
|
</select>
|
215
|
</div>
|
216
|
</div>
|
217
|
<div class="row my-1" id="irregular-wrapper">
|
218
|
<div class="col-xs-12 col-sm-4">
|
219
|
<label for="irregular">Neurčitý slovesný tvar:</label>
|
220
|
</div>
|
221
|
<div class="col-xs-12 col-sm-8">
|
222
|
<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
|
</select>
|
231
|
</div>
|
232
|
</div>
|
233
|
<div class="row my-1" id="gender-wrapper">
|
234
|
<div class="col-xs-12 col-sm-4">
|
235
|
<label for="gender">Rod:</label>
|
236
|
</div>
|
237
|
<div class="col-xs-12 col-sm-8">
|
238
|
<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
|
</select>
|
244
|
</div>
|
245
|
</div>
|
246
|
<div class="row my-1" id="shape-wrapper">
|
247
|
<div class="col-xs-12 col-sm-4">
|
248
|
<label for="shape">Tvar:</label>
|
249
|
</div>
|
250
|
<div class="col-xs-12 col-sm-8">
|
251
|
<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
|
</select>
|
256
|
</div>
|
257
|
</div>
|
258
|
<div class="row my-1" id="grade-wrapper">
|
259
|
<div class="col-xs-12 col-sm-4">
|
260
|
<label for="grade">Stupeň:</label>
|
261
|
</div>
|
262
|
<div class="col-xs-12 col-sm-8">
|
263
|
<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
|
</select>
|
269
|
</div>
|
270
|
</div>
|
271
|
<div class="row my-1" id="type-wrapper">
|
272
|
<div class="col-xs-12 col-sm-4">
|
273
|
<label for="type">Druh:</label>
|
274
|
</div>
|
275
|
<div class="col-xs-12 col-sm-8">
|
276
|
<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
|
</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
|
<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
|
</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
|
var $multis = $('#manuscript-m').multiSelect({
|
319
|
'noneText': 'nevybráno',
|
320
|
});
|
321
|
|
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
|
} else {
|
333
|
const data_obj = data[pseudo_id];
|
334
|
modal.find('#submit-but').text("Upravit");
|
335
|
modal.find('#submit-but').click(() => editData(data_obj, modal));
|
336
|
prefill(modal, data_obj);
|
337
|
changeWordType();
|
338
|
prefill(modal, data_obj);
|
339
|
moodMChange(modal);
|
340
|
irregularMChange(modal);
|
341
|
}
|
342
|
});
|
343
|
|
344
|
function changeWordType() {
|
345
|
let modal = $('#edit-modal');
|
346
|
const value = modal.find("#wordclass")[0].value;
|
347
|
let movedNode;
|
348
|
let beforeNode;
|
349
|
switch (value) {
|
350
|
case "N":
|
351
|
setElementVisibility([
|
352
|
true,
|
353
|
true,
|
354
|
true,
|
355
|
false,
|
356
|
false,
|
357
|
false,
|
358
|
false,
|
359
|
false,
|
360
|
false,
|
361
|
false,
|
362
|
false,
|
363
|
false,
|
364
|
false
|
365
|
], modal);
|
366
|
movedNode = modal.find("#case-wrapper");
|
367
|
beforeNode = modal.find("#countability-wrapper");
|
368
|
beforeNode.before(movedNode);
|
369
|
break;
|
370
|
case "A":
|
371
|
setElementVisibility([
|
372
|
true,
|
373
|
true,
|
374
|
true,
|
375
|
true,
|
376
|
true,
|
377
|
false,
|
378
|
false,
|
379
|
false,
|
380
|
false,
|
381
|
false,
|
382
|
false,
|
383
|
false,
|
384
|
false
|
385
|
], modal);
|
386
|
movedNode = modal.find("#case-wrapper");
|
387
|
beforeNode = modal.find("#countability-wrapper");
|
388
|
beforeNode.before(movedNode);
|
389
|
break;
|
390
|
case "P":
|
391
|
setElementVisibility([
|
392
|
true,
|
393
|
true,
|
394
|
true,
|
395
|
false,
|
396
|
false,
|
397
|
true,
|
398
|
false,
|
399
|
false,
|
400
|
false,
|
401
|
false,
|
402
|
false,
|
403
|
false,
|
404
|
false
|
405
|
], modal);
|
406
|
movedNode = modal.find("#case-wrapper");
|
407
|
beforeNode = modal.find("#countability-wrapper");
|
408
|
beforeNode.before(movedNode);
|
409
|
break;
|
410
|
case "C":
|
411
|
setElementVisibility([
|
412
|
true,
|
413
|
true,
|
414
|
true,
|
415
|
false,
|
416
|
false,
|
417
|
false,
|
418
|
false,
|
419
|
false,
|
420
|
false,
|
421
|
false,
|
422
|
false,
|
423
|
false,
|
424
|
false
|
425
|
], modal);
|
426
|
movedNode = modal.find("#case-wrapper");
|
427
|
beforeNode = modal.find("#countability-wrapper");
|
428
|
beforeNode.before(movedNode);
|
429
|
break;
|
430
|
case "V":
|
431
|
setElementVisibility([
|
432
|
true,
|
433
|
true,
|
434
|
true,
|
435
|
false,
|
436
|
false,
|
437
|
false,
|
438
|
true,
|
439
|
true,
|
440
|
true,
|
441
|
true,
|
442
|
true,
|
443
|
true,
|
444
|
false
|
445
|
], modal);
|
446
|
movedNode = modal.find("#case-wrapper");
|
447
|
beforeNode = modal.find("#vid-wrapper");
|
448
|
beforeNode.after(movedNode);
|
449
|
break;
|
450
|
case "D":
|
451
|
setElementVisibility([
|
452
|
false,
|
453
|
false,
|
454
|
false,
|
455
|
false,
|
456
|
true,
|
457
|
false,
|
458
|
false,
|
459
|
false,
|
460
|
false,
|
461
|
false,
|
462
|
false,
|
463
|
false,
|
464
|
false
|
465
|
], modal);
|
466
|
break;
|
467
|
case "R":
|
468
|
setElementVisibility([
|
469
|
true,
|
470
|
false,
|
471
|
false,
|
472
|
false,
|
473
|
false,
|
474
|
false,
|
475
|
false,
|
476
|
false,
|
477
|
false,
|
478
|
false,
|
479
|
false,
|
480
|
false,
|
481
|
false
|
482
|
], modal);
|
483
|
break;
|
484
|
case "J":
|
485
|
setElementVisibility([
|
486
|
false,
|
487
|
false,
|
488
|
false,
|
489
|
false,
|
490
|
false,
|
491
|
false,
|
492
|
false,
|
493
|
false,
|
494
|
false,
|
495
|
false,
|
496
|
false,
|
497
|
false,
|
498
|
true
|
499
|
], modal);
|
500
|
break;
|
501
|
case "I":
|
502
|
setElementVisibility([
|
503
|
false,
|
504
|
false,
|
505
|
false,
|
506
|
false,
|
507
|
false,
|
508
|
false,
|
509
|
false,
|
510
|
false,
|
511
|
false,
|
512
|
false,
|
513
|
false,
|
514
|
false,
|
515
|
false
|
516
|
], modal);
|
517
|
break;
|
518
|
case "T":
|
519
|
setElementVisibility([
|
520
|
false,
|
521
|
false,
|
522
|
false,
|
523
|
false,
|
524
|
false,
|
525
|
false,
|
526
|
false,
|
527
|
false,
|
528
|
false,
|
529
|
false,
|
530
|
false,
|
531
|
false,
|
532
|
false
|
533
|
], modal);
|
534
|
break;
|
535
|
default:
|
536
|
setElementVisibility([
|
537
|
false,
|
538
|
false,
|
539
|
false,
|
540
|
false,
|
541
|
false,
|
542
|
false,
|
543
|
false,
|
544
|
false,
|
545
|
false,
|
546
|
false,
|
547
|
false,
|
548
|
false,
|
549
|
false
|
550
|
], modal);
|
551
|
break;
|
552
|
}
|
553
|
}
|
554
|
|
555
|
const dynamicFields = [
|
556
|
"#case-wrapper",
|
557
|
"#countability-wrapper",
|
558
|
"#gender-wrapper",
|
559
|
"#shape-wrapper",
|
560
|
"#grade-wrapper",
|
561
|
"#type-wrapper",
|
562
|
"#mood-wrapper",
|
563
|
"#irregular-wrapper",
|
564
|
"#person-wrapper",
|
565
|
"#time-wrapper",
|
566
|
"#vid-wrapper",
|
567
|
"#v-type-wrapper",
|
568
|
"#k-type-wrapper"
|
569
|
];
|
570
|
|
571
|
const staticFields = [
|
572
|
"#word",
|
573
|
"#lemma",
|
574
|
"#manuscript-m",
|
575
|
"#position",
|
576
|
"#namedentity",
|
577
|
"#context",
|
578
|
"#description",
|
579
|
"#description2",
|
580
|
"#description3",
|
581
|
"#wordclass"
|
582
|
];
|
583
|
|
584
|
function setElementVisibility(visibility, modal) {
|
585
|
for(let i = 0; i < dynamicFields.length && i < visibility.length; i++){
|
586
|
if(visibility[i] === true){
|
587
|
modal.find(dynamicFields[i]).show();
|
588
|
} else {
|
589
|
modal.find(dynamicFields[i]).hide();
|
590
|
}
|
591
|
modal.find(dynamicFields[i].replace("-wrapper", "")).val("");
|
592
|
}
|
593
|
}
|
594
|
|
595
|
function prefill(modal, data = null){
|
596
|
staticFields.forEach((item) => {
|
597
|
modal.find(item).val("");
|
598
|
});
|
599
|
|
600
|
modal.find("#namedentity").prop('checked', false);
|
601
|
|
602
|
dynamicFields.forEach((item) => {
|
603
|
modal.find(item.replace("-wrapper", "")).val("");
|
604
|
});
|
605
|
|
606
|
if(data !== null){
|
607
|
modal.find("#context").val(data.context);
|
608
|
modal.find("#description").val(data.description);
|
609
|
modal.find("#description2").val(data.description2);
|
610
|
modal.find("#description3").val(data.description3);
|
611
|
modal.find("#namedentity").prop('checked', data.namedentity === 1);
|
612
|
|
613
|
let position = data.position1;
|
614
|
position += ((data.position2 !== null && data.position2.length > 0) ? ("/" + data.position2) : "");
|
615
|
position += ((data.positiondetail !== null && data.positiondetail.length > 0) ? ("/" + data.positiondetail) : "");
|
616
|
modal.find("#position").val(position);
|
617
|
|
618
|
modal.find("#word").val(data.word);
|
619
|
modal.find("#lemma").val(data.lemma.lemma);
|
620
|
modal.find("#manuscript-m").val(data.manuscript);//TODO not sure if this one works... kinda does what it wants
|
621
|
|
622
|
//dynamic setting
|
623
|
const morphem = data.tag.tag;
|
624
|
const wordclass = morphem.charAt(0);
|
625
|
modal.find("#wordclass").val(wordclass);
|
626
|
modal.find("#case").val((morphem.charAt(1) !== '-') ? morphem.charAt(1) : "");
|
627
|
modal.find("#countability").val((morphem.charAt(2) !== '-') ? morphem.charAt(2) : "");
|
628
|
modal.find("#gender").val((morphem.charAt(3) !== '-') ? morphem.charAt(3) : "");
|
629
|
modal.find("#grade").val((morphem.charAt(4) !== '-') ? morphem.charAt(4) : "");
|
630
|
modal.find("#shape").val((morphem.charAt(5) !== '-') ? morphem.charAt(5) : "");
|
631
|
|
632
|
if(morphem.charAt(7) !== '-'){
|
633
|
if(wordclass === 'J'){
|
634
|
modal.find("#k-type").val(morphem.charAt(7));
|
635
|
} else if(wordclass === 'P'){
|
636
|
modal.find("#type").val(morphem.charAt(7));
|
637
|
} else if(wordclass === 'V'){
|
638
|
if(codeToMood[morphem.charAt(7)] !== undefined) {
|
639
|
modal.find("#mood").val(morphem.charAt(7));
|
640
|
} else {
|
641
|
modal.find("#irregular").val(morphem.charAt(7));
|
642
|
}
|
643
|
}
|
644
|
}
|
645
|
|
646
|
modal.find("#person").val((morphem.charAt(8) !== '-') ? morphem.charAt(8) : "");
|
647
|
modal.find("#time").val((morphem.charAt(9) !== '-') ? morphem.charAt(9) : "");
|
648
|
modal.find("#v-type").val((morphem.charAt(10) !== '-') ? morphem.charAt(10) : "");
|
649
|
modal.find("#vid").val((morphem.charAt(11) !== '-') ? morphem.charAt(11) : "");
|
650
|
}
|
651
|
}
|
652
|
|
653
|
function editData(data, modal){
|
654
|
const formData = prepareFormData(modal);
|
655
|
formData.append("id", data.id);
|
656
|
|
657
|
formData.append("ending", data.ending);
|
658
|
formData.append("finished", data.finished);
|
659
|
formData.append("prefix", data.prefix);
|
660
|
formData.append("suffix", data.suffix);
|
661
|
|
662
|
var xhr = new XMLHttpRequest();
|
663
|
xhr.open("POST", "./controller/UpdateController.php");
|
664
|
xhr.send(formData);
|
665
|
setTimeout(function(){
|
666
|
location.reload();
|
667
|
}, 500);
|
668
|
}
|
669
|
|
670
|
function prepareFormData(modal) {
|
671
|
const formData = new FormData();
|
672
|
|
673
|
formData.append("namedentity", (modal.find("#namedentity")[0].checked) ? "1" : "0");
|
674
|
|
675
|
const position = modal.find("#position")[0].value.split("/");
|
676
|
formData.append("position1", position[0]);
|
677
|
formData.append("position2", (position[1] !== undefined) ? position[1] : "");
|
678
|
formData.append("positiondetail", (position[2] !== undefined) ? position[2] : "");
|
679
|
|
680
|
formData.append("word", modal.find("#word")[0].value);
|
681
|
formData.append("lemma", modal.find("#lemma")[0].value);
|
682
|
|
683
|
//this is to get data from manuscript --> possible better?
|
684
|
var elements = modal.find("#manuscript-m").data('multiSelectContainer').find('input:checked');
|
685
|
let ms_value = [];
|
686
|
Object.values(elements).forEach((item) => {
|
687
|
if(item.value !== undefined){
|
688
|
ms_value.push(""+item.value);
|
689
|
}
|
690
|
});
|
691
|
|
692
|
formData.append("manuscript", ms_value.join());
|
693
|
formData.append("context", modal.find("#context")[0].value);
|
694
|
formData.append("description", modal.find("#description")[0].value);
|
695
|
formData.append("description2", modal.find("#description2")[0].value);
|
696
|
formData.append("description3", modal.find("#description3")[0].value);
|
697
|
|
698
|
//morphem creation
|
699
|
let morphem = "";
|
700
|
const wordClass = modal.find("#wordclass")[0].value;
|
701
|
morphem += ((wordClass.length > 0) ? wordClass : "-");
|
702
|
morphem += ((modal.find("#case")[0].value.length > 0) ? modal.find("#case")[0].value : "-");
|
703
|
morphem += ((modal.find("#countability")[0].value.length > 0) ? modal.find("#countability")[0].value : "-");
|
704
|
morphem += ((modal.find("#gender")[0].value.length > 0) ? modal.find("#gender")[0].value : "-");
|
705
|
morphem += ((modal.find("#grade")[0].value.length > 0) ? modal.find("#grade")[0].value : "-");
|
706
|
morphem += ((modal.find("#shape")[0].value.length > 0) ? modal.find("#shape")[0].value : "-");
|
707
|
morphem += "-";
|
708
|
|
709
|
if(wordClass === "J"){
|
710
|
morphem += ((modal.find("#k-type")[0].value.length > 0) ? modal.find("#k-type")[0].value : "-");
|
711
|
} else if(wordClass === "P") {
|
712
|
morphem += ((modal.find("#type")[0].value.length > 0) ? modal.find("#type")[0].value : "-");
|
713
|
} else if(wordClass === "V"){
|
714
|
const value1 = modal.find("#mood")[0].value;
|
715
|
const value2 = modal.find("#irregular")[0].value;
|
716
|
if(value1.length > 0){
|
717
|
morphem += value1;
|
718
|
} else if(value2.length > 0){
|
719
|
morphem += value2;
|
720
|
} else {
|
721
|
morphem += "-";
|
722
|
}
|
723
|
} else {
|
724
|
morphem += "-";
|
725
|
}
|
726
|
|
727
|
morphem += ((modal.find("#person")[0].value.length > 0) ? modal.find("#person")[0].value : "-");
|
728
|
morphem += ((modal.find("#time")[0].value.length > 0) ? modal.find("#time")[0].value : "-");
|
729
|
morphem += ((modal.find("#v-type")[0].value.length > 0) ? modal.find("#v-type")[0].value : "-");
|
730
|
morphem += ((modal.find("#vid")[0].value.length > 0) ? modal.find("#vid")[0].value : "-");
|
731
|
formData.append("tag", morphem);
|
732
|
formData.append("pos", wordclassToNum[wordClass]);
|
733
|
|
734
|
return formData;
|
735
|
}
|
736
|
|
737
|
function moodMChange(modal) {
|
738
|
if(modal.find("#mood")[0].value !== ""){
|
739
|
modal.find("#irregular").prop('disabled', true);
|
740
|
modal.find("#irregular").prop('title', "Neurčitý slovesný tvar smí být nastaven pouze není-li nastaven způsob");
|
741
|
} else {
|
742
|
modal.find("#irregular").prop('disabled', false);
|
743
|
modal.find("#irregular").prop('title', "");
|
744
|
}
|
745
|
}
|
746
|
|
747
|
function irregularMChange(modal) {
|
748
|
if(modal.find("#irregular")[0].value !== ""){
|
749
|
modal.find("#mood").prop('disabled', true);
|
750
|
modal.find("#mood").prop('title', "Způsob smí být nastaven pouze není-li nastaven neurčitý slovesný tvar");
|
751
|
} else {
|
752
|
modal.find("#mood").prop('disabled', false);
|
753
|
modal.find("#mood").prop('title', "");
|
754
|
}
|
755
|
}
|
756
|
|
757
|
function createData(modal){
|
758
|
const formData = prepareFormData(modal);
|
759
|
|
760
|
formData.append("finished", false);
|
761
|
|
762
|
var xhr = new XMLHttpRequest();
|
763
|
xhr.open("POST", "./controller/InsertController.php");
|
764
|
xhr.send(formData);
|
765
|
setTimeout(function(){
|
766
|
location.reload();
|
767
|
}, 500);
|
768
|
}
|
769
|
</script>
|