]> code.delx.au - comingnext/blob - comingNext/index.html
updated readme, prepared for v1.28 release. Also added missing release date to v1.27
[comingnext] / comingNext / index.html
1 <?xml version="1.0" encoding="UTF-8"?>
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
4 <head>
5
6 <title>Coming Next</title>
7
8 <style type="text/css">
9 /* The following classes can be modified by widget settings */
10 .background { }
11 .backgroundFullscreen { }
12 .weekDay { }
13 .date { }
14 .today { }
15 .tomorrow { }
16 .time { }
17 .now { }
18 .description { }
19 .icon { }
20 .overdue {}
21 </style>
22
23 <script type="text/javascript" src="localizedTextStrings.js" charset="utf-8" />
24
25 <script>
26 // valid types for the config object are 'Int', 'Bool', 'String', 'Enum', 'UID'
27 var config = {
28 monthRange: { Type: 'Int', Default: 2, Value: 2,},
29 includeTodos: { Type: 'Bool', Default: true, Value: true,},
30 useBackgroundImage: { Type: 'Bool', Default: true, Value: true,},
31 backgroundImageLocation: { Type: 'Enum', Default: 'internal', Value: 'internal', ValidValues: ['internal', 'external']},
32 showCombinedDateTime: { Type: 'Bool', Default: false, Value: false,},
33 showLocation: { Type: 'Bool', Default: true, Value: true,},
34 showTodayAsText: { Type: 'Bool', Default: true, Value: true,},
35 todayText: { Type: 'String', Default: getLocalizedText('settings.default.todayText'), Value: getLocalizedText('settings.default.todayText'),},
36 tomorrowText: { Type: 'String', Default: getLocalizedText('settings.default.tomorrowText'), Value: getLocalizedText('settings.default.tomorrowText'),},
37 showNowAsText: { Type: 'Bool', Default: true, Value: true,},
38 nowText: { Type: 'String', Default: getLocalizedText('settings.default.nowText'), Value: getLocalizedText('settings.default.nowText'),},
39 markOverdueTodos: { Type: 'Bool', Default: true, Value: true,},
40 overdueText: {Type: 'String', Default: getLocalizedText('settings.default.overdueText'), Value: getLocalizedText('settings.default.overdueText'),},
41 dateSeparator: { Type: 'String', Default: getLocalizedText('settings.default.dateSeparator'), Value: getLocalizedText('settings.default.dateSeparator'),},
42 dateFormat: { Type: 'Enum', Default: 'auto', Value: 'auto', ValidValues: ['auto', 'DDMM', 'MMDD'],},
43 weekDayLength: { Type: 'Int', Default: 2, Value: 2,},
44 updateDataInterval: { Type: 'Int', Default: 5, Value: 5,},
45 calendarApp: { Type: 'UID', Default: 0x10005901, Value: 0x10005901,},
46 eventsPerWidget: { Type: 'Int', Default: 4, Value: 4,},
47 showNothingText: { Type: 'Bool', Default: true, Value: true,},
48 nothingText: { Type: 'String', Default: getLocalizedText('settings.default.nothingText'), Value: getLocalizedText('settings.default.nothingText'),},
49 enableDaylightSaving: { Type: 'Bool', Default: true, Value: true,},
50 hideWidgetOnCalendarOpen: { Type: 'Bool', Default: false, Value: false,},
51 cssStyle_background: { Type: 'String', Default: 'color:#ffffff; background-color:#000000', Value: 'color:#ffffff; background-color:#000000',},
52 cssStyle_backgroundFullscreen: { Type: 'String', Default: 'color:#ffffff; background-color:#000000', Value: 'color:#ffffff; background-color:#000000',},
53 cssStyle_weekDay: { Type: 'String', Default: '', Value: '',},
54 cssStyle_date: { Type: 'String', Default: '', Value: '',},
55 cssStyle_today: { Type: 'String', Default: 'color:#ff0000', Value: 'color:#ff0000',},
56 cssStyle_tomorrow: { Type: 'String', Default: 'color:#0000ff', Value: 'color:#0000ff',},
57 cssStyle_time: { Type: 'String', Default: '', Value: '',},
58 cssStyle_now: { Type: 'String', Default: 'color:#ff00ff', Value: 'color:#ff00ff',},
59 cssStyle_description: { Type: 'String', Default: '', Value: '',},
60 cssStyle_icon: { Type: 'String', Default: 'width:15px; height:15px', Value: 'width:15px; height:15px',},
61 cssStyle_overdue: { Type: 'String', Default: 'color:#ffff00', Value: 'color:#ffff00',},
62 }
63
64
65
66 //-------------------------------------------------------
67 // Nothing of interest from here on...
68 //-------------------------------------------------------
69 var panelNum = 0; // use 1 for second panel
70 var version = "1.28";
71 var versionURL = "http://comingnext.sourceforge.net/version.xml";
72 var calendarService = null;
73 var cacheEntriesHtml = [];
74 var months_translated = [];
75 var orientation = '';
76 var now = new Date();
77 var mode = 0; // 0 = homescreen, 1 = fullscreen, 2 = settings, 3 = about, 4 = check for update
78 var reqV = null;
79 var settingsCalEntryId = null;
80 var settingsCache = null;
81 var notificationRequest1;
82 var notificationRequest2;
83
84 // vars for daylight saving time
85 var daylightsavingWinter = 0;
86 var daylightsavingSummer = 0;
87 var summertime = false;
88
89 window.onload = init;
90 window.onresize = updateScreen;
91 window.onshow = updateScreen;
92
93 function isLeapYear( year ) {
94 if (( year % 4 == 0 && year % 100 != 0 ) || year % 400 == 0 )
95 return true;
96 else
97 return false;
98 }
99
100 function calcLeapYear(year, days)
101 {
102 if (isLeapYear(year))
103 return ++days;
104 else
105 return days;
106 }
107
108 function subToSunday(myDate, year, days, prevMonthDays)
109 {
110 for (i = myDate.getDay(); i > 0 ;i--)
111 days--;
112 days -= prevMonthDays;
113 days = isLeapYear(year) ? --days : days;
114 return days;
115 }
116
117 function calcDaylightSaving()
118 {
119 var thisYearS = new Date(now.getFullYear(), 3, 0, 0, 0, 0 );
120 var thisYearW = new Date(now.getFullYear(), 10, 0, 0, 0, 0 );
121 var nextYearS = new Date(now.getFullYear() + 1, 3, 0, 0, 0, 0 );
122 var nextYearW = new Date(now.getFullYear() + 1, 10, 0, 0, 0, 0 );
123 var summer = false;
124 var winter = false;
125
126 thisYearSDays = nextYearSDays = 90;
127 thisYearWDays = nextYearWDays = 304;
128
129 thisYearSDays = calcLeapYear(now.getFullYear(), thisYearSDays);
130 thisYearWDays = calcLeapYear(now.getFullYear(), thisYearWDays);
131 nextYearSDays = calcLeapYear(now.getFullYear() + 1, nextYearSDays);
132 nextYearWDays = calcLeapYear(now.getFullYear() + 1, nextYearWDays);
133
134 thisYearSDays = subToSunday(thisYearS, now.getFullYear(), thisYearSDays, 59);
135 thisYearWDays = subToSunday(thisYearW, now.getFullYear(), thisYearWDays, 273);
136 nextYearSDays = subToSunday(nextYearS, now.getFullYear() + 1, nextYearSDays, 59);
137 nextYearWDays = subToSunday(nextYearW, now.getFullYear() + 1, nextYearWDays, 273);
138
139 daylightsavingSummer = new Date (now.getFullYear(), 03-1, thisYearSDays, 2, 0, 0);
140 daylightsavingWinter = new Date (now.getFullYear(), 10-1, thisYearWDays, 2, 0, 0);
141 if (daylightsavingSummer < now) {
142 daylightsavingSummer = new Date (now.getFullYear()+1, 03-1, nextYearSDays, 2, 0, 0);
143 var summer = true;
144 }
145 if (daylightsavingWinter < now) {
146 daylightsavingWinter = new Date (now.getFullYear()+1, 10-1, nextYearWDays, 2, 0, 0);
147 var winter = true;
148 }
149 if (summer && !winter)
150 summertime = true;
151 else
152 summertime = false;
153 }
154
155 function error(message)
156 {
157 console.info('Error: ' + message);
158 document.getElementById("calendarList").innerHTML = 'Error: ' + message;
159 }
160
161 function areDatesEqual(date1, date2)
162 {
163 return (date1.getFullYear() == date2.getFullYear() &&
164 date1.getMonth() == date2.getMonth() &&
165 date1.getDate() == date2.getDate());
166 }
167
168 function isTomorrow(date)
169 {
170 // tommorow = now + 1 day
171 // ToDo: some days can be shorter as 24 hours(daylight saving change day)
172 return areDatesEqual(date, new Date (now.getTime() + 24*60*60*1000));
173 }
174
175 function isToday(date)
176 {
177 return areDatesEqual(date, now);
178 }
179
180 function collectLocales()
181 {
182 var tmpyear = 2000 + panelNum;
183 var month = 0;
184
185 if (months_translated.length > 0)
186 return;
187 for (month = 0; month < 12; month++) {
188 var startDate = new Date(tmpyear, month, 15);
189
190 var item = new Object();
191 item.Type = "DayEvent";
192 item.StartTime = startDate;
193 item.Summary = "__temp" + month;
194
195 var criteria = new Object();
196 criteria.Type = "CalendarEntry";
197 criteria.Item = item;
198
199 try {
200 var result = calendarService.IDataSource.Add(criteria);
201 if (result.ErrorCode)
202 error(result.ErrorMessage);
203 } catch (e) {
204 error("collectLocales: " + e + ', line ' + e.line);
205 }
206 }
207 try {
208 var startTime = new Date(tmpyear,0,1);
209 var endTime = new Date(tmpyear,11,31);
210 var listFiltering = {
211 Type:'CalendarEntry',
212 Filter:{
213 StartRange: startTime,
214 EndRange: endTime,
215 SearchText: '__temp',
216 Type: 'DayEvent'
217 }
218 }
219 var result = calendarService.IDataSource.GetList(listFiltering);
220 if (result.ErrorCode) {
221 error(result.ErrorMessage);
222 return;
223 }
224 var list = result.ReturnValue;
225 } catch(e) {
226 error(e + ', line ' + e.line);
227 return;
228 }
229 var ids = new Array();
230 try {
231 var entry;
232 var counter = 0;
233 var dateArr = [];
234
235 while (list && (entry = list.getNext()) != undefined) {
236 dateArr = entry.StartTime.replace(/,/g,'').replace(/\./g,':').replace(/ /g,' ').split(' ');
237 var day = dateArr[1];
238 var month = dateArr[2];
239 var year = dateArr[3];
240
241 // make sure month is set properly
242 if (isNaN(parseInt(day))) {
243 var tmp = day;
244 day = month;
245 month = tmp;
246 } else if (isNaN(parseInt(year))) {
247 var tmp = year;
248 year = month;
249 month = tmp;
250 }
251
252 console.info(entry.StartTime + ' -> ' + month + ' ' + counter);
253 ids[counter] = entry.id;
254 months_translated[month] = counter + 1;
255 counter++;
256 }
257 } catch(e) {
258 error(e + ', line ' + e.line);
259 return;
260 }
261 console.info(ids);
262 try {
263 var criteria = new Object();
264 criteria.Type = "CalendarEntry";
265 criteria.Data = {
266 IdList: ids
267 }
268
269 var result = calendarService.IDataSource.Delete(criteria);
270 if (result.ErrorCode)
271 error(result.ErrorMessage);
272 } catch(e) {
273 error('deleting temp calendar entries:' + e + ', line ' + e.line);
274 return;
275 }
276 }
277
278 function requestNotification()
279 {
280 var criteria = new Object();
281 criteria.Type = "CalendarEntry";
282
283 try {
284 notificationRequest1 = calendarService.IDataSource.RequestNotification(criteria, callback);
285 if (notificationRequest1.ErrorCode)
286 error('requestNotification failed with error code ' + notificationRequest1.ErrorCode);
287 } catch (e) {
288 error("requestNotification: " + e + ', line ' + e.line);
289 }
290
291 var criteria2 = new Object();
292 criteria2.Type = "CalendarEntry";
293 criteria2.Filter = new Object();
294 criteria2.Filter.LocalIdList = new Array();
295 criteria2.Filter.LocalIdList[0] = settingsCalEntryId;
296
297 try {
298 notificationRequest2 = calendarService.IDataSource.RequestNotification(criteria2, settingsCallback);
299 if (notificationRequest2.ErrorCode)
300 error('requestNotification failed with error code ' + notificationRequest2.ErrorCode);
301 } catch (e) {
302 error("requestNotification: " + e + ', line ' + e.line);
303 }
304 }
305
306 function callback(transId, eventCode, result)
307 {
308 console.info("callback(): panelNum: %d transId: %d eventCode: %d result.ErrorCode: %d", panelNum, transId, eventCode, result.ErrorCode);
309 updateData();
310 }
311
312 function settingsCallback(transId, eventCode, result)
313 {
314 console.info("settingsCallback(): panelNum: %d transId: %d eventCode: %d result.ErrorCode: %d", panelNum, transId, eventCode, result.ErrorCode);
315 loadSettings();
316 }
317
318 function parseDate(dateString)
319 {
320 /*
321 Dates my look very differently. Also keep in mind that the names are localized!!! These are the possibilities depending on the users date format setting:
322 Wednesday, 26 August, 2009 24:00:00
323 Wednesday, 26 August, 2009 12:00:00 am
324 Wednesday, August 26, 2009 12:00:00 am
325 Wednesday, 2009 August, 26 12:00:00 am
326 Wednesday, 2009 August, 28 8.00.00 pm
327 Wednesday, 2009 August, 28 08:00:00 PM
328 */
329
330 if (dateString == "" || dateString == null)
331 return null;
332 var dateArr = dateString.replace(/,/g,'').replace(/\./g,':').replace(/ /g,' ').split(' ');
333 if (dateArr.length != 5 && dateArr.length != 6)
334 return null;
335
336 // parse date
337 var weekDay = dateArr[0];
338 var day = dateArr[1];
339 var month = dateArr[2];
340 var year = dateArr[3];
341 // make sure month is set properly
342 if (isNaN(parseInt(day))) {
343 var tmp = day;
344 day = month;
345 month = tmp;
346 } else if (isNaN(parseInt(year))) {
347 var tmp = year;
348 year = month;
349 month = tmp;
350 }
351 // make sure day and year are set properly
352 if (Number(day) > Number(year)) {
353 var tmp = year;
354 year = day;
355 day = tmp;
356 }
357 month = months_translated[month];
358
359 // parse time
360 var timeArr = dateArr[4].split(':');
361 if (timeArr.length != 3)
362 return null;
363 var hours = Number(timeArr[0]);
364 var minutes = Number(timeArr[1]);
365 var seconds = Number(timeArr[2]);
366 if (dateArr.length == 6 && dateArr[5].toLowerCase() == 'pm' && hours < 12)
367 hours += 12;
368 if (dateArr.length == 6 && dateArr[5].toLowerCase() == 'am' && hours == 12)
369 hours = 0;
370
371 console.info('year=' + year + ' month=' + month + ' day=' + day + ' hours=' + hours + ' minutes=' + minutes+ ' seconds=' + seconds);
372
373 // take care of daylight saving time
374 if (config['enableDaylightSaving'].Value) {
375 var date = new Date(year, month - 1, day, hours, minutes, seconds);
376 if (summertime && date > daylightsavingWinter && date < daylightsavingSummer)
377 hours -= 1;
378 else if (!summertime && date > daylightsavingSummer && date < daylightsavingWinter)
379 hours += 1;
380 }
381
382 return new Date(year, month - 1, day, hours, minutes, seconds);
383 }
384
385 // returns a short date as string ("31.12" or "12.31") based on the format string which should look like "Wednesday, 26 August, 2009 12:00:00 am"
386 function formatDate(date, format)
387 {
388 var day = date.getDate().toString();
389 var month = (date.getMonth() + 1).toString();
390 while (day.length < 2) { day = '0' + day; }
391 while (month.length < 2) { month = '0' + month; }
392
393 if (config['showTodayAsText'].Value && isToday(date))
394 return '<span class="today">' + config['todayText'].Value + '</span>';
395 if (config['showTodayAsText'].Value && isTomorrow(date))
396 return '<span class="tomorrow">' + config['tomorrowText'].Value + '</span>';
397
398 var dateArr = format.replace(/,/g,'').replace(/\./g,':').replace(/ /g,' ').split(' ');
399 if (dateArr.length != 5 && dateArr.length != 6) {
400 // we don't know how to format this
401 if (config['dateFormat'].Value == 'auto' || config['dateFormat'].Value == 'DDMM')
402 return day + config['dateSeparator'].Value + month;
403 else
404 return month + config['dateSeparator'].Value + day;
405 }
406
407 var dayFirst = true;
408 if (config['dateFormat'].Value == 'MMDD')
409 dayFirst = false;
410 else if (config['dateFormat'].Value == 'DDMM')
411 dayFirst = true;
412 else {
413 // config['dateFormat'].Value == 'auto', try to detect system setting
414 // parse date
415 var day_ = dateArr[1];
416 var month_ = dateArr[2];
417 var year_ = dateArr[3];
418 // make sure month is set properly
419 if (isNaN(parseInt(day_))) {
420 var tmp = day_;
421 day_ = month_;
422 month_ = tmp;
423 dayFirst = false;
424 } else if (isNaN(parseInt(year_))) {
425 var tmp = year_;
426 year_ = month_;
427 month_ = tmp;
428 dayFirst = true;
429 }
430 // make sure day and year are set properly
431 if (Number(day_) > Number(year_))
432 dayFirst = false;
433 }
434
435 if (dayFirst)
436 return day + config['dateSeparator'].Value + month;
437 else
438 return month + config['dateSeparator'].Value + day;
439 }
440
441 function formatTime(date)
442 {
443 // date is a Date() object
444 date.setSeconds(0); // we don't care about seconds
445 var time = date.toLocaleTimeString().replace(/[\.:]00/, ''); // remove seconds from string
446 if (time.replace(/\./, ':').split(':')[0].length < 2)
447 time = '0' + time;
448 if (config['showNowAsText'].Value && date.getTime() == now.getTime())
449 time = '<span class="now">' + config['nowText'].Value + '</span>';
450 return time;
451 }
452
453 function updateData()
454 {
455 console.info('updateData()');
456 calcDaylightSaving();
457 try {
458 // meetings have time
459 // note: anniveraries have a start time of 12:00am. So since we want to include them, we have to query the whole day and check if events have passed later
460 now = new Date();
461 var meetingListFiltering = {
462 Type:'CalendarEntry',
463 Filter:{
464 StartRange: (new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0)),
465 EndRange: (new Date(now.getFullYear(), now.getMonth() + config['monthRange'].Value, now.getDate(), 0, 0, 0))
466 }
467 }
468 var meetingResult = calendarService.IDataSource.GetList(meetingListFiltering);
469 if (meetingResult.ErrorCode != 0)
470 throw("Error fetching calendar data: " + meetingResult.ErrorCode + ': ' + meetingResult.ErrorMessage);
471 var meetingList = meetingResult.ReturnValue;
472
473 // todos don't, they start on 00:00 hrs., but should be visible anyway
474 // this will generate a list of passed todos. We have to check if they have been marked as "done" yet
475 if (config['includeTodos'].Value) {
476 var todayTodoListFiltering = {
477 Type:'CalendarEntry',
478 Filter:{
479 Type: 'ToDo',
480 StartRange: (new Date(now.getFullYear() - 1, now.getMonth(), now.getDate(), 0, 0, 0)),
481 EndRange: (new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 1))
482 }
483 }
484 var todayTodoResult = calendarService.IDataSource.GetList(todayTodoListFiltering);
485 var todayTodoList = todayTodoResult.ReturnValue;
486 var entryLists = [todayTodoList, meetingList];
487 } else {
488 var entryLists = [meetingList];
489 }
490 } catch(e) {
491 error('loading Calendar items list:' + e + ', line ' + e.line);
492 return;
493 }
494
495 try {
496 var entry;
497 var counter = 0;
498 var entryDate = '';
499 var dateArr = [];
500 var fontsize = 'normal';
501 if (mode == 0) {
502 if (config['eventsPerWidget'].Value == 3) {
503 fontsize = '17pt';
504 changeCssClass('.icon', 'width:20px; height:20px');
505 }
506 else if (config['eventsPerWidget'].Value == 5) {
507 fontsize = '10pt';
508 changeCssClass('.icon', 'width:10px; height:10px');
509 }
510 else if (config['eventsPerWidget'].Value == 6) {
511 fontsize = '8pt';
512 changeCssClass('.icon', 'width:8px; height:8px');
513 }
514 }
515 else
516 changeCssClass('.icon', config['cssStyle_icon'].Value);
517 var entriesHtml = '<table style="font-size:' + fontsize + ';">';
518 var eventIds = [];
519 var max;
520 if (mode == 0)
521 max = (panelNum + 1) * config['eventsPerWidget'].Value;
522 else
523 max = 30; // we can display a lot more events in fullscreen mode
524
525 // the first outer loop iteration is for passed ToDos, the second loop is for all upcomming events (may also include ToDos)
526 for (var i=0; counter < max && i < entryLists.length; i++) {
527 while (counter < max && (entry = entryLists[i].getNext()) != undefined) {
528 counter++;
529
530 // output event info for debugging
531 console.info(
532 'event: Id=' + entry.id +
533 ',Type=' + entry.Type +
534 ',Summary=' + entry.Summary +
535 ',Location=' + entry.Location +
536 ',Status=' + entry.Status +
537 ',StartTime=' + entry.StartTime +
538 ',EndTime=' + entry.EndTime +
539 ',InstanceStartTime=' + entry.InstanceStartTime +
540 ',InstanceEndTime=' + entry.InstanceEndTime
541 );
542
543 // we don't want ToDos when includeTodos == false or when they are completed
544 if (entry.Type == 'ToDo' && (entry.Status == "TodoCompleted" || !config['includeTodos'].Value)) {
545 console.info('skipping ' + entry.id );
546 counter--;
547 continue;
548 }
549
550 // make sure that we don't include an event twice (useful for ToDos that might come up twice)
551 if (eventIds[entry.id] == 1 && entry.Type == 'ToDo') {
552 console.info('skipped (already included) ' + entry.id);
553 counter--;
554 continue;
555 } else
556 eventIds[entry.id] = 1;
557
558 // summary can be undefined!
559 var Summary = ((entry.Summary == null) ? '' : entry.Summary);
560 if (entry.Type == 'Meeting' && entry.Location != '' && config['showLocation'].Value)
561 Summary += ', ' + entry.Location;
562
563 // fix by yves: determine start and end dates/times
564 entryStartTime = ((entry.InstanceStartTime == null) ? entry.StartTime : entry.InstanceStartTime);
565 entryEndTime = ((entry.InstanceEndTime == null) ? entry.EndTime : entry.InstanceEndTime);
566
567 // there can be ToDos that have no date at all!
568 if (entry.Type == 'ToDo' && entry.EndTime == null)
569 entryDate = ""; // this will cause parseDate(entryDate) to return null;
570 else
571 entryDate = ((entry.Type == 'ToDo') ? entryEndTime : entryStartTime); // ToDo's use their EndTime, the rest use StartTime
572
573 // Convert date/time string to Date object
574 var date = parseDate(entryDate);
575 console.info('date: ' + date);
576 var endDate = ((entryEndTime == null) ? null : parseDate(entryEndTime));
577 console.info('endDate: ' + endDate);
578
579 // check if meeting event has already passed
580 if (entry.Type == 'Meeting') {
581 var compareTime = ((endDate == null) ? date.getTime() : endDate.getTime());
582 if (now.getTime() > compareTime) {
583 console.info('skipping Meeting (already passed) ' + entry.id);
584 counter--;
585 eventIds[entry.id] = 0;
586 continue;
587 }
588 }
589
590 // check if anniversary passed (not sure why they are in the list, the query was only for today - nokia?)
591 if (entry.Type == 'Anniversary') {
592 var tmp = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0,0,0);
593 if (date.getTime() < tmp.getTime()) {
594 console.info('skipping Anniversary (already passed) ' + entry.id);
595 counter--;
596 eventIds[entry.id] = 0;
597 continue;
598 }
599 }
600
601 // fix DayEvents end time. End times are off by 1 Second. It's possible that the event has already passed
602 if (entry.Type == 'DayEvent' && endDate != null) {
603 endDate.setMinutes(endDate.getMinutes() - 1);
604 console.info('fixing DayEvent endDate: ' + endDate);
605 if (now.getTime() > endDate.getTime()) {
606 console.info('event already passed ' + entry.id);
607 counter--;
608 eventIds[entry.id] = 0;
609 continue;
610 }
611 }
612
613 // check if the event is currently taking place
614 if (entryStartTime != null && entryEndTime != null && date != null && endDate != null) {
615 // check if we are between start and endtime
616 if ((date.getTime() < now.getTime()) && (now.getTime() < endDate.getTime())) {
617 date = now; // change appointment date/time to now
618 console.info('event is currently taking place: ' + date);
619 }
620 }
621
622 // skip events for the first panel in case this is the second one and we're not in fullscreen mode
623 if (mode == 0 && panelNum > 0 && counter < panelNum * config['eventsPerWidget'].Value + 1) {
624 console.info('skipping (already in first widget) ' + entry.id);
625 continue;
626 }
627
628 // mark overdue todos
629 var overdue = false;
630 if (entry.Type == 'ToDo' && date != null) {
631 var tmp1 = new Date(date.getFullYear(), date.getMonth(), date.getDate(), 0,0,0);
632 var tmp2 = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0,0,0);
633 if (tmp1.getTime() < tmp2.getTime()) {
634 overdue = true;
635 }
636 }
637
638 // generate html output
639 entriesHtml += '<tr><td><img class="icon" src="' + entry.Type + '.png" /></td>';
640 if(date == null) {
641 // some languages have very strange locale date formats, can't parse all those. Also some todos don't have dates at all.
642 entriesHtml += '<td colspan="4"><span class="date">' + entryDate + '</span> ';
643 } else {
644 var weekDay = date.toLocaleDateString().substr(0,config['weekDayLength'].Value);
645 var time = formatTime(date);
646 var dateStr = formatDate(date, entryDate);
647 if (entry.Type == 'ToDo' && overdue && config['markOverdueTodos'].Value) {
648 dateStr = '<span class="overdue">' + config['overdueText'].Value + '</span>';
649 entriesHtml += '<td colspan="4" width="1px"><span class="date">' + dateStr + '</span> ';
650 } else if (entry.Type == 'ToDo' || entry.Type == 'Anniversary' || entry.Type == 'DayEvent' || entry.Type == 'Reminder') {
651 if ((isToday(date) || isTomorrow(date)) && config['showTodayAsText'].Value) // show weekday if the date string is not text. looks odd otherwise
652 entriesHtml += '<td colspan="4" width="1px"><span class="date">' + dateStr + '</span> ';
653 else
654 entriesHtml += '<td class="weekDay" width="1px">' + weekDay + '</td><td width="1px" class="date">' + dateStr + '</td><td colspan="2">';
655 } else if (entry.Type == 'Meeting') {
656 if (config['showCombinedDateTime'].Value) {
657 if (isToday(date))
658 entriesHtml += '<td width="1px" colspan="4"><span class="today">' + time + '</span> ';
659 else if (isTomorrow(date))
660 entriesHtml += '<td width="1px" colspan="4"><span class="tomorrow">' + dateStr + '</span> <span class="time">' + time + '</span> ';
661 else
662 entriesHtml += '<td width="1px" class="weekDay">' + weekDay + '</td><td width="1px" class="date">' + dateStr + '</td><td colspan="2">';
663 } else {
664 if ((isToday(date) || isTomorrow(date)) && config['showTodayAsText'].Value)
665 entriesHtml += '<td colspan="4" width="1px"><span class="today">' + dateStr + '</span> <span class="time">' + time + '</span> ';
666 else
667 entriesHtml += '<td width="1px" class="weekDay">' + weekDay + '</td><td width="1px" class="date">' + dateStr + '</td><td width="1px" class="time">' + time + '</td><td>';
668 }
669 }
670 }
671 entriesHtml += '<span class="description">' + Summary + '</span></td></tr>';
672 }
673 }
674 entriesHtml += '</table>';
675 if (config['showNothingText'].Value && entriesHtml == '<table></table>') {
676 var text = config['nothingText'].Value.replace(/%d/, config['monthRange'].Value);
677 entriesHtml = '<div style="width:295px; height:75px; text-align:center; line-height:75px; overflow:visible;">' + text + '</div>';
678 }
679 if (cacheEntriesHtml != entriesHtml) {
680 if (mode == 0)
681 document.getElementById('calendarList').innerHTML = entriesHtml;
682 else
683 document.getElementById('fullscreenCalendarList').innerHTML = entriesHtml;
684 cacheEntriesHtml = entriesHtml;
685 }
686 } catch(e) {
687 error('displaying list:' + e + ', line ' + e.line);
688 return;
689 }
690 }
691
692 function updateScreen()
693 {
694 // check if opening fullscreen
695 if( window.innerHeight > 91 && mode == 0) {
696 mode = 1;
697 cacheEntriesHtml = '';
698 document.getElementById('body').style.backgroundImage = "";
699 showFullscreen();
700 }
701 else if (window.innerHeight <= 91 && mode != 0) {
702 mode = 0;
703 cacheEntriesHtml = '';
704 showHomescreen();
705 }
706
707 if (mode == 0)
708 updateHomescreen();
709 else if (mode == 1)
710 updateFullscreen();
711 }
712
713 function launchCalendar()
714 {
715 try {
716 widget.openApplication(config['calendarApp'].Value, "");
717 if (config['hideWidgetOnCalendarOpen'].Value)
718 window.close();
719 } catch(e) {
720 error('starting Calendar App');
721 return;
722 }
723 }
724
725 function init()
726 {
727 console.info('New widget instance starting up...');
728
729 try {
730 // call calendar service
731 if (device != "undefined")
732 calendarService = device.getServiceObject("Service.Calendar", "IDataSource");
733 else
734 throw('device object does not exist');
735 } catch(e) {
736 error('loading Calendar service: ' + e + ', line ' + e.line);
737 return;
738 }
739
740 loadSettings();
741 collectLocales();
742 //updateData();
743 requestNotification();
744 window.setInterval('updateData()', 1000 * 60 * config['updateDataInterval'].Value);
745
746 mode = 0;
747 showHomescreen();
748 updateScreen();
749 if (config['useBackgroundImage'].Value)
750 // check for screen rotation every 1 secs
751 window.setInterval('updateScreen()', 1000 * 1);
752 }
753
754 function createMenu()
755 {
756 window.menu.setLeftSoftkeyLabel("",null);
757 window.menu.setRightSoftkeyLabel("",null);
758 var id = 0;
759 var menuSettings = new MenuItem(getLocalizedText('menu.settings'), id++);
760 var menuCallApp = new MenuItem(getLocalizedText('menu.openCalendarApp'), id++);
761 var menuUpdate = new MenuItem(getLocalizedText('menu.update'), id++);
762 var menuAbout = new MenuItem(getLocalizedText('menu.about'), id++);
763 menuSettings.onSelect = showSettings;
764 menuAbout.onSelect = showAbout;
765 menuCallApp.onSelect = launchCalendar;
766 menuUpdate.onSelect = showUpdate;
767 window.menu.clear();
768 window.menu.append(menuCallApp);
769 window.menu.append(menuSettings);
770 window.menu.append(menuUpdate);
771 window.menu.append(menuAbout);
772 }
773
774 function showSettings()
775 {
776 mode = 2;
777 hideViews();
778 document.getElementById("settingsView").style.display = "block";
779 document.onclick = null;
780
781 window.menu.setLeftSoftkeyLabel(getLocalizedText('settings.save'), function()
782 {
783 for (var key in config) {
784 if (config[key].Type == 'String')
785 config[key].Value = document.forms[0].elements["settings." + key].value;
786 else if (config[key].Type == 'Int') {
787 config[key].Value = parseInt(document.forms[0].elements["settings." + key].value);
788 if (config[key].Value < 0)
789 config[key].Value = config[key].Default;
790 }
791 else if (config[key].Type == 'Bool')
792 config[key].Value = document.forms[0].elements["settings." + key].checked;
793 else if (config[key].Type == 'UID')
794 config[key].Value = parseInt(document.forms[0].elements["settings." + key].value);
795 else if (config[key].Type == 'Enum') {
796 config[key].Value = document.forms[0].elements["settings." + key].value;
797 if (config[key].ValidValues.indexOf(config[key].Value) == -1)
798 config[key].Value = config[key].Default;
799 }
800 }
801
802 updateCssClasses();
803
804 saveSettings();
805
806 mode = 1;
807 showFullscreen();
808 });
809 window.menu.setRightSoftkeyLabel(getLocalizedText('settings.cancel'), function()
810 {
811 mode = 1;
812 showFullscreen();
813 });
814
815 var settingsHtml = '<form>';
816 for (var key in config) {
817 if (config[key].Type == 'String')
818 settingsHtml += '<table><tr><td>' + getLocalizedText('settings.name.' + key) + '<br /><input class="textInput" name="settings.' + key + '" type="text" value="' + config[key].Value + '" /></td>' + printHintBox(getLocalizedText('settings.info.' + key)) + '<hr />';
819 else if (config[key].Type == 'Int')
820 settingsHtml += '<table><tr><td>' + getLocalizedText('settings.name.' + key) + '<br /><input class="textInput" name="settings.' + key + '" type="text" value="' + config[key].Value + '" /></td>' + printHintBox(getLocalizedText('settings.info.' + key)) + '<hr />';
821 else if (config[key].Type == 'Bool')
822 settingsHtml += '<table><tr><td>' + getLocalizedText('settings.name.' + key) + '<br /><input name="settings.' + key + '" type="checkbox" value="true" ' + (config[key].Value ? 'checked="checked"' : '') + '/></td>' + printHintBox(getLocalizedText('settings.info.' + key)) + '<hr />';
823 else if (config[key].Type == 'UID')
824 settingsHtml += '<table><tr><td>' + getLocalizedText('settings.name.' + key) + '<br /><input class="textInput" name="settings.' + key + '" type="text" value="0x' + config[key].Value.toString(16) + '" /></td>' + printHintBox(getLocalizedText('settings.info.' + key)) + '<hr />';
825 else if (config[key].Type == 'Enum') {
826 settingsHtml += '<table><tr><td>' + getLocalizedText('settings.name.' + key) + '<br /><select name="settings.' + key + '" size="1">';
827 for(var i = 0; i < config[key].ValidValues.length; i++)
828 settingsHtml += '<option value="' + config[key].ValidValues[i] + '"' + (config[key].Value == config[key].ValidValues[i] ? ' selected="selected"' : '') + '>' + getLocalizedText('settings.validValues.' + key + '.' + config[key].ValidValues[i]) + '</option>';
829 settingsHtml += '</select></div></td>' + printHintBox(getLocalizedText('settings.info.' + key)) + '<hr />';
830 }
831 }
832 settingsHtml += '<input name="reset" type="button" value="' + getLocalizedText('settings.restoreDefaults') + '" onclick="javascript:restoreDefaultSettings();showSettings();" />';
833 settingsHtml += '</form>';
834 document.getElementById("settingsList").innerHTML = settingsHtml;
835 }
836
837 function changeCssClass(classname, properties)
838 {
839 for(var i = 0; i < document.styleSheets[0]['cssRules'].length; i++)
840 {
841 if (document.styleSheets[0]['cssRules'][i].selectorText == classname) {
842 document.styleSheets[0].deleteRule(i);
843 document.styleSheets[0].insertRule(classname + ' { ' + properties + ' }', document.styleSheets[0]['cssRules'].length);
844 break;
845 }
846 }
847 }
848
849 function updateCssClasses()
850 {
851 for(var key in config) {
852 changeCssClass(getLocalizedText('settings.name.' + key), config[key].Value);
853 }
854 }
855
856 function getSettingsCalEntryId()
857 {
858 if (settingsCalEntryId == null) {
859 // check if entry already exists
860 var listFiltering = {
861 Type:'CalendarEntry',
862 Filter:{
863 StartRange: new Date(2000, 0, 1),
864 EndRange: new Date(2000, 0, 1),
865 SearchText: 'ComingNext Settings|',
866 Type: 'DayEvent'
867 }
868 }
869 var result = calendarService.IDataSource.GetList(listFiltering);
870 if (result.ErrorCode) {
871 error(result.ErrorMessage);
872 return;
873 }
874 var list = result.ReturnValue;
875 var entry = list.getNext();
876 if (entry != undefined) {
877 settingsCalEntryId = entry.LocalId;
878 console.info("settingsCalEntryId=" + settingsCalEntryId);
879 }
880 else { // create settings item
881 var item = new Object();
882 item.Type = "DayEvent";
883 item.StartTime = new Date(2000, 0, 1);
884 item.Summary = "ComingNext Settings|";
885
886 var criteria = new Object();
887 criteria.Type = "CalendarEntry";
888 criteria.Item = item;
889
890 try {
891 var result = calendarService.IDataSource.Add(criteria);
892 if (result.ErrorCode)
893 error(result.ErrorMessage);
894 } catch (e) {
895 error("getSettingsCalEntryId: " + e + ', line ' + e.line);
896 }
897
898 getSettingsCalEntryId();
899 }
900 }
901 }
902
903 function restoreDefaultSettings()
904 {
905 for (var key in config)
906 config[key].Value = config[key].Default;
907 }
908
909 function loadSettings()
910 {
911 getSettingsCalEntryId();
912 var listFiltering = {
913 Type:'CalendarEntry',
914 Filter:{
915 LocalId: settingsCalEntryId
916 }
917 }
918 var result = calendarService.IDataSource.GetList(listFiltering);
919 if (result.ErrorCode) {
920 error(result.ErrorMessage);
921 return;
922 }
923 var entry = result.ReturnValue.getNext();
924 if (entry != undefined) {
925 // only reload settings if they chanced since the last reload
926 if (settingsCache != entry.Summary)
927 {
928 restoreDefaultSettings();
929 var stringlist = entry.Summary.split("|");
930 // skip the first two entries, those contain header and version info
931 for(var i = 2; i < stringlist.length - 1; i++) {
932 var pair = stringlist[i].split('=');
933 var key = pair[0];
934 var value = pair[1];
935 console.info('stringlist: ' + key + '=\'' + value + '\'');
936 if (config[key].Type == 'Int')
937 config[key].Value = Number(value);
938 else if (config[key].Type == 'String')
939 config[key].Value = value;
940 else if (config[key].Type == 'Bool')
941 config[key].Value = (value == 'true')
942 else if (config[key].Type == 'Enum')
943 config[key].Value = value;
944 else if (config[key].Type == 'UID')
945 config[key].Value = Number(value);
946 }
947 settingsCache = entry.Summary;
948 updateCssClasses();
949 }
950 }
951 else {
952 error("Failed to load settings, calendar entry could not be found");
953 }
954 }
955
956 function saveSettings()
957 {
958 getSettingsCalEntryId();
959 var item = new Object();
960 item.Type = "DayEvent";
961 item.StartTime = new Date(2000, 0, 1);
962 item.LocalId = settingsCalEntryId;
963 item.Summary = "ComingNext Settings|" + version + "|";
964
965 for (var key in config) {
966 if (config[key].Type == 'Int')
967 item.Summary += key + "=" + config[key].Value.toString() + "|";
968 else if (config[key].Type == 'String')
969 item.Summary += key + "=" + config[key].Value + "|";
970 else if (config[key].Type == 'Bool')
971 item.Summary += key + "=" + (config[key].Value ? 'true' : 'false') + "|";
972 else if (config[key].Type == 'Enum')
973 item.Summary += key + "=" + config[key].Value + "|";
974 else if (config[key].Type == 'UID')
975 item.Summary += key + "=" + config[key].Value.toString() + "|";
976 }
977 settingsCache = item.Summary;
978
979 var criteria = new Object();
980 criteria.Type = "CalendarEntry";
981 criteria.Item = item;
982
983 console.info("Saving settings to calendar entry: " + item.Summary);
984 try {
985 var result = calendarService.IDataSource.Add(criteria);
986 if (result.ErrorCode)
987 error(result.ErrorMessage);
988 } catch (e) {
989 error("saveSettings: " + e + ', line ' + e.line);
990 }
991 }
992
993 function toggleVisibility(elementId)
994 {
995 if (document.getElementById(elementId).style.display == "none")
996 document.getElementById(elementId).style.display = "block";
997 else
998 document.getElementById(elementId).style.display = "none";
999 }
1000
1001 var uniqueId = 0;
1002 function printHintBox(text)
1003 {
1004 uniqueId++;
1005 return '<td width="1%" align="right" onclick="javascript:toggleVisibility(\'info' + uniqueId + '\')">' + getLocalizedText('settings.help') + '</td></tr></table>'+
1006 '<div class="settingsInfo" id="info' + uniqueId + '">' + text + '</div>';
1007 }
1008
1009 function showAbout()
1010 {
1011 mode = 3;
1012 hideViews();
1013 document.getElementById("aboutView").style.display = "block";
1014 document.onclick = null;
1015
1016 window.menu.setLeftSoftkeyLabel(" ", function(){});
1017 window.menu.setRightSoftkeyLabel(getLocalizedText('softkey.back'), function()
1018 {
1019 mode = 1;
1020 showFullscreen();
1021 });
1022
1023 //document.getElementById("aboutView").innerHTML = 'aboutView';
1024 document.getElementById("name").innerHTML = "Coming Next " + version;
1025 }
1026
1027 function updateFullscreen()
1028 {
1029 }
1030
1031 function showFullscreen()
1032 {
1033 hideViews();
1034 document.getElementById("fullscreenView").style.display = "block";
1035 document.getElementById('body').className = "backgroundFullscreen";
1036 document.onclick = launchCalendar;
1037 createMenu();
1038 updateData();
1039 }
1040
1041 function getBackgroundImage()
1042 {
1043 var bgImage;
1044 if (config['backgroundImageLocation'].Value == config['backgroundImageLocation'].ValidValues[0]) // internal
1045 bgImage = 'background_' + orientation + '.png';
1046 else
1047 bgImage = 'C:/Data/background_' + panelNum + '_' + orientation + '.png';
1048 return bgImage;
1049 }
1050
1051 function updateHomescreen()
1052 {
1053 if (config['useBackgroundImage'].Value) {
1054 // check for screen rotation
1055 if (orientation != 'portrait' && screen.width == 360 && screen.height == 640) {
1056 window.widget.prepareForTransition("fade");
1057 orientation = 'portrait';
1058 document.getElementById('body').style.backgroundImage = 'url(' + getBackgroundImage() + ')';
1059 document.getElementById('body').style.backgroundColor = 'none';
1060 window.widget.performTransition();
1061 } else if (orientation != 'landscape' && screen.width == 640 && screen.height == 360) {
1062 window.widget.prepareForTransition("fade");
1063 orientation = 'landscape';
1064 document.getElementById('body').style.backgroundImage = 'url(' + getBackgroundImage() + ')';
1065 document.getElementById('body').style.backgroundColor = 'none';
1066 window.widget.performTransition();
1067 }
1068 else if (document.getElementById('body').style.backgroundImage == "")
1069 {
1070 document.getElementById('body').style.backgroundImage = 'url(' + getBackgroundImage() + ')';
1071 }
1072 }
1073 }
1074
1075 function showHomescreen()
1076 {
1077 hideViews();
1078 document.getElementById("homescreenView").style.display = "block";
1079 document.getElementById('body').className = "background";
1080 document.onclick = null;
1081 updateData();
1082 }
1083
1084 function getLocalizedText(p_Txt)
1085 {
1086 if (localizedText[p_Txt])
1087 return localizedText[p_Txt];
1088 else
1089 return 'ERROR: missing translation for ' + p_Txt;
1090 }
1091
1092 function showUpdate()
1093 {
1094 mode = 4;
1095 hideViews();
1096 document.getElementById("updateView").style.display = "block";
1097 document.onclick = null;
1098
1099 window.menu.setLeftSoftkeyLabel(getLocalizedText('update.checknow'), function(){
1100 checkForUpdate();
1101 });
1102 window.menu.setRightSoftkeyLabel(getLocalizedText('softkey.back'), function()
1103 {
1104 mode = 1;
1105 showFullscreen();
1106 });
1107
1108 document.getElementById("currentVersion").innerHTML = getLocalizedText("update.current") + version;
1109 checkForUpdate();
1110 }
1111
1112 function checkForUpdate()
1113 {
1114 // asynch XHR to server url
1115 reqV = new XMLHttpRequest();
1116 reqV.onreadystatechange = checkForUpdateCallback;
1117 document.getElementById("updateDiv").innerHTML = getLocalizedText("update.checking");
1118 reqV.open("GET", versionURL, true);
1119 reqV.setRequestHeader( "If-Modified-Since", "Sat, 1 Jan 2000 00:00:00 GMT" ); // disable caching
1120 reqV.send(null);
1121 }
1122
1123 function checkForUpdateCallback()
1124 {
1125 if (reqV.readyState == 4) {
1126 if (reqV.status == 200) {
1127 var resultXml = reqV.responseText;
1128 if (resultXml) {
1129 var div = document.getElementById("tmp");
1130 div.innerHTML = resultXml;
1131 var newVersion = div.getElementsByTagName('version')[0].innerHTML;
1132 var newVersionURL = div.getElementsByTagName('url')[0].innerHTML;
1133 div.innerHTML = "";
1134 if (version != newVersion) {
1135 document.getElementById("updateDiv").innerHTML = getLocalizedText("update.download").replace(/%1/, newVersion).replace(/%2/, newVersionURL);
1136 }
1137 else {
1138 document.getElementById("updateDiv").innerHTML = getLocalizedText("update.nonewversion");
1139 }
1140 }
1141 }
1142 else {
1143 document.getElementById("updateDiv").innerHTML = getLocalizedText("update.error") + reqV.status + " " + reqV.responseText;
1144 }
1145 }
1146 }
1147
1148 function hideViews()
1149 {
1150 document.getElementById("homescreenView").style.display = "none";
1151 document.getElementById("fullscreenView").style.display = "none";
1152 document.getElementById("aboutView").style.display = "none";
1153 document.getElementById("settingsView").style.display = "none";
1154 document.getElementById("updateView").style.display = "none";
1155 }
1156 </script>
1157
1158 <style type="text/css">
1159 table { margin:0px; padding:0px; border-spacing:0px; }
1160 td { padding:0px 5px 0px 0px; white-space:nowrap; overflow:hidden; }
1161 hr { color:#ffffff; background-color:#ffffff; height:1px; text-align:left; border-style:none; }
1162 .settingsInfo { display:none; font-style:italic; }
1163 .title { font-weight:bold; font-size:14pt; }
1164 .textInput { width:90%; }
1165 .credits { margin-left:40px; text-indent: -20px; margin-bottom:0px; }
1166 #homescreenView { width: 315px; height:91px; overflow:hidden; }
1167 #calendarList { position:absolute; left:10px; top:4px; width:295px; height:75px; overflow:hidden; }
1168 #name { text-align:center; }
1169 #appicon { display: block; margin-left: auto; margin-right: auto; margin-top: 10px; }
1170 #smallappicon { width:22px; height:22px; margin-right:10px; float:left; }
1171 </style>
1172
1173 </head>
1174
1175 <body id="body" class="background">
1176 <div id="homescreenView">
1177 <div id="calendarList"></div>
1178 </div>
1179 <div id="fullscreenView" style="display:none;">
1180 <img src="Icon.png" id="smallappicon">
1181 <h1 class="title">Coming Next</h1>
1182 <hr />
1183 <div id="fullscreenCalendarList">loading...</div>
1184 </div>
1185 <div id="settingsView" style="display:none">
1186 <img src="Icon.png" id="smallappicon">
1187 <h1 class="title">Settings</h1>
1188 <hr />
1189 <div id="settingsList"></div>
1190 </div>
1191 <div id="aboutView" style="display:none">
1192 <img src="Icon.png" id="appicon">
1193 <h1 id="name">Coming Next</h1>
1194 <hr />
1195 <p>Created by Dr. Cochambre and Michael Prager.</p>
1196 <p>Contributions:</p>
1197 <p class="credits">Paul Moore (bug fixes, new features and code cleanup)</p>
1198 <p class="credits">Manfred Hanselmann (DST support)</p>
1199 <p class="credits">Christophe Milsent (translation support & french translation</p>
1200 <p class="credits">Flavio Nathan (portuguese-brazilian translation</p>
1201 <p>This software is open source and licensed under the GPLv3.</p>
1202 <p>Visit sourceforge.net/projects/comingnext for free updates.</p>
1203 <hr />
1204 </div>
1205 <div id="updateView" style="display:none">
1206 <img src="Icon.png" id="smallappicon">
1207 <h1 class="title">Check for update</h1>
1208 <hr />
1209 <div id="currentVersion">Coming Next ??</div>
1210 <div id="updateDiv"></div>
1211 <div id="tmp" style="display:none;"></div>
1212 </div>
1213 </body>
1214
1215 </html>