From 5b417518d4ba30c34a5008eedce506709b387a36 Mon Sep 17 00:00:00 2001 From: wolfgang Date: Fri, 30 Mar 2007 22:14:39 +0000 Subject: [PATCH] git-svn-id: http://svn.opengroupware.org/SOGo/inverse/trunk@1039 d1b88da0-ebda-0310-925b-ed51d893ca5b --- ChangeLog | 15 ++++++ SoObjects/Appointments/SOGoTaskObject.m | 30 ----------- SoObjects/Mailer/SOGoMailAccount.m | 25 ++++++--- UI/MailPartViewers/UIxMailPartHTMLViewer.m | 9 +++- UI/MailPartViewers/UIxMailPartICalViewer.m | 37 +++++++------ UI/MailPartViewers/UIxMailPartImageViewer.m | 22 ++++---- UI/MailerUI/UIxMailTree.h | 2 +- UI/MailerUI/UIxMailTree.m | 54 +++++++++---------- UI/MailerUI/product.plist | 3 +- .../MailPartViewers/UIxMailPartICalViewer.wox | 7 ++- UI/WebServerResources/SchedulerUI.css | 2 +- UI/WebServerResources/UIxAclEditor.css | 12 ++--- 12 files changed, 112 insertions(+), 106 deletions(-) diff --git a/ChangeLog b/ChangeLog index 4091f7b8..1f675d5f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2007-03-30 Wolfgang Sourdeau + + * SoObjects/Mailer/SOGoMailAccount.m ([SOGoMailAccount + -toManyRelationshipKeys]): don't put the predefined folders in the + list if they are returned by the server. + + * UI/MailerUI/UIxMailTree.m ([UIxMailTree -flattenedNodes]): we no + longer store the "flattenedBlocks" in a dictionary since the + object will be deleted anyway and we don't need to put the folders + in cache. + + * UI/MailPartViewers/UIxMailPartHTMLViewer.m + ([UIxMailPartHTMLViewer -_attachmentIds]): take the current + attachment path into account when computing the part urls. + 2007-03-29 Wolfgang Sourdeau * UI/Contacts/UIxContactsListViewContainer.m diff --git a/SoObjects/Appointments/SOGoTaskObject.m b/SoObjects/Appointments/SOGoTaskObject.m index 87dbef17..c364b922 100644 --- a/SoObjects/Appointments/SOGoTaskObject.m +++ b/SoObjects/Appointments/SOGoTaskObject.m @@ -504,34 +504,4 @@ static NSString *mailTemplateDefaultLanguage = nil; return @"IPM.Task"; } -/* EMail Notifications */ - -- (NSString *)homePageURLForPerson:(iCalPerson *)_person { - static AgenorUserManager *um = nil; - static NSString *baseURL = nil; - NSString *uid; - - if (!um) { - WOContext *ctx; - NSArray *traversalObjects; - - um = [[AgenorUserManager sharedUserManager] retain]; - - /* generate URL from traversal stack */ - ctx = [[WOApplication application] context]; - traversalObjects = [ctx objectTraversalStack]; - if ([traversalObjects count] >= 1) { - baseURL = [[[traversalObjects objectAtIndex:0] baseURLInContext:ctx] - retain]; - } - else { - [self warnWithFormat:@"Unable to create baseURL from context!"]; - baseURL = @"http://localhost/"; - } - } - uid = [um getUIDForEmail:[_person rfc822Email]]; - if (!uid) return nil; - return [NSString stringWithFormat:@"%@%@", baseURL, uid]; -} - @end /* SOGoTaskObject */ diff --git a/SoObjects/Mailer/SOGoMailAccount.m b/SoObjects/Mailer/SOGoMailAccount.m index 8f70346b..8a362fdd 100644 --- a/SoObjects/Mailer/SOGoMailAccount.m +++ b/SoObjects/Mailer/SOGoMailAccount.m @@ -100,12 +100,25 @@ static BOOL useAltNamespace = NO; return rootFolderNames; } -- (NSArray *)toManyRelationshipKeys { - NSArray *a, *b; - - a = [self additionalRootFolderNames]; - b = [[self imap4Connection] subfoldersForURL:[self imap4URL]]; - return [b count] > 0 ? [b arrayByAddingObjectsFromArray:a] : a; +- (NSArray *) toManyRelationshipKeys +{ + NSMutableArray *folders; + NSArray *imapFolders, *additionalFolders; + + folders = [NSMutableArray new]; + [folders autorelease]; + + imapFolders = [[self imap4Connection] subfoldersForURL: [self imap4URL]]; + additionalFolders = [self additionalRootFolderNames]; + if ([imapFolders count] > 0) + [folders addObjectsFromArray: imapFolders]; + if ([additionalFolders count] > 0) + { + [folders removeObjectsInArray: additionalFolders]; + [folders addObjectsFromArray: additionalFolders]; + } + + return folders; } /* identity */ diff --git a/UI/MailPartViewers/UIxMailPartHTMLViewer.m b/UI/MailPartViewers/UIxMailPartHTMLViewer.m index 5203d85e..3fd047fe 100644 --- a/UI/MailPartViewers/UIxMailPartHTMLViewer.m +++ b/UI/MailPartViewers/UIxMailPartHTMLViewer.m @@ -397,6 +397,7 @@ NSMutableDictionary *attachmentIds; UIxMailPartViewer *parent; unsigned int count, max; + NSMutableString *url; NSString *baseURL; NSArray *parts; @@ -408,16 +409,20 @@ isEqualToString: @"UIxMailPartAlternativeViewer"]) { baseURL = [[self clientObject] baseURLInContext: context]; + url = [NSMutableString new]; + [url appendString: baseURL]; + [url appendFormat: @"/%@", [partPath componentsJoinedByString: @"/"]]; + [url deleteCharactersInRange: NSMakeRange([url length] - 3, 2)]; parts = [[parent bodyInfo] objectForKey: @"parts"]; max = [parts count]; for (count = 0; count < max; count++) [self _convertReferencesForPart: [parts objectAtIndex: count] withCount: count + 1 - andBaseURL: baseURL + andBaseURL: url intoDictionary: attachmentIds]; + [url release]; } - NSLog(@"attc: '%@'", attachmentIds); return attachmentIds; } diff --git a/UI/MailPartViewers/UIxMailPartICalViewer.m b/UI/MailPartViewers/UIxMailPartICalViewer.m index 0cac3f1b..f8a0e549 100644 --- a/UI/MailPartViewers/UIxMailPartICalViewer.m +++ b/UI/MailPartViewers/UIxMailPartICalViewer.m @@ -135,6 +135,18 @@ return self->attendee; } +- (NSString *) _personForDisplay: (iCalPerson *) person +{ + return [NSString stringWithFormat: @"%@ <%@>", + [person cnWithoutQuotes], + [person rfc822Email]]; +} + +- (NSString *) attendeeForDisplay +{ + return [self _personForDisplay: attendee]; +} + - (void)setItem:(id)_item { ASSIGN(self->item, _item); } @@ -252,23 +264,18 @@ /* derived fields */ -- (NSString *)organizerDisplayName { +- (NSString *) organizerDisplayName +{ iCalPerson *organizer; - NSString *cn; - - if ((organizer = [[self authorativeEvent] organizer]) != nil) { - cn = [organizer valueForKey:@"cnWithoutQuotes"]; - if ([cn isNotNull] && [cn length] > 0) - return cn; - - cn = [organizer valueForKey:@"rfc822Email"]; - if ([cn isNotNull] && [cn length] > 0) - return cn; - - return @"[error: unable to derive organizer name]"; - } + NSString *value; + + organizer = [[self authorativeEvent] organizer]; + if (organizer) + value = [self _personForDisplay: organizer]; + else + value = @"[todo: no organizer set, use 'from']"; - return @"[todo: no organizer set, use 'from']"; + return value; } /* replies */ diff --git a/UI/MailPartViewers/UIxMailPartImageViewer.m b/UI/MailPartViewers/UIxMailPartImageViewer.m index deb7252e..b975a324 100644 --- a/UI/MailPartViewers/UIxMailPartImageViewer.m +++ b/UI/MailPartViewers/UIxMailPartImageViewer.m @@ -33,20 +33,22 @@ /* URLs */ -- (NSString *)pathToImage { - NSString *url; +- (NSString *) pathToImage +{ + NSMutableString *url; NSString *s; - - url = [[self clientObject] baseURLInContext:[self context]]; - if (![url hasSuffix:@"/"]) url = [url stringByAppendingString:@"/"]; + + s = [[self clientObject] baseURLInContext: [self context]]; + url = [NSMutableString stringWithString: s]; + if (![url hasSuffix: @"/"]) + [url appendString: @"/"]; s = [[self partPath] componentsJoinedByString:@"/"]; - url = [url stringByAppendingString:s]; + [url appendString: s]; - if ((s = [self preferredPathExtension]) != nil) { - url = [url stringByAppendingString:@"."]; - url = [url stringByAppendingString:s]; - } + s = [self preferredPathExtension]; + if (s) + [url appendFormat: @".%@", s]; return url; } diff --git a/UI/MailerUI/UIxMailTree.h b/UI/MailerUI/UIxMailTree.h index dcea0a40..b2c6a6af 100644 --- a/UI/MailerUI/UIxMailTree.h +++ b/UI/MailerUI/UIxMailTree.h @@ -31,7 +31,7 @@ { NSString *rootClassName; NSString *treeFolderAction; - NSMutableDictionary *flattenedNodes; + NSMutableArray *flattenedNodes; id rootNodes; id item; } diff --git a/UI/MailerUI/UIxMailTree.m b/UI/MailerUI/UIxMailTree.m index 1cb06352..0204d4fd 100644 --- a/UI/MailerUI/UIxMailTree.m +++ b/UI/MailerUI/UIxMailTree.m @@ -60,17 +60,18 @@ static BOOL debugBlocks = NO; { if ((self = [super init])) { - flattenedNodes = [NSMutableDictionary new]; + flattenedNodes = nil; } + return self; } - (void) dealloc { - [self->treeFolderAction release]; - [self->rootClassName release]; - [self->rootNodes release]; - [self->item release]; + [treeFolderAction release]; + [rootClassName release]; + [rootNodes release]; + [item release]; [flattenedNodes release]; [super dealloc]; } @@ -94,24 +95,24 @@ static BOOL debugBlocks = NO; /* accessors */ - (void)setRootClassName:(id)_rootClassName { - ASSIGNCOPY(self->rootClassName, _rootClassName); + ASSIGNCOPY(rootClassName, _rootClassName); } - (id)rootClassName { - return self->rootClassName; + return rootClassName; } - (void)setItem:(id)_item { - ASSIGN(self->item, _item); + ASSIGN(item, _item); } - (id)item { - return self->item; + return item; } - (void)setTreeFolderAction:(NSString *)_action { - ASSIGNCOPY(self->treeFolderAction, _action); + ASSIGNCOPY(treeFolderAction, _action); } - (NSString *)treeFolderAction { - return self->treeFolderAction; + return treeFolderAction; } - (NSString *)itemIconName { @@ -556,17 +557,17 @@ static BOOL debugBlocks = NO; - (NSArray *)rootNodes { UIxMailTreeBlock *navNode; - if (self->rootNodes != nil) - return self->rootNodes; + if (rootNodes != nil) + return rootNodes; navNode = [self buildNavigationNodesForObject:[self clientObject]]; if ([navNode hasChildren] && [navNode areChildrenLoaded]) - self->rootNodes = [[navNode children] retain]; + rootNodes = [[navNode children] retain]; else if (navNode) - self->rootNodes = [[NSArray alloc] initWithObjects:&navNode count:1]; + rootNodes = [[NSArray alloc] initWithObjects:&navNode count:1]; - return self->rootNodes; + return rootNodes; } - (int) addNodes: (NSArray *) nodes @@ -604,17 +605,13 @@ static BOOL debugBlocks = NO; - (NSArray *) flattenedNodes { - NSMutableArray *flattenedBlocks = nil; - NSString *userKey; UIxMailTreeBlock *rootNode; // , *curNode; id mailAccounts; // unsigned int count, max; - userKey = [[self user] login]; - flattenedBlocks = [flattenedNodes objectForKey: userKey]; - if (!flattenedBlocks) + if (!flattenedNodes) { - flattenedBlocks = [NSMutableArray new]; + flattenedNodes = [NSMutableArray new]; if (![[self clientObject] isKindOfClass: NSClassFromString(@"SOGoMailAccounts")]) mailAccounts = [[self clientObject] mailAccountsFolder]; @@ -626,9 +623,7 @@ static BOOL debugBlocks = NO; atSerial: 1 forParent: 0 withRootName: @"" - toArray: flattenedBlocks]; - - [flattenedNodes setObject: flattenedBlocks forKey: userKey]; + toArray: flattenedNodes]; // max = [flattenedBlocks count]; // for (count = 0; count < max; count++) // { @@ -637,14 +632,15 @@ static BOOL debugBlocks = NO; // } } - return flattenedBlocks; + return flattenedNodes; } /* notifications */ -- (void)sleep { - [self->item release]; self->item = nil; - [self->rootNodes release]; self->rootNodes = nil; +- (void) sleep +{ + [item release]; item = nil; + [rootNodes release]; rootNodes = nil; [super sleep]; } diff --git a/UI/MailerUI/product.plist b/UI/MailerUI/product.plist index 36638339..6a0803aa 100644 --- a/UI/MailerUI/product.plist +++ b/UI/MailerUI/product.plist @@ -1,4 +1,4 @@ -{ /* -*-cperl-*- */ +{ /* -*-javascript-*- */ requires = ( MAIN, CommonUI, Mailer ); /* , Sieve */ publicResources = ( @@ -121,7 +121,6 @@ pageName = "UIxMailListView"; actionName = "expunge"; }; - createFolder = { protectedBy = "View"; pageName = "UIxMailListView"; diff --git a/UI/Templates/MailPartViewers/UIxMailPartICalViewer.wox b/UI/Templates/MailPartViewers/UIxMailPartICalViewer.wox index 22987fc7..72a2fc92 100644 --- a/UI/Templates/MailPartViewers/UIxMailPartICalViewer.wox +++ b/UI/Templates/MailPartViewers/UIxMailPartICalViewer.wox @@ -33,7 +33,7 @@ - +

@@ -61,7 +61,7 @@

-
+ @@ -173,8 +173,7 @@ : - + ()
diff --git a/UI/WebServerResources/SchedulerUI.css b/UI/WebServerResources/SchedulerUI.css index adc757af..abc6070b 100644 --- a/UI/WebServerResources/SchedulerUI.css +++ b/UI/WebServerResources/SchedulerUI.css @@ -56,7 +56,7 @@ DIV.colorBox UL#tasksList, UL#calendarList { cursor: default; - margin: .25px; + margin: .25em; padding: 0px; overflow: auto; border-bottom: 1px solid #fff; diff --git a/UI/WebServerResources/UIxAclEditor.css b/UI/WebServerResources/UIxAclEditor.css index 3439d4af..9ed9f66c 100644 --- a/UI/WebServerResources/UIxAclEditor.css +++ b/UI/WebServerResources/UIxAclEditor.css @@ -12,13 +12,14 @@ DIV.acls UL width: 100%; } DIV#userRoles -{ height: 7em; +{ height: 8em; padding-bottom: 2em; } UL#userList { cursor: default; - margin: .25px; + margin: .25em; padding: 0px; + white-space: nowrap; overflow: auto; border-bottom: 1px solid #fff; border-right: 1px solid #fff; @@ -31,13 +32,12 @@ UL#userList list-style-image: none; } UL#userList > LI._selected -{ - background: #4b6983 !important; - color: #fff !important; -} +{ background: #4b6983 !important; + color: #fff !important; } SELECT#userRoleDropDown { visibility: hidden; + margin-top: 1em; margin-left: 2em; } SPAN.legend -- 2.39.5