From 08589a8e3e192c965eb1c46c5e9a372a5f821d3d Mon Sep 17 00:00:00 2001 From: helge Date: Wed, 29 Sep 2004 14:49:23 +0000 Subject: [PATCH] fixed navigation support git-svn-id: http://svn.opengroupware.org/SOGo/trunk@333 d1b88da0-ebda-0310-925b-ed51d893ca5b --- SOGo/SoObjects/Mailer/ChangeLog | 6 +++ SOGo/SoObjects/Mailer/SOGoMailAccounts.m | 61 ++++++++++++++++++++++ SOGo/SoObjects/Mailer/SOGoMailBaseObject.m | 25 --------- SOGo/SoObjects/Mailer/Version | 2 +- SOGo/SoObjects/SOGo/ChangeLog | 5 ++ SOGo/SoObjects/SOGo/GNUmakefile.preamble | 6 ++- SOGo/SoObjects/SOGo/SOGoObject.h | 6 ++- SOGo/SoObjects/SOGo/SOGoObject.m | 29 ++++++++++ SOGo/SoObjects/SOGo/Version | 2 +- 9 files changed, 112 insertions(+), 30 deletions(-) diff --git a/SOGo/SoObjects/Mailer/ChangeLog b/SOGo/SoObjects/Mailer/ChangeLog index 0e6b6ad2..a09246c8 100644 --- a/SOGo/SoObjects/Mailer/ChangeLog +++ b/SOGo/SoObjects/Mailer/ChangeLog @@ -1,5 +1,11 @@ 2004-09-29 Helge Hess + * v0.9.14 + + * SOGoMailAccounts.m: added tree navigation support + + * SOGoMailBaseObject.m: moved fetchSubfolders method to SOGoObject + * SOGoMailBaseObject.m: fixed WebDAV include (v0.9.13) * v0.9.12 diff --git a/SOGo/SoObjects/Mailer/SOGoMailAccounts.m b/SOGo/SoObjects/Mailer/SOGoMailAccounts.m index 609bec96..aca3fc7f 100644 --- a/SOGo/SoObjects/Mailer/SOGoMailAccounts.m +++ b/SOGo/SoObjects/Mailer/SOGoMailAccounts.m @@ -22,6 +22,7 @@ #include "SOGoMailAccounts.h" #include "common.h" +#include @implementation SOGoMailAccounts @@ -74,10 +75,70 @@ /* tree navigation */ +- (NSString *)treeNavigationLinkAtDepth:(int)_depth { + NSString *link; + unsigned i; + + link = [[self nameInContainer] stringByAppendingString:@"/"]; + for (i = 0; i < _depth; i++) + link = [@"../" stringByAppendingString:link]; + return link; +} + +- (id)treeNavigationBlockForLeafNodeAtDepth:(int)_depth { + NSMutableDictionary *md; + + md = [NSMutableDictionary dictionaryWithCapacity:4]; + [md setObject:[self davDisplayName] forKey:@"title"]; + [md setObject:[self treeNavigationLinkAtDepth:_depth] forKey:@"link"]; + + if ([[self toManyRelationshipKeys] count] > 0) + /* trigger plus in treeview */ + [md setObject:[NSArray arrayWithObject:@"FAKE"] forKey:@"children"]; + return md; +} + +- (id)treeNavigationBlockForActiveNode { + /* this generates the block for the clientObject */ + NSMutableDictionary *md; + NSMutableArray *blocks; + NSArray *folders; + unsigned i, count; + + /* process child folders */ + + folders = [self fetchSubfolders]; + count = [folders count]; + blocks = [NSMutableArray arrayWithCapacity:count]; + for (i = 0; i < count; i++) { + id block; + + block = [[folders objectAtIndex:i] + treeNavigationBlockForLeafNodeAtDepth:0]; + if ([block isNotNull]) [blocks addObject:block]; + } + + /* build block */ + + md = [NSMutableDictionary dictionaryWithCapacity:4]; + [md setObject:[NSNumber numberWithBool:YES] forKey:@"isActiveNode"]; + [md setObject:[NSNumber numberWithBool:YES] forKey:@"isPathNode"]; + [md setObject:[self davDisplayName] forKey:@"title"]; + [md setObject:[self nameInContainer] forKey:@"name"]; + [md setObject:@"." forKey:@"link"]; + if ([blocks count] > 0) + [md setObject:blocks forKey:@"children"]; + return md; +} + - (id)treeNavigationBlockWithActiveChildBlock:(id)_activeChildBlock depth:(int)_depth { return _activeChildBlock; } +- (id)treeNavigationNodes { + return [self treeNavigationBlockForActiveNode]; +} + @end /* SOGoMailAccounts */ diff --git a/SOGo/SoObjects/Mailer/SOGoMailBaseObject.m b/SOGo/SoObjects/Mailer/SOGoMailBaseObject.m index 10a94f61..53bffb93 100644 --- a/SOGo/SoObjects/Mailer/SOGoMailBaseObject.m +++ b/SOGo/SoObjects/Mailer/SOGoMailBaseObject.m @@ -55,31 +55,6 @@ return [[self container] mailAccountFolder]; } -- (NSArray *)fetchSubfolders { - NSMutableArray *ma; - NSArray *names; - unsigned i, count; - - if ((names = [self toManyRelationshipKeys]) == nil) - return nil; - - count = [names count]; - ma = [NSMutableArray arrayWithCapacity:count + 1]; - for (i = 0; i < count; i++) { - id folder; - - folder = [self lookupName:[names objectAtIndex:i] inContext:nil - acquire:NO]; - if (folder == nil) - continue; - if ([folder isKindOfClass:[NSException class]]) - continue; - - [ma addObject:folder]; - } - return ma; -} - /* IMAP4 */ - (SOGoMailManager *)mailManager { diff --git a/SOGo/SoObjects/Mailer/Version b/SOGo/SoObjects/Mailer/Version index 92c8fa08..cc039aca 100644 --- a/SOGo/SoObjects/Mailer/Version +++ b/SOGo/SoObjects/Mailer/Version @@ -1,3 +1,3 @@ # $Id$ -SUBMINOR_VERSION:=13 +SUBMINOR_VERSION:=14 diff --git a/SOGo/SoObjects/SOGo/ChangeLog b/SOGo/SoObjects/SOGo/ChangeLog index 3d132a0d..b76017e8 100644 --- a/SOGo/SoObjects/SOGo/ChangeLog +++ b/SOGo/SoObjects/SOGo/ChangeLog @@ -1,3 +1,8 @@ +2004-09-29 Helge Hess + + * SOGoObject.m: added -fetchSubfolders method to resolve all + toManyRelationshipKeys to SOPE objects (v0.9.19) + 2004-09-20 Helge Hess * SOGoObject.m: added a default GET method which redirects to diff --git a/SOGo/SoObjects/SOGo/GNUmakefile.preamble b/SOGo/SoObjects/SOGo/GNUmakefile.preamble index 4de78edc..d1cfafc5 100644 --- a/SOGo/SoObjects/SOGo/GNUmakefile.preamble +++ b/SOGo/SoObjects/SOGo/GNUmakefile.preamble @@ -17,5 +17,7 @@ libSOGo_LIB_DIRS += \ libSOGo_LIBRARIES_DEPEND_UPON += \ -lOGoContentStore \ -lGDLAccess \ - -lEOControl \ - -lSaxObjC + -lNGObjWeb \ + -lNGMime \ + -lNGStreams -lNGExtensions -lEOControl \ + -lXmlRpc -lDOM -lSaxObjC diff --git a/SOGo/SoObjects/SOGo/SOGoObject.h b/SOGo/SoObjects/SOGo/SOGoObject.h index de2680a4..a79577a5 100644 --- a/SOGo/SoObjects/SOGo/SOGoObject.h +++ b/SOGo/SoObjects/SOGo/SOGoObject.h @@ -25,7 +25,7 @@ #import -@class NSString, NSMutableString, NSException; +@class NSString, NSArray, NSMutableString, NSException; @class OCSFolderManager, OCSFolder; @class SOGoUserFolder, SOGoGroupsFolder; @@ -53,6 +53,10 @@ - (void)sleep; +/* hierarchy */ + +- (NSArray *)fetchSubfolders; + /* operations */ - (NSException *)delete; diff --git a/SOGo/SoObjects/SOGo/SOGoObject.m b/SOGo/SoObjects/SOGo/SOGoObject.m index 889b25e1..2afabb99 100644 --- a/SOGo/SoObjects/SOGo/SOGoObject.m +++ b/SOGo/SoObjects/SOGo/SOGoObject.m @@ -64,6 +64,33 @@ return [[self container] ownerInContext:_ctx]; } +/* hierarchy */ + +- (NSArray *)fetchSubfolders { + NSMutableArray *ma; + NSArray *names; + unsigned i, count; + + if ((names = [self toManyRelationshipKeys]) == nil) + return nil; + + count = [names count]; + ma = [NSMutableArray arrayWithCapacity:count + 1]; + for (i = 0; i < count; i++) { + id folder; + + folder = [self lookupName:[names objectAtIndex:i] inContext:nil + acquire:NO]; + if (folder == nil) + continue; + if ([folder isKindOfClass:[NSException class]]) + continue; + + [ma addObject:folder]; + } + return ma; +} + /* looking up shared objects */ - (SOGoUserFolder *)lookupUserFolder { @@ -101,6 +128,8 @@ return [self nameInContainer]; } +/* actions */ + - (id)DELETEAction:(id)_ctx { return [self delete]; } diff --git a/SOGo/SoObjects/SOGo/Version b/SOGo/SoObjects/SOGo/Version index 3b031fb7..590c3a2c 100644 --- a/SOGo/SoObjects/SOGo/Version +++ b/SOGo/SoObjects/SOGo/Version @@ -1,3 +1,3 @@ # $Id: Version 170 2004-08-11 10:45:40Z helge $ -SUBMINOR_VERSION:=18 +SUBMINOR_VERSION:=19 -- 2.39.5