From a83b2127e641728e65e62672a5aa2fe6a7a910b1 Mon Sep 17 00:00:00 2001 From: wolfgang Date: Thu, 20 Dec 2007 21:59:45 +0000 Subject: [PATCH] git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1312 d1b88da0-ebda-0310-925b-ed51d893ca5b --- ChangeLog | 6 +++ SOPE/NGCards/ChangeLog | 7 ++++ SOPE/NGCards/NGCardsSaxHandler.m | 4 +- SOPE/NGCards/NSString+NGCards.h | 3 +- SOPE/NGCards/NSString+NGCards.m | 52 ++++++++++++++++++------- SoObjects/SOGo/SOGoContentObject.m | 7 ++-- UI/Contacts/UIxContactEditor.m | 61 +++++++++++------------------- UI/Scheduler/UIxComponentEditor.m | 3 +- UI/WebServerResources/MailerUI.css | 6 ++- 9 files changed, 88 insertions(+), 61 deletions(-) diff --git a/ChangeLog b/ChangeLog index 2e2565e9..cefc413c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2007-12-20 Wolfgang Sourdeau + + * SoObjects/SOGo/SOGoContentObject.m ([SOGoContentObject + -aclsForUser:uid]): removed useless ACL checks on the current + object to reduce DB usage. + 2007-12-17 Wolfgang Sourdeau * UI/MailerUI/UIxMailEditor.m ([UIxMailEditor -attachmentNames]): diff --git a/SOPE/NGCards/ChangeLog b/SOPE/NGCards/ChangeLog index 5e6348e4..15921e0c 100644 --- a/SOPE/NGCards/ChangeLog +++ b/SOPE/NGCards/ChangeLog @@ -1,3 +1,10 @@ +2007-12-20 Wolfgang Sourdeau + + * NSString+NGCards.m ([NSString + -componentsWithSafeSeparator:separator]): new method that + separated the elements of a string into an array while avoiding + escaped instances of the separator passed as parameter. + 2007-12-12 Wolfgang Sourdeau * iCalTimeZone.m ([iCalTimeZone -periodForDate:date]): at least diff --git a/SOPE/NGCards/NGCardsSaxHandler.m b/SOPE/NGCards/NGCardsSaxHandler.m index dd939c17..f0109739 100644 --- a/SOPE/NGCards/NGCardsSaxHandler.m +++ b/SOPE/NGCards/NGCardsSaxHandler.m @@ -247,7 +247,7 @@ free (content); content = NULL; // NSLog (@"content: '%@'", s); - contentValues = [s componentsSeparatedByString: @";"]; + contentValues = [s componentsWithSafeSeparator: ';']; } else contentValues = nil; @@ -270,7 +270,7 @@ else { /* increase content */ - content = + content = realloc (content, (contentLength + _len+2) * sizeof(unichar)); memcpy (&(content[contentLength]), _chars, (_len * sizeof(unichar))); diff --git a/SOPE/NGCards/NSString+NGCards.h b/SOPE/NGCards/NSString+NGCards.h index 0311ab6b..b0ccf2d8 100644 --- a/SOPE/NGCards/NSString+NGCards.h +++ b/SOPE/NGCards/NSString+NGCards.h @@ -25,6 +25,7 @@ #import +@class NSArray; @class NSCalendarDate; @class NSTimeZone; @@ -39,7 +40,7 @@ - (NSCalendarDate *) asCalendarDate; - (BOOL) isAllDayDate; -- (NSArray *) commaSeparatedValues; +- (NSArray *) componentsWithSafeSeparator: (unichar) separator; @end diff --git a/SOPE/NGCards/NSString+NGCards.m b/SOPE/NGCards/NSString+NGCards.m index 2076e63b..2c96e2bd 100644 --- a/SOPE/NGCards/NSString+NGCards.m +++ b/SOPE/NGCards/NSString+NGCards.m @@ -261,26 +261,50 @@ static NSString *commaSeparator = nil; return ([self length] == 8); } -- (NSArray *) commaSeparatedValues +- (NSArray *) componentsWithSafeSeparator: (unichar) separator { - NSEnumerator *rawValues; - NSMutableArray *values; - NSString *currentValue, *newValue; + NSMutableArray *components; + NSRange currentRange; + unichar *stringBuffer; + unichar currentChar; + unsigned int count, length; + BOOL escaped; - values = [NSMutableArray new]; - [values autorelease]; + components = [NSMutableArray array]; + + length = [self length]; + stringBuffer = malloc (sizeof (unichar) * length); + [self getCharacters: stringBuffer]; - rawValues = [[self componentsSeparatedByString: @","] objectEnumerator]; - currentValue = [rawValues nextObject]; - while (currentValue) + currentRange = NSMakeRange(0, 0); + escaped = NO; + count = 0; + while (count < length) { - newValue = [currentValue stringByTrimmingSpaces]; - if ([newValue length]) - [values addObject: newValue]; - currentValue = [rawValues nextObject]; + if (escaped) + currentRange.length++; + else + { + currentChar = *(stringBuffer + count); + if (currentChar == '\\') + escaped = YES; + else if (currentChar == separator) + { + [components + addObject: [self substringWithRange: currentRange]]; + currentRange = NSMakeRange (count + 1, 0); + } + else + currentRange.length++; + } + count++; } + [components + addObject: [self substringWithRange: currentRange]]; - return values; + free (stringBuffer); + + return components; } @end diff --git a/SoObjects/SOGo/SOGoContentObject.m b/SoObjects/SOGo/SOGoContentObject.m index 73cc1401..9665eda9 100644 --- a/SoObjects/SOGo/SOGoContentObject.m +++ b/SoObjects/SOGo/SOGoContentObject.m @@ -393,9 +393,10 @@ NSArray *ownAcls, *containerAcls; acls = [NSMutableArray array]; - ownAcls = [container aclsForUser: uid - forObjectAtPath: [self pathArrayToSOGoObject]]; - [acls addObjectsFromArray: ownAcls]; + /* this is unused... */ +// ownAcls = [container aclsForUser: uid +// forObjectAtPath: [self pathArrayToSOGoObject]]; +// [acls addObjectsFromArray: ownAcls]; containerAcls = [container aclsForUser: uid]; if ([containerAcls count] > 0) { diff --git a/UI/Contacts/UIxContactEditor.m b/UI/Contacts/UIxContactEditor.m index 7181f47a..754b6ea7 100644 --- a/UI/Contacts/UIxContactEditor.m +++ b/UI/Contacts/UIxContactEditor.m @@ -50,7 +50,7 @@ - (void) dealloc { - [snapshot release]; + [snapshot release]; [preferredEmail release]; [super dealloc]; } @@ -88,44 +88,26 @@ /* load/store content format */ -- (void) _fixupSnapshot -{ - // TODO: perform sanity checking, eg build CN on demand - NSString *cn, *gn, *sn; - - cn = [snapshot objectForKey: @"cn"]; - gn = [snapshot objectForKey: @"givenName"]; - sn = [snapshot objectForKey: @"sn"]; - - if (![sn isNotNull] || [sn length] == 0) - sn = nil; - if (![cn isNotNull] || [cn length] == 0) - cn = nil; - - if (sn == nil) { - if (cn == nil) - sn = @"[noname]"; - else { - // TODO: need a better name parser here - NSRange r; - - r = [cn rangeOfString: @" "]; - sn = (r.length > 0) - ? [cn substringFromIndex:(r.location + r.length)] - : cn; - } - [snapshot setObject:sn forKey: @"sn"]; - } - if (sn == nil && gn == nil) - cn = @"[noname]"; - else if (sn == nil) - cn = gn; - else if (gn == nil) - cn = sn; - else - cn = [[gn stringByAppendingString: @" "] stringByAppendingString:sn]; - [snapshot setObject:cn forKey: @"cn"]; -} +// - (void) _fixupSnapshot +// { +// NSString *currentKey, *currentString; +// NSMutableString *newString; +// NSArray *keys; +// unsigned int count, max; + +// keys = [snapshot allKeys]; +// max = [keys count]; +// for (count = 0; count < max; count++) +// { +// currentKey = [keys objectAtIndex: count]; +// currentString = [snapshot objectForKey: currentKey]; +// newString = [currentString mutableCopy]; +// [newString autorelease]; +// [newString replaceString: @";" withString: @"\\;"]; +// if (![newString isEqualToString: currentString]) +// [snapshot setObject: newString forKey: currentKey]; +// } +// } /* helper */ @@ -518,6 +500,7 @@ card = [contact vCard]; if (card) { +// [self _fixupSnapshot]; [self _saveSnapshot]; [contact save]; diff --git a/UI/Scheduler/UIxComponentEditor.m b/UI/Scheduler/UIxComponentEditor.m index aa756c84..40a77b11 100644 --- a/UI/Scheduler/UIxComponentEditor.m +++ b/UI/Scheduler/UIxComponentEditor.m @@ -183,7 +183,8 @@ ASSIGN (privacy, [component accessClass]); ASSIGN (priority, [component priority]); ASSIGN (status, [component status]); - ASSIGN (categories, [[component categories] commaSeparatedValues]); + ASSIGN (categories, + [[component categories] componentsWithSafeSeparator: ',']); ASSIGN (organizer, [component organizer]); [self _loadCategories]; [self _loadAttendees]; diff --git a/UI/WebServerResources/MailerUI.css b/UI/WebServerResources/MailerUI.css index c19f0004..be7fca9b 100644 --- a/UI/WebServerResources/MailerUI.css +++ b/UI/WebServerResources/MailerUI.css @@ -540,7 +540,7 @@ TABLE#messageList TABLE#messageList TD, TABLE#messageList TH -{ height: 1.2em; +{ height: 20px; overflow: hidden; white-space: nowrap; } @@ -552,6 +552,10 @@ TABLE#messageList TD.messageFlagColumn { width: 22px; text-align: center; } +TABLE#messageList TD.messageFlagColumn IMG +{ width: 14px; + height: 14px; } + TD#subjectHeader, TABLE#messageList TD.tbtv_subject_headercell, TABLE#messageList TD.mailer_unreadmailsubject, -- 2.39.5