Aggiustamenti minori nella gestione del contesto

This commit is contained in:
Luca Trupiano 2023-01-19 17:52:07 +01:00
parent c22f672602
commit 3a02f19983
1 changed files with 15 additions and 11 deletions

View File

@ -1,5 +1,6 @@
/**
*
*unita' di ricerca:
verso discorso periodo frase metafora sintagma lemma forma
*/
/* necessari per il bundle:
@ -250,6 +251,7 @@ $(document).ready(function() {
$('#rigaRicerca').on('click', '.trashClaCont', function() {
var claIdNum = $(this)[0].id.substring(15);
resetContext(claIdNum);
refreshClaList();
});
// Evento: click sull'icona di add del contesto
@ -267,6 +269,7 @@ $(document).ready(function() {
if ($(this).closest('.card').find('span:visible').length == 1) {
$(this).closest('.card').find('div .sel-canti-intro').text("Selezionati tutti i canti.");
};
refreshClaList();
});
// Evento: click sull'icona di save local
@ -892,8 +895,8 @@ $(document).ready(function() {
};
var jsonTextToParse = '{"queryText": "' + qText + '", "lemma_forma": "' + l_f + '", "opzioni_testo": "' + optText + '", "TipoClausola": "' + claType + '", "Attiva": "' + claActive + '"';
var gramSelect = $("#" + claId).find(".catgram");
//claText = claGuiNum + ". " + termText + "Categoria grammaticale: " + gramSelect[0].options[gramSelect[0].selectedIndex].text + ';<br>';
claText = termText + "Categoria grammaticale: " + gramSelect[0].options[gramSelect[0].selectedIndex].text + ';<br>';
var contextText = $("#contextText-xX" + claIdNum).text();
claText = termText + "Categoria grammaticale: " + gramSelect[0].options[gramSelect[0].selectedIndex].text;
jsonTextToParse = jsonTextToParse + ', "' + gramSelect.attr('name') + '": "' + gramSelect[0].options[gramSelect[0].selectedIndex].value + '"';
var claSubParList = $("#" + claId).children(".dettaglifiltri").find("select, fieldset");
claSubParList.each(function(){
@ -903,14 +906,15 @@ $(document).ready(function() {
if (claSubParName.startsWith(claId)) {
claSubParName = claSubParName.replace(claId,'');
}
claText = claText + $(this).find(":checked")[0].defaultValue + "; ";
claText = claText + "; " + $(this).find(":checked")[0].defaultValue;
jsonTextToParse = jsonTextToParse + ', "' + claSubParName + '": "' + $(this).find(":checked")[0].value + '"';
};
if (claSubParType == "select-one" && $(this)[0].selectedIndex != 0) {
claText = claText + $(this)[0].options[$(this)[0].selectedIndex].text + "; ";
claText = claText + "; " + $(this)[0].options[$(this)[0].selectedIndex].text;
jsonTextToParse = jsonTextToParse + ', "' + $(this)[0].name + '": "' + $(this)[0].options[$(this)[0].selectedIndex].value + '"';
};
});
claText = claText + '.<br>Contesto: ' + contextText;
break;
case "Sintattico":
var l_f = $("form #lemma_forma" + claIdNum)[0].options[$("form #lemma_forma" + claIdNum)[0].selectedIndex].value;
@ -924,13 +928,11 @@ $(document).ready(function() {
var jsonTextToParse = '{"queryText": "' + qText + '", "lemma_forma": "' + l_f + '", "opzioni_testo": "' + optText + '", "TipoClausola": "' + claType + '", "Attiva": "' + claActive + '"';
var syntSelect = $("#" + claId).find("#synttypes");
var funcSelect = $("#" + claId).find("#syntfunc");
//claText = claGuiNum + ". " + termText + "Tipo sintattico: " + syntSelect[0].options[syntSelect[0].selectedIndex].text + ';<div class="col-md-12"></div>Livello di subordinazione: ' + funcSelect[0].options[funcSelect[0].selectedIndex].text;
claText = termText + "Tipo sintattico: " + syntSelect[0].options[syntSelect[0].selectedIndex].text + ';<div class="col-md-12"></div>Livello di subordinazione: ' + funcSelect[0].options[funcSelect[0].selectedIndex].text;
var contextText = $("#contextText-xX" + claIdNum).text();
claText = termText + "Tipo sintattico: " + syntSelect[0].options[syntSelect[0].selectedIndex].text + ';<br>Livello di subordinazione: ' + funcSelect[0].options[funcSelect[0].selectedIndex].text + '.<br>Contesto: ' + contextText;
jsonTextToParse = jsonTextToParse + ', "' + syntSelect.attr('name') + '": "' + syntSelect[0].options[syntSelect[0].selectedIndex].value + '", "' + funcSelect.attr('name') + '": "' + funcSelect[0].options[funcSelect[0].selectedIndex].value + '"';
break;
default:
//claText = claGuiNum + ". " + $("#" + claId).text();
//claText = $("#" + claId).text();
claText = $("#" + claListItemId + " .clatext").text();
checkInsert = ' disabled';
var jsonTextToParse = '{"queryText": "", "lemma_forma": "", "opzioni_testo": "", "TipoClausola": "' + claType + '", "Attiva": "' + claActive + '"';
@ -1269,6 +1271,7 @@ $(document).ready(function() {
var rangeHolderS = 0;
var rangeHolderE = -1;
var lastElem = "";
var totCan = 0;
for (var i=0; i < 3; i++) {
for (var j=0; j <= context[i].length; j++) {
if (context[i][j] == 1) {
@ -1278,6 +1281,7 @@ $(document).ready(function() {
rangeHolderS = j;
rangeHolderE = j;
};
totCan++;
} else {
if (rangeHolderE >= 0) {
if ( rangeHolderS == rangeHolderE) {
@ -1303,10 +1307,10 @@ $(document).ready(function() {
contextStringParts[i] = contextStringParts[i] + "]"
contextString.push(contextStringParts[i]);
}
if (contextString.toString() != "") {
if ((contextString.toString() != "") && (totCan < 100)) {
$("#contextText-xX" + claIdNum).html(contextString.toString());
} else {
$("#contextText-xX" + claIdNum).html("Tutta l'opera");
resetContext(claIdNum)
}
};
};