X-Git-Url: https://code.delx.au/comingnext/blobdiff_plain/631bc47f3e5b8f4d65a6c1f0d4d49ae7558427e2..3a8ae3ed904a6bccf63a4d694324d93e5f0a34fd:/comingNext/index.html diff --git a/comingNext/index.html b/comingNext/index.html index ad66566..459441c 100644 --- a/comingNext/index.html +++ b/comingNext/index.html @@ -67,7 +67,7 @@ var config = { // Nothing of interest from here on... //------------------------------------------------------- var panelNum = 0; // use 1 for second panel -var version = "1.26"; +var version = "1.28"; var versionURL = "http://comingnext.sourceforge.net/version.xml"; var calendarService = null; var cacheEntriesHtml = []; @@ -76,6 +76,11 @@ var orientation = ''; var now = new Date(); var mode = 0; // 0 = homescreen, 1 = fullscreen, 2 = settings, 3 = about, 4 = check for update var reqV = null; +var settingsCalEntryId = null; +var settingsCache = null; +var notificationRequest1; +var notificationRequest2; +var calendarList = []; // vars for daylight saving time var daylightsavingWinter = 0; @@ -277,9 +282,23 @@ function requestNotification() criteria.Type = "CalendarEntry"; try { - var result = calendarService.IDataSource.RequestNotification(criteria, callback); - if (result.ErrorCode) - error('loading Calendar items list'); + notificationRequest1 = calendarService.IDataSource.RequestNotification(criteria, callback); + if (notificationRequest1.ErrorCode) + error('requestNotification failed with error code ' + notificationRequest1.ErrorCode); + } catch (e) { + error("requestNotification: " + e + ', line ' + e.line); + } + + var criteria2 = new Object(); + criteria2.Type = "CalendarEntry"; + criteria2.Filter = new Object(); + criteria2.Filter.LocalIdList = new Array(); + criteria2.Filter.LocalIdList[0] = settingsCalEntryId; + + try { + notificationRequest2 = calendarService.IDataSource.RequestNotification(criteria2, settingsCallback); + if (notificationRequest2.ErrorCode) + error('requestNotification failed with error code ' + notificationRequest2.ErrorCode); } catch (e) { error("requestNotification: " + e + ', line ' + e.line); } @@ -287,9 +306,16 @@ function requestNotification() function callback(transId, eventCode, result) { + console.info("callback(): panelNum: %d transId: %d eventCode: %d result.ErrorCode: %d", panelNum, transId, eventCode, result.ErrorCode); updateData(); } +function settingsCallback(transId, eventCode, result) +{ + console.info("settingsCallback(): panelNum: %d transId: %d eventCode: %d result.ErrorCode: %d", panelNum, transId, eventCode, result.ErrorCode); + loadSettings(); +} + function parseDate(dateString) { /* @@ -433,31 +459,43 @@ function updateData() // meetings have time // 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 now = new Date(); - var meetingListFiltering = { - Type:'CalendarEntry', - Filter:{ - StartRange: (new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0)), - EndRange: (new Date(now.getFullYear(), now.getMonth() + config['monthRange'].Value, now.getDate(), 0, 0, 0)) + var meetingList = []; + for(var i=0; i < calendarList.length; i++) { + var meetingListFiltering = { + Type:'CalendarEntry', + Filter:{ + CalendarName: calendarList[i], + StartRange: (new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0)), + EndRange: (new Date(now.getFullYear(), now.getMonth() + config['monthRange'].Value, now.getDate(), 0, 0, 0)) + } } + var meetingResult = calendarService.IDataSource.GetList(meetingListFiltering); + if (meetingResult.ErrorCode != 0) + throw("Error fetching calendar data: " + meetingResult.ErrorCode + ': ' + meetingResult.ErrorMessage); + var list = meetingResult.ReturnValue; + meetingList = meetingList.concat(listToArray(list)); } - var meetingResult = calendarService.IDataSource.GetList(meetingListFiltering); - if (meetingResult.ErrorCode != 0) - throw("Error fetching calendar data: " + meetingResult.ErrorCode + ': ' + meetingResult.ErrorMessage); - var meetingList = meetingResult.ReturnValue; + meetingList.sort(sortCalendarEntries); // todos don't, they start on 00:00 hrs., but should be visible anyway // this will generate a list of passed todos. We have to check if they have been marked as "done" yet if (config['includeTodos'].Value) { - var todayTodoListFiltering = { - Type:'CalendarEntry', - Filter:{ - Type: 'ToDo', - StartRange: (new Date(now.getFullYear() - 1, now.getMonth(), now.getDate(), 0, 0, 0)), - EndRange: (new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 1)) + var todayTodoList = []; + for(var i=0; i < calendarList.length; i++) { + var todayTodoListFiltering = { + Type:'CalendarEntry', + Filter:{ + CalendarName: calendarList[i], + Type: 'ToDo', + StartRange: (new Date(now.getFullYear() - 1, now.getMonth(), now.getDate(), 0, 0, 0)), + EndRange: (new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 1)) + } } + var todayTodoResult = calendarService.IDataSource.GetList(todayTodoListFiltering); + var list = todayTodoResult.ReturnValue; + todayTodoList = todayTodoList.concat(listToArray(list)); } - var todayTodoResult = calendarService.IDataSource.GetList(todayTodoListFiltering); - var todayTodoList = todayTodoResult.ReturnValue; + todayTodoList.sort(sortCalendarEntries); var entryLists = [todayTodoList, meetingList]; } else { var entryLists = [meetingList]; @@ -472,7 +510,24 @@ function updateData() var counter = 0; var entryDate = ''; var dateArr = []; - var entriesHtml = '
' + dateStr + ' '; } else if (entry.Type == 'ToDo' || entry.Type == 'Anniversary' || entry.Type == 'DayEvent' || entry.Type == 'Reminder') { if ((isToday(date) || isTomorrow(date)) && config['showTodayAsText'].Value) // show weekday if the date string is not text. looks odd otherwise @@ -695,12 +751,13 @@ function init() return; } + calendarList = listCalendars(); loadSettings(); - updateCssClasses(); collectLocales(); //updateData(); requestNotification(); window.setInterval('updateData()', 1000 * 60 * config['updateDataInterval'].Value); + document.getElementById("settingsTitle").innerHTML = getLocalizedText('menu.settings'); mode = 0; showHomescreen(); @@ -773,8 +830,12 @@ function showSettings() var settingsHtml = ' |