1 |
e278dcbf
|
Ondřej Anděl
|
<script>
|
2 |
31a2bb94
|
Anděl Ondřej
|
let pageIndex = 0;
|
3 |
|
|
let itemPerPage = 50;
|
4 |
|
|
let itemCount = 0;
|
5 |
|
|
let pageCount = 0;
|
6 |
|
|
|
7 |
|
|
//what to do when page renders
|
8 |
e278dcbf
|
Ondřej Anděl
|
window.onload = function() {
|
9 |
a908ef13
|
Anděl Ondřej
|
let sourceSelect = new vanillaSelectBox("#source");
|
10 |
e278dcbf
|
Ondřej Anděl
|
filtersChange();
|
11 |
fb32f0e8
|
Anděl Ondřej
|
fetchData(false);
|
12 |
31a2bb94
|
Anděl Ondřej
|
|
13 |
|
|
//page-label listener
|
14 |
|
|
document.getElementById('page-label').addEventListener('keyup',function(e){
|
15 |
|
|
if (e.key === 'Enter' || e.keyCode === 13) {
|
16 |
|
|
this.blur();
|
17 |
|
|
}
|
18 |
|
|
});
|
19 |
e278dcbf
|
Ondřej Anděl
|
};
|
20 |
|
|
</script>
|
21 |
|
|
|
22 |
|
|
<div class="search-filters container" onload="filtersChange()">
|
23 |
9a7b1f4c
|
Ondřej Anděl
|
<div class="row">
|
24 |
fb32f0e8
|
Anděl Ondřej
|
<div class="mr-3">
|
25 |
|
|
<label for="lemma" class="mr-2">Lemma</label>
|
26 |
|
|
<input type="text" id="lemma">
|
27 |
|
|
</div>
|
28 |
a5559649
|
Anděl Ondřej
|
<div class="mr-3">
|
29 |
|
|
<label for="wordshape" class="mr-2">Slovní tvar</label>
|
30 |
|
|
<input type="text" id="wordshape">
|
31 |
|
|
</div>
|
32 |
9a7b1f4c
|
Ondřej Anděl
|
<div class="mr-3">
|
33 |
|
|
<label for="source" class="mr-2">Rukopisný pramen</label>
|
34 |
a908ef13
|
Anděl Ondřej
|
<select id="source" multiple>
|
35 |
fb32f0e8
|
Anděl Ondřej
|
<option value = "0">rukopis Vídeňský</option>
|
36 |
|
|
<option value = "1">zlomky Hanušovy</option>
|
37 |
|
|
<option value = "2">zlomky Hradecké</option>
|
38 |
|
|
<option value = "3">rukopis Cambridžský</option>
|
39 |
|
|
<option value = "4">rukopis Františkánský</option>
|
40 |
|
|
<option value = "5">zlomek Olomoucký</option>
|
41 |
|
|
<option value = "6">fragment Strahovský</option>
|
42 |
|
|
<option value = "7">zlomky Klementinsko-Křižovnické</option>
|
43 |
|
|
<option value = "8">zlomky Mnichovské</option>
|
44 |
|
|
<option value = "9">rukopis Lobkovický</option>
|
45 |
|
|
<option value = "10">rukopis Pelclův</option>
|
46 |
|
|
<option value = "11">rukopis Cerronský</option>
|
47 |
|
|
<option value = "12">rukopis Fürstenberský</option>
|
48 |
|
|
<option value = "13">rukopis Zebererův</option>
|
49 |
|
|
<option value = "14">vydání Pavla Ješína z Bezdězi, Praha 1620</option>
|
50 |
|
|
<option value = "15">básně připsané při Pulkavově kronice v rukopisu Litoměřickém</option>
|
51 |
a908ef13
|
Anděl Ondřej
|
</select>
|
52 |
9a7b1f4c
|
Ondřej Anděl
|
</div>
|
53 |
|
|
<div class="mr-3">
|
54 |
a908ef13
|
Anděl Ondřej
|
<label for="location" class="mr-2">Pozice</label>
|
55 |
9a7b1f4c
|
Ondřej Anděl
|
<input type="text" id="location">
|
56 |
|
|
</div>
|
57 |
a5559649
|
Anděl Ondřej
|
<div class="mr-3">
|
58 |
|
|
<label for="description2" class="mr-2">Poznámka 2</label>
|
59 |
|
|
<input type="text" id="description2" />
|
60 |
|
|
</div>
|
61 |
e278dcbf
|
Ondřej Anděl
|
|
62 |
|
|
<div class="mr-3">
|
63 |
|
|
<label for="wordclass" class="mr-2">Slovní druh</label>
|
64 |
|
|
<select onchange="filtersChange()" id="wordclass">
|
65 |
a5559649
|
Anděl Ondřej
|
<option selected="selected" value = "">nevybráno</option>
|
66 |
|
|
<option value = "N">substantivum</option>
|
67 |
|
|
<option value = "A">adjektivum</option>
|
68 |
|
|
<option value = "P">pronomen</option>
|
69 |
|
|
<option value = "C">numeralie</option>
|
70 |
|
|
<option value = "V">verbum</option>
|
71 |
|
|
<option value = "D">adverbium</option>
|
72 |
|
|
<option value = "R">prepozice</option>
|
73 |
|
|
<option value = "J">konjunkce</option>
|
74 |
|
|
<option value = "T">partikule</option>
|
75 |
|
|
<option value = "I">interjekce</option>
|
76 |
e278dcbf
|
Ondřej Anděl
|
</select>
|
77 |
|
|
</div>
|
78 |
|
|
|
79 |
|
|
<script>
|
80 |
|
|
function filtersChange() {
|
81 |
|
|
const value = document.getElementById("wordclass").value;
|
82 |
388846c1
|
Anděl Ondřej
|
let movedNode;
|
83 |
|
|
let beforeNode;
|
84 |
e278dcbf
|
Ondřej Anděl
|
switch (value) {
|
85 |
fb32f0e8
|
Anděl Ondřej
|
case "N":
|
86 |
e278dcbf
|
Ondřej Anděl
|
setFilerVisibility([
|
87 |
|
|
true,
|
88 |
|
|
true,
|
89 |
|
|
true,
|
90 |
|
|
false,
|
91 |
|
|
false,
|
92 |
|
|
false,
|
93 |
|
|
false,
|
94 |
|
|
false,
|
95 |
|
|
false,
|
96 |
|
|
false,
|
97 |
|
|
false,
|
98 |
0cfdee39
|
Anděl Ondřej
|
false,
|
99 |
e278dcbf
|
Ondřej Anděl
|
false
|
100 |
|
|
]);
|
101 |
388846c1
|
Anděl Ondřej
|
movedNode = document.getElementById("filter-case");
|
102 |
|
|
beforeNode = document.getElementById("filter-countability");
|
103 |
|
|
movedNode.parentNode.insertBefore(movedNode, beforeNode);
|
104 |
e278dcbf
|
Ondřej Anděl
|
break;
|
105 |
fb32f0e8
|
Anděl Ondřej
|
case "A":
|
106 |
e278dcbf
|
Ondřej Anděl
|
setFilerVisibility([
|
107 |
|
|
true,
|
108 |
|
|
true,
|
109 |
|
|
true,
|
110 |
|
|
true,
|
111 |
|
|
true,
|
112 |
|
|
false,
|
113 |
|
|
false,
|
114 |
|
|
false,
|
115 |
|
|
false,
|
116 |
|
|
false,
|
117 |
|
|
false,
|
118 |
0cfdee39
|
Anděl Ondřej
|
false,
|
119 |
e278dcbf
|
Ondřej Anděl
|
false
|
120 |
|
|
]);
|
121 |
388846c1
|
Anděl Ondřej
|
movedNode = document.getElementById("filter-case");
|
122 |
|
|
beforeNode = document.getElementById("filter-countability");
|
123 |
|
|
movedNode.parentNode.insertBefore(movedNode, beforeNode);
|
124 |
e278dcbf
|
Ondřej Anděl
|
break;
|
125 |
fb32f0e8
|
Anděl Ondřej
|
case "P":
|
126 |
e278dcbf
|
Ondřej Anděl
|
setFilerVisibility([
|
127 |
|
|
true,
|
128 |
|
|
true,
|
129 |
|
|
true,
|
130 |
|
|
false,
|
131 |
|
|
false,
|
132 |
|
|
true,
|
133 |
|
|
false,
|
134 |
|
|
false,
|
135 |
|
|
false,
|
136 |
|
|
false,
|
137 |
|
|
false,
|
138 |
0cfdee39
|
Anděl Ondřej
|
false,
|
139 |
e278dcbf
|
Ondřej Anděl
|
false
|
140 |
|
|
]);
|
141 |
388846c1
|
Anděl Ondřej
|
movedNode = document.getElementById("filter-case");
|
142 |
|
|
beforeNode = document.getElementById("filter-countability");
|
143 |
|
|
movedNode.parentNode.insertBefore(movedNode, beforeNode);
|
144 |
e278dcbf
|
Ondřej Anděl
|
break;
|
145 |
fb32f0e8
|
Anděl Ondřej
|
case "C":
|
146 |
e278dcbf
|
Ondřej Anděl
|
setFilerVisibility([
|
147 |
|
|
true,
|
148 |
|
|
true,
|
149 |
|
|
true,
|
150 |
|
|
false,
|
151 |
|
|
false,
|
152 |
|
|
false,
|
153 |
|
|
false,
|
154 |
|
|
false,
|
155 |
|
|
false,
|
156 |
|
|
false,
|
157 |
|
|
false,
|
158 |
0cfdee39
|
Anděl Ondřej
|
false,
|
159 |
e278dcbf
|
Ondřej Anděl
|
false
|
160 |
|
|
]);
|
161 |
388846c1
|
Anděl Ondřej
|
movedNode = document.getElementById("filter-case");
|
162 |
|
|
beforeNode = document.getElementById("filter-countability");
|
163 |
|
|
movedNode.parentNode.insertBefore(movedNode, beforeNode);
|
164 |
e278dcbf
|
Ondřej Anděl
|
break;
|
165 |
fb32f0e8
|
Anděl Ondřej
|
case "V":
|
166 |
e278dcbf
|
Ondřej Anděl
|
setFilerVisibility([
|
167 |
|
|
true,
|
168 |
|
|
true,
|
169 |
|
|
true,
|
170 |
|
|
false,
|
171 |
|
|
false,
|
172 |
|
|
false,
|
173 |
|
|
true,
|
174 |
|
|
true,
|
175 |
|
|
true,
|
176 |
|
|
true,
|
177 |
|
|
true,
|
178 |
0cfdee39
|
Anděl Ondřej
|
true,
|
179 |
e278dcbf
|
Ondřej Anděl
|
false
|
180 |
|
|
]);
|
181 |
388846c1
|
Anděl Ondřej
|
movedNode = document.getElementById("filter-case");
|
182 |
a5559649
|
Anděl Ondřej
|
beforeNode = document.getElementById("filter-control-div");
|
183 |
4779c9ce
|
Anděl Ondřej
|
movedNode.parentNode.insertBefore(movedNode, beforeNode);
|
184 |
e278dcbf
|
Ondřej Anděl
|
break;
|
185 |
fb32f0e8
|
Anděl Ondřej
|
case "D":
|
186 |
e278dcbf
|
Ondřej Anděl
|
setFilerVisibility([
|
187 |
|
|
false,
|
188 |
|
|
false,
|
189 |
|
|
false,
|
190 |
|
|
false,
|
191 |
|
|
true,
|
192 |
|
|
false,
|
193 |
|
|
false,
|
194 |
|
|
false,
|
195 |
|
|
false,
|
196 |
|
|
false,
|
197 |
|
|
false,
|
198 |
0cfdee39
|
Anděl Ondřej
|
false,
|
199 |
e278dcbf
|
Ondřej Anděl
|
false
|
200 |
|
|
]);
|
201 |
|
|
break;
|
202 |
fb32f0e8
|
Anděl Ondřej
|
case "R":
|
203 |
e278dcbf
|
Ondřej Anděl
|
setFilerVisibility([
|
204 |
|
|
true,
|
205 |
|
|
false,
|
206 |
|
|
false,
|
207 |
|
|
false,
|
208 |
|
|
false,
|
209 |
|
|
false,
|
210 |
|
|
false,
|
211 |
|
|
false,
|
212 |
|
|
false,
|
213 |
|
|
false,
|
214 |
|
|
false,
|
215 |
0cfdee39
|
Anděl Ondřej
|
false,
|
216 |
e278dcbf
|
Ondřej Anděl
|
false
|
217 |
|
|
]);
|
218 |
|
|
break;
|
219 |
fb32f0e8
|
Anděl Ondřej
|
case "J":
|
220 |
e278dcbf
|
Ondřej Anděl
|
setFilerVisibility([
|
221 |
|
|
false,
|
222 |
|
|
false,
|
223 |
|
|
false,
|
224 |
|
|
false,
|
225 |
|
|
false,
|
226 |
|
|
false,
|
227 |
|
|
false,
|
228 |
|
|
false,
|
229 |
|
|
false,
|
230 |
|
|
false,
|
231 |
|
|
false,
|
232 |
0cfdee39
|
Anděl Ondřej
|
false,
|
233 |
e278dcbf
|
Ondřej Anděl
|
true
|
234 |
|
|
]);
|
235 |
|
|
break;
|
236 |
fb32f0e8
|
Anděl Ondřej
|
case "I":
|
237 |
e278dcbf
|
Ondřej Anděl
|
setFilerVisibility([
|
238 |
|
|
false,
|
239 |
|
|
false,
|
240 |
|
|
false,
|
241 |
|
|
false,
|
242 |
|
|
false,
|
243 |
|
|
false,
|
244 |
|
|
false,
|
245 |
|
|
false,
|
246 |
|
|
false,
|
247 |
|
|
false,
|
248 |
|
|
false,
|
249 |
0cfdee39
|
Anděl Ondřej
|
false,
|
250 |
e278dcbf
|
Ondřej Anděl
|
false
|
251 |
|
|
]);
|
252 |
|
|
break;
|
253 |
fb32f0e8
|
Anděl Ondřej
|
case "T":
|
254 |
e278dcbf
|
Ondřej Anděl
|
setFilerVisibility([
|
255 |
|
|
false,
|
256 |
|
|
false,
|
257 |
|
|
false,
|
258 |
|
|
false,
|
259 |
|
|
false,
|
260 |
|
|
false,
|
261 |
|
|
false,
|
262 |
|
|
false,
|
263 |
|
|
false,
|
264 |
|
|
false,
|
265 |
|
|
false,
|
266 |
0cfdee39
|
Anděl Ondřej
|
false,
|
267 |
e278dcbf
|
Ondřej Anděl
|
false
|
268 |
|
|
]);
|
269 |
|
|
break;
|
270 |
|
|
default:
|
271 |
|
|
setFilerVisibility([
|
272 |
|
|
false,
|
273 |
|
|
false,
|
274 |
|
|
false,
|
275 |
|
|
false,
|
276 |
|
|
false,
|
277 |
|
|
false,
|
278 |
|
|
false,
|
279 |
|
|
false,
|
280 |
|
|
false,
|
281 |
|
|
false,
|
282 |
|
|
false,
|
283 |
0cfdee39
|
Anděl Ondřej
|
false,
|
284 |
e278dcbf
|
Ondřej Anděl
|
false
|
285 |
|
|
]);
|
286 |
|
|
break;
|
287 |
|
|
}
|
288 |
|
|
}
|
289 |
|
|
|
290 |
|
|
function setFilerVisibility(visibility) {
|
291 |
|
|
const id = [
|
292 |
|
|
"filter-case",
|
293 |
|
|
"filter-countability",
|
294 |
|
|
"filter-gender",
|
295 |
|
|
"filter-shape",
|
296 |
|
|
"filter-grade",
|
297 |
|
|
"filter-type",
|
298 |
|
|
"filter-mood",
|
299 |
0cfdee39
|
Anděl Ondřej
|
"filter-irregular",
|
300 |
e278dcbf
|
Ondřej Anděl
|
"filter-person",
|
301 |
|
|
"filter-time",
|
302 |
|
|
"filter-vid",
|
303 |
|
|
"filter-v-type",
|
304 |
|
|
"filter-k-type"
|
305 |
|
|
];
|
306 |
|
|
|
307 |
|
|
for(let i = 0; i < id.length && i < visibility.length; i++){
|
308 |
|
|
document.getElementById(id[i]).style.display = visibility[i] === true ? "" : "none";
|
309 |
|
|
document.getElementById(id[i].replace("filter-", "")).value = "";
|
310 |
|
|
}
|
311 |
|
|
}
|
312 |
|
|
</script>
|
313 |
|
|
|
314 |
|
|
<!-- conditionaly rendered filters-->
|
315 |
388846c1
|
Anděl Ondřej
|
<div class="mr-3" id="filter-person">
|
316 |
|
|
<label for="person" class="mr-2">Osoba</label>
|
317 |
|
|
<select id="person">
|
318 |
a5559649
|
Anděl Ondřej
|
<option selected="selected" value = "">nevybráno</option>
|
319 |
388846c1
|
Anděl Ondřej
|
<option value = "1">1.</option>
|
320 |
|
|
<option value = "2">2.</option>
|
321 |
|
|
<option value = "3">3.</option>
|
322 |
|
|
</select>
|
323 |
|
|
</div>
|
324 |
e278dcbf
|
Ondřej Anděl
|
<div class="mr-3" id="filter-case">
|
325 |
|
|
<label for="case" class="mr-2">Pád</label>
|
326 |
|
|
<select id="case">
|
327 |
a5559649
|
Anděl Ondřej
|
<option selected="selected" value = "">nevybráno</option>
|
328 |
|
|
<option value = "1">nominativ</option>
|
329 |
|
|
<option value = "2">genitiv</option>
|
330 |
|
|
<option value = "3">dativ</option>
|
331 |
|
|
<option value = "4">akuzativ</option>
|
332 |
|
|
<option value = "5">vokativ</option>
|
333 |
|
|
<option value = "6">lokál</option>
|
334 |
|
|
<option value = "7">instrumentál</option>
|
335 |
e278dcbf
|
Ondřej Anděl
|
</select>
|
336 |
|
|
</div>
|
337 |
|
|
<div class="mr-3" id="filter-countability">
|
338 |
|
|
<label for="countability" class="mr-2">Číslo</label>
|
339 |
|
|
<select id="countability">
|
340 |
a5559649
|
Anděl Ondřej
|
<option selected="selected" value = "">nevybráno</option>
|
341 |
|
|
<option value = "S">singulár</option>
|
342 |
|
|
<option value = "P">plurál</option>
|
343 |
|
|
<option value = "D">duál</option>
|
344 |
|
|
</select>
|
345 |
|
|
</div>
|
346 |
|
|
<div class="mr-3" id="filter-mood">
|
347 |
|
|
<label for="mood" class="mr-2">Způsob</label>
|
348 |
|
|
<select id="mood" onchange="moodChange()">
|
349 |
|
|
<option selected="selected" value = "">nevybráno</option>
|
350 |
|
|
<option value = "d">indikativ</option>
|
351 |
|
|
<option value = "i">imperativ</option>
|
352 |
|
|
<option value = "c">kondicionál</option>
|
353 |
|
|
</select>
|
354 |
|
|
</div>
|
355 |
|
|
<div class="mr-3" id="filter-time">
|
356 |
|
|
<label for="time" class="mr-2">Čas</label>
|
357 |
|
|
<select id="time">
|
358 |
|
|
<option selected="selected" value = "">nevybráno</option>
|
359 |
|
|
<option value = "P">prézens</option>
|
360 |
|
|
<option value = "A">aorist</option>
|
361 |
|
|
<option value = "R">préteritum</option>
|
362 |
|
|
<option value = "I">imperfektum</option>
|
363 |
|
|
<option value = "H">plusquamperfektum</option>
|
364 |
|
|
<option value = "F">futurum</option>
|
365 |
|
|
</select>
|
366 |
|
|
</div>
|
367 |
|
|
<div class="mr-3" id="filter-v-type">
|
368 |
|
|
<label for="v-type" class="mr-2">Slovesný rod</label>
|
369 |
|
|
<select id="v-type">
|
370 |
|
|
<option selected="selected" value = "">nevybráno</option>
|
371 |
|
|
<option value = "A">aktivum</option>
|
372 |
|
|
<option value = "P">pasivum</option>
|
373 |
|
|
</select>
|
374 |
|
|
</div>
|
375 |
|
|
<div class="mr-3" id="filter-vid">
|
376 |
|
|
<label for="vid" class="mr-2">Vid</label>
|
377 |
|
|
<select id="vid">
|
378 |
|
|
<option selected="selected" value = "">nevybráno</option>
|
379 |
|
|
<option value = "P">perfektivum</option>
|
380 |
|
|
<option value = "I">imperfektivum </option>
|
381 |
|
|
</select>
|
382 |
|
|
</div>
|
383 |
|
|
<div class="mr-3" id="filter-irregular">
|
384 |
|
|
<label for="irregular" class="mr-2">Neurčitý slovesný tvar</label>
|
385 |
|
|
<select id="irregular" onchange="irregularChange()">
|
386 |
|
|
<option selected="selected" value = "">nevybráno</option>
|
387 |
|
|
<option value = "f">infinitiv</option>
|
388 |
|
|
<option value = "S">supinum</option>
|
389 |
|
|
<option value = "e">přech. přítomný</option>
|
390 |
|
|
<option value = "m">přech. minulý</option>
|
391 |
|
|
<option value = "A">part. perf. akt.</option>
|
392 |
|
|
<option value = "P">part. perf. pas.</option>
|
393 |
e278dcbf
|
Ondřej Anděl
|
</select>
|
394 |
|
|
</div>
|
395 |
|
|
<div class="mr-3" id="filter-gender">
|
396 |
|
|
<label for="gender" class="mr-2">Rod</label>
|
397 |
|
|
<select id="gender">
|
398 |
a5559649
|
Anděl Ondřej
|
<option selected="selected" value = "">nevybráno</option>
|
399 |
|
|
<option value = "M">maskulinum</option>
|
400 |
|
|
<option value = "F">femininum</option>
|
401 |
|
|
<option value = "N">neutrum</option>
|
402 |
e278dcbf
|
Ondřej Anděl
|
</select>
|
403 |
|
|
</div>
|
404 |
|
|
<div class="mr-3" id="filter-shape">
|
405 |
|
|
<label for="shape" class="mr-2">Tvar</label>
|
406 |
|
|
<select id="shape">
|
407 |
a5559649
|
Anděl Ondřej
|
<option selected="selected" value = "">nevybráno</option>
|
408 |
|
|
<option value = "C">složený</option>
|
409 |
|
|
<option value = "N">jmenný</option>
|
410 |
e278dcbf
|
Ondřej Anděl
|
</select>
|
411 |
|
|
</div>
|
412 |
|
|
<div class="mr-3" id="filter-grade">
|
413 |
|
|
<label for="grade" class="mr-2">Stupeň</label>
|
414 |
|
|
<select id="grade">
|
415 |
a5559649
|
Anděl Ondřej
|
<option selected="selected" value = "">nevybráno</option>
|
416 |
|
|
<option value = "1">pozitiv</option>
|
417 |
|
|
<option value = "2">komparativ</option>
|
418 |
|
|
<option value = "3">superlativ</option>
|
419 |
e278dcbf
|
Ondřej Anděl
|
</select>
|
420 |
|
|
</div>
|
421 |
|
|
<div class="mr-3" id="filter-type">
|
422 |
|
|
<label for="type" class="mr-2">Druh</label>
|
423 |
|
|
<select id="type">
|
424 |
a5559649
|
Anděl Ondřej
|
<option selected="selected" value = "">nevybráno</option>
|
425 |
|
|
<option value = "P">personalia</option>
|
426 |
|
|
<option value = "S">posesiva</option>
|
427 |
|
|
<option value = "D">demonstrativa</option>
|
428 |
|
|
<option value = "Q">interogativa</option>
|
429 |
|
|
<option value = "J">relativa</option>
|
430 |
|
|
<option value = "Z">indefinita</option>
|
431 |
|
|
<option value = "L">limitativa</option>
|
432 |
|
|
<option value = "W">negativa</option>
|
433 |
e278dcbf
|
Ondřej Anděl
|
</select>
|
434 |
|
|
</div>
|
435 |
|
|
<div class="mr-3" id="filter-k-type">
|
436 |
|
|
<label for="k-type" class="mr-2">Typ</label>
|
437 |
|
|
<select id="k-type">
|
438 |
a5559649
|
Anděl Ondřej
|
<option selected="selected" value = "">nevybráno</option>
|
439 |
|
|
<option value = "V">větná</option>
|
440 |
|
|
<option value = "C">členská</option>
|
441 |
|
|
<option value = "N">navazovací</option>
|
442 |
|
|
<option value = "P">spojení s přechodníkem</option>
|
443 |
e278dcbf
|
Ondřej Anděl
|
</select>
|
444 |
|
|
</div>
|
445 |
a908ef13
|
Anděl Ondřej
|
|
446 |
|
|
<!-- send button-->
|
447 |
a5559649
|
Anděl Ondřej
|
<div class="ml-auto" id="filter-control-div">
|
448 |
|
|
<i class="mr-1 my-auto" id="hit-count">0 záznamů</i>
|
449 |
|
|
<button class="btn" id="filter-but" onclick="callFilter()">
|
450 |
|
|
Filtrovat
|
451 |
|
|
</button>
|
452 |
176259e4
|
Anděl Ondřej
|
|
453 |
|
|
<button class="btn" data-toggle="modal" data-target="#edit-modal" data-title="Nový záznam">
|
454 |
|
|
<i class="fa fa-plus"></i>
|
455 |
|
|
</button><!--TODO ADMIN ONLY-->
|
456 |
a5559649
|
Anděl Ondřej
|
</div>
|
457 |
9a7b1f4c
|
Ondřej Anděl
|
</div>
|
458 |
|
|
</div>
|
459 |
|
|
|
460 |
6ddecabb
|
Anděl Ondřej
|
<div class="search-results mt-4">
|
461 |
9a7b1f4c
|
Ondřej Anděl
|
<table class="table table-striped">
|
462 |
|
|
<thead>
|
463 |
|
|
<tr>
|
464 |
a9af2c07
|
Anděl Ondřej
|
<?php if(isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] == true) {?>
|
465 |
|
|
<th scope="col">Vydáno</th>
|
466 |
|
|
<?php }?>
|
467 |
9a7b1f4c
|
Ondřej Anděl
|
<th scope="col">Lemma</th>
|
468 |
a5559649
|
Anděl Ondřej
|
<th scope="col">Slovní tvar</th>
|
469 |
|
|
<th scope="col">Morfologie</th>
|
470 |
e278dcbf
|
Ondřej Anděl
|
<th scope="col">Rukopisy</th>
|
471 |
|
|
<th scope="col">Pozice</th>
|
472 |
a5559649
|
Anděl Ondřej
|
<th scope="col">Poznámka 2</th>
|
473 |
9a7b1f4c
|
Ondřej Anděl
|
<th scope="col"></th>
|
474 |
|
|
</tr>
|
475 |
|
|
</thead>
|
476 |
|
|
<tbody id="search-table">
|
477 |
|
|
<script>
|
478 |
86d083b4
|
Anděl Ondřej
|
function moodChange() {
|
479 |
|
|
if(document.getElementById("mood").value !== ""){
|
480 |
|
|
document.getElementById("irregular").disabled = true;
|
481 |
|
|
document.getElementById("irregular").title = "Neurčitý slovesný tvar smí být nastaven pouze není-li nastaven způsob";
|
482 |
|
|
} else {
|
483 |
|
|
document.getElementById("irregular").disabled = false;
|
484 |
|
|
document.getElementById("irregular").title = "";
|
485 |
|
|
}
|
486 |
|
|
}
|
487 |
|
|
|
488 |
|
|
function irregularChange() {
|
489 |
|
|
if(document.getElementById("irregular").value !== ""){
|
490 |
|
|
document.getElementById("mood").disabled = true;
|
491 |
|
|
document.getElementById("mood").title = "Způsob smí být nastaven pouze není-li nastaven neurčitý slovesný tvar";
|
492 |
|
|
} else {
|
493 |
|
|
document.getElementById("mood").disabled = false;
|
494 |
|
|
document.getElementById("mood").title = "";
|
495 |
|
|
}
|
496 |
|
|
}
|
497 |
|
|
|
498 |
a908ef13
|
Anděl Ondřej
|
let data;
|
499 |
31a2bb94
|
Anděl Ondřej
|
function callFilter() {
|
500 |
|
|
pageIndex = 0;
|
501 |
|
|
fetchData(true)
|
502 |
|
|
}
|
503 |
|
|
|
504 |
fb32f0e8
|
Anděl Ondřej
|
function filterData (formData) {
|
505 |
|
|
//regular
|
506 |
|
|
formData.append("lemma", document.getElementById("lemma").value);
|
507 |
|
|
formData.append("word", document.getElementById("wordshape").value);
|
508 |
a5559649
|
Anděl Ondřej
|
formData.append("description2", document.getElementById("description2").value);
|
509 |
fb32f0e8
|
Anděl Ondřej
|
|
510 |
|
|
//positions
|
511 |
|
|
const positionSplit = document.getElementById("location").value.split("/");
|
512 |
|
|
formData.append("position1", positionSplit[0] !== undefined ? positionSplit[0] : "");
|
513 |
|
|
formData.append("position2", positionSplit[1] !== undefined ? positionSplit[1] : "");
|
514 |
|
|
formData.append("positiondetail", positionSplit[2] !== undefined ? positionSplit[2] : "");
|
515 |
a908ef13
|
Anděl Ondřej
|
|
516 |
fb32f0e8
|
Anděl Ondřej
|
//multiselect
|
517 |
|
|
formData.append("manuscript", getValues("source"));
|
518 |
|
|
|
519 |
|
|
const pos = document.getElementById("wordclass").value;
|
520 |
|
|
formData.append("tag_pos", pos);
|
521 |
|
|
//those upcoming are dynamic based on the previous field
|
522 |
|
|
formData.append("tag_case", document.getElementById("case").value);
|
523 |
|
|
formData.append("tag_number", document.getElementById("countability").value);
|
524 |
|
|
formData.append("tag_gender", document.getElementById("gender").value);
|
525 |
|
|
formData.append("tag_degree", document.getElementById("grade").value);
|
526 |
|
|
formData.append("tag_shape", document.getElementById("shape").value);
|
527 |
|
|
formData.append("tag_num", "");//THIS ONE IS WORTHLESS
|
528 |
|
|
|
529 |
|
|
if(pos === "P"){
|
530 |
|
|
formData.append("tag_sentence", document.getElementById("type").value);
|
531 |
|
|
} else if(pos === "V"){
|
532 |
0cfdee39
|
Anděl Ondřej
|
const mood = document.getElementById("mood").value;
|
533 |
|
|
if(mood !== ""){
|
534 |
|
|
formData.append("tag_sentence", mood);
|
535 |
|
|
} else {
|
536 |
|
|
formData.append("tag_sentence", document.getElementById("irregular").value);
|
537 |
|
|
}
|
538 |
fb32f0e8
|
Anděl Ondřej
|
} else if(pos === "J"){
|
539 |
|
|
formData.append("tag_sentence", document.getElementById("k-type").value);
|
540 |
|
|
}
|
541 |
|
|
|
542 |
|
|
formData.append("tag_verb_person", document.getElementById("person").value);
|
543 |
|
|
formData.append("tag_verb_time", document.getElementById("time").value);
|
544 |
|
|
formData.append("tag_verb_degree", document.getElementById("vid").value);
|
545 |
|
|
formData.append("tag_verb_aspect", document.getElementById("v-type").value);
|
546 |
|
|
}
|
547 |
|
|
|
548 |
|
|
function fetchData (filter = true) {
|
549 |
a908ef13
|
Anděl Ondřej
|
// (A1) GET SEARCH TERM
|
550 |
|
|
const formData = new FormData();
|
551 |
31a2bb94
|
Anděl Ondřej
|
formData.append("page", ""+pageIndex);
|
552 |
|
|
formData.append("items_per_page", ""+itemPerPage);
|
553 |
a908ef13
|
Anděl Ondřej
|
formData.append("finished", "true");//TODO ADMIN
|
554 |
fb32f0e8
|
Anděl Ondřej
|
if(filter){
|
555 |
|
|
filterData(formData);
|
556 |
|
|
}
|
557 |
|
|
|
558 |
a5559649
|
Anděl Ondřej
|
// (A2) AJAX - USE HTTP:// NOT FILE:/
|
559 |
a908ef13
|
Anděl Ondřej
|
let xhr = new XMLHttpRequest();
|
560 |
|
|
xhr.open("POST", "./controller/TableController.php");
|
561 |
|
|
xhr.onload = function(){
|
562 |
|
|
let search = this.response;
|
563 |
53a9c7e2
|
Milan Vacek
|
//console.log(search);
|
564 |
a908ef13
|
Anděl Ondřej
|
let parsedJSON = JSON.parse(search);
|
565 |
fb32f0e8
|
Anděl Ondřej
|
if(parsedJSON.count === 0){
|
566 |
|
|
document.getElementById("no-data-label").style.display = "";
|
567 |
31a2bb94
|
Anděl Ondřej
|
document.getElementById("paging-control").style.display = "none";
|
568 |
fb32f0e8
|
Anděl Ondřej
|
} else {
|
569 |
|
|
document.getElementById("no-data-label").style.display = "none";
|
570 |
31a2bb94
|
Anděl Ondřej
|
document.getElementById("paging-control").style.display = "";
|
571 |
fb32f0e8
|
Anděl Ondřej
|
}
|
572 |
a5559649
|
Anděl Ondřej
|
|
573 |
|
|
if(parsedJSON.count === 1){
|
574 |
|
|
document.getElementById("hit-count").innerText = "1 záznamů";
|
575 |
|
|
} else if(parsedJSON.count < 5){
|
576 |
|
|
document.getElementById("hit-count").innerText = parsedJSON.count +" záznamů";
|
577 |
|
|
} else {
|
578 |
|
|
document.getElementById("hit-count").innerText = parsedJSON.count +" záznamů";
|
579 |
|
|
}
|
580 |
|
|
|
581 |
31a2bb94
|
Anděl Ondřej
|
itemCount = parsedJSON.count;
|
582 |
|
|
pageCount = Math.ceil(itemCount / itemPerPage);
|
583 |
|
|
document.getElementById("page-label").value = (pageIndex + 1) + " / " + pageCount;
|
584 |
a908ef13
|
Anděl Ondřej
|
data = parsedJSON.data;
|
585 |
|
|
renderData(parsedJSON.data);
|
586 |
|
|
};
|
587 |
|
|
xhr.send(formData);
|
588 |
|
|
}
|
589 |
|
|
|
590 |
|
|
function renderManuscript(manuscripts, shorten=true) {
|
591 |
|
|
let output = "";
|
592 |
|
|
for(let i = 0; i < manuscripts.length; i++){
|
593 |
56235f0a
|
Anděl Ondřej
|
if(shorten)
|
594 |
a5559649
|
Anděl Ondřej
|
output += ("<span title=\""+ codeToManuscript[manuscripts[i]] +"\">" + codeToManuscriptShort[manuscripts[i]] + "</span>");
|
595 |
56235f0a
|
Anděl Ondřej
|
else
|
596 |
|
|
output += codeToManuscript[manuscripts[i]];
|
597 |
a908ef13
|
Anděl Ondřej
|
|
598 |
|
|
if(i < manuscripts.length - 1){
|
599 |
56235f0a
|
Anděl Ondřej
|
if(shorten)
|
600 |
|
|
output += ", ";
|
601 |
|
|
else
|
602 |
|
|
output += "; ";
|
603 |
a908ef13
|
Anděl Ondřej
|
}
|
604 |
|
|
}
|
605 |
|
|
return output;
|
606 |
|
|
}
|
607 |
|
|
|
608 |
a9af2c07
|
Anděl Ondřej
|
function publishItem(id){
|
609 |
|
|
let item = data[id];
|
610 |
|
|
const finishedChecked = document.getElementById("check-"+id).checked;
|
611 |
|
|
|
612 |
|
|
const formData = new FormData();
|
613 |
|
|
formData.append("finished", finishedChecked);
|
614 |
|
|
|
615 |
|
|
formData.append("id", item.id);
|
616 |
|
|
formData.append("ending", item.ending);
|
617 |
|
|
formData.append("prefix", item.prefix);
|
618 |
|
|
formData.append("suffix", item.suffix);
|
619 |
|
|
|
620 |
|
|
formData.append("namedentity", item.namedentity);
|
621 |
|
|
formData.append("position1", item.position1);
|
622 |
|
|
formData.append("position2", item.position2);
|
623 |
|
|
formData.append("positiondetail", item.positiondetail);
|
624 |
|
|
formData.append("word", item.word);
|
625 |
|
|
formData.append("lemma", item.lemma.lemma);
|
626 |
|
|
formData.append("manuscript", item.manuscript);
|
627 |
|
|
formData.append("context", item.context);
|
628 |
|
|
formData.append("description", item.description);
|
629 |
|
|
formData.append("description2", item.description2);
|
630 |
|
|
formData.append("description3", item.description3);
|
631 |
|
|
formData.append("tag", item.tag.tag);
|
632 |
|
|
formData.append("pos", item.lemma.pos);
|
633 |
|
|
formData.append("date", item.date);
|
634 |
|
|
|
635 |
|
|
var xhr = new XMLHttpRequest();
|
636 |
|
|
xhr.open("POST", "./controller/UpdateController.php");
|
637 |
53a9c7e2
|
Milan Vacek
|
xhr.send(formData);
|
638 |
a9af2c07
|
Anděl Ondřej
|
setTimeout(function(){
|
639 |
|
|
location.reload();
|
640 |
|
|
}, 500);
|
641 |
|
|
}
|
642 |
|
|
|
643 |
a908ef13
|
Anděl Ondřej
|
function renderData(data) {
|
644 |
|
|
let result = "";
|
645 |
|
|
data.forEach((item,id) => {
|
646 |
|
|
result += "<tr>";
|
647 |
a9af2c07
|
Anděl Ondřej
|
<?php if(isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] == true) {?>
|
648 |
|
|
result += "<td><input type='checkbox' id='check-"+item.id+"' onchange='publishItem("+item.id+")' "+ ((item.finished === true) ? 'checked' : '') +" /></td>";
|
649 |
|
|
<?php }?>
|
650 |
a908ef13
|
Anděl Ondřej
|
result += "<td>" + item.lemma.lemma + "</td>";
|
651 |
a5559649
|
Anděl Ondřej
|
result += "<td>" + item.word + "</td>";
|
652 |
|
|
result += "<td>" + item.tag.tag + "</td>";
|
653 |
a908ef13
|
Anděl Ondřej
|
result += "<td>" + renderManuscript(item.manuscript) + "</td>";
|
654 |
|
|
result += "<td>" + item.position1 + (item.position2 ? ("/" + item.position2 + (item.positiondetail ? "/" + item.positiondetail : "")) : "") + "</td>";
|
655 |
a5559649
|
Anděl Ondřej
|
result += "<td>" + item.description2 + "</td>";
|
656 |
a908ef13
|
Anděl Ondřej
|
result += "<td class=\"action-td\">" +
|
657 |
a5559649
|
Anděl Ondřej
|
"<button class=\"btn mr-1\" title=\"Upravit\" data-toggle=\"modal\" data-target=\"#edit-modal\" data-pseudo-id='" + id + "' data-title=\"Upravit záznam\"><i class=\"fa fa-pencil\"></i></button>" + //TODO ADMIN change , regular send report
|
658 |
a908ef13
|
Anděl Ondřej
|
"<button class=\"btn\" title=\"Detail\" data-toggle=\"modal\" data-target=\"#detail-modal\" data-pseudo-id='" + id + "'><i class=\"fa fa-search\"></i></button>" +
|
659 |
f20e0b8b
|
Anděl Ondřej
|
"<button class=\"btn ml-1\" title=\"Odstranit\" data-toggle=\"modal\" data-target=\"#remove-modal\" data-pseudo-id='" + id + "'><i class=\"fa fa-trash\"></i></button>" + //TODO ADMIN change , regular send report
|
660 |
a908ef13
|
Anděl Ondřej
|
"</td>";
|
661 |
|
|
result += "</tr>";
|
662 |
|
|
});
|
663 |
|
|
document.getElementById("search-table").innerHTML = result;
|
664 |
|
|
}
|
665 |
9a7b1f4c
|
Ondřej Anděl
|
</script>
|
666 |
|
|
</tbody>
|
667 |
|
|
</table>
|
668 |
fb32f0e8
|
Anděl Ondřej
|
|
669 |
|
|
<h3 id="no-data-label" class="mx-auto text-center font-italic">Žádná data nebyla nalezena</h3>
|
670 |
31a2bb94
|
Anděl Ondřej
|
|
671 |
|
|
<script>
|
672 |
6c152ae0
|
Ondrej Drtina
|
function removeSelectedItem(idToDelete){
|
673 |
6f8c9e05
|
Ondrej Drtina
|
const data = new FormData(); //to pass ids, which we want to delete from DB
|
674 |
6c152ae0
|
Ondrej Drtina
|
data.append("id", ""+idToDelete); //id to delete from table dd_wordform
|
675 |
6f8c9e05
|
Ondrej Drtina
|
|
676 |
|
|
let xhr = new XMLHttpRequest();
|
677 |
|
|
xhr.open("POST", "./controller/RemoveController.php");
|
678 |
|
|
xhr.send(data);
|
679 |
6c152ae0
|
Ondrej Drtina
|
fetchData(true); //reload data after item delete
|
680 |
6f8c9e05
|
Ondrej Drtina
|
}
|
681 |
|
|
|
682 |
7a7b805f
|
Ondrej Drtina
|
function checkValidItemsPerPage(){
|
683 |
d845d95d
|
Ondrej Drtina
|
var visibleItemCount = document.getElementById("itemsPerPage");
|
684 |
7a7b805f
|
Ondrej Drtina
|
if(!isNaN(visibleItemCount.value) && visibleItemCount.value % 1 === 0 && parseInt(visibleItemCount.value) >= 1 && parseInt(visibleItemCount.value) <= 500){
|
685 |
|
|
return true;
|
686 |
|
|
}else{
|
687 |
|
|
alert("Zadaný počet není validní, zkuste to znovu.\nPlatný rozsah: 1 - 500 položek na stránku.");
|
688 |
|
|
visibleItemCount.value = itemPerPage;
|
689 |
|
|
return false;
|
690 |
|
|
}
|
691 |
d845d95d
|
Ondrej Drtina
|
}
|
692 |
|
|
|
693 |
|
|
function changeItemsPerPage(){
|
694 |
7a7b805f
|
Ondrej Drtina
|
//if there is no valid input, return and dont save
|
695 |
|
|
if(checkValidItemsPerPage() === false){
|
696 |
|
|
return;
|
697 |
|
|
}
|
698 |
d845d95d
|
Ondrej Drtina
|
|
699 |
7a7b805f
|
Ondrej Drtina
|
pageIndex = 0;
|
700 |
d845d95d
|
Ondrej Drtina
|
var visibleItemCount = document.getElementById("itemsPerPage").value;
|
701 |
|
|
itemPerPage = visibleItemCount;
|
702 |
|
|
fetchData(true);
|
703 |
|
|
}
|
704 |
|
|
|
705 |
31a2bb94
|
Anděl Ondřej
|
function moveToFirst(){
|
706 |
|
|
pageIndex = 0;
|
707 |
|
|
fetchData(true);
|
708 |
|
|
}
|
709 |
|
|
|
710 |
|
|
function moveToPrevious(){
|
711 |
|
|
pageIndex = (pageIndex - 1 > 0) ? (pageIndex - 1) : (0);
|
712 |
|
|
fetchData(true);
|
713 |
|
|
}
|
714 |
|
|
|
715 |
|
|
function moveToNext(){
|
716 |
|
|
pageIndex = (pageIndex + 1 < pageCount) ? (pageIndex + 1) : (pageCount - 1);
|
717 |
|
|
fetchData(true);
|
718 |
|
|
}
|
719 |
|
|
|
720 |
|
|
function moveToLast(){
|
721 |
|
|
pageIndex = pageCount - 1;
|
722 |
|
|
fetchData(true);
|
723 |
|
|
}
|
724 |
|
|
|
725 |
|
|
function onManualPageStart(element){
|
726 |
|
|
element.value = '';
|
727 |
|
|
}
|
728 |
|
|
|
729 |
|
|
function onManualPageEnd(element) {
|
730 |
|
|
const value = Number(element.value) - 1;
|
731 |
|
|
if(Number.isInteger(value) && value >= 0 && value < pageCount){
|
732 |
|
|
pageIndex = value;
|
733 |
|
|
fetchData(true);
|
734 |
|
|
} else {
|
735 |
|
|
element.value = (pageIndex + 1) + " / " + pageCount;
|
736 |
|
|
}
|
737 |
|
|
|
738 |
|
|
}
|
739 |
|
|
</script>
|
740 |
|
|
<div id="paging-control" class="mx-auto text-center" style="display: none">
|
741 |
|
|
<button class="border-0 shadow-none bg-transparent" onclick="moveToFirst()"><b><<</b></button>
|
742 |
|
|
<button class="border-0 shadow-none bg-transparent" onclick="moveToPrevious()"><b><</b></button>
|
743 |
|
|
<input class="border-0 shadow-none bg-transparent text-center font-weight-bold"
|
744 |
|
|
id="page-label"
|
745 |
|
|
onfocus="onManualPageStart(this)"
|
746 |
|
|
onblur="onManualPageEnd(this)"
|
747 |
|
|
/>
|
748 |
|
|
<button class="border-0 shadow-none bg-transparent" onclick="moveToNext()"><b>></b></button>
|
749 |
|
|
<button class="border-0 shadow-none bg-transparent" onclick="moveToLast()"><b>>></b></button>
|
750 |
|
|
</div>
|
751 |
9a7b1f4c
|
Ondřej Anděl
|
</div>
|
752 |
|
|
|