]> code.delx.au - comingnext/commitdiff
* fixed memos/anniversaries showing although they have already passed
authorMichael Prager <michael@pragers.de>
Sat, 5 Sep 2009 19:29:00 +0000 (21:29 +0200)
committerMichael Prager <michael@pragers.de>
Sat, 5 Sep 2009 19:29:00 +0000 (21:29 +0200)
 * don't display weekday if date is 'Today'
 * changed default 'Now' color to #ff00ff to make it different from the 'Today' color
 * patch by pcmoore:
    * Fix problem with appointments starting at 12p where they would display as starting 12h later (midnight the following day)
    * Add a new feature to only display the time for events happening today and only the date for events beyond today (showCombinedDateTime)
    * Add a new feature to disable showing the location of appointments (showLocation)

Readme.txt
comingNext/index.html
comingNextB/index.html

index 2679f205e767ecf66f6ca6a01a7a6235f9067074..46862534dd584a56114afdc3051c602cb1bbbc12 100644 (file)
@@ -150,4 +150,14 @@ Changelog:
   - refixed problems that 1.18 should have solved (todos not showing, entries \r
     showing twice)\r
 1.20 (2009-09-05) by Oxidative\r
-  - fixed memos to show although they have already passed
\ No newline at end of file
+  - fixed memos/anniversaries showing although they have already passed\r
+  - don't display weekday if date is 'Today'\r
+  - changed default 'Now' color to #ff00ff to make it different from the \r
+    'Today' color\r
+  - patch by pcmoore:\r
+    - Fix problem with appointments starting at 12p where they\r
+      would display as starting 12h later (midnight the following day)\r
+    - Add a new feature to only display the time for events happening today \r
+      and only the date for events beyond today (showCombinedDateTime)\r
+    - Add a new feature to disable showing the location of appointments \r
+      (showLocation) 
\ No newline at end of file
index 5ce4fd4bc951fb706a9e72bd6eed7493ed32c7ed..cedf780f55315200b88c7b7843ea2f6e53678ca7 100644 (file)
@@ -12,7 +12,7 @@ here you can customize background color, font color, font size etc...
 .date { }                              /* Defines the appearance of all date texts */\r
 .today { color:#ff0000; }              /* Defines the appearance of "Today" text */\r
 .time { }                              /* Defines the appearance of all time texts */\r
-.now { color:#ff0000; }                        /* Defines the appearance of "Now" text */\r
+.now { color:#ff00ff; }                        /* Defines the appearance of "Now" text */\r
 .description { }                       /* Defines the appearance of all event descriptions */\r
 .icon { width:15px; height:15px; }     /* Defines size and appearance of icons */\r
 </style>\r
@@ -23,6 +23,8 @@ here you can customize background color, font color, font size etc...
 var monthRange = 2;            // number of months to include in the event list\r
 var includeTodos = true;       // disable to remove ToDos from event list\r
 var useBackgroundImage = true; // use background_portrait.png and background_landscape.png to fake transparency. Set to "false" to use a solid background color\r
+var showCombinedDateTime = false;// only show the time for events happening today, otherwise just show the date\r
+var showLocation = true;       // show the location for meeting events\r
 var showTodayAsText = true;    // if enabled, the current date will be shown as "Today" instead of "31.12"\r
 var todayText = 'Today';       // text to display for "Today"\r
 var showNowAsText = true;      // if enabled, the appointment time will be shown as "Now" instead of "12:00"\r
@@ -176,6 +178,7 @@ function parseDate(dateString)
        Wednesday,  August 26, 2009 12:00:00 am\r
        Wednesday,  2009 August, 26 12:00:00 am\r
        Wednesday,  2009 August, 28 8.00.00 pm\r
+       Wednesday,  2009 August, 28 08:00:00 PM\r
        */\r
        if (dateString == "" || dateString == null)\r
                return null;\r
@@ -217,8 +220,10 @@ function parseDate(dateString)
        var hours = Number(timeArr[0]);\r
        var minutes = Number(timeArr[1]);\r
        var seconds = Number(timeArr[2]);\r
-       if (dateArr.length == 6 && dateArr[5].toLowerCase() == 'pm')\r
+       if (dateArr.length == 6 && dateArr[5].toLowerCase() == 'pm' && hours < 12)\r
                hours += 12;\r
+       if (dateArr.length == 6 && dateArr[5].toLowerCase() == 'am' && hours == 12)\r
+               hours = 0;\r
        \r
        console.info('year=' + year + ' month=' + month + ' day=' + day + ' hours=' + hours + ' minutes=' + minutes+ ' seconds=' + seconds);\r
        \r
@@ -366,17 +371,12 @@ function updateData(){
                                        console.info('skipped (already included) ' + entry.id);\r
                                        counter--;\r
                                        continue;\r
-                               } else {\r
+                               } else\r
                                        eventIds[entry.id] = 1;\r
-                               }                                                       \r
-\r
-                               // skip events for the first panel in case this is the second one\r
-                               if (panelNum == 1 && counter < eventsPerWidget + 1)\r
-                                       continue;\r
 \r
                                // summary can be undefined!\r
                                var Summary = ((entry.Summary == null) ? '' : entry.Summary);\r
-                               if (entry.Type == 'Meeting' && entry.Location != ''){\r
+                               if (entry.Type == 'Meeting' && entry.Location != '' && showLocation){\r
                                        Summary += ', ' + entry.Location;\r
                                }\r
                                \r
@@ -400,21 +400,33 @@ function updateData(){
                                if (entry.Type == 'Meeting'){\r
                                        var compareTime = ((endDate == null) ? date.getTime() : endDate.getTime());\r
                                        if (now.getTime() > compareTime){\r
-                                               console.info('skipped (already passed) ' + entry.id);\r
+                                               console.info('skipping Meeting (already passed) ' + entry.id);\r
                                                counter--;\r
+                                               eventIds[entry.id] = 0;\r
                                                continue;\r
                                        }\r
                                }\r
                                \r
-                               // 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\r
+                               // check if anniversary passed (not sure why they are in the list, the query was only for today - nokia?)\r
+                               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
+                                               counter--;\r
+                                               eventIds[entry.id] = 0;\r
+                                               continue;\r
+                                       }\r
+                               }\r
+                               \r
+                               // 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.setHours(endDate.getHours() - 12);\r
                                        endDate.setMinutes(endDate.getMinutes() - 1);\r
                                        console.info('fixing DayEvent endDate: ' + endDate);\r
                                        if (now.getTime() > endDate.getTime()){\r
-                                               console.info('event already passed');\r
+                                               console.info('event already passed ' + entry.id);\r
                                                counter--;\r
-                                               continue;                                               \r
+                                               eventIds[entry.id] = 0;\r
+                                               continue;\r
                                        }\r
                                }\r
 \r
@@ -428,6 +440,12 @@ function updateData(){
                                        }\r
                                }\r
                                \r
+                               // skip events for the first panel in case this is the second one\r
+                               if (panelNum == 1 && counter < eventsPerWidget + 1){\r
+                                       console.info('skipping (already in first widget) ' + entry.id);\r
+                                       continue;\r
+                               }\r
+                               \r
                                // generate html output\r
                                entriesHtml += '<tr><td><img class="icon" src="' + entry.Type + '.png" /></td>';\r
                                if(date == null){ // some languages have very strange locale date formats, can't parse all those. Also some todos don't have dates at all.\r
@@ -435,11 +453,31 @@ function updateData(){
                                }else{\r
                                        var weekDay = date.toLocaleDateString().substr(0,weekDayLength);\r
                                        var time = formatTime(date);\r
-                                       date = formatDate(date, entryDate);\r
-                                       if( entry.Type == 'ToDo' || entry.Type == 'Anniversary' || entry.Type == 'DayEvent' ){\r
-                                               entriesHtml += '<td><span class="weekDay">' + weekDay +'</span></td><td><span class="date">'+ date +'</span></td><td colspan="2">';\r
-                                       }else if( entry.Type == 'Meeting' || entry.Type == 'Reminder' ){\r
-                                               entriesHtml += '<td><span class="weekDay">' + weekDay +'</span></td><td><span class="date">'+ date +'</span></td><td width="1px"><span class="time">'+ time +'</span></td><td>';\r
+                                       var dateStr = formatDate(date, entryDate);\r
+                                       if( entry.Type == 'ToDo' || entry.Type == 'Anniversary' || entry.Type == 'DayEvent' || entry.Type == 'Reminder' ){\r
+                                               // decide if we want to leave off the weekday\r
+                                               if (dateStr.search(/Today/) != -1)\r
+                                                       entriesHtml += '<td colspan="4"><span class="date">'+ dateStr +'</span> ';\r
+                                               else\r
+                                                       entriesHtml += '<td><span class="weekDay">' + weekDay +'</span></td><td><span class="date">'+ dateStr +'</span></td><td colspan="2">';\r
+                                       }else if( entry.Type == 'Meeting' ){\r
+                                               if (showCombinedDateTime) {\r
+                                                       if (now.getDate() == date.getDate() && now.getMonth() == date.getMonth())\r
+                                                               entriesHtml += '<td colspan="4"><span class="today">'+ time +'</span> ';\r
+                                                       else {\r
+                                                               // decide if we want to leave off the weekday\r
+                                                               if (dateStr.search(/Today/) != -1)\r
+                                                                       entriesHtml += '<td colspan="4"><span class="date">'+ dateStr +'</span> ';\r
+                                                               else\r
+                                                                       entriesHtml += '<td><span class="weekDay">' + weekDay +'</span></td><td><span class="date">'+ dateStr +'</span></td><td colspan="2">';\r
+                                                       }\r
+                                               } else {\r
+                                                       // decide if we want to leave off the weekday\r
+                                                       if (dateStr.search(/Today/) != -1)\r
+                                                               entriesHtml += '<td colspan="4"><span class="date">'+ dateStr +'</span> <span class="time">'+ time +'</span> ';\r
+                                                       else\r
+                                                               entriesHtml += '<td><span class="weekDay">' + weekDay +'</span></td><td><span class="date">'+ dateStr +'</span></td><td width="1px"><span class="time">'+ time +'</span></td><td>';\r
+                                               }\r
                                        }\r
                                }\r
                                entriesHtml += '<span class="description">' + Summary +'</span></td></tr>';\r
index ead9bedb0cbf6e3fd228e396e2b5353f8f45f352..58181cec07f806b584a756662e8497e6b7ad2533 100644 (file)
@@ -12,7 +12,7 @@ here you can customize background color, font color, font size etc...
 .date { }                              /* Defines the appearance of all date texts */\r
 .today { color:#ff0000; }              /* Defines the appearance of "Today" text */\r
 .time { }                              /* Defines the appearance of all time texts */\r
-.now { color:#ff0000; }                        /* Defines the appearance of "Now" text */\r
+.now { color:#ff00ff; }                        /* Defines the appearance of "Now" text */\r
 .description { }                       /* Defines the appearance of all event descriptions */\r
 .icon { width:15px; height:15px; }     /* Defines size and appearance of icons */\r
 </style>\r
@@ -23,6 +23,8 @@ here you can customize background color, font color, font size etc...
 var monthRange = 2;            // number of months to include in the event list\r
 var includeTodos = true;       // disable to remove ToDos from event list\r
 var useBackgroundImage = true; // use background_portrait.png and background_landscape.png to fake transparency. Set to "false" to use a solid background color\r
+var showCombinedDateTime = false;// only show the time for events happening today, otherwise just show the date\r
+var showLocation = true;       // show the location for meeting events\r
 var showTodayAsText = true;    // if enabled, the current date will be shown as "Today" instead of "31.12"\r
 var todayText = 'Today';       // text to display for "Today"\r
 var showNowAsText = true;      // if enabled, the appointment time will be shown as "Now" instead of "12:00"\r
@@ -176,6 +178,7 @@ function parseDate(dateString)
        Wednesday,  August 26, 2009 12:00:00 am\r
        Wednesday,  2009 August, 26 12:00:00 am\r
        Wednesday,  2009 August, 28 8.00.00 pm\r
+       Wednesday,  2009 August, 28 08:00:00 PM\r
        */\r
        if (dateString == "" || dateString == null)\r
                return null;\r
@@ -217,8 +220,10 @@ function parseDate(dateString)
        var hours = Number(timeArr[0]);\r
        var minutes = Number(timeArr[1]);\r
        var seconds = Number(timeArr[2]);\r
-       if (dateArr.length == 6 && dateArr[5].toLowerCase() == 'pm')\r
+       if (dateArr.length == 6 && dateArr[5].toLowerCase() == 'pm' && hours < 12)\r
                hours += 12;\r
+       if (dateArr.length == 6 && dateArr[5].toLowerCase() == 'am' && hours == 12)\r
+               hours = 0;\r
        \r
        console.info('year=' + year + ' month=' + month + ' day=' + day + ' hours=' + hours + ' minutes=' + minutes+ ' seconds=' + seconds);\r
        \r
@@ -366,17 +371,12 @@ function updateData(){
                                        console.info('skipped (already included) ' + entry.id);\r
                                        counter--;\r
                                        continue;\r
-                               } else {\r
+                               } else\r
                                        eventIds[entry.id] = 1;\r
-                               }                                                       \r
-\r
-                               // skip events for the first panel in case this is the second one\r
-                               if (panelNum == 1 && counter < eventsPerWidget + 1)\r
-                                       continue;\r
 \r
                                // summary can be undefined!\r
                                var Summary = ((entry.Summary == null) ? '' : entry.Summary);\r
-                               if (entry.Type == 'Meeting' && entry.Location != ''){\r
+                               if (entry.Type == 'Meeting' && entry.Location != '' && showLocation){\r
                                        Summary += ', ' + entry.Location;\r
                                }\r
                                \r
@@ -400,21 +400,33 @@ function updateData(){
                                if (entry.Type == 'Meeting'){\r
                                        var compareTime = ((endDate == null) ? date.getTime() : endDate.getTime());\r
                                        if (now.getTime() > compareTime){\r
-                                               console.info('skipped (already passed) ' + entry.id);\r
+                                               console.info('skipping Meeting (already passed) ' + entry.id);\r
                                                counter--;\r
+                                               eventIds[entry.id] = 0;\r
                                                continue;\r
                                        }\r
                                }\r
                                \r
-                               // 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\r
+                               // check if anniversary passed (not sure why they are in the list, the query was only for today - nokia?)\r
+                               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
+                                               counter--;\r
+                                               eventIds[entry.id] = 0;\r
+                                               continue;\r
+                                       }\r
+                               }\r
+                               \r
+                               // 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.setHours(endDate.getHours() - 12);\r
                                        endDate.setMinutes(endDate.getMinutes() - 1);\r
                                        console.info('fixing DayEvent endDate: ' + endDate);\r
                                        if (now.getTime() > endDate.getTime()){\r
-                                               console.info('event already passed');\r
+                                               console.info('event already passed ' + entry.id);\r
                                                counter--;\r
-                                               continue;                                               \r
+                                               eventIds[entry.id] = 0;\r
+                                               continue;\r
                                        }\r
                                }\r
 \r
@@ -428,6 +440,12 @@ function updateData(){
                                        }\r
                                }\r
                                \r
+                               // skip events for the first panel in case this is the second one\r
+                               if (panelNum == 1 && counter < eventsPerWidget + 1){\r
+                                       console.info('skipping (already in first widget) ' + entry.id);\r
+                                       continue;\r
+                               }\r
+                               \r
                                // generate html output\r
                                entriesHtml += '<tr><td><img class="icon" src="' + entry.Type + '.png" /></td>';\r
                                if(date == null){ // some languages have very strange locale date formats, can't parse all those. Also some todos don't have dates at all.\r
@@ -435,11 +453,31 @@ function updateData(){
                                }else{\r
                                        var weekDay = date.toLocaleDateString().substr(0,weekDayLength);\r
                                        var time = formatTime(date);\r
-                                       date = formatDate(date, entryDate);\r
-                                       if( entry.Type == 'ToDo' || entry.Type == 'Anniversary' || entry.Type == 'DayEvent' ){\r
-                                               entriesHtml += '<td><span class="weekDay">' + weekDay +'</span></td><td><span class="date">'+ date +'</span></td><td colspan="2">';\r
-                                       }else if( entry.Type == 'Meeting' || entry.Type == 'Reminder' ){\r
-                                               entriesHtml += '<td><span class="weekDay">' + weekDay +'</span></td><td><span class="date">'+ date +'</span></td><td width="1px"><span class="time">'+ time +'</span></td><td>';\r
+                                       var dateStr = formatDate(date, entryDate);\r
+                                       if( entry.Type == 'ToDo' || entry.Type == 'Anniversary' || entry.Type == 'DayEvent' || entry.Type == 'Reminder' ){\r
+                                               // decide if we want to leave off the weekday\r
+                                               if (dateStr.search(/Today/) != -1)\r
+                                                       entriesHtml += '<td colspan="4"><span class="date">'+ dateStr +'</span> ';\r
+                                               else\r
+                                                       entriesHtml += '<td><span class="weekDay">' + weekDay +'</span></td><td><span class="date">'+ dateStr +'</span></td><td colspan="2">';\r
+                                       }else if( entry.Type == 'Meeting' ){\r
+                                               if (showCombinedDateTime) {\r
+                                                       if (now.getDate() == date.getDate() && now.getMonth() == date.getMonth())\r
+                                                               entriesHtml += '<td colspan="4"><span class="today">'+ time +'</span> ';\r
+                                                       else {\r
+                                                               // decide if we want to leave off the weekday\r
+                                                               if (dateStr.search(/Today/) != -1)\r
+                                                                       entriesHtml += '<td colspan="4"><span class="date">'+ dateStr +'</span> ';\r
+                                                               else\r
+                                                                       entriesHtml += '<td><span class="weekDay">' + weekDay +'</span></td><td><span class="date">'+ dateStr +'</span></td><td colspan="2">';\r
+                                                       }\r
+                                               } else {\r
+                                                       // decide if we want to leave off the weekday\r
+                                                       if (dateStr.search(/Today/) != -1)\r
+                                                               entriesHtml += '<td colspan="4"><span class="date">'+ dateStr +'</span> <span class="time">'+ time +'</span> ';\r
+                                                       else\r
+                                                               entriesHtml += '<td><span class="weekDay">' + weekDay +'</span></td><td><span class="date">'+ dateStr +'</span></td><td width="1px"><span class="time">'+ time +'</span></td><td>';\r
+                                               }\r
                                        }\r
                                }\r
                                entriesHtml += '<span class="description">' + Summary +'</span></td></tr>';\r