2 Copyright (C) 2000-2003 SKYRIX Software AG
4 This file is part of OGo
6 OGo is free software; you can redistribute it and/or modify it under
7 the terms of the GNU Lesser General Public License as published by the
8 Free Software Foundation; either version 2, or (at your option) any
11 OGo is distributed in the hope that it will be useful, but WITHOUT ANY
12 WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
14 License for more details.
16 You should have received a copy of the GNU Lesser General Public
17 License along with OGo; see the file COPYING. If not, write to the
18 Free Software Foundation, 59 Temple Place - Suite 330, Boston, MA
23 #include <NGObjWeb/WOComponent.h>
27 @interface MonthOverview: WOComponent
35 @implementation MonthOverview
37 static inline void setDateWithKey(id obj, NSString *key) {
40 str = [obj objectForKey:key];
45 date = [NSCalendarDate dateWithString:str
46 calendarFormat:@"%Y-%m-%d %H:%M:%S %Z"];
47 [obj setObject:date forKey:key];
52 if ((self = [super init])) {
62 - (NSCalendarDate *)weekStart {
63 return [NSCalendarDate dateWithString:@"2000-11-06 00:00:00 +0100"
64 calendarFormat:@"%Y-%m-%d %H:%M:%S %Z"];
68 if (self->list == nil) {
69 WOResourceManager *rm;
72 rm = [[self application] resourceManager];
73 path = [rm pathForResourceNamed:@"appointments.plist"
77 self->list = [[NSArray alloc] initWithContentsOfFile:path];
82 for (i = 0, cnt = [self->list count]; i < cnt; i++) {
83 setDateWithKey([self->list objectAtIndex:i], @"startDate");
84 setDateWithKey([self->list objectAtIndex:i], @"endDate");
91 - (NSString *)contentColor {
92 NSCalendarDate *day = nil;
94 day = [self valueForKey:@"currentDay"];
95 return ([day monthOfYear] == 11) ? @"#CCCCCC" : @"EEEEEE";