Parcourir la source

Bug fix on object

Alessia il y a 1 an
Parent
commit
f4724a8976
2 fichiers modifiés avec 35 ajouts et 14 suppressions
  1. 27 12
      js/object.js
  2. 8 2
      object.html

+ 27 - 12
js/object.js

@@ -47,7 +47,7 @@ PREFIX schema: <http://schema.org/> \
 PREFIX foaf: <http://xmlns.com/foaf/0.1/> \
 PREFIX person: <http://www.w3.org/ns/person#>"
 
-queryInfo = prefixes + " SELECT DISTINCT ?g AS ?graph ?uri ?label ?dimension ?consistency ?id ?sigla_registro (group_concat(distinct ?dimension ; separator='<br />') as ?dimensions) ?material (group_concat(distinct ?time_span ;separator='-') as ?time_span) ?location ?uri_owner ?owner ?note \
+queryInfo = prefixes + " SELECT DISTINCT ?g AS ?graph ?uri ?label ?dimension ?consistency ?id ?sigla_registro (group_concat(distinct ?dimension ; separator='<br />') as ?dimensions) ?material (group_concat(distinct ?time_span ;separator='-') as ?time_span) ?location ?uri_owner ?owner ?uri_document ?document ?note \
 WHERE { \
 VALUES ?uri {<" + thisUrlParams.link + ">} \
 GRAPH ?g { ?uri rdfs:label ?label } \
@@ -73,6 +73,8 @@ OPTIONAL { ?uri crm:P3_has_note ?uri_note . \
 OPTIONAL { ?uri crm:P92i_was_brought_into_existence_by ?creation . \
 ?creation crm:P4_has_time-span ?uri_time_span . \
 ?uri_time_span rdfs:label ?time_span . } \
+OPTIONAL {?uri_document crm:P46_is_composed_of ?uri ; \
+rdfs:label ?document .} \
 } "
 
 queryContent = prefixes + " SELECT DISTINCT ?g AS ?graph ?uri ?titolo ?tipo (group_concat(distinct ?ref ; separator='<br />') as ?ref) \
@@ -154,7 +156,7 @@ crm:P140_assigned_attribute_to ?uri_contrassegno . \
 
 queryEventiGettatelli = prefixes + " SELECT DISTINCT ?uri_obj ?object ?name_event ?event_type ?uri_person ?label ?role ?time_span ?uri_place ?place \
 WHERE {VALUES ?uri {<" + thisUrlParams.link + ">} \
-?uri crm:P46_is_composed_of ?uri_paper . \
+OPTIONAL {?uri crm:P46_is_composed_of ?uri_paper . } \
 {?uri_paper crm:P128_carries ?uri_doc } \
 UNION \
 {?uri crm:P128_carries ?uri_doc } \
@@ -274,6 +276,9 @@ function handle_objectData(json) {
         var current_owner = "";
         var uri_owner = "";
         var dates = "";
+        var uri_composed = "";
+        var composed = "";
+        var button_doc = "";
 
         var dataset = get_graph_name(graph);
 
@@ -312,15 +317,25 @@ function handle_objectData(json) {
           $("#notes").css("display", "flex");
           description = value['note']['value'];
         }
+        if (value.hasOwnProperty('uri_document')) {
+          uri_composed = value['uri_document']['value'];
+        }
+        if (value.hasOwnProperty('document')) {
+          $("#composed").css("display", "flex");
+          composed = value['document']['value'];
+        }
 
         if (identifier != "") {
-          button_ext = '<button class="btn btn-default" type="button" onclick="schedaASPO(\'' + uri + '\')"> \
-          <i class="fa fa-link" aria-hidden="true">	<p class="btn-text">Link</p></i></button>';
+          button_ext = '<a href= "' + uri + '">' + identifier + '</a>';
+        }
+
+        if (uri_composed != "") {
+          button_doc = '<button id="' + uri_composed + '" class="object btn btn-default" type="button" title="Bene culturale" > \
+          <i class="fa fa-book" aria-hidden="true">	<p class="btn-text">Bene culturale</p></i></button>';
         }
 
         if (owner != "") {
-          button_owner = '<button class="btn btn-default" type="button" onclick="schedaASPO(\'' + uri_owner + '\')"> \
-          <i class="fa fa-link" aria-hidden="true">	<p class="btn-text">Link</p></i></button>';
+          button_owner = '<a href= "' + uri_owner + '">' + current_owner + '</a>';
         }
 
         var Buttons = '<button class="btn btn-default" type="button" onclick="schedaASPO(\'' + uri + '\')"> \
@@ -332,15 +347,15 @@ function handle_objectData(json) {
 
         document.getElementById("grafo").innerHTML = dataset;
         document.getElementById("nome_oggetto").innerHTML = label;
-        document.getElementById("identifier").innerHTML = identifier;
-        document.getElementById("btn_identifier").innerHTML = button_ext;
+        document.getElementById("identifier").innerHTML = button_ext;
         document.getElementById("nota").innerHTML = description;
         document.getElementById("dimensions").innerHTML = dimensions;
         document.getElementById("materials").innerHTML = materials;
         document.getElementById("consistence").innerHTML = consistence;
-        document.getElementById("owner").innerHTML = current_owner;
-        document.getElementById("btn_owner").innerHTML = button_owner;
+        document.getElementById("owner").innerHTML = button_owner;
         document.getElementById("timeSpan").innerHTML = dates;
+        document.getElementById("superDoc").innerHTML = composed;
+        document.getElementById("btn_superDoc").innerHTML = button_doc;
         document.getElementById("link_buttons").innerHTML = Buttons;
        
         
@@ -773,10 +788,10 @@ function handle_eventiGettatelli(json) {
       for (var i=0; i<evGett.length; i++) {
         EventsTable += '<div class="row res">' +
         '<div class="col-4">' + evGett[i][0] + '</div>' +
-        '<div id="' + evGett[i][1] + '" class="col-2 persona">' + evGett[i][2] + '</div>' +
+        '<div id="' + evGett[i][1] + '" class="col-2 persona title_doc">' + evGett[i][2] + '</div>' +
         '<div class="col-2">' + evGett[i][3] + '</div>' +
         '<div class="col-2">' + evGett[i][4] + '</div>' +
-        '<div id="' + evGett[i][5] + '" class="col-2 luogo">' + evGett[i][6] + '</div>' +
+        '<div id="' + evGett[i][5] + '" class="col-2 luogo title_doc">' + evGett[i][6] + '</div>' +
         '</div>';
       }
     

+ 8 - 2
object.html

@@ -125,7 +125,6 @@
 												<span class="label">Segnatura:</span>
 											</div>
 											<div class="col" id="identifier"></div>
-											<div class="col-auto" id="btn_identifier"></div>
 										</div>
 
 										<div class="row mb-2" id="IDbis" style="display:none;">
@@ -141,7 +140,6 @@
 												<span class="label">Istituto di conservazione:</span>
 											</div>
 											<div class="col" id="owner"></div>
-											<div class="col-auto" id="btn_owner"></div>
 										</div>
 
 										<div class="row mb-2" id="time_span_object" style="display:none;">
@@ -179,6 +177,14 @@
 											<div class="col" id="materials"></div>
 										</div>
 
+										<div class="row mb-2" id="composed" style="display:none;">
+											<div class="col-sm-4">
+												<span class="label">Parte di:</span>
+											</div>
+											<div class="col" id="superDoc"></div>
+											<div class="col-auto" id="btn_superDoc"></div>
+										</div>
+
 										<div class="row mb-2" id="notes" style="display:none;">
 											<div class="col-sm-4">
 												<span class="label">Note:</span>