]> err.no Git - scalable-opengroupware.org/blob - ZideStore/UI-X/Scheduler/OGoCalWeekOverview.m
Work in progress. Highlighting works as expected, but Sunday is still broken (Note...
[scalable-opengroupware.org] / ZideStore / UI-X / Scheduler / OGoCalWeekOverview.m
1 /*
2   Copyright (C) 2000-2004 SKYRIX Software AG
3
4   This file is part of OpenGroupware.org.
5
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
9   later version.
10
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.
15
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
19   02111-1307, USA.
20 */
21 // $Id: OGoCalWeekOverview.m,v 1.3 2004/06/03 21:56:44 helge Exp $
22
23 #include "OGoCalWeekView.h"
24
25 @interface OGoCalWeekOverview : OGoCalWeekView
26 {
27     int dayIndex;
28     NSCalendarDate *currentDay;
29 }
30
31 @end
32
33 #include "common.h"
34 #include <Backend/SxAptManager.h>
35 #include "OGoAppointmentFormatter.h"
36
37
38 @implementation OGoCalWeekOverview
39
40 - (NSArray *)appointments {
41   return [self fetchCoreInfos];
42 }
43
44 - (void)setCurrentDay:(NSCalendarDate *)_day {
45     ASSIGN(self->currentDay, _day);
46 }
47
48 - (NSCalendarDate *)currentDay {
49     return self->currentDay;
50 }
51
52 - (NSString *)currentDayName {
53     return [self->currentDay descriptionWithCalendarFormat:@"%A"];
54 }
55
56 - (void)setDayIndex:(char)_idx {
57     NSCalendarDate *d;
58     
59     if ((self->dayIndex == _idx) && (self->currentDay != nil))
60         return;
61     
62     self->dayIndex = _idx;
63     
64     if (_idx > 0) {
65         d = [[self startDate]
66                dateByAddingYears:0 months:0 days:_idx
67                            hours:0 minutes:0 seconds:0];
68     }
69     else
70         d = [self startDate];
71     
72     [self setCurrentDay:d];
73 }
74
75 - (int)dayIndex {
76     return self->dayIndex;
77 }
78
79 - (NSDictionary *)currentDayQueryParameters {
80     return [self queryParametersBySettingSelectedDate:self->currentDay];
81 }
82
83 /* style sheet */
84
85 - (NSString *)titleStyle {
86     if([self->currentDay isToday])
87         return @"weekoverview_title_hilite";
88     return @"weekoverview_title";
89 }
90
91 - (NSString *)contentStyle {
92     if([self->currentDay isToday])
93         return @"weekoverview_content_hilite";
94     return @"weekoverview_content";
95 }
96
97 - (NSDictionary *)aptTypeDict {
98     return nil;
99 }
100
101 - (NSString *)aptTypeLabel {
102     return @"aptLabel";
103 }
104
105 - (NSString *)aptTypeIcon {
106     return @"";
107 }
108
109 - (NSString *)shortTextForApt {
110     OGoAppointmentFormatter *f;
111     
112     f = [OGoAppointmentFormatter formatterWithFormat:
113         @"%S - %E;\n%T;\n%L;\n%5P;\n%50R"];
114     [f setRelationDate:[self referenceDateForFormatter]];
115     [f setShowFullNames:[self showFullNames]];
116     if([self showAMPMDates])
117         [f switchToAMPMTimes:YES];
118
119     return [NSString stringWithFormat:@"%@:\n%@",
120         [self aptTypeLabel],
121         [f stringForObjectValue:self->appointment]];
122 }
123
124 - (BOOL)hasDayInfo {
125     return YES:
126 }
127
128 - (BOOL)hasHoldidayInfo {
129 }
130
131 - (NSArray *)allDayApts {
132 }
133
134 @end /* OGoCalWeekOverview */