risolto alcuni bachi

This commit is contained in:
nicola 2024-11-28 18:09:59 +01:00
parent 25afe13370
commit fc7152b676
2 changed files with 671 additions and 574 deletions

View File

@ -1029,7 +1029,8 @@
<input type="text" <input type="text"
class="form-control form-control-sm monMe" class="form-control form-control-sm monMe"
id="queryTextUnita" placeholder="inserisci un termine" id="queryTextUnita" placeholder="inserisci un termine"
aria-describedby="name-desc" name="query"> <select aria-describedby="name-desc" name="query">
<select
class="form-control custom-select custom-select-sm monMe bg-light text-muted border btn-outline-success" class="form-control custom-select custom-select-sm monMe bg-light text-muted border btn-outline-success"
id="opzioni_testoUnita"> id="opzioni_testoUnita">
<option value="parola">come Parola</option> <option value="parola">come Parola</option>
@ -1056,16 +1057,16 @@
</div> </div>
<select <select
class="form-control custom-select custom-select-sm monMe bg-light text-muted border btn-outline-success" class="form-control custom-select custom-select-sm monMe bg-light text-muted border btn-outline-success"
id="lemma_formaN"> id="lemma_formaINIT">
<option value="forma">La forma</option> <option value="forma">La forma</option>
<option value="lemma">Il lemma</option> <option value="lemma">Il lemma</option>
<option disabled value="testo">Il testo</option> <option disabled value="testo">Il testo</option>
</select> <input type="text" </select> <input type="text"
class="form-control form-control-sm monMe" class="form-control form-control-sm monMe"
id="queryTextN" placeholder="inserisci un termine" id="queryTextINIT" placeholder="inserisci un termine"
aria-describedby="name-desc" name="query"> <select aria-describedby="name-desc" name="query"> <select
class="form-control custom-select custom-select-sm monMe bg-light text-muted border btn-outline-success" class="form-control custom-select custom-select-sm monMe bg-light text-muted border btn-outline-success"
id="opzioni_testoN"> id="opzioni_testoINIT">
<option value="parola">come Parola</option> <option value="parola">come Parola</option>
<option value="sottostringa">come Sottostringa</option> <option value="sottostringa">come Sottostringa</option>
<option value="prefisso">come Prefisso</option> <option value="prefisso">come Prefisso</option>
@ -1694,6 +1695,32 @@
id="tipogrammaticaleN" role="tabpanel" aria-labelledby="claN-tab" id="tipogrammaticaleN" role="tabpanel" aria-labelledby="claN-tab"
data-claType="Grammaticale" data-claActive="1"> data-claType="Grammaticale" data-claActive="1">
<div
class="form-group form-inline input-group pt-3 px-2 m-0"
action="">
<div class="input-group-prepend">
<label class="input-group-text"><ion-icon
name="document-text"></ion-icon></label>
</div>
<select
class="form-control custom-select custom-select-sm monMe bg-light text-muted border btn-outline-success"
id="lemma_formaN">
<option value="forma">La forma</option>
<option value="lemma">Il lemma</option>
<option disabled value="testo">Il testo</option>
</select> <input type="text" class="form-control form-control-sm monMe"
id="queryTextN" placeholder="inserisci un termine"
aria-describedby="name-desc" name="query"> <select
class="form-control custom-select custom-select-sm monMe bg-light text-muted border btn-outline-success"
id="opzioni_testoN">
<option value="parola">come Parola</option>
<option value="sottostringa">come Sottostringa</option>
<option value="prefisso">come Prefisso</option>
<option value="suffisso">come Suffisso</option>
<option value="regexp">come Espressione regolare</option>
</select>
</div>
<div class="form-group px-1 pb-0 my-1"> <div class="form-group px-1 pb-0 my-1">
<label for="typeGramm0" class="text-muted control-label small pl-2 pt-2 m-0">Categoria <label for="typeGramm0" class="text-muted control-label small pl-2 pt-2 m-0">Categoria

View File

@ -115,6 +115,7 @@ $(document).ready(function() {
$("#showOptions").html('<span class="font-weight-bold text-muted">Opzioni</span>'); $("#showOptions").html('<span class="font-weight-bold text-muted">Opzioni</span>');
})*/ })*/
// click su icona pencil per chiudere finestra
$('.collapse').on('hide.bs.collapse', function(e) { $('.collapse').on('hide.bs.collapse', function(e) {
if (e.target.id.substr(0, 11) == "collapseCla") { if (e.target.id.substr(0, 11) == "collapseCla") {
var claIdNum = e.target.id.substr(11); var claIdNum = e.target.id.substr(11);
@ -125,7 +126,7 @@ $(document).ready(function() {
e.stopPropagation(); e.stopPropagation();
}; };
}) })
// click su icona pencil per aprire finestra
$('.collapse').on('show.bs.collapse', function(e) { $('.collapse').on('show.bs.collapse', function(e) {
if (e.target.id.substr(0, 11) == "collapseCla") { if (e.target.id.substr(0, 11) == "collapseCla") {
var claIdNum = e.target.id.substr(11); var claIdNum = e.target.id.substr(11);
@ -323,8 +324,26 @@ $(document).ready(function() {
refreshClaList(); refreshClaList();
}); });
// Variazione dei campi del form
$('#cla-TabContent').on('change', '.monMe', function() { $('#cla-TabContent').on('change', '.monMe', function() {
refreshClaList(); // Nik
var fieldId = $(this)[0].id;
var claId;
if (fieldId.startsWith("query")) {
$("form #queryText").val($("#" + fieldId).val());
claid = fieldId.substring(9);
} else {
if (fieldId.startsWith("lemma")) {
$("form #lemma_forma").val($("#" + fieldId).val());
claid = fieldId.substring(11);
} else {
if (fieldId.startsWith("opzioni")) {
$("form #opzioni_testo").val($("#" + fieldId).val());
claid = fieldId.substring(13);
}
}
}
refreshClaList(claid);
}); });
// Evento: click sull'icona rimuovi clausola // Evento: click sull'icona rimuovi clausola
@ -797,6 +816,39 @@ $(document).ready(function() {
$('#cla' + tabID + " #queryTextN").attr("id", "queryText" + tabID); $('#cla' + tabID + " #queryTextN").attr("id", "queryText" + tabID);
$('#cla' + tabID + " #opzioni_testoN").attr("id", "opzioni_testo" + tabID); $('#cla' + tabID + " #opzioni_testoN").attr("id", "opzioni_testo" + tabID);
$('#cla' + tabID + " #contextDivN").attr("id", "contextDiv" + 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
$('#queryText').val(query);
$('#lemma_forma').val(lemma_forma);
$('#opzioni_testo').val(opzioni);
$('#queryTextN').val(query);
$('#lemma_formaN').val(lemma_forma);
$('#opzioni_testoN').val(opzioni);
addClaContext(tabID); addClaContext(tabID);
} }
@ -926,11 +978,11 @@ $(document).ready(function() {
claClone.setAttribute("aria-labelledby", "cla" + tabID + "-tab"); claClone.setAttribute("aria-labelledby", "cla" + tabID + "-tab");
claClone.setAttribute("style", ""); claClone.setAttribute("style", "");
$('#claBody' + tabID).append(claClone); $('#claBody' + tabID).append(claClone);
//$('#cla' + tabID + " #lemma_formaN").attr("id","lemma_forma" + tabID); $('#cla' + tabID + " #lemma_formaN").attr("id", "lemma_forma" + tabID);
//$('#cla' + tabID + " #queryTextN").attr("id","queryText" + tabID); $('#cla' + tabID + " #queryTextN").attr("id", "queryText" + tabID);
//$('#cla' + tabID + " #opzioni_testoN").attr("id","opzioni_testo" + tabID); $('#cla' + tabID + " #opzioni_testoN").attr("id", "opzioni_testo" + tabID);
// $('#cla' + tabID + " #contextDivN").attr("id","contextDiv" + tabID); $('#cla' + tabID + " #contextDivN").attr("id", "contextDiv" + tabID);
// addClaContext(tabID); addClaContext(tabID);
} }
// Funzione di creazione del tab delle clausole metafore // Funzione di creazione del tab delle clausole metafore
@ -1019,11 +1071,11 @@ $(document).ready(function() {
}; };
// Funzione di refresh della lista clausole nella tab principale e del json della query // Funzione di refresh della lista clausole nella tab principale e del json della query
function refreshClaList(){ function refreshClaList(editCard = 9999) {
/*var l_f = $("form #lemma_forma")[0].options[$("form #lemma_forma")[0].selectedIndex].value; var l_f = $("form #lemma_forma")[0].options[$("form #lemma_forma")[0].selectedIndex].value;
var qText = $("form #queryText")[0].value; var qText = $("form #queryText")[0].value;
var optText = $("form #opzioni_testo")[0].value;*/ var optText = $("form #opzioni_testo")[0].value;
var l_f = ""; /*var l_f = "";
var qText = ""; var qText = "";
var optText = ""; var optText = "";
var unitaDiRicerca = $("#unitaRicerca")[0].options[$("#unitaRicerca")[0].selectedIndex].value; var unitaDiRicerca = $("#unitaRicerca")[0].options[$("#unitaRicerca")[0].selectedIndex].value;
@ -1032,10 +1084,10 @@ $(document).ready(function() {
qText = $("#queryTextUnita")[0].value; qText = $("#queryTextUnita")[0].value;
optText = $("#opzioni_testoUnita")[0].value; optText = $("#opzioni_testoUnita")[0].value;
} else { } else {
l_f = $("#lemma_formaN")[0].options[$("#lemma_formaN")[0].selectedIndex].value; l_f = $("#lemma_formaINIT")[0].options[$("#lemma_formaINIT")[0].selectedIndex].value;
qText = $("#queryTextN")[0].value; qText = $("#queryTextINIT")[0].value;
optText = $("#opzioni_testoN")[0].value; optText = $("#opzioni_testoINIT")[0].value;
} }*/
if (qText == "") { //disattivo clausola 0 se il testo e' vuoto if (qText == "") { //disattivo clausola 0 se il testo e' vuoto
var claActive = 0 var claActive = 0
@ -1052,7 +1104,7 @@ $(document).ready(function() {
}; };
$(tabsContent).each(function() { $(tabsContent).each(function() {
var claIdNum = $(this).attr('id').substr(6); var claIdNum = $(this).attr('id').substr(6);
updateClaListItem(claIdNum, "#sortable0"); updateClaListItem(claIdNum, "#sortable0", editCard);
}); });
} else { } else {
if (claListLen == 0 && condListLen == 0) { if (claListLen == 0 && condListLen == 0) {
@ -1072,7 +1124,7 @@ $(document).ready(function() {
} }
// Funzione di creazione del LI nella lista delle clausole nel tab principale, aggiunta della clausola nel JSON // Funzione di creazione del LI nella lista delle clausole nel tab principale, aggiunta della clausola nel JSON
function updateClaListItem(claIdNum, sortableId){ function updateClaListItem(claIdNum, sortableId, editCard) {
var claText = ''; var claText = '';
var termText = ''; var termText = '';
var checkInsert = ''; var checkInsert = '';
@ -1090,7 +1142,9 @@ $(document).ready(function() {
var optText = ""; var optText = "";
var optText_t = ""; var optText_t = "";
var articolo = "Il "; 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 (unitaDiRicerca == "lemma" || unitaDiRicerca == "forma") { if (unitaDiRicerca == "lemma" || unitaDiRicerca == "forma") {
l_f = unitaDiRicerca; l_f = unitaDiRicerca;
if (l_f == "forma") { if (l_f == "forma") {
@ -1107,6 +1161,14 @@ $(document).ready(function() {
optText = $("#opzioni_testoN")[0].value; optText = $("#opzioni_testoN")[0].value;
optText_t = $("#opzioni_testoN")[0].options[$("#opzioni_testoN")[0].selectedIndex].text; optText_t = $("#opzioni_testoN")[0].options[$("#opzioni_testoN")[0].selectedIndex].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;
qText = $("#queryText" + editCard)[0].value;
optText = $("#opzioni_testo" + editCard)[0].value;
optText_t = $("#opzioni_testo" + editCard)[0].options[$("#opzioni_testo" + editCard)[0].selectedIndex].text;
}
if (qText != "") { if (qText != "") {
termText = l_f_t + ' <span class="text-dark font-weight-bold">' + qText + '</span> ' + optText_t + '.<br>'; termText = l_f_t + ' <span class="text-dark font-weight-bold">' + qText + '</span> ' + optText_t + '.<br>';
}; };
@ -1149,8 +1211,15 @@ $(document).ready(function() {
checkInsert = ' disabled'; checkInsert = ' disabled';
var jsonTextToParse = '{"queryText": "", "lemma_forma": "", "opzioni_testo": "", "TipoClausola": "' + claType + '", "Attiva": "' + claActive + '"'; var jsonTextToParse = '{"queryText": "", "lemma_forma": "", "opzioni_testo": "", "TipoClausola": "' + claType + '", "Attiva": "' + claActive + '"';
}; };
// nik controllare in quale caso si verifica "else"
var tabsContentLenght = ($("#sortable0").find(".claLI").length);
if ($("#" + claListItemId)[0]) { if ($("#" + claListItemId)[0]) {
if (claListItemId == "li-cla" + tabsContentLenght && editCard == 9999) {
$("#" + claListItemId + " .clatext").replaceWith('<span class="small clatext">' + claText + '</span>'); $("#" + claListItemId + " .clatext").replaceWith('<span class="small clatext">' + claText + '</span>');
} else {
$("#" + "li-cla" + editCard + " .clatext").replaceWith('<span class="small clatext">' + claText + '</span>');
}
} else { } else {
addLIitem(sortableId, claIdNum, claText, checkInsert, 0); addLIitem(sortableId, claIdNum, claText, checkInsert, 0);
}; };
@ -1415,13 +1484,13 @@ $(document).ready(function() {
case "Grammaticale": case "Grammaticale":
selectedValue = queryJson["Clausola" + itm].typeGramm0; selectedValue = queryJson["Clausola" + itm].typeGramm0;
addGramCla($(this)[1], active, tabID, 0); addGramCla($(this)[1], active, tabID, 0);
$("#lemma_formaN").val(queryJson["Clausola" + itm].lemma_forma); $("#lemma_formaINIT").val(queryJson["Clausola" + itm].lemma_forma);
$("#queryTextN").val(queryJson["Clausola" + itm].queryText); $("#queryTexINIT").val(queryJson["Clausola" + itm].queryText);
$("#opzioni_testoN").val(queryJson["Clausola" + itm].opzioni_testo); $("#opzioni_testoINIT").val(queryJson["Clausola" + itm].opzioni_testo);
/*$("#lemma_forma" + tabID).val(queryJson["Clausola" + itm].lemma_forma); $("#lemma_forma" + tabID).val(queryJson["Clausola" + itm].lemma_forma);
$("#queryText" + tabID).val(queryJson["Clausola" + itm].queryText); $("#queryText" + tabID).val(queryJson["Clausola" + itm].queryText);
$("#opzioni_testo" + tabID).val(queryJson["Clausola" + itm].opzioni_testo); $("#opzioni_testo" + tabID).val(queryJson["Clausola" + itm].opzioni_testo);
*/
if (selectedValue != "all") { if (selectedValue != "all") {
$("#grammtypes" + tabID).val(selectedValue); $("#grammtypes" + tabID).val(selectedValue);
@ -1447,13 +1516,13 @@ $(document).ready(function() {
break; break;
case "Sintattico": case "Sintattico":
addSyntCla($(this)[1], active, tabID, 0); addSyntCla($(this)[1], active, tabID, 0);
$("#lemma_formaN").val(queryJson["Clausola" + itm].lemma_forma); $("#lemma_formaINIT").val(queryJson["Clausola" + itm].lemma_forma);
$("#queryTextN").val(queryJson["Clausola" + itm].queryText); $("#queryTextINIT").val(queryJson["Clausola" + itm].queryText);
$("#opzioni_testoN").val(queryJson["Clausola" + itm].opzioni_testo); $("#opzioni_testoINIT").val(queryJson["Clausola" + itm].opzioni_testo);
/*$("#lemma_forma" + tabID).val(queryJson["Clausola" + itm].lemma_forma); $("#lemma_forma" + tabID).val(queryJson["Clausola" + itm].lemma_forma);
$("#queryText" + tabID).val(queryJson["Clausola" + itm].queryText); $("#queryText" + tabID).val(queryJson["Clausola" + itm].queryText);
$("#opzioni_testo" + tabID).val(queryJson["Clausola" + itm].opzioni_testo); $("#opzioni_testo" + tabID).val(queryJson["Clausola" + itm].opzioni_testo);
*/
if (queryJson["Clausola" + itm].typeSyntax0 != ".+") { if (queryJson["Clausola" + itm].typeSyntax0 != ".+") {
$("#cla" + tabID + " #synttypes").val(queryJson["Clausola" + itm].typeSyntax0); $("#cla" + tabID + " #synttypes").val(queryJson["Clausola" + itm].typeSyntax0);
@ -1650,7 +1719,8 @@ $(document).ready(function() {
}; };
$('#bgImg').replaceWith(bgImgEl); $('#bgImg').replaceWith(bgImgEl);
drawMinimap(currentMinimap, false, 0); drawMinimap(currentMinimap, false, 0);
Cookies.set('LiDa_style', newStyle); }; Cookies.set('LiDa_style', newStyle);
};
}; };