]> code.delx.au - comingnext/blobdiff - comingNext/index.html
bumped version number for 1.30 release
[comingnext] / comingNext / index.html
index d66fd2917a992e14c4f05b49760e00b20ac8ea1c..383f8e158b4d3a7dbb1a848feb90412f799c8b1a 100644 (file)
@@ -49,6 +49,7 @@ var config = {
        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
@@ -60,6 +61,12 @@ var config = {
        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
@@ -68,7 +75,7 @@ var config = {
 // 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
@@ -79,9 +86,9 @@ var mode = 0; // 0 = homescreen, 1 = fullscreen, 2 = settings, 3 = about, 4 = ch
 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
@@ -91,6 +98,7 @@ var daylightSavingDates = new Object(); // caches calculated DST winter and summ
 var entryFields = [\r
        "id",\r
        "Type",\r
+       "CalendarName",\r
        "Summary",\r
        "Location",\r
        "Status",\r
@@ -298,13 +306,17 @@ function requestNotification()
 {\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
@@ -312,16 +324,29 @@ function requestNotification()
        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
@@ -480,6 +505,16 @@ function formatTime(date)
 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
@@ -685,7 +720,11 @@ function updateData()
                                }\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] + '">&nbsp;</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
@@ -788,6 +827,7 @@ function init()
 \r
        calendarList = listCalendars();\r
        loadSettings();\r
+       updateCalendarColors();\r
        collectLocales();\r
        //updateData();\r
        requestNotification();\r
@@ -1334,6 +1374,17 @@ function sortCalendarEntries(a, b)
        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
@@ -1381,7 +1432,7 @@ hr { color:#ffffff; background-color:#ffffff; height:1px; text-align:left; borde
                <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