Monotone-Parent: fbc6d1383213a8ac4c4f695e111f58e4a468fcfc
Monotone-Revision: 4413311b33917d53e558500df415e44da781815b Monotone-Author: wsourdeau@inverse.ca Monotone-Date: 2006-10-04T19:21:45 Monotone-Branch: ca.inverse.sogo
This commit is contained in:
parent
c561dffa14
commit
421d03f9aa
|
@ -1,5 +1,8 @@
|
|||
2006-10-04 Wolfgang Sourdeau <wsourdeau@inverse.ca>
|
||||
|
||||
* UI/SOGoUI/UIxComponent.m ([UIxComponent
|
||||
-_cDateFromShortDateString:dateStringandShortTimeString:timeString]): new method to compute the selected date from the "day" and "hm" query parameters (if found). This method replaces the old algorithm that was found in the "selectedDate" method.
|
||||
|
||||
* Main/sogod.m (main): initialize the NSTimeZone's defaultTimeZone
|
||||
to the value of SOGoServerTimeZone or "Canada/Eastern" if not found.
|
||||
|
||||
|
|
|
@ -371,43 +371,92 @@ static BOOL uixDebugEnabled = NO;
|
|||
}
|
||||
|
||||
/* date */
|
||||
- (NSCalendarDate *) _cDateFromShortDateString: (NSString *) dateString
|
||||
andShortTimeString: (NSString *) timeString
|
||||
{
|
||||
unsigned int year, month, day, hour, minute, total;
|
||||
NSCalendarDate *cDate, *tmpDate;
|
||||
NSTimeZone *uTZ;
|
||||
|
||||
uTZ = [[self clientObject] userTimeZone];
|
||||
|
||||
if (dateString && [dateString length] == 8)
|
||||
{
|
||||
total = [dateString intValue];
|
||||
year = total / 10000;
|
||||
total -= year * 10000;
|
||||
month = total / 100;
|
||||
day = total - (month * 100);
|
||||
}
|
||||
else
|
||||
{
|
||||
tmpDate = [NSCalendarDate calendarDate];
|
||||
[tmpDate setTimeZone: uTZ];
|
||||
|
||||
year = [tmpDate yearOfCommonEra];
|
||||
month = [tmpDate monthOfYear];
|
||||
day = [tmpDate dayOfMonth];
|
||||
}
|
||||
|
||||
if (timeString && [timeString length] == 4)
|
||||
{
|
||||
total = [timeString intValue];
|
||||
hour = total / 100;
|
||||
minute = total = (hour * 100);
|
||||
}
|
||||
else
|
||||
{
|
||||
hour = 12;
|
||||
minute = 0;
|
||||
}
|
||||
|
||||
cDate = [NSCalendarDate dateWithYear: year month: month day: day
|
||||
hour: hour minute: minute second: 0
|
||||
timeZone: uTZ];
|
||||
|
||||
return cDate;
|
||||
}
|
||||
|
||||
- (NSCalendarDate *) selectedDate
|
||||
{
|
||||
NSString *s, *dateString;
|
||||
NSCalendarDate *cdate;
|
||||
unsigned hour, minute;
|
||||
|
||||
if (!_selectedDate)
|
||||
{
|
||||
s = [self queryParameterForKey: @"day"];
|
||||
if ([s length] > 0)
|
||||
dateString = [s stringByAppendingFormat: @" %@",
|
||||
[[[self clientObject] userTimeZone] abbreviation]];
|
||||
else
|
||||
{
|
||||
cdate = [NSCalendarDate calendarDate];
|
||||
dateString = [NSString stringWithFormat: @"%.4d%.2d%.2d %@",
|
||||
[cdate yearOfCommonEra],
|
||||
[cdate monthOfYear],
|
||||
[cdate dayOfMonth],
|
||||
[[[self clientObject] userTimeZone] abbreviation]];
|
||||
}
|
||||
|
||||
cdate = [NSCalendarDate dateWithString: dateString
|
||||
calendarFormat: @"%Y%m%d %Z"];
|
||||
s = [self queryParameterForKey: @"hm"];
|
||||
if ([s length] == 4)
|
||||
{
|
||||
hour = [[s substringToIndex: 2] unsignedIntValue];
|
||||
minute = [[s substringFromIndex: 2] unsignedIntValue];
|
||||
_selectedDate = [cdate hour: hour minute: minute];
|
||||
}
|
||||
else
|
||||
_selectedDate = [cdate hour: 12 minute: 0];
|
||||
|
||||
_selectedDate
|
||||
= [self _cDateFromShortDateString: [self queryParameterForKey: @"day"]
|
||||
andShortTimeString: [self queryParameterForKey: @"hm"]];
|
||||
[_selectedDate retain];
|
||||
}
|
||||
// s = [self queryParameterForKey: @"day"];
|
||||
|
||||
// NSLog (@"query value 'day' = '%@'", s);
|
||||
// if ([s length] > 0)
|
||||
// dateString = [s stringByAppendingFormat: @" %@",
|
||||
// [[[self clientObject] userTimeZone] abbreviation]];
|
||||
// else
|
||||
// {
|
||||
// cdate = [NSCalendarDate calendarDate];
|
||||
// dateString = [NSString stringWithFormat: @"%.4d%.2d%.2d %@",
|
||||
// [cdate yearOfCommonEra],
|
||||
// [cdate monthOfYear],
|
||||
// [cdate dayOfMonth],
|
||||
// [[[self clientObject] userTimeZone] abbreviation]];
|
||||
// }
|
||||
|
||||
// cdate = [NSCalendarDate dateWithString: dateString
|
||||
// calendarFormat: @"%Y%m%d %Z"];
|
||||
// s = [self queryParameterForKey: @"hm"];
|
||||
// NSLog (@"query value 'hm' = '%@'", s);
|
||||
// if ([s length] == 4)
|
||||
// {
|
||||
// hour = [[s substringToIndex: 2] unsignedIntValue];
|
||||
// minute = [[s substringFromIndex: 2] unsignedIntValue];
|
||||
// _selectedDate = [cdate hour: hour minute: minute];
|
||||
// }
|
||||
// else
|
||||
// _selectedDate = [cdate hour: 12 minute: 0];
|
||||
|
||||
// [_selectedDate retain];
|
||||
// }
|
||||
|
||||
return _selectedDate;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue