Difference between revisions of "Patch Calendar Show All-Day Events in Month View"

From WebOS Internals
Jump to: navigation, search
(This needs to be updated for 1.2.1 and released to webos-internals for a patch.)
 
Line 1: Line 1:
{{template:patch}}
 
Is any one going to update this for 1.2.1?
 
Could some one add this patch to the webos modifications series for quilt?
 
 
 
This patch will modify the calendar application to show all day events in the month view of the application.
 
This patch will modify the calendar application to show all day events in the month view of the application.
It denotes days with all day events by changing the background of the cell to be blue.
+
It denotes days with all day events by grey in the all view, and by the calendar color when viewing a specific calendar.
  
 
<pre><nowiki>
 
<pre><nowiki>
Modifies the month controller to show allday events in the month scene by changing the background of the cell to a light blue.
+
--- /tmp/month-assistant.js Fri Aug 28 12:51:48 2009
Index: /usr/palm/applications/com.palm.app.calendar/app/controllers/month-assistant.js
+
+++ /usr/palm/applications/com.palm.app.calendar/app/controllers/month-assistant.js Fri Oct 23 12:37:41 2009
===================================================================
+
@@ -27,12 +27,21 @@
--- .orig/usr/palm/applications/com.palm.app.calendar/app/controllers/month-assistant.js
+
this.scrollerModel = { scrollbars: false, mode: "vertical-snap", snapIndex: 0, snapElements: { y: [] } };
+++ /usr/palm/applications/com.palm.app.calendar/app/controllers/month-assistant.js
+
},
@@ -25,11 +25,25 @@ var MonthAssistant = Class.create({
+
                this.scrollerModel = { scrollbars: false, mode: "vertical-snap", snapIndex: 0, snapElements: { y: [] } };
+
- setupMonth: function(startDate, endDate, callbackfn)  
        },
+
+ fullEvts: null,
 
 
+  fullEvts: null,
 
+
 
        setupMonth: function(startDate, endDate, callbackfn)
 
        {
 
+               getCalendarService().getEvents(getCurrentCal(),startDate.getTime(), endDate.getTime(),
 
+      this.getEventsCallback.bind(this),
 
+      this.controller,
 
+      this.getEventsFailCallback,
 
+                      {useSlices: true}
 
+    );
 
                getCalendarService().getBusyDays(getCurrentCal(), startDate.getTime(), endDate.getTime(), callbackfn, this.controller);
 
        },
 
-
 
 
+
 
+
+       getEventsCallback: function(resp)
+
+       setupMonth: function(startDate, endDate, callbackfn)
+       {
+
{
+Mojo.Log.info('month-assistant:getEventsCallback');
+
- getCalendarService().getBusyDays(getCurrentCal(), startDate.getTime(), endDate.getTime(), callbackfn, this.controller);
+               this.fullEvts = resp.days;
+
+ getCalendarService().getEvents(getCurrentCal(),startDate.getTime(), endDate.getTime(), this.getEventsCallback.bind(this), this.controller, this.getEventsFailCallback, {useSlices: true});
+       },
+
+                getCalendarService().getBusyDays(getCurrentCal(), startDate.getTime(), endDate.getTime(), callbackfn, this.controller);
 +
},
 +
 +
- buildViewHeader: function()
 +
+ getEventsCallback: function(resp)
 +
+       {
 +
+               //Mojo.Log.info('month-assistant:getEventsCallback');
 +
+               this.fullEvts = resp.days;
 +
+       },
 
+
 
+
        buildViewHeader: function()
+
+        buildViewHeader: function()  
        {
+
{
                //Mojo.Log.info("month-assistant: buildViewHeader");
+
//Mojo.Log.info("month-assistant: buildViewHeader");
@@ -342,6 +356,10 @@ var MonthAssistant = Class.create({
+
this.controller.get('mv_header_container1').update(Mojo.View.render({object: { viewPrefix: 'mv' }, template: 'shared/calendar_view_header'}));
                var daylen = days.length - 1; // We get back more days of info that we want - 1 more in fact, because its inclusive, rather than exclusive
+
@@ -376,7 +385,11 @@
                for (var d = 0; d < daylen; d++)
+
var cls;
                {
+
for (var i = 1; i < 8; i <<= 1)
+                       if (this.fullEvts[d].allDayEvents.length > 0)
+
{
+                       {
+
- if (day & (i << 3))
+                                       dayCell.style.backgroundColor = '#99ccff';
+
+ if (this.fullEvts[d].allDayEvents.length > 0)
+                       }
+
+ {
                        var day = this._token2state(days.charCodeAt(d));
+
+ cls = "monthview-busy-time " + calStyle;
 
+
+ }
                        var child = dayCell.firstChild;
+
+ else if (day & (i << 3))  
 +
{
 +
cls = "monthview-busy-time " + calStyle;
 +
}
  
 
</nowiki></pre>
 
</nowiki></pre>
  
 
==Notes==
 
==Notes==
* When changing (scrolling) from current month to the next month, the All-Day Events seem to be appended to the current list, therefore the dates show the blue background even though there isn't an event on the day. I'm still working on a fix for it but right now I have the correct dates showing but the color format for the previous and next overlapping month dates are incorrect -sstallard419
+
Updated and working with 1.2.1 on 2009/10/23 by daventx

Latest revision as of 20:27, 23 October 2009

This patch will modify the calendar application to show all day events in the month view of the application. It denotes days with all day events by grey in the all view, and by the calendar color when viewing a specific calendar.

--- /tmp/month-assistant.js	Fri Aug 28 12:51:48 2009
+++ /usr/palm/applications/com.palm.app.calendar/app/controllers/month-assistant.js	Fri Oct 23 12:37:41 2009
@@ -27,12 +27,21 @@
 		this.scrollerModel = { scrollbars: false, mode: "vertical-snap", snapIndex: 0, snapElements: { y: [] } };
 	},
 														
- 	setupMonth: function(startDate, endDate, callbackfn) 
+ 	fullEvts: null,
+
+        setupMonth: function(startDate, endDate, callbackfn) 
 	{
-		getCalendarService().getBusyDays(getCurrentCal(), startDate.getTime(), endDate.getTime(), callbackfn, this.controller);
+		getCalendarService().getEvents(getCurrentCal(),startDate.getTime(), endDate.getTime(), this.getEventsCallback.bind(this), this.controller, this.getEventsFailCallback, {useSlices: true});
+                getCalendarService().getBusyDays(getCurrentCal(), startDate.getTime(), endDate.getTime(), callbackfn, this.controller);
 	},
 	
-	buildViewHeader: function() 
+	getEventsCallback: function(resp)
+        {
+                //Mojo.Log.info('month-assistant:getEventsCallback');
+                this.fullEvts = resp.days;
+        },
+
+        buildViewHeader: function() 
 	{
 		//Mojo.Log.info("month-assistant: buildViewHeader");
 		this.controller.get('mv_header_container1').update(Mojo.View.render({object: { viewPrefix: 'mv' }, template: 'shared/calendar_view_header'}));
@@ -376,7 +385,11 @@
 			var cls;
 			for (var i = 1; i < 8; i <<= 1)
 			{
-				if (day & (i << 3)) 
+				if (this.fullEvts[d].allDayEvents.length > 0)
+				{
+					cls = "monthview-busy-time " + calStyle;
+				}
+				else if (day & (i << 3)) 
 				{
 					cls = "monthview-busy-time " + calStyle;
 				}

Notes

Updated and working with 1.2.1 on 2009/10/23 by daventx