Show plain/calendar mail parts.
*/
-@class SOGoDateFormatter, SOGoAppointment;
-@class iCalEvent;
+@class SOGoDateFormatter;
+@class iCalEvent, iCalCalendar;
@interface UIxMailPartICalViewer : UIxMailPartViewer
{
- SOGoAppointment *appointment;
+ iCalCalendar *inCalendar;
+ iCalEvent *inEvent;
id attendee;
SOGoDateFormatter *dateFormatter;
id item;
[self->storedEvent release];
[self->attendee release];
[self->item release];
- [self->appointment release];
+ [self->inCalendar release];
+ [self->inEvent release];
[self->dateFormatter release];
[super dealloc];
}
- (void)resetPathCaches {
[super resetPathCaches];
- [self->appointment release]; self->appointment = nil;
+ [self->inEvent release]; self->inEvent = nil;
+ [self->inCalendar release]; self->inCalendar = nil;
[self->storedEventObject release]; self->storedEventObject = nil;
[self->storedEvent release]; self->storedEvent = nil;
/* accessors */
-- (SOGoAppointment *)appointment {
+- (iCalCalendar *)inCalendar {
NSString *iCalString;
-
- if (self->appointment != nil)
- return self->appointment;
+
+ if (self->inCalendar != nil)
+ return [self->inCalendar isNotNull] ? self->inCalendar : nil;
iCalString = [self flatContentAsString];
- self->appointment = [[SOGoAppointment alloc] initWithICalString:iCalString];
- return self->appointment;
+ self->inCalendar =
+ [[iCalCalendar parseCalendarFromSource:iCalString] retain];
+ if (self->inCalendar == nil) {
+ [self warnWithFormat:@"Could not parse a vcalendar string."];
+ self->inCalendar = [[NSNull null] retain];
+ return nil;
+ }
+ else
+ return self->inCalendar;
+}
+- (BOOL)couldParseCalendar {
+ return [[self inCalendar] isNotNull];
+}
+
+- (iCalEvent *)inEvent {
+ NSArray *events;
+
+ if (self->inEvent != nil)
+ return [self->inEvent isNotNull] ? self->inEvent : nil;
+
+ events = [[self inCalendar] events];
+ if ([events count] > 0) {
+ self->inEvent = [[events objectAtIndex:0] retain];
+ return self->inEvent;
+ }
+ else {
+ self->inEvent = [[NSNull null] retain];
+ return nil;
+ }
}
/* formatters */
- (NSCalendarDate *)startTime {
NSCalendarDate *date;
-
- date = [[self appointment] startDate];
+
+ date = [[self inEvent] startDate];
[date setTimeZone:[self viewTimeZone]];
return date;
}
- (NSCalendarDate *)endTime {
NSCalendarDate *date;
- date = [[self appointment] endDate];
+ date = [[self inEvent] endDate];
[date setTimeZone:[self viewTimeZone]];
return date;
}
else {
NSString *filename;
- filename = [calendar resourceNameForEventUID:[[self appointment] uid]];
+ filename = [calendar resourceNameForEventUID:[[self inEvent] uid]];
if (filename != nil) {
// TODO: When we get an exception, this might be an auth issue meaning
// that the UID indeed exists but that the user has no access to
return [[self storedEvent] isOrganizer:loginEMail];
}
- return [[self appointment] isOrganizer:loginEMail];
+ return [[self inEvent] isOrganizer:loginEMail];
}
- (BOOL)isLoggedInUserAnAttendee {
return [[self storedEvent] isParticipant:loginEMail];
}
- return [[self appointment] isParticipant:loginEMail];
+ return [[self inEvent] isParticipant:loginEMail];
}
@end /* UIxMailPartICalViewer */
>
<!-- TODO: add iMIP actions -->
- <div class="linked_attachment_body">
- <var:string label:value="Appointment"/>:
- <var:string value="appointment.summary" /><br />
-
- Method: <var:string value="appointment.method" /><br/>
+ <fieldset>
+ <legend>
+ <var:string label:value="Appointment"/>:
+ <var:string value="inEvent.summary" />
+ </legend>
+
+ Method: <var:string value="inCalendar.method" /><br/>
TODO: Storage:
<var:if condition="isEventStoredInCalendar">
</var:if>
<br />
- <div class="linked_attachment_meta">
+ <div class="linked_attachment_meta" style="background-color: white;">
<table border="0" class="linked_attachment_meta">
<tr>
<td><var:string label:value="Time"/>:</td>
<tr>
<td><var:string label:value="Organizer"/>:</td>
<td>
- <var:string value="appointment.organizer.cnForDisplay" />
- (<a var:href="appointment.organizer.email"
- ><var:string value="appointment.organizer.rfc822Email" /></a>),
+ <a var:href="inEvent.organizer.email"
+ ><var:string value="inEvent.organizer.cnForDisplay" /></a>
</td>
</tr>
<tr>
<td valign="top"><var:string label:value="Attendees"/>:</td>
<td>
- <var:foreach list="appointment.participants" item="attendee">
+ <var:foreach list="inEvent.participants" item="attendee">
<a var:href="attendee.email"
><var:string value="attendee.cnForDisplay" /></a>
(<var:string value="attendee.partStat" />)
</tr>
<tr>
- <td><var:string label:value="Comment"/>:</td>
+ <td valign="top"><var:string label:value="User Comment"/>:</td>
+ <td>
+ <var:string value="inEvent.userComment" const:insertBR="1" />
+ </td>
+ </tr>
+
+ <tr> <!-- description in iCal -->
+ <td valign="top"><var:string label:value="Comment"/>:</td>
<td>
- <var:string value="appointment.comment" const:insertBR="1" />
+ <var:string value="inEvent.comment" const:insertBR="1" />
</td>
</tr>
</table>
</div>
- </div>
+ </fieldset>
<!--
<var:string value="appointment" />