nuova versione

Merge branch 'master' of
https://gitea-s2i2s.isti.cnr.it/concordia/LiDa_Search.git
This commit is contained in:
nicola 2024-12-10 12:15:28 +01:00
parent 421b5e7d64
commit f6a27cadee
2 changed files with 40 additions and 90 deletions

View File

@ -689,7 +689,7 @@
</select>
</div>
<span class="px-2" id="spanContenenti">Contenenti:</span>
<div id="grammaticaEsintassi">
<div id="grammaticaEsintassi" style="display: none;">
<div class="px-1 pb-0" id="cercaFrasiPeriodiDiscorsi">
<div
class=" form-group form-inline input-group px-1 pt-1 pb-2 m-0"
@ -1561,10 +1561,10 @@
</div>
</div>
</div>
<div class=" well m-0 pb-2" id="contextDiv0">
<div class=" well m-0 pb-2" id="contextDiv0" style="display: none;">
<div id="contextTable-xX0"
class="row no-gutters p-1 pt-0 bg-lida08">
class="row no-gutters p-1 pt-0 bg-lida08" >
<div class="col-12 py-0 pl-1">
<span class=" align-bottom">Restringi il contesto
di ricerca:</span>
@ -1904,11 +1904,7 @@
<div id="collapseLogic" class="collapse show"
style="display: none;" aria-labelledby="headingLogic"
data-parent="#accordionSearch">
<div class="card-body p-0">
<div class="col-12 pt-2 px-4">
<span class=" text-muted align-bottom pr-2">
Filtra in AND con</span>
</div>
<div class="card-body p-0">
<div class="row card tab-content bg-lida10 m-0 p-0"
id="cla-TabContent">
<div class="col-12 pt-2">
@ -1928,9 +1924,9 @@
<div class="col-12 p-0">
<ul id="sortable0"
class="condLIand list-group ui-sortable">
<li id="li-cla0"
<!-- <li id="li-cla0"
class="list-group-item align-items-center my-1 ui-state-default ui-state-disabled ui-state-disabled-opacity-06 border text-muted bg-lida-vis small">Nessuna
clausola aggiunta.</li>
clausola aggiunta.</li> -->
</ul>
</div>
</div>

View File

@ -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() {
@ -293,7 +296,10 @@ $(document).ready(function() {
$('#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;");
@ -301,6 +307,8 @@ $(document).ready(function() {
$('#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;
}
});
@ -371,41 +379,16 @@ $(document).ready(function() {
$('#btnAddAnd').on('click', function() {
tabID++;
addGramCla("#sortable0", 1, tabID, 1);
addGramCla("#sortable0", 1, tabID, 1,1);
$('#collapseLogic').attr('style', "display: d-flex;");
$("#unitaRicerca").prop('disabled',true);
});
// 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();
});
});
$('#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,
@ -804,14 +787,15 @@ $(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 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);
@ -824,7 +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);
$("#contextDiv0").attr('style', "display: none");
addClaContext(tabID);
}
@ -938,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) {
@ -986,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({
@ -1028,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;");
@ -1038,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();
@ -1094,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));
}
};
}