object.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698
  1. // Raccatto i parametri dall'URL -- mi aspetto un parametro di nome 'link'!
  2. thisUrlParams = {};
  3. window.location.href.replace(/[?&]+([^=&]+)=([^&]*)/gi, function(m,key,value) {
  4. thisUrlParams[key] = value;
  5. });
  6. console.log('URL get params: ', thisUrlParams);
  7. // Funzioni per eseguire le queries
  8. function prepareQueryURL(query){
  9. sparqlEndpoint = 'http://dev.restore.ovi.cnr.it:8890/sparql/';
  10. sparqlUrlParams = '?default-graph-uri=&query=' + encodeURIComponent(query) + '&output=json&callback=?';
  11. return sparqlEndpoint + sparqlUrlParams;
  12. }
  13. function doJsonQuery(query){
  14. queryURL = prepareQueryURL(query);
  15. response = $.ajax({//OGGETTO
  16. url: queryURL,
  17. dataType: "json",
  18. success: function (data){},
  19. error: function (e) {}
  20. });
  21. return response;
  22. }
  23. // Funzioni per raccattare + stringhificare l'output
  24. queryStringOutput = "";
  25. function stringifyResponse(val){
  26. resultArray = val['results']['bindings'];
  27. out = "";
  28. for(i = 0; i < resultArray.length; i++){
  29. out = out + JSON.stringify(resultArray[i])
  30. }
  31. queryStringOutput = (queryStringOutput + out).replace("}{",",");
  32. }
  33. prefixes = "PREFIX rdfs: <http://www.w3.org/2000/01/rdf-schema#> \
  34. PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \
  35. PREFIX crm: <http://www.cidoc-crm.org/cidoc-crm/> \
  36. PREFIX owl: <http://www.w3.org/2002/07/owl#> \
  37. PREFIX schema: <http://schema.org/> \
  38. PREFIX foaf: <http://xmlns.com/foaf/0.1/> \
  39. PREFIX person: <http://www.w3.org/ns/person#>"
  40. 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 \
  41. WHERE { \
  42. VALUES ?uri {<" + thisUrlParams.link + ">} \
  43. GRAPH ?g { ?uri rdfs:label ?label } \
  44. OPTIONAL {?uri crm:P1_is_identified_by ?uri_id . \
  45. ?uri_id rdfs:label ?id ; \
  46. crm:P2_has_type 'Segnatura' .} \
  47. OPTIONAL { ?uri crm:P43_has_dimension ?uri_consistency . \
  48. ?uri_consistency crm:P2_has_type 'Consistenza carte' ; \
  49. rdfs:label ?consistency } \
  50. OPTIONAL { ?uri crm:P43_has_dimension ?uri_dimension . \
  51. ?uri_dimension crm:P2_has_type 'Dimensioni' ; \
  52. rdfs:label ?dimension } \
  53. OPTIONAL { ?uri crm:P139_has_alternative_form ?uri_registro . \
  54. ?uri_registro rdfs:label ?sigla_registro; \
  55. crm:P2_has_type 'Sigla registro' . } \
  56. OPTIONAL { ?uri crm:P45_consist_of ?uri_material . \
  57. ?uri_material rdfs:label ?material } \
  58. OPTIONAL { ?uri crm:P52_has_current_owner ?uri_owner . \
  59. ?uri_owner rdfs:label ?owner . } \
  60. OPTIONAL { ?uri crm:P54_has_current_permanent_location ?location } \
  61. OPTIONAL { ?uri crm:P3_has_note ?uri_note . \
  62. ?uri_note rdfs:label ?note } \
  63. OPTIONAL { ?uri crm:P92i_was_brought_into_existence_by ?creation . \
  64. ?creation crm:P4_has_time-span ?uri_time_span . \
  65. ?uri_time_span rdfs:label ?time_span . } \
  66. } "
  67. queryContent = prefixes + " SELECT DISTINCT ?g AS ?graph ?uri ?titolo ?tipo (group_concat(distinct ?ref ; separator='<br />') as ?ref) \
  68. WHERE { \
  69. VALUES ?object {<" + thisUrlParams.link + ">} \
  70. ?object crm:P128_carries ?uri . \
  71. ?uri rdf:type crm:E73_Information_Object . \
  72. GRAPH ?g { ?uri rdfs:label ?label } \
  73. OPTIONAL {?uri crm:P1_is_identified_by ?uri_titolo . \
  74. ?uri_titolo rdfs:label ?titolo ; \
  75. rdf:type crm:E35_Title . } \
  76. OPTIONAL { ?uri crm:P2_has_type ?uri_tipo . \
  77. ?uri_tipo rdfs:label ?tipo . } \
  78. OPTIONAL { ?uri crm:P67_refers_to ?uri_ref . \
  79. ?uri_ref rdfs:label ?ref . } \
  80. FILTER NOT EXISTS {GRAPH <http://dev.restore.ovi.cnr.it:8890/ovi/datini> { ?uri rdfs:label ?label }}. \
  81. }"
  82. queryOviLetter = prefixes + " SELECT DISTINCT ?otherId ?InfObj \
  83. WHERE { \
  84. VALUES ?uri {<" + thisUrlParams.link + ">} \
  85. ?uri crm:P1_is_identified_by ?uri_id . \
  86. ?uri_id crm:P2_has_type 'Segnatura' ; \
  87. crm:P139_has_alternative_form ?other_id . \
  88. ?other_id crm:P2_has_type ?uri_type ; \
  89. rdfs:label ?otherId . \
  90. ?uri_type rdfs:label 'Segnatura OVI' . \
  91. OPTIONAL { ?uri crm:P128_carries ?InfObj . \
  92. GRAPH <http://dev.restore.ovi.cnr.it:8890/ovi/datini> {?InfObj rdf:type crm:E73_Information_Object } } \
  93. } "
  94. queryPersone = prefixes + " SELECT DISTINCT ?uri_person ?name ?p_type ?note \
  95. WHERE { \
  96. VALUES ?uri {<" + thisUrlParams.link + ">} \
  97. {?uri crm:P46_is_composed_of ?card . \
  98. ?card crm:P2_has_type 'Scheda anagrafica' . \
  99. ?document crm:P141_assigned ?card ; \
  100. crm:P67_refers_to ?uri_person . \
  101. ?uri_person foaf:name ?name ; \
  102. crm:P2_has_type ?person_type . \
  103. ?person_type rdfs:label ?p_type . \
  104. } UNION { \
  105. ?document crm:P141_assigned ?uri ; \
  106. crm:P67_refers_to ?uri_person . \
  107. ?uri_person foaf:name ?name ; \
  108. crm:P2_has_type ?person_type . \
  109. ?person_type rdfs:label ?p_type . \
  110. } UNION { \
  111. ?uri crm:P92i_was_brought_into_existence_by ?creation . \
  112. ?creation crm:P67_refers_to ?uri_person . \
  113. ?uri_person foaf:name ?name ; \
  114. crm:P67.1_type ?person_type . \
  115. OPTIONAL {?uri_person crm:P3_has_note ?note } \
  116. ?person_type rdfs:label ?p_type . \
  117. } \
  118. }"
  119. queryAssocDocs = prefixes + " SELECT DISTINCT ?card ?doc_type ?name_card \
  120. WHERE { \
  121. VALUES ?uri {<" + thisUrlParams.link + ">} \
  122. ?uri crm:P46_is_composed_of ?card . \
  123. ?card rdfs:label ?name_card . \
  124. OPTIONAL {?card crm:P2_has_type ?doc_type } \
  125. OPTIONAL {?document crm:P141_assigned ?card ; \
  126. crm:P67_refers_to ?uri_person . \
  127. ?uri_person foaf:name ?name ; \
  128. crm:P2_has_type ?person_type . \
  129. ?person_type rdfs:label ?type . \
  130. } \
  131. }"
  132. queryURL = prepareQueryURL(queryInfo);
  133. queryINF = prepareQueryURL(queryContent);
  134. queryOVI = prepareQueryURL(queryOviLetter);
  135. queryPERS = prepareQueryURL(queryPersone);
  136. queryDOC = prepareQueryURL(queryAssocDocs);
  137. response = $.ajax({
  138. url: queryURL,
  139. dataType: "json",
  140. success: function (data){
  141. handle_objectData(data);
  142. },
  143. error: function (e) {}
  144. });
  145. response_info = $.ajax({
  146. url: queryINF,
  147. dataType: "json",
  148. success: function (data){
  149. handle_objectInfo(data);
  150. },
  151. error: function (e) {}
  152. });
  153. response_info = $.ajax({
  154. url: queryOVI,
  155. dataType: "json",
  156. success: function (data){
  157. handle_oviLetter(data);
  158. },
  159. error: function (e) {}
  160. });
  161. response_people = $.ajax({
  162. url: queryPERS,
  163. dataType: "json",
  164. success: function (data){
  165. handle_citedPeople(data);
  166. },
  167. error: function (e) {}
  168. });
  169. response_documents = $.ajax({
  170. url: queryDOC,
  171. dataType: "json",
  172. success: function (data){
  173. handle_associatedDocuments(data);
  174. },
  175. error: function (e) {}
  176. });
  177. function handle_objectData(json) {
  178. console.log(json['results']['bindings']);
  179. $.each(
  180. json['results']['bindings'],
  181. function (index, value) {
  182. var graph = value['graph']['value'];
  183. var label = value['label']['value'];
  184. var uri = value['uri']['value'];
  185. var identifier = "";
  186. var dimensions = "";
  187. var consistence = "";
  188. var materials = "";
  189. var description = "";
  190. var button_ext = "";
  191. var button_owner = "";
  192. var current_owner = "";
  193. var uri_owner = "";
  194. var dates = "";
  195. var dataset = get_graph_name(graph);
  196. if (value.hasOwnProperty('id')) {
  197. $("#ID").css("display", "flex");
  198. identifier = value['id']['value'];
  199. }
  200. if (value.hasOwnProperty('dimension')) {
  201. $("#dimensione").css("display", "flex");
  202. dimensions = value['dimensions']['value'];
  203. }
  204. if (value.hasOwnProperty('consistency')) {
  205. $("#consistenza").css("display", "flex");
  206. consistence = value['consistency']['value'];
  207. }
  208. if (value.hasOwnProperty('condition')) {
  209. $("#STCC").css("display", "flex");
  210. condition = value['condition']['value'];
  211. }
  212. if (value.hasOwnProperty('material')) {
  213. $("#materia").css("display", "flex");
  214. materials = value['material']['value'];
  215. }
  216. if (value.hasOwnProperty('uri_owner')) {
  217. $("#current_owner").css("display", "flex");
  218. current_owner = value['owner']['value'];
  219. uri_owner = value['uri_owner']['value'];
  220. }
  221. if (value.hasOwnProperty('time_span')) {
  222. if (value['time_span']['value'] != ""){
  223. $("#time_span_object").css("display", "flex");
  224. dates = value['time_span']['value'];
  225. }
  226. }
  227. if (value.hasOwnProperty('note')) {
  228. $("#notes").css("display", "flex");
  229. description = value['note']['value'];
  230. }
  231. if (identifier != "") {
  232. button_ext = '<button class="btn btn-default" type="button" onclick="schedaASPO(\'' + uri + '\')"> \
  233. <i class="fa fa-link" aria-hidden="true"> <p class="btn-text">Link</p></i></button>';
  234. }
  235. if (owner != "") {
  236. button_owner = '<button class="btn btn-default" type="button" onclick="schedaASPO(\'' + uri_owner + '\')"> \
  237. <i class="fa fa-link" aria-hidden="true"> <p class="btn-text">Link</p></i></button>';
  238. }
  239. document.getElementById("grafo").innerHTML = dataset;
  240. document.getElementById("nome_oggetto").innerHTML = label;
  241. document.getElementById("identifier").innerHTML = identifier;
  242. document.getElementById("btn_identifier").innerHTML = button_ext;
  243. document.getElementById("nota").innerHTML = description;
  244. document.getElementById("dimensions").innerHTML = dimensions;
  245. document.getElementById("materials").innerHTML = materials;
  246. document.getElementById("consistence").innerHTML = consistence;
  247. document.getElementById("owner").innerHTML = current_owner;
  248. document.getElementById("btn_owner").innerHTML = button_owner;
  249. document.getElementById("timeSpan").innerHTML = dates;
  250. });
  251. }
  252. function get_graph_name(graph) {
  253. var dataset = "Scheda Oggetto";
  254. if (graph == "http://dev.restore.ovi.cnr.it:8890/aspo/ospedale") {
  255. dataset = dataset + " / Ospedale";
  256. } else if (graph == "http://dev.restore.ovi.cnr.it:8890/aspo/datini") {
  257. dataset = dataset + " / Datini";
  258. } else if (graph == "http://dev.restore.ovi.cnr.it:8890/aspo/marcovaldi") {
  259. dataset = dataset + " / Marcovaldi";
  260. } else if (graph == "http://dev.restore.ovi.cnr.it:8890/aspo/gettatelli") {
  261. dataset = dataset + " / Gettatelli";
  262. } else {
  263. dataset = dataset;
  264. }
  265. return dataset;
  266. }
  267. function handle_objectInfo(json) {
  268. console.log(json['results']['bindings']);
  269. $.each(
  270. json['results']['bindings'],
  271. function (index, value) {
  272. var title = "";
  273. var type = "";
  274. var subject = "";
  275. if (value.hasOwnProperty('titolo')) {
  276. $("#titolo").css("display", "flex");
  277. title = value['titolo']['value'];
  278. }
  279. if (value.hasOwnProperty('tipo')) {
  280. $("#tipo").css("display", "flex");
  281. type = value['tipo']['value'];
  282. }
  283. if (value.hasOwnProperty('ref')) {
  284. if (value['ref']['value'] != "") {
  285. $("#argomento").css("display", "flex");
  286. subject = value['ref']['value'];
  287. }
  288. }
  289. document.getElementById("title").innerHTML = title;
  290. document.getElementById("type").innerHTML = type;
  291. document.getElementById("subject").innerHTML = subject;
  292. });
  293. }
  294. function handle_oviLetter(json) {
  295. console.log(json['results']['bindings']);
  296. $.each(
  297. json['results']['bindings'],
  298. function (index, value) {
  299. var other_id = "";
  300. var uri = "";
  301. var button_letter = "";
  302. if (value.hasOwnProperty('otherId')) {
  303. $("#IDbis").css("display", "flex");
  304. other_id = value['otherId']['value'];
  305. }
  306. if (value.hasOwnProperty('InfObj')) {
  307. uri = value['InfObj']['value'];
  308. }
  309. if (uri != "") {
  310. button_letter = '<button type="button" id="' + uri +
  311. '" class="lettera btn btn-default" alt="lettera"><i class="fa fa-envelope"></i><p class="btn-text">Scheda Lettera</p></button>';
  312. }
  313. document.getElementById("other_identifier").innerHTML = other_id;
  314. document.getElementById("btn_other_identifier").innerHTML = button_letter;
  315. });
  316. }
  317. /*
  318. function handle_citedPeople(json) {
  319. console.log(json);
  320. var Relazioni = "";
  321. const myArray = []
  322. $.each(
  323. json['results']['bindings'],
  324. function (index, value) {
  325. var uri_person = value['uri_person']['value'];
  326. var name = value['name']['value'];
  327. var tipo = "";
  328. var nota = "";
  329. if (value.hasOwnProperty('p_type')) {
  330. tipo = value['p_type']['value'];
  331. }
  332. if (value.hasOwnProperty('note')) {
  333. nota = "<br /><span class='nota_menzione'><i>" + value['note']['value'] + "</i></span>";
  334. }
  335. var string = name + nota;
  336. myArray.push([tipo, string, uri_person, nota]);
  337. });
  338. if (myArray.length == 0) {
  339. $("#placeholder_people").css("display", "none");
  340. }
  341. const checkRel = [];
  342. for (var i=0; i<myArray.length; i++) {
  343. var key = myArray[i][0];
  344. checkRel.push(key);
  345. }
  346. var params = [];
  347. $.each(checkRel, function(i, el){
  348. if($.inArray(el, params) === -1) params.push(el);
  349. });
  350. for (var i=0; i<params.length; i++) {
  351. var par = params[i];
  352. var par_id = par.replaceAll(" ", "_");
  353. var rel = createDivRelazione(par, par_id);
  354. Relazioni = Relazioni + rel;
  355. }
  356. $(Relazioni).insertAfter( "#placeholder_people" );
  357. for (var j=0; j<params.length; j++) {
  358. var el = params[j];
  359. var par = el.replaceAll(" ", "_");
  360. var Colums = "";
  361. for (var i=0; i<myArray.length; i++) {
  362. var text = myArray[i][1];
  363. var link = myArray[i][2];
  364. var declaration = ""
  365. if (myArray[i][3] != "") {
  366. declaration = "myMargin";
  367. }
  368. var rel = myArray[i][0].replaceAll(" ", "_");
  369. if (par == rel) {
  370. var col = createColRelazione(text, link, "persona", "fa fa-user", "Scheda Persona", declaration);
  371. Colums = Colums + col;
  372. }
  373. }
  374. document.getElementById(par).innerHTML = Colums;
  375. }
  376. }
  377. function handle_associatedDocuments(json) {
  378. console.log(json);
  379. var Sezioni = "";
  380. const myArray = []
  381. $.each(
  382. json['results']['bindings'],
  383. function (index, value) {
  384. var uri = value['card']['value'];
  385. var name = value['name_card']['value'];
  386. var tipo = "";
  387. if (value.hasOwnProperty('doc_type')) {
  388. tipo = value['doc_type']['value'];
  389. }
  390. myArray.push([tipo, name, uri]);
  391. });
  392. if (myArray.length == 0) {
  393. $("#placeholder_documents").css("display", "none");
  394. }
  395. const checkRel = [];
  396. for (var i=0; i<myArray.length; i++) {
  397. var key = myArray[i][0];
  398. checkRel.push(key);
  399. }
  400. var params = [];
  401. $.each(checkRel, function(i, el){
  402. if($.inArray(el, params) === -1) params.push(el);
  403. });
  404. for (var i=0; i<params.length; i++) {
  405. var par = params[i];
  406. var par_id = par.replaceAll(" ", "_");
  407. var rel = createDivRelazione(par, par_id);
  408. Sezioni = Sezioni + rel;
  409. }
  410. $(Sezioni).insertAfter( "#placeholder_documents" );
  411. for (var j=0; j<params.length; j++) {
  412. var el = params[j];
  413. var par = el.replaceAll(" ", "_");
  414. var Colums = "";
  415. for (var i=0; i<myArray.length; i++) {
  416. var text = myArray[i][1];
  417. var link = myArray[i][2];
  418. var rel = myArray[i][0].replaceAll(" ", "_");
  419. if (par == rel) {
  420. var col = createColRelazione(text, link, "object", "fa fa-book", "Scheda Oggetto", "");
  421. Colums = Colums + col;
  422. }
  423. }
  424. document.getElementById(par).innerHTML = Colums;
  425. }
  426. } */
  427. function handle_citedPeople(json) {
  428. console.log(json);
  429. const people = [];
  430. $.each(
  431. json['results']['bindings'],
  432. function (index, value) {
  433. var uri = value['uri_person']['value'];
  434. var name = value['name']['value'];
  435. var tipo = "";
  436. var nota = "";
  437. if (value.hasOwnProperty('p_type')) {
  438. tipo = value['p_type']['value'];
  439. }
  440. if (value.hasOwnProperty('note')) {
  441. nota = value['note']['value'];
  442. }
  443. people.push([uri, name, tipo, nota]);
  444. });
  445. var Person = "";
  446. for (var i=0; i<people.length; i++) {
  447. var object = '<a href=' + people[i][0] + ' target="_blank">' + people[i][1] + '</a>';
  448. if (people[i][2] != "") {
  449. object = object + "<br />Ruolo: " + people[i][2];
  450. }
  451. if (people[i][3] != "") {
  452. object = object + "<br />Nota: " + people[i][3];
  453. }
  454. Person += /*INIZIO DIV*/ '<div class="row res"><div class="col-8">' +
  455. object + '</div>' +
  456. '<div class="col d-flex align-items-start justify-content-end"><button type="button" id="' + people[i][0] + '" class="persona btn btn-default" alt="persona" title="' +
  457. people[i][1] + '"><i class="fa fa-user"></i><p class="btn-text">Scheda Persona</p></button>' +
  458. '<button type="button" id="' + people[i][0] + '" class="cit btn btn-default" alt="scheda" title="Info"><i class="fa fa-quote-right"></i><p class="btn-text">Citazione</p></button>' +
  459. /*DA QUI HYPERLINK ->*/'<button type="button" id="' + people[i][0] + '" class="hyp btn btn-default" alt="scheda" title="Info"><i class="fa fa-link"></i><p class="btn-text">Hyperlink</p></button>' +
  460. /*DA QUI LOD ->*/'<a href="http://dev.restore.ovi.cnr.it/lodlive/?' + people[i][0] + '" target="_blank"><button type="button" class="btn btn-default info" alt="LOD"><i class="fa fa-share-alt"></i><p class="btn-text">Lod</p></button></a></div></div>';
  461. }
  462. document.getElementById("n_pp").innerHTML = people.length;
  463. document.getElementById("cited_people").innerHTML = Person;
  464. if (people.length==0) {
  465. var messaggio = "<p class='no-results'>Nessun risultato trovato</p>";
  466. document.getElementById("cited_people").innerHTML = messaggio;
  467. }
  468. }
  469. function handle_associatedDocuments(json) {
  470. console.log(json);
  471. const docs = [];
  472. $.each(
  473. json['results']['bindings'],
  474. function (index, value) {
  475. var uri = value['card']['value'];
  476. var label = value['name_card']['value'];
  477. var tipo = "";
  478. if (value.hasOwnProperty('doc_type')) {
  479. tipo = value['doc_type']['value'];
  480. }
  481. docs.push([uri, label, tipo]);
  482. });
  483. var Docs = "";
  484. for (var i=0; i<docs.length; i++) {
  485. var object = '<a href=' + docs[i][0] + ' target="_blank">' + docs[i][1] + '</a>';
  486. if (docs[i][2] != "") {
  487. object = object + "<br />Documento: " + docs[i][2];
  488. }
  489. var object_button = '<button type="button" id="' + docs[i][0] +
  490. '" class="object btn btn-default" alt="oggetto" title="' + docs[i][1] +
  491. '"><i class="fa fa-book"></i><p class="btn-text">Scheda Oggetto</p></button>';
  492. Docs += '<div class="row res"><div class="col-8"><p>'+ object +'</p></div>' +
  493. '<div class="col d-flex align-items-start justify-content-end">' + object_button +
  494. '<button type="button" id="' + docs[i][0] + '" class="cit btn btn-default" alt="scheda" title="Info"><i class="fa fa-quote-right"></i><p class="btn-text">Citazione</p></button>' +
  495. '<button type="button" id="' + docs[i][0] + '" class="hyp btn btn-default" alt="scheda" title="Info"><i class="fa fa-link"></i><p class="btn-text">Hyperlink</p></button>' +
  496. '<a href="http://dev.restore.ovi.cnr.it/lodlive/?' + docs[i][0] + '" target="_blank"><button type="button" class="btn btn-default info" alt="LOD"><i class="fa fa-share-alt"></i><p class="btn-text">Lod</p></button></a></div></div>';
  497. }
  498. document.getElementById("n_sec").innerHTML = docs.length;
  499. document.getElementById("section_documents").innerHTML = Docs;
  500. if (docs.length==0) {
  501. var messaggio = "<p class='no-results'>Nessun risultato trovato</p>";
  502. document.getElementById("section_documents").innerHTML = messaggio;
  503. }
  504. }
  505. function createDivRelazione(type, id){
  506. htmlCode = '\
  507. <div class="row mb-2"> \
  508. <div class="col-sm-4"> \
  509. <span class="label"><RELATIONSHIP></span> \
  510. </div> \
  511. <div class="col record_box" id="<ID_RELATIONSHIP>"></div> \
  512. </div> \
  513. '.replace("<RELATIONSHIP>", type).replace("<ID_RELATIONSHIP>", id);
  514. return htmlCode;
  515. }
  516. function createColRelazione(text, link, tipo, fa, tab, decl) {
  517. htmlCode = '\
  518. <div class="row"> \
  519. <div class="col <CLASS>"><NAME></div> \
  520. <div class="col-auto"> \
  521. <button class="<TIPO> btn btn-default" type="button" id="<URI>">\
  522. <i class="<BUTTON>" aria-hidden="true">\
  523. <p class="btn-text"><TAB></p>\
  524. </i>\
  525. </button>\</div> \
  526. </div>\
  527. '.replace("<NAME>", text).replace("<URI>", link).replace("<TIPO>", tipo).replace("<BUTTON>", fa).replace("<TAB>", tab).replace("<CLASS>", decl);
  528. return htmlCode;
  529. }
  530. $(document).on("click", ".lettera", function (ev) {
  531. var link = this.id;
  532. //alert(nome_autore);
  533. //$('#myModal').text("");
  534. window.open("lettera.html?link="+this.id);
  535. });
  536. $(document).on("click", ".luogo", function (ev) {
  537. var link = this.id;
  538. //alert(nome_autore);
  539. //$('#myModal').text("");
  540. window.open("Luogo.html?link="+this.id);
  541. });
  542. $(document).on("click", ".persona", function (ev) {
  543. var link = this.id;
  544. //alert(nome_autore);
  545. //$('#myModal').text("");
  546. window.open("Persona.html?link="+this.id);
  547. });
  548. $(document).on("click", ".object", function (ev) {
  549. var link = this.id;
  550. //alert(nome_autore);
  551. //$('#myModal').text("");
  552. window.open("object.html?link="+this.id);
  553. });
  554. function schedaASPO(info){
  555. window.open(info);
  556. }