Commit c1ffcc256efbc937277f8a6da4ee02a5a0c9cc9e
1 parent
cee90743
Removing more unused functions from code.
Showing
5 changed files
with
1 additions
and
70 deletions
dictionary/ajax_lemma_view.py
... | ... | @@ -390,33 +390,6 @@ def get_lemma_examples(request, id): |
390 | 390 | #'lemma_nkjp_examples': json_lemma_nkjp_examples, |
391 | 391 | 'can_modify': can_modify} |
392 | 392 | |
393 | -############################ semantics ################################### | |
394 | -@ajax(method='get') | |
395 | -def schema_got_assigned_semantics(request, lemma_id, schema_id): | |
396 | - lemma = Lemma.objects.get(id=lemma_id) | |
397 | -# sprawdz czy najnowsza wersja | |
398 | -# if lemma.old: | |
399 | -# raise AjaxError('old lemma') | |
400 | - frames = lemma.entry_obj.actual_frames() # jeszcze po przykladach trzeba sprawdzac | |
401 | - schema_examples = lemma.nkjp_examples.filter(frame__id=schema_id) | |
402 | - for frame in frames.all(): | |
403 | - if complements_pinned(frame, schema_id) or examples_pinned(frame, schema_examples): | |
404 | - return {'got_assigned_semantics': True} | |
405 | - return {'got_assigned_semantics': False} | |
406 | - | |
407 | -def complements_pinned(frame, schema_id): | |
408 | - if frame.complements.filter(realizations__frame__id=schema_id).exists(): | |
409 | - return True | |
410 | - return False | |
411 | - | |
412 | -def examples_pinned(frame, schema_examples): | |
413 | - for lexical_unit in frame.lexical_units.all(): | |
414 | - for example in schema_examples.all(): | |
415 | - if LexicalUnitExamples.objects.filter(lexical_unit=lexical_unit, | |
416 | - example=example).exists(): | |
417 | - return True | |
418 | - return False | |
419 | - | |
420 | 393 | ############################ lemma notes ################################# |
421 | 394 | |
422 | 395 | @render('lemma_notes.html') |
... | ... |
dictionary/static/js/lemma-view.js
... | ... | @@ -3468,11 +3468,6 @@ function restore_lemma() { |
3468 | 3468 | var assignedExamples = []; |
3469 | 3469 | if(canModifyFrame(window.selected_id, window.schemas) && |
3470 | 3470 | !checkIfSemChangedAndAlert()) { |
3471 | - | |
3472 | - /*if(schemaGotAssignedSemantics(window.selected_id)) { | |
3473 | - semanticsAssignedAlert(); | |
3474 | - }*/ | |
3475 | - | |
3476 | 3471 | assignedExamples = gotAssignedExample(nkjp_examples, selected_id, true); |
3477 | 3472 | if(assignedExamples.length == 0) { |
3478 | 3473 | schemas = removeFrameElement(selected_id, schemas); |
... | ... | @@ -3488,9 +3483,6 @@ function restore_lemma() { |
3488 | 3483 | function addElement() { |
3489 | 3484 | if(!checkIfSemChangedAndAlert() && |
3490 | 3485 | (window.selected_id == -1 || canModifyFrame(window.selected_id, window.schemas))) { |
3491 | - /*if(schemaGotAssignedSemantics(window.selected_id)) { | |
3492 | - semanticsAssignedAlert(); | |
3493 | - }*/ | |
3494 | 3486 | window.schemas = addFrameElementDialog(window.selected_id, window.schemas); |
3495 | 3487 | } |
3496 | 3488 | } |
... | ... | @@ -3628,10 +3620,6 @@ function restore_lemma() { |
3628 | 3620 | if(window.elem_in_bucket && !checkIfSemChangedAndAlert() && |
3629 | 3621 | (window.selected_id == -1 || |
3630 | 3622 | canModifyFrame(window.selected_id, window.schemas))) { |
3631 | - | |
3632 | - /*if(schemaGotAssignedSemantics(window.selected_id)) { | |
3633 | - semanticsAssignedAlert(); | |
3634 | - }*/ | |
3635 | 3623 | pasteFrameElement(selected_id, elem_in_bucket, schemas); |
3636 | 3624 | } |
3637 | 3625 | } |
... | ... | @@ -3662,12 +3650,6 @@ function restore_lemma() { |
3662 | 3650 | canModifyFrame(window.selected_id, window.schemas) && |
3663 | 3651 | !checkIfSemChangedAndAlert()) |
3664 | 3652 | { |
3665 | - /*if(getElementInstance(selected_id, schemas)['type'] != 'frame' && | |
3666 | - schemaGotAssignedSemantics(selected_id)) { | |
3667 | - semanticsAssignedAlert(); | |
3668 | - return; | |
3669 | - }*/ | |
3670 | - | |
3671 | 3653 | elem_in_bucket = getElementInstance(selected_id, schemas); |
3672 | 3654 | |
3673 | 3655 | var parent_elem = getParentInstance(selected_id, schemas); |
... | ... | @@ -3815,7 +3797,7 @@ function restore_lemma() { |
3815 | 3797 | function delete_all_nkjp_examples(frame_id) |
3816 | 3798 | { |
3817 | 3799 | if(canModifyFrame(frame_id, window.schemas) && |
3818 | - !checkIfSemChangedAndAlert())// && !schemaGotAssignedSemantics(frame_id)) | |
3800 | + !checkIfSemChangedAndAlert()) | |
3819 | 3801 | { |
3820 | 3802 | var new_example_tab = new Array(); |
3821 | 3803 | for(var i=0; i<nkjp_examples.length; i++) |
... | ... |
dictionary/static/js/semantics_coupling.js
1 | -function schemaGotAssignedSemantics(element_id) { | |
2 | - var semanticsAssigned = true; | |
3 | - var id_map = parseId(element_id); | |
4 | - var schema_id = id_map['frame_id']; | |
5 | - if(schema_id < 0) { | |
6 | - semanticsAssigned = false; | |
7 | - } | |
8 | - else { | |
9 | - jQuery.ajax({ | |
10 | - type: 'get', | |
11 | - url: ajax_schema_got_assigned_semantics, | |
12 | - data: {lemma_id: window.lemma_id, | |
13 | - schema_id: schema_id}, | |
14 | - success: function(result) { | |
15 | - semanticsAssigned = result['got_assigned_semantics']; | |
16 | - }, | |
17 | - async: false | |
18 | - }); | |
19 | - } | |
20 | - return semanticsAssigned; | |
21 | -} | |
22 | - | |
23 | 1 | function semanticsAssignedAlert() { |
24 | 2 | error_alert('Działaj rozważnie, element jest wykorzystywany w ramach semantycznych.'); |
25 | 3 | } |
... | ... |
dictionary/views.py
... | ... | @@ -120,7 +120,6 @@ def lemma_view(request): |
120 | 120 | 'ajax_user_is_authenticated': reverse('user_is_authenticated'), |
121 | 121 | |
122 | 122 | 'ajax_semantics': reverse('semantics.views.ajax_semantics'), |
123 | - 'ajax_schema_got_assigned_semantics': reverse('schema_got_assigned_semantics'), | |
124 | 123 | |
125 | 124 | 'ajax_get_note_text': reverse('get_note_text'), |
126 | 125 | 'ajax_lemma_notes_form_submit': reverse('lemma_notes_form_submit'), |
... | ... |
urls.py
... | ... | @@ -102,7 +102,6 @@ urlpatterns += patterns('dictionary.ajax_lemma_view', |
102 | 102 | url(r'^ajax/example_opinion_form_submit/$', 'example_opinion_form_submit'), |
103 | 103 | url(r'^ajax/nkjp_example_form_submit/$', 'nkjp_example_form_submit'), |
104 | 104 | url(r'^ajax/semantic_example_form_submit/$', 'semantic_example_form_submit'), |
105 | - url(r'^ajax/schema_got_assigned_semantics/$', 'schema_got_assigned_semantics'), | |
106 | 105 | url(r'^ajax/remove_example_from_lemma/$', 'remove_example_from_lemma'), |
107 | 106 | url(r'^ajax/can_confirm_example/$', 'can_confirm_example'), |
108 | 107 | url(r'^ajax/confirm_nkjp_example/$', 'confirm_nkjp_example'), |
... | ... |