Risolto visualizzazione clausole selezionate

This commit is contained in:
nicola 2024-12-11 18:39:17 +01:00
parent 354fd674a7
commit 2d07be7177
2 changed files with 127 additions and 177 deletions

View File

@ -703,7 +703,7 @@
id="lemma_formaINIT"> 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="queryTextINIT" placeholder="inserisci un termine" id="queryTextINIT" placeholder="inserisci un termine"
@ -732,7 +732,7 @@
</div> </div>
<select <select
class="form-control custom-select custom-select-sm catgram monMe bg-light text-muted border btn-outline-success" class="form-control custom-select custom-select-sm catgram monMe bg-light text-muted border btn-outline-success"
name="typeGramm0" id="grammtypesN" name="typeGramm0" id="grammtypesN" data-claType="Grammaticale"
title="Categoria grammaticale" value="oggetto"> title="Categoria grammaticale" value="oggetto">
<option value="all">Categoria grammaticale</option> <option value="all">Categoria grammaticale</option>
<optgroup label="Volgare"> <optgroup label="Volgare">
@ -786,8 +786,7 @@
</div> </div>
<div <div
class="container form-group pl-3 pr-2 mb-0 pt-1 pb-0 dettaglifiltri" class="container form-group pl-3 pr-2 mb-0 pt-1 pb-0 dettaglifiltri"
id="dettagliGrammaticale"> id="dettagliGrammaticale"></div>
</div>
<!-- FINE GRAMMATICALE --> <!-- FINE GRAMMATICALE -->
<!-- TIPO SINTATTICO --> <!-- TIPO SINTATTICO -->
<div class="col-12 tab-pane px-0" id="tiposintatticoN" <div class="col-12 tab-pane px-0" id="tiposintatticoN"
@ -801,7 +800,7 @@
</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"
name="typeSyntax0" id="synttypes" name="typeSyntax0" id="synttypes" data-claType="Sintattico"
title="Tipo sintattico" value="oggetto"> title="Tipo sintattico" value="oggetto">
<option value=".+" class="w-10" <option value=".+" class="w-10"
onclick="myformsyntax.functionSyntax0.disabled = false;"> onclick="myformsyntax.functionSyntax0.disabled = false;">
@ -1424,7 +1423,7 @@
</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"
name="functionSyntax" id="syntfunc" name="functionSyntax" id="syntfunc" data-claType="Sintattico"
title="Livello di subordinazione"> title="Livello di subordinazione">
<option value=".+">Livello di subordinazione</option> <option value=".+">Livello di subordinazione</option>
@ -1535,7 +1534,7 @@
<span>&nbsp;</span> <span>&nbsp;</span>
</div> </div>
<div <div
class=" form-group form-inline input-group px-0 pt-1 pb-3 m-0" class=" form-group form-inline input-group px-0 pt-1 pb-1 m-0"
action=""> action="">
<div class="input-group-prepend"> <div class="input-group-prepend">
<label class="input-group-text"><ion-icon <label class="input-group-text"><ion-icon
@ -1552,21 +1551,34 @@
<option value="filtraStringente">Stilema</option> <option value="filtraStringente">Stilema</option>
<option value="filtraEsplicita">Topografia</option> <option value="filtraEsplicita">Topografia</option>
<option value="filtraEsplicita">Teoria</option> <option value="filtraEsplicita">Teoria</option>
</select> <span>&nbsp;</span> <select </select> <span>&nbsp;</span> <input type="text"
class="form-control custom-select custom-select-sm monMe bg-light text-muted border btn-outline-success" class="form-control form-control-sm monMe"
id="filtraRapportoTestoFonte"> id="filtraRiferimento" placeholder="Riferimento"
<option value="tipo">Rapporto testo/fonte:</option> aria-describedby="name-desc" name="query">
<option value="filtraConferma">Conferma</option> </div>
<option value="filtraContraddice">Contraddice</option> <div
<option value="filtraEstende">Estende</option> class=" form-group form-inline input-group px-0 pt-1 pb-2 m-0"
</select> action="">
</div> <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="filtraRapportoTestoFonte">
<option value="tipo">Rapporto testo/fonte:</option>
<option value="filtraConferma">Conferma</option>
<option value="filtraContraddice">Contraddice</option>
<option value="filtraEstende">Estende</option>
</select>
</div>
</div> </div>
</div> </div>
<div class=" well m-0 pb-2" id="contextDiv0" style="display: none;"> <div class=" well m-0 pb-2" id="contextDiv0"
style="display: none;">
<div id="contextTable-xX0" <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"> <div class="col-12 py-0 pl-1">
<span class=" align-bottom">Restringi il contesto <span class=" align-bottom">Restringi il contesto
di ricerca:</span> di ricerca:</span>

View File

@ -314,7 +314,7 @@ $(document).ready(function() {
}); });
// Evento: modifica di un campo clausole // Evento: modifica di un campo clausole
$("form #lemma_forma,#queryText,#opzioni_testo").on('change', function() { $("form #lemmaforma_,#queryText,#opzioni_testo").on('change', function() {
if ($(this)[0].id == "queryText") { if ($(this)[0].id == "queryText") {
var orgSelection = "forma" // $('#lemma_forma option:selected')[0].value var orgSelection = "forma" // $('#lemma_forma option:selected')[0].value
var qText = $(this)[0].value; var qText = $(this)[0].value;
@ -328,22 +328,9 @@ $(document).ready(function() {
$('#cla-TabContent').on('change', '.monMe', function() { $('#cla-TabContent').on('change', '.monMe', function() {
// Nik // Nik
var fieldId = $(this)[0].id; var fieldId = $(this)[0].id;
var claid = 9999; var ids = fieldId.split('_');
if (fieldId.startsWith("query")) { var claType = $("#" + fieldId+":parent").attr('data-claType');
$("form #queryText").val($("#" + fieldId).val()); refreshClaList(ids[1],claType);
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
@ -357,7 +344,7 @@ $(document).ready(function() {
thisIs.remove(); thisIs.remove();
delete queryJson["Clausola" + claIdNum]; delete queryJson["Clausola" + claIdNum];
delete window["context" + claIdNum]; delete window["context" + claIdNum];
refreshClaList(); refreshClaList(claIdNum);
refreshSortables(); refreshSortables();
}); });
}); });
@ -382,12 +369,14 @@ $(document).ready(function() {
addGramCla("#sortable0", 1, tabID, 1,1); addGramCla("#sortable0", 1, tabID, 1,1);
$('#collapseLogic').attr('style', "display: d-flex;"); $('#collapseLogic').attr('style', "display: d-flex;");
$("#unitaRicerca").prop('disabled',true); $("#unitaRicerca").prop('disabled',true);
refreshClaList(tabID);
}); });
$('#btnAddOr').on('click', function() { $('#btnAddOr').on('click', function() {
tabID++; tabID++;
addGramCla("#sortable0", 1, tabID, 1,2); addGramCla("#sortable0", 1, tabID, 1,2);
$('#collapseLogic').attr('style', "display: d-flex;"); $('#collapseLogic').attr('style', "display: d-flex;");
$("#unitaRicerca").prop('disabled',true); $("#unitaRicerca").prop('disabled',true);
refreshClaList(tabID);
}); });
// Evento: clausola spostata nella lista // Evento: clausola spostata nella lista
$('#sortable0').sortable({ $('#sortable0').sortable({
@ -445,7 +434,7 @@ $(document).ready(function() {
$('#rigaRicerca').on('click', '.trashClaCont', function() { $('#rigaRicerca').on('click', '.trashClaCont', function() {
var claIdNum = $(this)[0].id.substring(15); var claIdNum = $(this)[0].id.substring(15);
resetContext(claIdNum); resetContext(claIdNum);
refreshClaList(); refreshClaList(tabID);
}); });
// Evento: click sull'icona di add del contesto // Evento: click sull'icona di add del contesto
@ -463,7 +452,7 @@ $(document).ready(function() {
if ($(this).closest('.card').find('span:visible').length == 1) { if ($(this).closest('.card').find('span:visible').length == 1) {
$(this).closest('.card').find('div .sel-canti-intro').text("Selezionati tutti i canti."); $(this).closest('.card').find('div .sel-canti-intro').text("Selezionati tutti i canti.");
}; };
refreshClaList(); refreshClaList(claIdNum);
}); });
// Evento: click sull'icona di save local // Evento: click sull'icona di save local
@ -506,8 +495,10 @@ $(document).ready(function() {
$("#grammtypesN").on('change', function(e) { $("#grammtypesN").on('change', function(e) {
var selectedValue = $(this).val(); var selectedValue = $(this).val();
var tabPaneId = ($(this).closest('.tab-pane').attr("id")); var tabPaneId = ($(this).closest('.tab-pane').attr("id"));
var id = tabPaneId.replace("tipogrammaticale","cla"); var id = tabPaneId.replace("tipogrammaticale_","cla");
addCatgramSubcla(id, selectedValue); addCatgramSubcla(id, selectedValue);
//id = id.substr(3);
//refreshClaList(id);
}); });
// Evento: Submit form // Evento: Submit form
$("form").submit(function(e) { $("form").submit(function(e) {
@ -795,7 +786,7 @@ $(document).ready(function() {
var checkInsert = ''; var checkInsert = '';
}; };
var claText = ""; //Categoria grammaticale: <br>"; var claText = ""; // "Categoria grammaticale: <br>";
addLIitem(sortableId, tabID, claText, checkInsert, toExpand, cond); addLIitem(sortableId, tabID, claText, checkInsert, toExpand, cond);
var claClone = $("#grammaticaEsintassi").clone(true); var claClone = $("#grammaticaEsintassi").clone(true);
claClone.attr("id", "cla" + tabID); claClone.attr("id", "cla" + tabID);
@ -803,13 +794,15 @@ $(document).ready(function() {
claClone.attr("aria-labelledby", "cla" + tabID + "-tab"); claClone.attr("aria-labelledby", "cla" + tabID + "-tab");
claClone.attr("style", ""); claClone.attr("style", "");
$('#claBody' + tabID).append(claClone); $('#claBody' + tabID).append(claClone);
// se non cambio l'id della select react non rileva l'evento onchange: $('#cla' + tabID + " #grammtypesN").attr("id", "grammtypes_" + tabID);
$('#cla' + tabID + " #grammtypesN").attr("id", "grammtypes" + tabID); $('#cla' + tabID + " #lemma_formaINIT").attr("id", "lemmaforma_" + tabID);
$('#cla' + tabID + " #lemma_formaN").attr("id", "lemma_forma" + tabID); $('#cla' + tabID + " #queryTextINIT").attr("id", "queryText_" + tabID);
$('#cla' + tabID + " #queryTextN").attr("id", "queryText" + tabID); $('#cla' + tabID + " #opzioni_testoINIT").attr("id", "opzionitesto_" + tabID);
$('#cla' + tabID + " #opzioni_testoN").attr("id", "opzioni_testo" + tabID); $('#cla' + tabID + " #contextDivN").attr("id", "contextDiv_" + tabID);
$('#cla' + tabID + " #contextDivN").attr("id", "contextDiv" + tabID); $('#cla' + tabID + " #tipogrammaticaleN").attr("id","tipogrammaticale_" + tabID);
$('#cla' + tabID + " #tipogrammaticaleN").attr("id","tipogrammaticale" + tabID); $('#cla' + tabID + " #tiposintatticoN").attr("id","tiposintattico_" + tabID);
$('#cla' + tabID + " #synttypes").attr("id","synttypes_" + tabID);
$('#cla' + tabID + " #syntfunc").attr("id","syntfunc_" + tabID);
$("#contextDiv0").attr('style', "display: none"); $("#contextDiv0").attr('style', "display: none");
addClaContext(tabID); addClaContext(tabID);
@ -935,7 +928,7 @@ $(document).ready(function() {
contClone = contClone.replace(/sel-canto/g, "sel-canto suxess"); contClone = contClone.replace(/sel-canto/g, "sel-canto suxess");
$("#contextDiv" + tabID).append($(contClone)[0]); $("#contextDiv_" + tabID).append($(contClone)[0]);
resetContext(tabID); resetContext(tabID);
$("#selectable-xX" + tabID).selectable({ $("#selectable-xX" + tabID).selectable({
filter: ".sel-canto", filter: ".sel-canto",
@ -1004,23 +997,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(editCard = 9999) { function refreshClaList(editCard = 9999, claType) {
var l_f = $("#lemma_formaINIT").val();
var qText = $("#queryTextINIT").val(); var l_f = $("#lemmaforma_"+editCard).val();
var optText = $("#opzioni_testoINIT").val(); var qText = $("#queryText_"+editCard).val();
/*var l_f = ""; var optText = $("#opzionitesto_"+editCard).val();
var qText = "";
var optText = "";
var unitaDiRicerca = $("#unitaRicerca")[0].options[$("#unitaRicerca")[0].selectedIndex].value;
if (unitaDiRicerca == "lemma" || unitaDiRicerca == "forma") {
l_f = unitaDiRicerca;
qText = $("#queryTextUnita")[0].value;
optText = $("#opzioni_testoUnita")[0].value;
} else {
l_f = $("#lemma_formaINIT")[0].options[$("#lemma_formaINIT")[0].selectedIndex].value;
qText = $("#queryTextINIT")[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
@ -1037,7 +1018,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", editCard); updateClaListItem(claIdNum, "#sortable0",claType);
}); });
} else { } else {
if (claListLen == 0 && condListLen == 0) { if (claListLen == 0 && condListLen == 0) {
@ -1057,93 +1038,72 @@ $(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, editCard) { function updateClaListItem(claIdNum, sortableId, type) {
var claText = ''; var claText = '';
var termText = ''; var termText = '';
var checkInsert = ''; var checkInsert = '';
var claId = "cla" + claIdNum; var claId = "cla" + claIdNum;
var claListItemId = "li-cla" + claIdNum; var claListItemId = "li-cla" + claIdNum;
var claType = $("#" + claId).attr('data-claType'); var claType = type;//$("#" + claId).attr('data-claType');
var claActive = $("#" + claId).attr('data-claActive'); var claActive = $("#" + claId).attr('data-claActive');
var tabsContentLenght = ($("#sortable0").find(".claLI").length);
if (claActive > 0) { if (claActive > 0) {
checkInsert = ' checked="checked"'; checkInsert = ' checked="checked"';
}; };
var l_f = $("#lemmaforma_"+claIdNum).val();
var l_f_t = $("#lemmaforma_"+claIdNum+" option:selected").text();
var qText = $("#queryText_"+claIdNum).val();
var optText = $("#opzionitesto_"+claIdNum).val();
var optText_t = $("#opzionitesto_"+claIdNum+" option:selected").text();
var l_f = "";
var l_f_t = "";
var qText = "";
var optText = "";
var optText_t = "";
var articolo = "Il ";
//Nik verificare in cao di modifica delle clausola
//var unitaDiRicerca = $("#unitaRicerca")[0].options[$("#unitaRicerca")[0].selectedIndex].value;
if (editCard == 9999) {
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;
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 + '.';
}; };
var jsonTextToParse = '{"queryText": "' + qText + '", "lemma_forma": "' + l_f + '", "opzioni_testo": "' + optText + '", "TipoClausola": "' + claType + '", "Attiva": "' + claActive + '"'; var jsonTextToParse = '{"queryText": "' + qText + '", "lemma_forma": "' + l_f + '", "opzioni_testo": "' + optText + '", "TipoClausola": "' + claType + '", "Attiva": "' + claActive + '"';
var gramSelect = $("#" + claId).find(".catgram");
var contextText = $("#contextText-xX" + claIdNum).text();
switch (claType) { if (gramSelect[0].selectedIndex > 0){
case "Grammaticale": if(termText !=""){
var gramSelect = $("#" + claId).find(".catgram"); termText += "<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() {
var claSubParType = $(this)[0].type;
if (claSubParType == "fieldset" && $(this).find(":checked").length) {
var claSubParName = $(this).find(":checked")[0].name;
if (claSubParName.startsWith(claId)) {
claSubParName = claSubParName.replace(claId, '');
}
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;
jsonTextToParse = jsonTextToParse + ', "' + $(this)[0].name + '": "' + $(this)[0].options[$(this)[0].selectedIndex].value + '"';
};
});
claText = claText + '.<br>Contesto: ' + contextText;
break;
case "Sintattico":
var syntSelect = $("#" + claId).find("#synttypes");
var funcSelect = $("#" + claId).find("#syntfunc");
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 = $("#" + claListItemId + " .clatext").text();
checkInsert = ' disabled';
var jsonTextToParse = '{"queryText": "", "lemma_forma": "", "opzioni_testo": "", "TipoClausola": "' + claType + '", "Attiva": "' + claActive + '"';
};
// nik controllare in quale caso si verifica "else"
if ($("#" + claListItemId)[0]) {
if (claListItemId == "li-cla" + tabsContentLenght && editCard == 9999) {
$("#" + claListItemId + " .clatext").replaceWith('<span class="small clatext">' + claText + '</span>');
} else {
$("#" + "li-cla" + editCard + " .clatext").replaceWith('<span class="small clatext">' + claText + '</span>');
} }
claText = termText + "Categoria grammaticale: " + gramSelect[0].options[gramSelect[0].selectedIndex].text;
}else{
claText = termText;
}
jsonTextToParse = jsonTextToParse + ', "' + gramSelect.attr('name') + '": "' + gramSelect[0].options[gramSelect[0].selectedIndex].value + '"';
var claSubParList = $("#" + claId).children(".dettaglifiltri").find("select, fieldset");
claSubParList.each(function() {
var claSubParType = $(this)[0].type;
if (claSubParType == "fieldset" && $(this).find(":checked").length) {
var claSubParName = $(this).find(":checked")[0].name;
if (claSubParName.startsWith(claId)) {
claSubParName = claSubParName.replace(claId, '');
}
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;
jsonTextToParse = jsonTextToParse + ', "' + $(this)[0].name + '": "' + $(this)[0].options[$(this)[0].selectedIndex].value + '"';
};
});
var syntSelect = $("#synttypes_"+claIdNum).find(":selected").text();
var funcSelect = $("#syntfunc_"+claIdNum).find(":selected").text();
if(!syntSelect.startsWith("\n\t")){
claText = claText+"<br>Tipo sintattico: " + syntSelect;
} else {
if (!funcSelect.startsWith("Livello di subordinazione")) {
claText = claText + "<br>Qualsiasi tipo sintattico: ";
}
}
if(!funcSelect.startsWith("Livello di subordinazione")){
claText = claText+"<br>Livello di subordinazione: " + funcSelect;
}
claText = claText + '.<br>Contesto: ' + contextText;
if ($("#" + claListItemId)[0]) {
$("#" + claListItemId + " .clatext").replaceWith('<span class="small clatext">' + claText + '</span>');
} else { } else {
addLIitem(sortableId, claIdNum, claText, checkInsert, 0); addLIitem(sortableId, claIdNum, claText, checkInsert, 0);
}; };
@ -1354,8 +1314,8 @@ $(document).ready(function() {
}; };
// Rigenerazione Clausola0: // Rigenerazione Clausola0:
if (queryJson["Clausola0"].Attiva) { if (queryJson["Clausola0"].Attiva) {
$("#queryText").val(queryJson["Clausola0"].queryText); $("#queryText_").val(queryJson["Clausola0"].queryText);
$("#opzioni_testo").val(queryJson["Clausola0"].opzioni_testo); $("#opzionitesto_").val(queryJson["Clausola0"].opzioni_testo);
var qText = queryJson["Clausola0"].queryText; var qText = queryJson["Clausola0"].queryText;
if (qText !== null && qText !== '') { qText = ' "' + qText + '"'; } if (qText !== null && qText !== '') { qText = ' "' + qText + '"'; }
setLemmaForma(qText, queryJson["Clausola0"].lemma_forma); setLemmaForma(qText, queryJson["Clausola0"].lemma_forma);
@ -1411,13 +1371,13 @@ $(document).ready(function() {
$("#lemma_formaINIT").val(queryJson["Clausola" + itm].lemma_forma); $("#lemma_formaINIT").val(queryJson["Clausola" + itm].lemma_forma);
$("#queryTexINIT").val(queryJson["Clausola" + itm].queryText); $("#queryTexINIT").val(queryJson["Clausola" + itm].queryText);
$("#opzioni_testoINIT").val(queryJson["Clausola" + itm].opzioni_testo); $("#opzioni_testoINIT").val(queryJson["Clausola" + itm].opzioni_testo);
$("#lemma_forma" + tabID).val(queryJson["Clausola" + itm].lemma_forma); $("#lemmaforma_" + 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); $("#opzionitesto_" + tabID).val(queryJson["Clausola" + itm].opzioni_testo);
if (selectedValue != "all") { if (selectedValue != "all") {
$("#grammtypes" + tabID).val(selectedValue); $("#grammtypes_" + tabID).val(selectedValue);
addCatgramSubcla("cla" + tabID, selectedValue); addCatgramSubcla("cla" + tabID, selectedValue);
var ks = Object.keys(queryJson["Clausola" + itm]); var ks = Object.keys(queryJson["Clausola" + itm]);
for (var j = 6; j < ks.length - 1; j++) { for (var j = 6; j < ks.length - 1; j++) {
@ -1438,50 +1398,28 @@ $(document).ready(function() {
window["context" + tabID] = JSON.parse(queryJson["Clausola" + itm].contesto); window["context" + tabID] = JSON.parse(queryJson["Clausola" + itm].contesto);
parseContext(tabID); parseContext(tabID);
break; break;
case "Sintattico":
addSyntCla($(this)[1], active, tabID, 0);
$("#lemma_formaINIT").val(queryJson["Clausola" + itm].lemma_forma);
$("#queryTextINIT").val(queryJson["Clausola" + itm].queryText);
$("#opzioni_testoINIT").val(queryJson["Clausola" + itm].opzioni_testo);
$("#lemma_forma" + tabID).val(queryJson["Clausola" + itm].lemma_forma);
$("#queryText" + tabID).val(queryJson["Clausola" + itm].queryText);
$("#opzioni_testo" + tabID).val(queryJson["Clausola" + itm].opzioni_testo);
if (queryJson["Clausola" + itm].typeSyntax0 != ".+") {
$("#cla" + tabID + " #synttypes").val(queryJson["Clausola" + itm].typeSyntax0);
}
if (queryJson["Clausola" + itm].functionSyntax != ".+") {
$("#cla" + tabID + " #syntfunc").val(queryJson["Clausola" + itm].functionSyntax);
}
window["context" + tabID] = JSON.parse(queryJson["Clausola" + itm].contesto);
parseContext(tabID);
break;
case "Metafora":
addMetaCla($(this)[1], active, tabID, 0);
break;
default: default:
}; };
}; };
}); });
refreshClaList(); refreshClaList(tabID);
refreshSortables(); refreshSortables();
}; };
function resetSimpleGui() { function resetSimpleGui() {
$('#queryText').val(""); $('#queryText_').val("");
setLemmaForma("", "forma"); setLemmaForma("", "forma");
$('#opzioni_testo').val("parola"); $('#opzionitesto_').val("parola");
resetContext(0); resetContext(0);
}; };
function setLemmaForma(qText, newSelection) { function setLemmaForma(qText, newSelection) {
var newOptions = { ['La forma' + qText]: 'forma', ['Il lemma' + qText]: 'lemma', ['Il testo' + qText]: 'testo' }; var newOptions = { ['La forma' + qText]: 'forma', ['Il lemma' + qText]: 'lemma', ['Il testo' + qText]: 'testo' };
$("#lemma_forma").empty(); $("#lemmaforma_").empty();
$.each(newOptions, function(key, value) { $.each(newOptions, function(key, value) {
$("#lemma_forma").append($("<option></option>").attr("value", value).text(key)); $("#lemmaforma_").append($("<option></option>").attr("value", value).text(key));
}); });
$("#lemma_forma").val(newSelection); $("#lemmaforma_").val(newSelection);
}; };
function resetContext(claIdNum) { function resetContext(claIdNum) {