]> code.delx.au - comingnext/commitdiff
Merge branch 'master' of ssh://comingnext.git.sourceforge.net/gitroot/comingnext...
authorMichael Prager <michael@pragers.de>
Sat, 14 May 2011 14:05:35 +0000 (16:05 +0200)
committerMichael Prager <michael@pragers.de>
Sat, 14 May 2011 14:05:35 +0000 (16:05 +0200)
Readme.txt
build.pl
comingNext/Info.plist
comingNext/de.lproj/localizedTextStrings.js
comingNext/es.lproj/localizedTextStrings.js
comingNext/fr.lproj/localizedTextStrings.js
comingNext/index.html
comingNext/it.lproj/localizedTextStrings.js
comingNext/localizedTextStrings.js
comingNext/pt-BR.lproj/localizedTextStrings.js
comingNext/ru.lproj/localizedTextStrings.js

index afcaf8df35083fddac00f026a97407e728e90614..1aa2408d45f3dead33f064044b9792e0164e6fb5 100644 (file)
@@ -63,9 +63,10 @@ How to obtain log file for solving issues:
 In order to analyse problems or bugs, it can help to obtain the detailed widget \r
 log file. You can generate a log by following these steps:\r
 \r
-1. Open your browser and go to Web > Settings > General\r
-2. Set "JavaScript Error Notification" to "Create Log file"\r
-3. Remove the widget from your homescreen and add it again\r
+1. Within the widget, go to Settings and check "Enable Logging"\r
+2. Open your browser and go to Web > Settings > General\r
+3. Set "JavaScript Error Notification" to "Create Log file"\r
+4. Remove the widget from your homescreen and add it again\r
 \r
 The log file will be generated here: C:\Data\jslog_widget.log. When you report\r
 a problem, send along this file so that the developers can analyse the issue.\r
@@ -261,3 +262,12 @@ Changelog:
   - fixed calendar indicators not showing in some cases\r
   - fixed homescreen widget not updating properly on N8\r
   - added help menu\r
+1.32 () by Michael Prager\r
+  - improved performance and battery life (reloading and sorting calendar \r
+    data has been reduced)\r
+  - fixed settings being lost when updating to a newer version\r
+  - added support for Location field for "all day" events. You'll have to wait \r
+    until Nokia fixes their firmware before this change will be visible though :-P\r
+  - fixed and improved spanish translation\r
+  - added "enableLogging" option which needs to be turned on if you want to \r
+    generate debug logs\r
index f8ac16ad8415c11964792047ed8518d12419b5f1..b429a9e95fdfb6523f601ffbe57dbb326efd96fd 100644 (file)
--- a/build.pl
+++ b/build.pl
@@ -1,6 +1,6 @@
 #!/usr/bin/perl\r
 \r
-my $version = "1.31";\r
+my $version = "1.32";
 \r
 use warnings;\r
 use strict;\r
index a9ac0d7f69f6327edd399a3e48dc43e8078cba21..1711c1682570b993c3579c80d6565633a244542e 100644 (file)
@@ -2,9 +2,9 @@
 <!DOCTYPE plist PUBLIC "-//Nokia//DTD PLIST 1.0//EN" "http://www.nokia.com/NOKIA_COM_1/DTDs/plist-1.0.dtd">\r
 <plist version="1.0">\r
 <dict>\r
-       <key>DisplayName</key>                  <string>ComingNext 1.31</string>\r
+       <key>DisplayName</key>                  <string>ComingNext 1.32</string>\r
        <key>Identifier</key>                   <string>ar.com.cochambre.symbian.wrt.comingnext</string>\r
-       <key>Version</key>                      <string>1.31</string>\r
+       <key>Version</key>                      <string>1.32</string>\r
        <key>MainHTML</key>                     <string>index.html</string>\r
        <key>AllowNetworkAccess</key>           <true/>\r
        <key>MiniViewEnabled</key>              <true/> \r
index faf9a0ab751ebd3f57d061300fe98bfaf0b7ecc6..21dd2b04705697ed213ad73a6e880c4a9b8f2c9c 100644 (file)
@@ -76,6 +76,8 @@ localizedText['settings.name.showCalendarIndicator'] = 'Zeige Farbindikator für
 localizedText['settings.info.showCalendarIndicator'] = 'falls mehrere Kalender benutzt werden, wird mit Hilfe eines Farbbalkens angezeigt, zu welchem Kalender ein Ereignis gehört';\r
 localizedText['settings.name.excludedCalendars'] = 'Anzuzeigende Kalender';\r
 localizedText['settings.info.excludedCalendars'] = 'falls du mehrere Kalender angelegt hast, kannst du hier festlegen, welche Kalender angezeigt werden sollen';\r
+localizedText['settings.name.enableLogging'] = 'Enable Logging';\r
+localizedText['settings.info.enableLogging'] = 'write debug information to C:\\Data\\jslog_widget.log. Note: Javascript error logging to file needs to be enabled in your browser settings for this.';\r
 localizedText['settings.name.cssStyle_background'] = '.background';\r
 localizedText['settings.info.cssStyle_background'] = 'Definiert den Hintergrund des Widgets. Falls Sie ein Hintergrundbild verwenden möchten, aktivieren Sie die Einstellung "Benutze Hintergrundbild". Für die Standardthemes des N97 ("schwarz", "grau" und "helles Blau") lauten die Farbcodes #292029, #e7dfe7 und #009aef.';\r
 localizedText['settings.name.cssStyle_backgroundFullscreen'] = '.backgroundFullscreen';\r
index bd3e0c61de71326b1faa0c6a6e6e291b10418ccb..ff08ff53a59eb43e71c5c47c681ce981a8a3daf7 100644 (file)
@@ -1,6 +1,6 @@
 var localizedText = new Array();\r
 \r
-localizedText['menu.settings'] = 'Configuración';\r
+localizedText['menu.settings'] = 'Ajustes';\r
 localizedText['menu.openCalendarApp'] = 'Abrir Calendario';\r
 localizedText['menu.about'] = 'Acerca de';\r
 localizedText['menu.update'] = 'Comprobar nueva versión';\r
@@ -14,8 +14,8 @@ localizedText['settings.save'] = 'Guardar';
 localizedText['settings.cancel'] = 'Cancelar';\r
 \r
 localizedText['settings.name.monthRange'] = 'Rango del Mes';\r
-localizedText['settings.info.monthRange'] = 'Número de meses incluídos en lista de evento';\r
-localizedText['settings.name.includeTodos'] = 'Incluir ToDos';\r
+localizedText['settings.info.monthRange'] = 'Número de meses incluidos en lista de eventos';\r
+localizedText['settings.name.includeTodos'] = 'Incluir tareas';\r
 localizedText['settings.info.includeTodos'] = 'Desactiva para quitar "ToDos" de la lista de eventos';\r
 localizedText['settings.name.useBackgroundImage'] = 'Usar Imagen de Fondo';\r
 localizedText['settings.info.useBackgroundImage'] = 'Usar background_portrait.png y background_landscape.png para transparencia artificial. Desativa para usar un color de fondo sólido';\r
@@ -76,6 +76,8 @@ localizedText['settings.name.showCalendarIndicator'] = 'Mostrar indicador de cal
 localizedText['settings.info.showCalendarIndicator'] = 'Si se usan varios calendarios simultáneamente, se usará una pequeña barra de color para indicar a cuál de los calendarios pertenece un evento';\r
 localizedText['settings.name.excludedCalendars'] = 'Calendarios incluidos';\r
 localizedText['settings.info.excludedCalendars'] = 'Aquí se puede especificar qué calendarios se mostrarán si se han definido varios calendarios';\r
+localizedText['settings.name.enableLogging'] = 'Enable Logging';\r
+localizedText['settings.info.enableLogging'] = 'write debug information to C:\\Data\\jslog_widget.log. Note: Javascript error logging to file needs to be enabled in your browser settings for this.';\r
 localizedText['settings.name.cssStyle_background'] = '.background';\r
 localizedText['settings.info.cssStyle_background'] = 'Define el fondo de aplicación del widget. Para usar una imagen de fondo personalizada, ponga useBackgroundImage = true debajo. Para el temo por defecto, negro, gris, y azul claro, los códigos son #292029, #e7dfe7, #009aef';\r
 localizedText['settings.name.cssStyle_backgroundFullscreen'] = '.backgroundFullscreen';\r
@@ -110,7 +112,7 @@ localizedText['settings.name.cssStyle_calendar5'] = '.calendar5';
 localizedText['settings.info.cssStyle_calendar5'] = 'Define el indicador de color para los eventos del calendario 5';\r
 localizedText['settings.name.cssStyle_calendar6'] = '.calendar6';\r
 localizedText['settings.info.cssStyle_calendar6'] = 'Define el indicador de color para los eventos del calendario 6';\r
-localizedText['settings.cssStyle_prefix'] = 'CSS Style for ';\r
+localizedText['settings.cssStyle_prefix'] = 'Estilo CSS para ';\r
 \r
 localizedText['update.current'] = 'Versión instalada: ';\r
 localizedText['update.checking'] = 'Comprobando actualización...';\r
index 4fa74477a2d3c53a15f96f01080dfb43b57973fb..2255b1c524fb075b239675bb6de2cd69c4a17ff3 100644 (file)
@@ -76,6 +76,8 @@ localizedText['settings.name.showCalendarIndicator'] = 'Show Calendar Indicator'
 localizedText['settings.info.showCalendarIndicator'] = 'if multiple calendars are used, a small color bar will be shown to indicate to which calendar an event belongs';\r
 localizedText['settings.name.excludedCalendars'] = 'Included Calendars';\r
 localizedText['settings.info.excludedCalendars'] = 'here you can specify which calendars should be displayed if multiple calendars have been defined';\r
+localizedText['settings.name.enableLogging'] = 'Enable Logging';\r
+localizedText['settings.info.enableLogging'] = 'write debug information to C:\\Data\\jslog_widget.log. Note: Javascript error logging to file needs to be enabled in your browser settings for this.';\r
 localizedText['settings.name.cssStyle_background'] = '.background';\r
 localizedText['settings.info.cssStyle_background'] = 'Definit le style CSS du fond du widget. Si vous voulez mettre une image de fond, cocher "Utiliser Background Image". Pour le th&egrave;me par d&eacute;faut, noir, gris, and bleu, les codes sont #292029, #e7dfe7, #009aef';\r
 localizedText['settings.name.cssStyle_backgroundFullscreen'] = '.backgroundFullscreen';\r
index 7e774b94776fc97fb990360e248f64f20c02d9f6..13745ef3f7e0007cfde8b0a3cb7b17af88735d63 100644 (file)
@@ -7,23 +7,23 @@
 \r
 <style type="text/css">\r
 /* The following classes can be modified by widget settings */\r
-.background { }\r
-.backgroundFullscreen { }\r
+.background { color:#ffffff; background-color:#000000 }\r
+.backgroundFullscreen { color:#ffffff; background-color:#000000 }\r
 .weekDay { }\r
 .date { }\r
-.today { }\r
-.tomorrow { }\r
+.today { color:#ff0000 }\r
+.tomorrow { color:#0000ff }\r
 .time { }\r
-.now { }\r
+.now { color:#ff00ff }\r
 .description { }\r
-.icon { }\r
-.overdue {}\r
-.calendar1 {}\r
-.calendar2 {}\r
-.calendar3 {}\r
-.calendar4 {}\r
-.calendar5 {}\r
-.calendar6 {}\r
+.icon { width:15px; height:15px }\r
+.overdue { color:#ffff00 }\r
+.calendar1 { background-color:#0757cf }\r
+.calendar2 { background-color:#579f37 }\r
+.calendar3 { background-color:#ff9f07 }\r
+.calendar4 { background-color:#af8fef }\r
+.calendar5 { background-color:#57afbf }\r
+.calendar6 { background-color:#9fdf57 }\r
 </style>\r
 \r
 <script type="text/javascript" src="localizedTextStrings.js" charset="utf-8" />\r
@@ -57,6 +57,7 @@ var config = {
        hideWidgetOnCalendarOpen: { Type: 'Bool', Default: false, Value: false,},\r
        showCalendarIndicator: { Type: 'Bool', Default: true, Value: true,},\r
        excludedCalendars: { Type: 'Array', Default: [], Value: [],},\r
+       enableLogging: { Type: 'Bool', Default: false, Value: false,},\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
@@ -82,7 +83,7 @@ var config = {
 // Nothing of interest from here on...\r
 //-------------------------------------------------------\r
 var panelNum = 0; // use 1 for second panel\r
-var version = "1.31";\r
+var version = "1.32";\r
 var versionURL = "http://comingnext.sourceforge.net/version.xml";\r
 var calendarService = null;\r
 var cacheEntriesHtml = [];\r
@@ -98,8 +99,11 @@ var calendarList = [];
 var calendarColors = [];\r
 var updateTimer = null;\r
 var screenRotationTimer = null;\r
-var lastUpdateTime = now;\r
+var lastUpdateTime = now; // last time we updated the display\r
+var lastReloadTime = null; // last time we fetched calendar data\r
+var reloadInterval = 6 * 60 * 60 * 1000; // = 6 hours; time interval for reloading calendar data\r
 var errorOccured = false;\r
+var entryLists = null; // stores all fetched calendar entries until data is refreshed\r
 \r
 // vars for daylight saving time\r
 var summertime = false; // true, if current date is in summer, false if in winter\r
@@ -119,17 +123,13 @@ var entryFields = [
        "InstanceEndTime"\r
 ];\r
 \r
-window.onload = init;\r
-window.onresize = updateScreen;\r
-window.onshow = updateScreen;\r
-\r
 function isLeapYear( year ) {\r
        if (( year % 4 == 0 && year % 100 != 0 ) || year % 400 == 0 )\r
                return true;\r
        else\r
                return false;\r
 }\r
-         \r
+\r
 function calcLeapYear(year, days)\r
 {\r
        if (isLeapYear(year))\r
@@ -290,7 +290,7 @@ function collectLocales()
                                month = tmp;\r
                        }\r
 \r
-                       console.info(entry.StartTime + ' -> ' + month + ' ' + counter);\r
+                       log(entry.StartTime + ' -> ' + month + ' ' + counter);\r
                        ids[counter] = entry.id;\r
                        months_translated[month] = counter + 1;\r
                        counter++;\r
@@ -299,7 +299,7 @@ function collectLocales()
                error(e + ', line ' + e.line);\r
                return;\r
        }\r
-       console.info(ids);\r
+       log(ids);\r
        try {\r
                var criteria = new Object();\r
                criteria.Type = "CalendarEntry";\r
@@ -363,13 +363,14 @@ function cancelNotification()
 \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
+       log("callback(): panelNum: " + panelNum + "  transId: " + transId + "  eventCode: " + eventCode + " result.ErrorCode: " + result.ErrorCode);\r
+       lastReloadTime = null; // force calendar data reload on next update\r
        updateData();\r
 }\r
 \r
 function settingsCallback(transId, eventCode, result)\r
 {\r
-       console.info("settingsCallback(): panelNum: %d  transId: %d  eventCode: %d result.ErrorCode: %d", panelNum, transId, eventCode, result.ErrorCode);\r
+       log("settingsCallback(): panelNum: " + panelNum + "  transId: " + transId + "  eventCode: " + eventCode + " result.ErrorCode: " + result.ErrorCode);\r
        loadSettings();\r
 }\r
 \r
@@ -437,11 +438,11 @@ function parseDate(dateString)
                // work around bug in Nokias calendar api resulting in dates within a different DST to be off by 1 hour\r
                if (summertime && !dateSummerTime) {\r
                        result = new Date(result.getTime() - 1000 * 60 * 60 * config['daylightSavingOffset'].Value); // -1 hour\r
-                       console.info('parseDate(): fixing time -1h: ' + result);\r
+                       log('parseDate(): fixing time -1h: ' + result);\r
                }\r
                else if (!summertime && dateSummerTime) {\r
                        result = new Date(result.getTime() + 1000 * 60 * 60 * config['daylightSavingOffset'].Value); // +1 hour\r
-                       console.info('parseDate(): fixing time +1h: ' + result);\r
+                       log('parseDate(): fixing time +1h: ' + result);\r
                }\r
        }\r
 \r
@@ -518,7 +519,7 @@ function formatTime(date)
 \r
 function updateData()\r
 {\r
-       console.info('updateData()');\r
+       log('updateData()');\r
        if (errorOccured) {\r
                return;\r
        }\r
@@ -530,65 +531,72 @@ function updateData()
                updateCalendarColors();\r
                cancelNotification();\r
                requestNotification();\r
+               lastReloadTime = null; // force calendar data reload on this update\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
-               now = new Date();\r
-               summertime = isSummertime(now); // cache summer time info for today\r
-               var meetingList = [];\r
-               for(var i=0; i < calendarList.length; i++) {\r
-                       // ignore excluded calendars\r
-                       if (config['excludedCalendars'].Value.indexOf(calendarList[i]) != -1)\r
-                               continue;\r
-                       var meetingListFiltering = {\r
-                               Type:'CalendarEntry',\r
-                               Filter:{\r
-                                       CalendarName: calendarList[i],\r
-                                       StartRange: (new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0)),\r
-                                       EndRange: (new Date(now.getFullYear(), now.getMonth() + config['monthRange'].Value, now.getDate(), 0, 0, 0))\r
-                               }\r
-                       }\r
-                       var meetingResult = calendarService.IDataSource.GetList(meetingListFiltering);\r
-                       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, calendarList[i]));\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
-               // this will generate a list of passed todos. We have to check if they have been marked as "done" yet\r
-               if (config['includeTodos'].Value) {\r
-                       var todayTodoList = [];\r
+       now = new Date();\r
+       \r
+       // only reload calendar data every 6 hours, visual updates occure more often\r
+       if (!lastReloadTime || now.getTime() - lastReloadTime.getTime() > reloadInterval) {\r
+               log('updateData(): reloading calendar data');\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
+                       summertime = isSummertime(now); // cache summer time info for today\r
+                       var meetingList = [];\r
                        for(var i=0; i < calendarList.length; i++) {\r
                                // ignore excluded calendars\r
                                if (config['excludedCalendars'].Value.indexOf(calendarList[i]) != -1)\r
                                        continue;\r
-                               var todayTodoListFiltering = {\r
+                               var meetingListFiltering = {\r
                                        Type:'CalendarEntry',\r
                                        Filter:{\r
                                                CalendarName: calendarList[i],\r
-                                               Type: 'ToDo',\r
-                                               StartRange: (new Date(now.getFullYear() - 1, now.getMonth(), now.getDate(), 0, 0, 0)),\r
-                                               EndRange: (new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 1))\r
+                                               StartRange: (new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 0)),\r
+                                               EndRange: (new Date(now.getFullYear(), now.getMonth() + config['monthRange'].Value, now.getDate(), 0, 0, 0))\r
+                                       }\r
+                               }\r
+                               var meetingResult = calendarService.IDataSource.GetList(meetingListFiltering);\r
+                               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, calendarList[i]));\r
+                       }\r
+                       log("updateData(): meetingList.sort()");\r
+                       meetingList.sort(sortCalendarEntries);\r
+\r
+                       // todos don't, they start on 00:00 hrs., but should be visible anyway\r
+                       // this will generate a list of passed todos. We have to check if they have been marked as "done" yet\r
+                       if (config['includeTodos'].Value) {\r
+                               var todayTodoList = [];\r
+                               for(var i=0; i < calendarList.length; i++) {\r
+                                       // ignore excluded calendars\r
+                                       if (config['excludedCalendars'].Value.indexOf(calendarList[i]) != -1)\r
+                                               continue;\r
+                                       var todayTodoListFiltering = {\r
+                                               Type:'CalendarEntry',\r
+                                               Filter:{\r
+                                                       CalendarName: calendarList[i],\r
+                                                       Type: 'ToDo',\r
+                                                       StartRange: (new Date(now.getFullYear() - 1, now.getMonth(), now.getDate(), 0, 0, 0)),\r
+                                                       EndRange: (new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0, 0, 1))\r
+                                               }\r
                                        }\r
+                                       var todayTodoResult = calendarService.IDataSource.GetList(todayTodoListFiltering);\r
+                                       var list = todayTodoResult.ReturnValue;\r
+                                       todayTodoList = todayTodoList.concat(listToArray(list, calendarList[i]));\r
                                }\r
-                               var todayTodoResult = calendarService.IDataSource.GetList(todayTodoListFiltering);\r
-                               var list = todayTodoResult.ReturnValue;\r
-                               todayTodoList = todayTodoList.concat(listToArray(list, calendarList[i]));\r
+                               log("updateData(): todayTodoList.sort()");\r
+                               todayTodoList.sort(sortCalendarEntries);\r
+                               entryLists = [todayTodoList, meetingList];\r
+                       } else {\r
+                               entryLists = [meetingList];\r
                        }\r
-                       console.info("updateData(): todayTodoList.sort()");\r
-                       todayTodoList.sort(sortCalendarEntries);\r
-                       var entryLists = [todayTodoList, meetingList];\r
-               } else {\r
-                       var entryLists = [meetingList];\r
+                       lastReloadTime = new Date();\r
+               } catch(e) {\r
+                       error('loading Calendar items list:' + e + ', line ' + e.line);\r
+                       return;\r
                }\r
-       } catch(e) {\r
-               error('loading Calendar items list:' + e + ', line ' + e.line);\r
-               return;\r
        }\r
 \r
        try {\r
@@ -621,16 +629,18 @@ 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
+               if (config['enableLogging'].Value) {\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
+                               log("updateData(): entrieslist: " + entrieslist);\r
                        }\r
-                       console.info("updateData(): entrieslist: " + entrieslist);\r
+                       log("updateData(): inner loop, " + entryLists.length + " lists, [" + listinfo + "] entries");\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
@@ -645,18 +655,18 @@ function updateData()
                                                entryInfo += entryFields[k] + "=" + entry[entryFields[k]] + ",";\r
                                        }\r
                                }\r
-                               console.info(entryInfo);\r
+                               log(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
-                                       console.info('skipping ' + entry.id );\r
+                                       log('skipping ' + entry.id );\r
                                        counter--;\r
                                        continue;\r
                                }\r
 \r
                                // make sure that we don't include an event twice (useful for ToDos that might come up twice)\r
                                if (eventIds[entry.id] == 1 && entry.Type == 'ToDo') {\r
-                                       console.info('skipped (already included) ' + entry.id);\r
+                                       log('skipped (already included) ' + entry.id);\r
                                        counter--;\r
                                        continue;\r
                                } else\r
@@ -664,7 +674,7 @@ function updateData()
 \r
                                // summary can be undefined!\r
                                var Summary = ((entry.Summary == null) ? '' : entry.Summary);\r
-                               if (entry.Type == 'Meeting' && entry.Location != '' && config['showLocation'].Value)\r
+                               if (entry.Location != '' && entry.Location != undefined && config['showLocation'].Value)\r
                                        Summary += ', ' + entry.Location;\r
                                \r
                                // fix by yves: determine start and end dates/times\r
@@ -679,15 +689,15 @@ function updateData()
 \r
                                // Convert date/time string to Date object\r
                                var date = parseDate(entryDate);\r
-                               console.info('date: ' + date);\r
+                               log('date: ' + date);\r
                                var endDate = ((entryEndTime == null) ? null : parseDate(entryEndTime));\r
-                               console.info('endDate: ' + endDate);\r
+                               log('endDate: ' + endDate);\r
 \r
                                // check if meeting event has already passed\r
                                if (entry.Type == 'Meeting') {\r
                                        var compareTime = ((endDate == null) ? date.getTime() : endDate.getTime());\r
                                        if (now.getTime() > compareTime) {\r
-                                               console.info('skipping Meeting (already passed) ' + entry.id);\r
+                                               log('skipping Meeting (already passed) ' + entry.id);\r
                                                counter--;\r
                                                eventIds[entry.id] = 0;\r
                                                continue;\r
@@ -698,7 +708,7 @@ function updateData()
                                if (entry.Type == 'Anniversary') {\r
                                        var tmp = new Date(now.getFullYear(), now.getMonth(), now.getDate(), 0,0,0);\r
                                        if (date.getTime() < tmp.getTime()) {\r
-                                               console.info('skipping Anniversary (already passed) ' + entry.id);\r
+                                               log('skipping Anniversary (already passed) ' + entry.id);\r
                                                counter--;\r
                                                eventIds[entry.id] = 0;\r
                                                continue;\r
@@ -708,9 +718,9 @@ function updateData()
                                // fix DayEvents end time. End times are off by 1 Second. It's possible that the event has already passed\r
                                if (entry.Type == 'DayEvent' && endDate != null) {\r
                                        endDate.setMinutes(endDate.getMinutes() - 1);\r
-                                       console.info('fixing DayEvent endDate: ' + endDate);\r
+                                       log('fixing DayEvent endDate: ' + endDate);\r
                                        if (now.getTime() > endDate.getTime()) {\r
-                                               console.info('event already passed ' + entry.id);\r
+                                               log('event already passed ' + entry.id);\r
                                                counter--;\r
                                                eventIds[entry.id] = 0;\r
                                                continue;\r
@@ -722,13 +732,13 @@ function updateData()
                                        // check if we are between start and endtime\r
                                        if ((date.getTime() < now.getTime()) && (now.getTime() < endDate.getTime())) {\r
                                                date = now; // change appointment date/time to now\r
-                                               console.info('event is currently taking place: ' + date);\r
+                                               log('event is currently taking place: ' + date);\r
                                        }\r
                                }\r
 \r
                                // skip events for the first panel in case this is the second one and we're not in fullscreen mode\r
                                if (mode == 0 && panelNum > 0 && counter < panelNum * config['eventsPerWidget'].Value + 1) {\r
-                                       console.info('skipping (already in first widget) ' + entry.id);\r
+                                       log('skipping (already in first widget) ' + entry.id);\r
                                        continue;\r
                                }\r
                                \r
@@ -802,8 +812,11 @@ function updateData()
        }\r
 }\r
 \r
+// called by handleOnShow() and onResize events\r
 function updateScreen()\r
 {\r
+       log('updateScreen()');\r
+\r
        // check if opening fullscreen\r
        if( window.innerHeight > 91 && mode == 0) {\r
                mode = 1;\r
@@ -818,13 +831,18 @@ function updateScreen()
        }\r
        \r
        if (mode == 0)\r
-               updateHomescreen();\r
+               updateHomescreen(); // check for screen rotation\r
        else if (mode == 1)\r
                updateFullscreen();\r
-       \r
+}\r
+\r
+function handleOnShow()\r
+{\r
+       updateScreen();\r
+\r
        var time = new Date();\r
        if (time.getTime() - lastUpdateTime.getTime() > config['updateDataInterval'].Value * 60 * 1000) {\r
-               console.info('updateScreen(): force updateData() because last update was too long ago (' + (time.getTime() - lastUpdateTime.getTime()) / 1000 + 's)');\r
+               log('updateScreen(): force updateData() because last update was too long ago (' + (time.getTime() - lastUpdateTime.getTime()) / 1000 + 's)');\r
                clearUpdateTimer();\r
                updateData();\r
                setUpdateTimer(); // reinitialize update timer\r
@@ -845,7 +863,7 @@ function launchCalendar()
 \r
 function init()\r
 {\r
-       console.info('New widget instance starting up...');\r
+       log('New widget instance starting up...');\r
        \r
        try {\r
                // call calendar service\r
@@ -872,12 +890,23 @@ function init()
        else {\r
                mode = 1;\r
        }\r
-       console.info("init(): updateScreen()");\r
+       log("init(): updateScreen()");\r
        updateScreen();\r
        if (config['useBackgroundImage'].Value)\r
                // check for screen rotation every 1 secs\r
-               screenRotationTimer = window.setInterval('updateScreen()', 1000 * 1);\r
-       console.info("init(): finished...");\r
+               screenRotationTimer = window.setInterval('checkOrientation()', 1000 * 1);\r
+       \r
+       // call updateScreen() when widget changes from background to forground\r
+       window.widget.onshow = handleOnShow;\r
+\r
+       log("init(): finished...");\r
+}\r
+\r
+function checkOrientation()\r
+{\r
+       //updateScreen();\r
+       if (mode == 0)\r
+               updateHomescreen(); // check for screen rotation\r
 }\r
 \r
 function setUpdateTimer()\r
@@ -892,7 +921,7 @@ function clearUpdateTimer()
 \r
 function updateTimerCallback()\r
 {\r
-       console.info("updateTimerCallback()");\r
+       log("updateTimerCallback()");\r
        updateData();\r
 }\r
 \r
@@ -933,13 +962,16 @@ function showSettings()
                                config[key].Value = document.forms[0].elements["settings." + key].value;\r
                        else if (config[key].Type == 'Int') {\r
                                config[key].Value = parseInt(document.forms[0].elements["settings." + key].value);\r
-                               if (config[key].Value < 0)\r
+                               if (config[key].Value < 0 || isNaN(config[key].Value))\r
                                        config[key].Value = config[key].Default;\r
                        }\r
                        else if (config[key].Type == 'Bool')\r
                                config[key].Value = document.forms[0].elements["settings." + key].checked;\r
-                       else if (config[key].Type == 'UID')\r
+                       else if (config[key].Type == 'UID') {\r
                                config[key].Value = parseInt(document.forms[0].elements["settings." + key].value);\r
+                               if (isNaN(config[key].Value))\r
+                                       config[key].Value = config[key].Default;\r
+                       }\r
                        else if (config[key].Type == 'Enum') {\r
                                config[key].Value = document.forms[0].elements["settings." + key].value;\r
                                if (config[key].ValidValues.indexOf(config[key].Value) == -1)\r
@@ -1034,8 +1066,8 @@ function getSettingsCalEntryId()
                var listFiltering = {\r
                        Type:'CalendarEntry', \r
                        Filter:{\r
-                               StartRange: new Date(2000, 0, 1),\r
-                               EndRange: new Date(2000, 0, 1),\r
+                               StartRange: new Date(1999, 11, 30), // note: due to Nokia's buggy calendar API, the settings event can be on 01.01.2000 AND on 31.12.1999, depending on when the calendar entry was created (in summer or winter). It is not even possible to narrow the search down to these two days (probably because of DST offsets). So we're looking for an event between 30.12.1999 and 02.01.2000!\r
+                               EndRange: new Date(2000, 0, 2),\r
                                SearchText: 'ComingNext Settings|',\r
                                Type: 'DayEvent'\r
                        }\r
@@ -1049,7 +1081,7 @@ function getSettingsCalEntryId()
                var entry = list.getNext();\r
                if (entry != undefined) {\r
                        settingsCalEntryId = entry.LocalId;\r
-                       console.info("settingsCalEntryId=" + settingsCalEntryId);\r
+                       log("settingsCalEntryId=" + settingsCalEntryId);\r
                }\r
                else { // create settings item\r
                        var item = new Object();\r
@@ -1096,7 +1128,7 @@ function loadSettings()
        }\r
        var entry = result.ReturnValue.getNext();\r
        if (entry != undefined) {\r
-               console.info("Loading Settings...");\r
+               log("Loading Settings...");\r
                // only reload settings if they chanced since the last reload\r
                if (settingsCache != entry.Summary)\r
                {\r
@@ -1107,17 +1139,27 @@ function loadSettings()
                                var pair = stringlist[i].split('=');\r
                                var key = pair[0];\r
                                var value = pair[1];\r
-                               console.info('stringlist: ' + key + '=\'' + value + '\'');\r
-                               if (config[key].Type == 'Int')\r
+                               if (key == null || value == null || config[key] == null) {\r
+                                       log('Warning: unknown or invalid setting: ' + stringlist[i]);\r
+                                       continue;\r
+                               }\r
+                               log('stringlist: ' + key + '=\'' + value + '\'');\r
+                               if (config[key].Type == 'Int') {\r
                                        config[key].Value = Number(value);\r
+                                       if (isNaN(config[key].Value))\r
+                                               config[key].Value = config[key].Default;\r
+                               }\r
                                else if (config[key].Type == 'String')\r
                                        config[key].Value = value;\r
                                else if (config[key].Type == 'Bool')\r
                                        config[key].Value = (value == 'true')\r
                                else if (config[key].Type == 'Enum')\r
                                        config[key].Value = value;\r
-                               else if (config[key].Type == 'UID')\r
+                               else if (config[key].Type == 'UID') {\r
                                        config[key].Value = Number(value);\r
+                                       if (isNaN(config[key].Value))\r
+                                               config[key].Value = config[key].Default;\r
+                               }\r
                                else if (config[key].Type == 'Array') {\r
                                        config[key].Value = value.split("^");\r
                                        if (config[key].Value.length == 1 && config[key].Value[0] == "") {\r
@@ -1129,7 +1171,7 @@ function loadSettings()
                        updateCssClasses();\r
                }\r
                else {\r
-                       console.info("Settings already cached and did not change");\r
+                       log("Settings already cached and did not change");\r
                }\r
        }\r
        else {\r
@@ -1166,7 +1208,7 @@ function saveSettings()
        criteria.Type = "CalendarEntry";\r
        criteria.Item = item;\r
 \r
-       console.info("Saving settings to calendar entry: " + item.Summary);\r
+       log("Saving settings to calendar entry: " + item.Summary);\r
        try {\r
                var result = calendarService.IDataSource.Add(criteria);\r
                if (result.ErrorCode)\r
@@ -1175,6 +1217,7 @@ function saveSettings()
                error("saveSettings: " + e + ', line ' + e.line);\r
        }\r
        \r
+       lastReloadTime = null; // force calendar data reload on next update\r
        clearUpdateTimer();\r
        setUpdateTimer();\r
 }\r
@@ -1223,7 +1266,7 @@ function updateFullscreen()
 \r
 function showFullscreen()\r
 {\r
-       console.info("showFullscreen()");\r
+       log("showFullscreen()");\r
        hideViews();\r
        document.getElementById("fullscreenView").style.display = "block";\r
        document.getElementById('body').className = "backgroundFullscreen";\r
@@ -1271,7 +1314,7 @@ function updateHomescreen()
 \r
 function showHomescreen()\r
 {\r
-       console.info("showHomescreen()");\r
+       log("showHomescreen()");\r
        hideViews();\r
        document.getElementById("homescreenView").style.display = "block";\r
        document.getElementById('body').className = "background";\r
@@ -1354,6 +1397,10 @@ function hideViews()
 \r
 function listCalendars()\r
 {\r
+       if (errorOccured) {\r
+               return null;\r
+       }\r
+\r
        try {\r
                var criteria = {\r
                        Type:'Calendar', \r
@@ -1373,7 +1420,7 @@ function listCalendars()
                while (( item = calendarListIterator.getNext()) != undefined ) {\r
                        calendars[count++] = item;\r
                }\r
-               console.info("Available Calendars: " + calendars.join(", "));\r
+               log("Available Calendars: " + calendars.join(", "));\r
                return calendars;\r
        } catch(e) {\r
                error('listing calendars:' + e + ', line ' + e.line);\r
@@ -1400,14 +1447,14 @@ function listToArray(list, calendarName)
                array.push(itemCopy);\r
                txt += array[array.length - 1].Summary + ", ";\r
        }\r
-       console.info("listToArray(): " + txt);\r
+       log("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
+       log("sortCalendarEntries(" + a.Summary + "," + b.Summary + ")");\r
        \r
        if (a.InstanceStartTime != null) {\r
                atime = a.InstanceStartTime;\r
@@ -1502,13 +1549,19 @@ function updateCalendarColors()
        var maxColors = 6;\r
        calendarColors = [];\r
        if (calendarList.length > maxColors) {\r
-               console.info("updateCalendarColors(): Warning: more calendars than available indicator colors");\r
+               log("updateCalendarColors(): Warning: more calendars than available indicator colors");\r
        }\r
        for(var i=0; i < calendarList.length; i++) {\r
                calendarColors[calendarList[i]] = (i % maxColors) + 1;\r
        }\r
 }\r
 \r
+function log(message) {\r
+       if (config['enableLogging'].Value) {\r
+               console.info(message);\r
+       }\r
+}\r
+\r
 </script>\r
 \r
 <style type="text/css">\r
@@ -1529,9 +1582,9 @@ hr { color:#ffffff; background-color:#ffffff; height:1px; text-align:left; borde
 \r
 </head>\r
 \r
-<body id="body" class="background">\r
+<body onload="javascript:setTimeout('init()', 10)" onresize="javascript:updateScreen()" id="body" class="background">\r
 <div id="homescreenView">\r
-       <div id="calendarList"></div>\r
+       <div id="calendarList">loading...</div>\r
 </div>\r
 <div id="fullscreenView" style="display:none;">\r
        <img src="Icon.png" id="smallappicon">\r
index edb875be225dcc81b9bd288c2342f81a2c707407..bffaca7607ab3b16ccbd55a159bde6446e567b2e 100644 (file)
@@ -76,6 +76,8 @@ localizedText['settings.name.showCalendarIndicator'] = 'Mostra Indicatore Calend
 localizedText['settings.info.showCalendarIndicator'] = 'se vengono usati calendari multipli, una piccola barra colorata viene mostrata per indicare a quale calendario appartiene l\'evento';\r
 localizedText['settings.name.excludedCalendars'] = 'Includi Calendari';\r
 localizedText['settings.info.excludedCalendars'] = 'qui puoi indicare quale calendario deve essere mostrato se sono impostati calendari multipli';\r
+localizedText['settings.name.enableLogging'] = 'Enable Logging';\r
+localizedText['settings.info.enableLogging'] = 'write debug information to C:\\Data\\jslog_widget.log. Note: Javascript error logging to file needs to be enabled in your browser settings for this.';\r
 localizedText['settings.name.cssStyle_background'] = '.background';\r
 localizedText['settings.info.cssStyle_background'] = 'Definisce il background del widget. Se vuoi usare una immagine come background imposta useBackgroundImage = true below. For the default themes, black, gray, and light blue, codes are #292029, #e7dfe7, #009aef';\r
 localizedText['settings.name.cssStyle_backgroundFullscreen'] = '.backgroundFullscreen';\r
index e84620db28800e6d9d1076e88b95c4fc81503918..68bb4f4049fbffcdc6617ed7d813fd95d1fdca1c 100644 (file)
@@ -76,6 +76,8 @@ localizedText['settings.name.showCalendarIndicator'] = 'Show Calendar Indicator'
 localizedText['settings.info.showCalendarIndicator'] = 'if multiple calendars are used, a small color bar will be shown to indicate to which calendar an event belongs';\r
 localizedText['settings.name.excludedCalendars'] = 'Included Calendars';\r
 localizedText['settings.info.excludedCalendars'] = 'here you can specify which calendars should be displayed if multiple calendars have been defined';\r
+localizedText['settings.name.enableLogging'] = 'Enable Logging';\r
+localizedText['settings.info.enableLogging'] = 'write debug information to C:\\Data\\jslog_widget.log. Note: Javascript error logging to file needs to be enabled in your browser settings for this.';\r
 localizedText['settings.name.cssStyle_background'] = '.background';\r
 localizedText['settings.info.cssStyle_background'] = 'Defines the background of the widget. If you want to use a background image, set useBackgroundImage = true below. For the default themes, black, gray, and light blue, codes are #292029, #e7dfe7, #009aef';\r
 localizedText['settings.name.cssStyle_backgroundFullscreen'] = '.backgroundFullscreen';\r
index 3c3c8a22236d54865bb63eb3d965fa332a2055c7..0f92a22945ac8388ee4d41d3c6d20371245c5560 100644 (file)
@@ -76,6 +76,8 @@ localizedText['settings.name.showCalendarIndicator'] = 'Show Calendar Indicator'
 localizedText['settings.info.showCalendarIndicator'] = 'if multiple calendars are used, a small color bar will be shown to indicate to which calendar an event belongs';\r
 localizedText['settings.name.excludedCalendars'] = 'Included Calendars';\r
 localizedText['settings.info.excludedCalendars'] = 'here you can specify which calendars should be displayed if multiple calendars have been defined';\r
+localizedText['settings.name.enableLogging'] = 'Enable Logging';\r
+localizedText['settings.info.enableLogging'] = 'write debug information to C:\\Data\\jslog_widget.log. Note: Javascript error logging to file needs to be enabled in your browser settings for this.';\r
 localizedText['settings.name.cssStyle_background'] = '.background';\r
 localizedText['settings.info.cssStyle_background'] = 'Define o fundo de tela do widget. Se você quer usar uma imagem de fundo, ponha useBackgroundImage = true abaixo. Para temas padrão, preto, cinza, e azul claro, os códigos são #292029, #e7dfe7, #009aef';\r
 localizedText['settings.name.cssStyle_backgroundFullscreen'] = '.backgroundFullscreen';\r
index 79e2c7a1448edd79f4468bd15baf0a81eecf077a..58ab4ad0fed68eb79aef80e2399c04501da84f7b 100644 (file)
@@ -76,6 +76,8 @@ localizedText['settings.name.showCalendarIndicator'] = 'Show Calendar Indicator'
 localizedText['settings.info.showCalendarIndicator'] = 'if multiple calendars are used, a small color bar will be shown to indicate to which calendar an event belongs';\r
 localizedText['settings.name.excludedCalendars'] = 'Included Calendars';\r
 localizedText['settings.info.excludedCalendars'] = 'here you can specify which calendars should be displayed if multiple calendars have been defined';\r
+localizedText['settings.name.enableLogging'] = 'Enable Logging';\r
+localizedText['settings.info.enableLogging'] = 'write debug information to C:\\Data\\jslog_widget.log. Note: Javascript error logging to file needs to be enabled in your browser settings for this.';\r
 localizedText['settings.name.cssStyle_background'] = '.background';\r
 localizedText['settings.info.cssStyle_background'] = 'Задает параметры фона виджета. Например коды цветов черный, серый, светлый -  #292029, #e7dfe7, #009aef';\r
 localizedText['settings.name.cssStyle_backgroundFullscreen'] = '.backgroundFullscreen';\r