|
@@ -1,207 +0,0 @@
|
|
|
-
|
|
|
-// Oggetto che raccoglie le info necessarie per la pagina
|
|
|
-pageInfo = {};
|
|
|
-
|
|
|
-// Inizializzazione della pagina
|
|
|
-initPage();
|
|
|
-
|
|
|
-
|
|
|
-// Def. funzione di inizializzazione
|
|
|
-async function initPage(){
|
|
|
- pageInfo = await getPageInfo();
|
|
|
- updatePage();
|
|
|
-}
|
|
|
-
|
|
|
-// Esegue le queries, restituisce un oggetto con tutte le info per completare la pagina
|
|
|
-async function getPageInfo(){
|
|
|
- var out = {};
|
|
|
-
|
|
|
- try{
|
|
|
- out.query1 = await doJsonQuery(query1, true);
|
|
|
- out.query2 = await doJsonQuery(query2, true);
|
|
|
- out.titolo = await doJsonQuery(queryTitolo, true);
|
|
|
- out.segnatura = await doJsonQuery(querySegnatura, true);
|
|
|
- out.sigla = await doJsonQuery(querySiglaOVI, true);
|
|
|
- out.areaLinguistica = await doJsonQuery(queryAreaLinguistica, true);
|
|
|
- out.descrizione = await doJsonQuery(queryDescrizione, true);
|
|
|
- out.testo = await doJsonQuery(queryTestoLemmatizzato, true);
|
|
|
- out.edizione = await doJsonQuery(queryEdizione, true);
|
|
|
- out.toponimi = await doJsonQuery(queryToponimi);
|
|
|
- out.antroponimi = await doJsonQuery(queryAntroponimi);
|
|
|
-
|
|
|
- // out.tipo = await doJsonQuery(queryTipo);
|
|
|
- // out.siglaOVI = await doJsonQuery(querySiglaOVI);
|
|
|
- // out.raccolta = await doJsonQuery(queryRaccolta);
|
|
|
- } catch(err){
|
|
|
- console.log(err);
|
|
|
- }
|
|
|
-
|
|
|
- console.log('out', out)
|
|
|
- return out;
|
|
|
-}
|
|
|
-
|
|
|
-
|
|
|
-// Aggiorna la pagina usando l'oggetto-info passato come parametro
|
|
|
-function updatePage(){
|
|
|
-
|
|
|
- if(pageInfo.titolo) document.getElementById("title").innerHTML = pageInfo.titolo.titolo.value;
|
|
|
-
|
|
|
- if(pageInfo.query1) {
|
|
|
- if(pageInfo.query1.hasOwnProperty('mittente')) document.getElementById("mittente_id").innerHTML = pageInfo.query1.mittente.value;
|
|
|
- if(pageInfo.query1.hasOwnProperty('destinatario')) document.getElementById("destinatario_id").innerHTML = pageInfo.query1.destinatario.value;
|
|
|
- if(pageInfo.query1.hasOwnProperty('luogo_partenza')) document.getElementById("luogo_partenza_id").innerHTML = pageInfo.query1.luogo_partenza.value;
|
|
|
- if(pageInfo.query1.hasOwnProperty('uriLuogoPartenza')) document.getElementById("luogo_partenza_btn").innerHTML = createButton("fa fa-map", "Vedi mappa", "schedaMappa('LUOGO')".replace("LUOGO", pageInfo.query1.uriLuogoPartenza.value));
|
|
|
- if(pageInfo.query1.hasOwnProperty('luogo_arrivo')) document.getElementById("luogo_arrivo_id").innerHTML = pageInfo.query1.luogo_arrivo.value;
|
|
|
- if(pageInfo.query1.hasOwnProperty('uriLuogoArrivo')) document.getElementById("luogo_arrivo_btn").innerHTML = createButton("fa fa-map", "Vedi mappa", "schedaMappa('LUOGO')".replace("LUOGO", pageInfo.query1.uriLuogoArrivo.value));
|
|
|
- if(pageInfo.query1.hasOwnProperty('data_partenza')) document.getElementById("data_partenza_id").innerHTML = pageInfo.query1.data_partenza.value;
|
|
|
- if(pageInfo.query1.hasOwnProperty('data_arrivo')) document.getElementById("data_arrivo_id").innerHTML = pageInfo.query1.data_arrivo.value;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
- /*if(pageInfo.query1){
|
|
|
- document.getElementById("mittente_id").innerHTML = pageInfo.query1.mittente.value;
|
|
|
- //document.getElementById("mittente_btn").innerHTML = createButton("fa fa-user", "Scheda persona", "schedaPersona('PERS')".replace("PERS", pageInfo.query1.mittente.value));
|
|
|
- }
|
|
|
- if(pageInfo.query1){
|
|
|
- document.getElementById("destinatario_id").innerHTML = pageInfo.query1.destinatario.value;
|
|
|
- //document.getElementById("destinatario_btn").innerHTML = createButton("fa fa-user", "Scheda persona", "schedaPersona('PERS')".replace("PERS", pageInfo.query1.destinatario.value));
|
|
|
- }
|
|
|
- if(pageInfo.query1){
|
|
|
- document.getElementById("imageASPO").innerHTML = createEmbed(pageInfo.query1.subject.value);
|
|
|
- }
|
|
|
- if(pageInfo.query1){
|
|
|
- document.getElementById("luogo_partenza_id").innerHTML = pageInfo.query1.luogo_partenza.value;
|
|
|
- document.getElementById("luogo_partenza_btn").innerHTML = createButton("fa fa-map", "Vedi mappa", "schedaMappa('LUOGO')".replace("LUOGO", pageInfo.query1.uriLuogoPartenza.value));
|
|
|
- }
|
|
|
- if(pageInfo.query1){
|
|
|
- document.getElementById("luogo_arrivo_id").innerHTML = pageInfo.query1.luogo_arrivo.value;
|
|
|
- document.getElementById("luogo_arrivo_btn").innerHTML = createButton("fa fa-map", "Vedi mappa", "schedaMappa('LUOGO')".replace("LUOGO", pageInfo.query1.uriLuogoArrivo.value));
|
|
|
- }
|
|
|
- if(pageInfo.query1) document.getElementById("data_partenza_id").innerHTML = pageInfo.query1.data_partenza.value;
|
|
|
- if(pageInfo.query1) document.getElementById("data_arrivo_id").innerHTML = pageInfo.query1.data_arrivo.value;
|
|
|
- */
|
|
|
- if(pageInfo.descrizione) document.getElementById("descrizione_id").innerHTML = pageInfo.descrizione.descrizione.value;
|
|
|
- if(pageInfo.areaLinguistica) document.getElementById("lingua_id").innerHTML = pageInfo.areaLinguistica.lingua.value;
|
|
|
- if(pageInfo.areaLinguistica) document.getElementById("area_linguistica_id").innerHTML = pageInfo.areaLinguistica.area_linguistica.value;
|
|
|
- if(pageInfo.sigla) document.getElementById("sigla_OVI").innerHTML = pageInfo.sigla.sigla_OVI.value;
|
|
|
- if(pageInfo.segnatura){
|
|
|
- document.getElementById("segnatura_id").innerHTML = pageInfo.segnatura.segnatura_OVI.value;
|
|
|
- document.getElementById("segnatura_btn").innerHTML = createButton("fa fa-link", "Link ASPO", "schedaASPO('SEGN')".replace("SEGN", thisUrlParams.link));
|
|
|
- }
|
|
|
- if(pageInfo.edizione){
|
|
|
- document.getElementById("edizione_id").innerHTML = pageInfo.edizione.edizione.value;
|
|
|
- document.getElementById("edizione_btn").innerHTML = createButton("fa fa-comments", "Cita Edizione", "schedaEdizione('EDIZ')".replace("EDIZ", pageInfo.edizione.edizione.value));
|
|
|
- }
|
|
|
- if(pageInfo.testo) document.getElementById("trascrizione_id").innerHTML = pageInfo.testo.testo_lemmatizzato.value;
|
|
|
- //
|
|
|
- if(pageInfo.antroponimi && pageInfo.antroponimi.length){
|
|
|
- const listaAntroponimi = pageInfo.antroponimi.map(elem => elem.antroponimo.value);
|
|
|
- document.getElementById("antroponimi").innerHTML = formatListAsLi(listaAntroponimi);
|
|
|
- }
|
|
|
- if(pageInfo.toponimi && pageInfo.toponimi.length){
|
|
|
- const listaToponimi = pageInfo.toponimi.map(elem => elem.toponimo.value);
|
|
|
- document.getElementById("toponimi").innerHTML = formatListAsLi(listaToponimi);
|
|
|
- }
|
|
|
-
|
|
|
- if(pageInfo.query2) {
|
|
|
- if(pageInfo.query2.hasOwnProperty('mittente')) document.getElementById("mittente_id_ASPO").innerHTML = pageInfo.query2.mittente.value;
|
|
|
- if(pageInfo.query2.hasOwnProperty('uriSender')) document.getElementById("mittente_btn_ASPO").innerHTML = createButton("fa fa-user", "Scheda persona", "schedaPersona('PERS')".replace("PERS", pageInfo.query2.uriSender.value));
|
|
|
- if(pageInfo.query2.hasOwnProperty('destinatario')) document.getElementById("destinatario_id_ASPO").innerHTML = pageInfo.query2.destinatario.value;
|
|
|
- if(pageInfo.query2.hasOwnProperty('uriReceiver')) document.getElementById("destinatario_btn_ASPO").innerHTML = createButton("fa fa-user", "Scheda persona", "schedaPersona('PERS')".replace("PERS", pageInfo.query2.uriReceiver.value));
|
|
|
- if(pageInfo.query2.hasOwnProperty('placeSend')) document.getElementById("luogo_partenza_id_ASPO").innerHTML = pageInfo.query2.placeSend.value;
|
|
|
- if(pageInfo.query2.hasOwnProperty('placeReceive')) document.getElementById("luogo_arrivo_id_ASPO").innerHTML = pageInfo.query2.placeReceive.value;
|
|
|
- if(pageInfo.query2.hasOwnProperty('timeSpanSend')) document.getElementById("data_partenza_id_ASPO").innerHTML = pageInfo.query2.timeSpanSend.value;
|
|
|
- if(pageInfo.query2.hasOwnProperty('timeSpanReceive')) document.getElementById("data_arrivo_id_ASPO").innerHTML = pageInfo.query2.timeSpanReceive.value;
|
|
|
- if(pageInfo.query2.hasOwnProperty('material')) document.getElementById("consistenzaASPO").innerHTML = pageInfo.query2.material.value;
|
|
|
- if(pageInfo.query2.hasOwnProperty('dimension')) document.getElementById("dimensioneASPO").innerHTML = pageInfo.query2.dimension.value;
|
|
|
- if(pageInfo.query2.hasOwnProperty('identifier')) document.getElementById("segnatura_id_ASPO").innerHTML = pageInfo.query2.identifier.value;
|
|
|
- if(pageInfo.query2.hasOwnProperty('currentLocation')) document.getElementById("ownerASPO").innerHTML = pageInfo.query2.currentLocation.value;
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- if(pageInfo.sigla){
|
|
|
- document.getElementById("evt_button").innerHTML = createButtonEVT(pageInfo.sigla.sigla_OVI.value);
|
|
|
- }
|
|
|
-
|
|
|
- if(pageInfo.query1){
|
|
|
- document.getElementById("imageASPO").innerHTML = createEmbed(pageInfo.query1.subject.value);
|
|
|
- }
|
|
|
-}
|
|
|
-
|
|
|
-// Mini-utility per formattare liste
|
|
|
-function formatListAsLi(thisList){
|
|
|
- toRet = "";
|
|
|
- thisList.forEach(value => toRet += "<li>" + value + "</li>");
|
|
|
- return toRet;
|
|
|
-}
|
|
|
-
|
|
|
-// Buttons
|
|
|
-function createButton(buttonClass, text, onClickFunction){
|
|
|
- htmlCode = '\
|
|
|
- <button class="btn btn-default" type="button" onclick="<FUNCTION>">\
|
|
|
- <i class="<CLASS>" aria-hidden="true">\
|
|
|
- <p class="btn-text"><TEXT></p>\
|
|
|
- </i>\
|
|
|
- </button>\
|
|
|
- '.replace("<CLASS>", buttonClass).replace("<TEXT>", text).replace("<FUNCTION>", onClickFunction);
|
|
|
- return htmlCode;
|
|
|
-}
|
|
|
-
|
|
|
-function createButtonEVT(sigla){
|
|
|
- htmlCode = '\
|
|
|
- <button type="button" class="btn btn-secondary" onclick="loadPageEVT(\'<SIGLA>\')">\
|
|
|
- Button EVT</button>\
|
|
|
- '.replace("<SIGLA>", sigla);
|
|
|
- return htmlCode;
|
|
|
-}
|
|
|
-//<button type="button" class="btn btn-secondary" onclick="loadPageLOD()">Button LOD</button>
|
|
|
-
|
|
|
-function loadPageEVT(sigla)
|
|
|
-{
|
|
|
- window.location="http://restore.ovi.cnr.it/mockup/evt/#/imageText?p=" + sigla + "_01&el=diplomatic";
|
|
|
-}
|
|
|
-
|
|
|
-function createEmbed(link) {
|
|
|
- image = link.replace("scheda", "imageView") + "/#main";
|
|
|
- htmlCode = '\
|
|
|
- <embed id="imageEmb" src="<LINK>"> \
|
|
|
- '.replace("<LINK", image);
|
|
|
- return htmlCode;
|
|
|
-}
|
|
|
-
|
|
|
-function schedaPersona(info){
|
|
|
- window.open("Persona.html?link="+info);
|
|
|
-}
|
|
|
-
|
|
|
-function schedaMappa(info){
|
|
|
- window.open("Luogo.html?link="+info);
|
|
|
-}
|
|
|
-
|
|
|
-function schedaASPO(info){
|
|
|
- window.open(info);
|
|
|
-}
|
|
|
-
|
|
|
-function schedaEdizione(info){
|
|
|
- alert("Hi! I've been clicked.\n I've been passed: '" + info + "' as a paramater");
|
|
|
-}
|
|
|
-
|
|
|
-function show_OVI(){
|
|
|
- document.getElementById("OVI_info").style.display = "block";
|
|
|
- document.getElementById("ASPO_info").style.display = "none";
|
|
|
-}
|
|
|
-
|
|
|
-function show_ASPO(){
|
|
|
- document.getElementById("OVI_info").style.display = "none";
|
|
|
- document.getElementById("ASPO_info").style.display = "block";
|
|
|
-}
|
|
|
-
|
|
|
-var header = document.getElementById("choice_buttons");
|
|
|
-var btns = header.getElementsByClassName("btn");
|
|
|
-for (var i = 0; i < btns.length; i++) {
|
|
|
- btns[i].addEventListener("click", function() {
|
|
|
- var current = document.getElementsByClassName("active");
|
|
|
- current[0].className = current[0].className.replace(" active", "");
|
|
|
- this.className += " active";
|
|
|
- });
|
|
|
-}
|