like authenticators.
UI contains the actual UI which is bound to the SoObjects as SOPE methods
+
+
+NOTES
+=====
+
+mapping email <-> logins
+usermanager -> part of SOGoLogic
+
+2004-07-29 Marcus Mueller <znek@mulle-kybernetik.com>
+
+ * v0.9.10
+
+ * UIxCalDayView.m, UIxCalWeekView.m, UIxCalMonthView.m: reversed
+ previous changes to -startDate/-endDate as these were wrong.
+ Views have to deal on their own if appointments break the
+ "usual" time range. Nevertheless we should never drop any
+ appointments!
+
+ * UIxCalDayOverview.[wox|m]: refactored dateRanges (moved to
+ UIxCalDayView) and completed display of all appropriate attributes
+ (all day appointments, holiday info).
+
+ * UIxCalDayView.[hm]: fixed dateRanges.
+
+ * UIxCalView.[hm]: implemented -allDayApts and refactored some code.
+
2004-07-28 Marcus Mueller <znek@mulle-kybernetik.com>
* v0.9.9
return self->currentApts;
}
-- (NSArray *)dateRange {
- NSMutableArray *dateRange;
- unsigned i, count, offset;
-
- offset = [self dayStartHour];
- count = [self dayEndHour] - offset;
- dateRange = [[NSMutableArray alloc] initWithCapacity:count];
- for(i = 0; i < count; i++) {
- NSCalendarDate *date;
-
- date = [[self startDate] hour:offset + i minute:0];
- [dateRange addObject:date];
- }
- return [dateRange autorelease];
-}
-
-
- (NSArray *)aptsForCurrentDate {
NSArray *apts;
NSMutableArray *filtered;
return [filtered autorelease];
}
-- (NSString *)shortTextForApt {
- NSCalendarDate *startDate, *endDate;
- NSString *ms;
-
- startDate = [[self appointment] valueForKey:@"startDate"];
- [startDate setTimeZone:[self viewTimeZone]];
- endDate = [[self appointment] valueForKey:@"endDate"];
- [endDate setTimeZone:[self viewTimeZone]];
-
- ms = [NSString stringWithFormat:@"%02i:%02i %@",
- [startDate hourOfDay],
- [startDate minuteOfHour],
- [[self appointment] valueForKey:@"title"]];
- return ms;
-}
-
-
-/* URLs */
-
- (NSDictionary *)currentDateQueryParameters {
NSMutableDictionary *qp;
NSString *hmString;
NSCalendarDate *date;
-
+
date = [self currentDate];
hmString = [NSString stringWithFormat:@"%02d%02d",
[date hourOfDay], [date minuteOfHour]];
return [qp autorelease];
}
-
-/* appointments */
-
-- (NSArray *)appointments {
- return [self fetchCoreInfos];
-}
-
@end
</td>
<td width="100%">
<table class="dayoverview_content" width="100%">
+ <var:if condition="hasHolidayInfo">
+ <tr>
+ <td class="dayoverview_content_time" colspan="2">
+ <b><var:string value="holidayInfo.title" /></b>
+ </td>
+ </tr>
+ </var:if>
+ <var:foreach list="allDayApts" item="appointment">
+ <tr>
+ <td class="dayoverview_content_time">
+ <var:entity value="nbsp" />
+ </td>
+ <td class="dayoverview_content_apts" width="90%">
+ <var:foreach list="allDayApts" item="appointment">
+ <a var:href="appointmentViewURL"
+ var:queryDictionary="currentDateQueryParameters"
+ ><var:string value="shortTextForApt" /></a>
+ <br />
+ </var:foreach>
+ </td>
+ </tr>
+ </var:foreach>
<var:foreach list="dateRange" item="currentDate">
<tr>
<td class="dayoverview_content_time">
@interface UIxCalDayView : UIxCalView
{
-
}
+- (NSArray *)dateRange;
+
@end
#endif /* __UIxCalDayView_H_ */
#import "UIxCalDayView.h"
-#include <NGExtensions/NGExtensions.h>
+#include <EOControl/EOControl.h>
+#include "common.h"
+@interface UIxCalDayView (PrivateAPI)
+- (NSArray *)_getDatesFrom:(NSCalendarDate *)_from to:(NSCalendarDate *)_to;
+@end
@implementation UIxCalDayView
+
+- (NSArray *)dateRange {
+ /* default range is from dayStartHour to dayEndHour. Any values before
+ or after are also fine */
+
+ NSCalendarDate *min, *max;
+ NSArray *aptDateRanges;
+
+ min = [[self startDate] hour:[self dayStartHour] minute:0];
+ max = [[self startDate] hour:[self dayEndHour] minute:0];
+
+ aptDateRanges = [[self appointments] valueForKey:@"startDate"];
+ if([aptDateRanges count] != 0) {
+ NSCalendarDate *d;
+
+ aptDateRanges = [aptDateRanges sortedArrayUsingSelector:@selector(compareAscending:)];
+ d = [aptDateRanges objectAtIndex:0];
+ min = (NSCalendarDate *)[d earlierDate:min];
+ d = [aptDateRanges objectAtIndex:[aptDateRanges count] - 1];
+ max = (NSCalendarDate *)[d laterDate:max];
+ }
+
+ return [self _getDatesFrom:min to:max];
+}
+
+- (NSArray *)_getDatesFrom:(NSCalendarDate *)_from to:(NSCalendarDate *)_to {
+ NSMutableArray *dates;
+ unsigned i, count, offset;
+
+ offset = [_from hourOfDay];
+ count = ([_to hourOfDay] + 1) - offset;
+ dates = [[NSMutableArray alloc] initWithCapacity:count];
+ for(i = 0; i < count; i++) {
+ NSCalendarDate *date;
+
+ date = [_from hour:offset + i minute:0];
+ [dates addObject:date];
+ }
+ return [dates autorelease];
+}
+
+
+- (NSString *)shortTextForApt {
+ NSCalendarDate *startDate, *endDate;
+ NSMutableString *aptDescr;
+ NSString *s;
+ BOOL spansRange;
+ id apt;
+
+ apt = [self appointment];
+ spansRange = NO;
+ startDate = [apt valueForKey:@"startDate"];
+ [startDate setTimeZone:[self viewTimeZone]];
+ endDate = [apt valueForKey:@"endDate"];
+ if(endDate != nil) {
+ [endDate setTimeZone:[self viewTimeZone]];
+ spansRange = ![endDate isEqualToDate:startDate];
+ }
+ aptDescr = [[NSMutableString alloc] init];
+ [aptDescr appendFormat:@"%02i:%02i",
+ [startDate hourOfDay],
+ [startDate minuteOfHour]];
+ if(spansRange) {
+ [aptDescr appendFormat:@"- %02i:%02i",
+ [endDate hourOfDay],
+ [endDate minuteOfHour]];
+ }
+ s = [apt valueForKey:@"title"];
+ if(s) {
+ [aptDescr appendFormat:@"; %@", s];
+ }
+ s = [apt valueForKey:@"location"];
+ if(s) {
+ [aptDescr appendFormat:@"; %@", s];
+ }
+ return [aptDescr autorelease];
+}
+
+
/* URLs */
- (NSDictionary *)prevDayQueryParameters {
/* fetching */
- (NSCalendarDate *)startDate {
- return [[self selectedDate] hour:[self dayStartHour] minute:0];
+ return [[self selectedDate] beginOfDay];
}
- (NSCalendarDate *)endDate {
- return [[self startDate] hour:[self dayEndHour] minute:0];
+ return [[self startDate] endOfDay];
+}
+
+
+/* appointments */
+
+- (NSArray *)appointments {
+ return [self fetchCoreInfos];
}
@end
@implementation UIxCalMonthView
- (NSCalendarDate *)startDate {
- return [[[super startDate] firstDayOfMonth]
- hour:[self dayStartHour]
- minute:0];
+ return [[[super startDate] firstDayOfMonth] beginOfDay];
}
- (NSCalendarDate *)endDate {
- NSCalendarDate *startDate = [[self startDate]
- hour:[self dayEndHour]
- minute:0];
+ NSCalendarDate *startDate = [[self startDate] endOfDay];
return [startDate dateByAddingYears:0
months:0
days:[startDate numberOfDaysInMonth]
@interface UIxCalView : UIxComponent
{
NSArray *appointments;
+ NSArray *allDayApts;
id appointment;
NSCalendarDate *currentDay;
}
/* accessors */
- (NSArray *)appointments;
+- (NSArray *)allDayApts;
- (id)appointment;
+- (BOOL)hasDayInfo;
+- (BOOL)hasHoldidayInfo;
+- (BOOL)hasAllDayApts;
+
- (NSDictionary *)aptTypeDict;
- (NSString *)aptTypeLabel;
- (NSString *)aptTypeIcon;
- (NSString *)shortTextForApt;
- (NSString *)shortTitleForApt;
+- (NSString *)appointmentViewURL;
+
+- (id)holidayInfo;
+
/* related to current day */
- (void)setCurrentDay:(NSCalendarDate *)_day;
- (NSCalendarDate *)currentDay;
-- (NSString *)currentDayName;
-- (NSArray *)allDayApts;
-- (BOOL)hasDayInfo;
-- (BOOL)hasHoldidayInfo;
+- (NSString *)currentDayName; /* localized */
-
+/* defaults */
- (BOOL)showFullNames;
- (BOOL)showAMPMDates;
- (unsigned)dayStartHour;
- (NSCalendarDate *)thisMonth;
- (NSCalendarDate *)nextMonth;
-/* URLs */
-
-- (NSString *)appointmentViewURL;
-
-/* backend */
-
/* fetching */
- (NSCalendarDate *)startDate;
@implementation UIxCalView
- (void)dealloc {
- [self->appointment release];
[self->appointments release];
+ [self->allDayApts release];
+ [self->appointment release];
[self->currentDay release];
[super dealloc];
}
return [self localizedNameForDayOfWeek:[self->currentDay dayOfWeek]];
}
+- (id)holidayInfo {
+ return nil;
+}
+
+- (NSArray *)allDayApts {
+ NSArray *apts;
+ NSMutableArray *filtered;
+ unsigned i, count;
+
+ if(self->allDayApts)
+ return self->allDayApts;
+
+ apts = [self appointments];
+ count = [apts count];
+ filtered = [[NSMutableArray alloc] initWithCapacity:3];
+ for(i = 0; i < count; i++) {
+ id apt;
+ NSNumber *bv;
+
+ apt = [apts objectAtIndex:i];
+#warning !! check if isAllDay is correct
+ bv = [apt valueForKey:@"isAllDay"];
+ if([bv boolValue]) {
+ [filtered addObject:apt];
+ }
+ }
+
+ ASSIGN(self->allDayApts, filtered);
+ [filtered release];
+ return self->allDayApts;
+}
+
+
+/* special appointments */
+
- (BOOL)hasDayInfo {
- return [self hasHoldidayInfo] || ([[self allDayApts] count] != 0);
+ return [self hasHoldidayInfo] || [self hasAllDayApts];
}
- (BOOL)hasHoldidayInfo {
- return NO;
+ return [self holidayInfo] != nil;
}
-- (NSArray *)allDayApts {
- return [NSArray array];
+- (BOOL)hasAllDayApts {
+ return [[self allDayApts] count] != 0;
}
}
- (unsigned)dayEndHour {
- return 19;
+ return 18;
}
- (BOOL)shouldDisplayWeekend {
@implementation UIxCalWeekView
- (NSCalendarDate *)startDate {
- return [[[super startDate] mondayOfWeek] hour:[self dayStartHour]
- minute:0];
+ return [[[super startDate] mondayOfWeek] beginOfDay];
}
- (NSCalendarDate *)endDate {
return [[[self startDate] dateByAddingYears:0 months:0 days:7
hours:0 minutes:0 seconds:0]
- hour:[self dayEndHour] minute:0];
+ endOfDay];
}
/* URLs */