]> code.delx.au - comingnext/blobdiff - comingNext/index.html
updated version info for next release (v1.29)
[comingnext] / comingNext / index.html
index 459441c5f3d64b5094669b5cc95f6b8886739ea9..372489b26d8233ca5c51b5945656f5f96a3e0127 100644 (file)
@@ -67,7 +67,7 @@ var config = {
 // Nothing of interest from here on...\r
 //-------------------------------------------------------\r
 var panelNum = 0; // use 1 for second panel\r
-var version = "1.28";\r
+var version = "1.29";\r
 var versionURL = "http://comingnext.sourceforge.net/version.xml";\r
 var calendarService = null;\r
 var cacheEntriesHtml = [];\r
@@ -87,6 +87,19 @@ var daylightsavingWinter = 0;
 var daylightsavingSummer = 0;\r
 var summertime = false;\r
 \r
+// this is a list of data fields a calendar event can have\r
+var entryFields = [\r
+       "id",\r
+       "Type",\r
+       "Summary",\r
+       "Location",\r
+       "Status",\r
+       "StartTime",\r
+       "EndTime",\r
+       "InstanceStartTime",\r
+       "InstanceEndTime"\r
+];\r
+\r
 window.onload = init;\r
 window.onresize = updateScreen;\r
 window.onshow = updateScreen;\r
@@ -475,6 +488,7 @@ function updateData()
                        var list = meetingResult.ReturnValue;\r
                        meetingList = meetingList.concat(listToArray(list));\r
                }\r
+               console.info("updateData(): meetingList.sort()");\r
                meetingList.sort(sortCalendarEntries);\r
 \r
                // todos don't, they start on 00:00 hrs., but should be visible anyway\r
@@ -495,6 +509,7 @@ function updateData()
                                var list = todayTodoResult.ReturnValue;\r
                                todayTodoList = todayTodoList.concat(listToArray(list));\r
                        }\r
+                       console.info("updateData(): todayTodoList.sort()");\r
                        todayTodoList.sort(sortCalendarEntries);\r
                        var entryLists = [todayTodoList, meetingList];\r
                } else {\r
@@ -535,6 +550,17 @@ function updateData()
                else\r
                        max = 30; // we can display a lot more events in fullscreen mode\r
 \r
+               var listinfo = "";\r
+               for (var i=0; i < entryLists.length; i++) {\r
+                       listinfo = listinfo + " " + entryLists[i].length;\r
+                       var entrieslist = "";\r
+                       for (var j=0; j < entryLists[i].length; j++) {\r
+                               entrieslist += entryLists[i][j].Summary + ", ";\r
+                       }\r
+                       console.info("updateData(): entrieslist: " + entrieslist);\r
+               }\r
+               console.info("updateData(): inner loop, " + entryLists.length + " lists, [" + listinfo + "] entries");\r
+               \r
                // the first outer loop iteration is for passed ToDos, the second loop is for all upcomming events (may also include ToDos)\r
                for (var i=0; counter < max && i < entryLists.length; i++) {\r
                        for (var j=0; (counter < max) && (j < entryLists[i].length); j++) {\r
@@ -542,17 +568,13 @@ function updateData()
                                counter++;\r
 \r
                                // output event info for debugging\r
-                               console.info(\r
-                                       'event: Id=' + entry.id + \r
-                                       ',Type=' + entry.Type + \r
-                                       ',Summary=' + entry.Summary + \r
-                                       ',Location=' + entry.Location + \r
-                                       ',Status=' + entry.Status + \r
-                                       ',StartTime=' + entry.StartTime +\r
-                                       ',EndTime=' + entry.EndTime +\r
-                                       ',InstanceStartTime=' + entry.InstanceStartTime +\r
-                                       ',InstanceEndTime=' + entry.InstanceEndTime\r
-                               );\r
+                               var entryInfo = "event: ";\r
+                               for(var k=0; k < entryFields.length; ++k) {\r
+                                       if (entry[entryFields[k]] != undefined) {\r
+                                               entryInfo += entryFields[k] + "=" + entry[entryFields[k]] + ",";\r
+                                       }\r
+                               }\r
+                               console.info(entryInfo);\r
 \r
                                // we don't want ToDos when includeTodos == false or when they are completed\r
                                if (entry.Type == 'ToDo' && (entry.Status == "TodoCompleted" || !config['includeTodos'].Value)) {\r
@@ -759,12 +781,18 @@ function init()
        window.setInterval('updateData()', 1000 * 60 * config['updateDataInterval'].Value);\r
        document.getElementById("settingsTitle").innerHTML = getLocalizedText('menu.settings');\r
 \r
-       mode = 0;\r
-       showHomescreen();\r
+       if (window.innerHeight > 91) {\r
+               mode = 0; // we're starting fullscreen, we set mode to homescreen in order to let updateScreen() do all the work for us\r
+       }\r
+       else {\r
+               mode = 1;\r
+       }\r
+       console.info("init(): updateScreen()");\r
        updateScreen();\r
        if (config['useBackgroundImage'].Value)\r
                // check for screen rotation every 1 secs\r
                window.setInterval('updateScreen()', 1000 * 1);\r
+       console.info("init(): finished...");\r
 }\r
 \r
 function createMenu()\r
@@ -942,6 +970,7 @@ function loadSettings()
        }\r
        var entry = result.ReturnValue.getNext();\r
        if (entry != undefined) {\r
+               console.info("Loading Settings...");\r
                // only reload settings if they chanced since the last reload\r
                if (settingsCache != entry.Summary)\r
                {\r
@@ -967,6 +996,9 @@ function loadSettings()
                        settingsCache = entry.Summary;\r
                        updateCssClasses();\r
                }\r
+               else {\r
+                       console.info("Settings already cached and did not change");\r
+               }\r
        }\r
        else {\r
                error("Failed to load settings, calendar entry could not be found");\r
@@ -1050,6 +1082,7 @@ function updateFullscreen()
 \r
 function showFullscreen()\r
 {\r
+       console.info("showFullscreen()");\r
        hideViews();\r
        document.getElementById("fullscreenView").style.display = "block";\r
        document.getElementById('body').className = "backgroundFullscreen";\r
@@ -1094,6 +1127,7 @@ function updateHomescreen()
 \r
 function showHomescreen()\r
 {\r
+       console.info("showHomescreen()");\r
        hideViews();\r
        document.getElementById("homescreenView").style.display = "block";\r
        document.getElementById('body').className = "background";\r
@@ -1203,44 +1237,53 @@ function listCalendars()
        }\r
 }\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
 {\r
-       var array = [];\r
+       var array = new Array();\r
        var item;\r
+       var txt = "";\r
        while (( item = list.getNext()) != undefined ) {\r
-               array.push(item);\r
+               var itemCopy = new Object();\r
+               for(var i=0; i < entryFields.length; i++) {\r
+                       itemCopy[entryFields[i]] = item[entryFields[i]];\r
+               }\r
+               array.push(itemCopy);\r
+               txt += array[array.length - 1].Summary + ", ";\r
        }\r
+       console.info("listToArray(): " + txt);\r
        return array;\r
 }\r
 \r
 function sortCalendarEntries(a, b)\r
 {\r
        var atime, btime;\r
+       console.info("sortCalendarEntries(" + a.Summary + "," + b.Summary + ")");\r
        \r
-       if (a['InstanceStartTime'] != null) {\r
-               atime = a['InstanceStartTime'];\r
+       if (a.InstanceStartTime != null) {\r
+               atime = a.InstanceStartTime;\r
        }\r
-       else if (a['StartTime'] != null) {\r
-               atime = a['StartTime'];\r
+       else if (a.StartTime != null) {\r
+               atime = a.StartTime;\r
        }\r
-       else if (a['InstanceEndTime'] != null) {\r
-               atime = a['InstanceEndTime'];\r
+       else if (a.InstanceEndTime != null) {\r
+               atime = a.InstanceEndTime;\r
        }\r
-       else if (a['EndTime'] != null) {\r
-               atime = a['EndTime'];\r
+       else if (a.EndTime != null) {\r
+               atime = a.EndTime;\r
        }\r
        \r
-       if (b['InstanceStartTime'] != null) {\r
-               btime = b['InstanceStartTime'];\r
+       if (b.InstanceStartTime != null) {\r
+               btime = b.InstanceStartTime;\r
        }\r
-       else if (b['StartTime'] != null) {\r
-               btime = b['StartTime'];\r
+       else if (b.StartTime != null) {\r
+               btime = b.StartTime;\r
        }\r
-       else if (b['InstanceEndTime'] != null) {\r
-               btime = b['InstanceEndTime'];\r
+       else if (b.InstanceEndTime != null) {\r
+               btime = b.InstanceEndTime;\r
        }\r
-       else if (b['EndTime'] != null) {\r
-               btime = b['EndTime'];\r
+       else if (b.EndTime != null) {\r
+               btime = b.EndTime;\r
        }\r
        \r
        if (atime && btime) {\r
@@ -1256,27 +1299,28 @@ function sortCalendarEntries(a, b)
                        return 1;\r
                }\r
                // sort by type\r
-               else if (a['Type'] != b['Type']) {\r
-                       if (a['Type'] < b['Type']) {\r
+               else if (a.Type != b.Type) {\r
+                       if (a.Type < b.Type) {\r
                                return -1;\r
                        }\r
-                       else if (a['Type'] > b['Type']) {\r
+                       else if (a.Type > b.Type) {\r
                                return 1;\r
                        }\r
                }\r
                // sort by description\r
-               else if (a['Summary'] && b['Summary'] && a['Summary'] != b['Summary']) {\r
-                       if (a['Summary'] < b['Summary']) {\r
+               else if (a.Summary && b.Summary && a.Summary != b.Summary) {\r
+                       if (a.Summary < b.Summary) {\r
                                return -1;\r
                        }\r
-                       else if (a['Summary'] > b['Summary']) {\r
+                       else if (a.Summary > b.Summary) {\r
                                return 1;\r
                        }\r
-               }               \r
+               }\r
        }\r
 \r
        return 0;\r
 }\r
+\r
 </script>\r
 \r
 <style type="text/css">\r