|
@@ -0,0 +1,291 @@
|
|
|
+
|
|
|
+// 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.query = await doJsonQuery(queryLettere, true);
|
|
|
+
|
|
|
+ } 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.query) {
|
|
|
+ for (var i=0; i<pageInfo.query.length; i++) {
|
|
|
+ if(pageInfo.query[i].hasOwnProperty('uri_document')) {
|
|
|
+ alert("Here");
|
|
|
+ uri_document = pageInfo.query.uri_document.value;
|
|
|
+ }
|
|
|
+ var l = pageInfo.query[i].uri_document.value;
|
|
|
+ }
|
|
|
+ var uri_document = "";
|
|
|
+ var doc = "";
|
|
|
+ var time_span_from = "";
|
|
|
+ var time_span_to = "";
|
|
|
+ var uri_place_from = "";
|
|
|
+ var place_from = "";
|
|
|
+ var uri_place_to = "";
|
|
|
+ var place_to = "";
|
|
|
+ var EventsTable = "";
|
|
|
+
|
|
|
+
|
|
|
+ if(pageInfo.query.hasOwnProperty('document')) {
|
|
|
+ doc = pageInfo.query.document.value;
|
|
|
+ }
|
|
|
+ if(pageInfo.query.hasOwnProperty('time_span_from')) {
|
|
|
+ time_span_from = pageInfo.query.time_span_from.value;
|
|
|
+ }
|
|
|
+ if(pageInfo.query.hasOwnProperty('time_span_to')) {
|
|
|
+ time_span_to = pageInfo.query.time_span_to.value;
|
|
|
+ }
|
|
|
+ if(pageInfo.query.hasOwnProperty('uri_place_from')) {
|
|
|
+ uri_place_from = pageInfo.query.uri_place_from.value;
|
|
|
+ }
|
|
|
+ if(pageInfo.query.hasOwnProperty('place_from')) {
|
|
|
+ place_from = pageInfo.query.place_from.value;
|
|
|
+ }
|
|
|
+ if(pageInfo.query.hasOwnProperty('uri_place_to')) {
|
|
|
+ uri_place_to = pageInfo.query.uri_place_to.value;
|
|
|
+ }
|
|
|
+ if(pageInfo.query.hasOwnProperty('place_to')) {
|
|
|
+ place_to = pageInfo.query.place_to.value;
|
|
|
+ }
|
|
|
+
|
|
|
+ EventsTable += '<div class="row">' +
|
|
|
+ '<div class="col-2">' + doc + '</div>' +
|
|
|
+ '<div class="col-2">' + time_span_from + '</div>' +
|
|
|
+ '<div class="col-2">' + time_span_to + '</div>' +
|
|
|
+ '<div class="col-2">' + place_from + '</div>' +
|
|
|
+ '<div class="col-4">' + place_to + '</div>' +
|
|
|
+ '</div>';
|
|
|
+
|
|
|
+
|
|
|
+ document.getElementById("results_table").innerHTML = EventsTable;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /*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);
|
|
|
+ }*/
|
|
|
+}
|
|
|
+
|
|
|
+// 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){
|
|
|
+ $("#myModal").empty();
|
|
|
+ $("#myModal").css("display", "block");
|
|
|
+ $('#myModal').append("<div class='modal-content'><div class='modal-close'><span class='close'>×</span></div><div id='myInput'>" +
|
|
|
+ info + "</div><button id='copy_btn' class='btn btn-theme-primary btn-md' onclick='myFunction()'>Copia</button>");
|
|
|
+
|
|
|
+
|
|
|
+}
|
|
|
+
|
|
|
+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";
|
|
|
+}
|
|
|
+
|
|
|
+$(document).on("click", ".close", function (ev) {
|
|
|
+
|
|
|
+ var link = this.id;
|
|
|
+ //alert(nome_autore);
|
|
|
+ //$('#myModal').text("");
|
|
|
+ $("#myModal").css("display", "none");
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+$(document).on("click", ".hyp", function (ev) {
|
|
|
+
|
|
|
+ var baseurl = window.location.origin+window.location.pathname;
|
|
|
+ let slash = baseurl.lastIndexOf("/");
|
|
|
+ var type = $(this).val() + '.html';
|
|
|
+ var link = this.id;
|
|
|
+ var url = baseurl.substr(0, slash+1) + type + "?link="+link;
|
|
|
+ var link = this.id;
|
|
|
+ $("#myModal").empty();
|
|
|
+ $("#myModal").css("display", "block");
|
|
|
+ $('#myModal').append("<div class='modal-content'><div class='modal-close'><span class='close'>×</span></div><div id='myInput'>" +
|
|
|
+ url + "</div><button id='copy_btn' class='btn btn-theme-primary btn-md' onclick='myFunction()'>Copia</button>");
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+$(document).on("click", ".cit", function (ev) {
|
|
|
+
|
|
|
+ var author ="RESTORE. smart access to digital heritage and memory"
|
|
|
+
|
|
|
+ var year = new Date().getFullYear()
|
|
|
+
|
|
|
+ var today = new Date();
|
|
|
+ var dd = String(today.getDate()).padStart(2, '0');
|
|
|
+ var mm = String(today.getMonth() + 1).padStart(2, '0'); //January is 0!
|
|
|
+ var yyyy = today.getFullYear();
|
|
|
+
|
|
|
+ today = dd + '/' + mm + '/' + yyyy;
|
|
|
+
|
|
|
+ var baseurl = window.location.origin+window.location.pathname;
|
|
|
+ let slash = baseurl.lastIndexOf("/");
|
|
|
+ var type = $(this).val() + '.html';
|
|
|
+ var link = this.id;
|
|
|
+ var url = baseurl.substr(0, slash+1) + type + "?link="+link;
|
|
|
+ //alert(nome_autore);
|
|
|
+ //$('#myModal').text("");
|
|
|
+ $("#myModal").empty();
|
|
|
+ $("#myModal").css("display", "block");
|
|
|
+ $('#myModal').append("<div class='modal-content'><div class='modal-close'><span class='close'>×</span></div><div id='myInput'>" +
|
|
|
+ author + " " + year + ", accesso effettuato: " + today + ", <" + url + "></div><button id='copy_btn' class='btn btn-theme-primary btn-md' onclick='myFunction()'>Copia</button>");
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+function copyToClipboard(text) {
|
|
|
+ var sampleTextarea = document.createElement("textarea");
|
|
|
+ document.body.appendChild(sampleTextarea);
|
|
|
+ sampleTextarea.value = text; //save main text in it
|
|
|
+ sampleTextarea.select(); //select textarea contenrs
|
|
|
+ document.execCommand("copy");
|
|
|
+ document.body.removeChild(sampleTextarea);
|
|
|
+}
|
|
|
+
|
|
|
+function myFunction(){
|
|
|
+ var copy = document.getElementById("myInput");
|
|
|
+ copyText = copy.textContent;
|
|
|
+ copyToClipboard(copyText);
|
|
|
+
|
|
|
+ //copyToClipboard(copyText.value);
|
|
|
+}
|