gestione risultati riferimenti, in progress
This commit is contained in:
parent
fad6685656
commit
739d7a5262
|
@ -1,7 +1,7 @@
|
|||
/**
|
||||
*
|
||||
*/
|
||||
import { getVersiConCitazioni, queryRiferimenti, getListaRis, cleanListaRis, getRisultatiRiferimenti, getListaIdCommenti, queryRiferimentimul } from './dataMgr_5.1.js';
|
||||
import { getVersiConCitazioni, queryRiferimenti, getListaRis, cleanListaRis, getRisultatiRiferimenti, getListaIdCommenti, queryRiferimentimul, versoCommentato } from './dataMgr_5.1.js';
|
||||
import { getJsonQuery, emptyStructCard, setCurrentPage, managePage } from './script_5.1.js';
|
||||
import { resetGraphStr } from './syntgraph_5.1.js'
|
||||
|
||||
|
@ -1721,8 +1721,7 @@ $(document).ready(function() {
|
|||
listaRisultatiCommenti = await queryRiferimentimul(jsonQuery, cantoDisplayed)
|
||||
}
|
||||
//carico i commenti risultato della query
|
||||
//var tmpresu=getRisultatiRiferimenti()
|
||||
//commentsSQL = Object.groupBy(tmpresu, ({ VersoCitazione }) => VersoCitazione);
|
||||
|
||||
showRisultatiCommenti(listaRisultatiCommenti)
|
||||
return
|
||||
}
|
||||
|
@ -1875,7 +1874,7 @@ $(document).ready(function() {
|
|||
commentoRisultato = uniq_res[j].replace('#','').split("_")
|
||||
risultato=uniq_res[j]
|
||||
|
||||
if (setVersicontesto.has(commentoRisultato[0]+'_'+commentoRisultato[2]+'_'+commentoRisultato[3]))
|
||||
if (setVersicontesto.has(commentoRisultato[0]+'_Canto_'+commentoRisultato[2]+'_'+commentoRisultato[3]+'_sp'))
|
||||
continue
|
||||
|
||||
var cre = getVersoContext(commentoRisultato, 3)
|
||||
|
@ -1898,7 +1897,7 @@ $(document).ready(function() {
|
|||
numeroCantica = forma.cantica
|
||||
canto = forma.canto
|
||||
}
|
||||
if (!setVersicontesto.has(forma.cantica+'_'+forma.canto+'_'+forma.verso)) {
|
||||
if (!setVersicontesto.has(forma.cantica+'_Canto_'+forma.canto+'_'+forma.verso+'_sp')) {
|
||||
divVerso = createDivVersoGenericLi(forma.cantica, forma.verso+'_res', 'Canto_'+forma.canto)
|
||||
elementoversospan = $('<span />')
|
||||
elementoversospan.attr('id', forma.cantica + "_" + 'Canto_'+forma.canto + "_" + forma.verso + '_sp_res')
|
||||
|
@ -1906,7 +1905,7 @@ $(document).ready(function() {
|
|||
versiIniziali.append(divVerso)
|
||||
listaVersi.append(versiIniziali)
|
||||
elencoRiferimenti.append(listaVersi)
|
||||
setVersicontesto.add(forma.cantica+'_'+forma.canto+'_'+forma.verso)
|
||||
setVersicontesto.add(forma.cantica+'_Canto_'+forma.canto+'_'+forma.verso+'_sp')
|
||||
numeroVersi++;
|
||||
}
|
||||
|
||||
|
@ -1933,24 +1932,6 @@ $(document).ready(function() {
|
|||
comandiGrp.attr('role', "group")
|
||||
|
||||
|
||||
//BOTTONE ESPANSIONE MODIFICARE
|
||||
/*var spanBadgeExpand = $('<button class="btn btn-sm btn-outline-primary espandiFrase px-1 pt-1 pb-0"/>');
|
||||
var expandIcon = '<ion-icon name="expand-outline"></ion-icon>';
|
||||
var spanBadgeReduce = $('<button class="btn btn-sm btn-outline-secondary riduciFrase px-1 pt-1 pb-0 ml-1 disabled"/>');
|
||||
var reduceIcon = '<ion-icon name="contract-outline"></ion-icon>';
|
||||
var ctxpivot=1
|
||||
|
||||
spanBadgeExpand.attr('id', commentoRisultato[0] + "Canto_ex_" + commentoRisultato[2] + "_" + ctxpivot + "_" + numeroRisultato);
|
||||
spanBadgeExpand.append(expandIcon);
|
||||
|
||||
spanBadgeReduce.attr('id', commentoRisultato[0] + "Canto_er_" + commentoRisultato[2] + "_" + ctxpivot + "_" + numeroRisultato);
|
||||
spanBadgeReduce.append(reduceIcon)
|
||||
|
||||
spanBadgeExpand.appendTo(comandiGrp);
|
||||
spanBadgeReduce.appendTo(comandiGrp);
|
||||
|
||||
comandiGrp.appendTo(comandi);*/
|
||||
|
||||
var citazioneDiv = $('<div class=" text-right flex-nowrap d-inline ml-3 px-3 py-0"/>')
|
||||
|
||||
var citazione = $('<span class= " pl-3 citazioneFrase align-text-top"/>')
|
||||
|
@ -1963,99 +1944,39 @@ $(document).ready(function() {
|
|||
|
||||
comandi.appendTo(elencoRiferimenti);
|
||||
|
||||
|
||||
|
||||
|
||||
/*var listaVersi = $('<ol class="pt-3" />')
|
||||
idFrase++;
|
||||
listaVersi.attr('id', "Frase" + idFrase);
|
||||
var versiFrase = $('<div class="versiFrase mt-3" />')
|
||||
versiFrase.attr('id', "versiFrase" + idFrase);
|
||||
cantica = commentoRisultato[0];
|
||||
canto = commentoRisultato[2];
|
||||
|
||||
cid = cantica + "Canto_" + canto
|
||||
var formeCanto;
|
||||
|
||||
switch (cantica) {
|
||||
case "Inferno":
|
||||
numCantica = 1;
|
||||
formeCanto = formeprima;
|
||||
break;
|
||||
case "Purgatorio":
|
||||
numCantica = 2;
|
||||
formeCanto = formeseconda;
|
||||
break;
|
||||
case "Paradiso":
|
||||
numCantica = 3
|
||||
formeCanto = formeterza;
|
||||
break;
|
||||
}
|
||||
|
||||
if (!(loadedCanti.has(cid))) {
|
||||
//loadCommentsBottons(cid,formeCanto, numCantica, canto)
|
||||
showCanto(formeCanto, numCantica, canto)
|
||||
loadedCanti.add(cid)
|
||||
}
|
||||
|
||||
verso = commentoRisultato[3];
|
||||
if (verso == "Proemio"){
|
||||
var proemio = $("#Titolo"+cantica + "Canto_" + canto ).clone()
|
||||
versiFrase.append("Proemio ")
|
||||
versiFrase.append(proemio)
|
||||
} else {
|
||||
verso = Number(verso);
|
||||
if (verso <= ultimoVersoPrecedente) {
|
||||
$("#" + cantica + '_Canto_' + canto + '_' + verso).addClass("mark ")
|
||||
continue;
|
||||
}
|
||||
$("#" + cantica + '_Canto_' + canto + '_' + verso).addClass("mark ")
|
||||
}
|
||||
|
||||
|
||||
for (var num = 0; num<versiPerGruppo; num++){
|
||||
var liVerso = $("#" + cantica + '_Canto_' + canto + '_' + verso).clone()
|
||||
versiFrase.append(liVerso)
|
||||
verso++
|
||||
}
|
||||
|
||||
ultimoVersoPrecedente = verso;
|
||||
|
||||
listaVersi.append(versiFrase)
|
||||
elencoRiferimenti.append(listaVersi)
|
||||
var citazioneDiv = $('<div class=" text-right flex-nowrap d-inline ml-3 px-3 py-0"/>')
|
||||
var citazione = $('<span class= " pl-3 citazioneFrase align-text-top"/>')
|
||||
|
||||
citazione.append("[" + cantica + ", Canto " + getRoman(canto) + "]")
|
||||
citazione.attr('name', cantica + "Canto " + canto);
|
||||
citazione.attr('id', idCitazione + '_' + numCantica + '_' + (verso-versiPerGruppo));
|
||||
citazione.appendTo(citazioneDiv);
|
||||
citazioneDiv.appendTo(elencoRiferimenti)*/
|
||||
|
||||
}
|
||||
|
||||
//ottimizzare
|
||||
// evidenzio i versi con almeno un risultato
|
||||
for (var tres of uniq_res){
|
||||
if (tres.includes('Proemio'))
|
||||
tres=tres.replace('Proemio','0')
|
||||
$('#' + tres+'_res').addClass("mark ")
|
||||
var tresa=tres.split('_')
|
||||
var tcantica='1'
|
||||
if (tresa[0]=='Purgatorio')
|
||||
tcantica='2'
|
||||
if (tresa[0]=='Paradiso')
|
||||
tcantica='3'
|
||||
var tverso= tresa[3]
|
||||
if (tverso=='0')
|
||||
tverso='Proemio'
|
||||
var idCommento = "CommentoRes_" + tcantica + "_" + tresa[2] + '_'+tverso;
|
||||
var pio = $("#" + idCommento )
|
||||
if (pio.length)
|
||||
continue;
|
||||
|
||||
var elverso = $("#" + tresa[0]+'_Canto_'+tresa[2] + '_'+tresa[3]+'_res')
|
||||
createCommentSpan(idCommento, elverso, 1)
|
||||
|
||||
}
|
||||
|
||||
//metto l'icona anche ai versi che hanno riferimenti ma che non sono nel resultset
|
||||
var versicontesto = [...setVersicontesto];
|
||||
for (var elverso of versicontesto){
|
||||
if (versoCommentato (elverso)){
|
||||
var tresa=elverso.split('_')
|
||||
var tcantica='1'
|
||||
if (tresa[0]=='Purgatorio')
|
||||
tcantica='2'
|
||||
if (tresa[0]=='Paradiso')
|
||||
tcantica='3'
|
||||
var tverso= tresa[3]
|
||||
var aidCommento = "CommentoRes_" + tcantica + "_" + tresa[2] + '_'+tverso;
|
||||
var apio = $("#" + aidCommento )
|
||||
if (apio.length)
|
||||
continue;
|
||||
var myverso = $('#'+elverso.replace('sp', 'res'))
|
||||
createCommentSpan(aidCommento, myverso, 1)
|
||||
}
|
||||
}
|
||||
/*var tmpresu=getRisultatiRiferimenti()
|
||||
commentsSQL = Object.groupBy(tmpresu, ({ VersoCitazione }) => VersoCitazione);*/
|
||||
drawMinimap('#vistaFrasi', false)
|
||||
showingComments = true;
|
||||
|
||||
|
|
|
@ -109,10 +109,19 @@ console.log('done')
|
|||
opzioniRiferimenti()
|
||||
|
||||
export function versoCommentato(rif) {
|
||||
return listaversicommentati.includes(rif);
|
||||
if (listaversicommentati.includes(rif)){
|
||||
var pars=rif.split('_')
|
||||
var tc=pars[2]
|
||||
if (tc.length==1)
|
||||
tc='0'+tc
|
||||
getCitazioniInVerso(pars[0], tc, pars[3])
|
||||
return true
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
export function getRisultatiRiferimenti() {
|
||||
listarisriferimenti=[... new Set(listarisriferimenti)]
|
||||
return listarisriferimenti;
|
||||
}
|
||||
export function getListaRis() {
|
||||
|
@ -173,6 +182,35 @@ export async function getVersiConCitazioni(canticapar = '', cantopar = '') {
|
|||
|
||||
}
|
||||
|
||||
async function getCitazioniInVerso(canticapar = '', cantopar = '', versovar='') {
|
||||
|
||||
//let citcantiche = ['Inferno', 'Purgatorio', 'Paradiso']
|
||||
if (canticapar == '') {
|
||||
return
|
||||
}
|
||||
const tconn = await db.connect();
|
||||
var table = await tconn.query(`
|
||||
select Ann as Annotazione, Com as Commentario, FrN as frammentoNota, AC as AutoreCitazione,
|
||||
F as FonteCitazione, LF as LuogoFonteCitazione, NF as NotaFonteCitazione,
|
||||
TF as TestoFonteCitazione, UF as URLFonteCitazione, NaRi as NaturaRiferimento,
|
||||
RCC as RapportoCommentoCommentatoreText, RSO as RapportoSoggettoOggetto,
|
||||
Aut as NomeAutoreCitazione, TiFo as TitoloFonteCitazione, Verso as VersoCitazione, CA as AreaTematica,
|
||||
TiCi as TipoCitazione, CEP as CitEpisodi, CIM as CitImmagini, CTE as CitTeorie,
|
||||
CMO as CitMotivi, CST as CitStilemi, CTO as CitTopografie, CPER as CitPersonaggi, IdRiferimento, n1, n2, n3
|
||||
from riferimenti
|
||||
where Cantica='${canticapar}' and Canto='${cantopar}' and Verso='${versovar}' order by n1, n2, n3;
|
||||
`);
|
||||
|
||||
var resultvc = table.toArray().map((row) => row.toJSON());
|
||||
|
||||
listarisriferimenti=listarisriferimenti.concat(resultvc)
|
||||
|
||||
|
||||
await tconn.close();
|
||||
return resultvc
|
||||
|
||||
}
|
||||
|
||||
|
||||
function getWhere(filtro) {
|
||||
if (filtro == null) {
|
||||
|
@ -235,9 +273,10 @@ function getWhere(filtro) {
|
|||
var oplog = ' and ('
|
||||
var tfi = filtroContesto(marray[0], 'Inferno', oplog)
|
||||
queryfi += tfi
|
||||
if (tfi.trim() != '')
|
||||
if (tfi.trim() != ''){
|
||||
infiltro = true
|
||||
oplog = ' or '
|
||||
oplog = ' or '
|
||||
}
|
||||
tfi = ''
|
||||
tfi = filtroContesto(marray[1], 'Purgatorio', oplog)
|
||||
if (tfi != '') {
|
||||
|
@ -448,9 +487,11 @@ export async function queryRiferimenti(filtro, cid) {
|
|||
var oplog = ' and ('
|
||||
var tfi = filtroContesto(marray[0], 'Inferno', oplog)
|
||||
queryfi += tfi
|
||||
if (tfi.trim() != '')
|
||||
if (tfi.trim() != ''){
|
||||
infiltro = true
|
||||
oplog = ' or '
|
||||
oplog = ' or '
|
||||
}
|
||||
|
||||
tfi = ''
|
||||
tfi = filtroContesto(marray[1], 'Purgatorio', oplog)
|
||||
if (tfi != '') {
|
||||
|
|
Loading…
Reference in New Issue