lemma_preview.html
9.94 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
<script type="text/javascript">
// <!--
var prev_frames = new Array();
var prev_nkjp_examples = new Array();
var activePrevPanel = 'prev_frames_modif';
var selectedPrevFrameIdNkjp = -1;
var prev_selected_example_id = -1;
frame_chars_str = '{{frame_char_list}}';
frame_chars_str = convertHtml(frame_chars_str);
window.frame_char_order = serializedObjToObj(frame_chars_str);
function selectPrevNkjpTr(id)
{
if(window.prev_selected_example_id != -1)
{
var recent_row = document.getElementById(window.prev_selected_example_id);
var recent_descendants = getDescendantsNodes(recent_row);
for(var i = 0; i<recent_descendants.length; i++)
$(recent_descendants[i]).css("background-color", "");
}
if(window.prev_selected_example_id == id)
{
window.prev_selected_example_id = -1;
}
else
{
window.prev_selected_example_id = id;
var row = document.getElementById(id);
var descendants = getDescendantsNodes(row);
for(var i = 0; i<descendants.length; i++)
$(descendants[i]).css("background-color", "LightSteelBlue");
nkjpInstance = getNkjpExampleInstance(window.prev_nkjp_examples, id);
// wyswietlanie komentarza jesli istnieje
if(nkjpInstance.comment)
{
var nkjp_table_container = document.getElementById("show_prev_nkjp_table");
var last_shown_comm_elem = document.getElementById('prev_example_comment');
$(last_shown_comm_elem).remove();
var outer_div = document.createElement('div');
outer_div.setAttribute('id', 'prev_example_comment');
var strong = document.createElement('strong');
strong.appendChild(document.createTextNode("Komentarz do przykładu:"));
outer_div.appendChild(strong);
div = document.createElement('div');
pre = document.createElement('pre');
pre.appendChild(document.createTextNode(nkjpInstance.comment));
div.appendChild(pre);
outer_div.appendChild(div);
nkjp_table_container.appendChild(outer_div);
}
//selectTd(nkjpInstance.frame_id);
var parent = document.getElementById("prev-lemma-tables");
var matching_elements = getMatchingElements(parent, nkjpInstance.frame_id);
for(var i=0; i<matching_elements.length; i++)
$(matching_elements[i]).css("background-color", "LightSteelBlue");
for(var i=0; i<nkjpInstance.arguments_ids.length; i++)
{
unselectPrevTd(nkjpInstance.arguments_ids[i]);
}
}
}
function selectPrevTd(id)
{
var parent = document.getElementById("prev-lemma-tables");
var recent_sel_elements = new Array();
if(window.activePrevPanel == 'prev_frames_modif')
{
if(prev_selected_id != -1)
{
recent_sel_elements = getMatchingElements(parent, prev_selected_id);
for(var i=0; i<recent_sel_elements.length; i++)
$(recent_sel_elements[i]).css("background-color", "");
}
if(prev_selected_id == id)
prev_selected_id = -1;
else
{
prev_selected_id = id;
var matching_elements = getMatchingElements(parent, id);
for(var i=0; i<matching_elements.length; i++)
$(matching_elements[i]).css("background-color", "LightSteelBlue");
}
}
else if(window.activePrevPanel == 'show_prev_nkjp_example')
{
elementInstance = getElementInstance(id, window.prev_frames);
if(elementInstance['type'] == 'frame')
{
prev_selected_example_id = -1;
if(id != window.selectedPrevFrameIdNkjp)
unselectPrevTd(window.selectedPrevFrameIdNkjp);
window.selectedPrevFrameIdNkjp = id;
var parent = document.getElementById("prev-lemma-tables");
var matching_elements = getMatchingElements(parent, id);
for(var i=0; i<matching_elements.length; i++)
$(matching_elements[i]).css("background-color", "LightSteelBlue");
var table_container = document.getElementById("show_prev_nkjp_table");
draw_nkjp_table(table_container, id, prev_nkjp_examples, 'PrevNkjpTableRow', 'nkjp_');
$("tr.PrevNkjpTableRow").click(function(){
selectPrevNkjpTr(this.id)});
}
}
}
function unselectPrevTd(id)
{
var parent = document.getElementById("prev-lemma-tables");
var recent_sel_elements = getMatchingElements(parent, id);
for(var i=0; i<recent_sel_elements.length; i++)
$(recent_sel_elements[i]).css("background-color", "");
}
function draw_filtered_prev_frames()
{
window.prev_filter_schema_type_val = $('#prev_frame_filter #schema_type_filter').val();
window.prev_filter_aspect_val = $('#prev_frame_filter #aspect_filter').val();
window.prev_filter_reflex_val = $('#prev_frame_filter #reflex_filter').val();
window.prev_filter_neg_val = $('#prev_frame_filter #neg_filter').val();
window.prev_filter_pred_val = $('#prev_frame_filter #pred_filter').val();
window.prev_filter_opinion_val = $('#prev_frame_filter #opinion_filter').val();
window.prev_filter_position_val = $('#prev_frame_filter #position_filter').val();
window.prev_filter_argument_val = $('#prev_frame_filter #argument_filter').val();
draw_filtered_frames(window.prev_frames, 'prev-lemma-tables', 'prev-lemma-table', 'prev_frame_filter', window.prev_nkjp_examples, 'InactiveFrameTable', window.prev_lemma_entry);
}
$("button#prev_copy").click(function(){copyElement()});
$("button#prev_relate_entries").click(function(){relateEntries()});
$("button#prev_disrelate_entries").click(function(){disrelateEntries()});
// -->
</script>
<div id='prevFramesSplit'>
<div id="prev-lemma-tables">
</div>
<div id="prev_tabs" class="prev_tabs">
<ul>
<!--li id='prev_lemma_info' style="float:left;">{{selected_lemma.entry}} ({{selected_lemma.vocabulary.name}})</li-->
<li><a href="#prev_frames_modif">Modyfikacja schematów</a></li>
<li><a href="#show_prev_nkjp_example">Przegląd przykładów</a></li>
<li><a href="#similar_lemmas">Czasowniki podobne</a></li>
<span id="cancel_prev_frame_filter" style="float:right;">x</span>
<span style="float:right;">
<ul id="filter_frames_menu">
<li id="prev_filter_frames_options"><a href="#">Filtrowanie schematów</a>
<ul id="options">
<li id="prev_frame_filter"><a href="#"></a></li>
</ul>
</li>
</ul>
</span>
</ul>
<div id="prev_frames_modif">
{% if perms.dictionary.add_syntactic_frames or perms.dictionary.add_phraseologic_frames or perms.dictionary.add_semantic_frames%}
{% if perms.dictionary.add_syntactic_frames or perms.dictionary.add_phraseologic_frames %}
<div>
<button type="button" id="prev_copy" style="width:120px">Kopiuj</button>
</div>
{% endif %}
{% if perms.dictionary.add_syntactic_frames or perms.dictionary.add_semantic_frames %}
<div>
<button type="button" id="prev_relate_entries" style="width:120px">Powiąż hasła</button>
<button type="button" id="prev_disrelate_entries" style="width:140px; visibility:hidden;">Anuluj powiązanie</button>
</div>
{% endif %}
{% else %}
Brak możliwych działań.
{% endif %}
</div>
<div id="show_prev_nkjp_example">
<div id="show_prev_nkjp_table">
Wybierz schemat, aby zobaczyć dodane do niego przykłady.
</div>
</div>
<div id="similar_lemmas">
<strong>Powiązane hasła:</strong>
<button id="related-lemmas-show">
Pokaż
</button></br>
<strong>Podobieństwo znaczeniowe:</strong>
<button id="similar-lemmas-show-synonyms">
Pokaż podobne
</button></br>
<strong>Nowe schematy:</strong>
<form class="similar-lemmas-new-form" method="post"> {% csrf_token %}
{{ similarLemmasNewForm.as_p }}
<p class="lexeme-save">
<button type="submit" id="similar-lemmas-new-form-submit">
Pokaż podobne
</button>
<button type="reset" id="similar-lemmas-new-form-cancel">
Wyczyść
</button>
</p>
</form>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
window.prev_lemma_entry = '{{selected_lemma.entry_obj.name}}';
window.activePrevPanel = 'prev_frames_modif';
$(".prev_tabs").tabs().bind('tabsselect', function(event, ui) {
window.activePrevPanel = ui.panel.id;
// czyszczenie zaznaczen elementow w tablicach (trzeba to jeszcze fizycznie zrobic)
unselectPrevTd(window.prev_selected_id);
window.prev_selected_id = -1;
unselectPrevTd(window.selectedPrevFrameIdNkjp);
//$('#show_prev_nkjp_table').empty();
window.selectedPrevFrameIdNkjp = -1;
prev_selected_example_id = -1;
});
draw_frames_filter('prev_frame_filter');
$('#prev_filter_frames_options #options').hide();
$('#prev_filter_frames_options').click(function(){
$('#prev_filter_frames_options #options').slideToggle('fast');
});
$('#prev_frame_filter #schema_type_filter').change(draw_filtered_prev_frames);
$('#prev_frame_filter #aspect_filter').change(draw_filtered_prev_frames);
$('#prev_frame_filter #reflex_filter').change(draw_filtered_prev_frames);
$('#prev_frame_filter #neg_filter').change(draw_filtered_prev_frames);
$('#prev_frame_filter #pred_filter').change(draw_filtered_prev_frames);
$('#prev_frame_filter #opinion_filter').change(draw_filtered_prev_frames);
$('#prev_frame_filter #argument_filter').change(draw_filtered_prev_frames);
$('#prev_frame_filter #position_filter').change(draw_filtered_prev_frames);
$('#prev_filter_frames_options #options').click(function(event) {
event.stopPropagation();
});
$('#cancel_prev_frame_filter').click(cancel_prev_schemata_filtering);
});
</script>