]> code.delx.au - comingnext/commitdiff
fixed CalendarName property not being passed to calendar events properly. Also fixed...
authorMichael Prager <michael@pragers.de>
Mon, 15 Nov 2010 12:25:19 +0000 (13:25 +0100)
committerMichael Prager <michael@pragers.de>
Mon, 15 Nov 2010 12:25:19 +0000 (13:25 +0100)
comingNext/index.html

index 383f8e158b4d3a7dbb1a848feb90412f799c8b1a..1a87aca0657d348ddd1015ad262debb2c2d4781d 100644 (file)
 .description { }\r
 .icon { }\r
 .overdue {}\r
+.calendar1 {}\r
+.calendar2 {}\r
+.calendar3 {}\r
+.calendar4 {}\r
+.calendar5 {}\r
+.calendar6 {}\r
 </style>\r
 \r
 <script type="text/javascript" src="localizedTextStrings.js" charset="utf-8" />\r
@@ -534,7 +540,7 @@ function updateData()
                        if (meetingResult.ErrorCode != 0)\r
                                throw("Error fetching calendar data: " + meetingResult.ErrorCode + ': ' + meetingResult.ErrorMessage);\r
                        var list = meetingResult.ReturnValue;\r
-                       meetingList = meetingList.concat(listToArray(list));\r
+                       meetingList = meetingList.concat(listToArray(list, calendarList[i]));\r
                }\r
                console.info("updateData(): meetingList.sort()");\r
                meetingList.sort(sortCalendarEntries);\r
@@ -555,7 +561,7 @@ function updateData()
                                }\r
                                var todayTodoResult = calendarService.IDataSource.GetList(todayTodoListFiltering);\r
                                var list = todayTodoResult.ReturnValue;\r
-                               todayTodoList = todayTodoList.concat(listToArray(list));\r
+                               todayTodoList = todayTodoList.concat(listToArray(list, calendarList[i]));\r
                        }\r
                        console.info("updateData(): todayTodoList.sort()");\r
                        todayTodoList.sort(sortCalendarEntries);\r
@@ -722,7 +728,7 @@ function updateData()
                                // generate html output\r
                                entriesHtml += '<tr>';\r
                                if (config['showCalendarIndicator'].Value && calendarList.length > 1) {\r
-                                       entriesHtml += '<td class="calendar' + calendarColors[entry.CalendarName] + '">&nbsp;</td>';\r
+                                       entriesHtml += '<td><span class="calendar' + calendarColors[entry.CalendarName] + '">&nbsp;</span></td>';\r
                                }\r
                                entriesHtml += '<td><img class="icon" src="' + entry.Type + '.png" /></td>';\r
                                if(date == null) {\r
@@ -1291,7 +1297,8 @@ function listCalendars()
 }\r
 \r
 // Copies all objects and their properties to an array. Data is copied so nothing gets lost when the reference is removed\r
-function listToArray(list)\r
+// Note: this will also set the "CalendarName" property of every entry to the name specified by the calendarName parameter if it has not been defined already\r
+function listToArray(list, calendarName)\r
 {\r
        var array = new Array();\r
        var item;\r
@@ -1301,6 +1308,10 @@ function listToArray(list)
                for(var i=0; i < entryFields.length; i++) {\r
                        itemCopy[entryFields[i]] = item[entryFields[i]];\r
                }\r
+               // for some reason, the CalendarName property is never correctly queried, so we assign it manually here\r
+               if (!itemCopy['CalendarName']) {\r
+                       itemCopy['CalendarName'] = calendarName;\r
+               }\r
                array.push(itemCopy);\r
                txt += array[array.length - 1].Summary + ", ";\r
        }\r
@@ -1376,12 +1387,13 @@ function sortCalendarEntries(a, b)
 \r
 function updateCalendarColors()\r
 {\r
+       var maxColors = 6;\r
        calendarColors = [];\r
-       if (calendarList.length > 6) {\r
+       if (calendarList.length > maxColors) {\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
+               calendarColors[calendarList[i]] = (i % maxColors) + 1;\r
        }\r
 }\r
 \r
@@ -1396,7 +1408,7 @@ hr { color:#ffffff; background-color:#ffffff; height:1px; text-align:left; borde
 .textInput { width:90%; }\r
 .credits { margin-left:40px; text-indent: -20px; margin-bottom:0px; }\r
 #homescreenView { width: 315px; height:91px; overflow:hidden; }\r
-#calendarList { position:absolute; left:10px; top:4px; width:295px; height:75px; overflow:hidden; }\r
+#calendarList { position:absolute; left:5px; top:4px; width:295px; height:75px; overflow:hidden; }\r
 #name { text-align:center; }\r
 #appicon { display: block; margin-left: auto; margin-right: auto; margin-top: 10px; }\r
 #smallappicon { width:22px; height:22px; margin-right:10px; float:left; }\r