// $Id$
#include "UIxAppointmentView.h"
-#include "common.h"
#include <NGiCal/NGiCal.h>
#include <SOGoLogic/SOGoAppointment.h>
+#include <SOGoUI/SOGoDateFormatter.h>
+#include "common.h"
@implementation UIxAppointmentView
- (void)dealloc {
[self->appointment release];
[self->attendee release];
+ [self->dateFormatter release];
[super dealloc];
}
return self->attendee;
}
-/* backend */
-
-- (SOGoAppointment *)appointment {
- NSString *iCalString;
-
- if (self->appointment)
- return self->appointment;
-
- iCalString = [[self clientObject] valueForKey:@"iCalString"];
- if (![iCalString isNotNull] || [iCalString length] == 0) {
- [self debugWithFormat:@"ERROR(%s): missing iCal string!",
- __PRETTY_FUNCTION__];
- return nil;
- }
-
- self->appointment = [[SOGoAppointment alloc] initWithICalString:iCalString];
- return self->appointment;
+- (SOGoDateFormatter *)dateFormatter {
+ if(self->dateFormatter == nil) {
+ self->dateFormatter = \
+ [[SOGoDateFormatter alloc] initWithLocale:[self locale]];
+ [self->dateFormatter setFullWeekdayNameAndDetails];
+ }
+ return self->dateFormatter;
}
-- (NSString *)formattedAptStartTime {
+- (NSCalendarDate *)startTime {
NSCalendarDate *date;
date = [[self appointment] startDate];
[date setTimeZone:[self viewTimeZone]];
- return [date descriptionWithCalendarFormat:@"%A, %Y-%m-%d %H:%M %Z"];
+ return date;
}
-- (NSString *)formattedAptEndTime {
+- (NSCalendarDate *)endTime {
NSCalendarDate *date;
date = [[self appointment] endDate];
[date setTimeZone:[self viewTimeZone]];
- return [date descriptionWithCalendarFormat:@"%A, %Y-%m-%d %H:%M %Z"];
+ return date;
+}
+
+- (NSString *)resourcesAsString {
+ NSArray *resources, *cns;
+
+ resources = [[self appointment] resources];
+ cns = [resources valueForKey:@"cnForDisplay"];
+ return [cns componentsJoinedByString:@"<br />"];
+}
+
+
+/* backend */
+
+- (SOGoAppointment *)appointment {
+ NSString *iCalString;
+
+ if (self->appointment)
+ return self->appointment;
+
+ iCalString = [[self clientObject] valueForKey:@"iCalString"];
+ if (![iCalString isNotNull] || [iCalString length] == 0) {
+ [self debugWithFormat:@"ERROR(%s): missing iCal string!",
+ __PRETTY_FUNCTION__];
+ return nil;
+ }
+
+ self->appointment = [[SOGoAppointment alloc] initWithICalString:iCalString];
+ return self->appointment;
}