Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found
Select Git revision
  • hierarchy
  • lu_without_semantic_frames
  • master
  • vertical_relations
  • additional-unification-filters
  • v0.0.1
  • v0.0.2
  • v0.0.3
  • v0.0.4
  • v0.0.5
  • v0.0.6
  • v0.0.7
  • v0.0.8
  • v0.0.9
  • v0.1.0
  • v0.1.1
16 results

Target

Select target project
  • ipipan/valunifer
1 result
Select Git revision
  • hierarchy
  • lu_without_semantic_frames
  • master
  • vertical_relations
  • additional-unification-filters
  • v0.0.1
  • v0.0.2
  • v0.0.3
  • v0.0.4
  • v0.0.5
  • v0.0.6
  • v0.0.7
  • v0.0.8
  • v0.0.9
  • v0.1.0
  • v0.1.1
16 results
Show changes

Commits on Source 13

#-*- coding:utf-8 -*-
import datetime
import os
from django.core.management.base import BaseCommand
from optparse import make_option
from unifier.models import UnifiedFrame
from django.contrib.auth.models import User
from users.models import Assignment
from common.valunifier_tei import createteixml
BASEPATH = '.'
class Command(BaseCommand):
args = ''
help = 'Export ValUnifier in TEI format'
def add_arguments(self, parser):
parser.add_argument('-i', '--individual', action='store_true', help='Gen individual files.')
def handle(self, **options):
now = datetime.datetime.now().strftime('%Y%m%d')
if not options['individual']:
print("Full dictionary")
outfile = 'valunifier_' + now + '.xml'
outpath = os.path.join(BASEPATH, outfile)
frames = UnifiedFrame.objects.all()
createteixml(outpath, frames)
else:
for user in User.objects.all():
print("Part for " + user.username)
frames = []
for assignment in Assignment.objects.filter(user=user):
if assignment.subject_ct.model_class() == UnifiedFrame:
frames.append(assignment.subject_ct.get_object_for_this_type(id=assignment.subject_id))
outfile = user.username + '_' + now + '.xml'
outpath = os.path.join(BASEPATH, outfile)
if len(frames) > 0:
createteixml(outpath, frames)
This diff is collapsed.
...@@ -32,5 +32,5 @@ table.table-button-menu { ...@@ -32,5 +32,5 @@ table.table-button-menu {
} }
#free-lus-frame .argument.active { #free-lus-frame .argument.active {
background-color: #dee1e4; background-color: black;
} }
...@@ -12,6 +12,7 @@ var curr_examples_by_id = null; ...@@ -12,6 +12,7 @@ var curr_examples_by_id = null;
var roles = [] var roles = []
var role_attributes = [] var role_attributes = []
var role_sub_attributes = [] var role_sub_attributes = []
var frame_opinions = []
function make_opinion_row(item, span, width) { function make_opinion_row(item, span, width) {
const opinion_row = document.createElement('tr'); const opinion_row = document.createElement('tr');
...@@ -1133,6 +1134,18 @@ function getRoleSubAttributes() { ...@@ -1133,6 +1134,18 @@ function getRoleSubAttributes() {
}); });
} }
function getFrameOpinions() {
$.ajax({
dataType: "json",
url: '/' + lang + '/entries/frame_opinions',
success: function(data){
frame_opinions = data.result;
},
async: false
});
}
$(document).ready(function() { $(document).ready(function() {
bind_last_visited(); bind_last_visited();
...@@ -1166,6 +1179,8 @@ $(document).ready(function() { ...@@ -1166,6 +1179,8 @@ $(document).ready(function() {
getRoleSubAttributes(); getRoleSubAttributes();
getFrameOpinions();
// $.getJSON('relations', function(data){ // $.getJSON('relations', function(data){
// memorizeRelations(data.relations); // memorizeRelations(data.relations);
// }); // });
......
...@@ -33,8 +33,9 @@ ...@@ -33,8 +33,9 @@
<li class="nav-item mr-1"><a <li class="nav-item mr-1"><a
onclick='window.location.replace(window.currUnifiedFrameId ? "/pl/entries/hierarchy/?unified_frame_id="+window.currUnifiedFrameId : "/pl/entries/hierarchy")' onclick='window.location.replace(window.currUnifiedFrameId ? "/pl/entries/hierarchy/?unified_frame_id="+window.currUnifiedFrameId : "/pl/entries/hierarchy")'
class="nav-link cursor-pointer">{% trans "Hierarchia" %}</a></li> class="nav-link cursor-pointer">{% trans "Hierarchia" %}</a></li>
{% if is_superlexicograf %}
<li class="nav-item mr-1"><a href="{% url 'entries:lu_free' %}" class="nav-link">{% trans "Wolne jednostki" %}</a></li> <li class="nav-item mr-1"><a href="{% url 'entries:lu_free' %}" class="nav-link">{% trans "Wolne jednostki" %}</a></li>
{% endif %}
{% endif %} {% endif %}
<li class="nav-item dropdown mr-1"> <li class="nav-item dropdown mr-1">
<a class="nav-link dropdown-toggle mr-1" href="#" id="nav-filters" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> <a class="nav-link dropdown-toggle mr-1" href="#" id="nav-filters" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
......
...@@ -2,7 +2,7 @@ from django.urls import path ...@@ -2,7 +2,7 @@ from django.urls import path
from . import autocompletes, views from . import autocompletes, views
from .views import ajax_plWN_context_lookup, ajax_predefined_preferences, ajax_relations, ajax_synsets, ajax_roles, \ from .views import ajax_plWN_context_lookup, ajax_predefined_preferences, ajax_relations, ajax_synsets, ajax_roles, \
ajax_role_attributes, ajax_role_sub_attributes, ajax_free_slowal_frame_lookup ajax_role_attributes, ajax_role_sub_attributes, ajax_free_slowal_frame_lookup, ajax_frame_opinions
app_name = 'entries' app_name = 'entries'
...@@ -25,6 +25,7 @@ urlpatterns = [ ...@@ -25,6 +25,7 @@ urlpatterns = [
path('plWN_context_lookup/', ajax_plWN_context_lookup, name='plWN_context_lookup'), path('plWN_context_lookup/', ajax_plWN_context_lookup, name='plWN_context_lookup'),
path('predefined_preferences/', ajax_predefined_preferences, name='predefined_preferences'), path('predefined_preferences/', ajax_predefined_preferences, name='predefined_preferences'),
path('roles/', ajax_roles, name='roles'), path('roles/', ajax_roles, name='roles'),
path('frame_opinions/', ajax_frame_opinions, name='frame_opinions'),
path('role_attributes/', ajax_role_attributes, name='role_attributes'), path('role_attributes/', ajax_role_attributes, name='role_attributes'),
path('role_sub_attributes/', ajax_role_sub_attributes, name='role_sub_attributes'), path('role_sub_attributes/', ajax_role_sub_attributes, name='role_sub_attributes'),
path('relations/', ajax_relations, name='relations'), path('relations/', ajax_relations, name='relations'),
......
...@@ -21,7 +21,7 @@ from connections.models import Entry, Subentry, ArgumentConnection, RealisationD ...@@ -21,7 +21,7 @@ from connections.models import Entry, Subentry, ArgumentConnection, RealisationD
from meanings.models import LexicalUnit from meanings.models import LexicalUnit
from syntax.models import NaturalLanguageDescription, Schema from syntax.models import NaturalLanguageDescription, Schema
from semantics.models import Frame, PredefinedSelectionalPreference, SelectivePreferenceRelations, SemanticRole, \ from semantics.models import Frame, PredefinedSelectionalPreference, SelectivePreferenceRelations, SemanticRole, \
RoleAttribute, RoleSubAttribute, SelectionalPreferenceRelation RoleAttribute, RoleSubAttribute, SelectionalPreferenceRelation, FrameOpinion
from common.decorators import ajax_required, ajax from common.decorators import ajax_required, ajax
from unifier.models import UnifiedFrame from unifier.models import UnifiedFrame
...@@ -99,6 +99,7 @@ def hierarchy(request): ...@@ -99,6 +99,7 @@ def hierarchy(request):
if "unified_frame_id" in request.GET: if "unified_frame_id" in request.GET:
unified_frame_id = request.GET.get("unified_frame_id") unified_frame_id = request.GET.get("unified_frame_id")
user = request.user
return render( return render(
request, request,
'hierarchy.html', 'hierarchy.html',
...@@ -109,6 +110,7 @@ def hierarchy(request): ...@@ -109,6 +110,7 @@ def hierarchy(request):
'frames_form': FrameFormFactory.get_form(as_subform=False), 'frames_form': FrameFormFactory.get_form(as_subform=False),
'schemata_form': SchemaFormFactory.get_form(as_subform=False), 'schemata_form': SchemaFormFactory.get_form(as_subform=False),
'unified_frames_form': UnifiedFrameFormFactory.get_form(as_subform=False), 'unified_frames_form': UnifiedFrameFormFactory.get_form(as_subform=False),
'is_superlexicograf': user.groups.filter(name=settings.SUPER_LEXICOGRAPHS_GROUP_NAME).exists()
}, },
) )
...@@ -120,6 +122,7 @@ def lu_free(request): ...@@ -120,6 +122,7 @@ def lu_free(request):
if "unified_frame_id" in request.GET: if "unified_frame_id" in request.GET:
unified_frame_id = request.GET.get("unified_frame_id") unified_frame_id = request.GET.get("unified_frame_id")
user = request.user
return render( return render(
request, request,
'lu_free.html', 'lu_free.html',
...@@ -130,6 +133,7 @@ def lu_free(request): ...@@ -130,6 +133,7 @@ def lu_free(request):
'frames_form': FrameFormFactory.get_form(as_subform=False), 'frames_form': FrameFormFactory.get_form(as_subform=False),
'schemata_form': SchemaFormFactory.get_form(as_subform=False), 'schemata_form': SchemaFormFactory.get_form(as_subform=False),
'unified_frames_form': UnifiedFrameFormFactory.get_form(as_subform=False), 'unified_frames_form': UnifiedFrameFormFactory.get_form(as_subform=False),
'is_superlexicograf': user.groups.filter(name=settings.SUPER_LEXICOGRAPHS_GROUP_NAME).exists()
}, },
) )
...@@ -414,10 +418,12 @@ def get_scroller_params(POST_data): ...@@ -414,10 +418,12 @@ def get_scroller_params(POST_data):
#from django.db.models import Count #from django.db.models import Count
def iter_lexical_units(lexical_units, has_unified_frame='false'): def iter_lexical_units(lexical_units, has_unified_frame='false', exclude_status=None):
for lu in lexical_units: for lu in lexical_units:
lu._frame = lu._frames[0] if lu._frames and len(lu._frames) > 0 else None lu._frame = lu._frames[0] if lu._frames and len(lu._frames) > 0 else None
if lu._frame is None or (not hasattr(lu._frame, 'slowal_frame_2_unified_frame') and has_unified_frame == 'true'): if lu._frame is None or \
(not hasattr(lu._frame, 'slowal_frame_2_unified_frame') and has_unified_frame == 'true') or \
(exclude_status is not None and lu._frame.status == exclude_status):
continue continue
else: else:
yield lu yield lu
...@@ -446,8 +452,7 @@ def get_entries(request): ...@@ -446,8 +452,7 @@ def get_entries(request):
#entries = entries.filter(subentries__schema_hooks__alternation=2) #entries = entries.filter(subentries__schema_hooks__alternation=2)
if without_frames: if without_frames:
entries = entries.filter(name__in=(LexicalUnit.objects.filter(frames__isnull=True).values("base"))) entries = entries.filter(name__in=(LexicalUnit.objects.filter(Q(frames__isnull=True) | Q(frames__in_building=True)).values("base")))
print('entries.query: ', entries.query)
total = entries.count() total = entries.count()
if scroller_params['filter']: if scroller_params['filter']:
...@@ -505,7 +510,7 @@ def get_entries(request): ...@@ -505,7 +510,7 @@ def get_entries(request):
) )
) )
if exclude_status is not None: if exclude_status is not None:
entries = entries.filter(lexical_units__frames__status__iexact=exclude_status) entries = entries.exclude(lexical_units__frames__status=exclude_status)
entries = entries.filter(lexical_units__frames__isnull=False) entries = entries.filter(lexical_units__frames__isnull=False)
if has_unified_frame == 'true': if has_unified_frame == 'true':
entries = entries.filter(lexical_units__frames__slowal_frame_2_unified_frame__isnull=False) entries = entries.filter(lexical_units__frames__slowal_frame_2_unified_frame__isnull=False)
...@@ -530,7 +535,7 @@ def get_entries(request): ...@@ -530,7 +535,7 @@ def get_entries(request):
**( **(
{ {
'lexical_units': [ 'lexical_units': [
lu2dict(lu) for lu in iter_lexical_units(e.lexical_units.all(), has_unified_frame) lu2dict(lu) for lu in iter_lexical_units(e.lexical_units.all(), has_unified_frame, exclude_status=exclude_status)
] ]
} }
if with_lexical_units else {} if with_lexical_units else {}
...@@ -757,10 +762,13 @@ def get_examples(entry): ...@@ -757,10 +762,13 @@ def get_examples(entry):
if connection.lexical_unit: if connection.lexical_unit:
lu_ids.add(connection.lexical_unit.id) lu_ids.add(connection.lexical_unit.id)
for hook in connection.schema_connections.all(): for hook in connection.schema_connections.all():
schema_ids.add(hook.schema.id); schema_ids.add(hook.schema.id)
phrases.add('{}-{}-{}-{}'.format(hook.schema.id, hook.position.id, hook.phrase_type.id, hook.alternation - 1)) phrases.add('{}-{}-{}-{}'.format(hook.schema.id, hook.position.id, hook.phrase_type.id, hook.alternation - 1))
phrases_syntax.add('{}-{}-{}'.format(hook.schema.id, hook.position.id, hook.phrase_type.id)) phrases_syntax.add('{}-{}-{}'.format(hook.schema.id, hook.position.id, hook.phrase_type.id))
positions.add('{}-{}'.format(hook.schema.id, hook.position.id)) positions.add('{}-{}'.format(hook.schema.id, hook.position.id))
for argument_connection in hook.argument_connections.all():
frame_ids.add(argument_connection.argument.frame.id)
argument_ids.add('{}-{}'.format(argument_connection.argument.frame.id, argument_connection.argument.id))
examples.append({ examples.append({
'id' : str(example.id), 'id' : str(example.id),
'sentence' : example.sentence, 'sentence' : example.sentence,
...@@ -923,7 +931,7 @@ def get_entry(request): ...@@ -923,7 +931,7 @@ def get_entry(request):
schemata.append(schema2dict(schema, subentry.negativity, request.LANGUAGE_CODE)) schemata.append(schema2dict(schema, subentry.negativity, request.LANGUAGE_CODE))
if schemata: if schemata:
all_schema_objects += list(schema_objects) all_schema_objects += list(schema_objects)
subentries.append({ 'str' : subentry2str(subentry), 'schemata' : schemata }) subentries.append({'str': subentry2str(subentry), 'id': subentry.id, 'schemata': schemata})
# frame_objects = Frame.objects.filter(arguments__argument_connections__schema_connections__subentry__entry=entry).distinct() # frame_objects = Frame.objects.filter(arguments__argument_connections__schema_connections__subentry__entry=entry).distinct()
frame_objects = Frame.objects.filter(lexical_units__entry=entry).distinct() frame_objects = Frame.objects.filter(lexical_units__entry=entry).distinct()
# filter out frames by frame properties # filter out frames by frame properties
...@@ -1071,6 +1079,15 @@ def ajax_roles(request): ...@@ -1071,6 +1079,15 @@ def ajax_roles(request):
return context return context
@ajax(method='get', encode_result=True)
def ajax_frame_opinions(request):
opinions = []
for opinion in FrameOpinion.objects.exclude(key='unk').filter(frame__isnull=False).distinct().order_by('priority'):
opinions.append({"id": opinion.id, "key": str(FRAME_OPINION()[opinion.key])})
return {'result': opinions}
@ajax(method='get', encode_result=True) @ajax(method='get', encode_result=True)
def ajax_role_attributes(request): def ajax_role_attributes(request):
roleAttributes = [] roleAttributes = []
...@@ -1155,3 +1172,5 @@ def ajax_free_slowal_frame_lookup(request, term): ...@@ -1155,3 +1172,5 @@ def ajax_free_slowal_frame_lookup(request, term):
lexical_unit_str.append(str(lexical_unit)) lexical_unit_str.append(str(lexical_unit))
return {'result': lexical_unit_str} return {'result': lexical_unit_str}
...@@ -84,9 +84,9 @@ class ApiTest(TestCase): ...@@ -84,9 +84,9 @@ class ApiTest(TestCase):
request = self.factory.post("/pl/freelus/attach_examples_to_frame/", request = self.factory.post("/pl/freelus/attach_examples_to_frame/",
HTTP_X_REQUESTED_WITH='XMLHttpRequest', HTTP_X_REQUESTED_WITH='XMLHttpRequest',
data={'frame_id': frame.pk, data={'frame_id': frame.pk,
'argument_id': argument.pk, 'selected_lus': json.dumps([self.lu.pk], separators=(',', ':')),
'example_ids': json.dumps([self.example.pk], separators=(',', ':'))}) 'example_ids': json.dumps([self.example.pk], separators=(',', ':'))})
response = attach_examples_to_frame(request) response = attach_examples_to_frame(request)
examples = ExampleConnection.objects.filter(arguments=argument) examples = ExampleConnection.objects.filter(lexical_unit=self.lu)
self.assertEqual(1, examples.count()) self.assertEqual(1, examples.count())
...@@ -13,5 +13,9 @@ urlpatterns = [ ...@@ -13,5 +13,9 @@ urlpatterns = [
path('delete_schema_to_argument_connection/', views.delete_schema_to_argument_connection, path('delete_schema_to_argument_connection/', views.delete_schema_to_argument_connection,
name='delete_schema_to_argument_connection'), name='delete_schema_to_argument_connection'),
path('finish_frame_processing/', views.finish_frame_processing, name='finish_frame_processing'), path('finish_frame_processing/', views.finish_frame_processing, name='finish_frame_processing'),
path('remove_argument_from_frame/', views.remove_argument_from_frame, name='remove_argument_from_frame'),
path('change_lus_in_slowal_frame/', views.change_lus_in_slowal_frame, name='change_lus_in_slowal_frame'),
path('change_frame_opinion/', views.change_frame_opinion, name='change_frame_opinion'),
] ]
...@@ -4,26 +4,60 @@ from django.http import JsonResponse ...@@ -4,26 +4,60 @@ from django.http import JsonResponse
from common.decorators import ajax_required from common.decorators import ajax_required
from connections.models import Entry, Status, ExampleConnection, SchemaHook, ArgumentConnection, RealisationDescription from connections.models import Entry, Status, ExampleConnection, SchemaHook, ArgumentConnection, RealisationDescription
from examples.models import Example
from meanings.models import LexicalUnit from meanings.models import LexicalUnit
from semantics.models import Frame, FrameOpinion, Argument, ArgumentRole, SemanticRole, \ from semantics.models import Frame, FrameOpinion, Argument, ArgumentRole, SemanticRole, \
RoleAttribute, RoleSubAttribute, RoleType RoleAttribute, RoleSubAttribute, RoleType
from syntax.models import Position
@ajax_required @ajax_required
@transaction.atomic @transaction.atomic
def change_status(request): def change_frame_opinion(request):
""" """
Changing status of slowal frame in building process. Changing opinion of slowal frame in building process.
The request has to contain 'entry_id' and 'status'. The request has to contain 'frame_id' and 'opinion_id'.
:param request: http request
:return: Empty json response
"""
if request.method == 'POST':
frame_id = request.POST['frame_id']
opinion_id = request.POST['opinion_id']
frame = Frame.objects.get(pk=frame_id)
frame.opinion_id = opinion_id
frame.save()
return JsonResponse({})
return JsonResponse({})
@ajax_required
@transaction.atomic
def change_lus_in_slowal_frame(request):
"""
Change lus assigned to slowal frame.
The request has to contain 'entry_id' and 'lu_ids' list for witch slowal frame has to be created.
:param request: http request :param request: http request
:return: Empty json response :return: Empty json response
""" """
if request.method == 'POST': if request.method == 'POST':
entry_id = request.POST['entry_id'] entry_id = request.POST['entry_id']
status = request.POST['status'] frame_id = request.POST['frame_id']
lu_ids = json.loads(request.POST['lu_ids'])
frame = Frame.objects.get(id=frame_id)
frame.lexical_units.clear()
entry = Entry.objects.get(pk=entry_id) entry = Entry.objects.get(pk=entry_id)
entry.status = Status.objects.get(key=status) entry.lexical_units.clear()
for lu_id in lu_ids:
lu = LexicalUnit.objects.get(pk=lu_id)
lu.entry = entry
lu.save()
frame.lexical_units.add(lu)
entry.lexical_units_count = entry.lexical_units_count + 1
frame.save()
entry.save() entry.save()
return JsonResponse({}) return JsonResponse({})
...@@ -82,6 +116,28 @@ def add_argument_to_frame(request): ...@@ -82,6 +116,28 @@ def add_argument_to_frame(request):
return JsonResponse({}) return JsonResponse({})
@ajax_required
@transaction.atomic
def remove_argument_from_frame(request):
"""
Removing argument from the specified slowal frame in building process.
The request has to contain 'argument_id'.
:param request: http request
:return: Empty json response
"""
if request.method == 'POST':
# frame_id = request.POST['frame_id']
argument_id = request.POST['argument_id']
# frame = Frame.objects.get(id=frame_id)
ArgumentConnection.objects.filter(argument_id=argument_id).delete()
Argument.objects.get(id=argument_id).delete()
return JsonResponse({})
return JsonResponse({})
@ajax_required @ajax_required
@transaction.atomic @transaction.atomic
def change_role(request): def change_role(request):
...@@ -123,28 +179,24 @@ def change_role_base(frame_argument, request): ...@@ -123,28 +179,24 @@ def change_role_base(frame_argument, request):
@transaction.atomic @transaction.atomic
def attach_examples_to_frame(request): def attach_examples_to_frame(request):
""" """
Attaching selected examples to the slowal frame in building process. Attaching selected examples to the lus.
The request has to contain 'frame_id' and 'argument_id' that represents slowal frame in building process. The request has to contain 'selected_lus' that represents lu ids.
List of example ids ('example_ids') is also required. List of example ids ('example_ids') is also required.
:param request: http request :param request: http request
:return: Empty json response :return: Empty json response
""" """
if request.method == 'POST': if request.method == 'POST':
frame_id = request.POST['frame_id']
argument_id = request.POST['argument_id']
example_ids = json.loads(request.POST['example_ids']) example_ids = json.loads(request.POST['example_ids'])
selected_lus = json.loads(request.POST['selected_lus'])
argument = Argument.objects.get(id=argument_id) lexical_units = LexicalUnit.objects.filter(id__in=selected_lus).all()
frame = Frame.objects.get(id=frame_id) for lexical_unit in lexical_units:
ExampleConnection.objects.filter(lexical_unit=lexical_unit).delete()
lexical_units = frame.lexical_units.all()
for example_id in example_ids: for example_id in example_ids:
for lexical_unit in lexical_units: for lexical_unit in lexical_units:
example_conn = ExampleConnection(example_id=example_id, lexical_unit=lexical_unit) example_conn = ExampleConnection(example_id=example_id, lexical_unit=lexical_unit)
example_conn.save() example_conn.save()
example_conn.arguments.add(argument)
example_conn.save()
return JsonResponse({}) return JsonResponse({})
...@@ -159,28 +211,46 @@ def attach_schema_to_argument(request): ...@@ -159,28 +211,46 @@ def attach_schema_to_argument(request):
:return: Empty json response :return: Empty json response
""" """
if request.method == 'POST': if request.method == 'POST':
frame_id = request.POST['frame_id'] frame_id = int(request.POST['frame_id'])
argument_id = request.POST['argument_id'] subentry_id = int(request.POST['subentry_id'])
schema_id = request.POST['schema_id'] argument_id = int(request.POST['argument_id'])
schema_position_id = request.POST['schema_position_id'] schema_id = int(request.POST['schema_id'])
schema_position_id = int(request.POST['schema_position_id'])
schema_alternation_id = int(request.POST['schema_alternation_id'])
argument = Argument.objects.get(id=argument_id) argument = Argument.objects.get(id=argument_id)
schema_hooks = SchemaHook.objects.filter(schema_id=schema_id, position_id=schema_position_id) if not ArgumentConnection.objects.filter(argument=argument, schema_connections__schema_id=schema_id).exists():
if len(schema_hooks) > 0: position = Position.objects.get(id=schema_position_id)
schema_hook = schema_hooks[0] for phrase_type in position.phrase_types.all():
argument_connection, xxx = ArgumentConnection.objects.get_or_create(argument=argument, schema_hooks = SchemaHook.objects.filter(subentry_id=subentry_id, schema_id=schema_id,
position_id=schema_position_id, phrase_type=phrase_type,
alternation=schema_alternation_id)
if not schema_hooks.exists():
schema_hooks = [SchemaHook.objects.create(subentry_id=subentry_id, schema_id=schema_id,
position_id=schema_position_id, phrase_type=phrase_type,
alternation=schema_alternation_id)]
# examples = Example.objects.filter(example_connections__schema_connections__in=schema_hooks)
# for example in examples:
# ExampleConnection.objects.get_or_create(example=example, argument=argument, schema_hook)
argument_connection, _ = ArgumentConnection.objects.get_or_create(argument=argument,
defaults={'argument': argument}) defaults={'argument': argument})
argument_connection.save() argument_connection.save()
for schema_hook in schema_hooks:
argument_connection.schema_connections.add(schema_hook) argument_connection.schema_connections.add(schema_hook)
argument_connection.save() argument_connection.save()
RealisationDescription.objects.get_or_create(frame_id=frame_id, RealisationDescription.objects.get_or_create(frame_id=frame_id,
schema_id=schema_id, schema_id=schema_id,
defaults={'alternation': 1, defaults={'alternation': schema_alternation_id,
'description': ''}) 'description': ''})
return JsonResponse({'succ': True})
return JsonResponse({}) else:
return JsonResponse({'succ': False, 'error': 'Odrzucono próbę połączenia. Argument jest już podłączony do innej pozycji w wybranym schemacie.'})
else:
return JsonResponse({'succ': False, 'error': 'Not a Post request.'})
@ajax_required @ajax_required
...@@ -195,14 +265,18 @@ def delete_schema_to_argument_connection(request): ...@@ -195,14 +265,18 @@ def delete_schema_to_argument_connection(request):
if request.method == 'POST': if request.method == 'POST':
argument_id = request.POST['argument_id'] argument_id = request.POST['argument_id']
schema_id = request.POST['schema_id'] schema_id = request.POST['schema_id']
subentry_id = request.POST['subentry_id']
schema_position_id = request.POST['schema_position_id'] schema_position_id = request.POST['schema_position_id']
schema_alternation_id = request.POST['schema_alternation_id']
argument = Argument.objects.get(id=argument_id) argument = Argument.objects.get(id=argument_id)
schema_hooks = SchemaHook.objects.filter(schema_id=schema_id, position=schema_position_id)
argument_connection = ArgumentConnection.objects.get(argument=argument) argument_connection = ArgumentConnection.objects.get(argument=argument)
argument_connection.schema_connections.remove(schema_hooks[0])
schema_hooks = SchemaHook.objects.filter(subentry_id=subentry_id, schema_id=schema_id,
position_id=schema_position_id,
alternation=schema_alternation_id)
for schema_hook in schema_hooks.all():
argument_connection.schema_connections.remove(schema_hook)
argument_connection.save() argument_connection.save()
return JsonResponse({}) return JsonResponse({})
......
...@@ -38,6 +38,8 @@ ...@@ -38,6 +38,8 @@
lexicalUnitsVisible: true, lexicalUnitsVisible: true,
selected_frame_argument_id: null, selected_frame_argument_id: null,
selected_schemata_position_id: null, selected_schemata_position_id: null,
selected_schemata_position_alternation_id: null,
selected_schemata_subentry_id: null,
} }
}, },
components: { components: {
...@@ -127,8 +129,10 @@ ...@@ -127,8 +129,10 @@
schemataSelected(schemas) { schemataSelected(schemas) {
this.selectedSchemas = schemas; this.selectedSchemas = schemas;
}, },
selectSchemaPositionSelected(selected_schemata_position_id) { selectSchemaPositionSelected(selected_schemata_position_id, subentry, alternation_id) {
this.selected_schemata_position_id = selected_schemata_position_id; this.selected_schemata_position_id = selected_schemata_position_id;
this.selected_schemata_position_alternation_id = alternation_id;
this.selected_schemata_subentry_id = subentry ? subentry.id : null;
}, },
exampleSelected(selectedExamples) { exampleSelected(selectedExamples) {
this.selectedExamples = selectedExamples; this.selectedExamples = selectedExamples;
...@@ -147,10 +151,21 @@ ...@@ -147,10 +151,21 @@
this.active_slowal_frame = frame; this.active_slowal_frame = frame;
} }
}, },
create_new_slowal_frame() { connect_lus_to_slowal_frame(frame_in_progress) {
const frame_in_progress_lus = frame_in_progress ? frames2lexical_units([frame_in_progress]).map(l => {
l.id = l.id;
l.str = l.str;
return l;
}) : [];
const free_lus = this.free_lexical_units.map(l => {
l.id = l.pk;
l.str = l.display;
return l;
});
const frame_in_progress_lus_ids = new Set(frame_in_progress_lus.map(l => l.id));
const lusSelect = function () { const lusSelect = function () {
return this.free_lexical_units.map(lu => { return free_lus.concat(frame_in_progress_lus).map(lu => {
return `<label><input type="checkbox" name="lus" value="${lu.pk}" /> ${lu.display}</label><br />`; return `<label><input type="checkbox" ${frame_in_progress_lus_ids.has(lu.id) ? 'checked' : ''} name="lus" value="${lu.id}" /> ${lu.str}</label><br />`;
}).join(""); }).join("");
}.bind(this); }.bind(this);
...@@ -170,16 +185,17 @@ ...@@ -170,16 +185,17 @@
let lu_ids = normalizeFormData(f.lus); let lu_ids = normalizeFormData(f.lus);
const data = { const data = {
'lu_ids': JSON.stringify(lu_ids), 'lu_ids': JSON.stringify(lu_ids),
'entry_id': this.entryId 'entry_id': this.entryId,
'frame_id': frame_in_progress ? frame_in_progress.id : null
}; };
$.ajax({ $.ajax({
type: 'post', type: 'post',
url: '/' + lang + '/freelus/create_new_slowal_frame/', url: '/' + lang + '/freelus/' + (frame_in_progress ? 'change_lus_in_slowal_frame' : 'create_new_slowal_frame') + '/',
dataType: 'json', dataType: 'json',
data: data, data: data,
timeout: 60000, timeout: 60000,
success: function (response) { success: function (response) {
show_info('Nowa rama została stworzona.'); // show_info(frame_in_progress ? 'Nowa rama została stworzona.' : 'Lista podpiętych jednostek leksyklanych zostala zmieniona.');
this.loadEntry(); this.loadEntry();
$.prompt.close(); $.prompt.close();
}.bind(this), }.bind(this),
...@@ -196,16 +212,16 @@ ...@@ -196,16 +212,16 @@
}, },
attach_examples() { attach_examples() {
if (this.frame_in_progress) { if (this.frame_in_progress) {
if (this.selected_frame_argument_id) { if (this.selectedLus && this.selectedLus.length > 0) {
const examplesSelect = function () { const examplesSelect = function () {
return '<div class="attach-examples-table-wrapper-scroll-y attach-examples-custom-scrollbar"><table id="attach-examples" class="table table-bordered table-striped mb-0"><thead><tr class="font-weight-bold"><th></th><th>Zdanie</th><th>Źródło</th><th>Opinia</th></tr></thead>' + this.examples.map(example => { return '<div class="attach-examples-table-wrapper-scroll-y attach-examples-custom-scrollbar"><table id="attach-examples" class="table table-bordered table-striped mb-0"><thead><tr class="font-weight-bold"><th></th><th>Zdanie</th><th>Źródło</th><th>Opinia</th></tr></thead>' + this.examples.map(example => {
return `<tr><td><input type="checkbox" name="lus" value="${example.id}" /></td><td>${example.sentence}</td><td>${example.source}</td><td>${example.opinion}</td></tr>`; return `<tr><td><input type="checkbox" ${this.selectedLus && example.lu_ids.includes(this.selectedLus[0].id) ? 'checked' : ''} name="lus" value="${example.id}" /></td><td>${example.sentence}</td><td>${example.source}</td><td>${example.opinion}</td></tr>`;
}).join("") + '</table></div>'; }).join("") + '</table></div>';
}.bind(this); }.bind(this);
const attach_examples_popup = { const attach_examples_popup = {
state0: { state0: {
title: 'Wybierz przykłady', title: 'Wybierz przykłady dla: ' + this.selectedLus.map(e => e.str).join(', '),
html: examplesSelect, html: examplesSelect,
buttons: {Anuluj: 0, Wybierz: 1}, buttons: {Anuluj: 0, Wybierz: 1},
focus: -1, focus: -1,
...@@ -219,8 +235,7 @@ ...@@ -219,8 +235,7 @@
let example_ids = normalizeFormData(f.lus); let example_ids = normalizeFormData(f.lus);
const data = { const data = {
'example_ids': JSON.stringify(example_ids), 'example_ids': JSON.stringify(example_ids),
'frame_id': this.frame_in_progress.id, 'selected_lus': JSON.stringify(this.selectedLus.map(e => e.id)),
'argument_id': this.selected_frame_argument_id.split('-')[1]
}; };
$.ajax({ $.ajax({
type: 'post', type: 'post',
...@@ -244,7 +259,7 @@ ...@@ -244,7 +259,7 @@
} }
$.prompt(attach_examples_popup); $.prompt(attach_examples_popup);
} else { } else {
alert(gettext("Wybierz argument, do którego chcesz podłączyć przykłady.")); alert(gettext("Zaznacz jednostkę leksykalną, do którego chcesz podłączyć przykłady."));
} }
} else { } else {
alert(gettext("Stwórz nową ramę.")); alert(gettext("Stwórz nową ramę."));
...@@ -252,20 +267,47 @@ ...@@ -252,20 +267,47 @@
}, },
change_frame_opinion() { change_frame_opinion() {
if (this.frame_in_progress) { if (this.frame_in_progress) {
const frame_opinion_select = function () {
return frame_opinions.map(frame_opinion => {
return `<label><input type="radio" name="opinion" value="${frame_opinion.id}" /> ${frame_opinion.key}</label><br />`;
}).join("");
}.bind(this);
const change_frame_opinion_popup = {
state0: {
title: 'Wybierz opinię',
html: frame_opinion_select,
buttons: {Anuluj: 0, Wybierz: 1},
focus: -1,
submit: function (e, v, m, f) {
if (v == 0) {
e.preventDefault();
$.prompt.close();
}
if (v === 1) {
e.preventDefault();
let opinion_id = normalizeFormData(f.opinion)[0];
send_post_request('/freelus/change_frame_opinion/', send_post_request('/freelus/change_frame_opinion/',
{ {
'frame_id': this.frame_in_progress.id, 'frame_id': this.frame_in_progress.id,
'opinion': frame.id, 'opinion_id': opinion_id,
}, },
(reponse) => { (reponse) => {
show_info('Opinia została zmieniona.'); // show_info('Opinia została zmieniona.');
alert(gettext("Opinia została zmieniona.")); alert(gettext("Opinia została zmieniona."));
this.loadEntry(); this.loadEntry();
$.prompt.close();
}, },
(request, errorType, errorMessage) => { (request, errorType, errorMessage) => {
show_error(errorType + ' (' + errorMessage + ')'); show_error(errorType + ' (' + errorMessage + ')');
alert(gettext("Zmiana opinii nie powiodła się. Błąd: " + errorType + ' (' + errorMessage + ')')); alert(gettext("Zmiana opinii nie powiodła się. Błąd: " + errorType + ' (' + errorMessage + ')'));
$.prompt.close();
}) })
}
}.bind(this)
}
}
$.prompt(change_frame_opinion_popup);
} else { } else {
alert(gettext("Stwórz nową ramę.")); alert(gettext("Stwórz nową ramę."));
} }
...@@ -279,6 +321,32 @@ ...@@ -279,6 +321,32 @@
return roleName; return roleName;
} }
}, },
remove_argument() {
if (this.selected_frame_argument_id === null) {
alert(gettext("Zaznacz argument, który chcesz usunąć."));
} else {
const data = {
'argument_id': parseInt(this.selected_frame_argument_id.split('-')[1]),
};
$.ajax({
type: 'post',
url: '/' + lang + '/freelus/remove_argument_from_frame/',
dataType: 'json',
data: data,
timeout: 60000,
success: function (response) {
// alert(gettext("Argument został usunięty."));
show_info('Argument został usunięty.');
this.loadEntry();
$.prompt.close();
}.bind(this),
error: function (request, errorType, errorMessage) {
show_error(errorType + ' (' + errorMessage + ')');
$.prompt.close();
}
});
}
},
change_role(selected_frame_argument_id, api_path) { change_role(selected_frame_argument_id, api_path) {
if (selected_frame_argument_id === null) { if (selected_frame_argument_id === null) {
alert(gettext("Zaznacz argument, dla którego chcesz wybrać rolę.")); alert(gettext("Zaznacz argument, dla którego chcesz wybrać rolę."));
...@@ -334,12 +402,13 @@ ...@@ -334,12 +402,13 @@
data: data, data: data,
timeout: 60000, timeout: 60000,
success: function (response) { success: function (response) {
alert(gettext("Nowa rola zosała zapisana.")); // alert(gettext("Nowa rola zosała zapisana."));
show_info('Nowa rola zosała zapisana.'); show_info('Nowa rola zosała zapisana.');
this.loadEntry(); this.loadEntry();
$.prompt.close(); $.prompt.close();
}.bind(this), }.bind(this),
error: function (request, errorType, errorMessage) { error: function (request, errorType, errorMessage) {
alert(errorType + ' (' + errorMessage + ')');
show_error(errorType + ' (' + errorMessage + ')'); show_error(errorType + ' (' + errorMessage + ')');
$.prompt.close(); $.prompt.close();
} }
...@@ -373,10 +442,12 @@ ...@@ -373,10 +442,12 @@
assign_schema() { assign_schema() {
if (this.frame_in_progress && this.selected_schemata_position_id && this.selected_frame_argument_id) { if (this.frame_in_progress && this.selected_schemata_position_id && this.selected_frame_argument_id) {
const data = { const data = {
'frame_id': this.frame_in_progress.id, 'frame_id': parseInt(this.frame_in_progress.id),
'argument_id': this.selected_frame_argument_id.split('-')[1], 'subentry_id': parseInt(this.selected_schemata_subentry_id),
'schema_id': this.selectedSchemas[0].id, 'argument_id': parseInt(this.selected_frame_argument_id.split('-')[1]),
'schema_position_id': this.selected_schemata_position_id.split('-')[1] 'schema_id': parseInt(this.selectedSchemas[0].id),
'schema_position_id': parseInt(this.selected_schemata_position_id.split('-')[1]),
'schema_alternation_id': (parseInt(this.selected_schemata_position_alternation_id)+1)
}; };
$.ajax({ $.ajax({
type: 'post', type: 'post',
...@@ -385,12 +456,18 @@ ...@@ -385,12 +456,18 @@
data: data, data: data,
timeout: 60000, timeout: 60000,
success: function (response) { success: function (response) {
alert(gettext("Argument ramy został powiązany z tybranym argumentem schematu.")); if(response['succ'] == true) {
// alert(gettext("Argument ramy został powiązany z tybranym argumentem schematu."));
show_info('Argument ramy został powiązany z tybranym argumentem schematu.'); show_info('Argument ramy został powiązany z tybranym argumentem schematu.');
this.loadEntry(); this.loadEntry();
} else {
alert(gettext(response['error']));
show_info(response['error']);
}
$.prompt.close(); $.prompt.close();
}.bind(this), }.bind(this),
error: function (request, errorType, errorMessage) { error: function (request, errorType, errorMessage) {
alert(errorType + ' (' + errorMessage + ')');
show_error(errorType + ' (' + errorMessage + ')'); show_error(errorType + ' (' + errorMessage + ')');
$.prompt.close(); $.prompt.close();
} }
...@@ -403,9 +480,11 @@ ...@@ -403,9 +480,11 @@
if (this.frame_in_progress && this.selected_schemata_position_id && this.selected_frame_argument_id) { if (this.frame_in_progress && this.selected_schemata_position_id && this.selected_frame_argument_id) {
const data = { const data = {
'frame_id': this.frame_in_progress.id, 'frame_id': this.frame_in_progress.id,
'subentry_id': parseInt(this.selected_schemata_subentry_id),
'argument_id': this.selected_frame_argument_id.split('-')[1], 'argument_id': this.selected_frame_argument_id.split('-')[1],
'schema_id': this.selectedSchemas[0].id, 'schema_id': this.selectedSchemas[0].id,
'schema_position_id': this.selected_schemata_position_id.split('-')[1] 'schema_position_id': this.selected_schemata_position_id.split('-')[1],
'schema_alternation_id': (parseInt(this.selected_schemata_position_alternation_id)+1)
}; };
$.ajax({ $.ajax({
type: 'post', type: 'post',
...@@ -414,12 +493,13 @@ ...@@ -414,12 +493,13 @@
data: data, data: data,
timeout: 60000, timeout: 60000,
success: function (response) { success: function (response) {
alert(gettext("Powiązanie pomiędzy argumentem ramy a argumentem schematu zostało usunięte.")); // alert(gettext("Powiązanie pomiędzy argumentem ramy a argumentem schematu zostało usunięte."));
show_info('Powiązanie pomiędzy argumentem ramy a argumentem schematu zostało usunięte.'); show_info('Powiązanie pomiędzy argumentem ramy a argumentem schematu zostało usunięte.');
this.loadEntry(); this.loadEntry();
$.prompt.close(); $.prompt.close();
}.bind(this), }.bind(this),
error: function (request, errorType, errorMessage) { error: function (request, errorType, errorMessage) {
alert(errorType + ' (' + errorMessage + ')');
show_error(errorType + ' (' + errorMessage + ')'); show_error(errorType + ' (' + errorMessage + ')');
$.prompt.close(); $.prompt.close();
} }
...@@ -446,6 +526,7 @@ ...@@ -446,6 +526,7 @@
$.prompt.close(); $.prompt.close();
}.bind(this), }.bind(this),
error: function (request, errorType, errorMessage) { error: function (request, errorType, errorMessage) {
alert(errorType + ' (' + errorMessage + ')');
show_error(errorType + ' (' + errorMessage + ')'); show_error(errorType + ' (' + errorMessage + ')');
$.prompt.close(); $.prompt.close();
} }
...@@ -484,29 +565,36 @@ ...@@ -484,29 +565,36 @@
<div id="free-lus-pane" class="col w-100 p-0 overflow-auto"> <div id="free-lus-pane" class="col w-100 p-0 overflow-auto">
<table class="table-button-menu sticky-top" cellspacing="1"> <table class="table-button-menu sticky-top" cellspacing="1">
<tr style="background-color: white;"> <tr style="background-color: white;">
<td id="create-new-frame" class="table-button-menu-td" @click="create_new_slowal_frame()" <td id="create-new-frame" class="table-button-menu-td" @click="connect_lus_to_slowal_frame(this.frame_in_progress)"
style="padding: 10px 15px 10px 15px; color: #000000;">Nowa rama style="padding: 10px 15px 10px 15px; color: #000000;">{{this.frame_in_progress ? 'Dodaj/Usuń jednostki' : 'Nowa rama'}}
</td> </td>
<td id="add-argument" class="table-button-menu-td" @click="change_role(-1, 'add_argument_to_frame')" <td id="add-argument" class="table-button-menu-td" @click="change_role(-1, 'add_argument_to_frame')"
style="padding: 10px 15px 10px 15px; color: #000000;">Dodaj argument style="padding: 10px 15px 10px 15px; color: #000000;">Dodaj argument
</td> </td>
<td id="change-role" class="table-button-menu-td"
@click="change_role(selected_frame_argument_id ? selected_frame_argument_id.split('-')[1] : null, 'change_role')" <td id="assign-schema" class="table-button-menu-td" @click="assign_schema()"
style="padding: 10px 15px 10px 15px; color: #000000;">Zmień rolę style="padding: 10px 15px 10px 15px; color: #000000;">Podłącz argument
</td> </td>
<td id="assign-examples" class="table-button-menu-td" @click="attach_examples()" <td id="assign-examples" class="table-button-menu-td" @click="attach_examples()"
style="padding: 10px 15px 10px 15px; color: #000000;">Podłącz przykłady style="padding: 10px 15px 10px 15px; color: #000000;">Podłącz przykłady
</td> </td>
<td id="finish-frame-building" class="table-button-menu-td" @click="finish_frame_building()"
style="padding: 10px 15px 10px 15px; color: #000000;">Gotowe
</td>
</tr> </tr>
<tr style="background-color: white;"> <tr style="background-color: white;">
<td id="assign-schema" class="table-button-menu-td" @click="assign_schema()" <td id="change-role" class="table-button-menu-td"
style="padding: 10px 15px 10px 15px; color: #000000;">Podłącz schemat @click="change_role(selected_frame_argument_id ? selected_frame_argument_id.split('-')[1] : null, 'change_role')"
style="padding: 10px 15px 10px 15px; color: #000000;">Zmień rolę
</td>
<td id="remove-argument" class="table-button-menu-td" @click="remove_argument()"
style="padding: 10px 15px 10px 15px; color: #000000;">Usuń argument
</td> </td>
<td id="delete-schema" class="table-button-menu-td" @click="delete_schema_connections()" <td id="delete-schema" class="table-button-menu-td" @click="delete_schema_connections()"
style="padding: 10px 15px 10px 15px; color: #000000;">Rozłącz schemat style="padding: 10px 15px 10px 15px; color: #000000;">Odłącz argument
</td> </td>
<td id="finish-frame-building" class="table-button-menu-td" @click="finish_frame_building()" <td id="change-frame-opinion" class="table-button-menu-td" @click="change_frame_opinion()"
style="padding: 10px 15px 10px 15px; color: #000000;">Zakończ tworzenie nowej ramy style="padding: 10px 15px 10px 15px; color: #000000;">Zmień opinię
</td> </td>
</tr> </tr>
</table> </table>
......
...@@ -103,7 +103,7 @@ ...@@ -103,7 +103,7 @@
}); });
this.$emit('schemataSelected', selected); this.$emit('schemataSelected', selected);
}, },
selectSchemaPosition(schema, position) { selectSchemaPosition(schema, position, subentry, alternation_id) {
this.subentries.forEach(subentry => { this.subentries.forEach(subentry => {
subentry.schemata.forEach(s => { subentry.schemata.forEach(s => {
s.selected = false; s.selected = false;
...@@ -111,12 +111,12 @@ ...@@ -111,12 +111,12 @@
}); });
if(this.selected_schemata_position_id != position.id) { if(this.selected_schemata_position_id != position.id) {
this.selected_schemata_position_id = position.id; this.selected_schemata_position_id = position.id;
this.$emit('schemaPositionSelected', this.selected_schemata_position_id); this.$emit('schemaPositionSelected', this.selected_schemata_position_id, subentry, alternation_id);
this.$emit('schemataSelected', [schema]); this.$emit('schemataSelected', [schema]);
} else { } else {
this.selected_schemata_position_id = null; this.selected_schemata_position_id = null;
this.$emit('schemaPositionSelected', null); this.$emit('schemaPositionSelected', null, null, null);
this.$emit('schemataSelected', []); this.$emit('schemataSelected', null);
} }
}, },
computePositionCSS(position) { computePositionCSS(position) {
...@@ -172,7 +172,7 @@ ...@@ -172,7 +172,7 @@
<tr class="phrase-types alt-0"> <tr class="phrase-types alt-0">
<th scope="row" class="py-0 px-1 text-secondary">Typy fraz</th> <th scope="row" class="py-0 px-1 text-secondary">Typy fraz</th>
<td v-for="position in schema.positions" class="px-0 py-0 border-top border-left border-secondary" <td v-for="position in schema.positions" class="px-0 py-0 border-top border-left border-secondary"
@click.stop="selectSchemaPosition(schema, position)" @click.stop="selectSchemaPosition(schema, position, subentry, index)"
@mouseenter="position.hover=true" @mouseenter="position.hover=true"
@mouseleave="position.hover=false" @mouseleave="position.hover=false"
:class="computePositionCSS(position)"> :class="computePositionCSS(position)">
...@@ -194,7 +194,7 @@ ...@@ -194,7 +194,7 @@
<tr class="phrase-types alt-0"> <tr class="phrase-types alt-0">
<th scope="row" class="py-0 px-1 text-secondary">Typy fraz</th> <th scope="row" class="py-0 px-1 text-secondary">Typy fraz</th>
<td v-for="position in schema.positions" class="px-0 py-0 border-top border-left border-secondary" <td v-for="position in schema.positions" class="px-0 py-0 border-top border-left border-secondary"
@click.stop="selectSchemaPosition(schema, position)" @click.stop="selectSchemaPosition(schema, position, subentry, 0)"
@mouseenter="position.hover=true" @mouseenter="position.hover=true"
@mouseleave="position.hover=false" @mouseleave="position.hover=false"
:class="computePositionCSS(position)"> :class="computePositionCSS(position)">
......
...@@ -79,7 +79,8 @@ class WalentyTeiHandler(handler.ContentHandler): ...@@ -79,7 +79,8 @@ class WalentyTeiHandler(handler.ContentHandler):
entry = Entry(self._subtree, self._entry_meanings, self._meanings, self._frames, self._examples_in, self._examples_out, self._misconnected_out) entry = Entry(self._subtree, self._entry_meanings, self._meanings, self._frames, self._examples_in, self._examples_out, self._misconnected_out)
if not connections.models.Entry.objects.filter(id=int(entry._id)).exists(): if not connections.models.Entry.objects.filter(id=int(entry._id)).exists():
print("Entry not exists in database: {}, status: {}".format(entry._base, entry._status)) print("Entry not exists in database: {}, status: {}".format(entry._base, entry._status))
if entry._status == '(S) sprawdzone' or entry._status == 'sprawdzone' or entry._status == '(S) gotowe': if entry._status == '(F) sprawdzone' or entry._status == '(S) w obróbce' or \
entry._status == '(S) sprawdzone' or entry._status == 'sprawdzone' or entry._status == '(S) gotowe':
entry.store(self._meanings, self._stored_positions) entry.store(self._meanings, self._stored_positions)
else: else:
print("Odrzucono niegotowe: {}, status: {}".format(entry._base, entry._status)) print("Odrzucono niegotowe: {}, status: {}".format(entry._base, entry._status))
......