new patches
[webos-internals:jeffrotulls-modifications.git] / calendar / calendar-full-day-view-calendar.patch
1 diff --git a/usr/palm/applications/com.palm.app.calendar/app/controllers/day-assistant.js b/usr/palm/applications/com.palm.app.calendar/app/controllers/day-assistant.js
2 index 84263c0..279bf4e 100644
3 --- a/usr/palm/applications/com.palm.app.calendar/app/controllers/day-assistant.js
4 +++ b/usr/palm/applications/com.palm.app.calendar/app/controllers/day-assistant.js
5 @@ -44,9 +44,10 @@ var DayAssistant = Class.create({
6                 this.snapEffectCount = 0;
7  
8                 
9 -               this.hourHeight = 48;
10 -               this.halfHourHeight = 24;
11 -               this.fifteenMinuteHeight = 12;
12 +                               // simply shrink hourHeight...  I'm setting half and quarter hours in case we want to make hourHeight variable
13 +               this.hourHeight = 16;
14 +               this.halfHourHeight = Math.round(this.hourHeight / 2);
15 +               this.fifteenMinuteHeight = Math.round(this.hourHeight / 4);
16                 
17                 this.totalWidth = 320;
18                 this.totalHeight = this.hourHeight * 24;
19 @@ -345,7 +346,7 @@ var DayAssistant = Class.create({
20         getXIndexForTimeText:function(ctx,i,text)
21         {               
22                         
23 -                       ctx.font = "bold 14px Prelude";
24 +                       ctx.font = "bold 10px Prelude";
25                         
26  
27                         var metrics = ctx.measureText(text);
28 @@ -381,6 +382,7 @@ var DayAssistant = Class.create({
29                                 }
30                                 
31                                 if (i < 24) {
32 +                               /*
33                                         var text = String(i);
34                                         if (this.currentTimeFormat == "HH12") {
35                                                 if (i == 0) 
36 @@ -389,6 +391,25 @@ var DayAssistant = Class.create({
37                                                         text = String(i - 12);
38                                         }
39                                         ctx.strokeText(text, this.getXIndexForTimeText(ctx, i, text), top + 15);
40 +                               */
41 +                                               // replace the time labels on the left with just three labels
42 +                                       var text = "";
43 +                                       if ( i == 12 ) {
44 +                                               text = "noon";
45 +                                               ctx.strokeText(text, this.getXIndexForTimeText(ctx, i, text), top + 7);
46 +                                       }
47 +                                       else if ( i == 6  || i == 18 ) {
48 +                                               text = "";
49 +                                               if (this.currentTimeFormat == "HH12") {
50 +                                                       if ( i > 12 ) {
51 +                                                               text = String(i - 12) + "pm";
52 +                                                       }
53 +                                                       else {
54 +                                                               text = i + "am";
55 +                                                       }
56 +                                               }
57 +                                               ctx.strokeText(text, this.getXIndexForTimeText(ctx, i, text), top + 7);
58 +                                       }
59                                 }
60                         }
61                 }
62 @@ -748,16 +769,53 @@ var DayAssistant = Class.create({
63                 ctx.fillStyle = this.colors[event.calendarColor].text;
64                 if (selected)
65                         ctx.fillStyle = "rgb(255, 255, 255)";
66 -               ctx.font = "bold 14px Prelude";
67 +               ctx.font = "bold 10px Prelude";
68                 bottom = textTop;
69 +               /*
70                 var subjectTop = top+15;
71                 if (bottom >= (top + height))
72                         subjectTop = top+17;    // no room for location or note, therefore vertically center subject text
73 -               this.fillText(event.subject, ctx, left+4, subjectTop, width, bottom, 15 /*line height*/);       
74 +               */
75 +                               // prepend the subject with a human readable time stamp
76 +               var subjectTop = top+12;
77 +               var timeText = "";
78 +               var d = new Date(event.start);
79 +               var timeH = d.getHours();
80 +               var timeM = d.getMinutes();
81 +               if (this.currentTimeFormat == "HH12") {
82 +                       if ( timeM > 0 ) {
83 +                               if ( timeH == 0 ) {
84 +                                       timeText = "12:" + pad(timeM) + "a";
85 +                               } else if ( timeH == 12 ) {
86 +                                       timeText = timeH + ":" + pad(timeM) + "p";
87 +                               } else if ( timeH < 12 ) {
88 +                                       timeText = timeH + ":" + pad(timeM) + "a";
89 +                               } else {
90 +                                       timeText = String(timeH - 12) + ":" + pad(timeM) + "p";
91 +                               }
92 +                       }
93 +                       else {
94 +                               if ( timeH == 0 ) {
95 +                                       timeText = "12a";
96 +                               } else if ( timeH == 12 ) {
97 +                                       timeText = timeH + "p";
98 +                               } else if ( timeH < 12 ) {
99 +                                       timeText = timeH + "a";
100 +                               } else {
101 +                                       timeText = String(timeH - 12) + "p";
102 +                               }
103 +                       }
104 +               }
105 +               else {
106 +                       timeText = timeH + ":" + pad(timeM);
107 +               }
108 +               //var str = Object.toJSON(event);
109 +               //console.error(str);
110 +               this.fillText(timeText + " " + event.subject, ctx, left+4, subjectTop, width, bottom, 15 /*line height*/);      
111                 
112                 // Location
113                 if (event.location && (event.location.length > 0) && (textTop < (top + height))) {
114 -                       ctx.font = "italic bold 14px Prelude";
115 +                       ctx.font = "italic bold 10px Prelude";
116                         bottom = textTop+15;
117                         this.fillText(event.location,ctx,left+4,textTop,width,bottom,15 /*line height*/);               
118                         textTop += 15;
119 @@ -841,7 +899,8 @@ var DayAssistant = Class.create({
120                 var i;
121                 
122                 // Make sure that free times, busy times, and events are sorted by start times
123 -               day.freeTimes = day.freeTimes.sortBy(function(f) { return f.start_decimal; })
124 +               // removing free time compression by setting empty array for freeTimes
125 +               day.freeTimes = []; //day.freeTimes.sortBy(function(f) { return f.start_decimal; })
126                 day.events = day.events.sortBy(function(e) { return e.start_decimal; })
127                 day.busyTimes = day.busyTimes.sortBy(function(b) { return b.start_decimal; })
128  
129 @@ -1108,11 +1167,14 @@ var DayAssistant = Class.create({
130                                 }
131                                 //now that we have finished rendering the timelines and number 
132                                 //render am pm
133 +                                               // remove the am/pm indicator that used to follow the top of the screen
134 +                               /*
135                                 if (this.currentTimeFormat == "HH12") {
136                                 //now show the am/pm indicators
137                                         this.calculatePosToDrawAmPm(Math.abs(this.tds[this.THIS_DAY].scroller.mojo.getScrollPosition().top));
138                                         this.controller.get('ampm_indicator').show();
139                                 }
140 +                               */
141  
142                         }
143                 }
144 @@ -1467,6 +1529,8 @@ var DayAssistant = Class.create({
145                         top: yPixel+'px'
146                 }).show();
147  
148 +               this.controller.get('current_time_image').style.height = this.hourHeight+'px';
149 +               this.controller.get('current_time_image').style.width = img.width+'px';
150         },
151         
152         calculatePosWithCompression:function(day,hour)
153 @@ -1500,6 +1564,10 @@ var DayAssistant = Class.create({
154         
155         
156         scrollToDefault: function(whichDay) {
157 +                       // disable the auto scrolling and just always follow the bottom of the page
158 +               this.tds[whichDay].scroller.mojo.revealBottom();
159 +               this.updateTimer(false);
160 +               /*
161                 if (this.tds[whichDay].scroller && this.tds[whichDay].scroller.mojo) {
162                         //Mojo.Log.info('BEFORE SCROLL TOP', this.tds[whichDay].scroller.mojo.getScrollPosition().top);
163                         var ctx = this.divs[whichDay].ctxEvents;
164 @@ -1526,6 +1594,7 @@ var DayAssistant = Class.create({
165                         this.updateTimer(false);
166                         //Mojo.Log.info('AFTER SCROLL TOP', this.tds[whichDay].scroller.mojo.getScrollPosition().top);  
167                 }
168 +               */
169         },
170         
171         blurStageBound:function(){
172 @@ -3587,11 +3656,14 @@ var DayAssistant = Class.create({
173                         Mojo.Animation.animateValue(Mojo.Animation.queueForElement(this.scrollDataDiv), 'bezier', function(value) {
174                                         this.animationValue = value;
175                                         this.renderDay(this.THIS_DAY, day, false);
176 +                                                       // more scrolling to disable
177 +                                       /*
178                                         if (this.compressed) {
179                                                 this.tds[this.THIS_DAY].scroller.mojo.scrollTo(undefined, Math.round(currentTop + scrollOffset * value));
180                                         } else {
181                                                 this.tds[this.THIS_DAY].scroller.mojo.scrollTo(undefined, Math.round(currentTop - scrollOffset * value));
182                                         }
183 +                                       */
184                                 }.bind(this), 
185                                 {
186                                 from: 0.0,
187 @@ -3683,3 +3755,12 @@ DayAssistant.MIN_EVENT_HEIGHT = 24;
188  DayAssistant.MAX_CACHE_SIZE = 15;              // in days
189  DayAssistant.cacheSize = 0;
190  DayAssistant.dayCache = new Hash();
191 +
192 +               // this function pads single digit numbers with zeros.  sprintf wasn't working
193 +pad = function(number) {
194 +       var str = String(number);
195 +       if ( number < 10 ) {
196 +               str = "0" + String(number);
197 +       }
198 +       return str;
199 +}
200 diff --git a/usr/palm/applications/com.palm.app.calendar/app/controllers/week-assistant.js b/usr/palm/applications/com.palm.app.calendar/app/controllers/week-assistant.js
201 index 217a467..f145a26 100644
202 --- a/usr/palm/applications/com.palm.app.calendar/app/controllers/week-assistant.js
203 +++ b/usr/palm/applications/com.palm.app.calendar/app/controllers/week-assistant.js
204 @@ -36,7 +36,7 @@ var WeekAssistant = Class.create({
205                 this.NEXT_WEEK = 3;
206                 this.active = false;
207                 this.requests = [];
208 -               this.HOUR_HEIGHT = 30;
209 +               this.HOUR_HEIGHT = 16;
210                 this.TOTAL_HEIGHT = this.HOUR_HEIGHT * 24;
211                 this.COL_WIDTH = [45, 46, 46, 46, 46, 46, 45];
212                 this.COL_POS = [0, 45, 91, 137, 183, 229, 275];
213 @@ -367,13 +367,30 @@ var WeekAssistant = Class.create({
214                 this.settingSnapIndex = false;
215         },
216  
217 -       renderDayMarkers: function(whichWeek) {
218 +       renderStartEndShading: function(whichWeek) {
219                 var ctx = this.weeks[whichWeek].ctxEvents;
220                 
221                 var startPos = this.startDayMarkerPos * this.HOUR_HEIGHT - 1;
222                 var midPos = this.midDayMarkerPos * this.HOUR_HEIGHT - 1;
223                 var endPos = this.endDayMarkerPos * this.HOUR_HEIGHT - 1;
224  
225 +                       // shaded
226 +               ctx.fillStyle = "rgb(206, 206, 204)";
227 +               ctx.fillRect(0, 0, 320, startPos);
228 +               ctx.fillRect(0, endPos, 320, (this.TOTAL_HEIGHT - endPos));
229 +                       // lines
230 +               ctx.fillStyle = "rgb(159, 159, 158)";
231 +               ctx.fillRect(0, startPos, 320, 2);
232 +               ctx.fillRect(0, endPos, 320, 2);
233 +       },
234 +       
235 +       renderDayMarkers: function(whichWeek) {
236 +               var ctx = this.weeks[whichWeek].ctxEvents;
237 +               
238 +               var startPos = this.startDayMarkerPos * this.HOUR_HEIGHT - 1;
239 +               var midPos = this.midDayMarkerPos * this.HOUR_HEIGHT - 1;
240 +               var endPos = this.endDayMarkerPos * this.HOUR_HEIGHT - 1;       
241 +               
242                 // Draw marker lines
243                 ctx.fillStyle = "rgb(135, 135, 134)";
244                 ctx.fillRect(0, startPos, 320, 2);
245 @@ -403,6 +420,33 @@ var WeekAssistant = Class.create({
246                 ctx.strokeText(this.endDayMarkerTime, 17, endPos + 24);
247         },
248         
249 +       renderTimeLabels: function(whichWeek) {                                                                                                                       
250 +               var ctx = this.weeks[whichWeek].ctxEvents;
251 +                       
252 +                               // print 6am/noon/6pm
253 +               ctx.font = "bold 10px Prelude";
254 +               if ( 6 > this.startDayMarkerPos && 6 <= this.endDayMarkerPos ) {
255 +                       ctx.fillStyle = "rgb(85, 85, 85)";
256 +               } else {
257 +                       ctx.fillStyle = "rgb(119, 119, 119)";
258 +               }
259 +               ctx.strokeText('6am', 4, (6 * this.HOUR_HEIGHT - 1) + 24);
260 +               
261 +               if ( 12 > this.startDayMarkerPos && 12 <= this.endDayMarkerPos ) {
262 +                       ctx.fillStyle = "rgb(85, 85, 85)";
263 +               } else {
264 +                       ctx.fillStyle = "rgb(119, 119, 119)";
265 +               }
266 +               ctx.strokeText('noon', 4, (12 * this.HOUR_HEIGHT - 1) + 24);
267 +               
268 +               if ( 18 > this.startDayMarkerPos && 18 <= this.endDayMarkerPos ) {
269 +                       ctx.fillStyle = "rgb(85, 85, 85)";
270 +               } else {
271 +                       ctx.fillStyle = "rgb(119, 119, 119)";
272 +               }
273 +               ctx.strokeText('6pm', 4, (18 * this.HOUR_HEIGHT - 1) + 24);
274 +       },
275 +       
276         renderEmptyWeek: function(whichWeek) {
277                 var ctx = this.weeks[whichWeek].ctxEvents;
278                 
279 @@ -410,6 +454,7 @@ var WeekAssistant = Class.create({
280                 ctx.fillStyle = "rgb(228, 228, 226)";
281                 ctx.fillRect(0, 0, 320, this.TOTAL_HEIGHT);
282  
283 +               this.renderStartEndShading(whichWeek);
284                 // Draw vertical day seperator lines
285                 var x = 0;
286                 for (var i = 0; i < 6; i++) {
287 @@ -420,7 +465,7 @@ var WeekAssistant = Class.create({
288                     ctx.fillRect(x+1, 0, 1, this.TOTAL_HEIGHT);
289                 }
290                 
291 -               this.renderDayMarkers(whichWeek);
292 +               //this.renderDayMarkers(whichWeek);
293         },      
294         
295         updateWeekHeight: function(whichWeek) {
296 @@ -585,7 +630,8 @@ var WeekAssistant = Class.create({
297                 ctxAllDay.fillRect(x+1, 0, 1, this.weeks[whichWeek].alldayHeight);
298                 }
299                 
300 -               this.renderStartEndDayLabels(whichWeek);
301 +               //this.renderStartEndDayLabels(whichWeek);
302 +               this.renderTimeLabels(whichWeek);
303         },
304         
305         setup: function() {
306 @@ -858,7 +904,9 @@ var WeekAssistant = Class.create({
307         
308         scrollToDefault: function(animate) {
309                 if (this.scroller) {
310 -                       this.scroller.mojo.scrollTo(0, -(this.startDayMarkerPos * this.HOUR_HEIGHT - this.weeks[this.THIS_WEEK].alldayHeight) + 20, animate);
311 +                       //this.scroller.mojo.scrollTo(0, -(this.startDayMarkerPos * this.HOUR_HEIGHT - this.weeks[this.THIS_WEEK].alldayHeight) + 20, animate);
312 +                       //this.scroller.mojo.scrollTo(0, this.TOTAL_HEIGHT);
313 +                       this.scroller.mojo.revealBottom();
314                 }
315         },
316         
317 diff --git a/usr/palm/applications/com.palm.app.calendar/app/views/day/day-scene.html b/usr/palm/applications/com.palm.app.calendar/app/views/day/day-scene.html
318 index 03c6380..954eeee 100644
319 --- a/usr/palm/applications/com.palm.app.calendar/app/views/day/day-scene.html
320 +++ b/usr/palm/applications/com.palm.app.calendar/app/views/day/day-scene.html
321 @@ -103,7 +103,7 @@
322                                                                 <canvas id="dv_events" width="320" height="1200">                                                               
323                                                                 </canvas>
324                                                                 <div id="current_time" style="position:absolute;top=0px;left=4px;" >
325 -                                                                       <img  src="images/current-time-indicator.png" />
326 +                                                                       <img id="current_time_image" src="images/current-time-indicator.png" />
327                                                                 </div>
328                                                                 <div id="ampm_indicator" style="-webkit-transition: color .3s ease-in-out;color:rgba(0,0,0,0) ;font-weight:bold; position:absolute;top:0px;left:6px;font-size:12px;font-style:Prelude">#{-value}</div>                                                          
329                                                                 <div id="dv_scratch_events"></div>
330 diff --git a/usr/palm/applications/com.palm.app.calendar/app/views/week/week-scene.html b/usr/palm/applications/com.palm.app.calendar/app/views/week/week-scene.html
331 index 9dcd204..989911e 100644
332 --- a/usr/palm/applications/com.palm.app.calendar/app/views/week/week-scene.html
333 +++ b/usr/palm/applications/com.palm.app.calendar/app/views/week/week-scene.html
334 @@ -35,13 +35,13 @@
335                         <div id="wv_scroll_events" x-mojo-element="Scroller">
336                                 <div id="wv_event_container">
337                                         <div id="wv_eventsDay0" class="wv-events-day">
338 -                                               <canvas id="events0" width="320" height="850"></canvas>
339 +                                               <canvas id="events0" width="320" height="450"></canvas>
340                                         </div>
341                                         <div id="wv_eventsDay1" class="wv-events-day">
342 -                                               <canvas id="events1" width="320" height="850"></canvas>
343 +                                               <canvas id="events1" width="320" height="450"></canvas>
344                                         </div>
345                                         <div id="wv_eventsDay2" class="wv-events-day">
346 -                                               <canvas id="events2" width="320" height="850"></canvas>
347 +                                               <canvas id="events2" width="320" height="450"></canvas>
348                                         </div>
349                                 </div>
350                         </div>  
351 diff --git a/usr/palm/applications/com.palm.app.calendar/stylesheets/day.css b/usr/palm/applications/com.palm.app.calendar/stylesheets/day.css
352 index 02d0417..af5a05c 100644
353 --- a/usr/palm/applications/com.palm.app.calendar/stylesheets/day.css
354 +++ b/usr/palm/applications/com.palm.app.calendar/stylesheets/day.css
355 @@ -234,12 +234,12 @@ Copyright 2009 Palm, Inc.  All rights reserved.
356         display: block !important;
357  }
358  .all-day-events-spacer {
359 -       height:9px;
360 +       height:0px;
361  }
362  .alldayeventsList {
363         position: relative;
364         top: 0px;
365 -       padding: 4px 0px 5px;
366 +       /*padding: 4px 0px 5px;*/
367         width: 100%;
368         overflow: hidden;
369  }
370 @@ -293,9 +293,9 @@ Copyright 2009 Palm, Inc.  All rights reserved.
371  .timeHeader {
372         width: 24px;
373         height: 32px;
374 -       font-size: 14px;
375 +       font-size: 10px;
376         text-align: center;
377 -       padding: 4px 0px 0px;
378 +       /*padding: 0px 0px 0px;*/
379         color: #777;
380         position: absolute;
381         z-index:3;
382 @@ -321,8 +321,8 @@ Copyright 2009 Palm, Inc.  All rights reserved.
383         margin-top:-6px;        
384  }
385  .dv-event.scratch-event .event-edit .hint-text {
386 -       margin-top:-5px;        
387 -       font-size: 14px;
388 +       margin-top:-7px;        
389 +       font-size: 10px;
390  }
391  .dv-event.scratch-event .event-edit input:focus {
392         margin-top:-14px;
393 @@ -337,7 +337,7 @@ Copyright 2009 Palm, Inc.  All rights reserved.
394         vertical-align: middle;
395         border: none;
396         outline: none;
397 -       font-size: 14px;
398 +       font-size: 10px;
399         height: 16px;
400         font-weight: bold;
401         color: inherit;
402 @@ -388,7 +388,7 @@ Copyright 2009 Palm, Inc.  All rights reserved.
403                 height: 48px;
404                 position: absolute;
405                 right: 0px;
406 -               top: -11px;
407 +               top: -28px;
408                 background: url(../images/day-event-info-press.png) center center no-repeat;
409                 background: url(../images/day-event-info.png) center center no-repeat;
410                 z-index: 10000;
411 @@ -447,7 +447,7 @@ Copyright 2009 Palm, Inc.  All rights reserved.
412  
413  
414  .dv-event .subject {
415 -       font-size: 14px;
416 +       font-size: 10px;
417         line-height: 14px;
418         height: 14px;
419         font-weight:bold;
420 @@ -456,7 +456,7 @@ Copyright 2009 Palm, Inc.  All rights reserved.
421  }
422  .dv-event .location {
423         margin-top:-1px;
424 -       font-size: 14px;
425 +       font-size: 10px;
426         line-height: 14px;
427         height: 14px;
428         font-weight:bold;