Commit 902704d20310f6fd9caee77948e60f12bd9a4cc8

Authored by janek37
1 parent d4668dfb

ostrzeganie przed usunięciem klasyfikacji, poprawki z powodu zmienionych tabel

.idea/sqldialects.xml
1 <?xml version="1.0" encoding="UTF-8"?> 1 <?xml version="1.0" encoding="UTF-8"?>
2 <project version="4"> 2 <project version="4">
3 <component name="SqlDialectMappings"> 3 <component name="SqlDialectMappings">
4 - <file url="file://$PROJECT_DIR$/sql/history.sql" dialect="PostgreSQL" /> 4 + <file url="file://$PROJECT_DIR$/sql" dialect="PostgreSQL" />
5 </component> 5 </component>
6 </project> 6 </project>
7 7
dictionary/ajax_lexeme_view.py
@@ -145,6 +145,14 @@ def lexeme_edit_form(request, id): @@ -145,6 +145,14 @@ def lexeme_edit_form(request, id):
145 to_return['cross_references'] = crs 145 to_return['cross_references'] = crs
146 return to_return 146 return to_return
147 147
  148 +@ajax(method='get')
  149 +def check_classifications(request, owner_id, pos):
  150 + part_of_speech = PartOfSpeech.objects.get(symbol=pos)
  151 + owner = Vocabulary.objects.get(pk=owner_id)
  152 + classifications = owner.classifications.filter(
  153 + parts_of_speech=part_of_speech)
  154 + return {'classifications': list(classifications.values_list('pk', flat=True))}
  155 +
148 def make_classification_forms(lexeme, vocabulary=None, part_of_speech=None, 156 def make_classification_forms(lexeme, vocabulary=None, part_of_speech=None,
149 editable=True): 157 editable=True):
150 if not vocabulary: 158 if not vocabulary:
dictionary/export.py
@@ -89,10 +89,10 @@ def export_lexemes(data=None, output_file=None): @@ -89,10 +89,10 @@ def export_lexemes(data=None, output_file=None):
89 cursor = connection.cursor() 89 cursor = connection.cursor()
90 query = """ 90 query = """
91 select distinct haslo, prefiks||rdzen||zak||sufiks, l.pos, ch.charfl, tag, 91 select distinct haslo, prefiks||rdzen||zak||sufiks, l.pos, ch.charfl, tag,
92 - l.id as leksem_id, refl.lexemeattributevalue_id %(clas_field)s 92 + l.id as leksem_id, refl.attribute_value_id %(clas_field)s
93 from leksemy l 93 from leksemy l
94 join leksemy_w_slownikach ls on (ls.l_id = l.id) 94 join leksemy_w_slownikach ls on (ls.l_id = l.id)
95 - left outer join dictionary_lexemeattributevalue_lexemes refl 95 + left outer join dictionary_lexemeav refl
96 on (l.id = refl.lexeme_id and %(refl)s) 96 on (l.id = refl.lexeme_id and %(refl)s)
97 join odmieniasie o on (o.l_id = l.id) 97 join odmieniasie o on (o.l_id = l.id)
98 join charfle ch on ch.id = o.charfl 98 join charfle ch on ch.id = o.charfl
@@ -111,13 +111,13 @@ def export_lexemes(data=None, output_file=None): @@ -111,13 +111,13 @@ def export_lexemes(data=None, output_file=None):
111 union all 111 union all
112 -- wymagające gniazdowania przy hasłowaniu: adjcom, advcom, derywaty: 112 -- wymagające gniazdowania przy hasłowaniu: adjcom, advcom, derywaty:
113 select distinct g.haslo as haslo, prefiks||rdzen||zak||sufiks, l.pos, 113 select distinct g.haslo as haslo, prefiks||rdzen||zak||sufiks, l.pos,
114 - ch.charfl, tag, l.id as leksem_id, refl.lexemeattributevalue_id 114 + ch.charfl, tag, l.id as leksem_id, refl.attribute_value_id
115 %(clas_field)s 115 %(clas_field)s
116 from leksemy l 116 from leksemy l
117 join leksemy_w_slownikach ls on (ls.l_id = l.id) 117 join leksemy_w_slownikach ls on (ls.l_id = l.id)
118 join odsylacze on l.id=l_id_od 118 join odsylacze on l.id=l_id_od
119 join leksemy g on (l_id_do=g.id and g.usuniety = false) 119 join leksemy g on (l_id_do=g.id and g.usuniety = false)
120 - left outer join dictionary_lexemeattributevalue_lexemes refl 120 + left outer join dictionary_lexemeav refl
121 on (g.id = refl.lexeme_id and %(refl)s) 121 on (g.id = refl.lexeme_id and %(refl)s)
122 join odmieniasie o on l.id=o.l_id 122 join odmieniasie o on l.id=o.l_id
123 join charfle ch on ch.id = o.charfl 123 join charfle ch on ch.id = o.charfl
@@ -138,13 +138,13 @@ def export_lexemes(data=None, output_file=None): @@ -138,13 +138,13 @@ def export_lexemes(data=None, output_file=None):
138 'x_qual': qualifier_clauses, 138 'x_qual': qualifier_clauses,
139 'magic': magic_qualifier_clauses, 139 'magic': magic_qualifier_clauses,
140 'crtype_ids': ', '.join(str(pk) for pk in crtype_ids), # brzydko, oj tam 140 'crtype_ids': ', '.join(str(pk) for pk in crtype_ids), # brzydko, oj tam
141 - 'clas_field': ', classificationvalue_id' if data['commonness'] else '', 141 + 'clas_field': ', classification_value_id' if data['commonness'] else '',
142 'clas_join': 142 'clas_join':
143 - 'left outer join wartosci_klasyfikacji_lexemes wkl '  
144 - 'on (wkl.lexeme_id=l.id and wkl.classificationvalue_id in (%s))' 143 + 'left outer join dictionary_lexemecv wkl '
  144 + 'on (wkl.lexeme_id=l.id and wkl.classification_value_id in (%s))'
145 % ', '.join(str(pk) for pk in cv_ids) if data['commonness'] else '', 145 % ', '.join(str(pk) for pk in cv_ids) if data['commonness'] else '',
146 'refl': 146 'refl':
147 - 'refl.lexemeattributevalue_id in (%s)' 147 + 'refl.attribute_value_id in (%s)'
148 % ', '.join(str(pk) for pk in refls), 148 % ', '.join(str(pk) for pk in refls),
149 } 149 }
150 params_part = (list(data['vocabs']) + list(data['antivocabs']) + 150 params_part = (list(data['vocabs']) + list(data['antivocabs']) +
dictionary/history.py
@@ -106,10 +106,10 @@ def prepare_value(table, column, value): @@ -106,10 +106,10 @@ def prepare_value(table, column, value):
106 prepared = InflectionCharacteristic.objects.get(pk=int(value)).symbol 106 prepared = InflectionCharacteristic.objects.get(pk=int(value)).symbol
107 elif column == 'w_id': 107 elif column == 'w_id':
108 prepared = Pattern.objects.get(pk=int(value)).name 108 prepared = Pattern.objects.get(pk=int(value)).name
109 - elif column == 'classificationvalue_id': 109 + elif column in ('classification_value_id', 'classificationvalue_id'):
110 cv = ClassificationValue.all_objects.get(pk=int(value)) 110 cv = ClassificationValue.all_objects.get(pk=int(value))
111 prepared = (cv.label, cv.classification.name) 111 prepared = (cv.label, cv.classification.name)
112 - elif column == 'lexemeattributevalue_id': 112 + elif column == 'attribute_value_id':
113 av = LexemeAttributeValue.objects.get(pk=int(value)) 113 av = LexemeAttributeValue.objects.get(pk=int(value))
114 prepared = (av.value, av.attribute.name) 114 prepared = (av.value, av.attribute.name)
115 else: 115 else:
@@ -152,9 +152,9 @@ def transaction_table(transaction_data): @@ -152,9 +152,9 @@ def transaction_table(transaction_data):
152 if item1.row_id not in lips: 152 if item1.row_id not in lips:
153 lips[item1.row_id] = {} 153 lips[item1.row_id] = {}
154 lips[item1.row_id][attr] = before_after 154 lips[item1.row_id][attr] = before_after
155 - if column == 'lexemeattributevalue_id': 155 + if column == 'attribute_value_id':
156 extra_attributes.append(before_after) 156 extra_attributes.append(before_after)
157 - if column == 'classificationvalue_id': 157 + if column in ('classification_value_id', 'classificationvalue_id'):
158 classifications.append(before_after) 158 classifications.append(before_after)
159 if table == 'kwalifikatory_leksemow' and column == 'qualifier_id': 159 if table == 'kwalifikatory_leksemow' and column == 'qualifier_id':
160 qualifiers.append(before_after) 160 qualifiers.append(before_after)
dictionary/views.py
@@ -65,6 +65,7 @@ def lexeme_view(request): @@ -65,6 +65,7 @@ def lexeme_view(request):
65 'ajax_prompter_list': reverse('prompter_list'), 65 'ajax_prompter_list': reverse('prompter_list'),
66 'ajax_check_pos': reverse('check_pos'), 66 'ajax_check_pos': reverse('check_pos'),
67 'ajax_check_pattern': reverse('check_pattern'), 67 'ajax_check_pattern': reverse('check_pattern'),
  68 + 'ajax_check_classifications': reverse('check_classifications'),
68 'ajax_get_ics': reverse('get_ics'), 69 'ajax_get_ics': reverse('get_ics'),
69 'ajax_save_default_owner': reverse('save_default_owner'), 70 'ajax_save_default_owner': reverse('save_default_owner'),
70 'ajax_create_lexeme': reverse('create_lexeme'), 71 'ajax_create_lexeme': reverse('create_lexeme'),
dictionary/wsjp.py
@@ -20,8 +20,8 @@ def make_data(entries): @@ -20,8 +20,8 @@ def make_data(entries):
20 as rodzaj, podparad, row, col, rowspan, colspan, kskl 20 as rodzaj, podparad, row, col, rowspan, colspan, kskl
21 from 21 from
22 leksemy l 22 leksemy l
23 - left outer join dictionary_lexemeattributevalue_lexemes refl  
24 - on (l.id = refl.lexeme_id and refl.lexemeattributevalue_id in (%(refl)s)) 23 + left outer join dictionary_lexemeav refl
  24 + on (l.id = refl.lexeme_id and refl.attribute_value_id in (%(refl)s))
25 join odmieniasie o on (l.id = o.l_id) 25 join odmieniasie o on (l.id = o.l_id)
26 join charfle ch on (o.charfl = ch.id) 26 join charfle ch on (o.charfl = ch.id)
27 join wzory on (o.w_id = wzory.id) 27 join wzory on (o.w_id = wzory.id)
@@ -40,8 +40,8 @@ def make_data(entries): @@ -40,8 +40,8 @@ def make_data(entries):
40 join odsylacze ods on l.id = l_id_od 40 join odsylacze ods on l.id = l_id_od
41 join typyodsylaczy tods on ods.typods_id = tods.id 41 join typyodsylaczy tods on ods.typods_id = tods.id
42 join leksemy g on l_id_do = g.id 42 join leksemy g on l_id_do = g.id
43 - left outer join dictionary_lexemeattributevalue_lexemes refl  
44 - on (g.id = refl.lexeme_id and refl.lexemeattributevalue_id in (%(refl)s)) 43 + left outer join dictionary_lexemeav refl
  44 + on (g.id = refl.lexeme_id and refl.attribute_value_id in (%(refl)s))
45 join odmieniasie o on l.id = o.l_id 45 join odmieniasie o on l.id = o.l_id
46 join charfle ch on (o.charfl = ch.id) 46 join charfle ch on (o.charfl = ch.id)
47 join wzory on (o.w_id = wzory.id) 47 join wzory on (o.w_id = wzory.id)
@@ -57,7 +57,7 @@ def make_data(entries): @@ -57,7 +57,7 @@ def make_data(entries):
57 'haslo': 'haslo', 57 'haslo': 'haslo',
58 'entry_placeholders': entry_placeholders, 58 'entry_placeholders': entry_placeholders,
59 'leks_clause': '''l.pos not in ('skrl','skrw') and 59 'leks_clause': '''l.pos not in ('skrl','skrw') and
60 - (l.pos != 'v' or refl.lexemeattributevalue_id in (%s))''' 60 + (l.pos != 'v' or refl.attribute_value_id in (%s))'''
61 % nonrefl_ids, 61 % nonrefl_ids,
62 'refl': refl_ids, 62 'refl': refl_ids,
63 }, 63 },
@@ -69,7 +69,7 @@ def make_data(entries): @@ -69,7 +69,7 @@ def make_data(entries):
69 'haslo_tab': u"haslo||' się'", 69 'haslo_tab': u"haslo||' się'",
70 'haslo': 'haslo', 70 'haslo': 'haslo',
71 'entry_placeholders': entry_placeholders, 71 'entry_placeholders': entry_placeholders,
72 - 'leks_clause': '''(l.pos='v' and refl.lexemeattributevalue_id <> %s)''', 72 + 'leks_clause': '''(l.pos='v' and refl.attribute_value_id <> %s)''',
73 'refl': refl_ids, 73 'refl': refl_ids,
74 }, 74 },
75 entries + [empty_refl, 's'] 75 entries + [empty_refl, 's']
@@ -80,7 +80,7 @@ def make_data(entries): @@ -80,7 +80,7 @@ def make_data(entries):
80 'haslo_tab': "'nie '||haslo", 80 'haslo_tab': "'nie '||haslo",
81 'haslo': "'nie '||haslo", 81 'haslo': "'nie '||haslo",
82 'entry_placeholders': entry_placeholders, 82 'entry_placeholders': entry_placeholders,
83 - 'leks_clause': '''l.pos='v' and refl.lexemeattributevalue_id in (%s)''' 83 + 'leks_clause': '''l.pos='v' and refl.attribute_value_id in (%s)'''
84 % nonrefl_ids, 84 % nonrefl_ids,
85 'refl': refl_ids, 85 'refl': refl_ids,
86 }, 86 },
@@ -92,7 +92,7 @@ def make_data(entries): @@ -92,7 +92,7 @@ def make_data(entries):
92 'haslo_tab': u"'nie '||haslo||' się'", 92 'haslo_tab': u"'nie '||haslo||' się'",
93 'haslo': "'nie '||haslo", 93 'haslo': "'nie '||haslo",
94 'entry_placeholders': entry_placeholders, 94 'entry_placeholders': entry_placeholders,
95 - 'leks_clause': '''(l.pos='v' and refl.lexemeattributevalue_id <> %s)''', 95 + 'leks_clause': '''(l.pos='v' and refl.attribute_value_id <> %s)''',
96 'refl': refl_ids, 96 'refl': refl_ids,
97 }, 97 },
98 entries + [empty_refl, 'ns'] 98 entries + [empty_refl, 'ns']
@@ -104,7 +104,7 @@ def make_data(entries): @@ -104,7 +104,7 @@ def make_data(entries):
104 'entry_placeholders': entry_placeholders, 104 'entry_placeholders': entry_placeholders,
105 'main_clause': '''typods in ('comadj','comadv','ppasver') and 105 'main_clause': '''typods in ('comadj','comadv','ppasver') and
106 l.pos in ('adjcom','advcom','ppas') and 106 l.pos in ('adjcom','advcom','ppas') and
107 - (l.pos != 'ppas' or refl.lexemeattributevalue_id in (%s))''' 107 + (l.pos != 'ppas' or refl.attribute_value_id in (%s))'''
108 % nonrefl_ids, 108 % nonrefl_ids,
109 'refl': refl_ids, 109 'refl': refl_ids,
110 }, 110 },
@@ -116,7 +116,7 @@ def make_data(entries): @@ -116,7 +116,7 @@ def make_data(entries):
116 'haslo': u"g.haslo||' się'", 116 'haslo': u"g.haslo||' się'",
117 'entry_placeholders': entry_placeholders, 117 'entry_placeholders': entry_placeholders,
118 'main_clause': '''(typods ='ppasver' and l.pos ='ppas' and 118 'main_clause': '''(typods ='ppasver' and l.pos ='ppas' and
119 - refl.lexemeattributevalue_id <> %s)''', 119 + refl.attribute_value_id <> %s)''',
120 'refl': refl_ids, 120 'refl': refl_ids,
121 }, 121 },
122 entries + [empty_refl] 122 entries + [empty_refl]
media/js/lexeme-view.js
1 var prompter_ctrl, created; 1 var prompter_ctrl, created;
2 2
  3 +function init_selection(jq) {
  4 + "use strict";
  5 + jq.find('option:selected').addClass('last-selected');
  6 +}
  7 +
  8 +function revert_selection(jq) {
  9 + "use strict";
  10 + jq.find('option.last-selected').prop('selected', true);
  11 +}
  12 +
  13 +function confirm_selection(jq) {
  14 + "use strict";
  15 + jq.find('option.last-selected').removeClass('last-selected');
  16 + jq.find('option:selected').addClass('last-selected');
  17 +}
  18 +
3 function selected_qualifiers_text(num, total, checked) { 19 function selected_qualifiers_text(num, total, checked) {
4 "use strict"; 20 "use strict";
5 if (num >= 4) 21 if (num >= 4)
@@ -227,6 +243,11 @@ function get_entry() { @@ -227,6 +243,11 @@ function get_entry() {
227 return $('#id_entry').val(); 243 return $('#id_entry').val();
228 } 244 }
229 245
  246 +function get_owner() {
  247 + "use strict";
  248 + return $('#id_new_owner').val();
  249 +}
  250 +
230 function join_attrs(attrs) { 251 function join_attrs(attrs) {
231 "use strict"; 252 "use strict";
232 return $.map(attrs, function(attr) { 253 return $.map(attrs, function(attr) {
@@ -234,6 +255,13 @@ function join_attrs(attrs) { @@ -234,6 +255,13 @@ function join_attrs(attrs) {
234 }).join(', '); 255 }).join(', ');
235 } 256 }
236 257
  258 +function join_classifications(clas_ids) {
  259 + "use strict";
  260 + return $.map(clas_ids, function(c_id) {
  261 + return $("[for='id_cl" + c_id + "-values']").text().replace(':', '');
  262 + }).join(', ');
  263 +}
  264 +
237 function init_form_widgets() { 265 function init_form_widgets() {
238 "use strict"; 266 "use strict";
239 $(document).on('click', '.lip-row span.remove', function() { 267 $(document).on('click', '.lip-row span.remove', function() {
@@ -259,8 +287,7 @@ function init_form_widgets() { @@ -259,8 +287,7 @@ function init_form_widgets() {
259 $(document).on('click', '#add-row', function() { 287 $(document).on('click', '#add-row', function() {
260 var id = lexeme_id(); 288 var id = lexeme_id();
261 var new_row = $(get_new_row_html(id)); 289 var new_row = $(get_new_row_html(id));
262 - new_row.find('.inflection-characteristic option:selected')  
263 - .addClass('last-selected'); 290 + init_selection(new_row.find('.inflection-characteristic'));
264 var pattern_list = $('#pattern-list'); 291 var pattern_list = $('#pattern-list');
265 pattern_list.append(new_row); 292 pattern_list.append(new_row);
266 var elem = pattern_list.find('.lip-qualifiers').last(); 293 var elem = pattern_list.find('.lip-qualifiers').last();
@@ -381,7 +408,21 @@ function init_form_widgets() { @@ -381,7 +408,21 @@ function init_form_widgets() {
381 $('#move-lexeme').toggleClass('move-hidden'); 408 $('#move-lexeme').toggleClass('move-hidden');
382 }); 409 });
383 $(document).on('change', '#id_part_of_speech', check_pos); 410 $(document).on('change', '#id_part_of_speech', check_pos);
384 - $(document).on('change', '#id_new_owner', reload_classifications); 411 + $(document).on('change', '#id_new_owner', function() {
  412 + var stale_classifications = check_classifications(), confirmed;
  413 + if (stale_classifications.length > 0) {
  414 + confirmed = window.confirm(
  415 + 'Zostaną usunięte klasyfikacje: ' +
  416 + join_classifications(stale_classifications) + 'Kontynuować?');
  417 + if (!confirmed) {
  418 + revert_selection($(this));
  419 + }
  420 + }
  421 + if (confirmed || stale_classifications.length === 0) {
  422 + confirm_selection($(this));
  423 + reload_classifications();
  424 + }
  425 + });
385 $(document).on('change', '.inflection-characteristic', function() { 426 $(document).on('change', '.inflection-characteristic', function() {
386 var new_ics = get_ic_symbols(); 427 var new_ics = get_ic_symbols();
387 var stale_attrs = check_attrs(new_ics); 428 var stale_attrs = check_attrs(new_ics);
@@ -390,12 +431,11 @@ function init_form_widgets() { @@ -390,12 +431,11 @@ function init_form_widgets() {
390 confirmed = window.confirm("Atrybuty: " + join_attrs(stale_attrs) + 431 confirmed = window.confirm("Atrybuty: " + join_attrs(stale_attrs) +
391 ' zostaną usunięte. Kontynouwać?'); 432 ' zostaną usunięte. Kontynouwać?');
392 if (!confirmed) { 433 if (!confirmed) {
393 - $(this).find('option.last-selected').prop('selected', true); 434 + revert_selection($(this));
394 } 435 }
395 } 436 }
396 if (confirmed || stale_attrs.length === 0) { 437 if (confirmed || stale_attrs.length === 0) {
397 - $(this).find('option.last-selected').removeClass('last-selected');  
398 - $(this).find('option:selected').addClass('last-selected'); 438 + confirm_selection($(this));
399 reload_attributes(); 439 reload_attributes();
400 } 440 }
401 }); 441 });
@@ -413,7 +453,7 @@ function reload_classifications() { @@ -413,7 +453,7 @@ function reload_classifications() {
413 "use strict"; 453 "use strict";
414 var data = { 454 var data = {
415 lexeme_id: lexeme_id(), 455 lexeme_id: lexeme_id(),
416 - vocab_id: $('#id_new_owner').val(), 456 + vocab_id: get_owner(),
417 pos: get_pos() 457 pos: get_pos()
418 }; 458 };
419 $.ajaxJSON({ 459 $.ajaxJSON({
@@ -527,8 +567,9 @@ function edit_form_init() { @@ -527,8 +567,9 @@ function edit_form_init() {
527 deleted = []; 567 deleted = [];
528 deleted_cr = []; 568 deleted_cr = [];
529 created = false; 569 created = false;
530 - $('#id_part_of_speech').find('option:selected').addClass('last-selected');  
531 - $('.inflection-characteristic option:selected').addClass('last-selected'); 570 + init_selection($('#id_part_of_speech'));
  571 + init_selection($('.inflection-characteristic'));
  572 + init_selection(new_owner_elem);
532 jqgrid.hide_changed(); 573 jqgrid.hide_changed();
533 if (jqgrid.ctrl) 574 if (jqgrid.ctrl)
534 jqgrid.ctrl.remove(); 575 jqgrid.ctrl.remove();
@@ -902,6 +943,26 @@ function input_prompter_pattern() { @@ -902,6 +943,26 @@ function input_prompter_pattern() {
902 } 943 }
903 } 944 }
904 945
  946 +function check_classifications() {
  947 + "use strict";
  948 + var new_classifications = $.ajaxJSON({
  949 + method: 'get',
  950 + url: $dj.ajax_check_classifications,
  951 + data: {lexeme_id: lexeme_id(), pos: get_pos(), owner_id: get_owner()},
  952 + async: false
  953 + }).classifications;
  954 + var old_classifications = $('#classifications').find('.classification-values')
  955 + .map(function(i, el) {
  956 + return parseInt(el.id.replace('id_cl', '').replace('-values', ''), 10);
  957 + });
  958 + var stale_classifications = [];
  959 + old_classifications.each(function(i, c_id) {
  960 + if (new_classifications.indexOf(c_id) === -1)
  961 + stale_classifications.push(c_id);
  962 + });
  963 + return stale_classifications;
  964 +}
  965 +
905 function check_attrs(ics) { 966 function check_attrs(ics) {
906 "use strict"; 967 "use strict";
907 var new_attrs = $.ajaxJSON({ 968 var new_attrs = $.ajaxJSON({
@@ -914,7 +975,7 @@ function check_attrs(ics) { @@ -914,7 +975,7 @@ function check_attrs(ics) {
914 return parseInt(el.id.split('-')[0].substring('id_attr'.length), 10); 975 return parseInt(el.id.split('-')[0].substring('id_attr'.length), 10);
915 }); 976 });
916 var stale_attrs = []; 977 var stale_attrs = [];
917 - $.each(old_attrs, function(i, attr) { 978 + old_attrs.each(function(i, attr) {
918 if (new_attrs.indexOf(attr) === -1) 979 if (new_attrs.indexOf(attr) === -1)
919 stale_attrs.push(attr); 980 stale_attrs.push(attr);
920 }); 981 });
@@ -943,7 +1004,9 @@ var check_pos = function() { @@ -943,7 +1004,9 @@ var check_pos = function() {
943 good_ics.push(ic_symbol); 1004 good_ics.push(ic_symbol);
944 }); 1005 });
945 var stale_attrs = check_attrs(good_ics); 1006 var stale_attrs = check_attrs(good_ics);
946 - if (bad_lips.length > 0 || cr_row_elems.length > 0 || stale_attrs.length > 0) { 1007 + var stale_classifications = check_classifications();
  1008 + if (bad_lips.length > 0 || cr_row_elems.length > 0 ||
  1009 + stale_attrs.length > 0 || stale_classifications.length > 0) {
947 var lips_text = '', cr_text = '', lips = []; 1010 var lips_text = '', cr_text = '', lips = [];
948 if (bad_lips.length > 0) { 1011 if (bad_lips.length > 0) {
949 $.each(bad_lips, function(i, t) { 1012 $.each(bad_lips, function(i, t) {
@@ -956,21 +1019,25 @@ var check_pos = function() { @@ -956,21 +1019,25 @@ var check_pos = function() {
956 if (cr_row_elems.length > 0) { 1019 if (cr_row_elems.length > 0) {
957 cr_text += "wszystkie odsyłacze\n"; 1020 cr_text += "wszystkie odsyłacze\n";
958 } 1021 }
959 - // TODO ostrzegać przed znikaniem klasyfikacji [kiedyś] (?)  
960 var attr_text = ''; 1022 var attr_text = '';
961 if (stale_attrs.length > 0) { 1023 if (stale_attrs.length > 0) {
962 attr_text = "atrybuty: " + join_attrs(stale_attrs) + '\n'; 1024 attr_text = "atrybuty: " + join_attrs(stale_attrs) + '\n';
963 } 1025 }
  1026 + var clas_text = '';
  1027 + if (stale_classifications.length > 0) {
  1028 + clas_text = "klasyfikacje: " +
  1029 + join_classifications(stale_classifications) + '\n';
  1030 + }
964 confirmed = window.confirm( 1031 confirmed = window.confirm(
965 - 'Zostaną usunięte:\n' + lips_text + cr_text + attr_text + 'Kontynuować?'); 1032 + 'Zostaną usunięte:\n' + lips_text + cr_text + attr_text + clas_text +
  1033 + 'Kontynuować?');
966 if (!confirmed) { 1034 if (!confirmed) {
967 - $(this).find('option.last-selected').prop('selected', true); 1035 + revert_selection($(this));
968 } 1036 }
969 } 1037 }
970 if (confirmed || !(bad_lips.length > 0 || cr_row_elems.length > 0 || 1038 if (confirmed || !(bad_lips.length > 0 || cr_row_elems.length > 0 ||
971 - stale_attrs.length > 0)) {  
972 - $(this).find('option.last-selected').removeClass('last-selected');  
973 - $(this).find('option:selected').addClass('last-selected'); 1039 + stale_attrs.length > 0 || stale_classifications.length > 0)) {
  1040 + confirm_selection($(this));
974 var result = $.ajax({ // znowu brzydko... 1041 var result = $.ajax({ // znowu brzydko...
975 type: 'get', 1042 type: 'get',
976 url: $dj.ajax_get_ics, 1043 url: $dj.ajax_get_ics,
sql/drop.sql
  1 +-- bardzo nieaktualne!
1 drop table "auth_group_permissions" cascade; 2 drop table "auth_group_permissions" cascade;
2 drop table "auth_group" cascade; 3 drop table "auth_group" cascade;
3 drop table "auth_user_user_permissions" cascade; 4 drop table "auth_user_user_permissions" cascade;
@@ -11,7 +12,7 @@ @@ -11,7 +12,7 @@
11 drop table "klasygramatyczne" cascade; 12 drop table "klasygramatyczne" cascade;
12 drop table "kwalifikatory_leksemow" cascade; 13 drop table "kwalifikatory_leksemow" cascade;
13 drop table "kwalifikatory_odmieniasiow" cascade; 14 drop table "kwalifikatory_odmieniasiow" cascade;
14 - drop table "wartosci_klasyfikacji_lexemes" cascade; 15 + drop table "dictionary_lexemecv" cascade;
15 drop table "odmieniasie" cascade; 16 drop table "odmieniasie" cascade;
16 drop table "zakonczenia" cascade; 17 drop table "zakonczenia" cascade;
17 drop table "kwalifikatory_zakonczen" cascade; 18 drop table "kwalifikatory_zakonczen" cascade;
sql/history.sql
@@ -40,7 +40,7 @@ BEGIN @@ -40,7 +40,7 @@ BEGIN
40 lexemeId := temp.id; 40 lexemeId := temp.id;
41 ELSIF (TG_TABLE_NAME IN ('odmieniasie', 'leksemy_w_slownikach')) THEN 41 ELSIF (TG_TABLE_NAME IN ('odmieniasie', 'leksemy_w_slownikach')) THEN
42 lexemeId := temp.l_id; 42 lexemeId := temp.l_id;
43 - ELSIF (TG_TABLE_NAME IN ('kwalifikatory_leksemow', 'wartosci_klasyfikacji_lexemes', 'dictionary_lexemeattributevalue_lexemes')) THEN 43 + ELSIF (TG_TABLE_NAME IN ('kwalifikatory_leksemow', 'dictionary_lexemeav', 'dictionary_lexemecv')) THEN
44 lexemeId := temp.lexeme_id; 44 lexemeId := temp.lexeme_id;
45 ELSIF (TG_TABLE_NAME = 'odsylacze') THEN 45 ELSIF (TG_TABLE_NAME = 'odsylacze') THEN
46 lexemeId := temp.l_id_od; 46 lexemeId := temp.l_id_od;
@@ -116,16 +116,16 @@ CREATE TRIGGER leksemy_w_slownikach_trigger_history_ @@ -116,16 +116,16 @@ CREATE TRIGGER leksemy_w_slownikach_trigger_history_
116 AFTER INSERT OR UPDATE OR DELETE ON leksemy_w_slownikach 116 AFTER INSERT OR UPDATE OR DELETE ON leksemy_w_slownikach
117 FOR EACH ROW EXECUTE PROCEDURE make_history_(); 117 FOR EACH ROW EXECUTE PROCEDURE make_history_();
118 118
119 -CREATE TRIGGER wartosci_klasyfikacji_lexemes_trigger_history_  
120 -AFTER INSERT OR UPDATE OR DELETE ON wartosci_klasyfikacji_lexemes -- ta tabela zmieni nazwę 119 +CREATE TRIGGER dictionary_lexemecv_trigger_history_
  120 +AFTER INSERT OR UPDATE OR DELETE ON dictionary_lexemecv
121 FOR EACH ROW EXECUTE PROCEDURE make_history_(); 121 FOR EACH ROW EXECUTE PROCEDURE make_history_();
122 122
123 CREATE TRIGGER odsylacze_trigger_history_ 123 CREATE TRIGGER odsylacze_trigger_history_
124 AFTER INSERT OR UPDATE OR DELETE ON odsylacze 124 AFTER INSERT OR UPDATE OR DELETE ON odsylacze
125 FOR EACH ROW EXECUTE PROCEDURE make_history_(); 125 FOR EACH ROW EXECUTE PROCEDURE make_history_();
126 126
127 -CREATE TRIGGER lexemeattributevalue_lexemes_trigger_history_  
128 -AFTER INSERT OR UPDATE OR DELETE ON dictionary_lexemeattributevalue_lexemes 127 +CREATE TRIGGER dictionary_lexemeav_trigger_history_
  128 +AFTER INSERT OR UPDATE OR DELETE ON dictionary_lexemeav
129 FOR EACH ROW EXECUTE PROCEDURE make_history_(); 129 FOR EACH ROW EXECUTE PROCEDURE make_history_();
130 130
131 -- wzory 131 -- wzory
@@ -5,8 +5,8 @@ from django.conf import settings @@ -5,8 +5,8 @@ from django.conf import settings
5 from common.util import url 5 from common.util import url
6 6
7 # Uncomment the next two lines to enable the admin: 7 # Uncomment the next two lines to enable the admin:
8 -from django.contrib import admin  
9 -admin.autodiscover() 8 +#from django.contrib import admin
  9 +#admin.autodiscover()
10 10
11 urlpatterns = patterns('', 11 urlpatterns = patterns('',
12 # Example: 12 # Example:
@@ -39,6 +39,7 @@ urlpatterns += patterns(&#39;dictionary.ajax_lexeme_view&#39;, @@ -39,6 +39,7 @@ urlpatterns += patterns(&#39;dictionary.ajax_lexeme_view&#39;,
39 url(r'^ajax/delete_lexeme/$', 'delete_lexeme'), 39 url(r'^ajax/delete_lexeme/$', 'delete_lexeme'),
40 url(r'^ajax/check-pos/$', 'check_pos'), 40 url(r'^ajax/check-pos/$', 'check_pos'),
41 url(r'^ajax/check-pattern/$', 'check_pattern'), 41 url(r'^ajax/check-pattern/$', 'check_pattern'),
  42 + url(r'^ajax/check-classifications/$', 'check_classifications'),
42 url(r'^ajax/get-ics/$', 'get_ics'), 43 url(r'^ajax/get-ics/$', 'get_ics'),
43 url(r'^ajax/create-lexeme/$', 'create_lexeme'), 44 url(r'^ajax/create-lexeme/$', 'create_lexeme'),
44 url(r'^ajax/classification-forms/$', 'classification_forms'), 45 url(r'^ajax/classification-forms/$', 'classification_forms'),