Skip to content
Snippets Groups Projects
Commit 9789d0ec authored by dcz's avatar dcz
Browse files

Check empty arguments before unified frame status change to ready.

parent d172ab7d
No related branches found
No related tags found
No related merge requests found
......@@ -510,7 +510,7 @@ Object.assign(LexicalUnitEdit, {
const duplicate_popup = {
state0: {
title: 'Podaj nazwę zduplikowanej ramy',
html: '<input type="text" size="32" value="KOPIA_' + title + '" name="title" />',
html: '<input type="text" size="32" value="" name="title" />',
buttons: {Anuluj: 0, Zapisz: 1},
focus: -1,
submit: function (e, v, m, f) {
......@@ -597,6 +597,8 @@ Object.assign(LexicalUnitEdit, {
}
if (Object.keys(roleDict).length === this.unified_frame_arguments.length && hasPreferenceSelected) {
//all roles are set, and are uniq
if(!this.has_full_empty_arguments()) {
//TODO: aktywne preferencje w argumencie nie znajdują się w relacji hipo-/hiperonimii.
const data = {'unified_frame_id': this.unified_frame.id};
$.ajax({
......@@ -616,6 +618,9 @@ Object.assign(LexicalUnitEdit, {
show_error(errorType + ' (' + errorMessage + ')');
}
});
} else {
alert(gettext("Rama posiada agrument, dla którego wszystkie ramy walentego są typu 'Empty'. Należy usunąć taki argument."));
}
} else {
alert(gettext("Role dla wszystkich argumentów powinny być ustawione oraz unikalne. Preferencje selekcyjne dla wszystkich argumentów powinny być ustawione."));
}
......@@ -938,6 +943,23 @@ Object.assign(LexicalUnitEdit, {
}
}
},
has_full_empty_arguments() {
let non_empty_unified_frame_arguments = {}
for (let i in this.unified_frame.slowal_frame_mapping) {
const slowal_frame_mapping = this.unified_frame.slowal_frame_mapping[i];
let slowal_frame = this.frames.find(o => o.id === slowal_frame_mapping.slowal_frame_id);
if(slowal_frame != null) {
for (let j in this.unified_frame.arguments) {
const unified_frame_argument = this.unified_frame.arguments[j];
let unified_frame_argument_mapping = slowal_frame_mapping.slowal_frame_argument_mapping.find(o => o.unified_frame_agrument_id === unified_frame_argument.id);
if (unified_frame_argument_mapping) {
non_empty_unified_frame_arguments[unified_frame_argument.id] = unified_frame_argument;
}
}
}
}
return Object.keys(non_empty_unified_frame_arguments).length !== this.unified_frame.arguments.length;
},
hideLexicalUnits() {
this.lexicalUnitsVisible = false;
},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment