// $Id$ #include "UIxAppointmentView.h" #include "common.h" #include @implementation UIxAppointmentView - (void)dealloc { [self->appointment release]; [self->attendee release]; [super dealloc]; } /* accessors */ - (NSString *)tabSelection { NSString *selection; selection = [self queryParameterForKey:@"tab"]; if (selection == nil) selection = @"attributes"; return selection; } - (void)setAttendee:(id)_attendee { ASSIGN(self->attendee, _attendee); } - (id)attendee { return self->attendee; } - (NSString *)attendeeEmail { NSString *s; s = [[self attendee] email]; if (![s hasPrefix:@"mailto:"]) return s; return [s substringFromIndex:7]; } /* backend */ - (SOGoAppointment *)appointment { NSString *iCalString; if (self->appointment) return self->appointment; iCalString = [[self clientObject] valueForKey:@"iCalString"]; if ([iCalString length] == 0) { [self logWithFormat:@"ERROR(%s): missing iCal string!", __PRETTY_FUNCTION__]; return nil; } self->appointment = [[SOGoAppointment alloc] initWithICalString:iCalString]; return self->appointment; } - (NSString *)formattedAptStartTime { NSCalendarDate *date; date = [[self appointment] startDate]; [date setTimeZone:[self viewTimeZone]]; return [date descriptionWithCalendarFormat:@"%A, %Y-%m-%d %H:%M %Z"]; } - (NSString *)formattedAptEndTime { NSCalendarDate *date; date = [[self appointment] endDate]; [date setTimeZone:[self viewTimeZone]]; return [date descriptionWithCalendarFormat:@"%A, %Y-%m-%d %H:%M %Z"]; } /* hrefs */ - (NSString *)attributesTabLink { return [self completeHrefForMethod:[self ownMethodName] withParameter:@"attributes" forKey:@"tab"]; } - (NSString *)participantsTabLink { return [self completeHrefForMethod:[self ownMethodName] withParameter:@"participants" forKey:@"tab"]; } - (NSString *)debugTabLink { return [self completeHrefForMethod:[self ownMethodName] withParameter:@"debug" forKey:@"tab"]; } - (NSString *)completeHrefForMethod:(NSString *)_method withParameter:(NSString *)_param forKey:(NSString *)_key { NSString *href; [self setQueryParameter:_param forKey:_key]; href = [self completeHrefForMethod:[self ownMethodName]]; [self setQueryParameter:nil forKey:_key]; return href; } @end /* UIxAppointmentView */