|
@@ -1,88 +1,89 @@
|
|
|
-
|
|
|
-// 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);
|
|
|
+//Parametri da passare alla funzione onclick
|
|
|
+
|
|
|
+queryChoice = queryLettere;
|
|
|
+tipoRisorsa = "scambio epistolare";
|
|
|
+mittente = "Bellandi Simone di Andrea";
|
|
|
+uri_mittente = "http://www.archiviodistato.prato.it/accedi-e-consulta/aspoMV001/scheda/IT-ASPO-AU00003-0000806";
|
|
|
+destinatario = "Compagnia di Datini Francesco di Marco & co";
|
|
|
+uri_destinatario = "http://www.archiviodistato.prato.it/accedi-e-consulta/aspoMV001/scheda/IT-ASPO-AU00003-0001817";
|
|
|
+//////
|
|
|
+
|
|
|
+query = prepareQueryURL(queryChoice);
|
|
|
+
|
|
|
+response = $.ajax({
|
|
|
+
|
|
|
+ url: query,
|
|
|
+ dataType: "json",
|
|
|
+ success: function (data){
|
|
|
+ handle_Letters(data, mittente, uri_mittente, destinatario, uri_destinatario);
|
|
|
+ },
|
|
|
+ error: function (e) {}
|
|
|
+});
|
|
|
+
|
|
|
+function handle_Letters(json, mittente, uri_mittente, destinatario, uri_destinatario){
|
|
|
+
|
|
|
+ thead = '<div class="row def_res"> \
|
|
|
+ <div class="col-4">Documento</div> \
|
|
|
+ <div class="col-2">Data di partenza</div> \
|
|
|
+ <div class="col-2">Data di arrivo</div> \
|
|
|
+ <div class="col-2">Luogo di partenza</div> \
|
|
|
+ <div class="col-2">Luogo di arrivo</div> \
|
|
|
+ </div>';
|
|
|
+
|
|
|
+ var EventsTable = thead;
|
|
|
+
|
|
|
+ $.each(
|
|
|
+ json['results']['bindings'],
|
|
|
+ function (index, 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 = "";
|
|
|
|
|
|
- } 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;
|
|
|
+ if(value.hasOwnProperty('uri_document')) {
|
|
|
+ uri_document = value['uri_document']['value'];
|
|
|
+ }
|
|
|
+ if(value.hasOwnProperty('document')) {
|
|
|
+ doc = value['document']['value'];
|
|
|
+ }
|
|
|
+ if(value.hasOwnProperty('time_span_from')) {
|
|
|
+ time_span_from = value['time_span_from']['value'];
|
|
|
+ }
|
|
|
+ if(value.hasOwnProperty('time_span_to')) {
|
|
|
+ time_span_to = value['time_span_to']['value'];
|
|
|
+ }
|
|
|
+ if(value.hasOwnProperty('uri_place_from')) {
|
|
|
+ uri_place_from = value['uri_place_from']['value'];
|
|
|
+ }
|
|
|
+ if(value.hasOwnProperty('place_from')) {
|
|
|
+ place_from = value['place_from']['value'];
|
|
|
+ }
|
|
|
+ if(value.hasOwnProperty('uri_place_to')) {
|
|
|
+ uri_place_to = value['uri_place_to']['value'];
|
|
|
+ }
|
|
|
+ if(value.hasOwnProperty('place_to')) {
|
|
|
+ place_to = value['place_to']['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>';
|
|
|
+ EventsTable += '<div class="row">' +
|
|
|
+ '<div id="' + uri_document + '" class="col-4 object">' + doc + '</div>' +
|
|
|
+ '<div class="col-2">' + time_span_from + '</div>' +
|
|
|
+ '<div class="col-2">' + time_span_to + '</div>' +
|
|
|
+ '<div id="' + uri_place_from + '" class="col-2 luogo">' + place_from + '</div>' +
|
|
|
+ '<div id="' + uri_place_to + '" class="col-2 luogo">' + place_to + '</div>' +
|
|
|
+ '</div>';
|
|
|
+
|
|
|
+ });
|
|
|
|
|
|
|
|
|
document.getElementById("results_table").innerHTML = EventsTable;
|
|
|
- }
|
|
|
-
|
|
|
+ document.getElementById("results_title").innerHTML = "Lettere da " + mittente + " a " + destinatario;
|
|
|
+
|
|
|
+}
|
|
|
|
|
|
/*if(pageInfo.query1){
|
|
|
document.getElementById("mittente_id").innerHTML = pageInfo.query1.mittente.value;
|
|
@@ -148,7 +149,6 @@ function updatePage(){
|
|
|
if(pageInfo.sigla){
|
|
|
document.getElementById("evt_button").innerHTML = createButtonEVT(pageInfo.sigla.sigla_OVI.value);
|
|
|
}*/
|
|
|
-}
|
|
|
|
|
|
// Mini-utility per formattare liste
|
|
|
function formatListAsLi(thisList){
|
|
@@ -288,4 +288,42 @@ function myFunction(){
|
|
|
copyToClipboard(copyText);
|
|
|
|
|
|
//copyToClipboard(copyText.value);
|
|
|
-}
|
|
|
+}
|
|
|
+
|
|
|
+$(document).on("click", ".luogo", function (ev) {
|
|
|
+
|
|
|
+ var link = this.id;
|
|
|
+ //alert(nome_autore);
|
|
|
+ //$('#myModal').text("");
|
|
|
+ window.open("Luogo.html?link="+this.id);
|
|
|
+
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+$(document).on("click", ".persona", function (ev) {
|
|
|
+
|
|
|
+ var link = this.id;
|
|
|
+ window.open("Persona.html?link="+this.id);
|
|
|
+
|
|
|
+
|
|
|
+ });
|
|
|
+
|
|
|
+$(document).on("click", ".lettera", function (ev) {
|
|
|
+
|
|
|
+ var link = this.id;
|
|
|
+ //alert(nome_autore);
|
|
|
+ //$('#myModal').text("");
|
|
|
+ window.open("lettera.html?link="+this.id);
|
|
|
+
|
|
|
+
|
|
|
+});
|
|
|
+
|
|
|
+$(document).on("click", ".object", function (ev) {
|
|
|
+
|
|
|
+ var link = this.id;
|
|
|
+ //alert(nome_autore);
|
|
|
+ //$('#myModal').text("");
|
|
|
+ window.open("object.html?link="+this.id);
|
|
|
+
|
|
|
+
|
|
|
+});
|