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

From WebOS Internals
Jump to navigation Jump to search
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 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)
+
+        setupMonth: function(startDate, endDate, callbackfn)  
        {
+
{
+               getCalendarService().getEvents(getCurrentCal(),startDate.getTime(), endDate.getTime(),
+
- getCalendarService().getBusyDays(getCurrentCal(), startDate.getTime(), endDate.getTime(), callbackfn, this.controller);
+      this.getEventsCallback.bind(this),
+
+ getCalendarService().getEvents(getCurrentCal(),startDate.getTime(), endDate.getTime(), this.getEventsCallback.bind(this), this.controller, this.getEventsFailCallback, {useSlices: true});
+      this.controller,
+
+                getCalendarService().getBusyDays(getCurrentCal(), startDate.getTime(), endDate.getTime(), callbackfn, this.controller);
+      this.getEventsFailCallback,
+
},
+                      {useSlices: true}
+
+    );
+
- buildViewHeader: function()
                getCalendarService().getBusyDays(getCurrentCal(), startDate.getTime(), endDate.getTime(), callbackfn, this.controller);
+
+ getEventsCallback: function(resp)
        },
+
+        {
-
+
+                //Mojo.Log.info('month-assistant:getEventsCallback');
 +
+                this.fullEvts = resp.days;
 +
+        },
 
+
 
+
+       getEventsCallback: function(resp)
+
+       buildViewHeader: function()  
+      {
+
{
+Mojo.Log.info('month-assistant:getEventsCallback');
+
//Mojo.Log.info("month-assistant: buildViewHeader");
+              this.fullEvts = resp.days;
+
this.controller.get('mv_header_container1').update(Mojo.View.render({object: { viewPrefix: 'mv' }, template: 'shared/calendar_view_header'}));
+      },
+
@@ -376,7 +385,11 @@
+
+
var cls;
        buildViewHeader: function()
+
for (var i = 1; i < 8; i <<= 1)
        {
+
{
                //Mojo.Log.info("month-assistant: buildViewHeader");
+
- if (day & (i << 3))
@@ -342,6 +356,10 @@ var MonthAssistant = Class.create({
+
+ if (this.fullEvts[d].allDayEvents.length > 0)
                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
+
+ {
                for (var d = 0; d < daylen; d++)
+
+ cls = "monthview-busy-time " + calStyle;
                {
+
+ }
+                       if (this.fullEvts[d].allDayEvents.length > 0)
+
+ else if (day & (i << 3))  
+                       {
+
{
+                                       dayCell.style.backgroundColor = '#99ccff';
+
cls = "monthview-busy-time " + calStyle;
+                       }
+
}
                        var day = this._token2state(days.charCodeAt(d));
 
  
                        var child = dayCell.firstChild;
+
</nowiki></pre>
  
</nowiki></pre>
+
==Notes==
 +
Updated and working with 1.2.1 on 2009/10/23 by daventx

Latest revision as of 04:27, 24 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