Compare commits

...

5 Commits

Author SHA1 Message Date
nicola f6a27cadee nuova versione
Merge branch 'master' of
https://gitea-s2i2s.isti.cnr.it/concordia/LiDa_Search.git
2024-12-10 12:15:28 +01:00
nicola 421b5e7d64 Merge branch 'master' of https://gitea-s2i2s.isti.cnr.it/concordia/LiDa_Search.git 2024-12-09 20:08:58 +01:00
nicola b765a6de3d Aggiunte funzionalità 2024-12-09 20:08:15 +01:00
nicola 6e9dcb18ee minor changes 2024-12-06 19:10:05 +01:00
nicola 474f3cdf5f Pulizia dell' HTML 2024-12-06 19:08:17 +01:00
2 changed files with 1476 additions and 1668 deletions

File diff suppressed because it is too large Load Diff

View File

@ -94,12 +94,12 @@ $(document).ready(function() {
// Funzioni di gestione del comportamento dei bottoni collapse
$('#collapseLogic').on('hidden.bs.collapse', function(e) {
/*$('#collapseLogic').on('hidden.bs.collapse', function(e) {
if (e.target.id == "collapseLogic") {
$("#showLogic").html('<span class="text-muted">Mostra</span>');
$("#collapseAdvanced").collapse('hide');
};
})
})*/
$('#collapseLogic').on('shown.bs.collapse', function() {
$("#showLogic").html('<span class="font-weight-bold text-muted">Nascondi</span>');
@ -148,7 +148,7 @@ $(document).ready(function() {
$('#checkmarkAdvanced').attr('style', 'opacity: 1');
$('#checkmarkSimple').attr('style', 'opacity: 0');
queryJson.QueryAvanzata = "1";
$("#collapseOptions").collapse('hide');
// $("#collapseOptions").collapse('hide');
$("#simpleSearchDiv").fadeOut(300, function() {
$("#rigaRicercaSemplice").removeClass("bg-lida08")
$("#rigaRicercaSemplice").addClass("bg-lida10")
@ -159,6 +159,9 @@ $(document).ready(function() {
$("#collapseLogic").collapse('show');
});
});
tabID++;
addGramCla("#sortable0", 1, tabID, 1);
$('#collapseLogic').attr('style', "display: d-flex;");
});
$('#searchSimple').on('click', function() {
@ -291,15 +294,21 @@ $(document).ready(function() {
case "discorso":
$('#cercaFrasiPeriodiDiscorsi').attr('style', "display: d-flex;");
$('#tipogrammaticaleN').attr('style', "display: d-flex;");
$('#spanContenenti').attr('style', "display: d-flex;");
$('#tiposintatticoN').attr('style', "display: d-flex;");
$('#cercaRiferimenti').attr('style', "display: none;");
$('#cercaRiferimenti').attr('style', "display: none;");
$("#contextDiv0").attr('style', "display: none");
$('#collapseLogic').attr('style', "display: d-flex;");
break;
case "riferimenti":
$('#cercaRiferimenti').attr('style', "display: d-flex;");
$('#cercaFrasiPeriodiDiscorsi').attr('style', "display: none;");
$('#tipogrammaticaleN').attr('style', "display: none;");
$('#tiposintatticoN').attr('style', "display: none");
$('#spanContenenti').attr('style', "display: none;");
$('#collapseLogic').attr('style', "display: none;");
$("#contextDiv0").attr('style', "display: d-flex;");
break;
}
});
@ -368,37 +377,18 @@ $(document).ready(function() {
});
});
// Evento: click sulla lista di clausole nel dropbox "Aggiungi clausola di tipo:" o "aggiungi condizione logica:"
$('.addCCbtn').on('click', function() {
var addCC = $(this).attr('id');
$('#collapseLogic').show();
switch (addCC) {
case "btnAddCla1":
tabID++;
addGramCla("#sortable0", 1, tabID, 1);
numberOfQueries++;
break;
case "btnAddCla2":
tabID++;
addSyntCla("#sortable0", 1, tabID, 1);
numberOfQueries++;
break;
case "btnAddCla3":
tabID++;
addMetaCla("#sortable0", 0, tabID, 0);
break;
case "btnAddCond":
addLogicCond("#sortable0", "OR");
break;
default:
$('#collapseLogic').hide();
break;
};
refreshClaList();
refreshSortables();
});
$('#btnAddAnd').on('click', function() {
tabID++;
addGramCla("#sortable0", 1, tabID, 1,1);
$('#collapseLogic').attr('style', "display: d-flex;");
$("#unitaRicerca").prop('disabled',true);
});
$('#btnAddOr').on('click', function() {
tabID++;
addGramCla("#sortable0", 1, tabID, 1,2);
$('#collapseLogic').attr('style', "display: d-flex;");
$("#unitaRicerca").prop('disabled',true);
});
// Evento: clausola spostata nella lista
$('#sortable0').sortable({
opacity: 0.6,
@ -535,6 +525,7 @@ $(document).ready(function() {
resetResult();
resetAdvGui();
refreshClaList();
$("#unitaRicerca").prop('disabled',false);
});
// Evento: click sull'icona rimuovi nota
@ -796,19 +787,20 @@ $(document).ready(function() {
// Funzione di creazione del tab delle clausole grammaticali
function addGramCla(sortableId, active, tabID, toExpand) {
function addGramCla(sortableId, active, tabID, toExpand, cond = 9999) {
if (active > 0) {
var checkInsert = ' checked="checked"';
} else {
var checkInsert = '';
};
var claText = "Categoria grammaticale: <br>";
addLIitem(sortableId, tabID, claText, checkInsert, toExpand);
var claClone = document.getElementById("tipogrammaticaleN").cloneNode(true);
claClone.setAttribute("id", "cla" + tabID);
claClone.setAttribute("data-claActive", active);
claClone.setAttribute("aria-labelledby", "cla" + tabID + "-tab");
claClone.setAttribute("style", "");
var claText = ""; //Categoria grammaticale: <br>";
addLIitem(sortableId, tabID, claText, checkInsert, toExpand, cond);
var claClone = $("#grammaticaEsintassi").clone(true);
claClone.attr("id", "cla" + tabID);
claClone.attr("data-claActive", active);
claClone.attr("aria-labelledby", "cla" + tabID + "-tab");
claClone.attr("style", "");
$('#claBody' + tabID).append(claClone);
// se non cambio l'id della select react non rileva l'evento onchange:
$('#cla' + tabID + " #grammtypesN").attr("id", "grammtypes" + tabID);
@ -816,39 +808,7 @@ $(document).ready(function() {
$('#cla' + tabID + " #queryTextN").attr("id", "queryText" + tabID);
$('#cla' + tabID + " #opzioni_testoN").attr("id", "opzioni_testo" + tabID);
$('#cla' + tabID + " #contextDivN").attr("id", "contextDiv" + tabID);
var unita = $('#unitaRicerca').val();
var query = "";
var lemma_forma = "";
var opzioni = "";
switch (unita) {
case "forma":
case "lemma":
query = $('#queryTextUnita').val();
lemma_forma = $('#unitaRicerca').val();
opzioni = $('#opzioni_testoUnita').val();
break;
case "frase":
case "periodo":
case "discorso":
case "riferimenti":
opzioni = $('#opzioni_testoINIT').val();
lemma_forma = $('#lemma_formaINIT').val();
query = $('#queryTextINIT').val();
break;
}
$('#queryText' + tabID).val(query);
$('#lemma_forma' + tabID).val(lemma_forma);
$('#opzioni_testo' + tabID).val(opzioni);
//Nik verificare costruzione clausole JSON
/*$('#queryText').val(query);
$('#lemma_forma').val(lemma_forma);
$('#opzioni_testo').val(opzioni);
*/
$('#queryTextN').val(query);
$('#lemma_formaN').val(lemma_forma);
$('#opzioni_testoN').val(opzioni);
$("#contextDiv0").attr('style', "display: none");
addClaContext(tabID);
}
@ -962,46 +922,6 @@ $(document).ready(function() {
};
}
// Funzione di creazione del tab delle clausole sintattiche
function addSyntCla(sortableId, active, tabID, toExpand) {
if (active > 0) {
var checkInsert = ' checked="checked"';
} else {
var checkInsert = '';
};
var claText = "Tipo sintattico: <br>";
addLIitem(sortableId, tabID, claText, checkInsert, toExpand);
var claClone = document.getElementById("tiposintatticoN").cloneNode(true);
claClone.setAttribute("id", "cla" + tabID);
claClone.setAttribute("data-claActive", active);
claClone.setAttribute("aria-labelledby", "cla" + tabID + "-tab");
claClone.setAttribute("style", "");
$('#claBody' + tabID).append(claClone);
$('#cla' + tabID + " #lemma_formaN").attr("id", "lemma_forma" + tabID);
$('#cla' + tabID + " #queryTextN").attr("id", "queryText" + tabID);
$('#cla' + tabID + " #opzioni_testoN").attr("id", "opzioni_testo" + tabID);
$('#cla' + tabID + " #contextDivN").attr("id", "contextDiv" + tabID);
addClaContext(tabID);
}
// Funzione di creazione del tab delle clausole metafore
function addMetaCla(sortableId, active, tabID, toExpand) {
var checkInsert = ' disabled';
//if (active > 0) {
// var checkInsert = '" checked="checked"';
//} else {
// var checkInsert = '"';
//};
var claText = "Clausola Metafore - non ancora implementata";
addLIitem(sortableId, tabID, claText, checkInsert, toExpand);
var claClone = document.getElementById("tipometaforaN").cloneNode(true);
claClone.setAttribute("id", "cla" + tabID);
claClone.setAttribute("data-claActive", active);
claClone.setAttribute("aria-labelledby", "cla" + tabID + "-tab");
claClone.setAttribute("style", "");
$('#claBody' + tabID).append(claClone);
}
// Funzione di creazione della parte di definizione del contesto delle clausole
function addClaContext(tabID) {
@ -1010,6 +930,8 @@ $(document).ready(function() {
contClone = contClone.outerHTML.replace(/xX0/g, "xX" + tabID);
contClone = contClone.replace(/-secondary/g, "-success");
contClone = contClone.replace(/sel-canto/g, "sel-canto suxess");
$("#contextDiv" + tabID).append($(contClone)[0]);
resetContext(tabID);
$("#selectable-xX" + tabID).selectable({
@ -1052,7 +974,7 @@ $(document).ready(function() {
}
// Funzione di creazione del LI di una clausola nella lista sortable
function addLIitem(sortableId, tabID, claText, checkInsert, toExpand) {
function addLIitem(sortableId, tabID, claText, checkInsert, toExpand, cond = 9999) {
claListLen++;
var cloneLI = document.getElementById("li-claxX1Xx").cloneNode(true);
cloneLI.setAttribute("style", "opacity: 0.1;");
@ -1062,6 +984,14 @@ $(document).ready(function() {
if (checkInsert == ' disabled') {
cloneLI = cloneLI.replace(/claCollBtn/g, "claCollBtn " + checkInsert);
};
var boolCond = $('<span />')
switch (cond){
case 1: boolCond.append("AND");
break;
case 2: boolCond.append("OR");
break;
}
$(sortableId).append(boolCond)
$(sortableId).append($(cloneLI)[0]);
if (toExpand == 1) {
$("#claCollapse" + tabID).focus();
@ -1072,9 +1002,9 @@ $(document).ready(function() {
// Funzione di refresh della lista clausole nella tab principale e del json della query
function refreshClaList(editCard = 9999) {
var l_f = $("form #lemma_forma")[0].options[$("form #lemma_forma")[0].selectedIndex].value;
var qText = $("form #queryText")[0].value;
var optText = $("form #opzioni_testo")[0].value;
var l_f = $("#lemma_formaINIT").val();
var qText = $("#queryTextINIT").val();
var optText = $("#opzioni_testoINIT").val();
/*var l_f = "";
var qText = "";
var optText = "";
@ -1118,7 +1048,7 @@ $(document).ready(function() {
$("#cla-defaultCond").remove();
} else {
if ($('#cla-defaultCond').length == 0) {
$("#cla-list-row").prepend($(defaultCond));
//$("#cla-list-row").prepend($(defaultCond));
}
};
}
@ -1145,33 +1075,14 @@ $(document).ready(function() {
var optText_t = "";
var articolo = "Il ";
//Nik verificare in cao di modifica delle clausola
var unitaDiRicerca = $("#unitaRicerca")[0].options[$("#unitaRicerca")[0].selectedIndex].value;
//var unitaDiRicerca = $("#unitaRicerca")[0].options[$("#unitaRicerca")[0].selectedIndex].value;
if (editCard == 9999) {
if (claListItemId == "li-cla" + tabsContentLenght) {
if (unitaDiRicerca == "lemma" || unitaDiRicerca == "forma") {
l_f = unitaDiRicerca;
if (l_f == "forma") {
articolo = "La ";
}
l_f_t = articolo + l_f;
qText = $("#queryTextUnita")[0].value;
optText = $("#opzioni_testoUnita")[0].value;
optText_t = $("#opzioni_testoUnita")[0].options[$("#opzioni_testoUnita")[0].selectedIndex].text;
} else {
l_f = $("#lemma_formaN")[0].options[$("#lemma_formaN")[0].selectedIndex].value;
l_f_t = $("#lemma_formaN")[0].options[$("#lemma_formaN")[0].selectedIndex].text;
qText = $("#queryTextN")[0].value;
optText = $("#opzioni_testoN")[0].value;
optText_t = $("#opzioni_testoN")[0].options[$("#opzioni_testoN")[0].selectedIndex].text;
}
}else{
l_f = $("form #lemma_forma" + claIdNum)[0].options[$("form #lemma_forma" + claIdNum)[0].selectedIndex].value;
l_f_t = $("form #lemma_forma" + claIdNum)[0].options[$("form #lemma_forma" + claIdNum)[0].selectedIndex].text;
qText = $("form #queryText" + claIdNum)[0].value;
optText = $("form #opzioni_testo" + claIdNum)[0].value;
optText_t = $("form #opzioni_testo" + claIdNum)[0].options[$("form #opzioni_testo" + claIdNum)[0].selectedIndex].text;
}
l_f = $("#lemma_formaINIT").val();
l_f_t = $("#lemma_formaINIT").text();
qText = $("#queryTextINIT").val();
optText = $("#opzioni_testoINIT").val();
optText_t = $("#opzioni_testoINIT").text();
} else {
l_f = $("#lemma_forma" + editCard)[0].options[$("#lemma_forma" + editCard)[0].selectedIndex].value;
l_f_t = $("#lemma_forma" + editCard)[0].options[$("#lemma_forma" + editCard)[0].selectedIndex].text;
@ -1582,7 +1493,7 @@ $(document).ready(function() {
window["context" + claIdNum] = JSON.parse(JSON.stringify(contextEmpty));
$('#selectable-xX' + claIdNum + " .show").removeClass("show");
$("#contextDiv" + claIdNum).hide(); //Nik work around per non mostrare context
//$("#contextDiv" + claIdNum).hide(); //Nik work around per non mostrare context
};
function resetAdvGui() {