- (SOGoAppointment *)appointment;
- (NSString *)iCalStringTemplate;
- (NSString *)iCalString;
-- (BOOL)isNewAppointment;
@end
@implementation UIxAppointmentEditor
+static NSTimeZone *GMT = nil;
+
++ (void)initialize {
+ if (GMT == nil)
+ GMT = [[NSTimeZone timeZoneWithAbbreviation:@"GMT"] retain];
+}
+
- (void)dealloc {
[self->appointment release];
[self->participants release];
- (NSString *)formattedAptStartTime {
NSCalendarDate *date;
- date = [[self appointment] startDate];
- /* TODO: convert this into display timeZone! */
+ date = [[[[self appointment] startDate] copy] autorelease];
+ [date setTimeZone:[self viewTimeZone]];
return [date descriptionWithCalendarFormat:@"%A, %Y-%m-%d %H:%M %Z"];
}
/* save */
+/* returned dates are in GMT */
- (NSCalendarDate *)_dateFromString:(NSString *)_str {
- _str = [_str stringByAppendingString:@" GMT"];
- return [NSCalendarDate dateWithString:_str
- calendarFormat:@"%Y-%m-%d %H:%M %Z"];
+ NSCalendarDate *date;
+
+ date = [NSCalendarDate dateWithString:_str
+ calendarFormat:@"%Y-%m-%d %H:%M %Z"];
+ [date setTimeZone:GMT];
+ return date;
}
- (id)saveAction {
SOGoAppointment *apt;
NSString *iCalString;
- NSString *summary, *location, *nextMethod, *uri, *uriFormat;
+ NSString *summary, *location, *uri, *uriFormat;
NSCalendarDate *sd, *ed;
NSArray *ps;
unsigned i, count;
/* receive current representation for save operation */
iCalString = [apt iCalString];
[apt release]; apt = nil;
-
- /* determine what's to do and where to go next */
- if([self isNewAppointment])
- nextMethod = @"duhduh";
- else
- nextMethod = @"view";
-
+
#if 0
NSLog(@"%s new iCalString:\n%@", __PRETTY_FUNCTION__, iCalString);
#else
#endif
uriFormat = [self uriAsFormat];
- uri = [NSString stringWithFormat:uriFormat, nextMethod];
+ uri = [NSString stringWithFormat:uriFormat, @"view"];
r = [WOResponse responseWithRequest:req];
[r setStatus:302 /* moved */];