Revize a908ef13
Přidáno uživatelem Ondřej Anděl před více než 3 roky(ů)
application/view/searchContent.php | ||
---|---|---|
1 | 1 |
<script> |
2 | 2 |
window.onload = function() { |
3 |
let sourceSelect = new vanillaSelectBox("#source"); |
|
3 | 4 |
filtersChange(); |
5 |
fetchData(); |
|
4 | 6 |
}; |
5 | 7 |
</script> |
6 | 8 |
|
... | ... | |
11 | 13 |
<input type="text" id="lemma"> |
12 | 14 |
</div> |
13 | 15 |
<div class="mr-3"> |
14 |
<label for="wordshape" class="mr-2">Tvar slova</label>
|
|
16 |
<label for="wordshape" class="mr-2">Slovo</label>
|
|
15 | 17 |
<input type="text" id="wordshape"> |
16 | 18 |
</div> |
17 | 19 |
<div class="mr-3"> |
18 | 20 |
<label for="source" class="mr-2">Rukopisný pramen</label> |
19 |
<input type="text" id="source"> |
|
21 |
<select id="source" multiple> |
|
22 |
<option value = "1">C</option> |
|
23 |
<option value = "2">Cr</option> |
|
24 |
<option value = "3">F</option> |
|
25 |
<option value = "4">Fs</option> |
|
26 |
<option value = "5">H</option> |
|
27 |
<option value = "6">Hr</option> |
|
28 |
<option value = "7">Jš</option> |
|
29 |
<option value = "8">K</option> |
|
30 |
<option value = "9">L</option> |
|
31 |
<option value = "10">M</option> |
|
32 |
<option value = "11">O</option> |
|
33 |
<option value = "12">P</option> |
|
34 |
<option value = "13">S</option> |
|
35 |
<option value = "14">V</option> |
|
36 |
<option value = "15">Z</option> |
|
37 |
</select> |
|
20 | 38 |
</div> |
21 | 39 |
<div class="mr-3"> |
22 |
<label for="location" class="mr-2">Lokace</label>
|
|
40 |
<label for="location" class="mr-2">Pozice</label>
|
|
23 | 41 |
<input type="text" id="location"> |
24 | 42 |
</div> |
25 | 43 |
|
... | ... | |
222 | 240 |
]); |
223 | 241 |
break; |
224 | 242 |
} |
225 |
//TODO data fetch |
|
226 | 243 |
} |
227 | 244 |
|
228 | 245 |
function setFilerVisibility(visibility) { |
... | ... | |
266 | 283 |
<label for="countability" class="mr-2">Číslo</label> |
267 | 284 |
<select id="countability"> |
268 | 285 |
<option selected="selected" value = "">Nevybráno</option> |
269 |
<option value = "1">Singulár</option>
|
|
270 |
<option value = "2">Plurál</option>
|
|
271 |
<option value = "3">Duál</option>
|
|
286 |
<option value = "S">Singulár</option>
|
|
287 |
<option value = "P">Plurál</option>
|
|
288 |
<option value = "D">Duál</option>
|
|
272 | 289 |
</select> |
273 | 290 |
</div> |
274 | 291 |
<div class="mr-3" id="filter-gender"> |
275 | 292 |
<label for="gender" class="mr-2">Rod</label> |
276 | 293 |
<select id="gender"> |
277 | 294 |
<option selected="selected" value = "">Nevybráno</option> |
278 |
<option value = "1">maskulinum</option>
|
|
279 |
<option value = "2">femininum</option>
|
|
280 |
<option value = "3">neutrum</option>
|
|
295 |
<option value = "M">Maskulinum</option>
|
|
296 |
<option value = "F">Femininum</option>
|
|
297 |
<option value = "N">Neutrum</option>
|
|
281 | 298 |
</select> |
282 | 299 |
</div> |
283 | 300 |
<div class="mr-3" id="filter-shape"> |
284 | 301 |
<label for="shape" class="mr-2">Tvar</label> |
285 | 302 |
<select id="shape"> |
286 | 303 |
<option selected="selected" value = "">Nevybráno</option> |
287 |
<option value = "1">Složený</option> |
|
288 |
<option value = "2">Jmenný</option> |
|
289 |
<option value = "3">Přivlastňovací</option> |
|
304 |
<option value = "C">Složený</option> |
|
305 |
<option value = "N">Jmenný</option> |
|
290 | 306 |
</select> |
291 | 307 |
</div> |
292 | 308 |
<div class="mr-3" id="filter-grade"> |
... | ... | |
302 | 318 |
<label for="type" class="mr-2">Druh</label> |
303 | 319 |
<select id="type"> |
304 | 320 |
<option selected="selected" value = "">Nevybráno</option> |
305 |
<option value = "1">Personalia</option>
|
|
306 |
<option value = "2">Posesiva</option>
|
|
307 |
<option value = "3">Demonstrativa</option>
|
|
308 |
<option value = "4">Interogativa</option>
|
|
309 |
<option value = "5">Relativa</option>
|
|
310 |
<option value = "6">Indefinita</option>
|
|
311 |
<option value = "7">Limitativa</option>
|
|
312 |
<option value = "8">Negativa</option>
|
|
321 |
<option value = "P">Personalia</option>
|
|
322 |
<option value = "S">Posesiva</option>
|
|
323 |
<option value = "D">Demonstrativa</option>
|
|
324 |
<option value = "Q">Interogativa</option>
|
|
325 |
<option value = "J">Relativa</option>
|
|
326 |
<option value = "Z">Indefinita</option>
|
|
327 |
<option value = "L">Limitativa</option>
|
|
328 |
<option value = "W">Negativa</option>
|
|
313 | 329 |
</select> |
314 | 330 |
</div> |
315 | 331 |
<div class="mr-3" id="filter-mood"> |
316 |
<label for="mood" class="mr-2">Osoba</label>
|
|
332 |
<label for="mood" class="mr-2">Způsob</label>
|
|
317 | 333 |
<select id="mood"> |
318 | 334 |
<option selected="selected" value = "">Nevybráno</option> |
319 |
<option value = "1">Indikativ</option> |
|
320 |
<option value = "2">Imperativ</option> |
|
321 |
<option value = "3">Kondicionál</option> |
|
335 |
<option value = "f">Infinitiv</option> |
|
336 |
<option value = "d">Indikativ</option> |
|
337 |
<option value = "i">Imperativ</option> |
|
338 |
<option value = "c">Kondicionál</option> |
|
339 |
<option value = "S">Supinum</option> |
|
340 |
<option value = "e">Přech. přítomný</option> |
|
341 |
<option value = "m">Přech. minulý</option> |
|
342 |
<option value = "A">Part. perf. akt.</option> |
|
343 |
<option value = "P">Part. perf. pas.</option> |
|
322 | 344 |
</select> |
323 | 345 |
</div> |
324 | 346 |
<div class="mr-3" id="filter-person"> |
... | ... | |
334 | 356 |
<label for="time" class="mr-2">Čas</label> |
335 | 357 |
<select id="time"> |
336 | 358 |
<option selected="selected" value = "">Nevybráno</option> |
337 |
<option value = "1">Prézens</option>
|
|
338 |
<option value = "2">Aorist</option>
|
|
339 |
<option value = "3">Préteritum</option>
|
|
340 |
<option value = "4">Imperfektum</option>
|
|
341 |
<option value = "5">Plusquamperfektum</option>
|
|
342 |
<option value = "6">Futurum</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>
|
|
343 | 365 |
</select> |
344 | 366 |
</div> |
345 | 367 |
<div class="mr-3" id="filter-vid"> |
346 |
<label for="vid" class="mr-2">Druh</label>
|
|
368 |
<label for="vid" class="mr-2">Vid</label>
|
|
347 | 369 |
<select id="vid"> |
348 | 370 |
<option selected="selected" value = "">Nevybráno</option> |
349 |
<option value = "1">Perfektivum</option>
|
|
350 |
<option value = "2">Imperfektivum </option>
|
|
371 |
<option value = "P">Perfektivum</option>
|
|
372 |
<option value = "I">Imperfektivum </option>
|
|
351 | 373 |
</select> |
352 | 374 |
</div> |
353 | 375 |
<div class="mr-3" id="filter-v-type"> |
354 |
<label for="v-type" class="mr-2">Rod</label>
|
|
376 |
<label for="v-type" class="mr-2">Slovesný rod</label>
|
|
355 | 377 |
<select id="v-type"> |
356 | 378 |
<option selected="selected" value = "">Nevybráno</option> |
357 |
<option value = "1">Aktivum</option>
|
|
358 |
<option value = "2">Pasivum</option>
|
|
379 |
<option value = "A">Aktivum</option>
|
|
380 |
<option value = "P">Pasivum</option>
|
|
359 | 381 |
</select> |
360 | 382 |
</div> |
361 | 383 |
<div class="mr-3" id="filter-k-type"> |
362 | 384 |
<label for="k-type" class="mr-2">Typ</label> |
363 | 385 |
<select id="k-type"> |
364 | 386 |
<option selected="selected" value = "">Nevybráno</option> |
365 |
<option value = "1">Větná</option>
|
|
366 |
<option value = "2">Členská</option>
|
|
367 |
<option value = "3">Navazovací</option>
|
|
368 |
<option value = "4">Spojení s přechodníkem</option>
|
|
387 |
<option value = "V">Větná</option>
|
|
388 |
<option value = "C">Členská</option>
|
|
389 |
<option value = "N">Navazovací</option>
|
|
390 |
<option value = "P">Spojení s přechodníkem</option>
|
|
369 | 391 |
</select> |
370 | 392 |
</div> |
393 |
|
|
394 |
<!-- send button--> |
|
395 |
<button class="ml-auto btn" onclick="filterData()"> |
|
396 |
Filtrovat |
|
397 |
</button> |
|
371 | 398 |
</div> |
372 | 399 |
</div> |
373 | 400 |
|
... | ... | |
375 | 402 |
<table class="table table-striped"> |
376 | 403 |
<thead> |
377 | 404 |
<tr> |
405 |
<th scope="col">Slovo</th> |
|
378 | 406 |
<th scope="col">Lemma</th> |
379 |
<th scope="col">Tvar slova</th> |
|
380 |
<th scope="col">Detail</th> |
|
381 |
<th scope="col">Morfém</th> |
|
382 | 407 |
<th scope="col">Rukopisy</th> |
383 | 408 |
<th scope="col">Pozice</th> |
384 | 409 |
<th scope="col"></th> |
... | ... | |
386 | 411 |
</thead> |
387 | 412 |
<tbody id="search-table"> |
388 | 413 |
<script> |
389 |
const data = [{"id":1,"context":"","date":"2013-08-22 00:00:00","description":"","description2":"","description3":"","ending":"e","finished":true,"namedentity":0,"position1":"45","position2":"19","positiondetail":"","prefix":"","suffix":"","word":"abaty\u0161e","lemma_id":1,"tag_id":1},{"id":2,"context":"","date":"2013-08-22 00:00:00","description":"","description2":"","description3":"","ending":"e","finished":true,"namedentity":0,"position1":"45","position2":"20","positiondetail":"","prefix":"","suffix":"","word":"abaty\u0161e","lemma_id":1,"tag_id":2},{"id":24,"context":"","date":"2013-05-29 00:00:00","description":"","description2":"\\N","description3":"\\N","ending":"","finished":true,"namedentity":1,"position1":"100","position2":"07","positiondetail":"","prefix":"","suffix":"","word":"Albrecht","lemma_id":7,"tag_id":8},{"id":3,"context":"","date":"2013-08-22 00:00:00","description":"","description2":"","description3":"","ending":"\u011b","finished":true,"namedentity":0,"position1":"45","position2":"19","positiondetail":"","prefix":"","suffix":"","word":"abaty\u0161\u011b","lemma_id":1,"tag_id":1},{"id":4,"context":"","date":"2013-05-27 00:00:00","description":"","description2":"","description3":"","ending":"a","finished":true,"namedentity":1,"position1":"96","position2":"15","positiondetail":"","prefix":"","suffix":"","word":"Adalfa","lemma_id":2,"tag_id":3},{"id":5,"context":"","date":"2013-05-27 00:00:00","description":"","description2":"\\N","description3":"\\N","ending":"a","finished":true,"namedentity":1,"position1":"96","position2":"15","positiondetail":"","prefix":"","suffix":"","word":"Adolfa","lemma_id":3,"tag_id":3},{"id":25,"context":"","date":"2013-05-28 00:00:00","description":"","description2":"","description3":"","ending":"a","finished":true,"namedentity":1,"position1":"99","position2":"04","positiondetail":"","prefix":"","suffix":"","word":"Albrechta","lemma_id":7,"tag_id":3},{"id":6,"context":"","date":"2013-05-31 00:00:00","description":"","description2":"\\N","description3":"\\N","ending":"\u011b","finished":true,"namedentity":1,"position1":"104","position2":"24","positiondetail":"","prefix":"","suffix":"\u00e9\u0159","word":"Ajn\u0161tejn\u00e9\u0159\u011b","lemma_id":4,"tag_id":3},{"id":7,"context":"","date":"2013-05-27 00:00:00","description":"","description2":"","description3":"","ending":"u","finished":true,"namedentity":0,"position1":"96","position2":"10","positiondetail":"","prefix":"","suffix":"\u00f3v","word":"Albertovu","lemma_id":5,"tag_id":4},{"id":38,"context":"z","date":"2013-03-28 00:00:00","description":"","description2":"\\N","description3":"\\N","ending":"a","finished":true,"namedentity":1,"position1":"39","position2":"05","positiondetail":"","prefix":"","suffix":"","word":"Aldenburka","lemma_id":12,"tag_id":7}]; |
|
390 |
let result = ""; |
|
391 |
data.forEach((item) => { |
|
392 |
result += "<tr>"; |
|
393 |
result += "<td>" + item.lemma_id + "</td>"; |
|
394 |
result += "<td>" + item.word + "</td>"; |
|
395 |
result += "<td>" + item.prefix + "</td>"; |
|
396 |
result += "<td>" + item.suffix + "</td>"; |
|
397 |
result += "<td>" + item.ending + "</td>"; |
|
398 |
result += "<td>" + item.ending + "</td>"; |
|
399 |
result += "<td class=\"action-td\">" + |
|
400 |
"<button class=\"btn\"><i class=\"fa fa-search\"></i></button>" + |
|
401 |
"</td>"; |
|
402 |
result += "</tr>"; |
|
403 |
}); |
|
404 |
document.getElementById("search-table").innerHTML = result; |
|
414 |
function filterData () { |
|
415 |
//TODO |
|
416 |
} |
|
417 |
|
|
418 |
let data; |
|
419 |
|
|
420 |
function fetchData () { |
|
421 |
// (A1) GET SEARCH TERM |
|
422 |
const formData = new FormData(); |
|
423 |
formData.append("page", "0");//TODO PAGING |
|
424 |
formData.append("items_per_page", "50");//TODO PAGING |
|
425 |
formData.append("finished", "true");//TODO ADMIN |
|
426 |
|
|
427 |
// (A2) AJAX - USE HTTP:// NOT FILE:// |
|
428 |
let xhr = new XMLHttpRequest(); |
|
429 |
xhr.open("POST", "./controller/TableController.php"); |
|
430 |
xhr.onload = function(){ |
|
431 |
let search = this.response; |
|
432 |
let parsedJSON = JSON.parse(search); |
|
433 |
data = parsedJSON.data; |
|
434 |
renderData(parsedJSON.data); |
|
435 |
}; |
|
436 |
xhr.send(formData); |
|
437 |
} |
|
438 |
|
|
439 |
function renderManuscript(manuscripts, shorten=true) { |
|
440 |
const names = [ |
|
441 |
"rukopis Vídeňský", |
|
442 |
"zlomky Hanušovy", |
|
443 |
"zlomky Hradecké", |
|
444 |
"rukopis Cambridžský", |
|
445 |
"rukopis Františkánský", |
|
446 |
"zlomek Olomoucký", |
|
447 |
"fragment Strahovský", |
|
448 |
"zlomky Klementinsko-Křižovnické", |
|
449 |
"zlomky Mnichovské", |
|
450 |
"rukopis Lobkovický", |
|
451 |
"rukopis Pelclův", |
|
452 |
"rukopis Cerronský", |
|
453 |
"rukopis Fürstenberský", |
|
454 |
"rukopis Zebererův", |
|
455 |
"vydání Pavla Ješína z Bezdězi, Praha 1620", |
|
456 |
"básně připsané při Pulkavově kronice v rukopisu Litoměřickém", |
|
457 |
]; |
|
458 |
let output = ""; |
|
459 |
for(let i = 0; i < manuscripts.length; i++){ |
|
460 |
output += names[manuscripts[i]]; |
|
461 |
|
|
462 |
if(i < manuscripts.length - 1){ |
|
463 |
if(shorten && i === 2){ |
|
464 |
const extras = manuscripts.length - (i + 1); |
|
465 |
output += " <i><small>a " + extras + " další" + (extras > 4? "ch" : "") + "</small></i>"; |
|
466 |
break; |
|
467 |
} |
|
468 |
output += "; " |
|
469 |
} |
|
470 |
} |
|
471 |
return output; |
|
472 |
} |
|
473 |
|
|
474 |
function renderData(data) { |
|
475 |
let result = ""; |
|
476 |
data.forEach((item,id) => { |
|
477 |
result += "<tr>"; |
|
478 |
result += "<td>" + item.word + "</td>"; |
|
479 |
result += "<td>" + item.lemma.lemma + "</td>"; |
|
480 |
result += "<td>" + renderManuscript(item.manuscript) + "</td>"; |
|
481 |
result += "<td>" + item.position1 + (item.position2 ? ("/" + item.position2 + (item.positiondetail ? "/" + item.positiondetail : "")) : "") + "</td>"; |
|
482 |
result += "<td class=\"action-td\">" + |
|
483 |
"<button class=\"btn\" title=\"Detail\" data-toggle=\"modal\" data-target=\"#detail-modal\" data-pseudo-id='" + id + "'><i class=\"fa fa-search\"></i></button>" + |
|
484 |
"</td>"; |
|
485 |
result += "</tr>"; |
|
486 |
}); |
|
487 |
document.getElementById("search-table").innerHTML = result; |
|
488 |
} |
|
405 | 489 |
</script> |
406 | 490 |
</tbody> |
407 | 491 |
</table> |
Také k dispozici: Unified diff
Feature #8350: Vytvoření modalů detailu a editu - detail