From e4e7d2ee70aa8b342892dfa914289d4e30f54ca3 Mon Sep 17 00:00:00 2001 From: Michael Prager Date: Sat, 5 Sep 2009 16:18:32 +0200 Subject: [PATCH] fixed DayEvents to be shown although they already passed (+12h bug in WRT API) --- Readme.txt | 6 +++++- build.bat | 2 +- comingNext/Info.plist | 4 ++-- comingNext/index.html | 44 ++++++++++++++++++++++++++---------------- comingNextB/Info.plist | 4 ++-- comingNextB/index.html | 44 ++++++++++++++++++++++++++---------------- 6 files changed, 64 insertions(+), 40 deletions(-) diff --git a/Readme.txt b/Readme.txt index 55203bd..2679f20 100644 --- a/Readme.txt +++ b/Readme.txt @@ -7,6 +7,8 @@ on your N97 homescreen. It consists of two seperate widgets, each displaying 4 events. For more info or to report bugs, please refere to +http://sourceforge.net/projects/comingnext + and http://www.symbian-freak.com/forum/viewtopic.php?t=38045 You can change the appearance (background color, font color, font size etc.) @@ -146,4 +148,6 @@ Changelog: in the list. This behaviour and the text can be changed in the settings 1.19 (2009-09-04) by Oxidative - refixed problems that 1.18 should have solved (todos not showing, entries - showing twice) \ No newline at end of file + showing twice) +1.20 (2009-09-05) by Oxidative + - fixed memos to show although they have already passed \ No newline at end of file diff --git a/build.bat b/build.bat index d720b8c..bb55d31 100644 --- a/build.bat +++ b/build.bat @@ -1,6 +1,6 @@ @echo off -set VERSION=1.19 +set VERSION=1.20 del *.wgz del *.zip diff --git a/comingNext/Info.plist b/comingNext/Info.plist index 1e65795..33921c7 100644 --- a/comingNext/Info.plist +++ b/comingNext/Info.plist @@ -2,9 +2,9 @@ - DisplayName Coming Next 1.19 + DisplayName Coming Next 1.20 Identifier ar.com.cochambre.symbian.wrt.comingnext - Version 1.19 + Version 1.20 MainHTML index.html AllowNetworkAccess MiniViewEnabled diff --git a/comingNext/index.html b/comingNext/index.html index 4a1c267..5ce4fd4 100644 --- a/comingNext/index.html +++ b/comingNext/index.html @@ -370,6 +370,7 @@ function updateData(){ eventIds[entry.id] = 1; } + // skip events for the first panel in case this is the second one if (panelNum == 1 && counter < eventsPerWidget + 1) continue; @@ -391,31 +392,40 @@ function updateData(){ // Convert date/time string to Date object var date = parseDate(entryDate); - console.info(date); + console.info('date: ' + date); + var endDate = ((entryEndTime == null) ? null : parseDate(entryEndTime)); + console.info('endDate: ' + endDate); - // check if event has already passed - if (entry.Type == 'Meeting' || entry.Type == 'Reminder'){ - if (entryEndTime == null){ - if (now.getTime() > date.getTime()){ - counter--; - continue; - } - }else if (entryEndTime != null){ - var endDate = parseDate(entryEndTime); - if (now.getTime() > endDate.getTime()){ - counter--; - continue; - } + // check if meeting event has already passed + if (entry.Type == 'Meeting'){ + var compareTime = ((endDate == null) ? date.getTime() : endDate.getTime()); + if (now.getTime() > compareTime){ + console.info('skipped (already passed) ' + entry.id); + counter--; + continue; } } + // fix DayEvents end time. A bug in WRT causes end times to be off by +12 hours. It's possible that the event has already passed + if (entry.Type == 'DayEvent' && endDate != null){ + endDate.setHours(endDate.getHours() - 12); + endDate.setMinutes(endDate.getMinutes() - 1); + console.info('fixing DayEvent endDate: ' + endDate); + if (now.getTime() > endDate.getTime()){ + console.info('event already passed'); + counter--; + continue; + } + } + // check if the event is currently taking place - if (entryStartTime != null && entryEndTime != null && date != null) + if (entryStartTime != null && entryEndTime != null && date != null && endDate != null) { // check if we are between start and endtime - var endDate = parseDate(entryEndTime); - if (endDate != null && (date.getTime() < now.getTime()) && (now.getTime() < endDate.getTime())) + if ((date.getTime() < now.getTime()) && (now.getTime() < endDate.getTime())) { date = now; // change appointment date/time to now + console.info('event is currently taking place: ' + date); + } } // generate html output diff --git a/comingNextB/Info.plist b/comingNextB/Info.plist index 34a0b89..0706ad0 100644 --- a/comingNextB/Info.plist +++ b/comingNextB/Info.plist @@ -2,9 +2,9 @@ - DisplayName Coming Next B 1.19 + DisplayName Coming Next B 1.20 Identifier ar.com.cochambre.symbian.wrt.comingnextb - Version 1.19 + Version 1.20 MainHTML index.html AllowNetworkAccess MiniViewEnabled diff --git a/comingNextB/index.html b/comingNextB/index.html index 4a5c0d6..ead9bed 100644 --- a/comingNextB/index.html +++ b/comingNextB/index.html @@ -370,6 +370,7 @@ function updateData(){ eventIds[entry.id] = 1; } + // skip events for the first panel in case this is the second one if (panelNum == 1 && counter < eventsPerWidget + 1) continue; @@ -391,31 +392,40 @@ function updateData(){ // Convert date/time string to Date object var date = parseDate(entryDate); - console.info(date); + console.info('date: ' + date); + var endDate = ((entryEndTime == null) ? null : parseDate(entryEndTime)); + console.info('endDate: ' + endDate); - // check if event has already passed - if (entry.Type == 'Meeting' || entry.Type == 'Reminder'){ - if (entryEndTime == null){ - if (now.getTime() > date.getTime()){ - counter--; - continue; - } - }else if (entryEndTime != null){ - var endDate = parseDate(entryEndTime); - if (now.getTime() > endDate.getTime()){ - counter--; - continue; - } + // check if meeting event has already passed + if (entry.Type == 'Meeting'){ + var compareTime = ((endDate == null) ? date.getTime() : endDate.getTime()); + if (now.getTime() > compareTime){ + console.info('skipped (already passed) ' + entry.id); + counter--; + continue; } } + // fix DayEvents end time. A bug in WRT causes end times to be off by +12 hours. It's possible that the event has already passed + if (entry.Type == 'DayEvent' && endDate != null){ + endDate.setHours(endDate.getHours() - 12); + endDate.setMinutes(endDate.getMinutes() - 1); + console.info('fixing DayEvent endDate: ' + endDate); + if (now.getTime() > endDate.getTime()){ + console.info('event already passed'); + counter--; + continue; + } + } + // check if the event is currently taking place - if (entryStartTime != null && entryEndTime != null && date != null) + if (entryStartTime != null && entryEndTime != null && date != null && endDate != null) { // check if we are between start and endtime - var endDate = parseDate(entryEndTime); - if (endDate != null && (date.getTime() < now.getTime()) && (now.getTime() < endDate.getTime())) + if ((date.getTime() < now.getTime()) && (now.getTime() < endDate.getTime())) { date = now; // change appointment date/time to now + console.info('event is currently taking place: ' + date); + } } // generate html output -- 2.39.2