-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathcalendar.html
427 lines (373 loc) · 20.1 KB
/
calendar.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
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
<!--
Author: W3layouts
Author URL: http://w3layouts.com
License: Creative Commons Attribution 3.0 Unported
License URL: http://creativecommons.org/licenses/by/3.0/
-->
<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title> SNAIL | Calendar </title>
<link href="css/bootstrap.css" rel='stylesheet' type='text/css' />
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="js/jquery.min.js"></script>
<!-- Custom Theme files -->
<!---- animated-css ---->
<link href="css/animate.css" rel="stylesheet" type="text/css" media="all">
<script src="js/wow.min.js"></script>
<script>
new WOW().init();
</script>
<!---- animated-css ---->
<link href="css/style.css" rel='stylesheet' type='text/css' />
<!-- Custom Theme files -->
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
</script>
<!----webfonts--->
<link href='http://fonts.googleapis.com/css?family=Open+Sans:400,300,600,700,800' rel='stylesheet' type='text/css'>
<!---//webfonts--->
<!----Back to top--->
<link rel="stylesheet" href="css/backtop.css"> <!-- Gem style -->
<script src="js/modernizr.js"></script> <!-- Modernizr -->
<!----//Back to top--->
<!-- qTip -->
<link href="css/qtip.min.css" rel='stylesheet' />
<script type='text/javascript' src="js/qtip.min.js"></script>
<!--// qTip -->
<!-- Full Calendar -->
<link href="css/fullcalendar.min.css" rel='stylesheet' />
<script type='text/javascript' src="js/moment.min.js"></script>
<script type='text/javascript' src="js/fullcalendar.min.js"></script>
<script type='text/javascript' src='js/gcal.js'></script>
<script type="text/javascript">
var clientId = '508957639999-jkb9s99df85ajoies54kk7509fmgcbns.apps.googleusercontent.com';
var apiKey = 'AIzaSyDzYo2E9RK4Xcz9zV313M7Bax7vq5JHUtM';
var scopes = 'https://www.googleapis.com/auth/calendar';
function handleClientLoad() {
gapi.client.setApiKey(apiKey);
window.setTimeout(checkAuth,1);
}
function checkAuth() {
gapi.auth.authorize({client_id: clientId, scope: scopes, immediate: true}, handleAuthResult);
}
function handleAuthResult(authResult) {
var authorizeButton = document.getElementById('authorize-button');
if (authResult && !authResult.error) {
authorizeButton.style.visibility = 'hidden';
makeApiCall();
} else {
authorizeButton.style.visibility = '';
authorizeButton.onclick = handleAuthClick;
GeneratePublicCalendar();
}
}
function handleAuthClick(event) {
gapi.auth.authorize({client_id: clientId, scope: scopes, immediate: false}, handleAuthResult);
return false;
}
// Load the API and make an API call. Display the results on the screen.
function makeApiCall() {
// Step 4: Load the Google+ API
gapi.client.load('calendar', 'v3').then(function() {
// Step 5: Assemble the API request
var request = gapi.client.calendar.events.list({
'calendarId': '[email protected]'
});
// Step 6: Execute the API request
request.then(function(resp) {
var eventsList = [];
var successArgs;
var successRes;
if (resp.result.error) {
reportError('Google Calendar API: ' + data.error.message, data.error.errors);
}
else if (resp.result.items) {
$.each(resp.result.items, function(i, entry) {
var url = entry.htmlLink;
// make the URLs for each event show times in the correct timezone
//if (timezoneArg) {
// url = injectQsComponent(url, 'ctz=' + timezoneArg);
//}
eventsList.push({
id: entry.id,
title: entry.summary,
start: entry.start.dateTime || entry.start.date, // try timed. will fall back to all-day
end: entry.end.dateTime || entry.end.date, // same
url: url,
location: entry.location,
description: entry.description
});
});
// call the success handler(s) and allow it to return a new events array
successArgs = [ eventsList ].concat(Array.prototype.slice.call(arguments, 1)); // forward other jq args
successRes = $.fullCalendar.applyAll(true, this, successArgs);
if ($.isArray(successRes)) {
return successRes;
}
}
if(eventsList.length > 0)
{
// qTip2
var tooltip = $('<div/>').qtip({
id: 'fullcalendar',
prerender: true,
content: {
text: ' ',
title: ' ',
},
position: {
my: 'bottom center',
at: 'top center',
target: 'event',
viewport: $('#calendar'),
adjust: {
mouse: false,
scroll: false
}
},
show: false,
hide: 'unfocus',
style: 'qtip-dark'
}).qtip('api');
// Full calendar with google.
$('#calendar').fullCalendar({
eventClick: function(data, event, view) {
var title = '<h4 style="color:#fe5433;">'+data.title+'</h4>' ;
var content = '<p><b>Start:</b> '+moment(data.start._d).utc().format('ddd MMM D YYYY HH:mm')+'</br>' +
(data.end && '<p><b>End:</b> '+moment(data.end._d).utc().format('ddd MMM D YYYY HH:mm')+'</p></br>' || '');
// Check if the event have a description
if(data.description){
// Check if inside description tag ## is found (That means attachments are linked)
if(data.description.search("##") > 0){
// Split description into array [0] = text, [i] where i = 1,.... = Attachements
var descArray = data.description.split("##");
// Insert description text before.
content += '<p><b>Description:</br></br></b> '+descArray[0]+'</p></br></br>';
content += '<p><b>Attachments :</br></b>';
// Loop on all attachments
for (i = 1; i < descArray.length; i++) {
// The attachments are store like this AttachementsName:GoogleDriveId
var googleId = descArray[i].split(":");
// Display the attachments name and image to view and download the contain.
content += googleId[0] + ' : ';
content += '<a href="https://drive.google.com/open?id=' + googleId[1] + '&authuser=0"><img src="images/viewIconv2.png"></img></a>';
content += '<a href="https://drive.google.com/uc?export=download&id=' + googleId[1] + '&authuser=0"><img src="images/downloadIconv2.png" style="margin:5px;"></img></a>';
content += '</br>';
}
content += '</br></br>';
}
else
{
content += '<p><b>Description:</br></br></b> '+data.description+'</p></br>';
}
}
// Add the url to the google event.
content += '<p><a style="color:#fe5433;" href="' + data.url +'">For more information</a></p>';
tooltip.set({
'content.text': content,
'content.title':title
})
.reposition(event).show(event);
// Return false, to stay on this page.
return false;
},
dayClick: function() { tooltip.hide() },
eventResizeStart: function() { tooltip.hide() },
eventDragStart: function() { tooltip.hide() },
viewDisplay: function() { tooltip.hide() },
dragScroll: function() { tooltip.hide() },
events: eventsList,
height: "auto",
header: {
left : 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
defaultView: 'month'
});
// TODO : Call a refresh on calendar ? Or try to avoid to recreate the calendar again by removing events.
}
return eventsList;
}, function(reason) {
console.log('Error: ' + reason.result.error.message);
});
});
}
function GeneratePublicCalendar(){
// qTip2
var tooltip = $('<div/>').qtip({
id: 'fullcalendar',
prerender: true,
content: {
text: ' ',
title: ' ',
},
position: {
my: 'bottom center',
at: 'top center',
target: 'event',
viewport: $('#calendar'),
adjust: {
mouse: false,
scroll: false
}
},
show: false,
hide: 'unfocus',
style: 'qtip-dark'
}).qtip('api');
// Full calendar with google.
$('#calendar').fullCalendar({
googleCalendarApiKey: 'AIzaSyDzYo2E9RK4Xcz9zV313M7Bax7vq5JHUtM',
eventClick: function(data, event, view) {
var title = '<h4 style="color:#fe5433;">'+data.title+'</h4>' ;
var content = '<p><b>Start:</b> '+moment(data.start._d).utc().format('ddd MMM D YYYY HH:mm')+'</br>' +
(data.end && '<p><b>End:</b> '+moment(data.end._d).utc().format('ddd MMM D YYYY HH:mm')+'</p></br>' || ''); 1
// Check if the event have a description
if(data.description){
// Check if inside description tag ## is found (That means attachments are linked)
if(data.description.search("##") > 0){
// Split description into array [0] = text, [i] where i = 1,.... = Attachements
var descArray = data.description.split("##");
// Insert description text before.
content += '<p><b>Description:</br></br></b> '+descArray[0]+'</p></br></br>';
content += '<p><b>Attachments :</br></b>';
// Loop on all attachments
for (i = 1; i < descArray.length; i++) {
// The attachments are store like this AttachementsName:GoogleDriveId
var googleId = descArray[i].split(":");
// Display the attachments name and image to view and download the contain.
content += googleId[0] + ' : ';
content += '<a href="https://drive.google.com/open?id=' + googleId[1] + '&authuser=0" target="_blank"><img src="images/viewIconv2.png"></img></a>';
content += '<a href="https://drive.google.com/uc?export=download&id=' + googleId[1] + '&authuser=0"><img src="images/downloadIconv2.png" style="margin:5px;"></img></a>';
content += '</br>';
}
content += '</br></br>';
}
else
{
content += '<p><b>Description:</br></br></b> '+data.description+'</p></br>';
}
}
// Add the url to the google event.
content += '<p><a style="color:#fe5433;" href="' + data.url +'" target="_blank">For more information</a></p>';
tooltip.set({
'content.text': content,
'content.title':title
})
.reposition(event).show(event);
// Return false, to stay on this page.
return false;
},
dayClick: function() { tooltip.hide() },
eventResizeStart: function() { tooltip.hide() },
eventDragStart: function() { tooltip.hide() },
viewDisplay: function() { tooltip.hide() },
dragScroll: function() { tooltip.hide() },
events: {
googleCalendarId: '[email protected]'
},
height: "auto",
header: {
left : 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
defaultView: 'month'
});
}
</script>
<script src="https://apis.google.com/js/client.js?onload=handleClientLoad"></script>
</head>
<body>
<div class="bg">
<div class="container">
<!----- start-header---->
<div id="home" class="header" data-wow-delay="0.4s>
<div class="top-header">
<div class="logo" data-wow-delay="0.4s">
<a href="index.html"><img src="images/logo4.png" title="dreams" /></a>
</div>
<!----start-top-nav---->
<nav class="top-nav" data-wow-delay="0.4s">
<span class="menu"> </span>
<ul class="top-nav">
<li><a href="index.html" class="scroll">Home</a></li>
<li class="active"><a href="calendar.html">Calendar</a></li>
<li><a href="publications.html">Publications</a></li>
<li><a href="project.html">Project</a></li>
<li><a href="team.html">Lab members</a></li>
<li><a href="photo.html">Gallery</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
</nav>
<script>
$("span.menu").click(function(){
$(".top-nav ul").slideToggle(200);
});
</script>
<div class="clearfix"> </div>
</div>
</div>
</div>
<!----- //End-header---->
</br>
</br>
<!----- mid-grids ----->
<div class="container">
<h3>Group calendar</h3></br>
<p> Here you can see all of our events. If you are not members of the group you are always welcome to join us for the events displayed. Note that attachments can be added to events.</p></br>
<button id="authorize-button" style="visibility: hidden">Show private events</button></br></br>
<div id='calendar'></div>
</div>
<!----- mid-grids ----->
</br>
</br>
<a href="#0" class="cd-top">Top</a>
<script src="js/backtop.js"></script> <!-- Gem jQuery -->
<!---- footer ---->
<div class="footer">
<div class="container">
<div class="footer-grids">
<div class="col-md-3 footer-grid ftr-sec wow fadeInLeft" data-wow-delay="0.4s">
<h3>Navigation</h3>
<ul>
<li><a href="index.html">Home</a></li>
<li><a href="calendar.html">Calendar</a></li>
<li><a href="publications.html">Publications</a></li>
<li><a href="project.html">Projects</a></li>
<li><a href="team.html">Lab members</a></li>
<li><a href="photo.html">Gallery</a></li>
<li><a href="contact.html">Contact</a></li>
</ul>
</div>
<!--
<div class="col-md-3 footer-grid ftr-sec wow fadeInRight" data-wow-delay="0.4s">
<h3>Follows</h3>
<ul class="social-icons">
<li><a class="twitter" href="#"><span> </span>twitter</a></li>
<li><a class="facebook" href="#"><span> </span>Facebook</a></li>
<li><a class="googlepluse" href="#"><span> </span>google+</a></li>
</ul>
</div>
-->
<div class="col-md-3 footer-grid ftr-sec ftr wow fadeInRight" data-wow-delay="0.4s">
<h3>Our Location</h3>
<ul class="location">
<li><a class="hm"><span> </span> CHUS - Faculté de médecine et des sciences de la santé
3001, 12e avenue Nord
Sherbrooke (Qc) J1H 5N4
Canada </a></li>
<!--<li><a class="phn" href="#"><span> </span> Phone : ?</a></li>-->
</ul>
</div>
<div class="clearfix"> </div>
</div>
<p class="copy-right wow fadeInRight" data-wow-delay="0.4s"">2014 © Design by <a href="http://w3layouts.com/">W3layouts</a></p>
</div>
</div>
<!---- footer ---->
</body>
</html>