enableDaylightSaving: { Type: 'Bool', Default: true, Value: true,},\r
daylightSavingOffset: { Type: 'Int', Default: 1, Value: 1,},\r
hideWidgetOnCalendarOpen: { Type: 'Bool', Default: false, Value: false,},\r
+ showCalendarIndicator: { Type: 'Bool', Default: true, Value: true,},\r
cssStyle_background: { Type: 'String', Default: 'color:#ffffff; background-color:#000000', Value: 'color:#ffffff; background-color:#000000',},\r
cssStyle_backgroundFullscreen: { Type: 'String', Default: 'color:#ffffff; background-color:#000000', Value: 'color:#ffffff; background-color:#000000',},\r
cssStyle_weekDay: { Type: 'String', Default: '', Value: '',},\r
cssStyle_description: { Type: 'String', Default: '', Value: '',},\r
cssStyle_icon: { Type: 'String', Default: 'width:15px; height:15px', Value: 'width:15px; height:15px',},\r
cssStyle_overdue: { Type: 'String', Default: 'color:#ffff00', Value: 'color:#ffff00',},\r
+ cssStyle_calendar1: { Type: 'String', Default: 'background-color:#800000', Value: 'background-color:#800000',},\r
+ cssStyle_calendar2: { Type: 'String', Default: 'background-color:#ff0000', Value: 'background-color:#ff0000',},\r
+ cssStyle_calendar3: { Type: 'String', Default: 'background-color:#808000', Value: 'background-color:#808000',},\r
+ cssStyle_calendar4: { Type: 'String', Default: 'background-color:#ffff00', Value: 'background-color:#ffff00',},\r
+ cssStyle_calendar5: { Type: 'String', Default: 'background-color:#008000', Value: 'background-color:#008000',},\r
+ cssStyle_calendar6: { Type: 'String', Default: 'background-color:#008080', Value: 'background-color:#008080',},\r
}\r
\r
\r
// Nothing of interest from here on...\r
//-------------------------------------------------------\r
var panelNum = 0; // use 1 for second panel\r
-var version = "1.29";\r
+var version = "1.30";\r
var versionURL = "http://comingnext.sourceforge.net/version.xml";\r
var calendarService = null;\r
var cacheEntriesHtml = [];\r
var reqV = null; \r
var settingsCalEntryId = null;\r
var settingsCache = null;\r
-var notificationRequest1;\r
-var notificationRequest2;\r
+var notificationRequests = new Array();\r
var calendarList = [];\r
+var calendarColors = [];\r
\r
// vars for daylight saving time\r
var summertime = false; // true, if current date is in summer, false if in winter\r
var entryFields = [\r
"id",\r
"Type",\r
+ "CalendarName",\r
"Summary",\r
"Location",\r
"Status",\r
{\r
var criteria = new Object();\r
criteria.Type = "CalendarEntry";\r
-\r
- try {\r
- notificationRequest1 = calendarService.IDataSource.RequestNotification(criteria, callback);\r
- if (notificationRequest1.ErrorCode)\r
- error('requestNotification failed with error code ' + notificationRequest1.ErrorCode);\r
- } catch (e) {\r
- error("requestNotification: " + e + ', line ' + e.line);\r
+ criteria.Filter = new Object();\r
+ for(var i=0; i < calendarList.length; i++) {\r
+ criteria.Filter.CalendarName = calendarList[i];\r
+ try {\r
+ var notificationRequest = calendarService.IDataSource.RequestNotification(criteria, callback);\r
+ if (notificationRequest.ErrorCode)\r
+ error('requestNotification failed with error code ' + notificationRequest.ErrorCode);\r
+ notificationRequests.push(notificationRequest);\r
+ } catch (e) {\r
+ error("requestNotification: " + e + ', line ' + e.line);\r
+ }\r
}\r
\r
var criteria2 = new Object();\r
criteria2.Filter = new Object();\r
criteria2.Filter.LocalIdList = new Array();\r
criteria2.Filter.LocalIdList[0] = settingsCalEntryId;\r
-\r
try {\r
- notificationRequest2 = calendarService.IDataSource.RequestNotification(criteria2, settingsCallback);\r
- if (notificationRequest2.ErrorCode)\r
- error('requestNotification failed with error code ' + notificationRequest2.ErrorCode);\r
+ var notificationRequest = calendarService.IDataSource.RequestNotification(criteria2, settingsCallback);\r
+ if (notificationRequest.ErrorCode)\r
+ error('requestNotification failed with error code ' + notificationRequest.ErrorCode);\r
+ notificationRequests.push(notificationRequest);\r
} catch (e) {\r
error("requestNotification: " + e + ', line ' + e.line);\r
}\r
}\r
\r
+function cancelNotification()\r
+{\r
+ for(var i=0; i < notificationRequests.length; i++) {\r
+ try {\r
+ var result = calendarService.IDataSource.Cancel(notificationRequests[i]);\r
+ if (result.ErrorCode)\r
+ error('cancelNotification failed with error code ' + result.ErrorCode);\r
+ } catch (e) {\r
+ error("cancelNotification: " + e + ', line ' + e.line);\r
+ }\r
+ }\r
+}\r
+\r
function callback(transId, eventCode, result)\r
{\r
console.info("callback(): panelNum: %d transId: %d eventCode: %d result.ErrorCode: %d", panelNum, transId, eventCode, result.ErrorCode);\r
function updateData()\r
{\r
console.info('updateData()');\r
+\r
+ // check if we got additional or less calendars since our last update\r
+ var newCalendarList = listCalendars();\r
+ if (newCalendarList.length != calendarList.length) {\r
+ calendarList = newCalendarList;\r
+ updateCalendarColors();\r
+ cancelNotification();\r
+ requestNotification();\r
+ }\r
+ \r
try {\r
// meetings have time\r
// 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\r
}\r
\r
// generate html output\r
- entriesHtml += '<tr><td><img class="icon" src="' + entry.Type + '.png" /></td>';\r
+ entriesHtml += '<tr>';\r
+ if (config['showCalendarIndicator'].Value && calendarList.length > 1) {\r
+ entriesHtml += '<td class="calendar' + calendarColors[entry.CalendarName] + '"> </td>';\r
+ }\r
+ entriesHtml += '<td><img class="icon" src="' + entry.Type + '.png" /></td>';\r
if(date == null) {\r
// some languages have very strange locale date formats, can't parse all those. Also some todos don't have dates at all.\r
entriesHtml += '<td colspan="4"><span class="date">' + entryDate + '</span> ';\r
\r
calendarList = listCalendars();\r
loadSettings();\r
+ updateCalendarColors();\r
collectLocales();\r
//updateData();\r
requestNotification();\r
return 0;\r
}\r
\r
+function updateCalendarColors()\r
+{\r
+ calendarColors = [];\r
+ if (calendarList.length > 6) {\r
+ console.info("updateCalendarColors(): Warning: more calendars than available indicator colors");\r
+ }\r
+ for(var i=0; i < calendarList.length; i++) {\r
+ calendarColors[calendarList[i]] = (i % 6) + 1;\r
+ }\r
+}\r
+\r
</script>\r
\r
<style type="text/css">\r
<p class="credits">Flavio Nathan (portuguese-brazilian translation)</p>\r
<p class="credits">Tokeda (russian translation)</p>\r
<p>This software is open source and licensed under the GPLv3.</p>\r
- <p>Visit sourceforge.net/projects/comingnext for free updates.</p>\r
+ <p>Visit <a href="http://sourceforge.net/projects/comingnext">sourceforge.net/projects/comingnext</a> for free updates.</p>\r
<hr />\r
</div>\r
<div id="updateView" style="display:none">\r