]> err.no Git - scalable-opengroupware.org/blob - UI/Scheduler/UIxCalDayListview.m
moved partstat modification from UI to SoObject
[scalable-opengroupware.org] / UI / Scheduler / UIxCalDayListview.m
1 /*
2   Copyright (C) 2004-2005 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
22 #include "UIxCalDayView.h"
23
24 /*
25   UIxCalDayListview
26
27   TODO: describe
28 */
29
30 @class NSArray;
31
32 @interface UIxCalDayListview : UIxCalDayView
33 {
34   NSArray *uids;
35   id currentUid;
36 }
37
38 @end
39
40 #include "common.h"
41 #include <SOGoUI/SOGoAptFormatter.h>
42 #include <SOGo/AgenorUserManager.h>
43 #include <SoObjects/Appointments/SOGoAppointmentFolder.h>
44
45 @implementation UIxCalDayListview
46
47 - (void)dealloc {
48   [self->uids       release];
49   [self->currentUid release];
50   [super dealloc];
51 }
52
53 - (void)configureFormatters {
54   [super configureFormatters];
55   
56   [self->aptFormatter setShortTitleOnly];
57 }
58
59 /* accessors */
60
61 - (NSArray *)uids {
62   if (self->uids == nil) {
63     // TODO: use -copy?
64     self->uids = [[[(SOGoAppointmentFolder *)[self clientObject] calendarUIDs]
65                      sortedArrayUsingSelector:@selector(compareAscending:)]
66                      retain];
67   }
68   return self->uids;
69 }
70
71 - (void)setCurrentUid:(id)_currentUid { // TODO: NSString?
72   ASSIGN(self->currentUid, _currentUid);
73 }
74 - (id)currentUid {
75   return self->currentUid;
76 }
77
78 - (NSString *)cnForCurrentUid {
79   return [[AgenorUserManager sharedUserManager] getCNForUID:self->currentUid];
80 }
81
82 - (NSString *)shortTextForApt {
83   if (![self canAccessApt])
84     return @"";
85   
86   return [[self appointment] valueForKey:@"title"];
87 }
88
89 - (BOOL)isRowActive {
90   AgenorUserManager *um;
91   NSString *mailChunk;
92   NSString *currentMail;
93   
94   um          = [AgenorUserManager sharedUserManager];
95   currentMail = [um getEmailForUID:self->currentUid];
96   mailChunk   = [self->appointment valueForKey:@"partmails"];
97   
98   return ([mailChunk rangeOfString:currentMail].length > 0) ? YES : NO;
99 }
100
101 @end /* UIxCalDayListview */