schemas.html
4.07 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
{% load staticfiles %}
{% load hash %}
{% load jsonify %}
<script src="{% static 'sloval/jquery-1.11.1.min.js' %}"></script>
<script src="https://raw.githubusercontent.com/trentrichardson/jQuery-Impromptu/master/dist/jquery-impromptu.min.js"></script>
<script>
var schemas = new Object;
var default_order = new Object;
{% for characteristic in characteristics %}
default_order[{{ characteristic }}] = []
{% for i, status, colspan, id, categories, rowspan, arguments in schemas_display|hash:characteristic %}
schemas["{{ id }}"] = '<table class="InactiveFrameTable">'
+ '<tr><td class="ColumnHeader">Ocena schematu:</td><td class=u"schema_{{ id }}_" colspan="{{ colspan }}">'
+ '<span class="Opinion">{{ status }}[{{ id }}]</span>'
+ '<span class="CheckComp"></span></td><tr>'
+ '<tr>'
+ '<td class="ColumnHeader">Kategoria:</td>'
{% for id, class, category in categories %}
+ '<td id="{{ id }}" class="{{ class }}" onclick="schemaClick(\'{{ class }}\')">'
+ '{{ category }}'
+ '</td>'
{% endfor %}
+ '</tr>'
+ '<tr>'
+ '<td class="ColumnHeader" rowspan="{{ rowspan }}">Argumenty:</td>'
{% for row in arguments %}
{% for id, class, argument in row %}
+ '<td id="{{ id }}" class="{{ class }}" onclick="schemaClick(\'{{ class }}\')">'
+ '{{ argument }}'
+ '</td>'
{% endfor %}
+ '</tr><tr>'
{% endfor %}
+ '</tr>'
+ '</table>';
default_order[{{ characteristic }}][{{ i }} - 1] = {{ id }}
{% endfor %}
{% endfor %}
var ranks = new Object;
{% for schema_id in schema_unit_rank %}
ranks["{{ schema_id }}"] = new Object;
{% for unit_id in schema_unit_rank|hash:schema_id %}
ranks["{{ schema_id }}"]["{{ unit_id }}"] = {{ schema_unit_rank|hash:schema_id|hash:unit_id }};
{% endfor %}
{% endfor %}
function reorder(frame_id) {
if (frame_id >= 0) {
lus = lexical_units[frame_id]
rank_values = new Object;
for (var schema_id in ranks) {
rank_values[schema_id] = 0.0
for (i = 0; i < lus.length; i++) {
rank_values[schema_id] += ranks[schema_id][lus[i]]
}
}
ranks_to_sort = []
for (var schema_id in rank_values) {
ranks_to_sort.push({ id: schema_id, value: rank_values[schema_id] })
}
ranks_to_sort.sort(value_compare);
for (i = 0; i < ranks_to_sort.length; i++) {
$("#"+(i+1)).html(schemas[ranks_to_sort[i].id])
}
} else {
for (i = 0; i < default_order.length; i++) {
$("#"+(i+1)).html(schemas[default_order[i]])
}
}
}
function value_compare(a, b) {
return b.value - a.value;
}
$(document).ready(function(){
for (var char in default_order) {
for (i = 0; i < default_order[char].length; i++) {
$("#"+char+"-"+(i+1)).html(schemas[default_order[char][i]])
}
}
})
</script>
{% for characteristic in characteristics %}
{% for c in characteristics_info|hash:characteristic %}
<div><strong>{{ lemma.entry }} {{ c.reflexiveness.reflexiveness }}({{ c.negativeness.negativeness }}, {{ c.predicativeness.predicativeness }}, {{ c.aspect.aspect }}):</strong></div>
{% endfor %}
{% for i, status, colspan, id, categories, rowspan, arguments in schemas_display|hash:characteristic %}
<table><tr id="{{ i }}"><td id="{{ characteristic }}-{{ i }}">
</td></tr></table>
{% endfor %}
{% endfor %}