-
Notifications
You must be signed in to change notification settings - Fork 1
/
eventdetails.html
110 lines (91 loc) · 3.58 KB
/
eventdetails.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Agenda Unica del Movimento Catanese</title>
<link rel="alternate" type="application/rss+xml" href="rdfevents2rss.php" title="opendatahacklab events feed">
<script type="text/javascript" src="../sparql_suite/sparql_processor.js"></script>
<script type="text/javascript" src="../sparql_suite/event_sparql_processor.js"></script>
<link rel="stylesheet" type="text/css" href="mystyle.css">
</head>
<body>
<header class="main-header">
<h1 id="maintitle"></h1>
</header>
<section id="eventdetail">
<p class="loading" id="loading">Loading ...</p>
</section>
<script type="text/javascript">
//the function responsible to print event information
var processEventFunction = function(event)
{
//check if the event has a event place
var isEventPlaceHere = false;
//replace titles
var titleLower=event.eventName;
document.getElementById("maintitle").appendChild(document.createTextNode(titleLower));
//document.getElementById("eventinbreadcrumb").appendChild(
// document.createTextNode(titleLower));
//put event details in the specified section
var container = document.getElementById("eventdetail");
container.removeChild(document.getElementById("loading"));
var time = document.createElement("p");
var timeStart = new Date(event.timeStart);
time.className="eventtime";
time.appendChild(document.createTextNode(timeStart.toLocaleDateString()+" - "+
timeStart.toLocaleTimeString(navigator.language, {hour: '2-digit', minute:'2-digit'})));
container.appendChild(time);
var address = document.createElement("p");
if(event.eventPlace)
{
var eventPlace = document.createElement("em");
eventPlace.appendChild(document.createTextNode(event.eventPlace));
isEventPlaceHere = true;
}
address.className="eventaddress";
//address.appendChild(document.createTextNode(event.address));
isEventPlaceHere == true ? address.appendChild(document.createTextNode(event.address + " - ")) : address.appendChild(document.createTextNode(event.address));
if(isEventPlaceHere)
{
address.appendChild(eventPlace);
}
container.appendChild(address);
if(event.description != null){
var description = document.createElement("p");
description.className="eventdescription";
description.appendChild(document.createTextNode(event.description));
container.appendChild(description);
}
if (event.posts!=null && event.posts.lenght>0){
var postsTitle=document.createElement("h2");
h2.className="posts";
postTitle.appendChild(document.createTextNode("Related Posts"));
container.appendChild(postTitle);
var postList=document.createElemet("ul");
container.appendChild(postList);
for(var i=0; i<event.posts.lenght; i++){
var postValue = event.posts[i];
var postItem=document.createElement("li");
postList.appendChild(postItem);
var a = document.createElement("a");
a.href=postValue.URI;
a.appendChild(document.createTextNode(postValue.title));
postItem.appendChild(a);
}
}
};
//retrieve the eventIRI from parameters
var eventIRI = location.search.split('?iri=')[1];
if (eventIRI==null)
window.alert("No event IRI provided.");
else{
var eventIRIdecoded=decodeURIComponent(eventIRI);
var p = new SingleEventQueryProcessor(eventIRIdecoded, processEventFunction, function(event){
window.alert("No such event "+eventIRIdecoded);
});
sparql_query("http://dydra.com/cristianolongo/agenda-unica-ct/sparql", p);
}
</script>
<a class="back" href="index.php">Torna ad Agenda Unica</a>
</body>
</html>