From 57b8bc5111a83b84d1500912f1b1ff3e62ab78bc Mon Sep 17 00:00:00 2001 From: cesare Date: Mon, 3 Feb 2025 11:25:31 +0100 Subject: [PATCH] test, menu creati da datamgr --- js/browseMgr_5.0.js | 3 +- js/dataMgr.js | 88 +++++++++++++++++++++++++++++++-------------- js/script_5.0.js | 15 ++++---- 3 files changed, 71 insertions(+), 35 deletions(-) diff --git a/js/browseMgr_5.0.js b/js/browseMgr_5.0.js index 7e668fc..ee7668a 100644 --- a/js/browseMgr_5.0.js +++ b/js/browseMgr_5.0.js @@ -1008,7 +1008,8 @@ $(document).ready(function() { } function createNoteEntry(comments, id, pos) { - var noteCard = $('
'); + var idref=comments.Id + var noteCard = $('
'); var collapseCardBody = $('
'); var divCampiSingoli = $('
'); diff --git a/js/dataMgr.js b/js/dataMgr.js index 64ec5dc..02da222 100644 --- a/js/dataMgr.js +++ b/js/dataMgr.js @@ -78,11 +78,14 @@ rif_fonti = result4.map((x) => x['TiFo']); await conn.close(); console.log('done') -export function getListaRis(){ + +opzioniRiferimenti() + +export function getListaRis() { return listaidversi; } -export function cleanListaRis(){ - listaidversi=[]; +export function cleanListaRis() { + listaidversi = []; } export function getFontiS() { @@ -135,16 +138,17 @@ export async function queryRiferimenti(filtro, cid) { return } console.log(filtro) - var contenuti_riferimento={'personaggio': " and CPER !='' and CPER !='no'", - 'episodio': " and CEP !='' and CEP !='no'", - 'motivo': " and CMO !='' and CMO !='no'", - 'immagine': " and CIM !='' and CIM !='no'", - 'teoria': " and CTE !='' and CTE !='no'", - 'stilema': " and CST !='' and CST !='no'", - 'topografia': " and CTO !='' and CTO !='no'" + var contenuti_riferimento = { + 'personaggio': " and CPER !='' and CPER !='no'", + 'episodio': " and CEP !='' and CEP !='no'", + 'motivo': " and CMO !='' and CMO !='no'", + 'immagine': " and CIM !='' and CIM !='no'", + 'teoria': " and CTE !='' and CTE !='no'", + 'stilema': " and CST !='' and CST !='no'", + 'topografia': " and CTO !='' and CTO !='no'" } const tconn = await db.connect(); - var querytl = 'select Cantica, Canto, Verso from riferimenti' + var querytl = 'select IdRiferimento, Cantica, Canto, Verso from riferimenti' var queryfi = ' where ' if (filtro.Commentatore != null && filtro.Commentatore.trim() != 'all') queryfi += "Com='" + filtro.Commentatore.trim() + "'" @@ -154,34 +158,35 @@ export async function queryRiferimenti(filtro, cid) { queryfi += " and Aut='" + filtro.Autore_Fonte.trim() + "'" if (filtro.Fonte != null && filtro.Fonte.trim() != 'all') queryfi += " and TiFo='" + filtro.Fonte.trim() + "'" - + if (filtro.Area_Tematica != null && filtro.Area_Tematica.trim() != 'all') queryfi += " and CA='" + filtro.Area_Tematica.trim() + "'" - + if (filtro.Tipo_Riferimento != null && filtro.Tipo_Riferimento.trim() != 'all') queryfi += " and NaRi='" + filtro.Tipo_Riferimento.trim().toUpperCase() + "'" - if( filtro.Contenuto_Riferimento!=null && filtro.Contenuto_Riferimento!='all') - queryfi+=contenuti_riferimento[filtro.Contenuto_Riferimento.trim()] + if (filtro.Contenuto_Riferimento != null && filtro.Contenuto_Riferimento != 'all') + queryfi += contenuti_riferimento[filtro.Contenuto_Riferimento.trim()] + + if (filtro.Rapporto_Testo_Fonte != null && filtro.Rapporto_Testo_Fonte != 'all') + queryfi += " and UPPER(RSO)=UPPER('" + filtro.Rapporto_Testo_Fonte.trim() + "')" + + if (filtro.Testo_Fonte != null && filtro.Testo_Fonte.trim() != '') + queryfi += " and TF like '%" + filtro.Testo_Fonte.trim() + "%'" + + if (filtro.Testo_Nota != null && filtro.Testo_Nota.trim() != '') + queryfi += " and Ann like '%" + filtro.Testo_Nota.trim() + "%'" - if( filtro.Rapporto_Testo_Fonte!=null && filtro.Rapporto_Testo_Fonte!='all') - queryfi+=" and UPPER(RSO)=UPPER('" + filtro.Rapporto_Testo_Fonte.trim() + "')" - - if( filtro.Testo_Fonte!=null && filtro.Testo_Fonte.trim()!='') - queryfi+=" and TF like '%" + filtro.Testo_Fonte.trim() + "%'" - - if( filtro.Testo_Nota!=null && filtro.Testo_Nota.trim()!='') - queryfi+=" and Ann like '%" + filtro.Testo_Nota.trim() + "%'" - var rs = await tconn.query(querytl + queryfi) var result4 = rs.toArray().map((row) => row.toJSON()); await tconn.close(); var resxcantica = Object.groupBy(result4, ({ Cantica }) => Cantica); - listaidversi=[] + listaidversi = [] var numcid = cid.split('_')[1] for (var cantica in resxcantica) { var $nctags = $(' .navig-canto') + console.log(resxcantica[cantica].length) var i = 1; if (cantica == 'Purgatorio') @@ -192,7 +197,8 @@ export async function queryRiferimenti(filtro, cid) { spanbadgecantica.attr('class', 'badge badge-warning badge-pill mx-2'); spanbadgecantica.append(resxcantica[cantica].length) spanbadgecantica.appendTo($('#cantica' + i + '-badge')) - console.log(spanbadgecantica) + + var tmp = resxcantica[cantica] var resxcanto = Object.groupBy(tmp, ({ Canto }) => Canto); for (var canto in resxcanto) { @@ -211,7 +217,7 @@ export async function queryRiferimenti(filtro, cid) { if (cid.includes(cantica) && numcid == canto) $(myveid).addClass("mark ") } - + } drawMinimap(cid, true) @@ -220,3 +226,31 @@ export async function queryRiferimenti(filtro, cid) { return listaidversi } + +function opzioniRiferimenti() { + $.each(rif_commentatori, function(i, p) { + if (!!p && p.length > 2) { + $('#Commentatore100').append($('') + .val(p).html(p)); + }; + }); + $.each(rif_fonti, function(i, p) { + if (!!p && p.length > 2) { + $('#Fonte100').append($('') + .val(p).html(p)); + }; + }); + $.each(rif_autori, function(i, p) { + if (!!p && p.length > 2) { + $('#Autore_Fonte100').append($('') + .val(p).html(p)); + }; + }); + $.each(rif_areetematiche, function(i, p) { + if (!!p && p.length > 2) { + $('#Area_Tematica100').append($('') + .val(p).html(p)); + }; + }); + +}; diff --git a/js/script_5.0.js b/js/script_5.0.js index 6f07832..acc6919 100644 --- a/js/script_5.0.js +++ b/js/script_5.0.js @@ -5,7 +5,7 @@ import {numeroContesti, resetResult} from './browseMgr_5.0.js' import { resetGraphStr } from './syntgraph_5.0.js'; -import { getAutoriFontiCitazioniS, getCommentatoriS, getAreeTematicheS, getFontiS} from './dataMgr.js'; +//import { getAutoriFontiCitazioniS, getCommentatoriS, getAreeTematicheS, getFontiS} from './dataMgr.js'; export var getJsonQuery; export var fillStructCard; @@ -687,10 +687,10 @@ $(document).ready(function() { const condLIplaceholderText2d = 'Trascina qui almeno 2 clausole o condizioni, oppure attiva le clausole inattive'; const condLIplaceholderPart1 = '
  • '; - const listaCommentatori = getCommentatoriS(); + /*const listaCommentatori = getCommentatoriS(); const listaAutoriFontiCitazioni = getAutoriFontiCitazioniS(); const listaAreeTematiche = getAreeTematicheS(); - const listaFonti = getFontiS(); + const listaFonti = getFontiS();*/ // Variabili e costanti funzionali- var minimapScrolling = false; @@ -723,11 +723,11 @@ $(document).ready(function() { // Funzione per popolare i menu delle opzioni di ricerca riferimenti $(document).ready(function() { - setTimeout(function() { fillOpzioniRiferimenti(); }, 400); + setTimeout(function() { fillOpzioniRiferimenti(); }, 100); }); function fillOpzioniRiferimenti() { - $.each(listaCommentatori, function (i, p) { + /*$.each(listaCommentatori, function (i, p) { if ( !!p && p.length > 2) { $('#Commentatore100').append($('') .val(p).html(p)); @@ -750,10 +750,11 @@ $(document).ready(function() { $('#Area_Tematica100').append($('') .val(p).html(p)); }; - }); + });*/ addClaContext(100); updateClaRifListItem(100,100); - }; + }; + // Funzioni di gestione del tab Periodo, usate da synthgraph.js