My favorites
▼
|
Sign in
fullcalendar
ISSUE TRACKER HAS MOVED. DO NOT USE THIS (more info)
Project Home
Issues
Export to GitHub
New issue
Search
Search within:
All issues
Open issues
New issues
Issues to verify
for
Advanced search
Search tips
Subscriptions
Issue
1113
attachment: LabCalender.htm
(7.6 KB)
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" manifest="LabCalender.manifest">
<head>
<title>Health Informatics Calender</title>
<link rel='Stylesheet' type='text/css' href='./Style/theme.css' />
<link rel='stylesheet' type='text/css' href='./Style/fullcalendar.print.css' media='print'/>
<link rel='stylesheet' type='text/css' href='./Style/fullcalendar.css' />
<script type='text/javascript' src='./Scripts/jquery-1.6.2.min.js'></script>
<script type='text/javascript' src='./Scripts/json2.js'></script>
<script type="text/javascript" src="Scripts/jquery-ui-1.8.11.custom.min.js"></script>
<script type='text/javascript' src='./Scripts/fullcalendar.js'></script>
<script type='text/javascript'>
//**********************************************************************************************************
// MAIN CONTROLLING FUNCTION
//**********************************************************************************************************
//Set up controling .ready() function which calls the other functions and set it to run every 90 mins nutes
$(document).ready(function () {
render();
getdata();
window.setInterval("getdata()", 5400000);
window.setInterval("testsupport()", 300000);
});
//**************************************************************
// MAIN CALENDER FUNCTIONS - RENDER CALENDER + GET DATA
//**************************************************************
// RENDER CALENDER: Set up the render() with data from Local store function
function render() {
var calevents = JSON.parse(localStorage.getItem('calender'))
//Remove calender
$('#calendar').empty();
//Update version
$('#version').html("<b>Last Updated: </b>" + localStorage.getItem('version'));
//Call test support to see if offline is supported here
testsupport();
//Get new calender
$('#calendar').fullCalendar({
theme: true,
defaultView: 'agendaDay',
firstDay: 1,
editable: true,
weekends: false,
firstHour: 8,
height: $('#calendar-wrap').height(),
//height: 700,
//contentHeight: 750,
//aspectRation: 0.5,
columnFormat: {
month: 'ddd',
week: 'ddd d/M',
day: 'dddd d/M'
},
header: {
left: 'prev,next today',
center: 'title',
right: 'agendaDay, agendaWeek, month'
},
//Pass new data to callback
events: function (start, end, callback) {
callback(calevents)
},
//format and populate the main body with Title and Description
eventRender: function (event, element) {
element.find(".fc-event-content").text(event.title + event.description);
element.find(".fc-event-time").append(" (" + event.title + ")");
},
//Warn if event is dropped
eventDrop: function (event, delta) {
alert(event.title + ' was moved ' + delta + ' days\n' +
'(should probably update your database)');
},
// show if loading
loading: function (bool) {
if (bool) $('#loading').show();
else $('#loading').hide();
}
});
}
// GET DATA: Set up the getdata() if online and save to local store function - Call Render
function getdata() {
if (navigator.onLine) {
//Format and set date time values to version
var versiondate = getformatdate();
// If run for first time set version date
if (localStorage.getItem('version') == null) {
localStorage.setItem('version', versiondate);
};
//Set up Source URL - Mobile or network
var soureceURL = "";
if (screen.width < 500 ||
navigator.userAgent.match(/iPad/i) ||
navigator.userAgent.match(/iPhone/i) ||
navigator.userAgent.match(/iPod/i) ||
navigator.userAgent.match(/BlackBerry/i) ||
navigator.userAgent.match(/Android/i)){
sourceURL = "http://137.44.141.212/OutputCalender"
}
else{
sourceURL = "http://brain:999/OutputCalender"
}
//Get the latest calender data after setting ajax cache to false localhost:17994
$.ajaxSetup({ cache: false });
$.getJSON(sourceURL,
function (result) {
if (result != null) {
for (i in result) {
var calEvent = result[i];
calEvent.start = new Date(parseInt(calEvent.start.replace("/Date(", "").replace(")/", ""), 10));
calEvent.start = changetolocal(calEvent.start);
calEvent.end = new Date(parseInt(calEvent.end.replace("/Date(", "").replace(")/", ""), 10));
calEvent.end = changetolocal(calEvent.end);
}
//Populate offline storage with result as data in key data pair
localStorage.setItem('calender', JSON.stringify(result));
//Update the version date to take account of successful data update
localStorage.setItem('version', versiondate);
//Call render calender with new values
render();
testsupport();
}
//No result so do nothing
}
);
};
};
//******************************************************************************************************************
//THE FOLLOWING ARE UI SUPPORT FUNTIONS ANT NOT MAIN DATA STUFF - OFFLINE OPERATIONS (x2) and DATE FORMATTING (x2)
//******************************************************************************************************************
// OFFLINE 1: Does the browser support offline operations?
function testsupport() {
if (window.applicationCache) {
$('#onlinesupport').html("Offline operations are supported by your browser - " + areweonline());
}
else {
$('#onlinesupport').html("Offline operations are not supported by your browser - " + areweonline());
}
}
// OFFLINE 2: Are we online or offline?
function areweonline() {
var online = "";
if (navigator.onLine) {
online = "You are currently Online";
}
else {
online = "You are currently Offline";
}
return online;
}
// DATE FORMTTING 1: Change to system time zone and allows for BST or Daylighty saving time
function changetolocal(localDate) {
return new Date(localDate.getFullYear(), localDate.getMonth(), localDate.getDate(), (localDate.getHours() ), localDate.getMinutes() - localDate.getTimezoneOffset());
}
// DATE FORMTTING 2: Format todays date for the version of data downloaded
function getformatdate() {
var td = new Date();
var cDay = (td.getDate() < 10 ? "0" : "") + td.getDate();
var cMonth = ((td.getMonth() + 1) < 10 ? "0" : "") + (td.getMonth() + 1);
var cYear = td.getFullYear();
var cHour = td.getHours();
var cHour = (td.getHours() > 12) ? td.getHours() - 12 : td.getHours();
var suffix = (td.getHours() < 12) ? "AM" : "PM";
var cMinute = (td.getMinutes() < 10 ? "0" : "" ) + (td.getMinutes());
//Format and set date time values for version
var newDate = cDay + "/" + cMonth + "/" + cYear + " at " + cHour + ":" + cMinute + " " + suffix;
return newDate
};
</script>
<!-- Override some style stuff via cascading -->
<style type='text/css'>
body {
margin-top: 2.2em;
text-align: center;
font-size: 1.2em;
font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
}
#calendar {
width: 50%;
margin: 0 auto;
}
</style>
</head>
<body>
<h1>Health Informatics Research Laboratory</h1>
<!-- Calender goes here -->
<div id="calendar"></div>
<!-- date of latest version goes here -->
<div id="version"></div>
<!-- Test for Browser support of Offline -->
<div id="onlinesupport"></div>
</body>
</html>
Powered by
Google Project Hosting