From 6ea7229a932b0322f4c27a23baf8f79470165d9d Mon Sep 17 00:00:00 2001 From: helge Date: Sun, 15 Aug 2004 21:49:40 +0000 Subject: [PATCH] git-svn-id: http://svn.opengroupware.org/SOGo/trunk@240 d1b88da0-ebda-0310-925b-ed51d893ca5b --- SOGo/UI/Anais/AnaisAttendeeSelector.m | 14 ++ SOGo/UI/Anais/ChangeLog | 3 + SOGo/UI/Anais/Version | 2 +- SOGo/UI/Scheduler/ChangeLog | 4 + SOGo/UI/Scheduler/UIxDatePicker.m | 111 ++++++++-------- SOGo/UI/Scheduler/UIxTimeDateControl.m | 93 +++++++------- SOGo/UI/Scheduler/UIxTimeDateControl.wox | 18 +-- SOGo/UI/Scheduler/UIxTimeSelector.m | 155 ++++++++++++----------- SOGo/UI/Scheduler/UIxTimeSelector.wox | 2 +- SOGo/UI/Scheduler/Version | 2 +- 10 files changed, 216 insertions(+), 188 deletions(-) diff --git a/SOGo/UI/Anais/AnaisAttendeeSelector.m b/SOGo/UI/Anais/AnaisAttendeeSelector.m index 4eba737d..dc7e2bcd 100644 --- a/SOGo/UI/Anais/AnaisAttendeeSelector.m +++ b/SOGo/UI/Anais/AnaisAttendeeSelector.m @@ -72,6 +72,14 @@ @implementation AnaisAttendeeSelector +static BOOL debugOn = NO; + ++ (void)initialize { + NSUserDefaults *ud = [NSUserDefaults standardUserDefaults]; + + debugOn = [ud boolForKey:@"AnaisDebugEnabled"]; +} + - (void)dealloc { [self->role release]; [self->emailForUser release]; @@ -306,4 +314,10 @@ return ms; } +/* debugging */ + +- (BOOL)isDebuggingEnabled { + return debugOn; +} + @end /* AnaisAttendeeSelector */ diff --git a/SOGo/UI/Anais/ChangeLog b/SOGo/UI/Anais/ChangeLog index c04f8f86..a3ebc9ad 100644 --- a/SOGo/UI/Anais/ChangeLog +++ b/SOGo/UI/Anais/ChangeLog @@ -1,5 +1,8 @@ 2004-08-15 Helge Hess + * AnaisAttendeeSelector.m: added AnaisDebugEnabled default to + enable/disable debug logs (v0.9.8) + * AnaisAttendeeSelector.m: added form processing code (v0.9.7) * AnaisAttendeeSelector.m: added support for default attendees (as used diff --git a/SOGo/UI/Anais/Version b/SOGo/UI/Anais/Version index 29a2806a..3a77a234 100644 --- a/SOGo/UI/Anais/Version +++ b/SOGo/UI/Anais/Version @@ -1,3 +1,3 @@ # $Id: Version 165 2004-08-05 17:55:50Z znek $ -SUBMINOR_VERSION:=7 +SUBMINOR_VERSION:=8 diff --git a/SOGo/UI/Scheduler/ChangeLog b/SOGo/UI/Scheduler/ChangeLog index 85b7f060..60b83586 100644 --- a/SOGo/UI/Scheduler/ChangeLog +++ b/SOGo/UI/Scheduler/ChangeLog @@ -1,3 +1,7 @@ +2004-08-15 Helge Hess + + * fixed time field controls (v0.9.50) + 2004-08-15 Marcus Mueller * v0.9.49 diff --git a/SOGo/UI/Scheduler/UIxDatePicker.m b/SOGo/UI/Scheduler/UIxDatePicker.m index 24528c6b..68514c10 100644 --- a/SOGo/UI/Scheduler/UIxDatePicker.m +++ b/SOGo/UI/Scheduler/UIxDatePicker.m @@ -1,7 +1,7 @@ /* - Copyright (C) 2000-2004 SKYRIX Software AG + Copyright (C) 2004 SKYRIX Software AG - This file is part of OGo + This file is part of OpenGroupware.org. OGo is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the @@ -20,15 +20,15 @@ */ // $Id$ +#include -#include - +@class NSString, NSCalendarDate; @interface UIxDatePicker : WOComponent { - NSString *dateID; - NSCalendarDate *date; - NSString *label; + NSString *dateID; + NSCalendarDate *date; + NSString *label; } - (NSString *)dateID; @@ -36,88 +36,92 @@ @end +#include "common.h" + @implementation UIxDatePicker - (void)dealloc { - [self->dateID release]; - [self->date release]; - [self->label release]; - [super dealloc]; + [self->dateID release]; + [self->date release]; + [self->label release]; + [super dealloc]; } /* Accessors */ - (void)setDateID:(NSString *)_dateID { - ASSIGN(self->dateID, _dateID); + ASSIGNCOPY(self->dateID, _dateID); } - (NSString *)dateID { - return self->dateID; + return self->dateID; } - (void)setDate:(NSCalendarDate *)_date { - ASSIGN(self->date, _date); + ASSIGN(self->date, _date); } - (NSCalendarDate *)date { - return self->date; + if (self->date == nil) /* HACK, return 'now' */ + return [NSCalendarDate date]; + return self->date; } - (void)setLabel:(NSString *)_label { - ASSIGN(self->label, _label); + ASSIGNCOPY(self->label, _label); } - (NSString *)label { - return self->label; + return self->label; } - (NSString *)formattedDateString { - return [date descriptionWithCalendarFormat:@"%Y-%m-%d"]; + return [[self date] descriptionWithCalendarFormat:@"%Y-%m-%d"]; } - (NSString *)dateFormat { - return @"yyyy-mm-dd"; + return @"yyyy-mm-dd"; } - (NSString *)calendarPageURL { - WOResourceManager *rm; - WOContext *ctx; - NSArray *languages; + WOResourceManager *rm; + WOContext *ctx; + NSArray *languages; - if ((rm = [self resourceManager]) == nil) - rm = [[WOApplication application] resourceManager]; - if (rm == nil) - [self debugWithFormat:@"WARNING: missing resource manager!"]; + if ((rm = [self resourceManager]) == nil) + rm = [[WOApplication application] resourceManager]; + if (rm == nil) + [self debugWithFormat:@"WARNING: missing resource manager!"]; - /* lookup languages */ + /* lookup languages */ - ctx = [self context]; + ctx = [self context]; #if 0 - languages = [ctx hasSession] + languages = [ctx hasSession] ? [[ctx session] languages] : [[ctx request] browserLanguages]; #else #warning !! FIX SoProduct to enable localizable resource, then disable this! - languages = nil; + languages = nil; #endif - return [rm urlForResourceNamed:@"skycalendar.html" - inFramework:nil - languages:languages - request:[ctx request]]; + return [rm urlForResourceNamed:@"skycalendar.html" + inFramework:nil + languages:languages + request:[ctx request]]; } /* JavaScript */ - (NSString *)jsPopup { - return [NSString stringWithFormat:@"javascript:calendar_%@.popup()", + return [NSString stringWithFormat:@"javascript:calendar_%@.popup()", [self dateID]]; } - (NSString *)jsCode { - static NSString *code = \ + static NSString *code = \ @"var calendar_%@ = new skycalendar(document.getElementById('%@'));\n" @"calendar_%@.setCalendarPage('%@');\n" @"calendar_%@.setDateFormat('%@');\n"; - return [NSString stringWithFormat:code, + return [NSString stringWithFormat:code, self->dateID, self->dateID, self->dateID, @@ -129,22 +133,21 @@ /* action */ - (void)takeValuesFromRequest:(WORequest *)_rq inContext:(WOContext *)_ctx { -#if 0 - NSString *dateString; - NSCalendarDate *d; - - dateString = [_rq formValueForKey:[self dateID]]; - if(!dateString) - return; - - d = [NSCalendarDate dateWithString:dateString calendarFormat:@"%Y-%m-%d"]; - if(!d) - NSLog(@"WARNING: Couldn't parse dateString '%@'", dateString); - NSLog(@"%s setting date:%@", - __PRETTY_FUNCTION__, - d); - [self setDate:d]; -#endif + NSString *dateString; + NSCalendarDate *d; + + dateString = [_rq formValueForKey:[self dateID]]; + if (dateString == nil) { + [self debugWithFormat:@"got no date string!"]; + return; + } + + d = [NSCalendarDate dateWithString:dateString calendarFormat:@"%Y-%m-%d"]; + if (d == nil) + [self logWithFormat:@"WARNING: Could not parse dateString: '%@'", + dateString]; + [self logWithFormat:@"%s setting date: %@", __PRETTY_FUNCTION__, d]; + [self setDate:d]; } -@end +@end /* UIxDatePicker */ diff --git a/SOGo/UI/Scheduler/UIxTimeDateControl.m b/SOGo/UI/Scheduler/UIxTimeDateControl.m index 9568283f..0dbbafd8 100644 --- a/SOGo/UI/Scheduler/UIxTimeDateControl.m +++ b/SOGo/UI/Scheduler/UIxTimeDateControl.m @@ -1,7 +1,7 @@ /* - Copyright (C) 2000-2004 SKYRIX Software AG + Copyright (C) 2004 SKYRIX Software AG - This file is part of OGo + This file is part of OpenGroupware.org. OGo is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the @@ -20,18 +20,16 @@ */ // $Id$ - #include - @interface UIxTimeDateControl : WOComponent { - NSString *controlID; - NSCalendarDate *date; - NSString *label; + NSString *controlID; + NSCalendarDate *date; + NSString *label; - NSCalendarDate *timeComponent; - NSCalendarDate *dateComponent; + NSCalendarDate *timeComponent; + NSCalendarDate *dateComponent; } - (NSString *)timeID; @@ -47,73 +45,78 @@ @implementation UIxTimeDateControl - (void)dealloc { - [self->controlID release]; - [self->date release]; - [self->label release]; - [self->timeComponent release]; - [self->dateComponent release]; - [super dealloc]; + [self->controlID release]; + [self->date release]; + [self->label release]; + [self->timeComponent release]; + [self->dateComponent release]; + [super dealloc]; } +/* accessors */ + - (void)setControlID:(NSString *)_controlID { - ASSIGNCOPY(self->controlID, _controlID); + ASSIGNCOPY(self->controlID, _controlID); } - (NSString *)controlID { - return self->controlID; + return self->controlID; } - (void)setDate:(NSCalendarDate *)_date { - ASSIGN(self->date, _date); - [self setTimeComponent:_date]; - [self setDateComponent:_date]; + ASSIGN(self->date, _date); + [self setTimeComponent:_date]; + [self setDateComponent:_date]; } - (NSCalendarDate *)date { - return self->date; + return self->date; } - (void)setLabel:(NSString *)_label { - ASSIGNCOPY(self->label, _label); + ASSIGNCOPY(self->label, _label); } - (NSString *)label { - return self->label; + return self->label; } - (void)setTimeComponent:(NSCalendarDate *)_timeComponent { - ASSIGN(self->timeComponent, _timeComponent); + ASSIGN(self->timeComponent, _timeComponent); } - (NSCalendarDate *)timeComponent { - return self->timeComponent; + return self->timeComponent; } - (void)setDateComponent:(NSCalendarDate *)_dateComponent { - ASSIGN(self->dateComponent, _dateComponent); + ASSIGN(self->dateComponent, _dateComponent); } - (NSCalendarDate *)dateComponent { - return self->dateComponent; + return self->dateComponent; } - (NSString *)timeID { - return [NSString stringWithFormat:@"%@_time", - [self controlID]]; + return [[self controlID] stringByAppendingString:@"_time"]; } - - (NSString *)dateID { - return [NSString stringWithFormat:@"%@_date", - [self controlID]]; + return [[self controlID] stringByAppendingString:@"_date"]; } -/* action */ +/* processing request */ - (void)takeValuesFromRequest:(WORequest *)_rq inContext:(WOContext *)_ctx { - NSCalendarDate *d; - - d = [[self dateComponent] hour:[[self timeComponent] hourOfDay] - minute:[[self timeComponent] minuteOfHour]]; - if(!d) - return; - - NSLog(@"%s newDate:%@", - __PRETTY_FUNCTION__, - d); - [self setDate:d]; + NSCalendarDate *d; + + /* call super, so that the form values are applied on the popups */ + [super takeValuesFromRequest:_rq inContext:_ctx]; + + d = [self dateComponent]; + [self logWithFormat:@"base date: %@", d]; + + d = [d hour:[[self timeComponent] hourOfDay] + minute:[[self timeComponent] minuteOfHour]]; + [self logWithFormat:@"%s newDate:%@", + __PRETTY_FUNCTION__, + d]; + + if (d == nil) + return; + [self setDate:d]; } -@end +@end /* UIxTimeDateControl */ diff --git a/SOGo/UI/Scheduler/UIxTimeDateControl.wox b/SOGo/UI/Scheduler/UIxTimeDateControl.wox index e3c70b98..3d52f3b0 100644 --- a/SOGo/UI/Scheduler/UIxTimeDateControl.wox +++ b/SOGo/UI/Scheduler/UIxTimeDateControl.wox @@ -1,17 +1,13 @@ - + - - - \ No newline at end of file + + + diff --git a/SOGo/UI/Scheduler/UIxTimeSelector.m b/SOGo/UI/Scheduler/UIxTimeSelector.m index dcba8fe6..a558990e 100644 --- a/SOGo/UI/Scheduler/UIxTimeSelector.m +++ b/SOGo/UI/Scheduler/UIxTimeSelector.m @@ -1,7 +1,7 @@ /* - Copyright (C) 2000-2004 SKYRIX Software AG + Copyright (C) 2004 SKYRIX Software AG - This file is part of OGo + This file is part of OpenGroupware.org. OGo is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the @@ -20,18 +20,18 @@ */ // $Id$ +#include -#include - +@class NSString, NSCalendarDate, NSArray; @interface UIxTimeSelector : WOComponent { - NSString *timeID; - NSCalendarDate *date; - BOOL combined; - NSString *minuteInterval; - id item; - NSArray *hours, *minutes; + NSString *timeID; + NSCalendarDate *date; + BOOL combined; + NSString *minuteInterval; + id item; + NSArray *hours, *minutes; } - (NSArray *)hours; @@ -45,118 +45,123 @@ @implementation UIxTimeSelector - (void)dealloc { - [self->timeID release]; - [self->date release]; - [self->minuteInterval release]; - [self->item release]; - [self->hours release]; - [self->minutes release]; - [super dealloc]; + [self->timeID release]; + [self->date release]; + [self->minuteInterval release]; + [self->item release]; + [self->hours release]; + [self->minutes release]; + [super dealloc]; } /* accessors */ - (void)setTimeID:(NSString *)_timeID { - ASSIGNCOPY(self->timeID, _timeID); + ASSIGNCOPY(self->timeID, _timeID); } - (NSString *)timeID { - return self->timeID; + return self->timeID; } - (void)setDate:(NSCalendarDate *)_date { - ASSIGN(self->date, _date); + ASSIGN(self->date, _date); } - (NSCalendarDate *)date { - return self->date; + if (self->date == nil) /* HACK, return 'now' */ + return [NSCalendarDate date]; + return self->date; } - (void)setMinuteInterval:(NSString *)_minuteInterval { - ASSIGNCOPY(self->minuteInterval, _minuteInterval); + ASSIGNCOPY(self->minuteInterval, _minuteInterval); } - (NSString *)minuteInterval { - if(self->minuteInterval == nil) - return @"1"; - return self->minuteInterval; + if(self->minuteInterval == nil) + return @"1"; + return self->minuteInterval; } - (void)setItem:(id)_item { - ASSIGN(self->item, _item); + ASSIGN(self->item, _item); } - (id)item { - return self->item; + return self->item; } - (NSString *)hoursName { - return [NSString stringWithFormat:@"%@_hours", - [self timeID]]; + return [[self timeID] stringByAppendingString:@"_hours"]; } - (NSString *)minutesName { - return [NSString stringWithFormat:@"%@_minutes", - [self timeID]]; + return [[self timeID] stringByAppendingString:@"_minutes"]; } - (NSArray *)hours { - if(self->hours == nil) { - NSMutableArray *values; - unsigned i, count; - - count = 24; - values = [NSMutableArray arrayWithCapacity:count]; - for(i = 0; i < count; i++) { - [values addObject:[NSNumber numberWithInt:i]]; - } - self->hours = [values retain]; - } + NSMutableArray *values; + unsigned i, count; + + if (self->hours) return self->hours; + + count = 24; + values = [NSMutableArray arrayWithCapacity:count]; + for (i = 0; i < count; i++) + [values addObject:[NSNumber numberWithInt:i]]; + + self->hours = [values copy]; + return self->hours; } - (NSArray *)minutes { - if(self->minutes == nil) { - NSMutableArray *values; - unsigned i, count, iv; - - iv = [[self minuteInterval] intValue]; - - count = 60; - values = [NSMutableArray arrayWithCapacity:count]; - for(i = 0; i < count; i += iv) { - [values addObject:[NSNumber numberWithInt:i]]; - } - self->minutes = [values retain]; - } + NSMutableArray *values; + unsigned i, count, iv; + + if (self->minutes) return self->minutes; + + iv = [[self minuteInterval] intValue]; + + count = 60; + values = [NSMutableArray arrayWithCapacity:count]; + for (i = 0; i < count; i += iv) + [values addObject:[NSNumber numberWithInt:i]]; + + self->minutes = [values copy]; + return self->minutes; } - (NSNumber *)selectedHour { - return [[self hours] objectAtIndex:[[self date] hourOfDay]]; + return [[self hours] objectAtIndex:[[self date] hourOfDay]]; } - (NSNumber *)selectedMinute { - return [[self minutes] objectAtIndex:[[self date] minuteOfHour]]; + return [[self minutes] objectAtIndex:[[self date] minuteOfHour]]; } - (NSString *)displayString { - return [NSString stringWithFormat:@"%02d", [item intValue]]; + char buf[8]; + sprintf(buf, "%02d", [item intValue]); + return [NSString stringWithCString:buf]; } - /* action */ - (void)takeValuesFromRequest:(WORequest *)_rq inContext:(WOContext *)_ctx { - NSString *h, *m; - NSCalendarDate *d; - - h = [_rq formValueForKey:[self hoursName]]; - if(!h) - return; - - m = [_rq formValueForKey:[self minutesName]]; - d = [[self date] hour:[h intValue] minute:[m intValue]]; - NSLog(@"%s setting date:%@", - __PRETTY_FUNCTION__, - d); - [self setDate:d]; -} - -@end + NSString *h, *m; + NSCalendarDate *d; + + h = [_rq formValueForKey:[self hoursName]]; + m = [_rq formValueForKey:[self minutesName]]; + + [self logWithFormat:@"got hour (%@): %@", [self hoursName], h]; + [self logWithFormat:@"got minute (%@): %@", [self minutesName], m]; + + if (h == nil) + return; + + d = [[self date] hour:[h intValue] minute:[m intValue]]; + [self logWithFormat:@"%s setting date:%@", __PRETTY_FUNCTION__, d]; + [self setDate:d]; +} + +@end /* UIxTimeSelector */ diff --git a/SOGo/UI/Scheduler/UIxTimeSelector.wox b/SOGo/UI/Scheduler/UIxTimeSelector.wox index bf4a0ce5..938bff14 100644 --- a/SOGo/UI/Scheduler/UIxTimeSelector.wox +++ b/SOGo/UI/Scheduler/UIxTimeSelector.wox @@ -17,4 +17,4 @@ displayString="displayString" selection="selectedMinute" /> - \ No newline at end of file + diff --git a/SOGo/UI/Scheduler/Version b/SOGo/UI/Scheduler/Version index e31de3a7..b838d545 100644 --- a/SOGo/UI/Scheduler/Version +++ b/SOGo/UI/Scheduler/Version @@ -1,6 +1,6 @@ # $Id$ -SUBMINOR_VERSION:=49 +SUBMINOR_VERSION:=50 # v0.9.41 requires libNGObjWeb v4.2.431 # v0.9.31 requires libWEExtensions v4.2.52 -- 2.39.5