From 824c7ab807ec226d26ebf2b3174a8423a18c8f3a Mon Sep 17 00:00:00 2001 From: Wolfgang Sourdeau Date: Tue, 31 Oct 2006 23:01:12 +0000 Subject: [PATCH] Monotone-Parent: 6f3f424424e1dc4ae51e22f8072993e3bd8ff14a Monotone-Revision: f69d60b9d521e7955f8e0a7051cb02f730a5b031 Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2006-10-31T23:01:12 Monotone-Branch: ca.inverse.sogo --- ChangeLog | 5 +++ UI/Scheduler/UIxCalInlineAptView.m | 37 +++++++++++++++++-- .../SchedulerUI/UIxCalInlineAptView.wox | 8 ++-- 3 files changed, 43 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7d59ac899..d7b69dac3 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2006-10-31 Wolfgang Sourdeau + * UI/Scheduler/UIxCalInlineAptView.m ([UIxCalInlineAptView + -displayStyle]): new method that returns a string containing the + css style relative to the current appointment cell. This code is + currently inactive but might be reused later. + * UI/WebServerResources/SchedulerUI.js: added code to handle the display of the selected day (the day pointed by the mouse, or the current day when changing the view). diff --git a/UI/Scheduler/UIxCalInlineAptView.m b/UI/Scheduler/UIxCalInlineAptView.m index c1bb4cf19..8a91d7fab 100644 --- a/UI/Scheduler/UIxCalInlineAptView.m +++ b/UI/Scheduler/UIxCalInlineAptView.m @@ -20,11 +20,13 @@ */ // $Id: UIxCalInlineAptView.m 885 2005-07-21 16:41:34Z znek $ +#import + #import @interface UIxCalInlineAptView : WOComponent { - id appointment; + NSDictionary *appointment; id formatter; id tooltipFormatter; id url; @@ -54,10 +56,10 @@ [super dealloc]; } -- (void)setAppointment:(id)_appointment { +- (void) setAppointment: (NSDictionary *)_appointment { ASSIGN(appointment, _appointment); } -- (id)appointment { +- (NSDictionary *)appointment { return appointment; } @@ -146,6 +148,35 @@ [appointment objectForKey: @"owner"]]; } +- (NSString *) displayStyle +{ + NSCalendarDate *startDate, *endDate, *dayStart, *dayEnd; + int sSeconds, eSeconds, deltaMinutes; + unsigned int height; + NSTimeZone *uTZ; + + uTZ = [referenceDate timeZone]; + dayStart = [referenceDate beginOfDay]; + dayEnd = [referenceDate endOfDay]; + + sSeconds = [[appointment objectForKey: @"startdate"] intValue]; + eSeconds = [[appointment objectForKey: @"enddate"] intValue]; + startDate = [NSCalendarDate dateWithTimeIntervalSince1970: sSeconds]; + [startDate setTimeZone: uTZ]; + if ([startDate earlierDate: dayStart] == startDate) + startDate = dayStart; + endDate = [NSCalendarDate dateWithTimeIntervalSince1970: eSeconds]; + [endDate setTimeZone: uTZ]; + if ([endDate earlierDate: dayEnd] == dayEnd) + endDate = dayEnd; + + deltaMinutes = (([endDate hourOfDay] - [startDate hourOfDay]) * 60 + + [endDate minuteOfHour] - [startDate minuteOfHour]); + height = ceil(deltaMinutes / 15) * 25; + + return [NSString stringWithFormat: @"height: %d%%;", height]; +} + /* helpers */ - (NSString *) title diff --git a/UI/Templates/SchedulerUI/UIxCalInlineAptView.wox b/UI/Templates/SchedulerUI/UIxCalInlineAptView.wox index fe78c82ee..e754c0b39 100644 --- a/UI/Templates/SchedulerUI/UIxCalInlineAptView.wox +++ b/UI/Templates/SchedulerUI/UIxCalInlineAptView.wox @@ -12,7 +12,7 @@ var:aptCName="appointment.c_name" var:title="tooltip" var:queryDictionary="queryDictionary"> - +
@@ -21,13 +21,13 @@ - +
- - +
+