object.js 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710
  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 current_location = "";
  190. var description = "";
  191. var button_ext = "";
  192. var button_owner = "";
  193. var registro = "";
  194. var current_owner = "";
  195. var uri_owner = "";
  196. var dates = "";
  197. var dataset = get_graph_name(graph);
  198. if (value.hasOwnProperty('id')) {
  199. $("#ID").css("display", "flex");
  200. identifier = value['id']['value'];
  201. }
  202. if (value.hasOwnProperty('dimension')) {
  203. $("#dimensione").css("display", "flex");
  204. dimensions = value['dimensions']['value'];
  205. }
  206. if (value.hasOwnProperty('consistency')) {
  207. $("#consistenza").css("display", "flex");
  208. consistence = value['consistency']['value'];
  209. }
  210. if (value.hasOwnProperty('condition')) {
  211. $("#STCC").css("display", "flex");
  212. condition = value['condition']['value'];
  213. }
  214. if (value.hasOwnProperty('material')) {
  215. $("#materia").css("display", "flex");
  216. materials = value['material']['value'];
  217. }
  218. if (value.hasOwnProperty('uri_owner')) {
  219. $("#current_owner").css("display", "flex");
  220. current_owner = value['owner']['value'];
  221. uri_owner = value['uri_owner']['value'];
  222. }
  223. if (value.hasOwnProperty('location')) {
  224. $("#conservazione").css("display", "flex");
  225. current_location = value['location']['value'];
  226. }
  227. if (value.hasOwnProperty('time_span')) {
  228. if (value['time_span']['value'] != ""){
  229. $("#time_span_object").css("display", "flex");
  230. dates = value['time_span']['value'];
  231. }
  232. }
  233. if (value.hasOwnProperty('sigla_registro')) {
  234. $("#IDreg").css("display", "flex");
  235. registro = value['sigla_registro']['value'];
  236. }
  237. if (value.hasOwnProperty('note')) {
  238. $("#notes").css("display", "flex");
  239. description = value['note']['value'];
  240. }
  241. if (identifier != "") {
  242. button_ext = '<button class="btn btn-default" type="button" onclick="schedaASPO(\'' + uri + '\')"> \
  243. <i class="fa fa-link" aria-hidden="true"> <p class="btn-text">Link</p></i></button>';
  244. }
  245. if (owner != "") {
  246. button_owner = '<button class="btn btn-default" type="button" onclick="schedaASPO(\'' + uri_owner + '\')"> \
  247. <i class="fa fa-link" aria-hidden="true"> <p class="btn-text">Link</p></i></button>';
  248. }
  249. document.getElementById("grafo").innerHTML = dataset;
  250. document.getElementById("nome_oggetto").innerHTML = label;
  251. document.getElementById("identifier").innerHTML = identifier;
  252. document.getElementById("btn_identifier").innerHTML = button_ext;
  253. document.getElementById("current_location").innerHTML = current_location;
  254. document.getElementById("nota").innerHTML = description;
  255. document.getElementById("dimensions").innerHTML = dimensions;
  256. document.getElementById("materials").innerHTML = materials;
  257. document.getElementById("consistence").innerHTML = consistence;
  258. document.getElementById("registry").innerHTML = registro;
  259. document.getElementById("owner").innerHTML = current_owner;
  260. document.getElementById("btn_owner").innerHTML = button_owner;
  261. document.getElementById("timeSpan").innerHTML = dates;
  262. });
  263. }
  264. function get_graph_name(graph) {
  265. var dataset = "Scheda Oggetto";
  266. if (graph == "http://dev.restore.ovi.cnr.it:8890/aspo/ospedale") {
  267. dataset = dataset + " / Ospedale";
  268. } else if (graph == "http://dev.restore.ovi.cnr.it:8890/aspo/datini") {
  269. dataset = dataset + " / Datini";
  270. } else if (graph == "http://dev.restore.ovi.cnr.it:8890/aspo/marcovaldi") {
  271. dataset = dataset + " / Marcovaldi";
  272. } else if (graph == "http://dev.restore.ovi.cnr.it:8890/aspo/gettatelli") {
  273. dataset = dataset + " / Gettatelli";
  274. } else {
  275. dataset = dataset;
  276. }
  277. return dataset;
  278. }
  279. function handle_objectInfo(json) {
  280. console.log(json['results']['bindings']);
  281. $.each(
  282. json['results']['bindings'],
  283. function (index, value) {
  284. var title = "";
  285. var type = "";
  286. var subject = "";
  287. if (value.hasOwnProperty('titolo')) {
  288. $("#titolo").css("display", "flex");
  289. title = value['titolo']['value'];
  290. }
  291. if (value.hasOwnProperty('tipo')) {
  292. $("#tipo").css("display", "flex");
  293. type = value['tipo']['value'];
  294. }
  295. if (value.hasOwnProperty('ref')) {
  296. if (value['ref']['value'] != "") {
  297. $("#argomento").css("display", "flex");
  298. subject = value['ref']['value'];
  299. }
  300. }
  301. document.getElementById("title").innerHTML = title;
  302. document.getElementById("type").innerHTML = type;
  303. document.getElementById("subject").innerHTML = subject;
  304. });
  305. }
  306. function handle_oviLetter(json) {
  307. console.log(json['results']['bindings']);
  308. $.each(
  309. json['results']['bindings'],
  310. function (index, value) {
  311. var other_id = "";
  312. var uri = "";
  313. var button_letter = "";
  314. if (value.hasOwnProperty('otherId')) {
  315. $("#IDbis").css("display", "flex");
  316. other_id = value['otherId']['value'];
  317. }
  318. if (value.hasOwnProperty('InfObj')) {
  319. uri = value['InfObj']['value'];
  320. }
  321. if (uri != "") {
  322. button_letter = '<button type="button" id="' + uri +
  323. '" class="lettera btn btn-default" alt="lettera"><i class="fa fa-envelope"></i><p class="btn-text">Scheda Lettera</p></button>';
  324. }
  325. document.getElementById("other_identifier").innerHTML = other_id;
  326. document.getElementById("btn_other_identifier").innerHTML = button_letter;
  327. });
  328. }
  329. /*
  330. function handle_citedPeople(json) {
  331. console.log(json);
  332. var Relazioni = "";
  333. const myArray = []
  334. $.each(
  335. json['results']['bindings'],
  336. function (index, value) {
  337. var uri_person = value['uri_person']['value'];
  338. var name = value['name']['value'];
  339. var tipo = "";
  340. var nota = "";
  341. if (value.hasOwnProperty('p_type')) {
  342. tipo = value['p_type']['value'];
  343. }
  344. if (value.hasOwnProperty('note')) {
  345. nota = "<br /><span class='nota_menzione'><i>" + value['note']['value'] + "</i></span>";
  346. }
  347. var string = name + nota;
  348. myArray.push([tipo, string, uri_person, nota]);
  349. });
  350. if (myArray.length == 0) {
  351. $("#placeholder_people").css("display", "none");
  352. }
  353. const checkRel = [];
  354. for (var i=0; i<myArray.length; i++) {
  355. var key = myArray[i][0];
  356. checkRel.push(key);
  357. }
  358. var params = [];
  359. $.each(checkRel, function(i, el){
  360. if($.inArray(el, params) === -1) params.push(el);
  361. });
  362. for (var i=0; i<params.length; i++) {
  363. var par = params[i];
  364. var par_id = par.replaceAll(" ", "_");
  365. var rel = createDivRelazione(par, par_id);
  366. Relazioni = Relazioni + rel;
  367. }
  368. $(Relazioni).insertAfter( "#placeholder_people" );
  369. for (var j=0; j<params.length; j++) {
  370. var el = params[j];
  371. var par = el.replaceAll(" ", "_");
  372. var Colums = "";
  373. for (var i=0; i<myArray.length; i++) {
  374. var text = myArray[i][1];
  375. var link = myArray[i][2];
  376. var declaration = ""
  377. if (myArray[i][3] != "") {
  378. declaration = "myMargin";
  379. }
  380. var rel = myArray[i][0].replaceAll(" ", "_");
  381. if (par == rel) {
  382. var col = createColRelazione(text, link, "persona", "fa fa-user", "Scheda Persona", declaration);
  383. Colums = Colums + col;
  384. }
  385. }
  386. document.getElementById(par).innerHTML = Colums;
  387. }
  388. }
  389. function handle_associatedDocuments(json) {
  390. console.log(json);
  391. var Sezioni = "";
  392. const myArray = []
  393. $.each(
  394. json['results']['bindings'],
  395. function (index, value) {
  396. var uri = value['card']['value'];
  397. var name = value['name_card']['value'];
  398. var tipo = "";
  399. if (value.hasOwnProperty('doc_type')) {
  400. tipo = value['doc_type']['value'];
  401. }
  402. myArray.push([tipo, name, uri]);
  403. });
  404. if (myArray.length == 0) {
  405. $("#placeholder_documents").css("display", "none");
  406. }
  407. const checkRel = [];
  408. for (var i=0; i<myArray.length; i++) {
  409. var key = myArray[i][0];
  410. checkRel.push(key);
  411. }
  412. var params = [];
  413. $.each(checkRel, function(i, el){
  414. if($.inArray(el, params) === -1) params.push(el);
  415. });
  416. for (var i=0; i<params.length; i++) {
  417. var par = params[i];
  418. var par_id = par.replaceAll(" ", "_");
  419. var rel = createDivRelazione(par, par_id);
  420. Sezioni = Sezioni + rel;
  421. }
  422. $(Sezioni).insertAfter( "#placeholder_documents" );
  423. for (var j=0; j<params.length; j++) {
  424. var el = params[j];
  425. var par = el.replaceAll(" ", "_");
  426. var Colums = "";
  427. for (var i=0; i<myArray.length; i++) {
  428. var text = myArray[i][1];
  429. var link = myArray[i][2];
  430. var rel = myArray[i][0].replaceAll(" ", "_");
  431. if (par == rel) {
  432. var col = createColRelazione(text, link, "object", "fa fa-book", "Scheda Oggetto", "");
  433. Colums = Colums + col;
  434. }
  435. }
  436. document.getElementById(par).innerHTML = Colums;
  437. }
  438. } */
  439. function handle_citedPeople(json) {
  440. console.log(json);
  441. const people = [];
  442. $.each(
  443. json['results']['bindings'],
  444. function (index, value) {
  445. var uri = value['uri_person']['value'];
  446. var name = value['name']['value'];
  447. var tipo = "";
  448. var nota = "";
  449. if (value.hasOwnProperty('p_type')) {
  450. tipo = value['p_type']['value'];
  451. }
  452. if (value.hasOwnProperty('note')) {
  453. nota = value['note']['value'];
  454. }
  455. people.push([uri, name, tipo, nota]);
  456. });
  457. var Person = "";
  458. for (var i=0; i<people.length; i++) {
  459. var object = '<a href=' + people[i][0] + ' target="_blank">' + people[i][1] + '</a>';
  460. if (people[i][2] != "") {
  461. object = object + "<br />Tipo: " + people[i][2];
  462. }
  463. if (people[i][3] != "") {
  464. object = object + "<br />Nota: " + people[i][3];
  465. }
  466. Person += /*INIZIO DIV*/ '<div class="row res"><div class="col-8">' +
  467. object + '</div>' +
  468. '<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="' +
  469. people[i][1] + '"><i class="fa fa-user"></i><p class="btn-text">Scheda Persona</p></button>' +
  470. '<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>' +
  471. /*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>' +
  472. /*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>';
  473. }
  474. document.getElementById("n_pp").innerHTML = people.length;
  475. document.getElementById("cited_people").innerHTML = Person;
  476. if (people.length==0) {
  477. var messaggio = "<p class='no-results'>Nessun risultato trovato</p>";
  478. document.getElementById("cited_people").innerHTML = messaggio;
  479. }
  480. }
  481. function handle_associatedDocuments(json) {
  482. console.log(json);
  483. const docs = [];
  484. $.each(
  485. json['results']['bindings'],
  486. function (index, value) {
  487. var uri = value['card']['value'];
  488. var label = value['name_card']['value'];
  489. var tipo = "";
  490. if (value.hasOwnProperty('doc_type')) {
  491. tipo = value['doc_type']['value'];
  492. }
  493. docs.push([uri, label, tipo]);
  494. });
  495. var Docs = "";
  496. for (var i=0; i<docs.length; i++) {
  497. var object = '<a href=' + docs[i][0] + ' target="_blank">' + docs[i][1] + '</a>';
  498. if (docs[i][2] != "") {
  499. object = object + "<br />Documento: " + docs[i][2];
  500. }
  501. var object_button = '<button type="button" id="' + docs[i][0] +
  502. '" class="object btn btn-default" alt="oggetto" title="' + docs[i][1] +
  503. '"><i class="fa fa-book"></i><p class="btn-text">Scheda Oggetto</p></button>';
  504. Docs += '<div class="row res"><div class="col-8"><p>'+ object +'</p></div>' +
  505. '<div class="col d-flex align-items-start justify-content-end">' + object_button +
  506. '<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>' +
  507. '<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>' +
  508. '<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>';
  509. }
  510. document.getElementById("n_sec").innerHTML = docs.length;
  511. document.getElementById("section_documents").innerHTML = Docs;
  512. if (docs.length==0) {
  513. var messaggio = "<p class='no-results'>Nessun risultato trovato</p>";
  514. document.getElementById("section_documents").innerHTML = messaggio;
  515. }
  516. }
  517. function createDivRelazione(type, id){
  518. htmlCode = '\
  519. <div class="row mb-2"> \
  520. <div class="col-sm-4"> \
  521. <span class="label"><RELATIONSHIP></span> \
  522. </div> \
  523. <div class="col record_box" id="<ID_RELATIONSHIP>"></div> \
  524. </div> \
  525. '.replace("<RELATIONSHIP>", type).replace("<ID_RELATIONSHIP>", id);
  526. return htmlCode;
  527. }
  528. function createColRelazione(text, link, tipo, fa, tab, decl) {
  529. htmlCode = '\
  530. <div class="row"> \
  531. <div class="col <CLASS>"><NAME></div> \
  532. <div class="col-auto"> \
  533. <button class="<TIPO> btn btn-default" type="button" id="<URI>">\
  534. <i class="<BUTTON>" aria-hidden="true">\
  535. <p class="btn-text"><TAB></p>\
  536. </i>\
  537. </button>\</div> \
  538. </div>\
  539. '.replace("<NAME>", text).replace("<URI>", link).replace("<TIPO>", tipo).replace("<BUTTON>", fa).replace("<TAB>", tab).replace("<CLASS>", decl);
  540. return htmlCode;
  541. }
  542. $(document).on("click", ".lettera", function (ev) {
  543. var link = this.id;
  544. //alert(nome_autore);
  545. //$('#myModal').text("");
  546. window.open("lettera.html?link="+this.id);
  547. });
  548. $(document).on("click", ".luogo", function (ev) {
  549. var link = this.id;
  550. //alert(nome_autore);
  551. //$('#myModal').text("");
  552. window.open("Luogo.html?link="+this.id);
  553. });
  554. $(document).on("click", ".persona", function (ev) {
  555. var link = this.id;
  556. //alert(nome_autore);
  557. //$('#myModal').text("");
  558. window.open("Persona.html?link="+this.id);
  559. });
  560. $(document).on("click", ".object", function (ev) {
  561. var link = this.id;
  562. //alert(nome_autore);
  563. //$('#myModal').text("");
  564. window.open("object.html?link="+this.id);
  565. });
  566. function schedaASPO(info){
  567. window.open(info);
  568. }