Projekt

Obecné

Profil

Stáhnout (14.6 KB) Statistiky
| Větev: | Revize:
1
<div id="detail-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">Detail záznamu</h4>
6
                <button type="button" class="close" data-dismiss="modal">&times;</button>
7
            </div>
8
            <div class="modal-body">
9
                <div class="container">
10
                    <div class="row">
11
                        <div class="col-xs-12 col-sm-4">
12
                            <label>Lemma:</label>
13
                        </div>
14
                        <div class="col-xs-12 col-sm-8">
15
                            <i id="lemma"></i>
16
                        </div>
17
                    </div>
18
                    <div class="row">
19
                        <div class="col-xs-12 col-sm-4">
20
                            <label>Slovní tvar:</label>
21
                        </div>
22
                        <div class="col-xs-12 col-sm-8">
23
                            <i id="word"></i>
24
                        </div>
25
                    </div>
26
                    <div class="row">
27
                        <div class="col-xs-12 col-sm-4">
28
                            <label>Datum přídání:</label>
29
                        </div>
30
                        <div class="col-xs-12 col-sm-8">
31
                            <i id="date"></i>
32
                        </div>
33
                    </div>
34
                    <div class="row">
35
                        <div class="col-xs-12 col-sm-4">
36
                            <label>Poznámka:</label>
37
                        </div>
38
                        <div class="col-xs-12 col-sm-8">
39
                            <i id="description"></i>
40
                        </div>
41
                    </div>
42
                    <div class="row">
43
                        <div class="col-xs-12 col-sm-4">
44
                            <label>Doplňující údaj:</label>
45
                        </div>
46
                        <div class="col-xs-12 col-sm-8">
47
                            <i id="description2"></i>
48
                        </div>
49
                    </div>
50
                    <?php if(isset($_SESSION['loggedIn']) && $_SESSION['loggedIn'] == true) {?>
51
                    <div class="row">
52
                        <div class="col-xs-12 col-sm-4">
53
                            <label>Varia:</label>
54
                        </div>
55
                        <div class="col-xs-12 col-sm-8">
56
                            <i id="description3"></i>
57
                        </div>
58
                    </div>
59
                    <?php }?>
60
                    <div class="row">
61
                        <div class="col-xs-12 col-sm-4">
62
                            <label>Rukopisy:</label>
63
                        </div>
64
                        <div class="col-xs-12 col-sm-8">
65
                            <i id="manuscript"></i>
66
                        </div>
67
                    </div>
68
                    <div class="row">
69
                        <div class="col-xs-12 col-sm-4">
70
                            <label>Pozice:</label>
71
                        </div>
72
                        <div class="col-xs-12 col-sm-8">
73
                            <i id="position"></i>
74
                        </div>
75
                    </div>
76
                    <div class="row">
77
                        <div class="col-xs-12 col-sm-4">
78
                            <label>Vlastní jméno:</label>
79
                        </div>
80
                        <div class="col-xs-12 col-sm-8">
81
                            <i id="namedentity"></i>
82
                        </div>
83
                    </div>
84
                    <div class="row">
85
                        <div class="col-xs-12 col-sm-4">
86
                            <label>Kontext:</label>
87
                        </div>
88
                        <div class="col-xs-12 col-sm-8">
89
                            <i id="context"></i>
90
                        </div>
91
                    </div>
92
                    <div class="row">
93
                        <div class="col-xs-12 col-sm-4">
94
                            <label>Slovní druh:</label>
95
                        </div>
96
                        <div class="col-xs-12 col-sm-8">
97
                            <i id="wordclass"></i>
98
                        </div>
99
                    </div>
100

    
101
                    <!-- conditional render -->
102
                    <div class="row" id="person-wrapper">
103
                        <div class="col-xs-12 col-sm-4">
104
                            <label>Osoba:</label>
105
                        </div>
106
                        <div class="col-xs-12 col-sm-8">
107
                            <i id="person"></i>
108
                        </div>
109
                    </div>
110
                    <div class="row" id="case-wrapper">
111
                        <div class="col-xs-12 col-sm-4">
112
                            <label>Pád:</label>
113
                        </div>
114
                        <div class="col-xs-12 col-sm-8">
115
                            <i id="case"></i>
116
                        </div>
117
                    </div>
118
                    <div class="row" id="countability-wrapper">
119
                        <div class="col-xs-12 col-sm-4">
120
                            <label>Číslo:</label>
121
                        </div>
122
                        <div class="col-xs-12 col-sm-8">
123
                            <i id="countability"></i>
124
                        </div>
125
                    </div>
126
                    <div class="row" id="mood-wrapper">
127
                        <div class="col-xs-12 col-sm-4">
128
                            <label>Způsob:</label>
129
                        </div>
130
                        <div class="col-xs-12 col-sm-8">
131
                            <i id="mood"></i>
132
                        </div>
133
                    </div>
134
                    <div class="row" id="time-wrapper">
135
                        <div class="col-xs-12 col-sm-4">
136
                            <label>Čas:</label>
137
                        </div>
138
                        <div class="col-xs-12 col-sm-8">
139
                            <i id="time"></i>
140
                        </div>
141
                    </div>
142
                    <div class="row" id="v-type-wrapper">
143
                        <div class="col-xs-12 col-sm-4">
144
                            <label>Slovesný rod:</label>
145
                        </div>
146
                        <div class="col-xs-12 col-sm-8">
147
                            <i id="v-type"></i>
148
                        </div>
149
                    </div>
150
                    <div class="row" id="vid-wrapper">
151
                        <div class="col-xs-12 col-sm-4">
152
                            <label>Slovesný vid:</label>
153
                        </div>
154
                        <div class="col-xs-12 col-sm-8">
155
                            <i id="vid"></i>
156
                        </div>
157
                    </div>
158
                    <div class="row" id="irregular-wrapper">
159
                        <div class="col-xs-12 col-sm-4">
160
                            <label>Neurčitý slovesný tvar:</label>
161
                        </div>
162
                        <div class="col-xs-12 col-sm-8">
163
                            <i id="irregular"></i>
164
                        </div>
165
                    </div>
166
                    <div class="row" id="gender-wrapper">
167
                        <div class="col-xs-12 col-sm-4">
168
                            <label>Rod:</label>
169
                        </div>
170
                        <div class="col-xs-12 col-sm-8">
171
                            <i id="gender"></i>
172
                        </div>
173
                    </div>
174
                    <div class="row" id="shape-wrapper">
175
                        <div class="col-xs-12 col-sm-4">
176
                            <label>Tvar:</label>
177
                        </div>
178
                        <div class="col-xs-12 col-sm-8">
179
                            <i id="shape"></i>
180
                        </div>
181
                    </div>
182
                    <div class="row" id="grade-wrapper">
183
                        <div class="col-xs-12 col-sm-4">
184
                            <label>Stupeň:</label>
185
                        </div>
186
                        <div class="col-xs-12 col-sm-8">
187
                            <i id="grade"></i>
188
                        </div>
189
                    </div>
190
                    <div class="row" id="type-wrapper">
191
                        <div class="col-xs-12 col-sm-4">
192
                            <label>Druh:</label>
193
                        </div>
194
                        <div class="col-xs-12 col-sm-8">
195
                            <i id="type"></i>
196
                        </div>
197
                    </div>
198
                    <div class="row" id="k-type-wrapper">
199
                        <div class="col-xs-12 col-sm-4">
200
                            <label>Typ:</label>
201
                        </div>
202
                        <div class="col-xs-12 col-sm-8">
203
                            <i id="k-type"></i>
204
                        </div>
205
                    </div>
206
                </div>
207
            </div>
208
            <div class="modal-footer">
209
                <button type="button" class="btn btn-default" data-dismiss="modal">Zavřít</button>
210
            </div>
211
        </div>
212
    </div>
213
</div>
214

    
215
<script>
216
    $('#detail-modal').on('show.bs.modal', function (event) {
217
        const button = $(event.relatedTarget);
218
        const pseudo_id = button.data('pseudo-id') ;// Extract info from data-* attributes
219

    
220
        const data_obj = data[pseudo_id];
221
        let modal = $(this);
222

    
223
        modal.find('#word').text(data_obj.word);
224
        modal.find('#lemma').text(data_obj.lemma.lemma);
225
        modal.find('#description').text(data_obj.description === ""? "-" :  data_obj.description);
226
        modal.find('#description2').text(data_obj.description2 === ""? "-" :  data_obj.description2);
227
        modal.find('#description3').text(data_obj.description3 === ""? "-" :  data_obj.description3);
228
        modal.find('#date').text(convertDate(data_obj.date));
229
        modal.find('#manuscript').text(renderManuscript(data_obj.manuscript, false));
230
        modal.find('#position').text(data_obj.position1 + (data_obj.position2 ? ("/" + data_obj.position2 + (data_obj.positiondetail ? "/"  + data_obj.positiondetail :  "")) : ""));
231
        modal.find('#namedentity').text(data_obj.namedentity === 1? "ano" :  "ne");
232
        modal.find('#context').text(data_obj.context === ""? "-" :  data_obj.context);
233

    
234
        const morphem = data_obj.tag.tag;
235
        analyzeMorphem(modal, morphem);
236
    });
237

    
238
    function analyzeMorphem(modal, morphem) {
239
        modal.find('#wordclass').text(codeToWordclass[morphem.charAt(0)]);
240

    
241
        let movedNode;
242
        let beforeNode;
243
        if(morphem.charAt(0) === 'V') {
244
            movedNode = document.getElementById("case-wrapper");
245
            beforeNode = document.getElementById(null);
246
            movedNode.parentNode.insertBefore(movedNode, beforeNode);
247
        } else {
248
            movedNode = document.getElementById("case-wrapper");
249
            beforeNode = document.getElementById("countability-wrapper");
250
            movedNode.parentNode.insertBefore(movedNode, beforeNode);
251
        }
252

    
253
        (morphem.charAt(1) === '-') ? modal.find('#case-wrapper').hide() :
254
            modal.find('#case-wrapper').show();
255
        modal.find('#case').text(codeToCase[morphem.charAt(1)]);
256

    
257
        (morphem.charAt(2) === '-') ? modal.find('#countability-wrapper').hide() :
258
            modal.find('#countability-wrapper').show();
259
        modal.find('#countability').text(codeToCountability[morphem.charAt(2)]);
260

    
261
        (morphem.charAt(3) === '-') ? modal.find('#gender-wrapper').hide() :
262
            modal.find('#gender-wrapper').show();
263
        modal.find('#gender').text(codeToGender[morphem.charAt(3)]);
264

    
265
        (morphem.charAt(4) === '-') ? modal.find('#grade-wrapper').hide() :
266
            modal.find('#grade-wrapper').show();
267
        modal.find('#grade').text(codeToGrade[morphem.charAt(4)]);
268

    
269
        (morphem.charAt(5) === '-') ? modal.find('#shape-wrapper').hide() :
270
            modal.find('#shape-wrapper').show();
271
        modal.find('#shape').text(codeToShape[morphem.charAt(5)]);
272

    
273
        if(morphem.charAt(7) === '-'){
274
            modal.find('#k-type-wrapper').hide();
275
            modal.find('#type-wrapper').hide();
276
            modal.find('#mood-wrapper').hide();
277
            modal.find('#irregular-wrapper').hide();
278
        } else {
279
            if(morphem.charAt(0) === 'J') {
280
                modal.find('#mood-wrapper').hide();
281
                modal.find('#type-wrapper').hide();
282
                modal.find('#irregular-wrapper').hide();
283

    
284
                modal.find('#k-type-wrapper').show();
285
                modal.find('#k-type').text(codeToKType[morphem.charAt(7)]);
286
            } else if(morphem.charAt(0) === 'P') {
287
                modal.find('#k-type-wrapper').hide();
288
                modal.find('#mood-wrapper').hide();
289
                modal.find('#irregular-wrapper').hide();
290

    
291
                modal.find('#type-wrapper').show();
292
                modal.find('#type').text(codeToType[morphem.charAt(7)]);
293
            } else if(morphem.charAt(0) === 'V') {
294
                modal.find('#k-type-wrapper').hide();
295
                modal.find('#type-wrapper').hide();
296

    
297
                if(codeToMood[morphem.charAt(7)] !== undefined){
298
                    modal.find('#irregular-wrapper').hide();
299
                    modal.find('#mood-wrapper').show();
300
                    modal.find('#mood').text(codeToMood[morphem.charAt(7)]);
301
                } else {
302
                    modal.find('#mood-wrapper').hide();
303
                    modal.find('#irregular-wrapper').show();
304
                    modal.find('#irregular').text(codeToIrregular[morphem.charAt(7)]);
305
                }
306
            } else {
307
                modal.find('#k-type-wrapper').hide();
308
                modal.find('#type-wrapper').hide();
309
                modal.find('#mood-wrapper').hide();
310
                modal.find('#irregular-wrapper').hide();
311
            }
312
        }
313

    
314
        (morphem.charAt(8) === '-') ? modal.find('#person-wrapper').hide() :
315
            modal.find('#person-wrapper').show();
316
        modal.find('#person').text(morphem.charAt(8) + ".");
317

    
318
        (morphem.charAt(9) === '-') ? modal.find('#time-wrapper').hide() :
319
            modal.find('#time-wrapper').show();
320
        modal.find('#time').text(codeToTime[morphem.charAt(9)]);
321

    
322
        (morphem.charAt(10) === '-') ? modal.find('#v-type-wrapper').hide() :
323
            modal.find('#v-type-wrapper').show();
324
        modal.find('#v-type').text(codeToVType[morphem.charAt(10)]);
325

    
326
        (morphem.charAt(11) === '-') ? modal.find('#vid-wrapper').hide() :
327
            modal.find('#vid-wrapper').show();
328
        modal.find('#vid').text(codeToVid[morphem.charAt(11)]);
329
    }
330
</script>
(2-2/10)